Example #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetApiMappingsResponse response = new GetApiMappingsResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("items", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <ApiMapping, ApiMappingUnmarshaller>(ApiMappingUnmarshaller.Instance);
                    response.Items = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("nextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetApiMappingsResponse response = new GetApiMappingsResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("apiId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ApiId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("apiMappingId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ApiMappingId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("apiMappingKey", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ApiMappingKey = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("stage", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Stage = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }