Esempio n. 1
0
        public async Task<UrlClicked> GetClickReportDetailsAsync(BaseRequest request, string campaignId, string linkId)
        {
            using (var client = CreateMailClient("reports/"))
            {
                var response = await client.GetAsync($"{campaignId}/click-details/{linkId}{request.ToQueryString()}");
                await response.EnsureSuccessMailChimpAsync();

                return await response.Content.ReadAsAsync<UrlClicked>();
            }
        }
Esempio n. 2
0
        public async Task<Report> GetReportAsync(BaseRequest request, string campaignId)
        {
            using (var client = CreateMailClient("reports/"))
            {
                var response = await client.GetAsync(campaignId + request.ToQueryString());
                await response.EnsureSuccessMailChimpAsync();

                return await response.Content.ReadAsAsync<Report>();
            }
        }
Esempio n. 3
0
        public async Task<IEnumerable<Advice>> GetCampaignAdviceAsync(BaseRequest request, string campaignId)
        {
            using (var client = CreateMailClient("reports/"))
            {
                var response = await client.GetAsync($"{campaignId}/advice{request.ToQueryString()}");
                await response.EnsureSuccessMailChimpAsync();

                var campaignAdviceReport = await response.Content.ReadAsAsync<CampaignAdviceReport>();
                return campaignAdviceReport.Advice;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// The get all async.
        /// </summary>
        /// <param name="listId">
        /// The list Id.
        /// </param>
        /// <param name="request">
        /// The request.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="requestUri"/> was null.
        /// </exception>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task<ActivityResponse> GetResponseAsync(string listId, BaseRequest request = null)
        {
            using (var client = this.CreateMailClient("lists/"))
            {
                var response = await client.GetAsync($"{listId}/activity{request.ToQueryString()}").ConfigureAwait(false);
                await response.EnsureSuccessMailChimpAsync().ConfigureAwait(false);

                var appResponse = await response.Content.ReadAsAsync<ActivityResponse>().ConfigureAwait(false);
                return appResponse;
            }
        }
Esempio n. 5
0
        public async Task<ClickMember> GetClickReportMemberAsync(BaseRequest request, string campaignId, string linkId,
            string emailAddress)
        {
            using (var client = CreateMailClient("reports/"))
            {
                var response =
                    await
                        client.GetAsync(
                            $"{campaignId}/click-details/{linkId}/members/{Hash(emailAddress)}{request.ToQueryString()}");
                await response.EnsureSuccessMailChimpAsync();

                return await response.Content.ReadAsAsync<ClickMember>();
            }
        }
Esempio n. 6
0
 public async Task<Unsubscribe> GetUnsubscriberAsync(BaseRequest request, string campaignId, string emailAddress)
 {
     using (var client = CreateMailClient("reports"))
     {
         var response =
             await client.GetAsync($"{campaignId}/unsubscribed/{Hash(emailAddress)}{request.ToQueryString()}");
         await response.EnsureSuccessMailChimpAsync();
         return await response.Content.ReadAsAsync<Unsubscribe>();
     }
 }
Esempio n. 7
0
 public async Task<IEnumerable<Report>> GetSubReportAsync(BaseRequest request, string campaignId)
 {
     using (var client = CreateMailClient("reports"))
     {
         var response = await client.GetAsync($"{campaignId}/sub-reports{request.ToQueryString()}");
         await response.EnsureSuccessMailChimpAsync();
         var reportResponse = await response.Content.ReadAsAsync<ReportResponse>();
         return reportResponse.Reports;
     }
 }
Esempio n. 8
0
        public async Task<IEnumerable<OpenLocation>> GetLocationsAsync(BaseRequest request, string campaignId)
        {
            using (var client = CreateMailClient("reports/"))
            {
                var response = await client.GetAsync($"{campaignId}/locations{request.ToQueryString()}");
                await response.EnsureSuccessMailChimpAsync();

                var openLocationResponse = await response.Content.ReadAsAsync<OpenLocationResponse>();
                return openLocationResponse.Locations;
            }
        }
Esempio n. 9
0
        public async Task<EmailActivity> GetEmailActivityAsync(BaseRequest request, string campaignId,
            string emailAddress)
        {
            using (var client = CreateMailClient("reports/"))
            {
                var response =
                    await client.GetAsync($"{campaignId}/email-activity/{Hash(emailAddress)}{request.ToQueryString()}");
                await response.EnsureSuccessMailChimpAsync();

                return await response.Content.ReadAsAsync<EmailActivity>();
            }
        }
Esempio n. 10
0
        public async Task<EepUrlActivity> GetEepUrlReportAsync(BaseRequest request, string campaignId)
        {
            using (var client = CreateMailClient("reports/"))
            {
                var response = await client.GetAsync($"{campaignId}/click-details/eepurl{request.ToQueryString()}");
                await response.EnsureSuccessMailChimpAsync();

                return await response.Content.ReadAsAsync<EepUrlActivity>();
            }
        }
Esempio n. 11
0
        public async Task<IEnumerable<Domain>> GetDomainPerformanceAsync(BaseRequest request, string campaignId)
        {
            using (var client = CreateMailClient("reports/"))
            {
                var response = await client.GetAsync($"{campaignId}/domain-performance{request.ToQueryString()}");
                await response.EnsureSuccessMailChimpAsync();

                var domainPerformanceResponse = await response.Content.ReadAsAsync<DomainPerformanceResponse>();
                return domainPerformanceResponse.Domains;
            }
        }