Interface IAsset
An interface containing the information about an asset.
Namespace: Unity.Cloud.Assets
Assembly: Unity.Cloud.Assets.dll
Syntax
public interface IAsset
Properties
AuthoringInfo
The creation and update information of the asset.
Declaration
AuthoringInfo AuthoringInfo { get; }
Property Value
Type | Description |
---|---|
AuthoringInfo |
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 |
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 |
PreviewFile
The preview file ID of the asset.
Declaration
string PreviewFile { get; }
Property Value
Type | Description |
---|---|
string |
SourceProject
The source project of the asset.
Declaration
ProjectDescriptor SourceProject { get; }
Property Value
Type | Description |
---|---|
ProjectDescriptor |
Status
The status of the asset.
Declaration
string Status { get; }
Property Value
Type | Description |
---|---|
string |
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
CreateDatasetAsync(DatasetCreation, CancellationToken)
Returns a IDataset with the specified creation information.
Declaration
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. |
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
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. |
LinkToProjectAsync(ProjectDescriptor, CancellationToken)
Creates a reference between an asset and the project.
Declaration
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. |
Examples
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
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. |
RefreshAsync(CancellationToken)
Refreshes the asset with the specified fields.
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. |
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. |
UnlinkFromProjectAsync(ProjectDescriptor, CancellationToken)
Removes the reference between an asset and the project.
Declaration
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. |
Examples
UpdateAsync(IAssetUpdate, CancellationToken)
Updates the asset.
Declaration
Task UpdateAsync(IAssetUpdate assetUpdate, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAssetUpdate | assetUpdate | The object containing the asset information to update. |
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task | A task with no result. |
UpdateStatusAsync(AssetStatusAction, CancellationToken)
Updates the asset's status.
Declaration
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
IAsset WithProject(ProjectDescriptor projectDescriptor)
Parameters
Type | Name | Description |
---|---|---|
ProjectDescriptor | projectDescriptor | The descriptor of the project. |
Returns
Type | Description |
---|---|
IAsset |