/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeCommunicationsResponse response = new DescribeCommunicationsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("communications", targetDepth)) { var unmarshaller = new ListUnmarshaller <Communication, CommunicationUnmarshaller>(CommunicationUnmarshaller.Instance); response.Communications = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("nextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } return(response); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeCommunicationsResponse response = new DescribeCommunicationsResponse(); context.Read(); UnmarshallResult(context, response); return(response); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeCommunicationsResponse response = new DescribeCommunicationsResponse(); context.Read(); response.DescribeCommunicationsResult = DescribeCommunicationsResultUnmarshaller.GetInstance().Unmarshall(context); return(response); }
private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeCommunicationsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("communications", targetDepth)) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { response.Communications = null; continue; } response.Communications = new List <Communication>(); CommunicationUnmarshaller unmarshaller = CommunicationUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.Communications.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("nextToken", targetDepth)) { context.Read(); response.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }