Skip to content

RemoteCatalogProviderBase

ClassAssetInventoryAssetInventory.Editor
public abstract class RemoteCatalogProviderBase : IRemoteCatalogProvider, IRemoteCatalogAccessProbe

Provides HTTPS catalog transport with cancellation, bounded responses and optional caller-owned HTTP clients.

protected RemoteCatalogProviderBase(HttpClient client = null)

Uses the supplied HTTP client without taking ownership, or creates an owned client with a 45-second request timeout.

Parameters

Name Type
client System.Net.Http.HttpClient

FetchAsync(RemoteCatalogRequest, CancellationToken)

Section titled “FetchAsync(RemoteCatalogRequest, CancellationToken)”
public abstract Task<RemoteCatalogPage> FetchAsync(RemoteCatalogRequest request, CancellationToken cancellationToken)

Fetches one normalized catalog page for the request's query, snapshot context and continuation cursor.

Parameters

Name Type
request AssetInventory.RemoteCatalogRequest
cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task{AssetInventory.RemoteCatalogPage}

GetVariantsAsync(string, RemoteCatalogRequest, CancellationToken)

Section titled “GetVariantsAsync(string, RemoteCatalogRequest, CancellationToken)”
public abstract Task<IReadOnlyList<RemoteDownloadVariant>> GetVariantsAsync(string itemId, RemoteCatalogRequest request, CancellationToken cancellationToken)

Resolves an item's available download manifests using the supplied revision, edition and access context.

Parameters

Name Type
itemId System.String
request AssetInventory.RemoteCatalogRequest
cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task{System.Collections.Generic.IReadOnlyList{AssetInventory.RemoteDownloadVariant}}

CheckAccessAsync(RemoteCatalogRequest, CancellationToken)

Section titled “CheckAccessAsync(RemoteCatalogRequest, CancellationToken)”
public virtual Task<RemoteCatalogAccessResult> CheckAccessAsync(RemoteCatalogRequest request, CancellationToken cancellationToken)

Checks metadata reachability by fetching a page; the default implementation does not claim credential validation.

Parameters

Name Type
request AssetInventory.RemoteCatalogRequest
cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task{AssetInventory.RemoteCatalogAccessResult}

GetJsonAsync(string, CancellationToken, IDictionary<string, string>)

Section titled “GetJsonAsync(string, CancellationToken, IDictionary<string, string>)”
protected Task<JToken> GetJsonAsync(string url, CancellationToken cancellationToken, IDictionary<string, string> headers = null)

Fetches and parses an HTTPS JSON response using provider response limits and optional request headers.

Parameters

Name Type
url System.String
cancellationToken System.Threading.CancellationToken
headers System.Collections.Generic.IDictionary{System.String,System.String}

Returns

System.Threading.Tasks.Task{Newtonsoft.Json.Linq.JToken}

PostFormJsonAsync(string, IEnumerable<KeyValuePair<string, string>>, CancellationToken)

Section titled “PostFormJsonAsync(string, IEnumerable<KeyValuePair<string, string>>, CancellationToken)”
protected Task<JToken> PostFormJsonAsync(string url, IEnumerable<KeyValuePair<string, string>> form, CancellationToken cancellationToken)

Posts form fields and parses the JSON response, with the same deadline and size limits as GET requests.

Parameters

Name Type
url System.String
form System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{System.String,System.String}}
cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task{Newtonsoft.Json.Linq.JToken}

ReadJsonAsync(string, Action, CancellationToken)

Section titled “ReadJsonAsync(string, Action, CancellationToken)”
protected Task<string> ReadJsonAsync(string url, Action<JsonReader> read, CancellationToken cancellationToken)

Hands a JSON response to a reader while it arrives and returns the absolute address of the next page that its Link header announces, or null. Nothing of the response is kept, so listings of hundreds of thousands of entries leave little garbage behind.

Parameters

Name Type
url System.String
read System.Action{Newtonsoft.Json.JsonReader}
cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task{System.String}

GetTextAsync(string, CancellationToken, IDictionary<string, string>)

Section titled “GetTextAsync(string, CancellationToken, IDictionary<string, string>)”
protected Task<string> GetTextAsync(string url, CancellationToken cancellationToken, IDictionary<string, string> headers = null)

Fetches an HTTPS response as UTF-8 text, honoring cancellation, configured response limits and optional request headers.

Parameters

Name Type
url System.String
cancellationToken System.Threading.CancellationToken
headers System.Collections.Generic.IDictionary{System.String,System.String}

Returns

System.Threading.Tasks.Task{System.String}

public void Dispose()

Disposes the HTTP client only when this provider created and owns it.

protected virtual int MaximumResponseBytes { get; }

Returns

System.Int32

public abstract string Id { get; }

Returns

System.String