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
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 |
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
AssignLabelsAsync(IEnumerable<string>, CancellationToken)
Adds labels to this 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
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. |
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. |
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. |
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. |
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 this 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(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
[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 this 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 this 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 this 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. |