Class TusClient
A class to perform actions against a Tus enabled server.
Namespace: Unity.Services.Ccd.Management
Syntax
public class TusClient : object
Properties
AdditionalHeaders
A mutable dictionary of headers which will be included with all requests.
Declaration
public Dictionary<string, string> AdditionalHeaders { get; }
Property Value
Type | Description |
---|---|
Dictionary<String, String> |
HashingImplementation
Get or set the hashing algorithm implementation to be used for checksum calculation.
Declaration
public static HashingImplementation HashingImplementation { get; set; }
Property Value
Type | Description |
---|---|
HashingImplementation |
Proxy
Get or set the proxy to use when making requests.
Declaration
public IWebProxy Proxy { get; set; }
Property Value
Type | Description |
---|---|
IWebProxy |
Methods
CreateAsync(String, FileInfo, (String key, String value)[])
Create a file at the Tus server.
Declaration
public async Task<string> CreateAsync(string url, FileInfo fileInfo, params (string key, string value)[] metadata)
Parameters
Type | Name | Description |
---|---|---|
String | url | URL to the creation endpoint of the Tus server. |
FileInfo | fileInfo | The file which will be uploaded. |
(, )<String, String>[] | metadata | Metadata to be stored alongside the file. |
Returns
Type | Description |
---|---|
Task<String> | The URL to the created file. |
CreateAsync(String, Int64, (String key, String value)[])
Create a file at the Tus server.
Declaration
public async Task<string> CreateAsync(string url, long uploadLength, params (string key, string value)[] metadata)
Parameters
Type | Name | Description |
---|---|---|
String | url | URL to the creation endpoint of the Tus server. |
Int64 | uploadLength | The byte size of the file which will be uploaded. |
(, )<String, String>[] | metadata | Metadata to be stored alongside the file. |
Returns
Type | Description |
---|---|
Task<String> | The URL to the created file. |
Delete(String)
Delete a file from the Tus server.
Declaration
public async Task<bool> Delete(string url)
Parameters
Type | Name | Description |
---|---|---|
String | url | The URL of the file at the Tus server. |
Returns
Type | Description |
---|---|
Task<Boolean> | A |
DownloadAsync(String, CancellationToken)
Download a file from the Tus server.
Declaration
public TusOperation<TusHttpResponse> DownloadAsync(string url, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | url | The URL of a file at the Tus server. |
CancellationToken | cancellationToken | A cancellation token to cancel the operation with. |
Returns
Type | Description |
---|---|
TusOperation<TusHttpResponse> | A TusOperation<T> which represents the download operation. |
GetServerInfo(String)
Get information about the Tus server.
Declaration
public async Task<TusServerInfo> GetServerInfo(string url)
Parameters
Type | Name | Description |
---|---|---|
String | url | The URL of the Tus enabled endpoint. |
Returns
Type | Description |
---|---|
Task<TusServerInfo> | A TusServerInfo containing information about the Tus server. |
HeadAsync(String)
Send a HEAD request to the Tus server.
Declaration
public async Task<TusHttpResponse> HeadAsync(string url)
Parameters
Type | Name | Description |
---|---|---|
String | url | The endpoint to post the HEAD request to. |
Returns
Type | Description |
---|---|
Task<TusHttpResponse> | The response from the Tus server. |
UploadAsync(String, FileInfo, Double, CancellationToken)
Upload a file to the Tus server.
Declaration
public TusOperation<List<TusHttpResponse>> UploadAsync(string url, FileInfo file, double chunkSize = 5, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | url | URL to a previously created file. |
FileInfo | file | The file to upload. |
Double | chunkSize | The size, in megabytes, of each file chunk when uploading. |
CancellationToken | cancellationToken | A cancellation token to cancel the operation with. |
Returns
Type | Description |
---|---|
TusOperation<List<TusHttpResponse>> | A TusOperation<T> which represents the upload operation. |
UploadAsync(String, Stream, Double, CancellationToken)
Upload a file to the Tus server.
Declaration
public TusOperation<List<TusHttpResponse>> UploadAsync(string url, Stream fileStream, double chunkSize = 5, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | url | URL to a previously created file. |
Stream | fileStream | A file stream of the file to upload. The stream will be closed automatically. |
Double | chunkSize | The size, in megabytes, of each file chunk when uploading. |
CancellationToken | cancellationToken | A cancellation token to cancel the operation with. |
Returns
Type | Description |
---|---|
TusOperation<List<TusHttpResponse>> | A TusOperation<T> which represents the upload operation. |