Exemplo n.º 1
0
 /// <summary>
 /// Sends to conversation with retries asynchronously.
 /// </summary>
 /// <param name="conversation">The conversation.</param>
 /// <param name="activity">The activity.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>Resource response.</returns>
 public static async Task <ResourceResponse> SendToConversationWithRetriesAsync(
     this IConversations conversation,
     Activity activity,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await ExecuteWithRetries(() => conversation.SendToConversationAsync(activity, cancellationToken), conversation));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Reply to an activity in an existing conversation
        /// </summary>
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='activity'>
        /// Activity to send
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public static Task <APIResponse> ReplyToActivityAsync(this IConversations operations, Activity activity, CancellationToken cancellationToken = default(CancellationToken))
        {
            // TEMP TODO REMOVE THIS AFTER SKYPE DEPLOYS NEW SERVICE WHICH PROPERLY IMPLEMENTS THIS ENDPOINT
            if (activity.ReplyToId == "0")
            {
                return(operations.SendToConversationAsync(activity));
            }

            return(operations.ReplyToActivityAsync(activity.Conversation.Id, activity.ReplyToId, activity, cancellationToken));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Reply to an activity in an existing conversation
        /// </summary>
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='activity'>
        /// Activity to send
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public static Task <ResourceResponse> ReplyToActivityAsync(this IConversations operations, Activity activity, CancellationToken cancellationToken = default(CancellationToken))
        {
            // TEMP TODO REMOVE THIS AFTER SKYPE DEPLOYS NEW SERVICE WHICH PROPERLY IMPLEMENTS THIS ENDPOINT
            if (activity.ReplyToId == "0")
            {
                return(operations.SendToConversationAsync(activity));
            }

            if (activity.ReplyToId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "ReplyToId");
            }

            return(operations.ReplyToActivityAsync(activity.Conversation.Id, activity.ReplyToId, activity, cancellationToken));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Send an activity to a conversation
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='activity'>
 /// Activity to send
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static Task <APIResponse> SendToConversationAsync(this IConversations operations, Activity activity, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(operations.SendToConversationAsync(activity, activity.Conversation.Id, cancellationToken));
 }
Exemplo n.º 5
0
 public static Task <ResourceResponse> SendToConversationAsync(this IConversations operations, Activity activity, Dictionary <string, List <string> > customHeaders, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(operations.SendToConversationAsync(activity.Conversation.Id, activity, customHeaders, cancellationToken));
 }
Exemplo n.º 6
0
 public static ResourceResponse SendToConversation(this IConversations operations, string conversationId, Activity activity, Dictionary <string, List <string> > customHeaders)
 {
     return(operations.SendToConversationAsync(conversationId, activity, customHeaders).GetAwaiter().GetResult());
 }
 /// <summary>
 /// SendToConversation
 /// </summary>
 /// <remarks>
 /// This method allows you to send an activity to the end of a conversation.
 ///
 /// This is slightly different from ReplyToActivity().
 /// * 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='activity'>
 /// Activity to send
 /// </param>
 public static ResourceResponse SendToConversation(this IConversations operations, string conversationId, Activity activity)
 {
     return(operations.SendToConversationAsync(conversationId, activity).GetAwaiter().GetResult());
 }