Class CloudAssetProvider
A class that provides cloud assets.
Asset Manager Contributor
role.
Inherited Members
Namespace: Unity.Cloud.Assets
Syntax
public class CloudAssetProvider : IAssetProvider
Constructors
CloudAssetProvider(IServiceHttpClient, IServiceHostResolver, AssetServiceConfiguration)
Initializes and returns an instance of CloudAssetProvider
Declaration
public CloudAssetProvider(IServiceHttpClient serviceHttpClient, IServiceHostResolver serviceHostResolver, AssetServiceConfiguration assetServiceConfiguration)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | serviceHttpClient | The IServiceHttpClient used to fetch the data. |
IServiceHostResolver | serviceHostResolver | The IServiceHostResolver object. |
AssetServiceConfiguration | assetServiceConfiguration | The asset service configuration object. |
Examples
var httpClient = new UnityHttpClient();
var serviceHostResolver = UnityRuntimeServiceHostResolverFactory.Create();
var playerSettings = UnityCloudPlayerSettings.Instance;
var platformSupport = PlatformSupportFactory.GetAuthenticationPlatformSupport();
var compositeAuthenticatorSettings = new CompositeAuthenticatorSettingsBuilder(httpClient, platformSupport, serviceHostResolver)
.AddDefaultPkceAuthenticator(playerSettings)
.Build();
var authenticator = new CompositeAuthenticator(compositeAuthenticatorSettings);
var serviceHttpClient = new ServiceHttpClient(httpClient, authenticator, playerSettings);
var assetServiceConfiguration = new AssetServiceConfiguration(true);
m_AssetProvider = new CloudAssetProvider(serviceHttpClient, serviceHostResolver, assetServiceConfiguration);
Properties
Name
The name of the provider.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
String |
Implements
Methods
AggregateAsync(IAssetSearchFilter, AggregationParameters, CancellationToken)
Implement this method to get a count of assets that satisfy the search criteria.
Declaration
public Task<Aggregation> AggregateAsync(IAssetSearchFilter assetSearchFilter, AggregationParameters parameters, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IAssetSearchFilter | assetSearchFilter | The object containing the parameters for the asset search. |
AggregationParameters | parameters | The object containing the necessary information for aggregation. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task<Aggregation> | A task whose result is a count of assets that satisfy the |
Implements
AggregateAsync(IOrganization, IEnumerable<IProject>, IAssetSearchFilter, AggregationParameters, CancellationToken)
Implement this method to get a count of assets across specified projects that satisfy the search criteria.
Declaration
public Task<Aggregation> AggregateAsync(IOrganization organization, IEnumerable<IProject> projects, IAssetSearchFilter assetSearchFilter, AggregationParameters parameters, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IOrganization | organization | The organization in which the projects are. |
IEnumerable<IProject> | projects | The id of the projects in which to search. |
IAssetSearchFilter | assetSearchFilter | The object containing the parameters for the asset search. |
AggregationParameters | parameters | The object containing the necessary information for aggregation. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task<Aggregation> | A task whose result is a count of assets that satisfy the |
Implements
GetAssetAsync(IProject, String, Int32, CancellationToken)
Implement this method to get a single IAsset.
Declaration
public async Task<IAsset> GetAssetAsync(IProject project, string assetId, int assetVersion, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IProject | project | The id of the project the |
String | assetId | The id of the asset to retrieve. |
Int32 | assetVersion | The version number of the asset. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task<IAsset> | A task whose result is the requested IAsset. |
Implements
GetAssetAsync<TAsset>(IProject, String, Int32, CancellationToken)
Implement this method to get a single asset of type TAsset
.
Declaration
public Task<TAsset> GetAssetAsync<TAsset>(IProject project, string assetId, int assetVersion, CancellationToken token)
where TAsset : IAsset, new()
Parameters
Type | Name | Description |
---|---|---|
IProject | project | The id of the project the |
String | assetId | The id of the asset to retrieve. |
Int32 | assetVersion | The version number of the asset. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task<TAsset> | A task whose result is the requested IAsset. |
Type Parameters
Name | Description |
---|---|
TAsset | A type which inherits from IAsset. |
Implements
SearchAsync(IAssetSearchFilter, Pagination, CancellationToken)
Implement this method to get a collection of assets that satisfy the search criteria.
Declaration
public IAsyncEnumerable<IAsset> SearchAsync(IAssetSearchFilter assetSearchFilter, Pagination pagination, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IAssetSearchFilter | assetSearchFilter | The object containing the parameters for the asset search. |
Pagination | pagination | An object containing the necessary information return a range of IAsset matching the search criteria. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IAsset> | A task whose result is an async enumeration of IAsset. |
Implements
SearchAsync(IOrganization, IEnumerable<IProject>, IAssetSearchFilter, Pagination, CancellationToken)
Implement this method to get a collection of assets across specified projects that satisfy the search criteria.
Declaration
public IAsyncEnumerable<IAsset> SearchAsync(IOrganization organization, IEnumerable<IProject> projects, IAssetSearchFilter assetSearchFilter, Pagination pagination, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IOrganization | organization | The organization in which the projects are. |
IEnumerable<IProject> | projects | The id of the projects in which to search. |
IAssetSearchFilter | assetSearchFilter | The object containing the parameters for the asset search. |
Pagination | pagination | An object containing the necessary information return a range of IAsset matching the search criteria. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IAsset> | A task whose result is an async enumeration of IAsset. |
Implements
SearchAsync<TAsset>(IAssetSearchFilter, Pagination, CancellationToken)
Implement this method to get a collection of assets that satisfy the search criteria.
Declaration
public IAsyncEnumerable<TAsset> SearchAsync<TAsset>(IAssetSearchFilter assetSearchFilter, Pagination pagination, CancellationToken token)
where TAsset : IAsset, new()
Parameters
Type | Name | Description |
---|---|---|
IAssetSearchFilter | assetSearchFilter | The object containing the parameters for the asset search. |
Pagination | pagination | An object containing the necessary information return a range of IAsset matching the search criteria. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TAsset> | A task whose result is an async enumeration of IAsset. |
Type Parameters
Name | Description |
---|---|
TAsset | A type which inherits from IAsset. |
Implements
SearchAsync<TAsset>(IOrganization, IEnumerable<IProject>, IAssetSearchFilter, Pagination, CancellationToken)
Implement this method to get a collection of assets across specified projects that satisfy the search criteria.
Declaration
public IAsyncEnumerable<TAsset> SearchAsync<TAsset>(IOrganization organization, IEnumerable<IProject> projects, IAssetSearchFilter assetSearchFilter, Pagination pagination, CancellationToken token)
where TAsset : IAsset, new()
Parameters
Type | Name | Description |
---|---|---|
IOrganization | organization | The organization in which the projects are. |
IEnumerable<IProject> | projects | The id of the projects in which to search. |
IAssetSearchFilter | assetSearchFilter | The object containing the parameters for the asset search. |
Pagination | pagination | An object containing the necessary information return a range of IAsset matching the search criteria. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TAsset> | A task whose result is an async enumeration of IAsset. |
Type Parameters
Name | Description |
---|---|
TAsset | A type which inherits from IAsset. |