Interface IFile
Namespace: Unity.Cloud.Assets
Assembly: Unity.Cloud.Assets.dll
Syntax
public interface IFile
Properties
AuthoringInfo
The authoring info of the file.
Declaration
[Obsolete("Use the FileProperties.AuthoringInfo instead.")]
AuthoringInfo AuthoringInfo { get; }
Property Value
Type | Description |
---|---|
AuthoringInfo |
CacheConfiguration
The caching configuration for the dataset.
Declaration
FileCacheConfiguration CacheConfiguration { get; }
Property Value
Type | Description |
---|---|
FileCacheConfiguration |
Description
The description of the file.
Declaration
[Obsolete("Use the FileProperties.Description instead.")]
string Description { get; }
Property Value
Type | Description |
---|---|
string |
Descriptor
The descriptor of the file.
Declaration
FileDescriptor Descriptor { get; }
Property Value
Type | Description |
---|---|
FileDescriptor |
LinkedDatasets
The datasets the file is linked to.
Declaration
[Obsolete("Use the FileProperties.LinkedDatasets instead.")]
IEnumerable<DatasetDescriptor> LinkedDatasets { get; }
Property Value
Type | Description |
---|---|
IEnumerable<DatasetDescriptor> |
Metadata
The metadata of the file.
Declaration
IMetadataContainer Metadata { get; }
Property Value
Type | Description |
---|---|
IMetadataContainer |
SizeBytes
The size of the file in bytes.
Declaration
[Obsolete("Use the FileProperties.SizeBytes instead.")]
long SizeBytes { get; }
Property Value
Type | Description |
---|---|
long |
Status
The status of the file. Possible values are: 'Draft' - The file is created, upload may be in progress. 'Uploaded' - All bytes have been uploaded and the file is finalized.
Declaration
[Obsolete("Use the FileProperties.StatusName instead.")]
string Status { get; }
Property Value
Type | Description |
---|---|
string |
SystemMetadata
The system metadata of the file.
Declaration
IReadOnlyMetadataContainer SystemMetadata { get; }
Property Value
Type | Description |
---|---|
IReadOnlyMetadataContainer |
SystemTags
The system tags of the file.
Declaration
[Obsolete("Use the FileProperties.SystemTags instead.")]
IEnumerable<string> SystemTags { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
Tags
The tags of the file.
Declaration
[Obsolete("Use the FileProperties.Tags instead.")]
IEnumerable<string> Tags { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
UserChecksum
The checksum of the file.
Declaration
[Obsolete("Use the FileProperties.UserChecksum instead.")]
string UserChecksum { get; }
Property Value
Type | Description |
---|---|
string |
Methods
DownloadAsync(Stream, IProgress<HttpProgress>, CancellationToken)
Downloads the file to the specified stream.
Declaration
Task DownloadAsync(Stream targetStream, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Stream | targetStream | The stream in which to download the file. |
IProgress<HttpProgress> | progress | The progress of the download. |
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task | A task with no result. |
GenerateSuggestedTagsAsync(CancellationToken)
Generates tag suggestions for the image file. Accepted formats are: JPEG, PNG, GIF, TIFF, and WebP.
Declaration
Task<IEnumerable<GeneratedTag>> GenerateSuggestedTagsAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task<IEnumerable<GeneratedTag>> | A task whose result is an enumeration of GeneratedTag. |
GetDownloadUrlAsync(CancellationToken)
Returns the download URL for the file.
Declaration
Task<Uri> GetDownloadUrlAsync(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 the download url of the file. |
GetLinkedDatasetsAsync(Range, CancellationToken)
Returns the datasets that are linked to this file.
Declaration
[Obsolete("Use FileProperties.LinkedDatasetIds instead, and get each IDataset from the IAssetRepository.")]
IAsyncEnumerable<IDataset> GetLinkedDatasetsAsync(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. |
GetPreviewUrlAsync(CancellationToken)
Returns the preview URL for the file.
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 the preview url of the file. |
GetPropertiesAsync(CancellationToken)
Returns the properties of the file.
Declaration
Task<FileProperties> GetPropertiesAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task<FileProperties> | A task whose result is the FileProperties of the dataset. |
GetResizedImageDownloadUrlAsync(int, CancellationToken)
Returns the download URL for the file, resized to maxDimension
if it is an image.
Declaration
Task<Uri> GetResizedImageDownloadUrlAsync(int maxDimension, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
int | maxDimension | The maximum width or height of the image (whichever is larger), while maintaining the same aspect ratio. |
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task<Uri> | A task whose result is the download url of the file. |
RefreshAsync(CancellationToken)
Refreshes the file 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. |
UpdateAsync(IFileUpdate, CancellationToken)
Updates the file.
Declaration
Task UpdateAsync(IFileUpdate fileUpdate, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IFileUpdate | fileUpdate | The object containing the necessary information to update the file. |
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 if the version of the asset is unfrozen.
Exceptions
Type | Condition |
---|---|
InvalidArgumentException | If this version of the asset is frozen, because it cannot be modified. |
UploadAsync(Stream, IProgress<HttpProgress>, CancellationToken)
Uploads the file from the specified stream.
Declaration
Task UploadAsync(Stream sourceStream, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Stream | sourceStream | The stream from which to upload the file. |
IProgress<HttpProgress> | progress | The progress of the upload. |
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 if the version of the asset is unfrozen.
Exceptions
Type | Condition |
---|---|
InvalidArgumentException | If this version of the asset is frozen, because it cannot be modified. |
WithCacheConfigurationAsync(FileCacheConfiguration, CancellationToken)
Returns a file configured with the specified caching configuration.
Declaration
Task<IFile> WithCacheConfigurationAsync(FileCacheConfiguration fileConfiguration, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
FileCacheConfiguration | fileConfiguration | The caching configuration for 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 with cached values specified by the caching configurations. |
WithDataset(DatasetDescriptor)
Returns a file in the context of the specified dataset.
Declaration
[Obsolete("Use WithDatasetAsync instead.")]
IFile WithDataset(DatasetDescriptor datasetDescriptor)
Parameters
Type | Name | Description |
---|---|---|
DatasetDescriptor | datasetDescriptor | The descriptor of the dataset. |
Returns
Type | Description |
---|---|
IFile | A copy of the current file with a different dataset parent. |
WithDatasetAsync(DatasetDescriptor, CancellationToken)
Returns a file in the context of the specified dataset.
Declaration
Task<IFile> WithDatasetAsync(DatasetDescriptor datasetDescriptor, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
DatasetDescriptor | datasetDescriptor | The descriptor of the dataset. |
CancellationToken | cancellationToken | A token that can be used to cancel the request. |
Returns
Type | Description |
---|---|
Task<IFile> | A task whose result is the file with the specified dataset partent. |