/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeCasesResponse response = new DescribeCasesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("cases", targetDepth)) { var unmarshaller = new ListUnmarshaller <CaseDetails, CaseDetailsUnmarshaller>(CaseDetailsUnmarshaller.Instance); response.Cases = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("nextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonAWSSupportConfig config = new AmazonAWSSupportConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonAWSSupportClient client = new AmazonAWSSupportClient(creds, config); DescribeCasesResponse resp = new DescribeCasesResponse(); do { DescribeCasesRequest req = new DescribeCasesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.DescribeCases(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Cases) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeCasesResponse response = new DescribeCasesResponse(); context.Read(); UnmarshallResult(context, response); return(response); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeCasesResponse response = new DescribeCasesResponse(); context.Read(); response.DescribeCasesResult = DescribeCasesResultUnmarshaller.GetInstance().Unmarshall(context); return(response); }
private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeCasesResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("cases", targetDepth)) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { response.Cases = null; continue; } response.Cases = new List <CaseDetails>(); CaseDetailsUnmarshaller unmarshaller = CaseDetailsUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.Cases.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; }