Пример #1
0
        /// <summary>
        ///   Pause a subaccount's sending. Any future emails delivered to this subaccount will be queued for a maximum of 3 days
        ///   until the subaccount is resumed.
        ///   <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=pause">Mandrill API Documentation</see>
        /// </summary>
        /// <param name="request">The request</param>
        /// <returns>the information for the paused subaccount</returns>
        public async Task <SubaccountInfo> PauseSubaccount(PauseSubAccountRequest request)
        {
            const string path = "subaccounts/pause.json";

            SubaccountInfo resp = await Post <SubaccountInfo>(path, request).ConfigureAwait(false);

            return(resp);
        }
Пример #2
0
        /// <summary>
        ///   Given the ID of an existing subaccount, asynchronously return the data about it
        ///   <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=info">Mandrill API Documentation</see>
        /// </summary>
        /// <param name="request">The request</param>
        /// <returns>the information about the subaccount</returns>
        public async Task <SubaccountInfo> SubaccountInfo(SubAccountInfoRequest request)
        {
            const string path = "subaccounts/info.json";

            SubaccountInfo response = await Post <SubaccountInfo>(path, request).ConfigureAwait(false);

            return(response);
        }
Пример #3
0
        /// <summary>
        ///   Delete an existing subaccount. Any email related to the subaccount will be saved, but stats will be removed and any
        ///   future sending calls to this subaccount will fail.
        ///   <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=delete">Mandrill API Documentation</see>
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>the information for the deleted subaccount</returns>
        public async Task <SubaccountInfo> DeleteSubaccount(DeleteSubAccountRequest request)
        {
            const string path = "/subaccounts/delete.json";

            SubaccountInfo resp = await Post <SubaccountInfo>(path, request);

            return(resp);
        }
Пример #4
0
        /// <summary>
        ///   Resume a paused subaccount's sending
        ///   <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=resume">Mandrill API Documentation</see>
        /// </summary>
        /// <param name="request">The request</param>
        /// <returns>the information for the resumed subaccount</returns>
        public async Task <SubaccountInfo> ResumeSubaccount(ResumeSubAccountRequest request)
        {
            const string path = "/subaccounts/resume.json";

            SubaccountInfo response = await Post <SubaccountInfo>(path, request);

            return(response);
        }
Пример #5
0
    /// <summary>
    ///   Given the ID of an existing subaccount, asynchronously return the data about it
    ///   <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=info">Mandrill API Documentation</see>
    /// </summary>
    /// <param name="request">The request</param>
    /// <returns>the information about the subaccount</returns>
    public async Task<SubaccountInfo> SubaccountInfo(SubAccountInfoRequest request)
    {
      const string path = "subaccounts/info.json";

      SubaccountInfo response = await Post<SubaccountInfo>(path, request);

      return response;
    }
Пример #6
0
    /// <summary>
    ///   Pause a subaccount's sending. Any future emails delivered to this subaccount will be queued for a maximum of 3 days
    ///   until the subaccount is resumed.
    ///   <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=pause">Mandrill API Documentation</see>
    /// </summary>
    /// <param name="request">The request</param>
    /// <returns>the information for the paused subaccount</returns>
    public async Task<SubaccountInfo> PauseSubaccount(PauseSubAccountRequest request)
    {
      const string path = "subaccounts/pause.json";

      SubaccountInfo resp = await Post<SubaccountInfo>(path, request);

      return resp;
    }
Пример #7
0
    /// <summary>
    ///   Update an existing subaccount
    ///   <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=update">Mandrill API Documentation</see>
    /// </summary>
    /// <param name="request">The request</param>
    /// <returns>the information for the updated subaccount</returns>
    public async Task<SubaccountInfo> UpdateSubaccount(UpdateSubAccountRequest request)
    {
      const string path = "subaccounts/update.json";

      SubaccountInfo response = await Post<SubaccountInfo>(path, request);

      return response;
    }
Пример #8
0
 /// <summary>
 ///     Update an existing subaccount
 ///     <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=update">Mandrill API Documentation</see>
 /// </summary>
 /// <param name="subaccount">The subaccount to update</param>
 /// <param name="notes">Optional extra text to associate with the subaccount</param>
 /// <returns>the information for the updated subaccount</returns>
 public SubaccountInfo UpdateSubaccount(SubaccountInfo subaccount, string notes = "")
 {
     try
     {
         return(this.UpdateSubaccountAsync(subaccount, notes).Result);
     }
     catch (AggregateException aex)
     {
         //catch and throw the inner exception
         throw aex.Flatten().InnerException;
     }
 }
Пример #9
0
        /// <summary>
        ///     Asynchronously add a new subaccount.
        ///     <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=add">Mandrill API Documentation</see>
        /// </summary>
        /// <param name="subaccount">The subaccount to add</param>
        /// <param name="notes">Optional extra text to associate with the subaccount</param>
        /// <returns>the information saved about the new subaccount</returns>
        public Task<SubaccountInfo> AddSubaccountAsync(SubaccountInfo subaccount, string notes)
        {
            const string path = "/subaccounts/add.json";

            dynamic payload = new ExpandoObject();
            payload.id = subaccount.Id;
            payload.name = subaccount.Name;
            payload.notes = notes;
            payload.custom_quota = subaccount.CustomQuota;

            return this.PostAsync<SubaccountInfo>(path, payload);
        }
Пример #10
0
 /// <summary>
 ///     Add a new subaccount.
 ///     <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=add">Mandrill API Documentation</see>
 /// </summary>
 /// <param name="subaccount">The subaccount to add</param>
 /// <param name="notes">Optional extra text to associate with the subaccount</param>
 /// <returns>the information saved about the new subaccount</returns>
 public SubaccountInfo AddSubaccount(SubaccountInfo subaccount, string notes = "")
 {
     try
     {
         return this.AddSubaccountAsync(subaccount, notes).Result;
     }
     catch (AggregateException aex)
     {
         //catch and throw the inner exception
         throw aex.Flatten().InnerException;
     }
 }
Пример #11
0
        /// <summary>
        ///     Asynchronously add a new subaccount.
        ///     <see cref="https://mandrillapp.com/api/docs/subaccounts.JSON.html#method=add">Mandrill API Documentation</see>
        /// </summary>
        /// <param name="subaccount">The subaccount to add</param>
        /// <param name="notes">Optional extra text to associate with the subaccount</param>
        /// <returns>the information saved about the new subaccount</returns>
        public Task <SubaccountInfo> AddSubaccountAsync(SubaccountInfo subaccount, string notes)
        {
            const string path = "/subaccounts/add.json";

            dynamic payload = new ExpandoObject();

            payload.id           = subaccount.Id;
            payload.name         = subaccount.Name;
            payload.notes        = notes;
            payload.custom_quota = subaccount.CustomQuota;

            return(this.PostAsync <SubaccountInfo>(path, payload));
        }