Example #1
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeCommunicationsResponse response = new DescribeCommunicationsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("communications", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Communication, CommunicationUnmarshaller>(
                        CommunicationUnmarshaller.GetInstance());
                    response.Communications = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("nextToken", targetDepth))
                {
                    response.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Example #2
0
        public RecentCaseCommunications Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            RecentCaseCommunications recentCaseCommunications = new RecentCaseCommunications();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("communications", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Communication, CommunicationUnmarshaller>(
                        CommunicationUnmarshaller.GetInstance());
                    recentCaseCommunications.Communications = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("nextToken", targetDepth))
                {
                    recentCaseCommunications.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(recentCaseCommunications);
        }
        public RecentCaseCommunications Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            RecentCaseCommunications recentCaseCommunications = new RecentCaseCommunications();



            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("communications", targetDepth))
                {
                    context.Read();

                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        recentCaseCommunications.Communications = null;
                        continue;
                    }
                    recentCaseCommunications.Communications = new List <Communication>();
                    CommunicationUnmarshaller unmarshaller = CommunicationUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        recentCaseCommunications.Communications.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("nextToken", targetDepth))
                {
                    context.Read();
                    recentCaseCommunications.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return(recentCaseCommunications);
                }
            }


            return(recentCaseCommunications);
        }
Example #4
0
 public static CommunicationUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new CommunicationUnmarshaller();
     }
     return(instance);
 }
        public DescribeCommunicationsResult Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeCommunicationsResult describeCommunicationsResult = new DescribeCommunicationsResult();

            describeCommunicationsResult.Communications = null;

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("Communications", targetDepth))
                    {
                        describeCommunicationsResult.Communications = new List <Communication>();
                        CommunicationUnmarshaller unmarshaller = CommunicationUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                describeCommunicationsResult.Communications.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("NextToken", targetDepth))
                    {
                        describeCommunicationsResult.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(describeCommunicationsResult);
                }
            }


            return(describeCommunicationsResult);
        }
        private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeCommunicationsResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("communications", targetDepth))
                {
                    context.Read();

                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        response.Communications = null;
                        continue;
                    }
                    response.Communications = new List <Communication>();
                    CommunicationUnmarshaller unmarshaller = CommunicationUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.Communications.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("nextToken", targetDepth))
                {
                    context.Read();
                    response.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return;
                }
            }

            return;
        }