ConnectorClient.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 
52  public partial class ConnectorClient : ServiceClient<ConnectorClient>, IConnectorClient
53  {
57  public Uri BaseUri { get; set; }
58 
62  public JsonSerializerSettings SerializationSettings { get; private set; }
63 
67  public JsonSerializerSettings DeserializationSettings { get; private set; }
68 
72  public ServiceClientCredentials Credentials { get; private set; }
73 
77  public virtual IAttachments Attachments { get; private set; }
78 
82  public virtual IConversations Conversations { get; private set; }
83 
90  protected ConnectorClient(params DelegatingHandler[] handlers) : base(handlers)
91  {
92  this.Initialize();
93  }
94 
104  protected ConnectorClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
105  {
106  this.Initialize();
107  }
108 
118  protected ConnectorClient(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 ConnectorClient(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 ConnectorClient(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 ConnectorClient(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 ConnectorClient(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 ConnectorClient(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.Attachments = new Attachments(this);
268  this.Conversations = new Conversations(this);
269  this.BaseUri = new Uri("https://api.botframework.com");
270  SerializationSettings = new JsonSerializerSettings
271  {
272  Formatting = Formatting.Indented,
273  DateFormatHandling = DateFormatHandling.IsoDateFormat,
274  DateTimeZoneHandling = DateTimeZoneHandling.Utc,
275  NullValueHandling = NullValueHandling.Ignore,
276  ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
277  ContractResolver = new ReadOnlyJsonContractResolver(),
278  Converters = new List<JsonConverter>
279  {
280  new Iso8601TimeSpanConverter()
281  }
282  };
283  DeserializationSettings = new JsonSerializerSettings
284  {
285  DateFormatHandling = DateFormatHandling.IsoDateFormat,
286  DateTimeZoneHandling = DateTimeZoneHandling.Utc,
287  NullValueHandling = NullValueHandling.Ignore,
288  ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
289  ContractResolver = new ReadOnlyJsonContractResolver(),
290  Converters = new List<JsonConverter>
291  {
292  new Iso8601TimeSpanConverter()
293  }
294  };
295  CustomInitialize();
296  }
297  }
298 }
ConnectorClient(params DelegatingHandler[] handlers)
Initializes a new instance of the ConnectorClient class.
Conversations operations.
ConnectorClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
Initializes a new instance of the ConnectorClient class.
ConnectorClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
Initializes a new instance of the ConnectorClient class.
ConnectorClient(Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
Initializes a new instance of the ConnectorClient class.
Attachments operations.
Definition: IAttachments.cs:18
ConnectorClient(Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers)
Initializes a new instance of the ConnectorClient class.
ConnectorClient(Uri baseUri, params DelegatingHandler[] handlers)
Initializes a new instance of the ConnectorClient class.
The Bot Connector REST API allows your bot to send and receive messages to channels configured in t...
ConnectorClient(Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
Initializes a new instance of the ConnectorClient class.
Attachments operations.
ConnectorClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers)
Initializes a new instance of the ConnectorClient class.
The Bot Connector REST API allows your bot to send and receive messages to channels configured in t...