public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListPresetsResponse response = new ListPresetsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Presets", targetDepth)) { var unmarshaller = new ListUnmarshaller <Preset, PresetUnmarshaller>( PresetUnmarshaller.GetInstance()); response.Presets = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("NextPageToken", targetDepth)) { response.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonElasticTranscoderConfig config = new AmazonElasticTranscoderConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonElasticTranscoderClient client = new AmazonElasticTranscoderClient(creds, config); ListPresetsResponse resp = new ListPresetsResponse(); do { ListPresetsRequest req = new ListPresetsRequest { PageToken = resp.NextPageToken }; resp = client.ListPresets(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Presets) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextPageToken)); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListPresetsResponse response = new ListPresetsResponse(); context.Read(); UnmarshallResult(context, response); return(response); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListPresetsResponse response = new ListPresetsResponse(); context.Read(); response.ListPresetsResult = ListPresetsResultUnmarshaller.GetInstance().Unmarshall(context); return(response); }
private static void UnmarshallResult(JsonUnmarshallerContext context, ListPresetsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("Presets", targetDepth)) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { response.Presets = null; continue; } response.Presets = new List <Preset>(); PresetUnmarshaller unmarshaller = PresetUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.Presets.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("NextPageToken", targetDepth)) { context.Read(); response.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }