Class SurveysSampleClient
public class SurveysSampleClient
- Inheritance
-
SurveysSampleClient
- Inherited Members
Constructors
SurveysSampleClient(string, HttpClient)
public SurveysSampleClient(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, IEnumerable<SampleFilterModel>, CancellationToken)
(Online - Cati) Deletes the specified survey's SampleData.
public virtual Task<BackgroundActivityStatus> DeleteAsync(string surveyId, IEnumerable<SampleFilterModel> filters, CancellationToken cancellationToken = default)
Parameters
surveyIdstringThe survey's ID
filtersIEnumerable<SampleFilterModel>[MANDATORY] Filters to be applied for the delete operation.
cancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<BackgroundActivityStatus>
Sample deleted
Exceptions
- NfieldSdkException
A server side error occurred.
GetAsync(string, CancellationToken)
Retrieves the sample data for the specified survey.
public virtual Task<FileResponse> GetAsync(string surveyId, CancellationToken cancellationToken = default)
Parameters
surveyIdstringid of the survey
cancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<FileResponse>
Sample data
Remarks
The Handler in Nfield.Manager.SampleManagement throws an SqlException if the survey cannot be found
Exceptions
- NfieldSdkException
A server side error occurred.
GetInterviewAsync(string, int, CancellationToken)
Retrieves a single sample record for the specified survey.
public virtual Task<FileResponse> GetInterviewAsync(string surveyId, int interviewId, CancellationToken cancellationToken = default)
Parameters
surveyIdstringid of the survey
interviewIdintinterview number of the sample record
cancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<FileResponse>
Sample data for specific survey
Remarks
The Handler in Nfield.Manager.SampleManagement throws an SqlException if the survey cannot be found
Exceptions
- NfieldSdkException
A server side error occurred.
GetMaskingStatusAsync(string, CancellationToken)
Gets the current masking status of the survey sample.
public virtual Task<CheckMaskingStatusResponseModel> GetMaskingStatusAsync(string surveyId, CancellationToken cancellationToken = default)
Parameters
surveyIdstringid of the survey
cancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<CheckMaskingStatusResponseModel>
Successful
Exceptions
- NfieldSdkException
A server side error occurred.
MaskSampleDataAsync(string, MaskingDataRequestModel, CancellationToken)
Sets the masking configuration for the survey sample.
public virtual Task<MaskDataResponseModel> MaskSampleDataAsync(string surveyId, MaskingDataRequestModel request, CancellationToken cancellationToken = default)
Parameters
surveyIdstringid of the survey
requestMaskingDataRequestModelThe masking data request
cancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<MaskDataResponseModel>
Successful
Exceptions
- NfieldSdkException
A server side error occurred.
PostAsync(string, FileParameter, CancellationToken)
(Online - Cati) Uploads the sample data for the specified survey. Pass the sample data as a CSV formatted string in the body of the request.
public virtual Task<SampleUploadStatus> PostAsync(string surveyId, FileParameter file = null, CancellationToken cancellationToken = default)
Parameters
surveyIdstringid of the survey
fileFileParametercancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<SampleUploadStatus>
Sample data uploaded
Exceptions
- NfieldSdkException
A server side error occurred.
PostRecordAsync(string, IEnumerable<SurveyCreateSampleColumnModel>, CancellationToken)
(Online - Cati) Creates a sample record for the specified survey.
Body parameters: If one of the ColumnNames is "RespondentInterviewLink" and the corresponding Value is "true", the Response will include the full respondent interview link.
NOTE: "RespondentInterviewLink" is a system reserved name, this column is not stored.
public virtual Task<ICollection<SurveyCreateSampleColumnModel>> PostRecordAsync(string surveyId, IEnumerable<SurveyCreateSampleColumnModel> sampleColumns, CancellationToken cancellationToken = default)
Parameters
surveyIdstringThe survey's ID
sampleColumnsIEnumerable<SurveyCreateSampleColumnModel>[MANDATORY] Sample columns to be created
cancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<ICollection<SurveyCreateSampleColumnModel>>
Sample created
Exceptions
- NfieldSdkException
A server side error occurred.
PutAsync(string, SurveyUpdateSampleRecordModel, CancellationToken)
Updates Sample Record
public virtual Task<SampleUpdateStatus> PutAsync(string surveyId, SurveyUpdateSampleRecordModel model, CancellationToken cancellationToken = default)
Parameters
surveyIdstringid of the survey
modelSurveyUpdateSampleRecordModelmodel with the sample record id to edit and the custom columns to be changed
cancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<SampleUpdateStatus>
Sample updated
Exceptions
- NfieldSdkException
A server side error occurred.
PutBlockAsync(string, IEnumerable<SampleFilterModel>, CancellationToken)
(Online - Cati) Blocks sample data for a survey based on the survey id and a filter.
public virtual Task<BackgroundActivityStatus> PutBlockAsync(string surveyId, IEnumerable<SampleFilterModel> filters, CancellationToken cancellationToken = default)
Parameters
surveyIdstringThe survey's ID
filtersIEnumerable<SampleFilterModel>[MANDATORY] Filters to be applied for the block operation
cancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<BackgroundActivityStatus>
Sample blocked
Exceptions
- NfieldSdkException
A server side error occurred.
PutClearAsync(string, ClearSurveySampleModel, CancellationToken)
Clears the specified columns in sample data for a survey based on the survey id and a filter.
public virtual Task<BackgroundActivityStatus> PutClearAsync(string surveyId, ClearSurveySampleModel request, CancellationToken cancellationToken = default)
Parameters
surveyIdstringThe survey's ID
requestClearSurveySampleModel[MANDATORY] Filters and columns for the clear operation
cancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<BackgroundActivityStatus>
Sample cleared
Exceptions
- NfieldSdkException
A server side error occurred.
PutResetAsync(string, IEnumerable<SampleFilterModel>, CancellationToken)
(Online - Cati) Resets sample data for a survey based on the survey id and a filter.
public virtual Task<BackgroundActivityStatus> PutResetAsync(string surveyId, IEnumerable<SampleFilterModel> filters, CancellationToken cancellationToken = default)
Parameters
surveyIdstringThe survey's ID
filtersIEnumerable<SampleFilterModel>[MANDATORY] Filters to be applied for the reset operation
cancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<BackgroundActivityStatus>
Sample reset
Exceptions
- NfieldSdkException
A server side error occurred.
ReadObjectResponseAsync<T>(HttpResponseMessage, IReadOnlyDictionary<string, IEnumerable<string>>, CancellationToken)
protected virtual Task<SurveysSampleClient.ObjectResponseResult<T>> ReadObjectResponseAsync<T>(HttpResponseMessage response, IReadOnlyDictionary<string, IEnumerable<string>> headers, CancellationToken cancellationToken)
Parameters
responseHttpResponseMessageheadersIReadOnlyDictionary<string, IEnumerable<string>>cancellationTokenCancellationToken
Returns
Type Parameters
T