Class SurveysMediaFilesClient
public class SurveysMediaFilesClient
- Inheritance
-
SurveysMediaFilesClient
- Inherited Members
Constructors
SurveysMediaFilesClient(string, HttpClient)
public SurveysMediaFilesClient(string baseUrl, HttpClient httpClient)
Parameters
baseUrlstringhttpClientHttpClient
Properties
BaseUrl
public string BaseUrl { get; set; }
Property Value
JsonSerializerSettings
protected JsonSerializerSettings JsonSerializerSettings { get; }
Property Value
- JsonSerializerSettings
ReadResponseAsString
public bool ReadResponseAsString { get; set; }
Property Value
Methods
DeleteAsync(string, string, CancellationToken)
Deletes the survey media file.
public virtual Task DeleteAsync(string surveyId, string fileName, CancellationToken cancellationToken = default)
Parameters
surveyIdstringthe id of the survey
fileNamestringthe filename of the media file
cancellationTokenCancellationTokenA 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
surveyIdstringThe survey id
cancellationTokenCancellationTokenA 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
surveyIdstringThe survey id
fileNamestringThe name of the media file to be retrieved
cancellationTokenCancellationTokenA 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
surveyIdstringThe survey id
cancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
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
surveyIdstringThe survey id
fileNamestringThe filename of the media file
fileFileParametercancellationTokenCancellationTokenA 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
responseHttpResponseMessageheadersIReadOnlyDictionary<string, IEnumerable<string>>cancellationTokenCancellationToken
Returns
Type Parameters
T