Class FilesClient
Implementation of IFilesClient
Implements
Inherited Members
Namespace: Noxum.Nova.Cms.Client
Assembly: Noxum.Nova.Cms.Client.dll
Syntax
public class FilesClient : IFilesClient
Constructors
FilesClient(string, HttpClient)
Declaration
public FilesClient(string baseUrl, HttpClient httpClient)
Parameters
| Type | Name | Description |
|---|---|---|
| string | baseUrl | |
| HttpClient | httpClient |
Properties
BaseUrl
Declaration
public string BaseUrl { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
JsonSerializerSettings
Declaration
protected JsonSerializerOptions JsonSerializerSettings { get; }
Property Value
| Type | Description |
|---|---|
| JsonSerializerOptions |
ReadResponseAsString
Declaration
public bool ReadResponseAsString { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
ContinueUploadAsync(string, string, bool?, FileParameter, CancellationToken)
Continue uploading an external file.
Declaration
public virtual Task<FileUploadResult> ContinueUploadAsync(string token, string extension = null, bool? commit = null, FileParameter file = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | token | The token of the temporary file. |
| string | extension | |
| bool? | commit | |
| FileParameter | file | |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<FileUploadResult> | Ok |
Remarks
Continue uploading an external file.
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
DeleteTempFileAsync(string, CancellationToken)
Delete the temporary file using the provided token.
Declaration
public virtual Task<FileResponse> DeleteTempFileAsync(string token, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | token | Token for the temporary file to delete (including extension). |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<FileResponse> | Ok |
Remarks
Delete the temporary file using the provided token.
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetFileAsync(string, string, CancellationToken)
Retrieve the file with the specified name.
Declaration
public virtual Task<FileResponse> GetFileAsync(string name, string range = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Name of the file including the extension. |
| string | range | Range header value. For more information, visit https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<FileResponse> | Ok |
Remarks
Retrieve the file with the specified name.
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
ReadObjectResponseAsync<T>(HttpResponseMessage, IReadOnlyDictionary<string, IEnumerable<string>>, CancellationToken)
Declaration
protected virtual Task<FilesClient.ObjectResponseResult<T>> ReadObjectResponseAsync<T>(HttpResponseMessage response, IReadOnlyDictionary<string, IEnumerable<string>> headers, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpResponseMessage | response | |
| IReadOnlyDictionary<string, IEnumerable<string>> | headers | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<FilesClient.ObjectResponseResult<T>> |
Type Parameters
| Name | Description |
|---|---|
| T |
StartUploadAsync(string, bool?, FileParameter, CancellationToken)
Start uploading an external file.
Declaration
public virtual Task<FileUploadResult> StartUploadAsync(string extension = null, bool? commit = null, FileParameter file = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | extension | |
| bool? | commit | |
| FileParameter | file | |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<FileUploadResult> | Ok |
Remarks
Start uploading an external file.
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |