示例#1
0
        public static ResponseModel GetResponseModel(AlexaRequest alexaRequest)
        {
            if (alexaRequest.Request.Type == RequestType.LaunchRequest)
            {
                return(GetHelpResponse());
            }
            switch (alexaRequest.Request.Intent.Name)
            {
            case IntentType.What:
                return(GetWhatResponse());

            case IntentType.When:
                return(GetWhenResponse());

            case IntentType.DaysUntil:
                return(GetDaysUntilResponse(alexaRequest.Request.Timestamp));

            case IntentType.Where:
                return(GetWhereResponse());

            case IntentType.SkillInfo:
                return(GetSkillInfoResponse());

            default:
                throw new NotSupportedException();
            }
        }
示例#2
0
        public AlexaResponse Hello(AlexaRequest alexaRequest)
        {
            if (alexaRequest.Request.Type == RequestType.SessionEndedRequest)
            {
                return(null);
            }
            var responseModel = GetResponseModel(alexaRequest);
            var response      = GetTextAlexaResponse(responseModel);

            Console.WriteLine(JsonConvert.SerializeObject(response));
            return(response);
        }