Table of Contents

Class SurveysClient

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

Constructors

SurveysClient(string, HttpClient)

public SurveysClient(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, CancellationToken)

Deletes a survey from the domain.

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

Parameters

surveyId string

The unique identifier of the survey to delete.

cancellationToken CancellationToken

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

Returns

Task

Survey deleted

Remarks

Only surveys that have not been started can be deleted.

Exceptions

NfieldSdkException

A server side error occurred.

GetAllAsync(CancellationToken)

Retrieves all surveys in the domain with support for OData queries.

public virtual Task<ICollection<SurveyModel>> GetAllAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

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

Returns

Task<ICollection<SurveyModel>>

Successful

Exceptions

NfieldSdkException

A server side error occurred.

GetAsync(string, CancellationToken)

Retrieves detailed information for a specific survey by its identifier.

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

Parameters

surveyId string

The unique identifier of the survey.

cancellationToken CancellationToken

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

Returns

Task<SurveyModel>

Successful

Exceptions

NfieldSdkException

A server side error occurred.

PatchAsync(string, SurveyUpdateModel, CancellationToken)

Partially updates a survey's general settings.

public virtual Task<SurveyModel> PatchAsync(string surveyId, SurveyUpdateModel surveyChanges, CancellationToken cancellationToken = default)

Parameters

surveyId string

The unique identifier of the survey to update.

surveyChanges SurveyUpdateModel

The survey properties to update. Supported fields: SurveyName, ClientName, Description, InterviewerInstruction.

cancellationToken CancellationToken

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

Returns

Task<SurveyModel>

Successful

Exceptions

NfieldSdkException

A server side error occurred.

PostAsync(SurveyModel, CancellationToken)

Creates a new survey in the domain with the specified configuration.

public virtual Task<SurveyModel> PostAsync(SurveyModel newSurvey, CancellationToken cancellationToken = default)

Parameters

newSurvey SurveyModel

The survey details including name, type, and initial configuration.

cancellationToken CancellationToken

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

Returns

Task<SurveyModel>

Survey created

Exceptions

NfieldSdkException

A server side error occurred.

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

protected virtual Task<SurveysClient.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<SurveysClient.ObjectResponseResult<T>>

Type Parameters

T