StateClient.cs
1 // Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2 // Changes may cause incorrect behavior and will be lost if the code is
3 // regenerated.
4 
5 namespace Microsoft.Bot.Connector
6 {
7  using System;
8  using System.Linq;
9  using System.Collections.Generic;
10  using System.Diagnostics;
11  using System.Net;
12  using System.Net.Http;
13  using System.Net.Http.Headers;
14  using System.Text;
15  using System.Text.RegularExpressions;
16  using System.Threading;
17  using System.Threading.Tasks;
18  using Microsoft.Rest;
19  using Microsoft.Rest.Serialization;
20  using Newtonsoft.Json;
21 
22 
57  public partial class StateClient : ServiceClient<StateClient>, IStateClient
58  {
62  public Uri BaseUri { get; set; }
63 
67  public JsonSerializerSettings SerializationSettings { get; private set; }
68 
72  public JsonSerializerSettings DeserializationSettings { get; private set; }
73 
77  public ServiceClientCredentials Credentials { get; private set; }
78 
82  public virtual IBotState BotState { get; private set; }
83 
90  protected StateClient(params DelegatingHandler[] handlers) : base(handlers)
91  {
92  this.Initialize();
93  }
94 
104  protected StateClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
105  {
106  this.Initialize();
107  }
108 
118  protected StateClient(Uri baseUri, params DelegatingHandler[] handlers) : this(handlers)
119  {
120  if (baseUri == null)
121  {
122  throw new ArgumentNullException("baseUri");
123  }
124  this.BaseUri = baseUri;
125  }
126 
139  protected StateClient(Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
140  {
141  if (baseUri == null)
142  {
143  throw new ArgumentNullException("baseUri");
144  }
145  this.BaseUri = baseUri;
146  }
147 
157  protected StateClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
158  {
159  if (credentials == null)
160  {
161  throw new ArgumentNullException("credentials");
162  }
163  this.Credentials = credentials;
164  if (this.Credentials != null)
165  {
166  this.Credentials.InitializeServiceClient(this);
167  }
168  }
169 
182  protected StateClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
183  {
184  if (credentials == null)
185  {
186  throw new ArgumentNullException("credentials");
187  }
188  this.Credentials = credentials;
189  if (this.Credentials != null)
190  {
191  this.Credentials.InitializeServiceClient(this);
192  }
193  }
194 
207  protected StateClient(Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
208  {
209  if (baseUri == null)
210  {
211  throw new ArgumentNullException("baseUri");
212  }
213  if (credentials == null)
214  {
215  throw new ArgumentNullException("credentials");
216  }
217  this.BaseUri = baseUri;
218  this.Credentials = credentials;
219  if (this.Credentials != null)
220  {
221  this.Credentials.InitializeServiceClient(this);
222  }
223  }
224 
240  protected StateClient(Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
241  {
242  if (baseUri == null)
243  {
244  throw new ArgumentNullException("baseUri");
245  }
246  if (credentials == null)
247  {
248  throw new ArgumentNullException("credentials");
249  }
250  this.BaseUri = baseUri;
251  this.Credentials = credentials;
252  if (this.Credentials != null)
253  {
254  this.Credentials.InitializeServiceClient(this);
255  }
256  }
257 
261  partial void CustomInitialize();
265  private void Initialize()
266  {
267  this.BotState = new BotState(this);
268  this.BaseUri = new Uri("https://state.botframework.com");
269  SerializationSettings = new JsonSerializerSettings
270  {
271  Formatting = Formatting.Indented,
272  DateFormatHandling = DateFormatHandling.IsoDateFormat,
273  DateTimeZoneHandling = DateTimeZoneHandling.Utc,
274  NullValueHandling = NullValueHandling.Ignore,
275  ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
276  ContractResolver = new ReadOnlyJsonContractResolver(),
277  Converters = new List<JsonConverter>
278  {
279  new Iso8601TimeSpanConverter()
280  }
281  };
282  DeserializationSettings = new JsonSerializerSettings
283  {
284  DateFormatHandling = DateFormatHandling.IsoDateFormat,
285  DateTimeZoneHandling = DateTimeZoneHandling.Utc,
286  NullValueHandling = NullValueHandling.Ignore,
287  ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
288  ContractResolver = new ReadOnlyJsonContractResolver(),
289  Converters = new List<JsonConverter>
290  {
291  new Iso8601TimeSpanConverter()
292  }
293  };
294  CustomInitialize();
295  }
296  }
297 }
The Bot State REST API allows your bot to store and retrieve state associated with conversations cond...
Definition: IStateClient.cs:50
StateClient(Uri baseUri, params DelegatingHandler[] handlers)
Initializes a new instance of the StateClient class.
Definition: StateClient.cs:118
The Bot State REST API allows your bot to store and retrieve state associated with conversations cond...
Definition: StateClient.cs:57
StateClient(params DelegatingHandler[] handlers)
Initializes a new instance of the StateClient class.
Definition: StateClient.cs:90
StateClient(Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers)
Initializes a new instance of the StateClient class.
Definition: StateClient.cs:207
BotState operations.
Definition: IBotState.cs:18
BotState operations.
Definition: BotState.cs:25
StateClient(Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
Initializes a new instance of the StateClient class.
Definition: StateClient.cs:139
StateClient(Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
Initializes a new instance of the StateClient class.
Definition: StateClient.cs:240
StateClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers)
Initializes a new instance of the StateClient class.
Definition: StateClient.cs:157
StateClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
Initializes a new instance of the StateClient class.
Definition: StateClient.cs:182
StateClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
Initializes a new instance of the StateClient class.
Definition: StateClient.cs:104