/// <summary>
 /// Schedule Campaign (Set campaign sending time)
 /// </summary>
 /// <param name="campaignId">campaignId is to choose specific campaign which we want to send</param>
 /// <param name="content">It is to set our campaign sending time </param>
 public void ScheduleCampaign(string campaignId, CampaignScheduleRequest content = null)
 {
     if (campaignId != null && content != null)
     {
         mailChimpManager.Campaigns.ScheduleAsync(campaignId, content);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// The send test request async.
        /// </summary>
        /// <param name="campaignId">
        /// The campaign Id.
        /// </param>
        /// <param name="content"></param>
        /// <exception cref="ArgumentNullException">
        /// The <paramref>
        ///         <name>requestUri</name>
        ///     </paramref>
        ///     was null.
        /// </exception>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        /// <exception cref="UriFormatException">In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, <see cref="T:System.FormatException" />, instead.<paramref name="uriString" /> is empty.-or- The scheme specified in <paramref name="uriString" /> is not correctly formed. See <see cref="M:System.Uri.CheckSchemeName(System.String)" />.-or- <paramref name="uriString" /> contains too many slashes.-or- The password specified in <paramref name="uriString" /> is not valid.-or- The host name specified in <paramref name="uriString" /> is not valid.-or- The file name specified in <paramref name="uriString" /> is not valid. -or- The user name specified in <paramref name="uriString" /> is not valid.-or- The host or authority name specified in <paramref name="uriString" /> cannot be terminated by backslashes.-or- The port number specified in <paramref name="uriString" /> is not valid or cannot be parsed.-or- The length of <paramref name="uriString" /> exceeds 65519 characters.-or- The length of the scheme specified in <paramref name="uriString" /> exceeds 1023 characters.-or- There is an invalid character sequence in <paramref name="uriString" />.-or- The MS-DOS path specified in <paramref name="uriString" /> must start with c:\\.</exception>
        /// <exception cref="MailChimpException">
        /// Custom Mail Chimp Exception
        /// </exception>
        public async Task ScheduleAsync(string campaignId, CampaignScheduleRequest content = null)
        {
            using (var client = this.CreateMailClient("campaigns/"))
            {
                var response = await client.PostAsJsonAsync($"{campaignId}/actions/schedule", content).ConfigureAwait(false);

                await response.EnsureSuccessMailChimpAsync().ConfigureAwait(false);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Schedule sync
        /// </summary>
        /// <param name="campaignId"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public void Schedule(string campaignId, CampaignScheduleRequest content = null)
        {
            //Crate a web request with MC us1 URL
            string requestUrl = $"campaigns/{campaignId}/actions/schedule";

            var jsonHttpWebRequest = this.CreateJsonWebRequest(requestUrl, "POST");

            //Get JSON content for the request
            string responseJsonContent = this.GetJsonResponseFromRequest(jsonHttpWebRequest, content);
        }