Conversations.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.Net;
11  using System.Net.Http;
12  using System.Net.Http.Headers;
13  using System.Text;
14  using System.Text.RegularExpressions;
15  using System.Threading;
16  using System.Threading.Tasks;
17  using Microsoft.Rest;
18  using Microsoft.Rest.Serialization;
19  using Newtonsoft.Json;
20 
21 
25  public partial class Conversations : IServiceOperations<ConnectorClient>, IConversations
26  {
34  {
35  if (client == null)
36  {
37  throw new ArgumentNullException("client");
38  }
39  this.Client = client;
40  }
41 
45  public ConnectorClient Client { get; private set; }
46 
85  public async Task<HttpOperationResponse<object>> CreateConversationWithHttpMessagesAsync(ConversationParameters parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
86  {
87  if (parameters == null)
88  {
89  throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
90  }
91  // Tracing
92  bool _shouldTrace = ServiceClientTracing.IsEnabled;
93  string _invocationId = null;
94  if (_shouldTrace)
95  {
96  _invocationId = ServiceClientTracing.NextInvocationId.ToString();
97  Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
98  tracingParameters.Add("parameters", parameters);
99  tracingParameters.Add("cancellationToken", cancellationToken);
100  ServiceClientTracing.Enter(_invocationId, this, "CreateConversation", tracingParameters);
101  }
102  // Construct URL
103  var _baseUrl = this.Client.BaseUri.AbsoluteUri;
104  var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v3/conversations").ToString();
105  // Create HTTP transport objects
106  HttpRequestMessage _httpRequest = new HttpRequestMessage();
107  HttpResponseMessage _httpResponse = null;
108  _httpRequest.Method = new HttpMethod("POST");
109  _httpRequest.RequestUri = new Uri(_url);
110  // Set Headers
111  if (customHeaders != null)
112  {
113  foreach(var _header in customHeaders)
114  {
115  if (_httpRequest.Headers.Contains(_header.Key))
116  {
117  _httpRequest.Headers.Remove(_header.Key);
118  }
119  _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
120  }
121  }
122 
123  // Serialize Request
124  string _requestContent = null;
125  if(parameters != null)
126  {
127  _requestContent = SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings);
128  _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
129  _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
130  }
131  // Set Credentials
132  if (this.Client.Credentials != null)
133  {
134  cancellationToken.ThrowIfCancellationRequested();
135  await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
136  }
137  // Send Request
138  if (_shouldTrace)
139  {
140  ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
141  }
142  cancellationToken.ThrowIfCancellationRequested();
143  _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
144  if (_shouldTrace)
145  {
146  ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
147  }
148  HttpStatusCode _statusCode = _httpResponse.StatusCode;
149  cancellationToken.ThrowIfCancellationRequested();
150  string _responseContent = null;
151  if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403 && (int)_statusCode != 404 && (int)_statusCode != 405 && (int)_statusCode != 500 && (int)_statusCode != 503)
152  {
153  var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
154  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
155  ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
156  ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
157  if (_shouldTrace)
158  {
159  ServiceClientTracing.Error(_invocationId, ex);
160  }
161  _httpRequest.Dispose();
162  if (_httpResponse != null)
163  {
164  _httpResponse.Dispose();
165  }
166  throw ex;
167  }
168  // Create Result
169  var _result = new HttpOperationResponse<object>();
170  _result.Request = _httpRequest;
171  _result.Response = _httpResponse;
172  // Deserialize Response
173  if ((int)_statusCode == 200)
174  {
175  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
176  try
177  {
178  _result.Body = SafeJsonConvert.DeserializeObject<ConversationResourceResponse>(_responseContent, this.Client.DeserializationSettings);
179  }
180  catch (JsonException ex)
181  {
182  _httpRequest.Dispose();
183  if (_httpResponse != null)
184  {
185  _httpResponse.Dispose();
186  }
187  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
188  }
189  }
190  // Deserialize Response
191  if ((int)_statusCode == 201)
192  {
193  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
194  try
195  {
196  _result.Body = SafeJsonConvert.DeserializeObject<ConversationResourceResponse>(_responseContent, this.Client.DeserializationSettings);
197  }
198  catch (JsonException ex)
199  {
200  _httpRequest.Dispose();
201  if (_httpResponse != null)
202  {
203  _httpResponse.Dispose();
204  }
205  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
206  }
207  }
208  // Deserialize Response
209  if ((int)_statusCode == 202)
210  {
211  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
212  try
213  {
214  _result.Body = SafeJsonConvert.DeserializeObject<ConversationResourceResponse>(_responseContent, this.Client.DeserializationSettings);
215  }
216  catch (JsonException ex)
217  {
218  _httpRequest.Dispose();
219  if (_httpResponse != null)
220  {
221  _httpResponse.Dispose();
222  }
223  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
224  }
225  }
226  // Deserialize Response
227  if ((int)_statusCode == 400)
228  {
229  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
230  try
231  {
232  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
233  }
234  catch (JsonException ex)
235  {
236  _httpRequest.Dispose();
237  if (_httpResponse != null)
238  {
239  _httpResponse.Dispose();
240  }
241  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
242  }
243  }
244  // Deserialize Response
245  if ((int)_statusCode == 404)
246  {
247  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
248  try
249  {
250  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
251  }
252  catch (JsonException ex)
253  {
254  _httpRequest.Dispose();
255  if (_httpResponse != null)
256  {
257  _httpResponse.Dispose();
258  }
259  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
260  }
261  }
262  // Deserialize Response
263  if ((int)_statusCode == 405)
264  {
265  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
266  try
267  {
268  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
269  }
270  catch (JsonException ex)
271  {
272  _httpRequest.Dispose();
273  if (_httpResponse != null)
274  {
275  _httpResponse.Dispose();
276  }
277  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
278  }
279  }
280  // Deserialize Response
281  if ((int)_statusCode == 500)
282  {
283  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
284  try
285  {
286  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
287  }
288  catch (JsonException ex)
289  {
290  _httpRequest.Dispose();
291  if (_httpResponse != null)
292  {
293  _httpResponse.Dispose();
294  }
295  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
296  }
297  }
298  // Deserialize Response
299  if ((int)_statusCode == 503)
300  {
301  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
302  try
303  {
304  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
305  }
306  catch (JsonException ex)
307  {
308  _httpRequest.Dispose();
309  if (_httpResponse != null)
310  {
311  _httpResponse.Dispose();
312  }
313  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
314  }
315  }
316  if (_shouldTrace)
317  {
318  ServiceClientTracing.Exit(_invocationId, _result);
319  }
320  return _result;
321  }
322 
356  public async Task<HttpOperationResponse<object>> SendToConversationWithHttpMessagesAsync(Activity activity, string conversationId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
357  {
358  if (activity == null)
359  {
360  throw new ValidationException(ValidationRules.CannotBeNull, "activity");
361  }
362  if (conversationId == null)
363  {
364  throw new ValidationException(ValidationRules.CannotBeNull, "conversationId");
365  }
366  // Tracing
367  bool _shouldTrace = ServiceClientTracing.IsEnabled;
368  string _invocationId = null;
369  if (_shouldTrace)
370  {
371  _invocationId = ServiceClientTracing.NextInvocationId.ToString();
372  Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
373  tracingParameters.Add("activity", activity);
374  tracingParameters.Add("conversationId", conversationId);
375  tracingParameters.Add("cancellationToken", cancellationToken);
376  ServiceClientTracing.Enter(_invocationId, this, "SendToConversation", tracingParameters);
377  }
378  // Construct URL
379  var _baseUrl = this.Client.BaseUri.AbsoluteUri;
380  var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v3/conversations/{conversationId}/activities").ToString();
381  _url = _url.Replace("{conversationId}", Uri.EscapeDataString(conversationId));
382  // Create HTTP transport objects
383  HttpRequestMessage _httpRequest = new HttpRequestMessage();
384  HttpResponseMessage _httpResponse = null;
385  _httpRequest.Method = new HttpMethod("POST");
386  _httpRequest.RequestUri = new Uri(_url);
387  // Set Headers
388  if (customHeaders != null)
389  {
390  foreach(var _header in customHeaders)
391  {
392  if (_httpRequest.Headers.Contains(_header.Key))
393  {
394  _httpRequest.Headers.Remove(_header.Key);
395  }
396  _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
397  }
398  }
399 
400  // Serialize Request
401  string _requestContent = null;
402  if(activity != null)
403  {
404  _requestContent = SafeJsonConvert.SerializeObject(activity, this.Client.SerializationSettings);
405  _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
406  _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
407  }
408  // Set Credentials
409  if (this.Client.Credentials != null)
410  {
411  cancellationToken.ThrowIfCancellationRequested();
412  await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
413  }
414  // Send Request
415  if (_shouldTrace)
416  {
417  ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
418  }
419  cancellationToken.ThrowIfCancellationRequested();
420  _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
421  if (_shouldTrace)
422  {
423  ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
424  }
425  HttpStatusCode _statusCode = _httpResponse.StatusCode;
426  cancellationToken.ThrowIfCancellationRequested();
427  string _responseContent = null;
428  if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403 && (int)_statusCode != 404 && (int)_statusCode != 500 && (int)_statusCode != 503)
429  {
430  var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
431  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
432  ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
433  ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
434  if (_shouldTrace)
435  {
436  ServiceClientTracing.Error(_invocationId, ex);
437  }
438  _httpRequest.Dispose();
439  if (_httpResponse != null)
440  {
441  _httpResponse.Dispose();
442  }
443  throw ex;
444  }
445  // Create Result
446  var _result = new HttpOperationResponse<object>();
447  _result.Request = _httpRequest;
448  _result.Response = _httpResponse;
449  // Deserialize Response
450  if ((int)_statusCode == 200)
451  {
452  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
453  try
454  {
455  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
456  }
457  catch (JsonException ex)
458  {
459  _httpRequest.Dispose();
460  if (_httpResponse != null)
461  {
462  _httpResponse.Dispose();
463  }
464  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
465  }
466  }
467  // Deserialize Response
468  if ((int)_statusCode == 201)
469  {
470  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
471  try
472  {
473  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
474  }
475  catch (JsonException ex)
476  {
477  _httpRequest.Dispose();
478  if (_httpResponse != null)
479  {
480  _httpResponse.Dispose();
481  }
482  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
483  }
484  }
485  // Deserialize Response
486  if ((int)_statusCode == 202)
487  {
488  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
489  try
490  {
491  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
492  }
493  catch (JsonException ex)
494  {
495  _httpRequest.Dispose();
496  if (_httpResponse != null)
497  {
498  _httpResponse.Dispose();
499  }
500  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
501  }
502  }
503  // Deserialize Response
504  if ((int)_statusCode == 400)
505  {
506  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
507  try
508  {
509  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
510  }
511  catch (JsonException ex)
512  {
513  _httpRequest.Dispose();
514  if (_httpResponse != null)
515  {
516  _httpResponse.Dispose();
517  }
518  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
519  }
520  }
521  // Deserialize Response
522  if ((int)_statusCode == 404)
523  {
524  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
525  try
526  {
527  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
528  }
529  catch (JsonException ex)
530  {
531  _httpRequest.Dispose();
532  if (_httpResponse != null)
533  {
534  _httpResponse.Dispose();
535  }
536  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
537  }
538  }
539  // Deserialize Response
540  if ((int)_statusCode == 500)
541  {
542  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
543  try
544  {
545  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
546  }
547  catch (JsonException ex)
548  {
549  _httpRequest.Dispose();
550  if (_httpResponse != null)
551  {
552  _httpResponse.Dispose();
553  }
554  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
555  }
556  }
557  // Deserialize Response
558  if ((int)_statusCode == 503)
559  {
560  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
561  try
562  {
563  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
564  }
565  catch (JsonException ex)
566  {
567  _httpRequest.Dispose();
568  if (_httpResponse != null)
569  {
570  _httpResponse.Dispose();
571  }
572  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
573  }
574  }
575  if (_shouldTrace)
576  {
577  ServiceClientTracing.Exit(_invocationId, _result);
578  }
579  return _result;
580  }
581 
610  public async Task<HttpOperationResponse<object>> UpdateActivityWithHttpMessagesAsync(string conversationId, string activityId, Activity activity, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
611  {
612  if (conversationId == null)
613  {
614  throw new ValidationException(ValidationRules.CannotBeNull, "conversationId");
615  }
616  if (activityId == null)
617  {
618  throw new ValidationException(ValidationRules.CannotBeNull, "activityId");
619  }
620  if (activity == null)
621  {
622  throw new ValidationException(ValidationRules.CannotBeNull, "activity");
623  }
624  // Tracing
625  bool _shouldTrace = ServiceClientTracing.IsEnabled;
626  string _invocationId = null;
627  if (_shouldTrace)
628  {
629  _invocationId = ServiceClientTracing.NextInvocationId.ToString();
630  Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
631  tracingParameters.Add("conversationId", conversationId);
632  tracingParameters.Add("activityId", activityId);
633  tracingParameters.Add("activity", activity);
634  tracingParameters.Add("cancellationToken", cancellationToken);
635  ServiceClientTracing.Enter(_invocationId, this, "UpdateActivity", tracingParameters);
636  }
637  // Construct URL
638  var _baseUrl = this.Client.BaseUri.AbsoluteUri;
639  var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v3/conversations/{conversationId}/activities/{activityId}").ToString();
640  _url = _url.Replace("{conversationId}", Uri.EscapeDataString(conversationId));
641  _url = _url.Replace("{activityId}", Uri.EscapeDataString(activityId));
642  // Create HTTP transport objects
643  HttpRequestMessage _httpRequest = new HttpRequestMessage();
644  HttpResponseMessage _httpResponse = null;
645  _httpRequest.Method = new HttpMethod("PUT");
646  _httpRequest.RequestUri = new Uri(_url);
647  // Set Headers
648  if (customHeaders != null)
649  {
650  foreach(var _header in customHeaders)
651  {
652  if (_httpRequest.Headers.Contains(_header.Key))
653  {
654  _httpRequest.Headers.Remove(_header.Key);
655  }
656  _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
657  }
658  }
659 
660  // Serialize Request
661  string _requestContent = null;
662  if(activity != null)
663  {
664  _requestContent = SafeJsonConvert.SerializeObject(activity, this.Client.SerializationSettings);
665  _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
666  _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
667  }
668  // Set Credentials
669  if (this.Client.Credentials != null)
670  {
671  cancellationToken.ThrowIfCancellationRequested();
672  await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
673  }
674  // Send Request
675  if (_shouldTrace)
676  {
677  ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
678  }
679  cancellationToken.ThrowIfCancellationRequested();
680  _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
681  if (_shouldTrace)
682  {
683  ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
684  }
685  HttpStatusCode _statusCode = _httpResponse.StatusCode;
686  cancellationToken.ThrowIfCancellationRequested();
687  string _responseContent = null;
688  if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403 && (int)_statusCode != 404 && (int)_statusCode != 405 && (int)_statusCode != 500 && (int)_statusCode != 503)
689  {
690  var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
691  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
692  ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
693  ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
694  if (_shouldTrace)
695  {
696  ServiceClientTracing.Error(_invocationId, ex);
697  }
698  _httpRequest.Dispose();
699  if (_httpResponse != null)
700  {
701  _httpResponse.Dispose();
702  }
703  throw ex;
704  }
705  // Create Result
706  var _result = new HttpOperationResponse<object>();
707  _result.Request = _httpRequest;
708  _result.Response = _httpResponse;
709  // Deserialize Response
710  if ((int)_statusCode == 200)
711  {
712  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
713  try
714  {
715  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
716  }
717  catch (JsonException ex)
718  {
719  _httpRequest.Dispose();
720  if (_httpResponse != null)
721  {
722  _httpResponse.Dispose();
723  }
724  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
725  }
726  }
727  // Deserialize Response
728  if ((int)_statusCode == 201)
729  {
730  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
731  try
732  {
733  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
734  }
735  catch (JsonException ex)
736  {
737  _httpRequest.Dispose();
738  if (_httpResponse != null)
739  {
740  _httpResponse.Dispose();
741  }
742  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
743  }
744  }
745  // Deserialize Response
746  if ((int)_statusCode == 202)
747  {
748  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
749  try
750  {
751  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
752  }
753  catch (JsonException ex)
754  {
755  _httpRequest.Dispose();
756  if (_httpResponse != null)
757  {
758  _httpResponse.Dispose();
759  }
760  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
761  }
762  }
763  // Deserialize Response
764  if ((int)_statusCode == 400)
765  {
766  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
767  try
768  {
769  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
770  }
771  catch (JsonException ex)
772  {
773  _httpRequest.Dispose();
774  if (_httpResponse != null)
775  {
776  _httpResponse.Dispose();
777  }
778  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
779  }
780  }
781  // Deserialize Response
782  if ((int)_statusCode == 404)
783  {
784  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
785  try
786  {
787  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
788  }
789  catch (JsonException ex)
790  {
791  _httpRequest.Dispose();
792  if (_httpResponse != null)
793  {
794  _httpResponse.Dispose();
795  }
796  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
797  }
798  }
799  // Deserialize Response
800  if ((int)_statusCode == 405)
801  {
802  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
803  try
804  {
805  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
806  }
807  catch (JsonException ex)
808  {
809  _httpRequest.Dispose();
810  if (_httpResponse != null)
811  {
812  _httpResponse.Dispose();
813  }
814  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
815  }
816  }
817  // Deserialize Response
818  if ((int)_statusCode == 500)
819  {
820  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
821  try
822  {
823  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
824  }
825  catch (JsonException ex)
826  {
827  _httpRequest.Dispose();
828  if (_httpResponse != null)
829  {
830  _httpResponse.Dispose();
831  }
832  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
833  }
834  }
835  // Deserialize Response
836  if ((int)_statusCode == 503)
837  {
838  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
839  try
840  {
841  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
842  }
843  catch (JsonException ex)
844  {
845  _httpRequest.Dispose();
846  if (_httpResponse != null)
847  {
848  _httpResponse.Dispose();
849  }
850  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
851  }
852  }
853  if (_shouldTrace)
854  {
855  ServiceClientTracing.Exit(_invocationId, _result);
856  }
857  return _result;
858  }
859 
896  public async Task<HttpOperationResponse<object>> ReplyToActivityWithHttpMessagesAsync(string conversationId, string activityId, Activity activity, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
897  {
898  if (conversationId == null)
899  {
900  throw new ValidationException(ValidationRules.CannotBeNull, "conversationId");
901  }
902  if (activityId == null)
903  {
904  throw new ValidationException(ValidationRules.CannotBeNull, "activityId");
905  }
906  if (activity == null)
907  {
908  throw new ValidationException(ValidationRules.CannotBeNull, "activity");
909  }
910  // Tracing
911  bool _shouldTrace = ServiceClientTracing.IsEnabled;
912  string _invocationId = null;
913  if (_shouldTrace)
914  {
915  _invocationId = ServiceClientTracing.NextInvocationId.ToString();
916  Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
917  tracingParameters.Add("conversationId", conversationId);
918  tracingParameters.Add("activityId", activityId);
919  tracingParameters.Add("activity", activity);
920  tracingParameters.Add("cancellationToken", cancellationToken);
921  ServiceClientTracing.Enter(_invocationId, this, "ReplyToActivity", tracingParameters);
922  }
923  // Construct URL
924  var _baseUrl = this.Client.BaseUri.AbsoluteUri;
925  var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v3/conversations/{conversationId}/activities/{activityId}").ToString();
926  _url = _url.Replace("{conversationId}", Uri.EscapeDataString(conversationId));
927  _url = _url.Replace("{activityId}", Uri.EscapeDataString(activityId));
928  // Create HTTP transport objects
929  HttpRequestMessage _httpRequest = new HttpRequestMessage();
930  HttpResponseMessage _httpResponse = null;
931  _httpRequest.Method = new HttpMethod("POST");
932  _httpRequest.RequestUri = new Uri(_url);
933  // Set Headers
934  if (customHeaders != null)
935  {
936  foreach(var _header in customHeaders)
937  {
938  if (_httpRequest.Headers.Contains(_header.Key))
939  {
940  _httpRequest.Headers.Remove(_header.Key);
941  }
942  _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
943  }
944  }
945 
946  // Serialize Request
947  string _requestContent = null;
948  if(activity != null)
949  {
950  _requestContent = SafeJsonConvert.SerializeObject(activity, this.Client.SerializationSettings);
951  _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
952  _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
953  }
954  // Set Credentials
955  if (this.Client.Credentials != null)
956  {
957  cancellationToken.ThrowIfCancellationRequested();
958  await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
959  }
960  // Send Request
961  if (_shouldTrace)
962  {
963  ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
964  }
965  cancellationToken.ThrowIfCancellationRequested();
966  _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
967  if (_shouldTrace)
968  {
969  ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
970  }
971  HttpStatusCode _statusCode = _httpResponse.StatusCode;
972  cancellationToken.ThrowIfCancellationRequested();
973  string _responseContent = null;
974  if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403 && (int)_statusCode != 404 && (int)_statusCode != 500 && (int)_statusCode != 503)
975  {
976  var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
977  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
978  ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
979  ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
980  if (_shouldTrace)
981  {
982  ServiceClientTracing.Error(_invocationId, ex);
983  }
984  _httpRequest.Dispose();
985  if (_httpResponse != null)
986  {
987  _httpResponse.Dispose();
988  }
989  throw ex;
990  }
991  // Create Result
992  var _result = new HttpOperationResponse<object>();
993  _result.Request = _httpRequest;
994  _result.Response = _httpResponse;
995  // Deserialize Response
996  if ((int)_statusCode == 200)
997  {
998  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
999  try
1000  {
1001  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
1002  }
1003  catch (JsonException ex)
1004  {
1005  _httpRequest.Dispose();
1006  if (_httpResponse != null)
1007  {
1008  _httpResponse.Dispose();
1009  }
1010  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1011  }
1012  }
1013  // Deserialize Response
1014  if ((int)_statusCode == 201)
1015  {
1016  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1017  try
1018  {
1019  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
1020  }
1021  catch (JsonException ex)
1022  {
1023  _httpRequest.Dispose();
1024  if (_httpResponse != null)
1025  {
1026  _httpResponse.Dispose();
1027  }
1028  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1029  }
1030  }
1031  // Deserialize Response
1032  if ((int)_statusCode == 202)
1033  {
1034  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1035  try
1036  {
1037  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
1038  }
1039  catch (JsonException ex)
1040  {
1041  _httpRequest.Dispose();
1042  if (_httpResponse != null)
1043  {
1044  _httpResponse.Dispose();
1045  }
1046  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1047  }
1048  }
1049  // Deserialize Response
1050  if ((int)_statusCode == 400)
1051  {
1052  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1053  try
1054  {
1055  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1056  }
1057  catch (JsonException ex)
1058  {
1059  _httpRequest.Dispose();
1060  if (_httpResponse != null)
1061  {
1062  _httpResponse.Dispose();
1063  }
1064  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1065  }
1066  }
1067  // Deserialize Response
1068  if ((int)_statusCode == 404)
1069  {
1070  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1071  try
1072  {
1073  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1074  }
1075  catch (JsonException ex)
1076  {
1077  _httpRequest.Dispose();
1078  if (_httpResponse != null)
1079  {
1080  _httpResponse.Dispose();
1081  }
1082  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1083  }
1084  }
1085  // Deserialize Response
1086  if ((int)_statusCode == 500)
1087  {
1088  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1089  try
1090  {
1091  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1092  }
1093  catch (JsonException ex)
1094  {
1095  _httpRequest.Dispose();
1096  if (_httpResponse != null)
1097  {
1098  _httpResponse.Dispose();
1099  }
1100  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1101  }
1102  }
1103  // Deserialize Response
1104  if ((int)_statusCode == 503)
1105  {
1106  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1107  try
1108  {
1109  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1110  }
1111  catch (JsonException ex)
1112  {
1113  _httpRequest.Dispose();
1114  if (_httpResponse != null)
1115  {
1116  _httpResponse.Dispose();
1117  }
1118  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1119  }
1120  }
1121  if (_shouldTrace)
1122  {
1123  ServiceClientTracing.Exit(_invocationId, _result);
1124  }
1125  return _result;
1126  }
1127 
1150  public async Task<HttpOperationResponse<ErrorResponse>> DeleteActivityWithHttpMessagesAsync(string conversationId, string activityId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
1151  {
1152  if (conversationId == null)
1153  {
1154  throw new ValidationException(ValidationRules.CannotBeNull, "conversationId");
1155  }
1156  if (activityId == null)
1157  {
1158  throw new ValidationException(ValidationRules.CannotBeNull, "activityId");
1159  }
1160  // Tracing
1161  bool _shouldTrace = ServiceClientTracing.IsEnabled;
1162  string _invocationId = null;
1163  if (_shouldTrace)
1164  {
1165  _invocationId = ServiceClientTracing.NextInvocationId.ToString();
1166  Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
1167  tracingParameters.Add("conversationId", conversationId);
1168  tracingParameters.Add("activityId", activityId);
1169  tracingParameters.Add("cancellationToken", cancellationToken);
1170  ServiceClientTracing.Enter(_invocationId, this, "DeleteActivity", tracingParameters);
1171  }
1172  // Construct URL
1173  var _baseUrl = this.Client.BaseUri.AbsoluteUri;
1174  var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v3/conversations/{conversationId}/activities/{activityId}").ToString();
1175  _url = _url.Replace("{conversationId}", Uri.EscapeDataString(conversationId));
1176  _url = _url.Replace("{activityId}", Uri.EscapeDataString(activityId));
1177  // Create HTTP transport objects
1178  HttpRequestMessage _httpRequest = new HttpRequestMessage();
1179  HttpResponseMessage _httpResponse = null;
1180  _httpRequest.Method = new HttpMethod("DELETE");
1181  _httpRequest.RequestUri = new Uri(_url);
1182  // Set Headers
1183  if (customHeaders != null)
1184  {
1185  foreach(var _header in customHeaders)
1186  {
1187  if (_httpRequest.Headers.Contains(_header.Key))
1188  {
1189  _httpRequest.Headers.Remove(_header.Key);
1190  }
1191  _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
1192  }
1193  }
1194 
1195  // Serialize Request
1196  string _requestContent = null;
1197  // Set Credentials
1198  if (this.Client.Credentials != null)
1199  {
1200  cancellationToken.ThrowIfCancellationRequested();
1201  await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
1202  }
1203  // Send Request
1204  if (_shouldTrace)
1205  {
1206  ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
1207  }
1208  cancellationToken.ThrowIfCancellationRequested();
1209  _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
1210  if (_shouldTrace)
1211  {
1212  ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
1213  }
1214  HttpStatusCode _statusCode = _httpResponse.StatusCode;
1215  cancellationToken.ThrowIfCancellationRequested();
1216  string _responseContent = null;
1217  if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403 && (int)_statusCode != 404 && (int)_statusCode != 405 && (int)_statusCode != 500 && (int)_statusCode != 503)
1218  {
1219  var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
1220  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1221  ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
1222  ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
1223  if (_shouldTrace)
1224  {
1225  ServiceClientTracing.Error(_invocationId, ex);
1226  }
1227  _httpRequest.Dispose();
1228  if (_httpResponse != null)
1229  {
1230  _httpResponse.Dispose();
1231  }
1232  throw ex;
1233  }
1234  // Create Result
1235  var _result = new HttpOperationResponse<ErrorResponse>();
1236  _result.Request = _httpRequest;
1237  _result.Response = _httpResponse;
1238  // Deserialize Response
1239  if ((int)_statusCode == 400)
1240  {
1241  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1242  try
1243  {
1244  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1245  }
1246  catch (JsonException ex)
1247  {
1248  _httpRequest.Dispose();
1249  if (_httpResponse != null)
1250  {
1251  _httpResponse.Dispose();
1252  }
1253  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1254  }
1255  }
1256  // Deserialize Response
1257  if ((int)_statusCode == 404)
1258  {
1259  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1260  try
1261  {
1262  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1263  }
1264  catch (JsonException ex)
1265  {
1266  _httpRequest.Dispose();
1267  if (_httpResponse != null)
1268  {
1269  _httpResponse.Dispose();
1270  }
1271  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1272  }
1273  }
1274  // Deserialize Response
1275  if ((int)_statusCode == 405)
1276  {
1277  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1278  try
1279  {
1280  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1281  }
1282  catch (JsonException ex)
1283  {
1284  _httpRequest.Dispose();
1285  if (_httpResponse != null)
1286  {
1287  _httpResponse.Dispose();
1288  }
1289  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1290  }
1291  }
1292  // Deserialize Response
1293  if ((int)_statusCode == 500)
1294  {
1295  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1296  try
1297  {
1298  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1299  }
1300  catch (JsonException ex)
1301  {
1302  _httpRequest.Dispose();
1303  if (_httpResponse != null)
1304  {
1305  _httpResponse.Dispose();
1306  }
1307  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1308  }
1309  }
1310  // Deserialize Response
1311  if ((int)_statusCode == 503)
1312  {
1313  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1314  try
1315  {
1316  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1317  }
1318  catch (JsonException ex)
1319  {
1320  _httpRequest.Dispose();
1321  if (_httpResponse != null)
1322  {
1323  _httpResponse.Dispose();
1324  }
1325  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1326  }
1327  }
1328  if (_shouldTrace)
1329  {
1330  ServiceClientTracing.Exit(_invocationId, _result);
1331  }
1332  return _result;
1333  }
1334 
1354  public async Task<HttpOperationResponse<object>> GetConversationMembersWithHttpMessagesAsync(string conversationId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
1355  {
1356  if (conversationId == null)
1357  {
1358  throw new ValidationException(ValidationRules.CannotBeNull, "conversationId");
1359  }
1360  // Tracing
1361  bool _shouldTrace = ServiceClientTracing.IsEnabled;
1362  string _invocationId = null;
1363  if (_shouldTrace)
1364  {
1365  _invocationId = ServiceClientTracing.NextInvocationId.ToString();
1366  Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
1367  tracingParameters.Add("conversationId", conversationId);
1368  tracingParameters.Add("cancellationToken", cancellationToken);
1369  ServiceClientTracing.Enter(_invocationId, this, "GetConversationMembers", tracingParameters);
1370  }
1371  // Construct URL
1372  var _baseUrl = this.Client.BaseUri.AbsoluteUri;
1373  var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v3/conversations/{conversationId}/members").ToString();
1374  _url = _url.Replace("{conversationId}", Uri.EscapeDataString(conversationId));
1375  // Create HTTP transport objects
1376  HttpRequestMessage _httpRequest = new HttpRequestMessage();
1377  HttpResponseMessage _httpResponse = null;
1378  _httpRequest.Method = new HttpMethod("GET");
1379  _httpRequest.RequestUri = new Uri(_url);
1380  // Set Headers
1381  if (customHeaders != null)
1382  {
1383  foreach(var _header in customHeaders)
1384  {
1385  if (_httpRequest.Headers.Contains(_header.Key))
1386  {
1387  _httpRequest.Headers.Remove(_header.Key);
1388  }
1389  _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
1390  }
1391  }
1392 
1393  // Serialize Request
1394  string _requestContent = null;
1395  // Set Credentials
1396  if (this.Client.Credentials != null)
1397  {
1398  cancellationToken.ThrowIfCancellationRequested();
1399  await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
1400  }
1401  // Send Request
1402  if (_shouldTrace)
1403  {
1404  ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
1405  }
1406  cancellationToken.ThrowIfCancellationRequested();
1407  _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
1408  if (_shouldTrace)
1409  {
1410  ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
1411  }
1412  HttpStatusCode _statusCode = _httpResponse.StatusCode;
1413  cancellationToken.ThrowIfCancellationRequested();
1414  string _responseContent = null;
1415  if ((int)_statusCode != 200 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403 && (int)_statusCode != 404 && (int)_statusCode != 405 && (int)_statusCode != 500 && (int)_statusCode != 503)
1416  {
1417  var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
1418  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1419  ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
1420  ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
1421  if (_shouldTrace)
1422  {
1423  ServiceClientTracing.Error(_invocationId, ex);
1424  }
1425  _httpRequest.Dispose();
1426  if (_httpResponse != null)
1427  {
1428  _httpResponse.Dispose();
1429  }
1430  throw ex;
1431  }
1432  // Create Result
1433  var _result = new HttpOperationResponse<object>();
1434  _result.Request = _httpRequest;
1435  _result.Response = _httpResponse;
1436  // Deserialize Response
1437  if ((int)_statusCode == 200)
1438  {
1439  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1440  try
1441  {
1442  _result.Body = SafeJsonConvert.DeserializeObject<IList<ChannelAccount>>(_responseContent, this.Client.DeserializationSettings);
1443  }
1444  catch (JsonException ex)
1445  {
1446  _httpRequest.Dispose();
1447  if (_httpResponse != null)
1448  {
1449  _httpResponse.Dispose();
1450  }
1451  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1452  }
1453  }
1454  // Deserialize Response
1455  if ((int)_statusCode == 400)
1456  {
1457  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1458  try
1459  {
1460  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1461  }
1462  catch (JsonException ex)
1463  {
1464  _httpRequest.Dispose();
1465  if (_httpResponse != null)
1466  {
1467  _httpResponse.Dispose();
1468  }
1469  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1470  }
1471  }
1472  // Deserialize Response
1473  if ((int)_statusCode == 404)
1474  {
1475  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1476  try
1477  {
1478  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1479  }
1480  catch (JsonException ex)
1481  {
1482  _httpRequest.Dispose();
1483  if (_httpResponse != null)
1484  {
1485  _httpResponse.Dispose();
1486  }
1487  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1488  }
1489  }
1490  // Deserialize Response
1491  if ((int)_statusCode == 405)
1492  {
1493  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1494  try
1495  {
1496  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1497  }
1498  catch (JsonException ex)
1499  {
1500  _httpRequest.Dispose();
1501  if (_httpResponse != null)
1502  {
1503  _httpResponse.Dispose();
1504  }
1505  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1506  }
1507  }
1508  // Deserialize Response
1509  if ((int)_statusCode == 500)
1510  {
1511  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1512  try
1513  {
1514  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1515  }
1516  catch (JsonException ex)
1517  {
1518  _httpRequest.Dispose();
1519  if (_httpResponse != null)
1520  {
1521  _httpResponse.Dispose();
1522  }
1523  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1524  }
1525  }
1526  // Deserialize Response
1527  if ((int)_statusCode == 503)
1528  {
1529  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1530  try
1531  {
1532  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1533  }
1534  catch (JsonException ex)
1535  {
1536  _httpRequest.Dispose();
1537  if (_httpResponse != null)
1538  {
1539  _httpResponse.Dispose();
1540  }
1541  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1542  }
1543  }
1544  if (_shouldTrace)
1545  {
1546  ServiceClientTracing.Exit(_invocationId, _result);
1547  }
1548  return _result;
1549  }
1550 
1574  public async Task<HttpOperationResponse<object>> GetActivityMembersWithHttpMessagesAsync(string conversationId, string activityId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
1575  {
1576  if (conversationId == null)
1577  {
1578  throw new ValidationException(ValidationRules.CannotBeNull, "conversationId");
1579  }
1580  if (activityId == null)
1581  {
1582  throw new ValidationException(ValidationRules.CannotBeNull, "activityId");
1583  }
1584  // Tracing
1585  bool _shouldTrace = ServiceClientTracing.IsEnabled;
1586  string _invocationId = null;
1587  if (_shouldTrace)
1588  {
1589  _invocationId = ServiceClientTracing.NextInvocationId.ToString();
1590  Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
1591  tracingParameters.Add("conversationId", conversationId);
1592  tracingParameters.Add("activityId", activityId);
1593  tracingParameters.Add("cancellationToken", cancellationToken);
1594  ServiceClientTracing.Enter(_invocationId, this, "GetActivityMembers", tracingParameters);
1595  }
1596  // Construct URL
1597  var _baseUrl = this.Client.BaseUri.AbsoluteUri;
1598  var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v3/conversations/{conversationId}/activities/{activityId}/members").ToString();
1599  _url = _url.Replace("{conversationId}", Uri.EscapeDataString(conversationId));
1600  _url = _url.Replace("{activityId}", Uri.EscapeDataString(activityId));
1601  // Create HTTP transport objects
1602  HttpRequestMessage _httpRequest = new HttpRequestMessage();
1603  HttpResponseMessage _httpResponse = null;
1604  _httpRequest.Method = new HttpMethod("GET");
1605  _httpRequest.RequestUri = new Uri(_url);
1606  // Set Headers
1607  if (customHeaders != null)
1608  {
1609  foreach(var _header in customHeaders)
1610  {
1611  if (_httpRequest.Headers.Contains(_header.Key))
1612  {
1613  _httpRequest.Headers.Remove(_header.Key);
1614  }
1615  _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
1616  }
1617  }
1618 
1619  // Serialize Request
1620  string _requestContent = null;
1621  // Set Credentials
1622  if (this.Client.Credentials != null)
1623  {
1624  cancellationToken.ThrowIfCancellationRequested();
1625  await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
1626  }
1627  // Send Request
1628  if (_shouldTrace)
1629  {
1630  ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
1631  }
1632  cancellationToken.ThrowIfCancellationRequested();
1633  _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
1634  if (_shouldTrace)
1635  {
1636  ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
1637  }
1638  HttpStatusCode _statusCode = _httpResponse.StatusCode;
1639  cancellationToken.ThrowIfCancellationRequested();
1640  string _responseContent = null;
1641  if ((int)_statusCode != 200 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403 && (int)_statusCode != 404 && (int)_statusCode != 405 && (int)_statusCode != 500 && (int)_statusCode != 503)
1642  {
1643  var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
1644  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1645  ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
1646  ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
1647  if (_shouldTrace)
1648  {
1649  ServiceClientTracing.Error(_invocationId, ex);
1650  }
1651  _httpRequest.Dispose();
1652  if (_httpResponse != null)
1653  {
1654  _httpResponse.Dispose();
1655  }
1656  throw ex;
1657  }
1658  // Create Result
1659  var _result = new HttpOperationResponse<object>();
1660  _result.Request = _httpRequest;
1661  _result.Response = _httpResponse;
1662  // Deserialize Response
1663  if ((int)_statusCode == 200)
1664  {
1665  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1666  try
1667  {
1668  _result.Body = SafeJsonConvert.DeserializeObject<IList<ChannelAccount>>(_responseContent, this.Client.DeserializationSettings);
1669  }
1670  catch (JsonException ex)
1671  {
1672  _httpRequest.Dispose();
1673  if (_httpResponse != null)
1674  {
1675  _httpResponse.Dispose();
1676  }
1677  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1678  }
1679  }
1680  // Deserialize Response
1681  if ((int)_statusCode == 400)
1682  {
1683  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1684  try
1685  {
1686  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1687  }
1688  catch (JsonException ex)
1689  {
1690  _httpRequest.Dispose();
1691  if (_httpResponse != null)
1692  {
1693  _httpResponse.Dispose();
1694  }
1695  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1696  }
1697  }
1698  // Deserialize Response
1699  if ((int)_statusCode == 404)
1700  {
1701  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1702  try
1703  {
1704  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1705  }
1706  catch (JsonException ex)
1707  {
1708  _httpRequest.Dispose();
1709  if (_httpResponse != null)
1710  {
1711  _httpResponse.Dispose();
1712  }
1713  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1714  }
1715  }
1716  // Deserialize Response
1717  if ((int)_statusCode == 405)
1718  {
1719  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1720  try
1721  {
1722  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1723  }
1724  catch (JsonException ex)
1725  {
1726  _httpRequest.Dispose();
1727  if (_httpResponse != null)
1728  {
1729  _httpResponse.Dispose();
1730  }
1731  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1732  }
1733  }
1734  // Deserialize Response
1735  if ((int)_statusCode == 500)
1736  {
1737  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1738  try
1739  {
1740  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1741  }
1742  catch (JsonException ex)
1743  {
1744  _httpRequest.Dispose();
1745  if (_httpResponse != null)
1746  {
1747  _httpResponse.Dispose();
1748  }
1749  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1750  }
1751  }
1752  // Deserialize Response
1753  if ((int)_statusCode == 503)
1754  {
1755  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1756  try
1757  {
1758  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1759  }
1760  catch (JsonException ex)
1761  {
1762  _httpRequest.Dispose();
1763  if (_httpResponse != null)
1764  {
1765  _httpResponse.Dispose();
1766  }
1767  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1768  }
1769  }
1770  if (_shouldTrace)
1771  {
1772  ServiceClientTracing.Exit(_invocationId, _result);
1773  }
1774  return _result;
1775  }
1776 
1802  public async Task<HttpOperationResponse<object>> UploadAttachmentWithHttpMessagesAsync(string conversationId, AttachmentData attachmentUpload, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
1803  {
1804  if (conversationId == null)
1805  {
1806  throw new ValidationException(ValidationRules.CannotBeNull, "conversationId");
1807  }
1808  if (attachmentUpload == null)
1809  {
1810  throw new ValidationException(ValidationRules.CannotBeNull, "attachmentUpload");
1811  }
1812  // Tracing
1813  bool _shouldTrace = ServiceClientTracing.IsEnabled;
1814  string _invocationId = null;
1815  if (_shouldTrace)
1816  {
1817  _invocationId = ServiceClientTracing.NextInvocationId.ToString();
1818  Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
1819  tracingParameters.Add("conversationId", conversationId);
1820  tracingParameters.Add("attachmentUpload", attachmentUpload);
1821  tracingParameters.Add("cancellationToken", cancellationToken);
1822  ServiceClientTracing.Enter(_invocationId, this, "UploadAttachment", tracingParameters);
1823  }
1824  // Construct URL
1825  var _baseUrl = this.Client.BaseUri.AbsoluteUri;
1826  var _url = new Uri(new Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v3/conversations/{conversationId}/attachments").ToString();
1827  _url = _url.Replace("{conversationId}", Uri.EscapeDataString(conversationId));
1828  // Create HTTP transport objects
1829  HttpRequestMessage _httpRequest = new HttpRequestMessage();
1830  HttpResponseMessage _httpResponse = null;
1831  _httpRequest.Method = new HttpMethod("POST");
1832  _httpRequest.RequestUri = new Uri(_url);
1833  // Set Headers
1834  if (customHeaders != null)
1835  {
1836  foreach(var _header in customHeaders)
1837  {
1838  if (_httpRequest.Headers.Contains(_header.Key))
1839  {
1840  _httpRequest.Headers.Remove(_header.Key);
1841  }
1842  _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
1843  }
1844  }
1845 
1846  // Serialize Request
1847  string _requestContent = null;
1848  if(attachmentUpload != null)
1849  {
1850  _requestContent = SafeJsonConvert.SerializeObject(attachmentUpload, this.Client.SerializationSettings);
1851  _httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
1852  _httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
1853  }
1854  // Set Credentials
1855  if (this.Client.Credentials != null)
1856  {
1857  cancellationToken.ThrowIfCancellationRequested();
1858  await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
1859  }
1860  // Send Request
1861  if (_shouldTrace)
1862  {
1863  ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
1864  }
1865  cancellationToken.ThrowIfCancellationRequested();
1866  _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
1867  if (_shouldTrace)
1868  {
1869  ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
1870  }
1871  HttpStatusCode _statusCode = _httpResponse.StatusCode;
1872  cancellationToken.ThrowIfCancellationRequested();
1873  string _responseContent = null;
1874  if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403 && (int)_statusCode != 404 && (int)_statusCode != 405 && (int)_statusCode != 500 && (int)_statusCode != 503)
1875  {
1876  var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
1877  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1878  ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
1879  ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
1880  if (_shouldTrace)
1881  {
1882  ServiceClientTracing.Error(_invocationId, ex);
1883  }
1884  _httpRequest.Dispose();
1885  if (_httpResponse != null)
1886  {
1887  _httpResponse.Dispose();
1888  }
1889  throw ex;
1890  }
1891  // Create Result
1892  var _result = new HttpOperationResponse<object>();
1893  _result.Request = _httpRequest;
1894  _result.Response = _httpResponse;
1895  // Deserialize Response
1896  if ((int)_statusCode == 200)
1897  {
1898  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1899  try
1900  {
1901  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
1902  }
1903  catch (JsonException ex)
1904  {
1905  _httpRequest.Dispose();
1906  if (_httpResponse != null)
1907  {
1908  _httpResponse.Dispose();
1909  }
1910  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1911  }
1912  }
1913  // Deserialize Response
1914  if ((int)_statusCode == 201)
1915  {
1916  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1917  try
1918  {
1919  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
1920  }
1921  catch (JsonException ex)
1922  {
1923  _httpRequest.Dispose();
1924  if (_httpResponse != null)
1925  {
1926  _httpResponse.Dispose();
1927  }
1928  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1929  }
1930  }
1931  // Deserialize Response
1932  if ((int)_statusCode == 202)
1933  {
1934  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1935  try
1936  {
1937  _result.Body = SafeJsonConvert.DeserializeObject<ResourceResponse>(_responseContent, this.Client.DeserializationSettings);
1938  }
1939  catch (JsonException ex)
1940  {
1941  _httpRequest.Dispose();
1942  if (_httpResponse != null)
1943  {
1944  _httpResponse.Dispose();
1945  }
1946  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1947  }
1948  }
1949  // Deserialize Response
1950  if ((int)_statusCode == 400)
1951  {
1952  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1953  try
1954  {
1955  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1956  }
1957  catch (JsonException ex)
1958  {
1959  _httpRequest.Dispose();
1960  if (_httpResponse != null)
1961  {
1962  _httpResponse.Dispose();
1963  }
1964  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1965  }
1966  }
1967  // Deserialize Response
1968  if ((int)_statusCode == 404)
1969  {
1970  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1971  try
1972  {
1973  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1974  }
1975  catch (JsonException ex)
1976  {
1977  _httpRequest.Dispose();
1978  if (_httpResponse != null)
1979  {
1980  _httpResponse.Dispose();
1981  }
1982  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
1983  }
1984  }
1985  // Deserialize Response
1986  if ((int)_statusCode == 405)
1987  {
1988  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
1989  try
1990  {
1991  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
1992  }
1993  catch (JsonException ex)
1994  {
1995  _httpRequest.Dispose();
1996  if (_httpResponse != null)
1997  {
1998  _httpResponse.Dispose();
1999  }
2000  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
2001  }
2002  }
2003  // Deserialize Response
2004  if ((int)_statusCode == 500)
2005  {
2006  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
2007  try
2008  {
2009  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
2010  }
2011  catch (JsonException ex)
2012  {
2013  _httpRequest.Dispose();
2014  if (_httpResponse != null)
2015  {
2016  _httpResponse.Dispose();
2017  }
2018  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
2019  }
2020  }
2021  // Deserialize Response
2022  if ((int)_statusCode == 503)
2023  {
2024  _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
2025  try
2026  {
2027  _result.Body = SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
2028  }
2029  catch (JsonException ex)
2030  {
2031  _httpRequest.Dispose();
2032  if (_httpResponse != null)
2033  {
2034  _httpResponse.Dispose();
2035  }
2036  throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
2037  }
2038  }
2039  if (_shouldTrace)
2040  {
2041  ServiceClientTracing.Exit(_invocationId, _result);
2042  }
2043  return _result;
2044  }
2045 
2046  }
2047 }
async Task< HttpOperationResponse< object > > UpdateActivityWithHttpMessagesAsync(string conversationId, string activityId, Activity activity, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
UpdateActivity
Conversations operations.
async Task< HttpOperationResponse< object > > GetActivityMembersWithHttpMessagesAsync(string conversationId, string activityId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
GetActivityMembers
Parameters for creating a new conversation
async Task< HttpOperationResponse< ErrorResponse > > DeleteActivityWithHttpMessagesAsync(string conversationId, string activityId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
DeleteActivity
async Task< HttpOperationResponse< object > > GetConversationMembersWithHttpMessagesAsync(string conversationId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
GetConversationMembers
async Task< HttpOperationResponse< object > > SendToConversationWithHttpMessagesAsync(Activity activity, string conversationId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
SendToConversation
async Task< HttpOperationResponse< object > > UploadAttachmentWithHttpMessagesAsync(string conversationId, AttachmentData attachmentUpload, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
UploadAttachment
Conversations(ConnectorClient client)
Initializes a new instance of the Conversations class.
An Activity is the basic communication type for the Bot Framework 3.0 protocol
Definition: ActivityEx.cs:18
A response containing a resource ID
´╗┐The Bot Connector REST API allows your bot to send and receive messages to channels configured in t...
async Task< HttpOperationResponse< object > > CreateConversationWithHttpMessagesAsync(ConversationParameters parameters, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
CreateConversation
async Task< HttpOperationResponse< object > > ReplyToActivityWithHttpMessagesAsync(string conversationId, string activityId, Activity activity, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
ReplyToActivity