/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeProjectsResponse response = new DescribeProjectsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ProjectDescriptions", targetDepth)) { var unmarshaller = new ListUnmarshaller <ProjectDescription, ProjectDescriptionUnmarshaller>(ProjectDescriptionUnmarshaller.Instance); response.ProjectDescriptions = unmarshaller.Unmarshall(context); continue; } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonRekognitionConfig config = new AmazonRekognitionConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonRekognitionClient client = new AmazonRekognitionClient(creds, config); DescribeProjectsResponse resp = new DescribeProjectsResponse(); do { DescribeProjectsRequest req = new DescribeProjectsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.DescribeProjects(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.ProjectDescriptions) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public static DescribeProjectsResponse Unmarshall(UnmarshallerContext context) { DescribeProjectsResponse describeProjectsResponse = new DescribeProjectsResponse(); describeProjectsResponse.HttpResponse = context.HttpResponse; describeProjectsResponse.RequestId = context.StringValue("DescribeProjects.RequestId"); describeProjectsResponse.TotalNum = context.LongValue("DescribeProjects.TotalNum"); describeProjectsResponse.CurrentPage = context.LongValue("DescribeProjects.CurrentPage"); describeProjectsResponse.PageSize = context.LongValue("DescribeProjects.PageSize"); describeProjectsResponse.NextPageToken = context.StringValue("DescribeProjects.NextPageToken"); List <DescribeProjectsResponse.DescribeProjects_Project> describeProjectsResponse_projects = new List <DescribeProjectsResponse.DescribeProjects_Project>(); for (int i = 0; i < context.Length("DescribeProjects.Projects.Length"); i++) { DescribeProjectsResponse.DescribeProjects_Project project = new DescribeProjectsResponse.DescribeProjects_Project(); project.ProjectId = context.StringValue("DescribeProjects.Projects[" + i + "].ProjectId"); project.Name = context.StringValue("DescribeProjects.Projects[" + i + "].Name"); project.Description = context.StringValue("DescribeProjects.Projects[" + i + "].Description"); project.ProType = context.StringValue("DescribeProjects.Projects[" + i + "].ProType"); project.IterCount = context.IntegerValue("DescribeProjects.Projects[" + i + "].IterCount"); project.CreationTime = context.StringValue("DescribeProjects.Projects[" + i + "].CreationTime"); project.Status = context.StringValue("DescribeProjects.Projects[" + i + "].Status"); describeProjectsResponse_projects.Add(project); } describeProjectsResponse.Projects = describeProjectsResponse_projects; return(describeProjectsResponse); }