/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { UpdateItemResponse response = new UpdateItemResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Attributes", targetDepth)) { var unmarshaller = new DictionaryUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.Instance, AttributeValueUnmarshaller.Instance); response.Attributes = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ConsumedCapacity", targetDepth)) { var unmarshaller = ConsumedCapacityUnmarshaller.Instance; response.ConsumedCapacity = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ItemCollectionMetrics", targetDepth)) { var unmarshaller = ItemCollectionMetricsUnmarshaller.Instance; response.ItemCollectionMetrics = unmarshaller.Unmarshall(context); continue; } } return response; }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { UpdateItemResponse response = new UpdateItemResponse(); context.Read(); UnmarshallResult(context,response); return response; }
private static void UnmarshallResult(JsonUnmarshallerContext context,UpdateItemResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("Attributes", targetDepth)) { context.Read(); response.Attributes = new Dictionary<String,AttributeValue>(); if (context.CurrentTokenType == JsonToken.Null) { continue; } KeyValueUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new KeyValueUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance()); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart) { continue; } if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd) { break; } KeyValuePair<string, AttributeValue> kvp = unmarshaller.Unmarshall(context); response.Attributes.Add(kvp.Key, kvp.Value); } continue; } if (context.TestExpression("ConsumedCapacity", targetDepth)) { context.Read(); response.ConsumedCapacity = ConsumedCapacityUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ItemCollectionMetrics", targetDepth)) { context.Read(); response.ItemCollectionMetrics = ItemCollectionMetricsUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { UpdateItemResponse response = new UpdateItemResponse(); context.Read(); response.UpdateItemResult = UpdateItemResultUnmarshaller.GetInstance().Unmarshall(context); return response; }