Class SurveysClient
public class SurveysClient
- Inheritance
-
SurveysClient
- Inherited Members
Constructors
SurveysClient(string, HttpClient)
public SurveysClient(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, CancellationToken)
Deletes a survey from the domain.
public virtual Task DeleteAsync(string surveyId, CancellationToken cancellationToken = default)
Parameters
surveyIdstringThe unique identifier of the survey to delete.
cancellationTokenCancellationTokenA 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
cancellationTokenCancellationTokenA 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
surveyIdstringThe unique identifier of the survey.
cancellationTokenCancellationTokenA 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
surveyIdstringThe unique identifier of the survey to update.
surveyChangesSurveyUpdateModelThe survey properties to update. Supported fields: SurveyName, ClientName, Description, InterviewerInstruction.
cancellationTokenCancellationTokenA 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
newSurveySurveyModelThe survey details including name, type, and initial configuration.
cancellationTokenCancellationTokenA 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
responseHttpResponseMessageheadersIReadOnlyDictionary<string, IEnumerable<string>>cancellationTokenCancellationToken
Returns
Type Parameters
T