Exemplo n.º 1
0
 /// <summary>
 /// ReplyToActivity
 /// </summary>
 /// This method allows you to reply to an activity.
 ///
 /// This is slightly different then SendToConversation().
 /// * SendToConverstion(conversationId) - will simply append a message to the
 /// end of the conversation according to the timestamp or semantics of the
 /// channel
 /// * ReplyToConversation(conversationId,ActivityId) - models the semantics of
 /// threaded conversations, meaning it has the information necessary for the
 /// channel to reply to the actual message being responded to.
 ///
 /// ReplyToConversation is almost always preferable to SendToConversation()
 /// because it maintains threaded conversations.
 ///
 /// SendToConversation is appropriate for the first message which initiates a
 /// conversation, or if you don't have a particular activity you are
 /// responding to.
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='conversationId'>
 /// Conversation ID
 /// </param>
 /// <param name='activityId'>
 /// activityId the reply is to (OPTIONAL)
 /// </param>
 /// <param name='activity'>
 /// Activity to send
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <APIResponse> ReplyToActivityAsync(this IConversations operations, string conversationId, string activityId, Activity activity, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ReplyToActivityWithHttpMessagesAsync(conversationId, activityId, activity, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Exemplo n.º 2
0
 public static async Task <ResourceResponse> ReplyToActivityAsync(this IConversations operations, string conversationId, string activityId, Activity activity, Dictionary <string, List <string> > customHeaders, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ReplyToActivityWithHttpMessagesAsync(conversationId, activityId, activity, customHeaders, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// ReplyToActivity
        /// </summary>
        /// <remarks>
        /// This method allows you to reply to an activity.
        ///
        /// This is slightly different from SendToConversation().
        /// * SendToConverstion(conversationId) - will append the activity to the end
        /// of the conversation according to the timestamp or semantics of the channel.
        /// * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply
        /// to another activity, if the channel supports it. If the channel does not
        /// support nested replies, ReplyToActivity falls back to SendToConversation.
        ///
        /// Use ReplyToActivity when replying to a specific activity in the
        /// conversation.
        ///
        /// Use SendToConversation in all other cases.
        /// </remarks>
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='conversationId'>
        /// Conversation ID
        /// </param>
        /// <param name='activityId'>
        /// activityId the reply is to (OPTIONAL)
        /// </param>
        /// <param name='activity'>
        /// Activity to send
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public static async Task <ResourceResponse> ReplyToActivityAsync(this IConversations operations, string conversationId, string activityId, Activity activity, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (activity.Type == ActivityTypes.Trace && activity.ChannelId != "emulator")
            {
                return(new ResourceResponse(activity.Id ?? string.Empty));
            }

            using (var _result = await operations.ReplyToActivityWithHttpMessagesAsync(conversationId, activityId, activity, null, cancellationToken).ConfigureAwait(false))
            {
                return(_result.Body);
            }
        }