ConversationsExtensions.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.Collections;
9  using System.Collections.Generic;
10  using System.Threading;
11  using System.Threading.Tasks;
12  using Microsoft.Rest;
13 
14 
18  public static partial class ConversationsExtensions
19  {
53  {
54  return Task.Factory.StartNew(s => ((IConversations)s).CreateConversationAsync(parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
55  }
56 
92  public static async Task<ConversationResourceResponse> CreateConversationAsync(this IConversations operations, ConversationParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
93  {
94  using (var _result = await operations.CreateConversationWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false))
95  {
96  return await _result.HandleErrorAsync<ConversationResourceResponse>().ConfigureAwait(false);
97  }
98  }
99 
127  public static ResourceResponse SendToConversation(this IConversations operations, Activity activity, string conversationId)
128  {
129  return Task.Factory.StartNew(s => ((IConversations)s).SendToConversationAsync(activity, conversationId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
130  }
131 
162  public static async Task<ResourceResponse> SendToConversationAsync(this IConversations operations, Activity activity, string conversationId, CancellationToken cancellationToken = default(CancellationToken))
163  {
164  using (var _result = await operations.SendToConversationWithHttpMessagesAsync(activity, conversationId, null, cancellationToken).ConfigureAwait(false))
165  {
166  return await _result.HandleErrorAsync<ResourceResponse>().ConfigureAwait(false);
167  }
168  }
169 
192  public static ResourceResponse UpdateActivity(this IConversations operations, string conversationId, string activityId, Activity activity)
193  {
194  return Task.Factory.StartNew(s => ((IConversations)s).UpdateActivityAsync(conversationId, activityId, activity), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
195  }
196 
222  public static async Task<ResourceResponse> UpdateActivityAsync(this IConversations operations, string conversationId, string activityId, Activity activity, CancellationToken cancellationToken = default(CancellationToken))
223  {
224  using (var _result = await operations.UpdateActivityWithHttpMessagesAsync(conversationId, activityId, activity, null, cancellationToken).ConfigureAwait(false))
225  {
226  return await _result.HandleErrorAsync<ResourceResponse>().ConfigureAwait(false);
227  }
228  }
229 
260  public static ResourceResponse ReplyToActivity(this IConversations operations, string conversationId, string activityId, Activity activity)
261  {
262  return Task.Factory.StartNew(s => ((IConversations)s).ReplyToActivityAsync(conversationId, activityId, activity), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
263  }
264 
298  public static async Task<ResourceResponse> ReplyToActivityAsync(this IConversations operations, string conversationId, string activityId, Activity activity, CancellationToken cancellationToken = default(CancellationToken))
299  {
300  using (var _result = await operations.ReplyToActivityWithHttpMessagesAsync(conversationId, activityId, activity, null, cancellationToken).ConfigureAwait(false))
301  {
302  return await _result.HandleErrorAsync<ResourceResponse>().ConfigureAwait(false);
303  }
304  }
305 
322  public static ErrorResponse DeleteActivity(this IConversations operations, string conversationId, string activityId)
323  {
324  return Task.Factory.StartNew(s => ((IConversations)s).DeleteActivityAsync(conversationId, activityId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
325  }
326 
346  public static async Task<ErrorResponse> DeleteActivityAsync(this IConversations operations, string conversationId, string activityId, CancellationToken cancellationToken = default(CancellationToken))
347  {
348  using (var _result = await operations.DeleteActivityWithHttpMessagesAsync(conversationId, activityId, null, cancellationToken).ConfigureAwait(false))
349  {
350  return await _result.HandleErrorAsync().ConfigureAwait(false);
351  }
352  }
353 
367  public static ChannelAccount[] GetConversationMembers(this IConversations operations, string conversationId)
368  {
369  return Task.Factory.StartNew(s => ((IConversations)s).GetConversationMembersAsync(conversationId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
370  }
371 
388  public static async Task<ChannelAccount[]> GetConversationMembersAsync(this IConversations operations, string conversationId, CancellationToken cancellationToken = default(CancellationToken))
389  {
390  using (var _result = await operations.GetConversationMembersWithHttpMessagesAsync(conversationId, null, cancellationToken).ConfigureAwait(false))
391  {
392  return await _result.HandleErrorAsync<ChannelAccount[]>().ConfigureAwait(false);
393  }
394  }
395 
413  public static ChannelAccount[] GetActivityMembers(this IConversations operations, string conversationId, string activityId)
414  {
415  return Task.Factory.StartNew(s => ((IConversations)s).GetActivityMembersAsync(conversationId, activityId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
416  }
417 
438  public static async Task<ChannelAccount[]> GetActivityMembersAsync(this IConversations operations, string conversationId, string activityId, CancellationToken cancellationToken = default(CancellationToken))
439  {
440  using (var _result = await operations.GetActivityMembersWithHttpMessagesAsync(conversationId, activityId, null, cancellationToken).ConfigureAwait(false))
441  {
442  return await _result.HandleErrorAsync<ChannelAccount[]>().ConfigureAwait(false);
443  }
444  }
445 
465  public static ResourceResponse UploadAttachment(this IConversations operations, string conversationId, AttachmentData attachmentUpload)
466  {
467  return Task.Factory.StartNew(s => ((IConversations)s).UploadAttachmentAsync(conversationId, attachmentUpload), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
468  }
469 
492  public static async Task<ResourceResponse> UploadAttachmentAsync(this IConversations operations, string conversationId, AttachmentData attachmentUpload, CancellationToken cancellationToken = default(CancellationToken))
493  {
494  using (var _result = await operations.UploadAttachmentWithHttpMessagesAsync(conversationId, attachmentUpload, null, cancellationToken).ConfigureAwait(false))
495  {
496  return await _result.HandleErrorAsync<ResourceResponse>().ConfigureAwait(false);
497  }
498  }
499 
500  }
501 }
Task< HttpOperationResponse< object > > GetActivityMembersWithHttpMessagesAsync(string conversationId, string activityId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
GetActivityMembers
static ResourceResponse ReplyToActivity(this IConversations operations, string conversationId, string activityId, Activity activity)
ReplyToActivity
Task< HttpOperationResponse< object > > ReplyToActivityWithHttpMessagesAsync(string conversationId, string activityId, Activity activity, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
ReplyToActivity
static async Task< ChannelAccount[]> GetConversationMembersAsync(this IConversations operations, string conversationId, CancellationToken cancellationToken=default(CancellationToken))
GetConversationMembers
static async Task< ResourceResponse > SendToConversationAsync(this IConversations operations, Activity activity, string conversationId, CancellationToken cancellationToken=default(CancellationToken))
SendToConversation
static ResourceResponse UpdateActivity(this IConversations operations, string conversationId, string activityId, Activity activity)
UpdateActivity
Task< HttpOperationResponse< object > > SendToConversationWithHttpMessagesAsync(Activity activity, string conversationId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
SendToConversation
static ConversationResourceResponse CreateConversation(this IConversations operations, ConversationParameters parameters)
CreateConversation
Task< HttpOperationResponse< object > > UploadAttachmentWithHttpMessagesAsync(string conversationId, AttachmentData attachmentUpload, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
UploadAttachment
Task< HttpOperationResponse< ErrorResponse > > DeleteActivityWithHttpMessagesAsync(string conversationId, string activityId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
DeleteActivity
Parameters for creating a new conversation
static async Task< ConversationResourceResponse > CreateConversationAsync(this IConversations operations, ConversationParameters parameters, CancellationToken cancellationToken=default(CancellationToken))
CreateConversation
static ErrorResponse DeleteActivity(this IConversations operations, string conversationId, string activityId)
DeleteActivity
Task< HttpOperationResponse< object > > GetConversationMembersWithHttpMessagesAsync(string conversationId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
GetConversationMembers
static async Task< ChannelAccount[]> GetActivityMembersAsync(this IConversations operations, string conversationId, string activityId, CancellationToken cancellationToken=default(CancellationToken))
GetActivityMembers
An Activity is the basic communication type for the Bot Framework 3.0 protocol
Definition: ActivityEx.cs:18
static async Task< ResourceResponse > UploadAttachmentAsync(this IConversations operations, string conversationId, AttachmentData attachmentUpload, CancellationToken cancellationToken=default(CancellationToken))
UploadAttachment
A response containing a resource ID
static ChannelAccount[] GetActivityMembers(this IConversations operations, string conversationId, string activityId)
GetActivityMembers
static async Task< ResourceResponse > ReplyToActivityAsync(this IConversations operations, string conversationId, string activityId, Activity activity, CancellationToken cancellationToken=default(CancellationToken))
ReplyToActivity
static ChannelAccount[] GetConversationMembers(this IConversations operations, string conversationId)
GetConversationMembers
static ResourceResponse UploadAttachment(this IConversations operations, string conversationId, AttachmentData attachmentUpload)
UploadAttachment
Task< HttpOperationResponse< object > > UpdateActivityWithHttpMessagesAsync(string conversationId, string activityId, Activity activity, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
UpdateActivity
static ResourceResponse SendToConversation(this IConversations operations, Activity activity, string conversationId)
SendToConversation
static async Task< ResourceResponse > UpdateActivityAsync(this IConversations operations, string conversationId, string activityId, Activity activity, CancellationToken cancellationToken=default(CancellationToken))
UpdateActivity
static async Task< ErrorResponse > DeleteActivityAsync(this IConversations operations, string conversationId, string activityId, CancellationToken cancellationToken=default(CancellationToken))
DeleteActivity
Task< HttpOperationResponse< object > > CreateConversationWithHttpMessagesAsync(ConversationParameters parameters, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
CreateConversation
Channel account information needed to route a message