Table of Contents

Class SurveysSampleClient

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

Constructors

SurveysSampleClient(string, HttpClient)

public SurveysSampleClient(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, 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

surveyId string

The survey's ID

filters IEnumerable<SampleFilterModel>

[MANDATORY] Filters to be applied for the delete operation.

cancellationToken CancellationToken

A 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

surveyId string

id of the survey

cancellationToken CancellationToken

A 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

surveyId string

id of the survey

interviewId int

interview number of the sample record

cancellationToken CancellationToken

A 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

surveyId string

id of the survey

cancellationToken CancellationToken

A 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

surveyId string

id of the survey

request MaskingDataRequestModel

The masking data request

cancellationToken CancellationToken

A 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

surveyId string

id of the survey

file FileParameter
cancellationToken CancellationToken

A 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

surveyId string

The survey's ID

sampleColumns IEnumerable<SurveyCreateSampleColumnModel>

[MANDATORY] Sample columns to be created

cancellationToken CancellationToken

A 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

surveyId string

id of the survey

model SurveyUpdateSampleRecordModel

model with the sample record id to edit and the custom columns to be changed

cancellationToken CancellationToken

A 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

surveyId string

The survey's ID

filters IEnumerable<SampleFilterModel>

[MANDATORY] Filters to be applied for the block operation

cancellationToken CancellationToken

A 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

surveyId string

The survey's ID

request ClearSurveySampleModel

[MANDATORY] Filters and columns for the clear operation

cancellationToken CancellationToken

A 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

surveyId string

The survey's ID

filters IEnumerable<SampleFilterModel>

[MANDATORY] Filters to be applied for the reset operation

cancellationToken CancellationToken

A 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

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

Returns

Task<SurveysSampleClient.ObjectResponseResult<T>>

Type Parameters

T