Class File
This class provides access to Kinvey's File API.
Inheritance
Namespace: Kinvey
Assembly: Kinvey.dll
Syntax
public class File : object
Constructors
| Improve this Doc View SourceFile(AbstractClient)
Initializes a new instance of the
Declaration
public File(AbstractClient client = null)
Parameters
Type | Name | Description |
---|---|---|
AbstractClient | client | [optional] Client (default set to SharedClient). |
Methods
| Improve this Doc View SourceClearCustomRequestProperties()
Clears the currently saved custom request properties.
Declaration
public void ClearCustomRequestProperties()
delete(String, CancellationToken)
Delete the specified file.
Declaration
public Task<KinveyDeleteResponse> delete(string fileId, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileId | The _id of the file to delete. |
CancellationToken | ct | [optional] The cancellation token. If cancellation is requested, an OperationCancelledException will be thrown. |
Returns
Type | Description |
---|---|
Task<KinveyDeleteResponse> |
downloadAsync(FileMetaData, Stream, CancellationToken)
Declaration
public Task<FileMetaData> downloadAsync(FileMetaData metadata, Stream content, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
FileMetaData | metadata | |
Stream | content | |
CancellationToken | ct |
Returns
Type | Description |
---|---|
Task<FileMetaData> |
DownloadAsync(FileMetaData, Stream, CancellationToken)
Download the File associated with the id of the provided metadata. The file is streamed into the stream, with delegates returning either errors or the FileMetaData from Kinvey.
Declaration
public Task<FileMetaData> DownloadAsync(FileMetaData metadata, Stream content, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
FileMetaData | metadata | The FileMetaData representing the file to download. This must contain an id. |
Stream | content | Where the contents of the file will be streamed. |
CancellationToken | ct | [optional] The cancellation token. If cancellation is requested, an OperationCancelledException will be thrown. |
Returns
Type | Description |
---|---|
Task<FileMetaData> |
downloadAsync(FileMetaData, Byte[], CancellationToken)
Declaration
public Task<FileMetaData> downloadAsync(FileMetaData metadata, byte[] content, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
FileMetaData | metadata | |
System.Byte[] | content | |
CancellationToken | ct |
Returns
Type | Description |
---|---|
Task<FileMetaData> |
DownloadAsync(FileMetaData, Byte[], CancellationToken)
Download the File associated with the id of the provided metadata. The file is copied into the byte[], with delegates returning either errors or the FileMetaData from Kinvey.
Declaration
public Task<FileMetaData> DownloadAsync(FileMetaData metadata, byte[] content, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
FileMetaData | metadata | The FileMetaData representing the file to download. This must contain an id. |
System.Byte[] | content | Content. |
CancellationToken | ct | [optional] The cancellation token. If cancellation is requested, an OperationCancelledException will be thrown. |
Returns
Type | Description |
---|---|
Task<FileMetaData> |
downloadMetadataAsync(String, CancellationToken)
Downloads the metadata of a File, without actually downloading the file.
Declaration
public Task<FileMetaData> downloadMetadataAsync(string fileId, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileId | The _id of the file's metadata to download. |
CancellationToken | ct | [optional] The cancellation token. If cancellation is requested, an OperationCancelledException will be thrown. |
Returns
Type | Description |
---|---|
Task<FileMetaData> |
GetCustomRequestProperties()
Gets the custom request properties.
Declaration
public JObject GetCustomRequestProperties()
Returns
Type | Description |
---|---|
JObject | The custom request properties. |
SetCustomRequestProperties(JObject)
Sets a specific custom request property from a Json object.
Declaration
public void SetCustomRequestProperties(JObject customheaders)
Parameters
Type | Name | Description |
---|---|---|
JObject | customheaders | Custom request property as a JObject |
SetCustomRequestProperty(String, JObject)
Sets a specific custom request property from a Json object.
Declaration
public void SetCustomRequestProperty(string key, JObject value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Custom request property key |
JObject | value | Custom request property value as a JObject |
uploadAsync(FileMetaData, Stream, CancellationToken)
Upload the specified stream to Kinvey file storage. The FileMetaData contains extra data about the file.
Declaration
public Task<FileMetaData> uploadAsync(FileMetaData metadata, Stream content, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
FileMetaData | metadata | Metadata associated with the file; supports arbitrary key/value pairs. |
Stream | content | The stream of file content to upload. |
CancellationToken | ct | [optional] The cancellation token. If cancellation is requested, an OperationCancelledException will be thrown. |
Returns
Type | Description |
---|---|
Task<FileMetaData> |
uploadAsync(FileMetaData, Byte[], CancellationToken)
Upload the specified byte[] to Kinvey file storage. The FileMetaData contains extra data about the file.
Declaration
public Task<FileMetaData> uploadAsync(FileMetaData metadata, byte[] content, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
FileMetaData | metadata | Metadata associated with the file; supports arbitrary key/value pairs. |
System.Byte[] | content | The actual bytes of the file to upload. |
CancellationToken | ct | [optional] The cancellation token. If cancellation is requested, an OperationCancelledException will be thrown. |
Returns
Type | Description |
---|---|
Task<FileMetaData> |
uploadMetadataAsync(FileMetaData, CancellationToken)
Uploads metadata associated with a file, without changing the file itself. Do not modify the id or filename using this method-- it's for any other key/value pairs.
Declaration
public Task<FileMetaData> uploadMetadataAsync(FileMetaData metadata, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
FileMetaData | metadata | The updated FileMetaData to upload to Kinvey. |
CancellationToken | ct | [optional] The cancellation token. If cancellation is requested, an OperationCancelledException will be thrown. |
Returns
Type | Description |
---|---|
Task<FileMetaData> |