internal MailChimp( IAutomations automations, ICampaigns campaigns, IConversations conversations, IEcomm ecomm, IFolders folders, IGallery gallery, IGoal goal, IHelper helper, ILists lists, IReports reports, ITemplates templates, IUsers users, IVip vip) { Automations = automations; Campaigns = campaigns; Conversations = conversations; Ecomm = ecomm; Folders = folders; Gallery = gallery; Goal = goal; Helper = helper; Lists = lists; Reports = reports; Templates = templates; Users = users; Vip = vip; }
/// <summary> /// Create a new direct conversation between a bot and a user /// </summary> /// <param name='operations'>The operations group for this extension method.</param> /// <param name='botAddress'>Bot to create conversation from</param> /// <param name='userAddress'>User to create conversation with</param> /// <param name="activity">(OPTIONAL) initial message to send to the new conversation</param> /// <param name='cancellationToken'>The cancellation token</param> public static async Task <ConversationResourceResponse> CreateDirectConversationAsync(this IConversations operations, string botAddress, string userAddress, Activity activity = null, CancellationToken cancellationToken = default(CancellationToken)) { var _result = await operations.CreateConversationWithHttpMessagesAsync(GetDirectParameters(botAddress, userAddress, activity), null, cancellationToken).ConfigureAwait(false); var res = _result.Body; MicrosoftAppCredentials.TrustServiceUrl(res.ServiceUrl); return(res); }
/// <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> public static ResourceResponse SendToConversation(this IConversations operations, Activity activity) { return(Task.Factory.StartNew(s => ((IConversations)s).SendToConversationAsync(activity.Conversation.Id, activity), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Update an activity in an existing conversation /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='activity'> /// Activity to update /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static Task <ResourceResponse> UpdateActivityAsync(this IConversations operations, Activity activity, CancellationToken cancellationToken = default(CancellationToken)) { return(operations.UpdateActivityAsync(activity.Conversation.Id, activity.Id, activity, cancellationToken)); }
/// <summary> /// Create a new direct conversation between a bot and a user /// </summary> /// <param name='operations'>The operations group for this extension method.</param> /// <param name='botAddress'>Bot to create conversation from</param> /// <param name='userAddress'>User to create conversation with</param> /// <param name="activity">(OPTIONAL) initial message to send to the new conversation</param> public static ConversationResourceResponse CreateDirectConversation(this IConversations operations, string botAddress, string userAddress, Activity activity = null) { return(Task.Factory.StartNew(s => ((IConversations)s).CreateConversationAsync(GetDirectParameters(botAddress, userAddress, activity)), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Create a new direct conversation between a bot and a user /// </summary> /// <param name='operations'>The operations group for this extension method.</param> /// <param name='bot'>Bot to create conversation from</param> /// <param name='user'>User to create conversation with</param> /// <param name='cancellationToken'>The cancellation token.</param> public static async Task <ResourceResponse> CreateDirectConversationAsync(this IConversations operations, ChannelAccount bot, ChannelAccount user, CancellationToken cancellationToken = default(CancellationToken)) { var _result = await operations.CreateConversationWithHttpMessagesAsync(GetDirectParameters(bot, user), null, cancellationToken).ConfigureAwait(false); return(await _result.HandleErrorAsync <ResourceResponse>().ConfigureAwait(false)); }
/// <summary> /// Create a new direct conversation between a bot and a user /// </summary> /// <param name='operations'>The operations group for this extension method.</param> /// <param name='botAddress'>Bot to create conversation from</param> /// <param name='userAddress'>User to create conversation with</param> /// <param name="activity">(OPTIONAL) initial message to send to the new conversation</param> /// <param name='cancellationToken'>The cancellation token</param> public static async Task <ConversationResourceResponse> CreateDirectConversationAsync(this IConversations operations, string botAddress, string userAddress, Activity activity = null, CancellationToken cancellationToken = default(CancellationToken)) { var _result = await operations.CreateConversationWithHttpMessagesAsync(GetDirectParameters(botAddress, userAddress, activity), null, cancellationToken).ConfigureAwait(false); return(await _result.HandleErrorAsync <ConversationResourceResponse>().ConfigureAwait(false)); }
/// <summary> /// Create a new direct conversation between a bot and a user /// </summary> /// <param name='operations'>The operations group for this extension method.</param> /// <param name='bot'>Bot to create conversation from</param> /// <param name='user'>User to create conversation with</param> public static ResourceResponse CreateDirectConversation(this IConversations operations, ChannelAccount bot, ChannelAccount user) { return(Task.Factory.StartNew(s => ((IConversations)s).CreateConversationAsync(GetDirectParameters(bot, user)), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <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> /// DeleteConversationMember /// </summary> /// <remarks> /// Deletes a member from a conversation. /// /// This REST API takes a ConversationId and a memberId (of type string) and /// removes that member from the conversation. If that member was the last /// member /// of the conversation, the conversation will also be deleted. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='conversationId'> /// Conversation ID /// </param> /// <param name='memberId'> /// ID of the member to delete from this conversation /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task DeleteConversationMemberAsync(this IConversations operations, string conversationId, string memberId, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteConversationMemberWithHttpMessagesAsync(conversationId, memberId, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// GetConversationPagedMembers /// </summary> /// <remarks> /// Enumerate the members of a conversation one page at a time. /// /// This REST API takes a ConversationId. Optionally a pageSize and/or /// continuationToken can be provided. It returns a PagedMembersResult, which /// contains an array /// of ChannelAccounts representing the members of the conversation and a /// continuation token that can be used to get more values. /// /// One page of ChannelAccounts records are returned with each call. The number /// of records in a page may vary between channels and calls. The pageSize /// parameter can be used as /// a suggestion. If there are no additional results the response will not /// contain a continuation token. If there are no members in the conversation /// the Members will be empty or not present in the response. /// /// A response to a request that has a continuation token from a prior request /// may rarely return members from a previous request. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='conversationId'> /// Conversation ID /// </param> /// <param name='pageSize'> /// Suggested page size /// </param> /// <param name='continuationToken'> /// Continuation Token /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <PagedMembersResult> GetConversationPagedMembersAsync(this IConversations operations, string conversationId, int?pageSize = default(int?), string continuationToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetConversationPagedMembersWithHttpMessagesAsync(conversationId, pageSize, continuationToken, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// GetConversationMembers /// </summary> /// <remarks> /// Enumerate the members of a conversation. /// /// This REST API takes a ConversationId and returns an array of ChannelAccount /// objects representing the members of the conversation. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='conversationId'> /// Conversation ID /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <ChannelAccount> > GetConversationMembersAsync(this IConversations operations, string conversationId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetConversationMembersWithHttpMessagesAsync(conversationId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }