OperationOutcomeConverter.cs
1 using System;
3 using Newtonsoft.Json.Linq;
4 
5 namespace Microsoft.Bot.Builder.Calling.ObjectModel.Contracts
6 {
11  public class OperationOutcomeConverter : JsonCreationConverter<OperationOutcomeBase>
12  {
13  protected override OperationOutcomeBase Create(Type objectType, JObject jsonObject)
14  {
15  var type = (string)jsonObject.Property("type");
16  if (String.Equals(type, ValidOutcomes.AnswerOutcome, StringComparison.OrdinalIgnoreCase))
17  {
18  return new AnswerOutcome();
19  }
20  else if (String.Equals(type, ValidOutcomes.HangupOutcome, StringComparison.OrdinalIgnoreCase))
21  {
22  return new HangupOutcome();
23  }
24  else if (String.Equals(type, ValidOutcomes.RejectOutcome, StringComparison.OrdinalIgnoreCase))
25  {
26  return new RejectOutcome();
27  }
28  else if (String.Equals(type, ValidOutcomes.PlayPromptOutcome, StringComparison.OrdinalIgnoreCase))
29  {
30  return new PlayPromptOutcome();
31  }
32  else if (String.Equals(type, ValidOutcomes.RecordOutcome, StringComparison.OrdinalIgnoreCase))
33  {
34  return new RecordOutcome();
35  }
36  else if (String.Equals(type, ValidOutcomes.RecognizeOutcome, StringComparison.OrdinalIgnoreCase))
37  {
38  return new RecognizeOutcome();
39  }
40  else if (String.Equals(type, ValidOutcomes.WorkflowValidationOutcome, StringComparison.OrdinalIgnoreCase))
41  {
42  return new WorkflowValidationOutcome();
43  }
44 
45  throw new ArgumentException(String.Format("The given outcome type '{0}' is not supported!", type));
46  }
47  }
48 }
This is the outcome of the "recognize" action. This is conveyed to the customer as POST to the custom...
If the customer&#39;s "response" fails validation, this is the outcome conveyed to the customer as POST t...
By default Json.net doesn&#39;t know how to deserialize JSON data into Interfaces or abstract classes...
Helper class to use for deserializing where the concrete classes are determined by checking propertie...
This is the outcome of the "playPrompt" action. This is conveyed to the customer as POST to the custo...
Root namespace for the Microsoft Bot Builder Calling SDK object model.
This is a helper class for validating outcomes. This can be used by customers or by us (before we sen...
This is the outcome of the "record" action. This is conveyed to the customer as POST to the customer ...
This is the outcome of the "reject" action. This is conveyed to the customer as POST to the customer ...
Definition: RejectOutcome.cs:9
Root namespace for the Microsoft Bot Builder Calling SDK.
const string WorkflowValidationOutcome
WorkflowValidationOutcome
This is the outcome of the "answer" action. This is conveyed to the customer as POST to the customer ...
Definition: AnswerOutcome.cs:9
override OperationOutcomeBase Create(Type objectType, JObject jsonObject)
Create an instance of objectType, based properties in the JSON object
This is the outcome of the "hangup" action. This is conveyed to the customer as POST to the customer ...
Definition: HangupOutcome.cs:9
Namespace for utilities and helpers in the Microsoft Bot Builder Calling SDK.
Root namespace for the Microsoft Bot Builder SDK.