/// <summary> /// Get a specific campaign /// </summary> /// <param name="accountID">Your Account ID, used for authorization (Found in the EmailCampaigns app in the "API credentials" page in Settings)</param> /// <param name="campaignID">This is the ID of the Campaign that you want to retrieve</param> /// <param name="cancellationToken">An optional cancellation token to abort this request</param> /// <returns></returns> public async Task <Campaign> GetCampaignAsync(Guid accountID, Guid campaignID, bool?includePreviewHtmlBody = null, CancellationToken cancellationToken = default) { QueryStringBuilder query = new QueryStringBuilder($"/bulkemail/v1.0/accounts/{accountID}/campaigns/{campaignID}"); if (includePreviewHtmlBody != default) { query.Add("includePreviewHtmlBody", includePreviewHtmlBody); } return(await GetAsync <Campaign>(query, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Get the campaign's detailed statistics /// </summary> /// <param name="accountID">Your Account ID, used for authorization (Found in the EmailCampaigns app in the "API credentials" page in Settings)</param> /// <param name="campaignID">This is the ID of the Campaign of which you want t retrieve the detailed statistics</param> /// <param name="skip">The amount of entities to skip from the result (Optional)</param> /// <param name="take">The amount of entities to retrieve from the result (Optional)</param> /// <param name="filter">Filter for email addresses (Optional)</param> /// <param name="includeSentItems">Whether to include items that are sent (Optional)</param> /// <param name="includeDeliveredItems">Whether to include items that are delivered (Optional)</param> /// <param name="includeOpenedItems">Whether to include items that are opened (Optional)</param> /// <param name="includeBouncedItem">Whether to include items that are bounced (Optional)</param> /// <param name="includeComplainedItems">Whether to include items that are complained (Optional)</param> /// <param name="includeUnsubscribedItems">Whether to include items that are unsubscribed (Optional)</param> /// <param name="includeBlacklistedItems">Whether to include items that are blacklisted</param> /// <param name="includeClickedItems">Whether to include items that are clicked</param> /// <param name="cancellationToken">An optional cancellation token to abort this request</param> /// <returns></returns> public async Task <Paginated <CampaignStatisticDetail> > GetCampaignStatisticDetailsAsync(Guid accountID, Guid campaignID, int?skip = null, int?take = null, string filter = null, bool?includeSentItems = null, bool?includeDeliveredItems = null, bool?includeOpenedItems = null, bool?includeBouncedItem = null, bool?includeComplainedItems = null, bool?includeUnsubscribedItems = null, bool?includeBlacklistedItems = null, bool?includeClickedItems = null, CancellationToken cancellationToken = default) { QueryStringBuilder query = new QueryStringBuilder($"/bulkemail/v1.0/accounts/{accountID}/campaigns/{campaignID}/statistics/details"); if (skip != default) { query.Add("skip", skip); } if (take != default) { query.Add("take", take); } if (filter != default) { query.Add("filter", filter); } if (includeSentItems != default) { query.Add("includeSentItems", includeSentItems); } if (includeDeliveredItems != default) { query.Add("includeDeliveredItems", includeDeliveredItems); } if (includeOpenedItems != default) { query.Add("includeOpenedItems", includeOpenedItems); } if (includeBouncedItem != default) { query.Add("includeBouncedItems", includeBouncedItem); } if (includeComplainedItems != default) { query.Add("includeComplainedItems", includeComplainedItems); } if (includeUnsubscribedItems != default) { query.Add("includeUnsubscribedItems", includeUnsubscribedItems); } if (includeBlacklistedItems != default) { query.Add("includeBlacklistedItems", includeBlacklistedItems); } if (includeClickedItems != default) { query.Add("includeClickedItems", includeClickedItems); } return(await GetAsync <Paginated <CampaignStatisticDetail> >(query, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Get all campaign tags /// </summary> /// <param name="accountID">Your Account ID, used for authorization (Found in the EmailCampaigns app in the "API credentials" page in Settings)</param> /// <param name="skip">The amount of entities to skip from the result (Optional)</param> /// <param name="take">The amount of entities to retrieve from the result (Optional)</param> /// <param name="cancellationToken">An optional cancellation token to abort this request</param> /// <returns></returns> public async Task <Paginated <CampaignTag> > GetCampaignTagsAsync(Guid accountID, int?skip = null, int?take = null, CancellationToken cancellationToken = default) { QueryStringBuilder query = new QueryStringBuilder($"/bulkemail/v1.0/accounts/{accountID}/campaigntags"); if (skip != default) { query.Add("skip", skip); } if (take != default) { query.Add("take", take); } return(await GetPaginatedAsync <CampaignTag>(query, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Get all unsubscripitons /// </summary> /// <param name="accountID">Your Account ID, used for authorization (Found in the EmailCampaigns app in the "API credentials" page in Settings)</param> /// <param name="skip">The amount of entities to skip from the result (Optional)</param> /// <param name="take">The amount of entities to retrieve from the result (Optional)</param> /// <param name="filter">The text that you want to filter the results on (Optional)</param> /// <param name="cancellationToken">An optional cancellation token to abort this request</param> /// <returns></returns> public async Task <Paginated <Unsubscription> > GetUnsubscriptionsAsync(Guid accountID, int?skip = null, int?take = null, string filter = null, CancellationToken cancellationToken = default) { QueryStringBuilder query = new QueryStringBuilder($"/bulkemail/v1.0/accounts/{accountID}/unsubscriptions"); if (skip != default) { query.Add("skip", skip); } if (take != default) { query.Add("take", take); } if (filter != default) { query.Add("filter", filter); } return(await GetPaginatedAsync <Unsubscription>(query, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Get a specific mailing for a campaign /// </summary> /// <param name="accountID">Your Account ID, used for authorization (Found in the EmailCampaigns app in the "API credentials" page in Settings)</param> /// <param name="campaignID">This is the ID of the Campaign that you want to retrieve the specific mailing for</param> /// <param name="mailingID">This is the ID of the mailing that you want to retrieve/param> /// <param name="includeTemplateHtmlBody">Whether to include the html body in the response (Optional)</param> /// <param name="includeTemplateTextBody">Whether to include the text body in the response (Optional)</param> /// <param name="includeTemplateJson">Whether to include the template json in the response (Optional)</param> /// <param name="cancellationToken">An optional cancellation token to abort this request</param> /// <returns></returns> public async Task <Mailing> GetMailingForCampaignAsync(Guid accountID, Guid campaignID, Guid mailingID, bool?includeTemplateHtmlBody = null, bool?includeTemplateTextBody = null, bool?includeTemplateJson = null, CancellationToken cancellationToken = default) { QueryStringBuilder query = new QueryStringBuilder($"/bulkemail/v1.0/accounts/{accountID}/campaigns/{campaignID}/mailings/{mailingID}"); if (includeTemplateHtmlBody != default) { query.Add("includeTemplateHtmlBody", includeTemplateHtmlBody); } if (includeTemplateTextBody != default) { query.Add("includeTemplateTextBody", includeTemplateTextBody); } if (includeTemplateJson != default) { query.Add("includeTemplateJson", includeTemplateJson); } return(await GetAsync <Mailing>(query, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Get a specific template /// </summary> /// <param name="accountID">Your Account ID, used for authorization (Found in the EmailCampaigns app in the "API credentials" page in Settings)</param> /// <param name="templateID">This is the ID of the Template that you want to retrieve</param> /// <param name="includeHtmlBody">Whether to include the html body in the response (Optional)</param> /// <param name="includeTextBody">Whether to include the text body in the response (Optional)</param> /// <param name="includeJson">Whether to include the template json in the response (Optional)</param> /// <param name="cancellationToken">An optional cancellation token to abort this request</param> /// <returns></returns> public async Task <Template> GetTemplateAsync(Guid accountID, Guid templateID, bool?includeHtmlBody = null, bool?includeTextBody = null, bool?includeJson = null, CancellationToken cancellationToken = default) { QueryStringBuilder query = new QueryStringBuilder($"/bulkemail/v1.0/accounts/{accountID}/templates"); if (includeHtmlBody != default) { query.Add("includeHtmlBody", includeHtmlBody); } if (includeTextBody != default) { query.Add("includeTextBody", includeTextBody); } if (includeJson != default) { query.Add("includeJson", includeJson); } return(await GetAsync <Template>($"/bulkemail/v1.0/accounts/{accountID}/templates/{templateID}", cancellationToken).ConfigureAwait(false)); }