NotificationConverter.cs
1 using System;
3 using Newtonsoft.Json.Linq;
4 
5 namespace Microsoft.Bot.Builder.Calling.ObjectModel.Contracts
6 {
11  public class NotificationConverter : JsonCreationConverter<NotificationBase>
12  {
13  protected override NotificationBase Create(Type objectType, JObject jsonObject)
14  {
15  var type = (string)jsonObject.Property("type");
16  if (String.Equals(type, NotificationType.CallStateChange.ToString(), StringComparison.OrdinalIgnoreCase))
17  {
18  return new CallStateChangeNotification();
19  }
20  else
21  {
22  throw new ArgumentException(String.Format("The given notification type '{0}' is not supported!", type));
23  }
24  }
25  }
26 }
This concrete class defines the call state change notification schema.
Helper class to use for deserializing where the concrete classes are determined by checking propertie...
Root namespace for the Microsoft Bot Builder Calling SDK object model.
override NotificationBase Create(Type objectType, JObject jsonObject)
Create an instance of objectType, based properties in the JSON object
NotificationType
List of various notification types
Root namespace for the Microsoft Bot Builder Calling SDK.
By default Json.net doesn&#39;t know how to deserialize JSON data into Interfaces or abstract classes...
This base class defines a subset of properties which define a notification. CallStateNotification and...
Namespace for utilities and helpers in the Microsoft Bot Builder Calling SDK.
Root namespace for the Microsoft Bot Builder SDK.