Interface IAssetProvider
An interface that provides all the methods to fetch an IAsset.
Namespace: Unity.Cloud.Assets
Syntax
public interface IAssetProvider
Properties
Name
The name of the provider.
Declaration
string Name { get; set; }
Property Value
Type | Description |
---|---|
String |
Methods
AggregateAsync(IAssetSearchFilter, AggregationParameters, CancellationToken)
Implement this method to get a count of assets that satisfy the search criteria.
Declaration
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 |
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
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 |
GetAssetAsync(IProject, String, Int32, CancellationToken)
Implement this method to get a single IAsset.
Declaration
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. |
Examples
async Task<IAsset> GetAsset(IProject project, string assetId, int assetVersion, CancellationToken cancellationToken)
{
var asset = await m_AssetProvider.GetAssetAsync(project, assetId, assetVersion, cancellationToken);
return asset;
}
GetAssetAsync<TAsset>(IProject, String, Int32, CancellationToken)
Implement this method to get a single asset of type TAsset
.
Declaration
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. |
Examples
async Task<Asset> GetAsset_GenericType(IProject project, string assetId, int assetVersion, CancellationToken cancellationToken)
{
var asset = await m_AssetProvider.GetAssetAsync<Asset>(project, assetId, assetVersion, cancellationToken);
return asset;
}
SearchAsync(IAssetSearchFilter, Pagination, CancellationToken)
Implement this method to get a collection of assets that satisfy the search criteria.
Declaration
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. |
Examples
IAsyncEnumerable<IAsset> SearchForAssets(IProject project, string assetName, CancellationToken cancellationToken)
{
var assetSearchFilter = new AssetSearchFilter(project);
assetSearchFilter.Name.Include(assetName);
var pagination = new Pagination(nameof(IAsset.VersionName), Range.All);
var assets = m_AssetProvider.SearchAsync(assetSearchFilter, pagination, cancellationToken);
return assets;
}
IAsyncEnumerable<IAsset> SearchForAssets(IOrganization organization, IEnumerable<IProject> projects, string assetName, CancellationToken cancellationToken)
{
var assetSearchFilter = new AssetSearchFilter(null);
assetSearchFilter.Name.Include(assetName);
var pagination = new Pagination(nameof(IAsset.VersionName), Range.All);
var assets = m_AssetProvider.SearchAsync(organization, projects, assetSearchFilter, pagination, cancellationToken);
return assets;
}
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
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. |
Examples
IAsyncEnumerable<IAsset> SearchForAssets(IProject project, string assetName, CancellationToken cancellationToken)
{
var assetSearchFilter = new AssetSearchFilter(project);
assetSearchFilter.Name.Include(assetName);
var pagination = new Pagination(nameof(IAsset.VersionName), Range.All);
var assets = m_AssetProvider.SearchAsync(assetSearchFilter, pagination, cancellationToken);
return assets;
}
IAsyncEnumerable<IAsset> SearchForAssets(IOrganization organization, IEnumerable<IProject> projects, string assetName, CancellationToken cancellationToken)
{
var assetSearchFilter = new AssetSearchFilter(null);
assetSearchFilter.Name.Include(assetName);
var pagination = new Pagination(nameof(IAsset.VersionName), Range.All);
var assets = m_AssetProvider.SearchAsync(organization, projects, assetSearchFilter, pagination, cancellationToken);
return assets;
}
SearchAsync<TAsset>(IAssetSearchFilter, Pagination, CancellationToken)
Implement this method to get a collection of assets that satisfy the search criteria.
Declaration
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. |
Examples
IAsyncEnumerable<IAsset> SearchForAssets_GenericType(IProject project, string assetName, CancellationToken cancellationToken)
{
var assetSearchFilter = new AssetSearchFilter(project);
assetSearchFilter.Name.Include(assetName);
var pagination = new Pagination(nameof(IAsset.VersionName), Range.All);
var assets = m_AssetProvider.SearchAsync<Asset>(assetSearchFilter, pagination, cancellationToken);
return assets;
}
IAsyncEnumerable<IAsset> SearchForAssets_GenericType(IOrganization organization, IEnumerable<IProject> projects,string assetName, CancellationToken cancellationToken)
{
var assetSearchFilter = new AssetSearchFilter(null);
assetSearchFilter.Name.Include(assetName);
var pagination = new Pagination(nameof(IAsset.VersionName), Range.All);
var assets = m_AssetProvider.SearchAsync<Asset>(organization, projects, assetSearchFilter, pagination, cancellationToken);
return assets;
}
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
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. |
Examples
IAsyncEnumerable<IAsset> SearchForAssets_GenericType(IProject project, string assetName, CancellationToken cancellationToken)
{
var assetSearchFilter = new AssetSearchFilter(project);
assetSearchFilter.Name.Include(assetName);
var pagination = new Pagination(nameof(IAsset.VersionName), Range.All);
var assets = m_AssetProvider.SearchAsync<Asset>(assetSearchFilter, pagination, cancellationToken);
return assets;
}
IAsyncEnumerable<IAsset> SearchForAssets_GenericType(IOrganization organization, IEnumerable<IProject> projects,string assetName, CancellationToken cancellationToken)
{
var assetSearchFilter = new AssetSearchFilter(null);
assetSearchFilter.Name.Include(assetName);
var pagination = new Pagination(nameof(IAsset.VersionName), Range.All);
var assets = m_AssetProvider.SearchAsync<Asset>(organization, projects, assetSearchFilter, pagination, cancellationToken);
return assets;
}