Table of Contents

Class SurveysMediaFilesClient

Namespace
Nfield.SDK
Assembly
Nfield.Public.SDK.dll
public class SurveysMediaFilesClient
Inheritance
SurveysMediaFilesClient
Inherited Members

Constructors

SurveysMediaFilesClient(string, HttpClient)

public SurveysMediaFilesClient(string baseUrl, HttpClient httpClient)

Parameters

baseUrl string
httpClient HttpClient

Properties

BaseUrl

public string BaseUrl { get; set; }

Property Value

string

JsonSerializerSettings

protected JsonSerializerSettings JsonSerializerSettings { get; }

Property Value

JsonSerializerSettings

ReadResponseAsString

public bool ReadResponseAsString { get; set; }

Property Value

bool

Methods

DeleteAsync(string, string, CancellationToken)

Deletes the survey media file.

public virtual Task DeleteAsync(string surveyId, string fileName, CancellationToken cancellationToken = default)

Parameters

surveyId string

the id of the survey

fileName string

the filename of the media file

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task

Deleted

Exceptions

NfieldSdkException

A server side error occurred.

GetAllAsync(string, CancellationToken)

Gets a list of all media file names for a survey.

public virtual Task<ICollection<string>> GetAllAsync(string surveyId, CancellationToken cancellationToken = default)

Parameters

surveyId string

The survey id

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task<ICollection<string>>

Successful

Exceptions

NfieldSdkException

A server side error occurred.

GetAsync(string, string, CancellationToken)

Streams the needed media file.

public virtual Task<FileResponse> GetAsync(string surveyId, string fileName, CancellationToken cancellationToken = default)

Parameters

surveyId string

The survey id

fileName string

The name of the media file to be retrieved

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task<FileResponse>

Successful

Exceptions

NfieldSdkException

A server side error occurred.

GetCountAsync(string, CancellationToken)

Gets the number of media files in a survey.

public virtual Task<int> GetCountAsync(string surveyId, CancellationToken cancellationToken = default)

Parameters

surveyId string

The survey id

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task<int>

Successful

Exceptions

NfieldSdkException

A server side error occurred.

PostAsync(string, string, FileParameter, CancellationToken)

Creates or update the survey media file.
You can upload multiple zipped files, make sure you don't add folders to the zip.

public virtual Task<BackgroundActivityStatus> PostAsync(string surveyId, string fileName, FileParameter file = null, CancellationToken cancellationToken = default)

Parameters

surveyId string

The survey id

fileName string

The filename of the media file

file FileParameter
cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task<BackgroundActivityStatus>

Successful

Exceptions

NfieldSdkException

A server side error occurred.

ReadObjectResponseAsync<T>(HttpResponseMessage, IReadOnlyDictionary<string, IEnumerable<string>>, CancellationToken)

protected virtual Task<SurveysMediaFilesClient.ObjectResponseResult<T>> ReadObjectResponseAsync<T>(HttpResponseMessage response, IReadOnlyDictionary<string, IEnumerable<string>> headers, CancellationToken cancellationToken)

Parameters

response HttpResponseMessage
headers IReadOnlyDictionary<string, IEnumerable<string>>
cancellationToken CancellationToken

Returns

Task<SurveysMediaFilesClient.ObjectResponseResult<T>>

Type Parameters

T