RecognizeOutcome.cs
1 using System;
3 using Newtonsoft.Json;
4 
5 namespace Microsoft.Bot.Builder.Calling.ObjectModel.Contracts
6 {
10  [JsonObject(MemberSerialization.OptOut)]
12  {
16  [JsonProperty(Required = Required.Default)]
17  public ChoiceOutcome ChoiceOutcome { get; set; }
18 
22  [JsonProperty(Required = Required.Default)]
24 
26  {
27  this.Type = ValidOutcomes.RecognizeOutcome;
28  }
29 
30  public override void Validate()
31  {
32  base.Validate();
33  if (this.Outcome == Outcome.Success)
34  {
35  bool choiceOutcome = (this.ChoiceOutcome != null);
36  bool collectDigitsOutcome = (this.CollectDigitsOutcome != null);
37 
39  (choiceOutcome && !collectDigitsOutcome) || (!choiceOutcome && collectDigitsOutcome),
40  "Either a ChoiceOutcome or a CollectDigitsOutcome must for specified for successful recognition outcome");
41 
42  if (choiceOutcome)
43  {
44  Utils.AssertArgument(!String.IsNullOrWhiteSpace(this.ChoiceOutcome.ChoiceName),
45  "Recognized choice name must be specified for successful choice recognition outcome");
46  }
47 
48  if (collectDigitsOutcome)
49  {
50  Utils.AssertArgument(!String.IsNullOrWhiteSpace(this.CollectDigitsOutcome.Digits),
51  "Collected digits must be specified for successful choice recognition outcome");
52  ValidDtmfs.Validate(this.CollectDigitsOutcome.Digits.ToCharArray());
53  }
54  }
55  }
56  }
57 }
This is the outcome of the "recognize" action. This is conveyed to the customer as POST to the custom...
Root namespace for the Microsoft Bot Builder Calling SDK object model.
static void AssertArgument(bool condition, string format, params object[] args)
Argument checker
Definition: Utils.cs:17
This is a helper class for validating outcomes. This can be used by customers or by us (before we sen...
This is a part of the "recognize" action outcome. This is specified if the customer had specified any...
Root namespace for the Microsoft Bot Builder Calling SDK.
This is a part of the "recognize" action outcome. This is specified if the customer had specified any...
This is a helper class for validating dtmfs specified in strings
Definition: ValidDtmfs.cs:10
Namespace for utilities and helpers in the Microsoft Bot Builder Calling SDK.
Root namespace for the Microsoft Bot Builder SDK.