Class AssetExtensions
Inherited Members
Namespace: Unity.Cloud.Assets
Assembly: Unity.Cloud.Assets.dll
Syntax
public static class AssetExtensions
Methods
AddReferenceAsync(IAsset, AssetDescriptor, CancellationToken)
Creates a reference between the asset and another asset, where the asset is the source of the reference.
Declaration
public static Task<IAssetReference> AddReferenceAsync(this IAsset asset, AssetDescriptor targetAssetDescriptor, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsset | asset | An asset. |
AssetDescriptor | targetAssetDescriptor | The descriptor of the asset which is a target. |
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task<IAssetReference> | A task whose result is the reference between the assets. |
AddTagsAsync(IAsset, IEnumerable<string>, CancellationToken)
Adds the specified tags to the asset if they are not already present.
Declaration
public static Task AddTagsAsync(this IAsset asset, IEnumerable<string> tagsToAdd, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsset | asset | An asset. |
IEnumerable<string> | tagsToAdd | A set of tags to add. |
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task | A task with no result. |
GetPreviewDatasetAsync(IAsset, CancellationToken)
Returns the Preview dataset for the asset.
Declaration
public static Task<IDataset> GetPreviewDatasetAsync(this IAsset asset, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsset | asset | The asset to query. |
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task<IDataset> | A task whose result is an IDataset. |
GetSourceDatasetAsync(IAsset, CancellationToken)
Returns the Source dataset for the asset.
Declaration
public static Task<IDataset> GetSourceDatasetAsync(this IAsset asset, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsset | asset | The asset to query. |
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task<IDataset> | A task whose result is an IDataset. |
RemoveTagsAsync(IAsset, IEnumerable<string>, CancellationToken)
Removes all instances of the specified tags from the asset.
Declaration
public static Task RemoveTagsAsync(this IAsset asset, IEnumerable<string> tagsToRemove, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsset | asset | An asset. |
IEnumerable<string> | tagsToRemove | A set of tags to remove. |
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task | A task with no result. |
WithLatestVersionAsync(IAsset, CancellationToken)
Returns the latest version of the asset.
Declaration
public static Task<IAsset> WithLatestVersionAsync(this IAsset asset, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsset | asset | The asset to query. |
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task<IAsset> | A task whose result is an IAsset. |
WithVersionAsync(IAsset, int, CancellationToken)
Returns the version of the asset with the specified sequence number.
Declaration
public static Task<IAsset> WithVersionAsync(this IAsset asset, int frozenSequenceNumber, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsset | asset | The asset to query. |
int | frozenSequenceNumber | The sequence number of the version of the asset to fetch. |
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task<IAsset> | A task whose result is the IAsset with the frozen version attributed to the specified sequence number. |
Exceptions
Type | Condition |
---|---|
NotFoundException | If a version with the corresponding |