Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 927 Bytes

render-url.md

File metadata and controls

24 lines (19 loc) · 927 Bytes
uid title
Guides.RenderUrl
Using RenderUrl

Using RenderUrl

The RenderUrl is a custom struct that makes it easier to download assets from the Guild Wars 2 render service. All web API properties that are URLs, are automatically converted to RenderUrls. The difference is best explained with an example:

// Assuming you already have a client

// Normal
var item = await client.WebApi.V2.Items.GetAsync(64240);
var icon = await client.Render.DownloadToByteArrayAsync(item.Icon);

// RenderUrl
var item = await client.WebApi.V2.Items.GetAsync(64240);
var icon = await item.Icon.DownloadToByteArrayAsync();

It doesn't save you many characters, but it does make it more intuitive, because you don't have to explicitly use the Render client yourself. Instead, you can pass along the model you got from the API, and still download the icon somewhere else without even knowing that the Render client exists.