Answer.cs
1 using System.Collections.Generic;
2 using System.Linq;
4 using Newtonsoft.Json;
5 
6 namespace Microsoft.Bot.Builder.Calling.ObjectModel.Contracts
7 {
12  [JsonObject(MemberSerialization.OptOut)]
13  public class Answer : ActionBase
14  {
15  public static readonly IEnumerable<ModalityType> DefaultAcceptModalityTypes = new ModalityType[] { ModalityType.Audio };
16 
17  private IEnumerable<ModalityType> acceptModalityTypes;
18 
23  [JsonProperty(Required = Required.Default)]
24  public IEnumerable<ModalityType> AcceptModalityTypes
25  {
26  get
27  {
28  if (this.acceptModalityTypes == null || !this.acceptModalityTypes.Any())
29  {
30  return DefaultAcceptModalityTypes;
31  }
32  else
33  {
34  return this.acceptModalityTypes;
35  }
36  }
37 
38  set
39  {
40  this.acceptModalityTypes = value;
41  }
42  }
43 
44  public Answer()
45  {
46  this.Action = ValidActions.AnswerAction;
47  }
48 
49  public override void Validate()
50  {
51  base.Validate();
52  Utils.AssertArgument(this.AcceptModalityTypes.Distinct().Count() == this.AcceptModalityTypes.Count(), "AcceptModalityTypes cannot contain duplicate elements.");
53  Utils.AssertArgument(this.AcceptModalityTypes.All((m) => { return m != ModalityType.Unknown; }), "AcceptModalityTypes contains an unknown media type.");
54  Utils.AssertArgument(this.AcceptModalityTypes.All((m) => { return m != ModalityType.VideoBasedScreenSharing; }), "AcceptModalityTypes cannot contain VideoBasedScreenSharing.");
55  }
56  }
57 }
This is the action which customers can specify to indicate that the server call agent should accept t...
Definition: Answer.cs:13
ModalityType
List of supported modality types
Definition: ModalityType.cs:9
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.