using System.Threading.Tasks;
using Avius.SDK.Questions;
public static async Task Main()
#warning Replace replace the client_id and client_secret below with an API key obtained from Avius
using (var aviusClient = new AviusClient("client_id", "client_secret"))
var surveys = await aviusClient.GetSurveysAsync();
foreach (var survey in surveys)
Console.WriteLine($"Survey {survey.Name}");
var questions = await aviusClient.GetSurveyQuestionsAsync(survey.Id);
foreach (var question in questions)
Console.WriteLine($" Question {string.Join("-",question.QuestionText.Select(x=>x.Value))}");
case GroupedChoiceQuestion groupedChoiceQuestion:
case ChoiceQuestion choiceQuestion:
case RankedQuestion rankedQuestion:
case Question otherQuestion:
ResponsePage responsePage = null;
responsePage = await aviusClient.GetSurveyResponsesAsync(survey.Id, watermark);
foreach (var response in responsePage.Results)
Console.WriteLine($" Response {response.ResponseId}");
foreach (var answer in response.Answers)
case AddressAnswer addressAnswer:
case BinaryAnswer binaryAnswer:
case ChoiceAnswer choiceAnswer:
Console.WriteLine($" Answer to question {answer.Key} is option {String.Join("-",choiceAnswer.Response.Select(x=>x.ToString()))}");
case GroupedChoiceAnswer groupedChoiceAnswer:
case DateAnswer dateAnswer:
case TextAnswer textAnswer:
throw new NotSupportedException("New Question Type I need to add");
watermark = responsePage.NextWatermark;
while (responsePage.Results.Length > 0);
Console.WriteLine($"To check for new responses for SurveyId {survey.Id} use the watermark {watermark} next time");