/**
* Customers service.
* @module api/CustomersApi
*/
export default class CustomersApi {
/**
* Constructs a new CustomersApi.
* @alias CustomersApi
* @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 createCustomer operation.
* @callback createCustomerCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {CustomersCreateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Create Customer
* Creates a customer object. Upsert Mode If you pass an id or a source_id that already exists in the customer database, Voucherify will return a related customer object with updated fields.
* @param {CustomersCreateRequestBody} customersCreateRequestBody Create a customer with specified parameters.
* @param {createCustomerCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link CustomersCreateResponseBody}
* @returns {Promise<(CustomersCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CustomersCreateResponseBody` object or with `undefined`.
*/
createCustomer(customersCreateRequestBody: CustomersCreateRequestBody, callback?: (error: Error | null, data?: CustomersCreateResponseBody, response?: any) => any): Promise<(CustomersCreateResponseBody | undefined)>;
/**
* Callback function to receive the result of the customerPermanentlyDeletion operation.
* @callback customerPermanentlyDeletionCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {CustomersPermanentDeletionCreateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Delete Customer Permanently
* The organization user can remove customer data permanently from the Voucherify system by using this API method. It deletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify as per the GDPR.
* @param {String} customerId A Voucherify customers id or source_id.
* @param {customerPermanentlyDeletionCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link CustomersPermanentDeletionCreateResponseBody}
* @returns {Promise<(CustomersPermanentDeletionCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CustomersPermanentDeletionCreateResponseBody` object or with `undefined`.
*/
customerPermanentlyDeletion(customerId: string, callback?: (error: Error | null, data?: CustomersPermanentDeletionCreateResponseBody, response?: any) => any): Promise<(CustomersPermanentDeletionCreateResponseBody | undefined)>;
/**
* Callback function to receive the result of the deleteCustomer operation.
* @callback deleteCustomerCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param data This operation does not return a value.
* @param {Object} [response] Full response object if successful.
*/
/**
* Delete Customer
* This method deletes a customer. The customer is permanently deleted. This means that a new customer with the same source_id can be created. GDPR compliance This method does NOT delete all related data, including personal data, from Voucherify databases. To delete these records and fulfil the right to be forgotten in the sense of the GDPR, use the [Delete Customer Permanently](/api-reference/customers/delete-customer-permanently) endpoint or go to [Delete people data](/manage/team-settings#delete-people-data) in the Voucherify [Team settings](/manage/team-settings).
* @param {String} customerId A Voucherify customers id or source_id.
* @param {deleteCustomerCallback} [callback] The callback function, accepting three arguments: error, data, response
* @returns {Promise<( | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `` object or with `undefined`.
*/
deleteCustomer(customerId: string, callback?: (error: Error | null, data: any, response?: any) => any): Promise<(undefined)>;
/**
* Callback function to receive the result of the getCustomer operation.
* @callback getCustomerCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {CustomersGetResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Get Customer
* Retrieves details of a given customer by customers id or source_id.
* @param {String} customerId A Voucherify customers id or source_id.
* @param {getCustomerCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link CustomersGetResponseBody}
* @returns {Promise<(CustomersGetResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CustomersGetResponseBody` object or with `undefined`.
*/
getCustomer(customerId: string, callback?: (error: Error | null, data?: CustomersGetResponseBody, response?: any) => any): Promise<(CustomersGetResponseBody | undefined)>;
/**
* Callback function to receive the result of the importCustomersUsingCsv operation.
* @callback importCustomersUsingCsvCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {CustomersImportCsvCreateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Import and Update Customers using CSV
* This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. # Request Example # CSV File Format The CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object. Standard customer fields mapping **No spaces allowed in field names** Id, Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2 # Update Customers using CSV If you would like to update customers data, you can do it using the CSV file with new data. However, remember to include a source_id in your CSV file to manage the update successfully. 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 {{
file?: File,
}} [opts] Optional parameters
* @param {importCustomersUsingCsvCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link CustomersImportCsvCreateResponseBody}
* @returns {Promise<(CustomersImportCsvCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CustomersImportCsvCreateResponseBody` object or with `undefined`.
*/
importCustomersUsingCsv(opts?: {
file?: File;
}, callback?: (error: Error | null, data?: CustomersImportCsvCreateResponseBody, response?: any) => any): Promise<(CustomersImportCsvCreateResponseBody | undefined)>;
/**
* Callback function to receive the result of the listCustomerActivity operation.
* @callback listCustomerActivityCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {CustomersActivityListResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* List Customer Activity
* Retrieves activity details of a given customer by customers id or source_id.
* @param {String} customerId A Voucherify customers id or source ID of the customer who performed the activities.
* @param {{
limit?: Number,
order?: Exclude,
startingAfterId?: String,
startDate?: Date,
endDate?: Date,
campaignId?: String,
campaignType?: Exclude,
category?: Exclude,
type?: Exclude,
}} [opts] Optional parameters
* @param {listCustomerActivityCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link CustomersActivityListResponseBody}
* @returns {Promise<(CustomersActivityListResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CustomersActivityListResponseBody` object or with `undefined`.
*/
listCustomerActivity(customerId: string, opts?: {
limit?: number;
order?: Exclude;
startingAfterId?: string;
startDate?: Date;
endDate?: Date;
campaignId?: string;
campaignType?: Exclude;
category?: Exclude;
type?: Exclude;
}, callback?: (error: Error | null, data?: CustomersActivityListResponseBody, response?: any) => any): Promise<(CustomersActivityListResponseBody | undefined)>;
/**
* Callback function to receive the result of the listCustomerRedeemables operation.
* @callback listCustomerRedeemablesCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {CustomersRedeemablesListResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* List Customer's Redeemables
* Retrieves all the redeemables that have been assigned to the customer. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read)
* @param {String} customerId Unique identifier of a customer represented by an internal customer ID or customer source ID.
* @param {{
limit?: Number,
order?: Exclude,
startingAfterId?: String,
filters?: ParameterFiltersListCustomerRedeemables,
}} [opts] Optional parameters
* @param {listCustomerRedeemablesCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link CustomersRedeemablesListResponseBody}
* @returns {Promise<(CustomersRedeemablesListResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CustomersRedeemablesListResponseBody` object or with `undefined`.
*/
listCustomerRedeemables(customerId: string, opts?: {
limit?: number;
order?: Exclude;
startingAfterId?: string;
filters?: ParameterFiltersListCustomerRedeemables;
}, callback?: (error: Error | null, data?: CustomersRedeemablesListResponseBody, response?: any) => any): Promise<(CustomersRedeemablesListResponseBody | undefined)>;
/**
* Callback function to receive the result of the listCustomerSegments operation.
* @callback listCustomerSegmentsCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {CustomersSegmentsListResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* List Customer's Segments
* Returns the list of segments IDs to which the customer belongs to. If you pass a customerId which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system.
* @param {String} customerId Unique identifier of a customer represented by an internal customer ID or customer source ID.
* @param {listCustomerSegmentsCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link CustomersSegmentsListResponseBody}
* @returns {Promise<(CustomersSegmentsListResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CustomersSegmentsListResponseBody` object or with `undefined`.
*/
listCustomerSegments(customerId: string, callback?: (error: Error | null, data?: CustomersSegmentsListResponseBody, response?: any) => any): Promise<(CustomersSegmentsListResponseBody | undefined)>;
/**
* Callback function to receive the result of the listCustomers operation.
* @callback listCustomersCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {CustomersListResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* List Customers
* Returns a list of customers.
* @param {{
limit?: Number,
page?: Number,
email?: String,
city?: String,
name?: String,
segmentId?: String,
createdAtBefore?: Date,
createdAtAfter?: Date,
updatedAtBefore?: Date,
updatedAtAfter?: Date,
order?: Exclude,
startingAfter?: Date,
filters?: Object.,
}} [opts] Optional parameters
* @param {listCustomersCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link CustomersListResponseBody}
* @returns {Promise<(CustomersListResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CustomersListResponseBody` object or with `undefined`.
*/
listCustomers(opts?: {
limit?: number;
page?: number;
email?: string;
city?: string;
name?: string;
segmentId?: string;
createdAtBefore?: Date;
createdAtAfter?: Date;
updatedAtBefore?: Date;
updatedAtAfter?: Date;
order?: Exclude;
startingAfter?: Date;
filters?: any;
}, callback?: (error: Error | null, data?: CustomersListResponseBody, response?: any) => any): Promise<(CustomersListResponseBody | undefined)>;
/**
* Callback function to receive the result of the updateCustomer operation.
* @callback updateCustomerCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {CustomersUpdateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Update Customer
* Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.
* @param {String} customerId A Voucherify customers id or source_id.
* @param {CustomersUpdateRequestBody} customersUpdateRequestBody Specify the parameters to be updated.
* @param {updateCustomerCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link CustomersUpdateResponseBody}
* @returns {Promise<(CustomersUpdateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CustomersUpdateResponseBody` object or with `undefined`.
*/
updateCustomer(customerId: string, customersUpdateRequestBody: CustomersUpdateRequestBody, callback?: (error: Error | null, data?: CustomersUpdateResponseBody, response?: any) => any): Promise<(CustomersUpdateResponseBody | undefined)>;
/**
* Callback function to receive the result of the updateCustomersInBulk operation.
* @callback updateCustomersInBulkCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {CustomersUpdateInBulkResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Update Customers in Bulk
* Updates customers in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the [GET Async Action](/api-reference/async-actions/get-async-action) endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is **upserted**. This is shown in the report file in the **GET** Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished.
* @param {Array.} customersUpdateInBulkRequestBody List the customer fields to be updated in each customer object.
* @param {updateCustomersInBulkCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link CustomersUpdateInBulkResponseBody}
* @returns {Promise<(CustomersUpdateInBulkResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CustomersUpdateInBulkResponseBody` object or with `undefined`.
*/
updateCustomersInBulk(customersUpdateInBulkRequestBody: Array, callback?: (error: Error | null, data?: CustomersUpdateInBulkResponseBody, response?: any) => any): Promise<(CustomersUpdateInBulkResponseBody | undefined)>;
/**
* Callback function to receive the result of the updateCustomersMetadataInBulk operation.
* @callback updateCustomersMetadataInBulkCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {CustomersMetadataUpdateInBulkResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Update Customers' Metadata in Bulk
* Updates metadata parameters for a list of customers. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the [GET Async Action](/api-reference/async-actions/get-async-action) endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is **upserted**. This is shown in the report file in the **GET** Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished.
* @param {CustomersMetadataUpdateInBulkRequestBody} customersMetadataUpdateInBulkRequestBody List the source_ids of the customers you would like to update with the metadata key/value pairs.
* @param {updateCustomersMetadataInBulkCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link CustomersMetadataUpdateInBulkResponseBody}
* @returns {Promise<(CustomersMetadataUpdateInBulkResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `CustomersMetadataUpdateInBulkResponseBody` object or with `undefined`.
*/
updateCustomersMetadataInBulk(customersMetadataUpdateInBulkRequestBody: CustomersMetadataUpdateInBulkRequestBody, callback?: (error: Error | null, data?: CustomersMetadataUpdateInBulkResponseBody, response?: any) => any): Promise<(CustomersMetadataUpdateInBulkResponseBody | undefined)>;
}
import CustomersCreateRequestBody from '../model/CustomersCreateRequestBody';
import CustomersCreateResponseBody from '../model/CustomersCreateResponseBody';
import CustomersPermanentDeletionCreateResponseBody from '../model/CustomersPermanentDeletionCreateResponseBody';
import CustomersGetResponseBody from '../model/CustomersGetResponseBody';
import CustomersImportCsvCreateResponseBody from '../model/CustomersImportCsvCreateResponseBody';
import ParameterOrderCreatedAt from '../model/ParameterOrderCreatedAt';
import ParameterCampaignType from '../model/ParameterCampaignType';
import ParameterActivityCategory from '../model/ParameterActivityCategory';
import ParameterCustomerEvent from '../model/ParameterCustomerEvent';
import CustomersActivityListResponseBody from '../model/CustomersActivityListResponseBody';
import ParameterOrderListRedeemables from '../model/ParameterOrderListRedeemables';
import ParameterFiltersListCustomerRedeemables from '../model/ParameterFiltersListCustomerRedeemables';
import CustomersRedeemablesListResponseBody from '../model/CustomersRedeemablesListResponseBody';
import CustomersSegmentsListResponseBody from '../model/CustomersSegmentsListResponseBody';
import ParameterOrderListCustomers from '../model/ParameterOrderListCustomers';
import CustomersListResponseBody from '../model/CustomersListResponseBody';
import CustomersUpdateRequestBody from '../model/CustomersUpdateRequestBody';
import CustomersUpdateResponseBody from '../model/CustomersUpdateResponseBody';
import CustomersUpdateInBulkRequestBody from '../model/CustomersUpdateInBulkRequestBody';
import CustomersUpdateInBulkResponseBody from '../model/CustomersUpdateInBulkResponseBody';
import CustomersMetadataUpdateInBulkRequestBody from '../model/CustomersMetadataUpdateInBulkRequestBody';
import CustomersMetadataUpdateInBulkResponseBody from '../model/CustomersMetadataUpdateInBulkResponseBody';