/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { PutPipelineDefinitionResponse response = new PutPipelineDefinitionResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("errored", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.Errored = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("validationErrors", targetDepth)) { var unmarshaller = new ListUnmarshaller<ValidationError, ValidationErrorUnmarshaller>(ValidationErrorUnmarshaller.Instance); response.ValidationErrors = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("validationWarnings", targetDepth)) { var unmarshaller = new ListUnmarshaller<ValidationWarning, ValidationWarningUnmarshaller>(ValidationWarningUnmarshaller.Instance); response.ValidationWarnings = unmarshaller.Unmarshall(context); continue; } } return response; }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { PutPipelineDefinitionResponse response = new PutPipelineDefinitionResponse(); context.Read(); UnmarshallResult(context,response); return response; }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { PutPipelineDefinitionResponse response = new PutPipelineDefinitionResponse(); context.Read(); response.PutPipelineDefinitionResult = PutPipelineDefinitionResultUnmarshaller.GetInstance().Unmarshall(context); return response; }
private static void UnmarshallResult(JsonUnmarshallerContext context,PutPipelineDefinitionResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("validationErrors", targetDepth)) { context.Read(); response.ValidationErrors = new List<ValidationError>(); ValidationErrorUnmarshaller unmarshaller = ValidationErrorUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.ValidationErrors.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("validationWarnings", targetDepth)) { context.Read(); response.ValidationWarnings = new List<ValidationWarning>(); ValidationWarningUnmarshaller unmarshaller = ValidationWarningUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.ValidationWarnings.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("errored", targetDepth)) { context.Read(); response.Errored = BoolUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }