Exemplo n.º 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)
        {
            GetBotResponse response = new GetBotResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Bot", targetDepth))
                {
                    var unmarshaller = BotUnmarshaller.Instance;
                    response.Bot = 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)
        {
            GetBotResponse response = new GetBotResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("abortStatement", targetDepth))
                {
                    var unmarshaller = StatementUnmarshaller.Instance;
                    response.AbortStatement = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("checksum", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Checksum = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("childDirected", targetDepth))
                {
                    var unmarshaller = BoolUnmarshaller.Instance;
                    response.ChildDirected = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("clarificationPrompt", targetDepth))
                {
                    var unmarshaller = PromptUnmarshaller.Instance;
                    response.ClarificationPrompt = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("createdDate", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.CreatedDate = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("description", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Description = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("detectSentiment", targetDepth))
                {
                    var unmarshaller = BoolUnmarshaller.Instance;
                    response.DetectSentiment = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("failureReason", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.FailureReason = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("idleSessionTTLInSeconds", targetDepth))
                {
                    var unmarshaller = IntUnmarshaller.Instance;
                    response.IdleSessionTTLInSeconds = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("intents", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Intent, IntentUnmarshaller>(IntentUnmarshaller.Instance);
                    response.Intents = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("lastUpdatedDate", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.LastUpdatedDate = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("locale", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Locale = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("name", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Name = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("status", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Status = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("version", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Version = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("voiceId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.VoiceId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }