Interface IAssetCollectionManager
An interface that provides the methods to interact with an IAssetCollection.
Namespace: Unity.Cloud.Assets
Syntax
public interface IAssetCollectionManager
Methods
CreateCollectionAsync(IOrganization, IProject, IAssetCollection, CancellationToken)
Creates a new IAssetCollection at the specified path. in an IProject.
Declaration
Task<CollectionPath> CreateCollectionAsync(IOrganization organization, IProject project, IAssetCollection assetCollection, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IOrganization | organization | The organization in which the |
IProject | project | The project in which the collection will reside. It must exist within the |
IAssetCollection | assetCollection | The collection to commit to the cloud. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task<CollectionPath> | A task whose result is the path to the new collection within the |
Examples
async Task<string> CreateCollection(IOrganization organization, IProject project, CancellationToken cancellationToken)
{
var assetCollection = new AssetCollection("My Collection", "A description of my collection.");
var collectionPath = await m_AssetCollectionManager.CreateCollectionAsync(organization, project, assetCollection, cancellationToken);
return collectionPath;
}
Exceptions
Type | Condition |
---|---|
ArgumentNullException | This exception is thrown if the IAssetCollection has invalid members. |
DeleteCollectionAsync(IAssetCollection, CancellationToken)
Deletes the IAssetCollection at the specified path from an IProject.
Declaration
Task DeleteCollectionAsync(IAssetCollection assetCollection, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IAssetCollection | assetCollection | The collection to remove from the cloud. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task | A task with no result. |
Examples
async Task DeleteCollection(IAssetCollection assetCollection, CancellationToken cancellationToken)
{
await m_AssetCollectionManager.DeleteCollectionAsync(assetCollection, cancellationToken);
}
GetCollectionAsync(IOrganization, IProject, CollectionPath, CancellationToken)
Gets an IAssetCollection in an IProject.
Declaration
Task<IAssetCollection> GetCollectionAsync(IOrganization organization, IProject project, CollectionPath collectionPath, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IOrganization | organization | The organization in which the |
IProject | project | The project in which the collection resides. It must exist within the |
CollectionPath | collectionPath | The path to a collection. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task<IAssetCollection> | A task whose result is the IAssetCollection at path |
Examples
InsertAssetsToCollectionAsync(IOrganization, IProject, CollectionPath, IEnumerable<IAsset>, CancellationToken)
Implement this method to insert assets into a collection in an IProject.
Declaration
Task InsertAssetsToCollectionAsync(IOrganization organization, IProject project, CollectionPath collectionPath, IEnumerable<IAsset> assets, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IOrganization | organization | The organization the |
IProject | project | The project the collection belongs to. |
CollectionPath | collectionPath | The path to the collection to be modified. |
IEnumerable<IAsset> | assets | The assets to add. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task | A task with no result. |
Examples
async Task CollectionInsert(IAssetCollection assetCollection, CancellationToken cancellationToken, params IAsset[] assets)
{
await m_AssetCollectionManager.InsertAssetsToCollectionAsync(assetCollection, assets, cancellationToken);
}
ListCollectionsAsync(IOrganization, IProject, CancellationToken)
Gets the collections in an IProject.
Declaration
Task<IAssetCollection[]> ListCollectionsAsync(IOrganization organization, IProject project, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IOrganization | organization | |
IProject | project | |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task<IAssetCollection[]> | A task whose result is an array of collections. |
Examples
async Task<IAssetCollection[]> ListCollections(IOrganization organization, IProject project, CancellationToken cancellationToken)
{
var collections = await m_AssetCollectionManager.ListCollectionsAsync(organization, project, cancellationToken);
return collections;
}
MoveCollectionToNewPathAsync(IAssetCollection, CollectionPath, CancellationToken)
Implement this method to move a collection in an IProject to a new path.
Declaration
Task<string> MoveCollectionToNewPathAsync(IAssetCollection assetCollection, CollectionPath newCollectionPath, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IAssetCollection | assetCollection | |
CollectionPath | newCollectionPath | |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task<String> | A task whose result is the new path to the collection. |
Examples
async Task MoveCollection(IAssetCollection assetCollection, CollectionPath newCollectionPath, CancellationToken cancellationToken)
{
await m_AssetCollectionManager.MoveCollectionToNewPathAsync(assetCollection, newCollectionPath, cancellationToken);
}
RemoveAssetsFromCollectionAsync(IOrganization, IProject, CollectionPath, IEnumerable<IAsset>, CancellationToken)
Implement this method to remove assets from a collection in an IProject.
Declaration
Task RemoveAssetsFromCollectionAsync(IOrganization organization, IProject project, CollectionPath collectionPath, IEnumerable<IAsset> assets, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IOrganization | organization | The organization the |
IProject | project | The project the collection belongs to. |
CollectionPath | collectionPath | The path to the collection to modified. |
IEnumerable<IAsset> | assets | The assets to remove. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task | A task with no result. |
Examples
async Task CollectionRemove(IAssetCollection assetCollection, CancellationToken cancellationToken, params IAsset[] assets)
{
await m_AssetCollectionManager.RemoveAssetsFromCollectionAsync(assetCollection, assets, cancellationToken);
}
UpdateCollectionAsync(IAssetCollection, CancellationToken)
Updates an IAssetCollection in an IProject.
Declaration
Task UpdateCollectionAsync(IAssetCollection assetCollection, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IAssetCollection | assetCollection | The collection to commit to the cloud. |
CancellationToken | token | The cancellation token |
Returns
Type | Description |
---|---|
Task | A task with no result. |
Examples
async Task UpdateCollection(IAssetCollection assetCollection, CancellationToken cancellationToken)
{
assetCollection.SetName("A new name");
assetCollection.SetDescription("A new description");
await m_AssetCollectionManager.UpdateCollectionAsync(assetCollection, cancellationToken);
}