/// <summary>
 /// CreateConversation
 /// </summary>
 /// Create a new Conversation.
 /// 
 /// POST to this method with a
 /// * Bot being the bot creating the conversation
 /// * IsGroup set to true if this is not a direct message (default is false)
 /// * Members array contining the members you want to have be in the
 /// conversation.
 /// 
 /// The return value is a ResourceResponse which contains a conversation id
 /// which is suitable for use
 /// in the message payload and REST API uris.
 /// 
 /// Most channels only support the semantics of bots initiating a direct
 /// message conversation.  An example of how to do that would be:
 /// 
 /// ```
 /// var resource = await connector.conversations.CreateConversation(new
 /// ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new
 /// ChannelAccount("user1") } );
 /// await connect.Conversations.SendToConversationAsync(resource.Id, new
 /// Activity() ... ) ;
 /// 
 /// ```
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='parameters'>
 /// Parameters to create the conversation from
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task<ResourceResponse> CreateConversationAsync(this IConversations operations, ConversationParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     var _result = await operations.CreateConversationWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false);
     return _result.HandleError<ResourceResponse>();
 }
 /// <summary>
 /// CreateConversation
 /// </summary>
 /// Create a new Conversation.
 /// 
 /// POST to this method with a
 /// * Bot being the bot creating the conversation
 /// * IsGroup set to true if this is not a direct message (default is false)
 /// * Members array contining the members you want to have be in the
 /// conversation.
 /// 
 /// The return value is a ResourceResponse which contains a conversation id
 /// which is suitable for use
 /// in the message payload and REST API uris.
 /// 
 /// Most channels only support the semantics of bots initiating a direct
 /// message conversation.  An example of how to do that would be:
 /// 
 /// ```
 /// var resource = await connector.conversations.CreateConversation(new
 /// ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new
 /// ChannelAccount("user1") } );
 /// await connect.Conversations.SendToConversationAsync(resource.Id, new
 /// Activity() ... ) ;
 /// 
 /// ```
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='parameters'>
 /// Parameters to create the conversation from
 /// </param>
 public static ResourceResponse CreateConversation(this IConversations operations, ConversationParameters parameters)
 {
     return Task.Factory.StartNew(s => ((IConversations)s).CreateConversationAsync(parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
示例#3
0
 /// <summary>
 /// CreateConversation
 /// </summary>
 /// <remarks>
 /// Create a new Conversation.
 ///
 /// POST to this method with a
 /// * Bot being the bot creating the conversation
 /// * IsGroup set to true if this is not a direct message (default is false)
 /// * Array containing the members to include in the conversation
 ///
 /// The return value is a ResourceResponse which contains a conversation id
 /// which is suitable for use
 /// in the message payload and REST API uris.
 ///
 /// Most channels only support the semantics of bots initiating a direct
 /// message conversation.  An example of how to do that would be:
 ///
 /// ```
 /// var resource = await connector.conversations.CreateConversation(new
 /// ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new
 /// ChannelAccount("user1") } );
 /// await connect.Conversations.SendToConversationAsync(resource.Id, new
 /// Activity() ... ) ;
 ///
 /// ```
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='parameters'>
 /// Parameters to create the conversation from
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ConversationResourceResponse> CreateConversationAsync(this IConversations operations, ConversationParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateConversationWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// CreateConversation
 /// </summary>
 /// Create a new Conversation.
 ///
 /// POST to this method with a
 /// * Bot being the bot creating the conversation
 /// * IsGroup set to true if this is not a direct message (default is false)
 /// * Members array contining the members you want to have be in the
 /// conversation.
 ///
 /// The return value is a ResourceResponse which contains a conversation id
 /// which is suitable for use
 /// in the message payload and REST API uris.
 ///
 /// Most channels only support the semantics of bots initiating a direct
 /// message conversation.  An example of how to do that would be:
 ///
 /// ```
 /// var resource = await connector.conversations.CreateConversation(new
 /// ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new
 /// ChannelAccount("user1") } );
 /// await connect.Conversations.SendToConversationAsync(resource.Id, new
 /// Activity() ... ) ;
 ///
 /// ```
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='parameters'>
 /// Parameters to create the conversation from
 /// </param>
 public static ResourceResponse CreateConversation(this IConversations operations, ConversationParameters parameters)
 {
     return(Task.Factory.StartNew(s => ((IConversations)s).CreateConversationAsync(parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
示例#5
0
 /// <summary>
 /// CreateConversation
 /// </summary>
 /// <remarks>
 /// Create a new Conversation.
 ///
 /// POST to this method with a
 /// * Bot being the bot creating the conversation
 /// * IsGroup set to true if this is not a direct message (default is false)
 /// * Array containing the members to include in the conversation
 ///
 /// The return value is a ResourceResponse which contains a conversation id
 /// which is suitable for use
 /// in the message payload and REST API uris.
 ///
 /// Most channels only support the semantics of bots initiating a direct
 /// message conversation.  An example of how to do that would be:
 ///
 /// ```
 /// var resource = await connector.conversations.CreateConversation(new
 /// ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new
 /// ChannelAccount("user1") } );
 /// await connect.Conversations.SendToConversationAsync(resource.Id, new
 /// Activity() ... ) ;
 ///
 /// ```
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='parameters'>
 /// Parameters to create the conversation from
 /// </param>
 public static ConversationResourceResponse CreateConversation(this IConversations operations, ConversationParameters parameters)
 {
     return(operations.CreateConversationAsync(parameters).GetAwaiter().GetResult());
 }
示例#6
0
        /// <summary>
        /// CreateConversation
        /// </summary>
        /// Create a new Conversation.
        ///
        /// POST to this method with a
        /// * Bot being the bot creating the conversation
        /// * IsGroup set to true if this is not a direct message (default is false)
        /// * Members array contining the members you want to have be in the
        /// conversation.
        ///
        /// The return value is a ResourceResponse which contains a conversation id
        /// which is suitable for use
        /// in the message payload and REST API uris.
        ///
        /// Most channels only support the semantics of bots initiating a direct
        /// message conversation.  An example of how to do that would be:
        ///
        /// ```
        /// var resource = await connector.conversations.CreateConversation(new
        /// ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new
        /// ChannelAccount("user1") } );
        /// await connect.Conversations.SendToConversationAsync(resource.Id, new
        /// Activity() ... ) ;
        ///
        /// ```
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='parameters'>
        /// Parameters to create the conversation from
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public static async Task <ConversationResourceResponse> CreateConversationAsync(this IConversations operations, ConversationParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
        {
            using (var _result = await operations.CreateConversationWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false))
            {
                var res = await _result.HandleErrorAsync <ConversationResourceResponse>().ConfigureAwait(false);

                MicrosoftAppCredentials.TrustServiceUrl(res.ServiceUrl);
                return(res);
            }
        }