Class CloudAssetCollectionManager
A class that provides the methods to interact with an IAssetCollection.
Inherited Members
Namespace: Unity.Cloud.Assets
Syntax
public class CloudAssetCollectionManager : IAssetCollectionManager
Constructors
CloudAssetCollectionManager(IServiceHttpClient, IServiceHostResolver)
Initializes and returns an instance of CloudAssetCollectionManager
Declaration
public CloudAssetCollectionManager(IServiceHttpClient serviceHttpClient, IServiceHostResolver serviceHostResolver)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceHttpClient | serviceHttpClient | The IServiceHttpClient used to fetch the data. |
| IServiceHostResolver | serviceHostResolver | The IServiceHostResolver 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);
m_AssetCollectionManager = new CloudAssetCollectionManager(serviceHttpClient, serviceHostResolver);
Methods
CreateCollectionAsync(IProject, IAssetCollection, CancellationToken)
Creates a new IAssetCollection at the specified path. in an IProject.
Declaration
public Task<CollectionPath> CreateCollectionAsync(IProject project, IAssetCollection assetCollection, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| IProject | project | The project in which the collection will reside. |
| 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 |
Implements
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
public 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. |
Implements
GetCollectionAsync(IProject, CollectionPath, CancellationToken)
Gets an IAssetCollection in an IProject.
Declaration
public Task<IAssetCollection> GetCollectionAsync(IProject project, CollectionPath collectionPath, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| IProject | project | The project in which the collection resides. |
| 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 |
Implements
InsertAssetsToCollectionAsync(IProject, CollectionPath, IEnumerable<IAsset>, CancellationToken)
Implement this method to insert assets into a collection in an IProject.
Declaration
public Task InsertAssetsToCollectionAsync(IProject project, CollectionPath collectionPath, IEnumerable<IAsset> assets, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| 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. |
Implements
ListCollectionsAsync(IProject, CancellationToken)
Gets the collections in an IProject.
Declaration
public Task<IAssetCollection[]> ListCollectionsAsync(IProject project, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| IProject | project | The project in which the collections reside. |
| CancellationToken | token | The cancellation token |
Returns
| Type | Description |
|---|---|
| Task<IAssetCollection[]> | A task whose result is an array of collections. |
Implements
MoveCollectionToNewPathAsync(IAssetCollection, CollectionPath, CancellationToken)
Implement this method to move a collection in an IProject to a new path.
Declaration
public 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. |
Implements
RemoveAssetsFromCollectionAsync(IProject, CollectionPath, IEnumerable<IAsset>, CancellationToken)
Implement this method to remove assets from a collection in an IProject.
Declaration
public Task RemoveAssetsFromCollectionAsync(IProject project, CollectionPath collectionPath, IEnumerable<IAsset> assets, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| 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. |
Implements
UpdateCollectionAsync(IAssetCollection, CancellationToken)
Updates an IAssetCollection in an IProject.
Declaration
public 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. |