Class ImageUrl
- Namespace
- TcgDex.Models
- Assembly
- TcgDex.CSharpSdk.dll
Builds asset URLs from the base URLs the API returns.
public static class ImageUrlInheritance
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
baseUrlstring?-
The base URL from the API, without an extension.
qualityImageQuality-
The resolution to request.
formatImageFormat-
The file format to request.
Returns
- string?
-
The full asset URL, or null when
baseUrlis 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
baseUrlstring?-
The base URL from the API, without an extension.
formatImageFormat-
The file format to request.
Returns
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.