public async Task PostReplyAsync(long personId, IDictionary <long, long> surveyResponses) { var x = new NationBuilder.NBSurvey.SurveyResponseBody.Body.Response[surveyResponses.Count]; int i = 0; foreach (var kv in surveyResponses) { x[i] = new SurveyResponseBody.Body.Response { question_id = kv.Key, response = kv.Value }; i++; } var request = new SurveyResponseBody(); request.survey_response = new SurveyResponseBody.Body { person_id = personId, survey_id = this.id, question_responses = x }; // this will throw on any errors. // POST https://trcmobile.nationbuilder.com/api/v1/survey_responses var response = await this.Client.PostAsync <SurveyResponseBody, JObject>("survey_responses", request); }
public static void Encode(XdrDataOutputStream stream, SurveyResponseBody encodedSurveyResponseBody) { stream.WriteInt((int)encodedSurveyResponseBody.Discriminant.InnerValue); switch (encodedSurveyResponseBody.Discriminant.InnerValue) { case SurveyMessageCommandType.SurveyMessageCommandTypeEnum.SURVEY_TOPOLOGY: TopologyResponseBody.Encode(stream, encodedSurveyResponseBody.TopologyResponseBody); break; } }
public static SurveyResponseBody Decode(XdrDataInputStream stream) { SurveyResponseBody decodedSurveyResponseBody = new SurveyResponseBody(); SurveyMessageCommandType discriminant = SurveyMessageCommandType.Decode(stream); decodedSurveyResponseBody.Discriminant = discriminant; switch (decodedSurveyResponseBody.Discriminant.InnerValue) { case SurveyMessageCommandType.SurveyMessageCommandTypeEnum.SURVEY_TOPOLOGY: decodedSurveyResponseBody.TopologyResponseBody = TopologyResponseBody.Decode(stream); break; } return(decodedSurveyResponseBody); }