/** * Campaigns service. * @module api/CampaignsApi */ export default class CampaignsApi { /** * Constructs a new CampaignsApi. * @alias CampaignsApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ constructor(apiClient?: any); apiClient: any; /** * Callback function to receive the result of the addVoucherWithSpecificCodeToCampaign operation. * @callback addVoucherWithSpecificCodeToCampaignCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsVouchersCreateResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Add Voucher with Specific Code to Campaign * This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign. * @param {String} campaignId The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. * @param {String} code A custom **code** that identifies the voucher. * @param {CampaignsVouchersCreateRequestBody} campaignsVouchersCreateRequestBody Specify the voucher parameters that you would like to overwrite. * @param {addVoucherWithSpecificCodeToCampaignCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsVouchersCreateResponseBody} * @returns {Promise<(CampaignsVouchersCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsVouchersCreateResponseBody` object or with `undefined`. */ addVoucherWithSpecificCodeToCampaign(campaignId: string, code: string, campaignsVouchersCreateRequestBody: CampaignsVouchersCreateRequestBody, callback?: (error: Error | null, data?: CampaignsVouchersCreateResponseBody, response?: any) => any): Promise<(CampaignsVouchersCreateResponseBody | undefined)>; /** * Callback function to receive the result of the addVouchersToCampaign operation. * @callback addVouchersToCampaignCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsVouchersCreateCombinedResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Add Vouchers to Campaign * This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional code_config parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this [API request](/api-reference/async-actions/get-async-action). * @param {String} campaignId The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. * @param {CampaignsVouchersCreateInBulkRequestBody} campaignsVouchersCreateInBulkRequestBody Specify the voucher parameters that you would like to overwrite. * @param {{ vouchersCount?: Number, }} [opts] Optional parameters * @param {addVouchersToCampaignCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsVouchersCreateCombinedResponseBody} * @returns {Promise<(CampaignsVouchersCreateCombinedResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsVouchersCreateCombinedResponseBody` object or with `undefined`. */ addVouchersToCampaign(campaignId: string, campaignsVouchersCreateInBulkRequestBody: CampaignsVouchersCreateInBulkRequestBody, opts?: { vouchersCount?: number; }, callback?: (error: Error | null, data?: CampaignsVouchersCreateCombinedResponseBody, response?: any) => any): Promise<(CampaignsVouchersCreateCombinedResponseBody | undefined)>; /** * Callback function to receive the result of the createCampaign operation. * @callback createCampaignCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsCreateResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Create Campaign * Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. Global uniqueness All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. Code generation status This is an asynchronous action; you cant read or modify a newly created campaign until the code generation is completed. See the creation_status field in the [campaign object](/api-reference/campaigns/campaign-object) description. * @param {CampaignsCreateRequestBody} campaignsCreateRequestBody Specify the details of the campaign that you would like to create. * @param {createCampaignCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsCreateResponseBody} * @returns {Promise<(CampaignsCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsCreateResponseBody` object or with `undefined`. */ createCampaign(campaignsCreateRequestBody: CampaignsCreateRequestBody, callback?: (error: Error | null, data?: CampaignsCreateResponseBody, response?: any) => any): Promise<(CampaignsCreateResponseBody | undefined)>; /** * Callback function to receive the result of the deleteCampaign operation. * @callback deleteCampaignCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsDeleteResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Delete Campaign * Deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the campaign and all related vouchers will be moved to [the bin](/api-reference/bin/list-bin-entries). This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this [API request](/api-reference/async-actions/get-async-action). * @param {String} campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. * @param {{ force?: Boolean, }} [opts] Optional parameters * @param {deleteCampaignCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsDeleteResponseBody} * @returns {Promise<(CampaignsDeleteResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsDeleteResponseBody` object or with `undefined`. */ deleteCampaign(campaignId: string, opts?: { force?: boolean; }, callback?: (error: Error | null, data?: CampaignsDeleteResponseBody, response?: any) => any): Promise<(CampaignsDeleteResponseBody | undefined)>; /** * Callback function to receive the result of the disableCampaign operation. * @callback disableCampaignCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {Object} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Disable Campaign * Sets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed. * @param {String} campaignId The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. * @param {disableCampaignCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link Object} * @returns {Promise<(Object | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `Object` object or with `undefined`. */ disableCampaign(campaignId: string, callback?: (error: Error | null, data?: any, response?: any) => any): Promise<(any | undefined)>; /** * Callback function to receive the result of the enableCampaign operation. * @callback enableCampaignCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {Object} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Enable Campaign * Sets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired. * @param {String} campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. * @param {enableCampaignCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link Object} * @returns {Promise<(Object | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `Object` object or with `undefined`. */ enableCampaign(campaignId: string, callback?: (error: Error | null, data?: any, response?: any) => any): Promise<(any | undefined)>; /** * Callback function to receive the result of the exportCampaignTransactions operation. * @callback exportCampaignTransactionsCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsTransactionsExportCreateResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Export Campaign Transactions * Export transactions is an asynchronous process that generates a CSV file with the data about credit movements on all gift cards or point movements on all loyalty cards in a given campaign. To export transactions: 1. In the export request, use parameters to select which fields will be exported, in what order, and which data will be filtered. 2. Use the returned id to track the export status with the [GET Export](/api-reference/exports/get-export) method. 3. In the GET Export method, when the returned status field has the DONE value, the export file has been generated. 4. Use the URL in the result property to download the file. You must be logged to your Voucherify account on a given cluster in the browser to be able to download the file. An export request will almost always result in a single file being generated by the system. However, when the data volume is large, the system may split the results into multiple files. An example export file can look as follows: Export Loyalty Campaign Transactions For loyalty campaigns, this method works in the same way the [POST Export Loyalty Campaign Transactions](/api-reference/loyalties/export-loyalty-campaign-transactions) does. * @param {String} campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. * @param {CampaignsTransactionsExportCreateRequestBody} campaignsTransactionsExportCreateRequestBody Specify the parameters for the transaction export. * @param {exportCampaignTransactionsCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsTransactionsExportCreateResponseBody} * @returns {Promise<(CampaignsTransactionsExportCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsTransactionsExportCreateResponseBody` object or with `undefined`. */ exportCampaignTransactions(campaignId: string, campaignsTransactionsExportCreateRequestBody: CampaignsTransactionsExportCreateRequestBody, callback?: (error: Error | null, data?: CampaignsTransactionsExportCreateResponseBody, response?: any) => any): Promise<(CampaignsTransactionsExportCreateResponseBody | undefined)>; /** * Callback function to receive the result of the getCampaign operation. * @callback getCampaignCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsGetResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Get Campaign * Retrieves the campaign with the given campaign ID or campaign name. * @param {String} campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. * @param {getCampaignCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsGetResponseBody} * @returns {Promise<(CampaignsGetResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsGetResponseBody` object or with `undefined`. */ getCampaign(campaignId: string, callback?: (error: Error | null, data?: CampaignsGetResponseBody, response?: any) => any): Promise<(CampaignsGetResponseBody | undefined)>; /** * Callback function to receive the result of the getCampaignSummary operation. * @callback getCampaignSummaryCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsSummaryGetResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Get Campaign Summary * Returns data for campaign analytics, covering validations, redemptions, publications, and other details specific to a given campaign type. Use start_date and end_date to narrow down the data to specific periods. Campaigns created before 17 June 2025 This endpoint returns analytics data for campaigns that were created after 17 June 2025. Older campaigns return empty data. * @param {String} campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. * @param {{ startDate?: Date, endDate?: Date, }} [opts] Optional parameters * @param {getCampaignSummaryCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsSummaryGetResponseBody} * @returns {Promise<(CampaignsSummaryGetResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsSummaryGetResponseBody` object or with `undefined`. */ getCampaignSummary(campaignId: string, opts?: { startDate?: Date; endDate?: Date; }, callback?: (error: Error | null, data?: CampaignsSummaryGetResponseBody, response?: any) => any): Promise<(CampaignsSummaryGetResponseBody | undefined)>; /** * Callback function to receive the result of the importVouchersToCampaign operation. * @callback importVouchersToCampaignCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsImportCreateResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Import Vouchers to Campaign * Imports vouchers to an **existing** campaign. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this [API request](/api-reference/async-actions/get-async-action). * @param {String} campaignId The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. * @param {Array.} campaignsImportVoucherItem Discount type, expiration date and the remaining attributes will be taken from the [Campaign](/api-reference/campaigns/get-campaign) settings. * @param {importVouchersToCampaignCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsImportCreateResponseBody} * @returns {Promise<(CampaignsImportCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsImportCreateResponseBody` object or with `undefined`. */ importVouchersToCampaign(campaignId: string, campaignsImportVoucherItem: Array, callback?: (error: Error | null, data?: CampaignsImportCreateResponseBody, response?: any) => any): Promise<(CampaignsImportCreateResponseBody | undefined)>; /** * Callback function to receive the result of the importVouchersToCampaignUsingCsv operation. * @callback importVouchersToCampaignUsingCsvCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsImportCsvCreateResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Import Vouchers to Campaign by CSV * Imports vouchers to an **existing** campaign. The CSV file has to include headers in the first line. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this [API request](/api-reference/async-actions/get-async-action). * @param {String} campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. * @param {{ file?: File, }} [opts] Optional parameters * @param {importVouchersToCampaignUsingCsvCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsImportCsvCreateResponseBody} * @returns {Promise<(CampaignsImportCsvCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsImportCsvCreateResponseBody` object or with `undefined`. */ importVouchersToCampaignUsingCsv(campaignId: string, opts?: { file?: File; }, callback?: (error: Error | null, data?: CampaignsImportCsvCreateResponseBody, response?: any) => any): Promise<(CampaignsImportCsvCreateResponseBody | undefined)>; /** * Callback function to receive the result of the listCampaignTransactions operation. * @callback listCampaignTransactionsCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsTransactionsListResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * List Campaign Transactions * Retrieves all transactions for the campaign with the given campaign ID or campaign name. The id filter denotes the unique transaction identifier. The endpoint works only for gift card and loyalty campaigns. * @param {String} campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. * @param {{ limit?: Number, order?: Exclude, startingAfterId?: String, filters?: ParametersFiltersListCampaignTransactions, }} [opts] Optional parameters * @param {listCampaignTransactionsCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsTransactionsListResponseBody} * @returns {Promise<(CampaignsTransactionsListResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsTransactionsListResponseBody` object or with `undefined`. */ listCampaignTransactions(campaignId: string, opts?: { limit?: number; order?: Exclude; startingAfterId?: string; filters?: ParametersFiltersListCampaignTransactions; }, callback?: (error: Error | null, data?: CampaignsTransactionsListResponseBody, response?: any) => any): Promise<(CampaignsTransactionsListResponseBody | undefined)>; /** * Callback function to receive the result of the listCampaigns operation. * @callback listCampaignsCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsListResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * List Campaigns * Retrieve a list of campaigns in a project. The campaigns are returned sorted by creation date, with the most recent campaigns appearing first. When you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using limit, which page of campaigns to return using page, sort the campaigns using the order query parameter and filter the results by the campaign_type. This method will return an error when trying to return a limit of more than 100 campaigns. * @param {{ limit?: Number, page?: Number, campaignType?: Exclude, expand?: Exclude, campaignStatus?: Exclude, isReferralCode?: Boolean, order?: Exclude, filters?: ParameterFiltersListCampaigns, accessSettings?: ParameterCampaignsAccessSetttings, }} [opts] Optional parameters * @param {listCampaignsCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsListResponseBody} * @returns {Promise<(CampaignsListResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsListResponseBody` object or with `undefined`. */ listCampaigns(opts?: { limit?: number; page?: number; campaignType?: Exclude; expand?: Exclude; campaignStatus?: Exclude; isReferralCode?: boolean; order?: Exclude; filters?: ParameterFiltersListCampaigns; accessSettings?: ParameterCampaignsAccessSetttings; }, callback?: (error: Error | null, data?: CampaignsListResponseBody, response?: any) => any): Promise<(CampaignsListResponseBody | undefined)>; /** * Callback function to receive the result of the updateCampaign operation. * @callback updateCampaignCallback * @param {Error|null} error Error object if failed, null otherwise. * @param {CampaignsUpdateResponseBody} [data] The data returned by the service call. * @param {Object} [response] Full response object if successful. */ /** * Update Campaign * Updates the specified campaign by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. Vouchers will be affected This method will update vouchers aggregated in the campaign. It will affect all vouchers that are not published or redeemed yet. * @param {String} campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. * @param {CampaignsUpdateRequestBody} campaignsUpdateRequestBody Specify the campaign parameters to be updated. * @param {updateCampaignCallback} [callback] The callback function, accepting three arguments: error, data, response * data is of type: {@link CampaignsUpdateResponseBody} * @returns {Promise<(CampaignsUpdateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CampaignsUpdateResponseBody` object or with `undefined`. */ updateCampaign(campaignId: string, campaignsUpdateRequestBody: CampaignsUpdateRequestBody, callback?: (error: Error | null, data?: CampaignsUpdateResponseBody, response?: any) => any): Promise<(CampaignsUpdateResponseBody | undefined)>; } import CampaignsVouchersCreateRequestBody from '../model/CampaignsVouchersCreateRequestBody'; import CampaignsVouchersCreateResponseBody from '../model/CampaignsVouchersCreateResponseBody'; import CampaignsVouchersCreateInBulkRequestBody from '../model/CampaignsVouchersCreateInBulkRequestBody'; import CampaignsVouchersCreateCombinedResponseBody from '../model/CampaignsVouchersCreateCombinedResponseBody'; import CampaignsCreateRequestBody from '../model/CampaignsCreateRequestBody'; import CampaignsCreateResponseBody from '../model/CampaignsCreateResponseBody'; import CampaignsDeleteResponseBody from '../model/CampaignsDeleteResponseBody'; import CampaignsTransactionsExportCreateRequestBody from '../model/CampaignsTransactionsExportCreateRequestBody'; import CampaignsTransactionsExportCreateResponseBody from '../model/CampaignsTransactionsExportCreateResponseBody'; import CampaignsGetResponseBody from '../model/CampaignsGetResponseBody'; import CampaignsSummaryGetResponseBody from '../model/CampaignsSummaryGetResponseBody'; import CampaignsImportVoucherItem from '../model/CampaignsImportVoucherItem'; import CampaignsImportCreateResponseBody from '../model/CampaignsImportCreateResponseBody'; import CampaignsImportCsvCreateResponseBody from '../model/CampaignsImportCsvCreateResponseBody'; import ParameterOrderListTransactions from '../model/ParameterOrderListTransactions'; import ParametersFiltersListCampaignTransactions from '../model/ParametersFiltersListCampaignTransactions'; import CampaignsTransactionsListResponseBody from '../model/CampaignsTransactionsListResponseBody'; import ParameterCampaignType from '../model/ParameterCampaignType'; import ParameterExpandListCampaigns from '../model/ParameterExpandListCampaigns'; import ParameterCampaignStatusListCampaigns from '../model/ParameterCampaignStatusListCampaigns'; import ParameterOrderListCampaigns from '../model/ParameterOrderListCampaigns'; import ParameterFiltersListCampaigns from '../model/ParameterFiltersListCampaigns'; import ParameterCampaignsAccessSetttings from '../model/ParameterCampaignsAccessSetttings'; import CampaignsListResponseBody from '../model/CampaignsListResponseBody'; import CampaignsUpdateRequestBody from '../model/CampaignsUpdateRequestBody'; import CampaignsUpdateResponseBody from '../model/CampaignsUpdateResponseBody';