/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListBotsResponse response = new ListBotsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Bots", targetDepth)) { var unmarshaller = new ListUnmarshaller <Bot, BotUnmarshaller>(BotUnmarshaller.Instance); response.Bots = 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) { AmazonLexModelsV2Config config = new AmazonLexModelsV2Config(); config.RegionEndpoint = region; ConfigureClient(config); AmazonLexModelsV2Client client = new AmazonLexModelsV2Client(creds, config); ListBotsResponse resp = new ListBotsResponse(); do { ListBotsRequest req = new ListBotsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListBots(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.BotSummaries) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }