/* 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 { GetEmailCampaignActivityPreview200Response } from '../models'; // @ts-ignore import { GetEmailCampaignActivitySchedule200ResponseInner } from '../models'; // @ts-ignore import { GetEmailCampaignActivitySendHistory200ResponseInner } from '../models'; // @ts-ignore import { ScheduleEmailCampaignActivityRequest } from '../models'; // @ts-ignore import { TestSendEmailCampaignActivityRequest } from '../models'; /** * EmailSchedulingApi - axios parameter creator * @export */ export const EmailSchedulingApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Use this method to get the HTML preview of an email campaign activity. The HTML preview allows you to verify how the email campaign activity will look before you send it to contacts. Custom code emails (`format_type` 5) use the Constant Contact account owner\'s contact information to process contact, custom field, and account variables in the preview. This method returns the HTML preview encoded as a JSON string. You will need to decode the string before you can use it as valid HTML. * @summary GET the HTML Preview of an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignActivityPreview: async (campaignActivityId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignActivityId' is not null or undefined assertParamExists('getEmailCampaignActivityPreview', 'campaignActivityId', campaignActivityId) const localVarPath = `/emails/activities/{campaign_activity_id}/previews` .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 return the current schedule for an email campaign activity. This schedule contains the date that Constant Contact will send the email campaign activity to contacts. If the email campaign activity is not in `SCHEDULED` status, this method returns an empty array and a 200 response code. * @summary GET an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignActivitySchedule: async (campaignActivityId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignActivityId' is not null or undefined assertParamExists('getEmailCampaignActivitySchedule', 'campaignActivityId', campaignActivityId) const localVarPath = `/emails/activities/{campaign_activity_id}/schedules` .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 return the send history of an email campaign activity. This method returns the send history as an array containing an object for each time you sent a specific email campaign activity to contacts. Each send history object contains the email campaign activity send date, the number of contacts it was sent to, and the contact lists or segments used to send it. Each send history object also includes if the send attempt completed or encountered an error, and the reason why each error occurred. This method returns results in ascending order starting with the first send attempt. If the email campaign activity has not been sent to contacts, this method returns a 200 response and an empty array. * @summary GET the Send History of an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. You can return the send history for `primary_email` and `resend` role email campaign activities. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignActivitySendHistory: async (campaignActivityId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignActivityId' is not null or undefined assertParamExists('getEmailCampaignActivitySendHistory', 'campaignActivityId', campaignActivityId) const localVarPath = `/emails/activities/{campaign_activity_id}/send_history` .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 schedule when Constant Contact will send an email campaign activity to contacts. Use the `scheduled_date` request body property to enter the ISO-8601 format date that you want Constant Contact to send the email campaign activity on. Before you schedule an email campaign activity, you must update the email campaign activity and specify which contacts you want Constant Contact to send the email to. When you make a PUT call to update an email campaign activity, use the `contact_list_ids` or `segment_ids` array to add contacts. You can only schedule email campaign activities that have the `primary_email` role and are in `DRAFT`, `DONE`, or `ERROR` status. When you schedule an email campaign activity in `DONE` status, Constant Contact does not send the email campaign activity to contacts that already received it. Constant Contact only sends the email campaign activity to any new contacts in the contact lists or segment you use. * @summary POST (Create) an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. You can only schedule email campaign activities that have the `primary_email` role. * @param {ScheduleEmailCampaignActivityRequest} scheduleEmailCampaignActivityRequest A request body payload that contains the date that you want Constant Contact to send your email campaign activity on. Use `\"0\"` as the date to have Constant Contact immediately send the email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ scheduleEmailCampaignActivity: async (campaignActivityId: string, scheduleEmailCampaignActivityRequest: ScheduleEmailCampaignActivityRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignActivityId' is not null or undefined assertParamExists('scheduleEmailCampaignActivity', 'campaignActivityId', campaignActivityId) // verify required parameter 'scheduleEmailCampaignActivityRequest' is not null or undefined assertParamExists('scheduleEmailCampaignActivity', 'scheduleEmailCampaignActivityRequest', scheduleEmailCampaignActivityRequest) const localVarPath = `/emails/activities/{campaign_activity_id}/schedules` .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(scheduleEmailCampaignActivityRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Use this method to send a test email to specific email addresses. Test emails allow you to verify how the email campaign activity will look before you send it to contacts. This method uses the `email_addresses` array in the request body to determine the recipients of the test email. The test email does not process any dynamic content in the email campaign activity. Dynamic content includes contact and custom field variables. You can send up to 50 test emails each day. Each recipient you add to the `email_addresses` array in the request body counts towards this limit. Successfully sending a test email returns a 204 response code without a response body. * @summary POST Test Send an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. You can only test send email campaign activities that have the `primary_email` role. * @param {TestSendEmailCampaignActivityRequest} testSendEmailCampaignActivityRequest A JSON request body that contains the recipients of the test email and an optional personal message. * @param {*} [options] Override http request option. * @throws {RequiredError} */ testSendEmailCampaignActivity: async (campaignActivityId: string, testSendEmailCampaignActivityRequest: TestSendEmailCampaignActivityRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignActivityId' is not null or undefined assertParamExists('testSendEmailCampaignActivity', 'campaignActivityId', campaignActivityId) // verify required parameter 'testSendEmailCampaignActivityRequest' is not null or undefined assertParamExists('testSendEmailCampaignActivity', 'testSendEmailCampaignActivityRequest', testSendEmailCampaignActivityRequest) const localVarPath = `/emails/activities/{campaign_activity_id}/tests` .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(testSendEmailCampaignActivityRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Use this method to unschedule an email campaign activity by deleting the schedule. You can only unschedule email campaign activities that are in `SCHEDULED` status. Unscheduling reverts the email campaign activity to the status prior to `SCHEDULED`. * @summary DELETE an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ unscheduleEmailCampaignActivity: async (campaignActivityId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'campaignActivityId' is not null or undefined assertParamExists('unscheduleEmailCampaignActivity', 'campaignActivityId', campaignActivityId) const localVarPath = `/emails/activities/{campaign_activity_id}/schedules` .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: '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, }; }, } }; /** * EmailSchedulingApi - functional programming interface * @export */ export const EmailSchedulingApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = EmailSchedulingApiAxiosParamCreator(configuration) return { /** * Use this method to get the HTML preview of an email campaign activity. The HTML preview allows you to verify how the email campaign activity will look before you send it to contacts. Custom code emails (`format_type` 5) use the Constant Contact account owner\'s contact information to process contact, custom field, and account variables in the preview. This method returns the HTML preview encoded as a JSON string. You will need to decode the string before you can use it as valid HTML. * @summary GET the HTML Preview of an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEmailCampaignActivityPreview(campaignActivityId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEmailCampaignActivityPreview(campaignActivityId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailSchedulingApi.getEmailCampaignActivityPreview']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this method to return the current schedule for an email campaign activity. This schedule contains the date that Constant Contact will send the email campaign activity to contacts. If the email campaign activity is not in `SCHEDULED` status, this method returns an empty array and a 200 response code. * @summary GET an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEmailCampaignActivitySchedule(campaignActivityId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEmailCampaignActivitySchedule(campaignActivityId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailSchedulingApi.getEmailCampaignActivitySchedule']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this method to return the send history of an email campaign activity. This method returns the send history as an array containing an object for each time you sent a specific email campaign activity to contacts. Each send history object contains the email campaign activity send date, the number of contacts it was sent to, and the contact lists or segments used to send it. Each send history object also includes if the send attempt completed or encountered an error, and the reason why each error occurred. This method returns results in ascending order starting with the first send attempt. If the email campaign activity has not been sent to contacts, this method returns a 200 response and an empty array. * @summary GET the Send History of an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. You can return the send history for `primary_email` and `resend` role email campaign activities. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEmailCampaignActivitySendHistory(campaignActivityId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEmailCampaignActivitySendHistory(campaignActivityId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailSchedulingApi.getEmailCampaignActivitySendHistory']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this method to schedule when Constant Contact will send an email campaign activity to contacts. Use the `scheduled_date` request body property to enter the ISO-8601 format date that you want Constant Contact to send the email campaign activity on. Before you schedule an email campaign activity, you must update the email campaign activity and specify which contacts you want Constant Contact to send the email to. When you make a PUT call to update an email campaign activity, use the `contact_list_ids` or `segment_ids` array to add contacts. You can only schedule email campaign activities that have the `primary_email` role and are in `DRAFT`, `DONE`, or `ERROR` status. When you schedule an email campaign activity in `DONE` status, Constant Contact does not send the email campaign activity to contacts that already received it. Constant Contact only sends the email campaign activity to any new contacts in the contact lists or segment you use. * @summary POST (Create) an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. You can only schedule email campaign activities that have the `primary_email` role. * @param {ScheduleEmailCampaignActivityRequest} scheduleEmailCampaignActivityRequest A request body payload that contains the date that you want Constant Contact to send your email campaign activity on. Use `\"0\"` as the date to have Constant Contact immediately send the email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async scheduleEmailCampaignActivity(campaignActivityId: string, scheduleEmailCampaignActivityRequest: ScheduleEmailCampaignActivityRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.scheduleEmailCampaignActivity(campaignActivityId, scheduleEmailCampaignActivityRequest, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailSchedulingApi.scheduleEmailCampaignActivity']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this method to send a test email to specific email addresses. Test emails allow you to verify how the email campaign activity will look before you send it to contacts. This method uses the `email_addresses` array in the request body to determine the recipients of the test email. The test email does not process any dynamic content in the email campaign activity. Dynamic content includes contact and custom field variables. You can send up to 50 test emails each day. Each recipient you add to the `email_addresses` array in the request body counts towards this limit. Successfully sending a test email returns a 204 response code without a response body. * @summary POST Test Send an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. You can only test send email campaign activities that have the `primary_email` role. * @param {TestSendEmailCampaignActivityRequest} testSendEmailCampaignActivityRequest A JSON request body that contains the recipients of the test email and an optional personal message. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async testSendEmailCampaignActivity(campaignActivityId: string, testSendEmailCampaignActivityRequest: TestSendEmailCampaignActivityRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.testSendEmailCampaignActivity(campaignActivityId, testSendEmailCampaignActivityRequest, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailSchedulingApi.testSendEmailCampaignActivity']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Use this method to unschedule an email campaign activity by deleting the schedule. You can only unschedule email campaign activities that are in `SCHEDULED` status. Unscheduling reverts the email campaign activity to the status prior to `SCHEDULED`. * @summary DELETE an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async unscheduleEmailCampaignActivity(campaignActivityId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.unscheduleEmailCampaignActivity(campaignActivityId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['EmailSchedulingApi.unscheduleEmailCampaignActivity']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, } }; /** * EmailSchedulingApi - factory interface * @export */ export const EmailSchedulingApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = EmailSchedulingApiFp(configuration) return { /** * Use this method to get the HTML preview of an email campaign activity. The HTML preview allows you to verify how the email campaign activity will look before you send it to contacts. Custom code emails (`format_type` 5) use the Constant Contact account owner\'s contact information to process contact, custom field, and account variables in the preview. This method returns the HTML preview encoded as a JSON string. You will need to decode the string before you can use it as valid HTML. * @summary GET the HTML Preview of an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignActivityPreview(campaignActivityId: string, options?: any): AxiosPromise { return localVarFp.getEmailCampaignActivityPreview(campaignActivityId, options).then((request) => request(axios, basePath)); }, /** * Use this method to return the current schedule for an email campaign activity. This schedule contains the date that Constant Contact will send the email campaign activity to contacts. If the email campaign activity is not in `SCHEDULED` status, this method returns an empty array and a 200 response code. * @summary GET an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignActivitySchedule(campaignActivityId: string, options?: any): AxiosPromise> { return localVarFp.getEmailCampaignActivitySchedule(campaignActivityId, options).then((request) => request(axios, basePath)); }, /** * Use this method to return the send history of an email campaign activity. This method returns the send history as an array containing an object for each time you sent a specific email campaign activity to contacts. Each send history object contains the email campaign activity send date, the number of contacts it was sent to, and the contact lists or segments used to send it. Each send history object also includes if the send attempt completed or encountered an error, and the reason why each error occurred. This method returns results in ascending order starting with the first send attempt. If the email campaign activity has not been sent to contacts, this method returns a 200 response and an empty array. * @summary GET the Send History of an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. You can return the send history for `primary_email` and `resend` role email campaign activities. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEmailCampaignActivitySendHistory(campaignActivityId: string, options?: any): AxiosPromise> { return localVarFp.getEmailCampaignActivitySendHistory(campaignActivityId, options).then((request) => request(axios, basePath)); }, /** * Use this method to schedule when Constant Contact will send an email campaign activity to contacts. Use the `scheduled_date` request body property to enter the ISO-8601 format date that you want Constant Contact to send the email campaign activity on. Before you schedule an email campaign activity, you must update the email campaign activity and specify which contacts you want Constant Contact to send the email to. When you make a PUT call to update an email campaign activity, use the `contact_list_ids` or `segment_ids` array to add contacts. You can only schedule email campaign activities that have the `primary_email` role and are in `DRAFT`, `DONE`, or `ERROR` status. When you schedule an email campaign activity in `DONE` status, Constant Contact does not send the email campaign activity to contacts that already received it. Constant Contact only sends the email campaign activity to any new contacts in the contact lists or segment you use. * @summary POST (Create) an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. You can only schedule email campaign activities that have the `primary_email` role. * @param {ScheduleEmailCampaignActivityRequest} scheduleEmailCampaignActivityRequest A request body payload that contains the date that you want Constant Contact to send your email campaign activity on. Use `\"0\"` as the date to have Constant Contact immediately send the email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ scheduleEmailCampaignActivity(campaignActivityId: string, scheduleEmailCampaignActivityRequest: ScheduleEmailCampaignActivityRequest, options?: any): AxiosPromise> { return localVarFp.scheduleEmailCampaignActivity(campaignActivityId, scheduleEmailCampaignActivityRequest, options).then((request) => request(axios, basePath)); }, /** * Use this method to send a test email to specific email addresses. Test emails allow you to verify how the email campaign activity will look before you send it to contacts. This method uses the `email_addresses` array in the request body to determine the recipients of the test email. The test email does not process any dynamic content in the email campaign activity. Dynamic content includes contact and custom field variables. You can send up to 50 test emails each day. Each recipient you add to the `email_addresses` array in the request body counts towards this limit. Successfully sending a test email returns a 204 response code without a response body. * @summary POST Test Send an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. You can only test send email campaign activities that have the `primary_email` role. * @param {TestSendEmailCampaignActivityRequest} testSendEmailCampaignActivityRequest A JSON request body that contains the recipients of the test email and an optional personal message. * @param {*} [options] Override http request option. * @throws {RequiredError} */ testSendEmailCampaignActivity(campaignActivityId: string, testSendEmailCampaignActivityRequest: TestSendEmailCampaignActivityRequest, options?: any): AxiosPromise { return localVarFp.testSendEmailCampaignActivity(campaignActivityId, testSendEmailCampaignActivityRequest, options).then((request) => request(axios, basePath)); }, /** * Use this method to unschedule an email campaign activity by deleting the schedule. You can only unschedule email campaign activities that are in `SCHEDULED` status. Unscheduling reverts the email campaign activity to the status prior to `SCHEDULED`. * @summary DELETE an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ unscheduleEmailCampaignActivity(campaignActivityId: string, options?: any): AxiosPromise { return localVarFp.unscheduleEmailCampaignActivity(campaignActivityId, options).then((request) => request(axios, basePath)); }, }; }; /** * EmailSchedulingApi - object-oriented interface * @export * @class EmailSchedulingApi * @extends {BaseAPI} */ export class EmailSchedulingApi extends BaseAPI { /** * Use this method to get the HTML preview of an email campaign activity. The HTML preview allows you to verify how the email campaign activity will look before you send it to contacts. Custom code emails (`format_type` 5) use the Constant Contact account owner\'s contact information to process contact, custom field, and account variables in the preview. This method returns the HTML preview encoded as a JSON string. You will need to decode the string before you can use it as valid HTML. * @summary GET the HTML Preview of an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailSchedulingApi */ public getEmailCampaignActivityPreview(campaignActivityId: string, options?: RawAxiosRequestConfig) { return EmailSchedulingApiFp(this.configuration).getEmailCampaignActivityPreview(campaignActivityId, options).then((request) => request(this.axios, this.basePath)); } /** * Use this method to return the current schedule for an email campaign activity. This schedule contains the date that Constant Contact will send the email campaign activity to contacts. If the email campaign activity is not in `SCHEDULED` status, this method returns an empty array and a 200 response code. * @summary GET an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailSchedulingApi */ public getEmailCampaignActivitySchedule(campaignActivityId: string, options?: RawAxiosRequestConfig) { return EmailSchedulingApiFp(this.configuration).getEmailCampaignActivitySchedule(campaignActivityId, options).then((request) => request(this.axios, this.basePath)); } /** * Use this method to return the send history of an email campaign activity. This method returns the send history as an array containing an object for each time you sent a specific email campaign activity to contacts. Each send history object contains the email campaign activity send date, the number of contacts it was sent to, and the contact lists or segments used to send it. Each send history object also includes if the send attempt completed or encountered an error, and the reason why each error occurred. This method returns results in ascending order starting with the first send attempt. If the email campaign activity has not been sent to contacts, this method returns a 200 response and an empty array. * @summary GET the Send History of an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. You can return the send history for `primary_email` and `resend` role email campaign activities. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailSchedulingApi */ public getEmailCampaignActivitySendHistory(campaignActivityId: string, options?: RawAxiosRequestConfig) { return EmailSchedulingApiFp(this.configuration).getEmailCampaignActivitySendHistory(campaignActivityId, options).then((request) => request(this.axios, this.basePath)); } /** * Use this method to schedule when Constant Contact will send an email campaign activity to contacts. Use the `scheduled_date` request body property to enter the ISO-8601 format date that you want Constant Contact to send the email campaign activity on. Before you schedule an email campaign activity, you must update the email campaign activity and specify which contacts you want Constant Contact to send the email to. When you make a PUT call to update an email campaign activity, use the `contact_list_ids` or `segment_ids` array to add contacts. You can only schedule email campaign activities that have the `primary_email` role and are in `DRAFT`, `DONE`, or `ERROR` status. When you schedule an email campaign activity in `DONE` status, Constant Contact does not send the email campaign activity to contacts that already received it. Constant Contact only sends the email campaign activity to any new contacts in the contact lists or segment you use. * @summary POST (Create) an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. You can only schedule email campaign activities that have the `primary_email` role. * @param {ScheduleEmailCampaignActivityRequest} scheduleEmailCampaignActivityRequest A request body payload that contains the date that you want Constant Contact to send your email campaign activity on. Use `\"0\"` as the date to have Constant Contact immediately send the email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailSchedulingApi */ public scheduleEmailCampaignActivity(campaignActivityId: string, scheduleEmailCampaignActivityRequest: ScheduleEmailCampaignActivityRequest, options?: RawAxiosRequestConfig) { return EmailSchedulingApiFp(this.configuration).scheduleEmailCampaignActivity(campaignActivityId, scheduleEmailCampaignActivityRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Use this method to send a test email to specific email addresses. Test emails allow you to verify how the email campaign activity will look before you send it to contacts. This method uses the `email_addresses` array in the request body to determine the recipients of the test email. The test email does not process any dynamic content in the email campaign activity. Dynamic content includes contact and custom field variables. You can send up to 50 test emails each day. Each recipient you add to the `email_addresses` array in the request body counts towards this limit. Successfully sending a test email returns a 204 response code without a response body. * @summary POST Test Send an Email Campaign Activity * @param {string} campaignActivityId The unique ID for an email campaign activity. You can only test send email campaign activities that have the `primary_email` role. * @param {TestSendEmailCampaignActivityRequest} testSendEmailCampaignActivityRequest A JSON request body that contains the recipients of the test email and an optional personal message. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailSchedulingApi */ public testSendEmailCampaignActivity(campaignActivityId: string, testSendEmailCampaignActivityRequest: TestSendEmailCampaignActivityRequest, options?: RawAxiosRequestConfig) { return EmailSchedulingApiFp(this.configuration).testSendEmailCampaignActivity(campaignActivityId, testSendEmailCampaignActivityRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Use this method to unschedule an email campaign activity by deleting the schedule. You can only unschedule email campaign activities that are in `SCHEDULED` status. Unscheduling reverts the email campaign activity to the status prior to `SCHEDULED`. * @summary DELETE an Email Campaign Activity Schedule * @param {string} campaignActivityId The unique ID for an email campaign activity. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailSchedulingApi */ public unscheduleEmailCampaignActivity(campaignActivityId: string, options?: RawAxiosRequestConfig) { return EmailSchedulingApiFp(this.configuration).unscheduleEmailCampaignActivity(campaignActivityId, options).then((request) => request(this.axios, this.basePath)); } }