/* tslint:disable */ /* eslint-disable */ /** * Constant Contact API v3 * Swagger build version 3.0.2475 * * The version of the OpenAPI document: 1.0.116 * Contact: webservices@constantcontact.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import type { Configuration } from '../configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; // @ts-ignore import { CreateEmailCampaign200Response } from '../models'; // @ts-ignore import { CreateEmailCampaignRequest } from '../models'; // @ts-ignore import { CreateResendEmailCampaign201Response } from '../models'; // @ts-ignore import { CreateResendEmailCampaignRequest } from '../models'; // @ts-ignore import { GetAllEmailCampaigns200Response } from '../models'; // @ts-ignore import { GetEmailCampaignActivity200Response } from '../models'; // @ts-ignore import { GetEmailCampaignXrefs200Response } from '../models'; // @ts-ignore import { GetResendEmailCampaign200ResponseInner } from '../models'; // @ts-ignore import { PatchEmailCampaignNameRequest } from '../models'; /** * EmailCampaignsApi - axios parameter creator * @export */ export const EmailCampaignsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Use this method to create a new email campaign. This method also creates new `primary_email` and `permalink` email campaign activities and associates them with the new email campaign. The request body must contain the `name` property and the `email_campaign_activities` array. The `name` must be unique. The `email_campaign_activities` array contains the main content of your email campaign and must include `format_type`, `from_name`, `from_email`, `reply_to_email`, `subject`, and `html_content` properties. The `from_email` address you use must use a verified email address for your account. NOTE: If you create an email campaign using a legacy (V7) format, Constant Contact automatically converts it to the newer custom code format. * @summary POST (Create) a New Email Campaign * @param {CreateEmailCampaignRequest} createEmailCampaignRequest A JSON request body that contains the email content. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createEmailCampaign: async (createEmailCampaignRequest: CreateEmailCampaignRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'createEmailCampaignRequest' is not null or undefined assertParamExists('createEmailCampaign', 'createEmailCampaignRequest', createEmailCampaignRequest) const localVarPath = `/emails`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication oauth2_access_code required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_access_code", ["campaign_data"], configuration) // authentication oauth2_implicit required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_implicit", ["campaign_data"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(createEmailCampaignRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Use this POST method to resend a primary campaign activity to contacts that did not open a campaign activity that has a current `status` of `Draft`, `Scheduled`, or `Done`. You can only create one resend activity per email campaign. After an email campaign activity is sent to contacts, Constant Contact waits the specified number of `delay_days` or `delay_minutes` (properties are mutually exclusive) before resending to non-openers. If you set both `delay_days` or `delay_minutes`, `delay_minutes` is ignored in the request. You can resend to non-openers a minimum of twelve hours (720 minutes) and a maximum of up to 10 days (or 10 x 1440 minutes) after the initial send date. * @summary POST a Resend to Non-openers Campaign Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {CreateResendEmailCampaignRequest} createResendEmailCampaignRequest A JSON request body that specifies when to resend the campaign activity to non-openers. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createResendEmailCampaign: async (campaignActivityId: string, createResendEmailCampaignRequest: CreateResendEmailCampaignRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignActivityId' is not null or undefined assertParamExists('createResendEmailCampaign', 'campaignActivityId', campaignActivityId) // verify required parameter 'createResendEmailCampaignRequest' is not null or undefined assertParamExists('createResendEmailCampaign', 'createResendEmailCampaignRequest', createResendEmailCampaignRequest) const localVarPath = `/emails/activities/{campaign_activity_id}/non_opener_resends` .replace(`{${"campaign_activity_id"}}`, encodeURIComponent(String(campaignActivityId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication oauth2_access_code required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_access_code", ["campaign_data"], configuration) // authentication oauth2_implicit required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_implicit", ["campaign_data"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(createResendEmailCampaignRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Use this method to delete an email campaign and the email campaign activities associated with the email campaign. You cannot delete an email campaign when it has a `Scheduled` status. Constant Contact users can restore deleted email campaigns using the UI. * @summary DELETE an Email Campaign * @param {string} campaignId The unique ID for the email campaign you are deleting. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteEmailCampaign: async (campaignId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignId' is not null or undefined assertParamExists('deleteEmailCampaign', 'campaignId', campaignId) const localVarPath = `/emails/{campaign_id}` .replace(`{${"campaign_id"}}`, encodeURIComponent(String(campaignId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication oauth2_access_code required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_access_code", ["campaign_data"], configuration) // authentication oauth2_implicit required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_implicit", ["campaign_data"], configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Use this `DELETE` method to delete (unschedule) a resend to non openers activity. * @summary DELETE a Resend to Non Openers Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {string} resendRequestId The unique ID associated with the resend for the email campaign activity (for example: `389093`). If the email campaign activity is currently in draft status, specify `DRAFT` as the ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteResendEmailCampaign: async (campaignActivityId: string, resendRequestId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignActivityId' is not null or undefined assertParamExists('deleteResendEmailCampaign', 'campaignActivityId', campaignActivityId) // verify required parameter 'resendRequestId' is not null or undefined assertParamExists('deleteResendEmailCampaign', 'resendRequestId', resendRequestId) const localVarPath = `/emails/activities/{campaign_activity_id}/non_opener_resends/{resend_request_id}` .replace(`{${"campaign_activity_id"}}`, encodeURIComponent(String(campaignActivityId))) .replace(`{${"resend_request_id"}}`, encodeURIComponent(String(resendRequestId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication oauth2_access_code required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_access_code", ["campaign_data"], configuration) // authentication oauth2_implicit required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_implicit", ["campaign_data"], configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Use this method to list and get details about your email campaigns. By default, this method returns all email campaigns for the user account including deleted email campaigns. To get email campaigns within a date-range, use the `after_date` and `before_date` query parameters. This endpoint does not return campaign activity details for each email campaign in the collection. To get email campaign activity details for a single email campaign, use the GET `/emails/{campaign_id}` endpoint.\"

This method does not currently support filtering results using the email campaign creation date.

* @summary GET a Collection of Email Campaigns * @param {number} [limit] Specifies the number of campaigns to display on each page of output that is returned (from return 1 - 500). The default returns 50 campaigns per page. * @param {string} [beforeDate] Use to return email campaigns with `updated_at` timestamps that are before a specific date and time (in ISO-8601 format). Use with the `after_date` query parameter to get email campaigns sent within a specific date range. * @param {string} [afterDate] Use to return email campaigns with last `updated_at` timestamps that are after a specific date and time (in ISO-8601 format). Use with the `before_date` query parameter to get email campaigns sent within a specific date range. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAllEmailCampaigns: async (limit?: number, beforeDate?: string, afterDate?: string, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/emails`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication oauth2_access_code required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_access_code", ["campaign_data"], configuration) // authentication oauth2_implicit required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_implicit", ["campaign_data"], configuration) if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (beforeDate !== undefined) { localVarQueryParameter['before_date'] = (beforeDate as any instanceof Date) ? (beforeDate as any).toISOString() : beforeDate; } if (afterDate !== undefined) { localVarQueryParameter['after_date'] = (afterDate as any instanceof Date) ? (afterDate as any).toISOString() : afterDate; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Use this method to return a specific email campaign activity. Each email campaign activity contains the email content, metadata, and styling information of an email. Email campaign activities can also contain either contact lists or segments. Constant Contact uses this information to determine who to send the email campaign activity to when you schedule it. You cannot get email campaign activities that have a `REMOVED` status. * @summary GET a Single Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {GetEmailCampaignActivityIncludeEnum} [include] Use the `include` query parameter to enter a comma separated list of additional email campaign activity properties for the V3 API to return. Valid values are `physical_address_in_footer`, `permalink_url`, `html_content`, and `document_properties`. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignActivity: async (campaignActivityId: string, include?: GetEmailCampaignActivityIncludeEnum, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignActivityId' is not null or undefined assertParamExists('getEmailCampaignActivity', 'campaignActivityId', campaignActivityId) const localVarPath = `/emails/activities/{campaign_activity_id}` .replace(`{${"campaign_activity_id"}}`, encodeURIComponent(String(campaignActivityId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication oauth2_access_code required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_access_code", ["campaign_data"], configuration) // authentication oauth2_implicit required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_implicit", ["campaign_data"], configuration) if (include !== undefined) { localVarQueryParameter['include'] = include; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Use this method to get details about a single email campaign and campaign related activities. Details include the email campaign name, current status, create date, last update date, and a list of campaign activities; including the `campaign_activity_id` and `role`. * @summary GET Details About a Single Email Campaign * @param {string} campaignId The ID (UUID format) that uniquely identifies this email campaign. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignById: async (campaignId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignId' is not null or undefined assertParamExists('getEmailCampaignById', 'campaignId', campaignId) const localVarPath = `/emails/{campaign_id}` .replace(`{${"campaign_id"}}`, encodeURIComponent(String(campaignId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication oauth2_access_code required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_access_code", ["campaign_data"], configuration) // authentication oauth2_implicit required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_implicit", ["campaign_data"], configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** *

Use this endpoint to migrate your locally stored V2 email campaign data to the new V3 format. Developers are expected to use this endpoint sparingly. This endpoint is NOT intended for regular or repeated use. Constant Contact will eventually deprecate and remove this endpoint.

Use this method to migrate your local V2 API email data to the V3 API format. For each value that you provide in the `v2_email_campaign_ids` query parameter, this method returns the corresponding V3 `campaign_id` and V3 `campaign_activity_id` UUID value. For more information on the changes to the email campaign resource model, see [V3 Email Campaign Resource Changes](/api_guide/v3_v2_email_campaign_deltas.html) in the API guide. * @summary GET a Collection of V2 and V3 API Email Campaign Identifiers * @param {string} v2EmailCampaignIds Comma separated list of V2 API `campaignId` values. You can enter up to 50 V2 `campaignId` values in each request. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignXrefs: async (v2EmailCampaignIds: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'v2EmailCampaignIds' is not null or undefined assertParamExists('getEmailCampaignXrefs', 'v2EmailCampaignIds', v2EmailCampaignIds) const localVarPath = `/emails/campaign_id_xrefs`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication oauth2_access_code required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_access_code", ["campaign_data"], configuration) // authentication oauth2_implicit required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_implicit", ["campaign_data"], configuration) if (v2EmailCampaignIds !== undefined) { localVarQueryParameter['v2_email_campaign_ids'] = v2EmailCampaignIds; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Get details about a resend to non-openers campaign activity. If resend activity does not exist for the specified `campaign_activity_id`, an empty list is returned in the results. You can only create one resend activity per email campaign. * @summary GET Details for a Resend to Non-openers Campaign Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getResendEmailCampaign: async (campaignActivityId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignActivityId' is not null or undefined assertParamExists('getResendEmailCampaign', 'campaignActivityId', campaignActivityId) const localVarPath = `/emails/activities/{campaign_activity_id}/non_opener_resends` .replace(`{${"campaign_activity_id"}}`, encodeURIComponent(String(campaignActivityId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication oauth2_access_code required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_access_code", ["campaign_data"], configuration) // authentication oauth2_implicit required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_implicit", ["campaign_data"], configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Use this method to rename an email campaign. The name is not visible to contacts. The name must be unique and cannot exceed 80 characters. You cannot rename email campaigns that have a `Removed` status. * @summary PATCH (Update) an Email Campaign Name * @param {string} campaignId The unique identifier for an email campaign. * @param {PatchEmailCampaignNameRequest} patchEmailCampaignNameRequest A JSON payload that contains the new email campaign name. * @param {*} [options] Override http request option. * @throws {RequiredError} */ patchEmailCampaignName: async (campaignId: string, patchEmailCampaignNameRequest: PatchEmailCampaignNameRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignId' is not null or undefined assertParamExists('patchEmailCampaignName', 'campaignId', campaignId) // verify required parameter 'patchEmailCampaignNameRequest' is not null or undefined assertParamExists('patchEmailCampaignName', 'patchEmailCampaignNameRequest', patchEmailCampaignNameRequest) const localVarPath = `/emails/{campaign_id}` .replace(`{${"campaign_id"}}`, encodeURIComponent(String(campaignId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication oauth2_access_code required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_access_code", ["campaign_data"], configuration) // authentication oauth2_implicit required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_implicit", ["campaign_data"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(patchEmailCampaignNameRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Use this method to update an email campaign activity by including the complete email campaign activity with your changes in the request body. The request body requires the `from_name`, `from_email`, `reply_to_email`, and `subject` properties. You can only update email campaign activities that have the `primary_email` role and that are in `DRAFT` or `Done` status. When you use a PUT method to update a resource, the V3 API overwrites any properties that are missing in the request body. However, the V3 API does not overwrite subresources that you omit in the request body or missing properties in subresources. This method considers `physical_address_in_footer`, `document_properties`, `html_content`, and `permalink_url` subresources of the email campaign activity. * @summary PUT (Update) An Email Campaign Activity * @param {string} campaignActivityId The unique ID for the email campaign activity you are updating. * @param {GetEmailCampaignActivity200Response} getEmailCampaignActivity200Response A request body payload that contains the complete email campaign activity with your changes. * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateEmailCampaignActivity: async (campaignActivityId: string, getEmailCampaignActivity200Response: GetEmailCampaignActivity200Response, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignActivityId' is not null or undefined assertParamExists('updateEmailCampaignActivity', 'campaignActivityId', campaignActivityId) // verify required parameter 'getEmailCampaignActivity200Response' is not null or undefined assertParamExists('updateEmailCampaignActivity', 'getEmailCampaignActivity200Response', getEmailCampaignActivity200Response) const localVarPath = `/emails/activities/{campaign_activity_id}` .replace(`{${"campaign_activity_id"}}`, encodeURIComponent(String(campaignActivityId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication oauth2_access_code required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_access_code", ["campaign_data"], configuration) // authentication oauth2_implicit required // oauth required await setOAuthToObject(localVarHeaderParameter, "oauth2_implicit", ["campaign_data"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getEmailCampaignActivity200Response, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * EmailCampaignsApi - functional programming interface * @export */ export const EmailCampaignsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = EmailCampaignsApiAxiosParamCreator(configuration) return { /** * Use this method to create a new email campaign. This method also creates new `primary_email` and `permalink` email campaign activities and associates them with the new email campaign. The request body must contain the `name` property and the `email_campaign_activities` array. The `name` must be unique. The `email_campaign_activities` array contains the main content of your email campaign and must include `format_type`, `from_name`, `from_email`, `reply_to_email`, `subject`, and `html_content` properties. The `from_email` address you use must use a verified email address for your account. NOTE: If you create an email campaign using a legacy (V7) format, Constant Contact automatically converts it to the newer custom code format. * @summary POST (Create) a New Email Campaign * @param {CreateEmailCampaignRequest} createEmailCampaignRequest A JSON request body that contains the email content. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createEmailCampaign(createEmailCampaignRequest: CreateEmailCampaignRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.createEmailCampaign(createEmailCampaignRequest, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailCampaignsApi.createEmailCampaign']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this POST method to resend a primary campaign activity to contacts that did not open a campaign activity that has a current `status` of `Draft`, `Scheduled`, or `Done`. You can only create one resend activity per email campaign. After an email campaign activity is sent to contacts, Constant Contact waits the specified number of `delay_days` or `delay_minutes` (properties are mutually exclusive) before resending to non-openers. If you set both `delay_days` or `delay_minutes`, `delay_minutes` is ignored in the request. You can resend to non-openers a minimum of twelve hours (720 minutes) and a maximum of up to 10 days (or 10 x 1440 minutes) after the initial send date. * @summary POST a Resend to Non-openers Campaign Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {CreateResendEmailCampaignRequest} createResendEmailCampaignRequest A JSON request body that specifies when to resend the campaign activity to non-openers. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createResendEmailCampaign(campaignActivityId: string, createResendEmailCampaignRequest: CreateResendEmailCampaignRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.createResendEmailCampaign(campaignActivityId, createResendEmailCampaignRequest, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailCampaignsApi.createResendEmailCampaign']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this method to delete an email campaign and the email campaign activities associated with the email campaign. You cannot delete an email campaign when it has a `Scheduled` status. Constant Contact users can restore deleted email campaigns using the UI. * @summary DELETE an Email Campaign * @param {string} campaignId The unique ID for the email campaign you are deleting. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async deleteEmailCampaign(campaignId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteEmailCampaign(campaignId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailCampaignsApi.deleteEmailCampaign']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this `DELETE` method to delete (unschedule) a resend to non openers activity. * @summary DELETE a Resend to Non Openers Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {string} resendRequestId The unique ID associated with the resend for the email campaign activity (for example: `389093`). If the email campaign activity is currently in draft status, specify `DRAFT` as the ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async deleteResendEmailCampaign(campaignActivityId: string, resendRequestId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteResendEmailCampaign(campaignActivityId, resendRequestId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailCampaignsApi.deleteResendEmailCampaign']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this method to list and get details about your email campaigns. By default, this method returns all email campaigns for the user account including deleted email campaigns. To get email campaigns within a date-range, use the `after_date` and `before_date` query parameters. This endpoint does not return campaign activity details for each email campaign in the collection. To get email campaign activity details for a single email campaign, use the GET `/emails/{campaign_id}` endpoint.\"

This method does not currently support filtering results using the email campaign creation date.

* @summary GET a Collection of Email Campaigns * @param {number} [limit] Specifies the number of campaigns to display on each page of output that is returned (from return 1 - 500). The default returns 50 campaigns per page. * @param {string} [beforeDate] Use to return email campaigns with `updated_at` timestamps that are before a specific date and time (in ISO-8601 format). Use with the `after_date` query parameter to get email campaigns sent within a specific date range. * @param {string} [afterDate] Use to return email campaigns with last `updated_at` timestamps that are after a specific date and time (in ISO-8601 format). Use with the `before_date` query parameter to get email campaigns sent within a specific date range. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAllEmailCampaigns(limit?: number, beforeDate?: string, afterDate?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getAllEmailCampaigns(limit, beforeDate, afterDate, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailCampaignsApi.getAllEmailCampaigns']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this method to return a specific email campaign activity. Each email campaign activity contains the email content, metadata, and styling information of an email. Email campaign activities can also contain either contact lists or segments. Constant Contact uses this information to determine who to send the email campaign activity to when you schedule it. You cannot get email campaign activities that have a `REMOVED` status. * @summary GET a Single Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {GetEmailCampaignActivityIncludeEnum} [include] Use the `include` query parameter to enter a comma separated list of additional email campaign activity properties for the V3 API to return. Valid values are `physical_address_in_footer`, `permalink_url`, `html_content`, and `document_properties`. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEmailCampaignActivity(campaignActivityId: string, include?: GetEmailCampaignActivityIncludeEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEmailCampaignActivity(campaignActivityId, include, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailCampaignsApi.getEmailCampaignActivity']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this method to get details about a single email campaign and campaign related activities. Details include the email campaign name, current status, create date, last update date, and a list of campaign activities; including the `campaign_activity_id` and `role`. * @summary GET Details About a Single Email Campaign * @param {string} campaignId The ID (UUID format) that uniquely identifies this email campaign. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEmailCampaignById(campaignId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEmailCampaignById(campaignId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailCampaignsApi.getEmailCampaignById']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** *

Use this endpoint to migrate your locally stored V2 email campaign data to the new V3 format. Developers are expected to use this endpoint sparingly. This endpoint is NOT intended for regular or repeated use. Constant Contact will eventually deprecate and remove this endpoint.

Use this method to migrate your local V2 API email data to the V3 API format. For each value that you provide in the `v2_email_campaign_ids` query parameter, this method returns the corresponding V3 `campaign_id` and V3 `campaign_activity_id` UUID value. For more information on the changes to the email campaign resource model, see [V3 Email Campaign Resource Changes](/api_guide/v3_v2_email_campaign_deltas.html) in the API guide. * @summary GET a Collection of V2 and V3 API Email Campaign Identifiers * @param {string} v2EmailCampaignIds Comma separated list of V2 API `campaignId` values. You can enter up to 50 V2 `campaignId` values in each request. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEmailCampaignXrefs(v2EmailCampaignIds: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEmailCampaignXrefs(v2EmailCampaignIds, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailCampaignsApi.getEmailCampaignXrefs']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Get details about a resend to non-openers campaign activity. If resend activity does not exist for the specified `campaign_activity_id`, an empty list is returned in the results. You can only create one resend activity per email campaign. * @summary GET Details for a Resend to Non-openers Campaign Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getResendEmailCampaign(campaignActivityId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getResendEmailCampaign(campaignActivityId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailCampaignsApi.getResendEmailCampaign']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this method to rename an email campaign. The name is not visible to contacts. The name must be unique and cannot exceed 80 characters. You cannot rename email campaigns that have a `Removed` status. * @summary PATCH (Update) an Email Campaign Name * @param {string} campaignId The unique identifier for an email campaign. * @param {PatchEmailCampaignNameRequest} patchEmailCampaignNameRequest A JSON payload that contains the new email campaign name. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async patchEmailCampaignName(campaignId: string, patchEmailCampaignNameRequest: PatchEmailCampaignNameRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.patchEmailCampaignName(campaignId, patchEmailCampaignNameRequest, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailCampaignsApi.patchEmailCampaignName']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this method to update an email campaign activity by including the complete email campaign activity with your changes in the request body. The request body requires the `from_name`, `from_email`, `reply_to_email`, and `subject` properties. You can only update email campaign activities that have the `primary_email` role and that are in `DRAFT` or `Done` status. When you use a PUT method to update a resource, the V3 API overwrites any properties that are missing in the request body. However, the V3 API does not overwrite subresources that you omit in the request body or missing properties in subresources. This method considers `physical_address_in_footer`, `document_properties`, `html_content`, and `permalink_url` subresources of the email campaign activity. * @summary PUT (Update) An Email Campaign Activity * @param {string} campaignActivityId The unique ID for the email campaign activity you are updating. * @param {GetEmailCampaignActivity200Response} getEmailCampaignActivity200Response A request body payload that contains the complete email campaign activity with your changes. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async updateEmailCampaignActivity(campaignActivityId: string, getEmailCampaignActivity200Response: GetEmailCampaignActivity200Response, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.updateEmailCampaignActivity(campaignActivityId, getEmailCampaignActivity200Response, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailCampaignsApi.updateEmailCampaignActivity']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, } }; /** * EmailCampaignsApi - factory interface * @export */ export const EmailCampaignsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = EmailCampaignsApiFp(configuration) return { /** * Use this method to create a new email campaign. This method also creates new `primary_email` and `permalink` email campaign activities and associates them with the new email campaign. The request body must contain the `name` property and the `email_campaign_activities` array. The `name` must be unique. The `email_campaign_activities` array contains the main content of your email campaign and must include `format_type`, `from_name`, `from_email`, `reply_to_email`, `subject`, and `html_content` properties. The `from_email` address you use must use a verified email address for your account. NOTE: If you create an email campaign using a legacy (V7) format, Constant Contact automatically converts it to the newer custom code format. * @summary POST (Create) a New Email Campaign * @param {CreateEmailCampaignRequest} createEmailCampaignRequest A JSON request body that contains the email content. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createEmailCampaign(createEmailCampaignRequest: CreateEmailCampaignRequest, options?: any): AxiosPromise { return localVarFp.createEmailCampaign(createEmailCampaignRequest, options).then((request) => request(axios, basePath)); }, /** * Use this POST method to resend a primary campaign activity to contacts that did not open a campaign activity that has a current `status` of `Draft`, `Scheduled`, or `Done`. You can only create one resend activity per email campaign. After an email campaign activity is sent to contacts, Constant Contact waits the specified number of `delay_days` or `delay_minutes` (properties are mutually exclusive) before resending to non-openers. If you set both `delay_days` or `delay_minutes`, `delay_minutes` is ignored in the request. You can resend to non-openers a minimum of twelve hours (720 minutes) and a maximum of up to 10 days (or 10 x 1440 minutes) after the initial send date. * @summary POST a Resend to Non-openers Campaign Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {CreateResendEmailCampaignRequest} createResendEmailCampaignRequest A JSON request body that specifies when to resend the campaign activity to non-openers. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createResendEmailCampaign(campaignActivityId: string, createResendEmailCampaignRequest: CreateResendEmailCampaignRequest, options?: any): AxiosPromise { return localVarFp.createResendEmailCampaign(campaignActivityId, createResendEmailCampaignRequest, options).then((request) => request(axios, basePath)); }, /** * Use this method to delete an email campaign and the email campaign activities associated with the email campaign. You cannot delete an email campaign when it has a `Scheduled` status. Constant Contact users can restore deleted email campaigns using the UI. * @summary DELETE an Email Campaign * @param {string} campaignId The unique ID for the email campaign you are deleting. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteEmailCampaign(campaignId: string, options?: any): AxiosPromise { return localVarFp.deleteEmailCampaign(campaignId, options).then((request) => request(axios, basePath)); }, /** * Use this `DELETE` method to delete (unschedule) a resend to non openers activity. * @summary DELETE a Resend to Non Openers Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {string} resendRequestId The unique ID associated with the resend for the email campaign activity (for example: `389093`). If the email campaign activity is currently in draft status, specify `DRAFT` as the ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteResendEmailCampaign(campaignActivityId: string, resendRequestId: string, options?: any): AxiosPromise { return localVarFp.deleteResendEmailCampaign(campaignActivityId, resendRequestId, options).then((request) => request(axios, basePath)); }, /** * Use this method to list and get details about your email campaigns. By default, this method returns all email campaigns for the user account including deleted email campaigns. To get email campaigns within a date-range, use the `after_date` and `before_date` query parameters. This endpoint does not return campaign activity details for each email campaign in the collection. To get email campaign activity details for a single email campaign, use the GET `/emails/{campaign_id}` endpoint.\"

This method does not currently support filtering results using the email campaign creation date.

* @summary GET a Collection of Email Campaigns * @param {number} [limit] Specifies the number of campaigns to display on each page of output that is returned (from return 1 - 500). The default returns 50 campaigns per page. * @param {string} [beforeDate] Use to return email campaigns with `updated_at` timestamps that are before a specific date and time (in ISO-8601 format). Use with the `after_date` query parameter to get email campaigns sent within a specific date range. * @param {string} [afterDate] Use to return email campaigns with last `updated_at` timestamps that are after a specific date and time (in ISO-8601 format). Use with the `before_date` query parameter to get email campaigns sent within a specific date range. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAllEmailCampaigns(limit?: number, beforeDate?: string, afterDate?: string, options?: any): AxiosPromise { return localVarFp.getAllEmailCampaigns(limit, beforeDate, afterDate, options).then((request) => request(axios, basePath)); }, /** * Use this method to return a specific email campaign activity. Each email campaign activity contains the email content, metadata, and styling information of an email. Email campaign activities can also contain either contact lists or segments. Constant Contact uses this information to determine who to send the email campaign activity to when you schedule it. You cannot get email campaign activities that have a `REMOVED` status. * @summary GET a Single Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {GetEmailCampaignActivityIncludeEnum} [include] Use the `include` query parameter to enter a comma separated list of additional email campaign activity properties for the V3 API to return. Valid values are `physical_address_in_footer`, `permalink_url`, `html_content`, and `document_properties`. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignActivity(campaignActivityId: string, include?: GetEmailCampaignActivityIncludeEnum, options?: any): AxiosPromise { return localVarFp.getEmailCampaignActivity(campaignActivityId, include, options).then((request) => request(axios, basePath)); }, /** * Use this method to get details about a single email campaign and campaign related activities. Details include the email campaign name, current status, create date, last update date, and a list of campaign activities; including the `campaign_activity_id` and `role`. * @summary GET Details About a Single Email Campaign * @param {string} campaignId The ID (UUID format) that uniquely identifies this email campaign. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignById(campaignId: string, options?: any): AxiosPromise { return localVarFp.getEmailCampaignById(campaignId, options).then((request) => request(axios, basePath)); }, /** *

Use this endpoint to migrate your locally stored V2 email campaign data to the new V3 format. Developers are expected to use this endpoint sparingly. This endpoint is NOT intended for regular or repeated use. Constant Contact will eventually deprecate and remove this endpoint.

Use this method to migrate your local V2 API email data to the V3 API format. For each value that you provide in the `v2_email_campaign_ids` query parameter, this method returns the corresponding V3 `campaign_id` and V3 `campaign_activity_id` UUID value. For more information on the changes to the email campaign resource model, see [V3 Email Campaign Resource Changes](/api_guide/v3_v2_email_campaign_deltas.html) in the API guide. * @summary GET a Collection of V2 and V3 API Email Campaign Identifiers * @param {string} v2EmailCampaignIds Comma separated list of V2 API `campaignId` values. You can enter up to 50 V2 `campaignId` values in each request. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignXrefs(v2EmailCampaignIds: string, options?: any): AxiosPromise { return localVarFp.getEmailCampaignXrefs(v2EmailCampaignIds, options).then((request) => request(axios, basePath)); }, /** * Get details about a resend to non-openers campaign activity. If resend activity does not exist for the specified `campaign_activity_id`, an empty list is returned in the results. You can only create one resend activity per email campaign. * @summary GET Details for a Resend to Non-openers Campaign Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getResendEmailCampaign(campaignActivityId: string, options?: any): AxiosPromise> { return localVarFp.getResendEmailCampaign(campaignActivityId, options).then((request) => request(axios, basePath)); }, /** * Use this method to rename an email campaign. The name is not visible to contacts. The name must be unique and cannot exceed 80 characters. You cannot rename email campaigns that have a `Removed` status. * @summary PATCH (Update) an Email Campaign Name * @param {string} campaignId The unique identifier for an email campaign. * @param {PatchEmailCampaignNameRequest} patchEmailCampaignNameRequest A JSON payload that contains the new email campaign name. * @param {*} [options] Override http request option. * @throws {RequiredError} */ patchEmailCampaignName(campaignId: string, patchEmailCampaignNameRequest: PatchEmailCampaignNameRequest, options?: any): AxiosPromise { return localVarFp.patchEmailCampaignName(campaignId, patchEmailCampaignNameRequest, options).then((request) => request(axios, basePath)); }, /** * Use this method to update an email campaign activity by including the complete email campaign activity with your changes in the request body. The request body requires the `from_name`, `from_email`, `reply_to_email`, and `subject` properties. You can only update email campaign activities that have the `primary_email` role and that are in `DRAFT` or `Done` status. When you use a PUT method to update a resource, the V3 API overwrites any properties that are missing in the request body. However, the V3 API does not overwrite subresources that you omit in the request body or missing properties in subresources. This method considers `physical_address_in_footer`, `document_properties`, `html_content`, and `permalink_url` subresources of the email campaign activity. * @summary PUT (Update) An Email Campaign Activity * @param {string} campaignActivityId The unique ID for the email campaign activity you are updating. * @param {GetEmailCampaignActivity200Response} getEmailCampaignActivity200Response A request body payload that contains the complete email campaign activity with your changes. * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateEmailCampaignActivity(campaignActivityId: string, getEmailCampaignActivity200Response: GetEmailCampaignActivity200Response, options?: any): AxiosPromise { return localVarFp.updateEmailCampaignActivity(campaignActivityId, getEmailCampaignActivity200Response, options).then((request) => request(axios, basePath)); }, }; }; /** * EmailCampaignsApi - object-oriented interface * @export * @class EmailCampaignsApi * @extends {BaseAPI} */ export class EmailCampaignsApi extends BaseAPI { /** * Use this method to create a new email campaign. This method also creates new `primary_email` and `permalink` email campaign activities and associates them with the new email campaign. The request body must contain the `name` property and the `email_campaign_activities` array. The `name` must be unique. The `email_campaign_activities` array contains the main content of your email campaign and must include `format_type`, `from_name`, `from_email`, `reply_to_email`, `subject`, and `html_content` properties. The `from_email` address you use must use a verified email address for your account. NOTE: If you create an email campaign using a legacy (V7) format, Constant Contact automatically converts it to the newer custom code format. * @summary POST (Create) a New Email Campaign * @param {CreateEmailCampaignRequest} createEmailCampaignRequest A JSON request body that contains the email content. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailCampaignsApi */ public createEmailCampaign(createEmailCampaignRequest: CreateEmailCampaignRequest, options?: RawAxiosRequestConfig) { return EmailCampaignsApiFp(this.configuration).createEmailCampaign(createEmailCampaignRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Use this POST method to resend a primary campaign activity to contacts that did not open a campaign activity that has a current `status` of `Draft`, `Scheduled`, or `Done`. You can only create one resend activity per email campaign. After an email campaign activity is sent to contacts, Constant Contact waits the specified number of `delay_days` or `delay_minutes` (properties are mutually exclusive) before resending to non-openers. If you set both `delay_days` or `delay_minutes`, `delay_minutes` is ignored in the request. You can resend to non-openers a minimum of twelve hours (720 minutes) and a maximum of up to 10 days (or 10 x 1440 minutes) after the initial send date. * @summary POST a Resend to Non-openers Campaign Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {CreateResendEmailCampaignRequest} createResendEmailCampaignRequest A JSON request body that specifies when to resend the campaign activity to non-openers. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailCampaignsApi */ public createResendEmailCampaign(campaignActivityId: string, createResendEmailCampaignRequest: CreateResendEmailCampaignRequest, options?: RawAxiosRequestConfig) { return EmailCampaignsApiFp(this.configuration).createResendEmailCampaign(campaignActivityId, createResendEmailCampaignRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Use this method to delete an email campaign and the email campaign activities associated with the email campaign. You cannot delete an email campaign when it has a `Scheduled` status. Constant Contact users can restore deleted email campaigns using the UI. * @summary DELETE an Email Campaign * @param {string} campaignId The unique ID for the email campaign you are deleting. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailCampaignsApi */ public deleteEmailCampaign(campaignId: string, options?: RawAxiosRequestConfig) { return EmailCampaignsApiFp(this.configuration).deleteEmailCampaign(campaignId, options).then((request) => request(this.axios, this.basePath)); } /** * Use this `DELETE` method to delete (unschedule) a resend to non openers activity. * @summary DELETE a Resend to Non Openers Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {string} resendRequestId The unique ID associated with the resend for the email campaign activity (for example: `389093`). If the email campaign activity is currently in draft status, specify `DRAFT` as the ID. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailCampaignsApi */ public deleteResendEmailCampaign(campaignActivityId: string, resendRequestId: string, options?: RawAxiosRequestConfig) { return EmailCampaignsApiFp(this.configuration).deleteResendEmailCampaign(campaignActivityId, resendRequestId, options).then((request) => request(this.axios, this.basePath)); } /** * Use this method to list and get details about your email campaigns. By default, this method returns all email campaigns for the user account including deleted email campaigns. To get email campaigns within a date-range, use the `after_date` and `before_date` query parameters. This endpoint does not return campaign activity details for each email campaign in the collection. To get email campaign activity details for a single email campaign, use the GET `/emails/{campaign_id}` endpoint.\"

This method does not currently support filtering results using the email campaign creation date.

* @summary GET a Collection of Email Campaigns * @param {number} [limit] Specifies the number of campaigns to display on each page of output that is returned (from return 1 - 500). The default returns 50 campaigns per page. * @param {string} [beforeDate] Use to return email campaigns with `updated_at` timestamps that are before a specific date and time (in ISO-8601 format). Use with the `after_date` query parameter to get email campaigns sent within a specific date range. * @param {string} [afterDate] Use to return email campaigns with last `updated_at` timestamps that are after a specific date and time (in ISO-8601 format). Use with the `before_date` query parameter to get email campaigns sent within a specific date range. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailCampaignsApi */ public getAllEmailCampaigns(limit?: number, beforeDate?: string, afterDate?: string, options?: RawAxiosRequestConfig) { return EmailCampaignsApiFp(this.configuration).getAllEmailCampaigns(limit, beforeDate, afterDate, options).then((request) => request(this.axios, this.basePath)); } /** * Use this method to return a specific email campaign activity. Each email campaign activity contains the email content, metadata, and styling information of an email. Email campaign activities can also contain either contact lists or segments. Constant Contact uses this information to determine who to send the email campaign activity to when you schedule it. You cannot get email campaign activities that have a `REMOVED` status. * @summary GET a Single Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {GetEmailCampaignActivityIncludeEnum} [include] Use the `include` query parameter to enter a comma separated list of additional email campaign activity properties for the V3 API to return. Valid values are `physical_address_in_footer`, `permalink_url`, `html_content`, and `document_properties`. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailCampaignsApi */ public getEmailCampaignActivity(campaignActivityId: string, include?: GetEmailCampaignActivityIncludeEnum, options?: RawAxiosRequestConfig) { return EmailCampaignsApiFp(this.configuration).getEmailCampaignActivity(campaignActivityId, include, options).then((request) => request(this.axios, this.basePath)); } /** * Use this method to get details about a single email campaign and campaign related activities. Details include the email campaign name, current status, create date, last update date, and a list of campaign activities; including the `campaign_activity_id` and `role`. * @summary GET Details About a Single Email Campaign * @param {string} campaignId The ID (UUID format) that uniquely identifies this email campaign. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailCampaignsApi */ public getEmailCampaignById(campaignId: string, options?: RawAxiosRequestConfig) { return EmailCampaignsApiFp(this.configuration).getEmailCampaignById(campaignId, options).then((request) => request(this.axios, this.basePath)); } /** *

Use this endpoint to migrate your locally stored V2 email campaign data to the new V3 format. Developers are expected to use this endpoint sparingly. This endpoint is NOT intended for regular or repeated use. Constant Contact will eventually deprecate and remove this endpoint.

Use this method to migrate your local V2 API email data to the V3 API format. For each value that you provide in the `v2_email_campaign_ids` query parameter, this method returns the corresponding V3 `campaign_id` and V3 `campaign_activity_id` UUID value. For more information on the changes to the email campaign resource model, see [V3 Email Campaign Resource Changes](/api_guide/v3_v2_email_campaign_deltas.html) in the API guide. * @summary GET a Collection of V2 and V3 API Email Campaign Identifiers * @param {string} v2EmailCampaignIds Comma separated list of V2 API `campaignId` values. You can enter up to 50 V2 `campaignId` values in each request. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailCampaignsApi */ public getEmailCampaignXrefs(v2EmailCampaignIds: string, options?: RawAxiosRequestConfig) { return EmailCampaignsApiFp(this.configuration).getEmailCampaignXrefs(v2EmailCampaignIds, options).then((request) => request(this.axios, this.basePath)); } /** * Get details about a resend to non-openers campaign activity. If resend activity does not exist for the specified `campaign_activity_id`, an empty list is returned in the results. You can only create one resend activity per email campaign. * @summary GET Details for a Resend to Non-openers Campaign Activity * @param {string} campaignActivityId The unique ID for the primary email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailCampaignsApi */ public getResendEmailCampaign(campaignActivityId: string, options?: RawAxiosRequestConfig) { return EmailCampaignsApiFp(this.configuration).getResendEmailCampaign(campaignActivityId, options).then((request) => request(this.axios, this.basePath)); } /** * Use this method to rename an email campaign. The name is not visible to contacts. The name must be unique and cannot exceed 80 characters. You cannot rename email campaigns that have a `Removed` status. * @summary PATCH (Update) an Email Campaign Name * @param {string} campaignId The unique identifier for an email campaign. * @param {PatchEmailCampaignNameRequest} patchEmailCampaignNameRequest A JSON payload that contains the new email campaign name. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailCampaignsApi */ public patchEmailCampaignName(campaignId: string, patchEmailCampaignNameRequest: PatchEmailCampaignNameRequest, options?: RawAxiosRequestConfig) { return EmailCampaignsApiFp(this.configuration).patchEmailCampaignName(campaignId, patchEmailCampaignNameRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Use this method to update an email campaign activity by including the complete email campaign activity with your changes in the request body. The request body requires the `from_name`, `from_email`, `reply_to_email`, and `subject` properties. You can only update email campaign activities that have the `primary_email` role and that are in `DRAFT` or `Done` status. When you use a PUT method to update a resource, the V3 API overwrites any properties that are missing in the request body. However, the V3 API does not overwrite subresources that you omit in the request body or missing properties in subresources. This method considers `physical_address_in_footer`, `document_properties`, `html_content`, and `permalink_url` subresources of the email campaign activity. * @summary PUT (Update) An Email Campaign Activity * @param {string} campaignActivityId The unique ID for the email campaign activity you are updating. * @param {GetEmailCampaignActivity200Response} getEmailCampaignActivity200Response A request body payload that contains the complete email campaign activity with your changes. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailCampaignsApi */ public updateEmailCampaignActivity(campaignActivityId: string, getEmailCampaignActivity200Response: GetEmailCampaignActivity200Response, options?: RawAxiosRequestConfig) { return EmailCampaignsApiFp(this.configuration).updateEmailCampaignActivity(campaignActivityId, getEmailCampaignActivity200Response, options).then((request) => request(this.axios, this.basePath)); } } /** * @export */ export const GetEmailCampaignActivityIncludeEnum = { PhysicalAddressInFooter: 'physical_address_in_footer', PermalinkUrl: 'permalink_url', HtmlContent: 'html_content', DocumentProperties: 'document_properties' } as const; export type GetEmailCampaignActivityIncludeEnum = typeof GetEmailCampaignActivityIncludeEnum[keyof typeof GetEmailCampaignActivityIncludeEnum];