Workflow.cs
1 using System.Collections.Generic;
2 using System.Linq;
4 using Newtonsoft.Json;
5 using Newtonsoft.Json.Linq;
6 
7 namespace Microsoft.Bot.Builder.Calling.ObjectModel.Contracts
8 {
13  [JsonObject(MemberSerialization.OptOut)]
14  public class Workflow
15  {
32  [JsonProperty(Required = Required.Default)]
33  public CallbackLink Links { get; set; }
34 
38  [JsonProperty(Required = Required.Always)]
39  public IEnumerable<ActionBase> Actions { get; set; }
40 
45  [JsonProperty(Required = Required.Default)]
46  public string AppState { get; set; }
47 
53  [JsonProperty(Required = Required.Default)]
54  public IEnumerable<NotificationType> NotificationSubscriptions { get; set; }
55 
56  public void Validate()
57  {
58  ValidActions.Validate(this.Actions);
59  if (this.Links != null)
60  {
61  Utils.AssertArgument(this.Links.Callback != null, "Callback link cannot be specified as null");
62  Utils.AssertArgument(this.Links.Callback.IsAbsoluteUri, "Callback link must be an absolute uri");
63  }
64  ApplicationState.Validate(this.AppState);
65 
66  if (this.NotificationSubscriptions != null)
67  {
68  if (!this.NotificationSubscriptions.Contains<NotificationType>(NotificationType.CallStateChange))
69  {
70  List<NotificationType> newNotificationSubscriptionList = new List<NotificationType>();
71  newNotificationSubscriptionList.Add(NotificationType.CallStateChange);
72  newNotificationSubscriptionList.AddRange(this.NotificationSubscriptions);
73  this.NotificationSubscriptions = newNotificationSubscriptionList;
74  }
75  }
76  else
77  {
78  List<NotificationType> callStateNotificationList = new List<NotificationType>();
79  callStateNotificationList.Add(NotificationType.CallStateChange);
80  this.NotificationSubscriptions = callStateNotificationList;
81  }
82  }
83  }
84 }
static void Validate(string appState)
helper method to validate appState
This class contains the workflow the customer sent for the OnInComingCall POST or any subsequent POST...
Definition: Workflow.cs:14
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
NotificationType
List of various notification types
This is a helper class for validating actions specified by customers
Definition: ValidActions.cs:11
Root namespace for the Microsoft Bot Builder Calling SDK.
Namespace for utilities and helpers in the Microsoft Bot Builder Calling SDK.
Root namespace for the Microsoft Bot Builder SDK.