/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListReportsResponse response = new ListReportsResponse(); 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("reports", targetDepth)) { var unmarshaller = new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance); response.Reports = unmarshaller.Unmarshall(context); continue; } } return(response); }
public ListReportsResponse GetReports(BaseRequest request) { return(GetResponse(() => { var response = new ListReportsResponse(); try { using (FamilyFinanceContext db = new FamilyFinanceContext()) { if (request.PersonId == null && request.FamilyId == null) { response.BaseIsSuccess = false; response.BaseMessage = Shared.Constants.BAD_REQUEST; } else { response.Reports = request.PersonId == null ? db.Reports.Where(x => x.FamilyId == request.FamilyId).ToList() : db.Reports.Where(x => x.FamilyId == request.FamilyId && x.PersonId == request.PersonId).ToList(); } } } catch { response.BaseIsSuccess = false; response.BaseMessage = Shared.Constants.BAD_REQUEST; } return response; })); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonCodeBuildConfig config = new AmazonCodeBuildConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonCodeBuildClient client = new AmazonCodeBuildClient(creds, config); ListReportsResponse resp = new ListReportsResponse(); do { ListReportsRequest req = new ListReportsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListReports(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Reports) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }