Interface IAsset
An interface containing the information about an asset.
Namespace: Unity.Cloud.Assets
Assembly: Unity.Cloud.Assets.dll
Syntax
public interface IAsset
Properties
ArchivedLabels
The labels no longer associated to the asset version.
Declaration
IEnumerable<LabelDescriptor> ArchivedLabels { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<LabelDescriptor> |
AuthoringInfo
The creation and update information of the asset.
Declaration
AuthoringInfo AuthoringInfo { get; }
Property Value
| Type | Description |
|---|---|
| AuthoringInfo |
Changelog
The change log of the asset version.
Declaration
string Changelog { get; }
Property Value
| Type | Description |
|---|---|
| string |
Description
The description of the asset.
Declaration
string Description { get; }
Property Value
| Type | Description |
|---|---|
| string |
Descriptor
The descriptor of the asset.
Declaration
AssetDescriptor Descriptor { get; }
Property Value
| Type | Description |
|---|---|
| AssetDescriptor |
FrozenSequenceNumber
The sequence number of the asset. This will only be populated if the version is frozen.
Declaration
int FrozenSequenceNumber { get; }
Property Value
| Type | Description |
|---|---|
| int |
IsFrozen
Whether the asset version is frozen.
Declaration
bool IsFrozen { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Labels
The labels associated to the asset version.
Declaration
IEnumerable<LabelDescriptor> Labels { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<LabelDescriptor> |
LinkedProjects
The list of projects the asset is linked to.
Declaration
IEnumerable<ProjectDescriptor> LinkedProjects { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<ProjectDescriptor> |
Metadata
The searchable metadata of the asset.
Declaration
IMetadataContainer Metadata { get; }
Property Value
| Type | Description |
|---|---|
| IMetadataContainer |
Name
The name of the asset.
Declaration
string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
ParentFrozenSequenceNumber
The sequence number from which this version was branched.
Declaration
int ParentFrozenSequenceNumber { get; }
Property Value
| Type | Description |
|---|---|
| int |
ParentVersion
The version id from which this version was branched.
Declaration
AssetVersion ParentVersion { get; }
Property Value
| Type | Description |
|---|---|
| AssetVersion |
PreviewFile
The preview file ID of the asset.
Declaration
[Obsolete("Use PreviewFileDescriptor instead.")]
string PreviewFile { get; }
Property Value
| Type | Description |
|---|---|
| string |
PreviewFileDescriptor
The descriptor for the preview file of the asset.
Declaration
FileDescriptor PreviewFileDescriptor { get; }
Property Value
| Type | Description |
|---|---|
| FileDescriptor |
SourceProject
The source project of the asset.
Declaration
ProjectDescriptor SourceProject { get; }
Property Value
| Type | Description |
|---|---|
| ProjectDescriptor |
Status
The status of the asset.
Declaration
[Obsolete("Use StatusName instead.")]
string Status { get; }
Property Value
| Type | Description |
|---|---|
| string |
StatusFlowDescriptor
The descriptor for the status flow of the asset.
Declaration
StatusFlowDescriptor StatusFlowDescriptor { get; }
Property Value
| Type | Description |
|---|---|
| StatusFlowDescriptor |
StatusName
The status of the asset.
Declaration
string StatusName { get; }
Property Value
| Type | Description |
|---|---|
| string |
SystemMetadata
The system metadata of the asset.
Declaration
IReadOnlyMetadataContainer SystemMetadata { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyMetadataContainer |
SystemTags
The tags of the asset.
Declaration
IEnumerable<string> SystemTags { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<string> |
Tags
The tags of the asset.
Declaration
IEnumerable<string> Tags { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<string> |
Type
The type of the asset.
Declaration
AssetType Type { get; }
Property Value
| Type | Description |
|---|---|
| AssetType |
Methods
AddReferenceAsync(AssetId, string, CancellationToken)
Creates a reference between the asset and another asset, where the asset is the source of the reference.
Declaration
Task<IAssetReference> AddReferenceAsync(AssetId targetAssetId, string targetLabel, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetId | targetAssetId | The id of the asset. |
| string | targetLabel | The label associated to the asset version. |
| 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. |
AddReferenceAsync(AssetId, AssetVersion, CancellationToken)
Creates a reference between the asset and another asset, where the asset is the source of the reference.
Declaration
Task<IAssetReference> AddReferenceAsync(AssetId targetAssetId, AssetVersion targetAssetVersion, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetId | targetAssetId | The id of the asset. |
| AssetVersion | targetAssetVersion | The version of the asset. |
| 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. |
AssignLabelsAsync(IEnumerable<string>, CancellationToken)
Adds labels to the asset.
Declaration
Task AssignLabelsAsync(IEnumerable<string> labels, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<string> | labels | The collection of labels to add. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task | A task with no result. |
CreateDatasetAsync(DatasetCreation, CancellationToken)
Returns a IDataset with the specified creation information.
Declaration
[Obsolete("Use CreateDatasetAsync(IDatasetCreation, CancellationToken) instead.")]
Task<IDataset> CreateDatasetAsync(DatasetCreation datasetCreation, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DatasetCreation | datasetCreation | The object containing the necessary information to create a dataset. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task<IDataset> | A task whose result is the newly created dataset. |
Remarks
Can only be called on a version that is not frozen.
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | If the asset is frozen, because it cannot be modified. |
CreateDatasetAsync(IDatasetCreation, CancellationToken)
Returns a IDataset with the specified creation information.
Declaration
Task<IDataset> CreateDatasetAsync(IDatasetCreation datasetCreation, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| IDatasetCreation | datasetCreation | The object containing the necessary information to create a dataset. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task<IDataset> | A task whose result is the newly created dataset. |
Remarks
Can only be called on a version that is not frozen.
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | If the asset is frozen, because it cannot be modified. |
CreateUnfrozenVersionAsync(CancellationToken)
Creates a new unfrozen version of the asset.
Declaration
Task<IAsset> CreateUnfrozenVersionAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task<IAsset> | A task whose result is a new version of the asset. |
Remarks
Can only be called if the version is frozen; this version will be the parent of the new version.
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | If the asset is unfrozen, because it cannot be used as a parent for a new version. |
FreezeAsync(string, CancellationToken)
Submits the asset to freeze the current version.
Declaration
Task<int> FreezeAsync(string changeLog, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | changeLog | The change log for the new version. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task<int> | A task whose result is a frozen sequence number. |
Remarks
Can only be called on a version that is not frozen.
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | If the asset is frozen, because it cannot be re-submitted. |
GetAssetDownloadUrlsAsync(CancellationToken)
Returns the download URLs for the asset's files.
Declaration
Task<IDictionary<string, Uri>> GetAssetDownloadUrlsAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task<IDictionary<string, Uri>> | A task whose result is the download URLs for all the asset's files and attachments. |
GetDatasetAsync(DatasetId, CancellationToken)
Retrieves the specified IDataset.
Declaration
Task<IDataset> GetDatasetAsync(DatasetId datasetId, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DatasetId | datasetId | The id of the dataset. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task<IDataset> | A task whose result is the requested dataset. |
GetFileAsync(string, CancellationToken)
Retrieves the specified IFile.
Declaration
[Obsolete("Use IDataset.GetFileAsync instead.")]
Task<IFile> GetFileAsync(string filePath, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | The id of the file |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task<IFile> | A task whose result is an IFile. |
GetLinkedProjectsAsync(CancellationToken)
Returns an enumeration of the asset's linked IAssetProject.
Declaration
IAsyncEnumerable<IAssetProject> GetLinkedProjectsAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<IAssetProject> | A task whose result is an async enumeration of IAssetProject. |
GetPreviewUrlAsync(CancellationToken)
Returns the url to the preview image of the asset.
Declaration
Task<Uri> GetPreviewUrlAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task<Uri> | A task whose result is downloadble url pointing to the preview image. |
GetReachableStatusNamesAsync(CancellationToken)
Returns a set of reachable statuses from the current status.
Declaration
Task<string[]> GetReachableStatusNamesAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task<string[]> | A task whose result is an array of status names. |
LinkToProjectAsync(ProjectDescriptor, CancellationToken)
Creates a reference between an asset and the project.
Declaration
[Obsolete("Use IAssetProject.LinkAssetsAsync instead.")]
Task LinkToProjectAsync(ProjectDescriptor projectDescriptor, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| ProjectDescriptor | projectDescriptor | The descriptor of the project to link to. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task | A task with no result. |
ListDatasetsAsync(Range, CancellationToken)
Retrieves all the IDataset.
Declaration
IAsyncEnumerable<IDataset> ListDatasetsAsync(Range range, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Range | range | The range of datasets to return. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<IDataset> | A task whose result is an async enumeration of datasets. |
ListFilesAsync(Range, CancellationToken)
Retrieves all the IFiles for the asset.
Declaration
[Obsolete("Use IDataset.ListFilesAsync instead.")]
IAsyncEnumerable<IFile> ListFilesAsync(Range range, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Range | range | |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<IFile> | A task whose result is an async enumeration of IFile referenced by the asset. |
ListLinkedAssetCollectionsAsync(Range, CancellationToken)
Returns the IAssetCollection the asset belongs too.
Declaration
IAsyncEnumerable<CollectionDescriptor> ListLinkedAssetCollectionsAsync(Range range, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Range | range | The range of collections to return. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<CollectionDescriptor> | An async enumeration of IAssetCollection. |
ListReferencesAsync(Range, CancellationToken)
Returns references to the asset.
Declaration
IAsyncEnumerable<IAssetReference> ListReferencesAsync(Range range, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Range | range | The range of results to return. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<IAssetReference> | An async enumeration of IAssetReference. |
QueryLabels()
Returns an object that can be used to query asset labels across versions.
Declaration
AssetLabelQueryBuilder QueryLabels()
Returns
| Type | Description |
|---|---|
| AssetLabelQueryBuilder |
QueryVersions()
Returns an object that can be used to query the asset's versions.
Declaration
VersionQueryBuilder QueryVersions()
Returns
| Type | Description |
|---|---|
| VersionQueryBuilder |
RefreshAsync(CancellationToken)
Fetches the latest changes.
Declaration
Task RefreshAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task | A task with no result. |
RemoveReferenceAsync(string, CancellationToken)
Removes a reference between the asset and another asset. The asset can be either the source or the target.
Declaration
Task RemoveReferenceAsync(string referenceId, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | referenceId | The id of the reference between the assets. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task | A task with no result. |
Serialize()
Returns a JSON string of the asset.
Declaration
string Serialize()
Returns
| Type | Description |
|---|---|
| string | The asset serialized as a JSON string. |
Remarks
To deserialize the asset use DeserializeAsset(string). The IAssetRepository is responsible for injecting the necessary dependencies into the asset.
SerializeIdentifiers()
Returns a JSON serialized string of the asset's identifiers.
Declaration
[Obsolete("Use Descriptor.ToJson() instead.")]
string SerializeIdentifiers()
Returns
| Type | Description |
|---|---|
| string | The serialized identifiers of the asset. |
UnassignLabelsAsync(IEnumerable<string>, CancellationToken)
Remove labels from the asset.
Declaration
Task UnassignLabelsAsync(IEnumerable<string> labels, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<string> | labels | The collection of labels to remove. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task | A task with no result. |
UnlinkFromProjectAsync(ProjectDescriptor, CancellationToken)
Removes the reference between an asset and the project.
Declaration
[Obsolete("Use IAssetProject.UnlinkAssetsAsync instead.")]
Task UnlinkFromProjectAsync(ProjectDescriptor projectDescriptor, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| ProjectDescriptor | projectDescriptor | The descriptor of the project to unlink from. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task | A task with no result. |
UpdateAsync(IAssetUpdate, CancellationToken)
Updates the asset.
Declaration
Task UpdateAsync(IAssetUpdate assetUpdate, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| IAssetUpdate | assetUpdate | The object containing information to update this version of the asset. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task | A task with no result. |
Remarks
Can only be called on a version that is not frozen.
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | If the asset is frozen, because it cannot be modified. |
UpdateStatusAsync(string, CancellationToken)
Updates the asset's status.
Declaration
Task UpdateStatusAsync(string statusName, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | statusName | The name of the status. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task | A task with no result. |
Remarks
The status of an asset can be updated whether an asset is frozen or unfrozen. However, note that the reachable statuses may vary based on the state of the asset.
UpdateStatusAsync(AssetStatusAction, CancellationToken)
Updates the asset's status.
Declaration
[Obsolete("Use UpdateStatus(string, CancellationToken) instead.")]
Task UpdateStatusAsync(AssetStatusAction statusAction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetStatusAction | statusAction | The new status of the asset. |
| CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task | A task with no result. |
WithProject(ProjectDescriptor)
Returns an asset in the context of the specified project.
Declaration
[Obsolete("Use WithProjectAsync instead.")]
IAsset WithProject(ProjectDescriptor projectDescriptor)
Parameters
| Type | Name | Description |
|---|---|---|
| ProjectDescriptor | projectDescriptor | The descriptor of the project. |
Returns
| Type | Description |
|---|---|
| IAsset | A copy of the asset with a different parent project. |
WithProjectAsync(ProjectDescriptor, CancellationToken)
Changes the path of the asset to the specified project.
Declaration
Task<IAsset> WithProjectAsync(ProjectDescriptor projectDescriptor, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| ProjectDescriptor | projectDescriptor | The descriptor of the project. |
| 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 specified project path. |
WithVersionAsync(string, CancellationToken)
Switches the asset to the specified version.
Declaration
Task<IAsset> WithVersionAsync(string label, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | The label associated to the version of the asset. |
| 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 version attributed to the specified label. |
WithVersionAsync(AssetVersion, CancellationToken)
Switches the asset to the specified version.
Declaration
Task<IAsset> WithVersionAsync(AssetVersion assetVersion, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetVersion | assetVersion | 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 specified version. |