Table of Contents

Class ImageUrl

Namespace
TcgDex.Models
Assembly
TcgDex.CSharpSdk.dll

Builds asset URLs from the base URLs the API returns.

public static class ImageUrl

Inheritance

Inherited Members

Remarks

TcgDex.Models.Card.Image, TcgDex.Models.SetBrief.Logo and TcgDex.Models.SetBrief.Symbol are base URLs without a file extension; requesting one directly returns 404. The quality and format have to be appended, and these methods do it without the caller hand-assembling strings or guessing at the accepted values.

Methods

Build(string?, ImageQuality, ImageFormat)

Builds a card artwork URL at a given quality and format.

public static string? Build(string? baseUrl, ImageQuality quality = ImageQuality.High, ImageFormat format = ImageFormat.Png)

Parameters

baseUrl string?

The base URL from the API, without an extension.

quality ImageQuality

The resolution to request.

format ImageFormat

The file format to request.

Returns

string?

The full asset URL, or null when baseUrl is null or blank — some cards genuinely have no artwork on record.

Remarks

Card artwork is addressed as {base}/{quality}.{format}. Set logos and symbols are not — see TcgDex.Models.ImageUrl.BuildAsset(System.String,TcgDex.Models.ImageFormat).

BuildAsset(string?, ImageFormat)

Builds a set logo or symbol URL.

public static string? BuildAsset(string? baseUrl, ImageFormat format = ImageFormat.Png)

Parameters

baseUrl string?

The base URL from the API, without an extension.

format ImageFormat

The file format to request.

Returns

string?

The full asset URL, or null when there is no base URL.

Remarks

Logos and symbols are addressed as {base}.{format} — with no quality segment. Applying the card pattern to them returns 404, which is an easy mistake to make since all three fields look alike on the model.