ActionBase.cs
1 using System;
2 using System.Collections.Generic;
4 using Newtonsoft.Json;
5 using Newtonsoft.Json.Linq;
6 
7 namespace Microsoft.Bot.Builder.Calling.ObjectModel.Contracts
8 {
12  [JsonObject(MemberSerialization.OptOut)]
13  public abstract class ActionBase
14  {
15  protected ActionBase()
16  : this(isStandaloneAction: false)
17  {
18  }
19 
20  protected ActionBase(bool isStandaloneAction)
21  {
22  this.IsStandaloneAction = isStandaloneAction;
23  }
24 
32  [JsonProperty(Required = Required.Always, Order = -3)]
33  public string OperationId { get; set; }
34 
39  [JsonProperty(Required = Required.Always, Order = -2)]
40  public string Action { get; set; }
41 
45  [JsonIgnore]
46  public bool IsStandaloneAction { get; private set; }
47 
51  [JsonExtensionData]
52  private IDictionary<string, JToken> _additionalData;
53 
54  public virtual void Validate()
55  {
56  Utils.AssertArgument(!String.IsNullOrWhiteSpace(this.OperationId), "A valid OperationId must be specified");
57  ValidActions.Validate(this.Action);
58  }
59  }
60 }
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 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.