/**
* Publications service.
* @module api/PublicationsApi
*/
export default class PublicationsApi {
/**
* Constructs a new PublicationsApi.
* @alias PublicationsApi
* @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 createPublication operation.
* @callback createPublicationCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {PublicationsCreateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Create Publication
* This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. Publish multiple vouchers In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish. Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign.
* @param {PublicationsCreateRequestBody} publicationsCreateRequestBody Specify the publication parameters.
* @param {{
joinOnce?: Boolean,
}} [opts] Optional parameters
* @param {createPublicationCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link PublicationsCreateResponseBody}
* @returns {Promise<(PublicationsCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `PublicationsCreateResponseBody` object or with `undefined`.
*/
createPublication(publicationsCreateRequestBody: PublicationsCreateRequestBody, opts?: {
joinOnce?: boolean;
}, callback?: (error: Error | null, data?: PublicationsCreateResponseBody, response?: any) => any): Promise<(PublicationsCreateResponseBody | undefined)>;
/**
* Callback function to receive the result of the createPublication1 operation.
* @callback createPublication1Callback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {PublicationsCreateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Create Publication with GET
* This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. Limited access Access to this endpoint is limited. This endpoint is designed for specific integrations and the API keys need to be configured to access this endpoint. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request. Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. Publish multiple vouchers This endpoint does not support the publishing of multiple vouchers from a single campaign. In case you want to publish multiple vouchers within a single publication, you need to use a [dedicated endpoint](/api-reference/publications/create-publication). Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign. # Example Request Required Query param voucher OR campaign MUST be filled out. If you provide both, campaign param will be skipped.
* @param {Customer} customer Contains information about the customer to whom the publication was directed. Use customer.id, customer.source_id, or both to identify the customer; at least one of them is required.
* @param {{
joinOnce?: Boolean,
voucher?: String,
campaign?: CreatePublicationCampaign,
sourceId?: String,
metadata?: Object.,
}} [opts] Optional parameters
* @param {createPublication1Callback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link PublicationsCreateResponseBody}
* @returns {Promise<(PublicationsCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `PublicationsCreateResponseBody` object or with `undefined`.
*/
createPublication1(customer: Customer, opts?: {
joinOnce?: boolean;
voucher?: string;
campaign?: CreatePublicationCampaign;
sourceId?: string;
metadata?: any;
}, callback?: (error: Error | null, data?: PublicationsCreateResponseBody, response?: any) => any): Promise<(PublicationsCreateResponseBody | undefined)>;
/**
* Callback function to receive the result of the listPublications operation.
* @callback listPublicationsCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {PublicationsListResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* List Publications
* Retrieve a list of publications. To return a **particular** publication, you can use the source_id query parameter and provide the source_id of the publication you are looking for specifically. # Pagination Important! If you want to scroll through a huge set of records, it is recommended to use the [Exports API](/api-reference/exports/create-export). This API will return an error page_over_limit if you reach a page above 1000. # Filter Query The filters query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows: ## Examples
* @param {{
limit?: Number,
page?: Number,
order?: Exclude,
campaign?: String,
customer?: String,
voucher?: String,
result?: Exclude,
voucherType?: Exclude,
isReferralCode?: Boolean,
filters?: ParameterFiltersListPublications,
sourceId?: String,
}} [opts] Optional parameters
* @param {listPublicationsCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link PublicationsListResponseBody}
* @returns {Promise<(PublicationsListResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `PublicationsListResponseBody` object or with `undefined`.
*/
listPublications(opts?: {
limit?: number;
page?: number;
order?: Exclude;
campaign?: string;
customer?: string;
voucher?: string;
result?: Exclude;
voucherType?: Exclude;
isReferralCode?: boolean;
filters?: ParameterFiltersListPublications;
sourceId?: string;
}, callback?: (error: Error | null, data?: PublicationsListResponseBody, response?: any) => any): Promise<(PublicationsListResponseBody | undefined)>;
}
import PublicationsCreateRequestBody from '../model/PublicationsCreateRequestBody';
import PublicationsCreateResponseBody from '../model/PublicationsCreateResponseBody';
import Customer from '../model/Customer';
import CreatePublicationCampaign from '../model/CreatePublicationCampaign';
import ParameterOrderListPublications from '../model/ParameterOrderListPublications';
import ParameterResultListPublications from '../model/ParameterResultListPublications';
import ParameterVoucherTypeListPublications from '../model/ParameterVoucherTypeListPublications';
import ParameterFiltersListPublications from '../model/ParameterFiltersListPublications';
import PublicationsListResponseBody from '../model/PublicationsListResponseBody';