Exemple #1
0
        public void LexModelBuildingServiceGetIntent()
        {
            #region to-get-a-information-about-an-intent-1494432574147

            var client   = new AmazonLexModelBuildingServiceClient();
            var response = client.GetIntent(new GetIntentRequest
            {
                Version = "$LATEST",
                Name    = "DocOrderPizza"
            });

            string              version             = response.Version;
            string              name                = response.Name;
            string              checksum            = response.Checksum;
            Statement           conclusionStatement = response.ConclusionStatement;
            Prompt              confirmationPrompt  = response.ConfirmationPrompt;
            DateTime            createdDate         = response.CreatedDate;
            string              description         = response.Description;
            FulfillmentActivity fulfillmentActivity = response.FulfillmentActivity;
            DateTime            lastUpdatedDate     = response.LastUpdatedDate;
            Statement           rejectionStatement  = response.RejectionStatement;
            List <string>       sampleUtterances    = response.SampleUtterances;
            List <Slot>         slots               = response.Slots;

            #endregion
        }
Exemple #2
0
        public void LexModelBuildingServicePutIntent()
        {
            #region to-create-an-intent-1494358144659

            var client   = new AmazonLexModelBuildingServiceClient();
            var response = client.PutIntent(new PutIntentRequest
            {
                Name = "DocOrderPizza",
                ConclusionStatement = new Statement {
                    Messages = new List <Message> {
                        new Message {
                            Content     = "All right, I ordered  you a {Crust} crust {Type} pizza with {Sauce} sauce.",
                            ContentType = "PlainText"
                        },
                        new Message {
                            Content     = "OK, your {Crust} crust {Type} pizza with {Sauce} sauce is on the way.",
                            ContentType = "PlainText"
                        }
                    },
                    ResponseCard = "foo"
                },
                ConfirmationPrompt = new Prompt {
                    MaxAttempts = 1,
                    Messages    = new List <Message> {
                        new Message {
                            Content     = "Should I order  your {Crust} crust {Type} pizza with {Sauce} sauce?",
                            ContentType = "PlainText"
                        }
                    }
                },
                Description         = "Order a pizza from a local pizzeria.",
                FulfillmentActivity = new FulfillmentActivity {
                    Type = "ReturnIntent"
                },
                RejectionStatement = new Statement {
                    Messages = new List <Message> {
                        new Message {
                            Content     = "Ok, I'll cancel your order.",
                            ContentType = "PlainText"
                        },
                        new Message {
                            Content     = "I cancelled your order.",
                            ContentType = "PlainText"
                        }
                    }
                },
                SampleUtterances = new List <string> {
                    "Order me a pizza.",
                    "Order me a {Type} pizza.",
                    "I want a {Crust} crust {Type} pizza",
                    "I want a {Crust} crust {Type} pizza with {Sauce} sauce."
                },
                Slots = new List <Slot> {
                    new Slot {
                        Name             = "Type",
                        Description      = "The type of pizza to order.",
                        Priority         = 1,
                        SampleUtterances = new List <string> {
                            "Get me a {Type} pizza.",
                            "A {Type} pizza please.",
                            "I'd like a {Type} pizza."
                        },
                        SlotConstraint         = "Required",
                        SlotType               = "DocPizzaType",
                        SlotTypeVersion        = "$LATEST",
                        ValueElicitationPrompt = new Prompt {
                            MaxAttempts = 1,
                            Messages    = new List <Message> {
                                new Message {
                                    Content     = "What type of pizza would you like?",
                                    ContentType = "PlainText"
                                },
                                new Message {
                                    Content     = "Vegie or cheese pizza?",
                                    ContentType = "PlainText"
                                },
                                new Message {
                                    Content     = "I can get you a vegie or a cheese pizza.",
                                    ContentType = "PlainText"
                                }
                            }
                        }
                    },
                    new Slot {
                        Name             = "Crust",
                        Description      = "The type of pizza crust to order.",
                        Priority         = 2,
                        SampleUtterances = new List <string> {
                            "Make it a {Crust} crust.",
                            "I'd like a {Crust} crust."
                        },
                        SlotConstraint         = "Required",
                        SlotType               = "DocPizzaCrustType",
                        SlotTypeVersion        = "$LATEST",
                        ValueElicitationPrompt = new Prompt {
                            MaxAttempts = 1,
                            Messages    = new List <Message> {
                                new Message {
                                    Content     = "What type of crust would you like?",
                                    ContentType = "PlainText"
                                },
                                new Message {
                                    Content     = "Thick or thin crust?",
                                    ContentType = "PlainText"
                                }
                            }
                        }
                    },
                    new Slot {
                        Name             = "Sauce",
                        Description      = "The type of sauce to use on the pizza.",
                        Priority         = 3,
                        SampleUtterances = new List <string> {
                            "Make it {Sauce} sauce.",
                            "I'd like {Sauce} sauce."
                        },
                        SlotConstraint         = "Required",
                        SlotType               = "DocPizzaSauceType",
                        SlotTypeVersion        = "$LATEST",
                        ValueElicitationPrompt = new Prompt {
                            MaxAttempts = 1,
                            Messages    = new List <Message> {
                                new Message {
                                    Content     = "White or red sauce?",
                                    ContentType = "PlainText"
                                },
                                new Message {
                                    Content     = "Garlic or tomato sauce?",
                                    ContentType = "PlainText"
                                }
                            }
                        }
                    }
                }
            });

            string              version             = response.Version;
            string              name                = response.Name;
            string              checksum            = response.Checksum;
            Statement           conclusionStatement = response.ConclusionStatement;
            Prompt              confirmationPrompt  = response.ConfirmationPrompt;
            DateTime            createdDate         = response.CreatedDate;
            string              description         = response.Description;
            FulfillmentActivity fulfillmentActivity = response.FulfillmentActivity;
            DateTime            lastUpdatedDate     = response.LastUpdatedDate;
            Statement           rejectionStatement  = response.RejectionStatement;
            List <string>       sampleUtterances    = response.SampleUtterances;
            List <Slot>         slots               = response.Slots;

            #endregion
        }