Source: api/CustomersApi.js

/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
/* Copyright (c) 2020 Mobify Research & Development Inc. All rights reserved. */
/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

/**
 * Shop API
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: 20.4
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 *
 */


import ApiClient from '../ApiClient'
import BasketsResult from '../models/BasketsResult'
import Customer from '../models/Customer'
import CustomerAddress from '../models/CustomerAddress'
import CustomerAddressResult from '../models/CustomerAddressResult'
import CustomerOrderResult from '../models/CustomerOrderResult'
import CustomerPaymentInstrument from '../models/CustomerPaymentInstrument'
import CustomerPaymentInstrumentResult from '../models/CustomerPaymentInstrumentResult'
import CustomerProductList from '../models/CustomerProductList'
import CustomerProductListItem from '../models/CustomerProductListItem'
import CustomerProductListItemPurchase from '../models/CustomerProductListItemPurchase'
import CustomerProductListItemPurchaseResult from '../models/CustomerProductListItemPurchaseResult'
import CustomerProductListItemResult from '../models/CustomerProductListItemResult'
import CustomerProductListResult from '../models/CustomerProductListResult'
import ResetPasswordTokenResult from '../models/ResetPasswordTokenResult'

/**
* Customers service.
* @module api/CustomersApi
* @version 20.4
*/
export default class CustomersApi {

    /**
    * Constructs a new CustomersApi.
    * @alias module:api/CustomersApi
    * @class
    * @param {module:ApiClient} apiClient Optional API client implementation to use,
    * default to {@link module:ApiClient#instance} if unspecified.
    */
    constructor(apiClient) {
        this.apiClient = apiClient || ApiClient.instance
    }



    /**
     * Invalidates the JWT provided in the header.
     * @param {Object} opts Optional parameters
     * @param {String} opts.authorization the JWT
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    deleteCustomersAuthWithHttpInfo(opts) {
        opts = opts || {}
        const postBody = null


        const pathParams = {
        }
        const queryParams = {
        }
        const headerParams = {
            Authorization: opts.authorization
        }
        const formParams = {
        }

        const authNames = ['customers_auth']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = null

        return this.apiClient.callApi(
            '/customers/auth', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Invalidates the JWT provided in the header.
     * @param {Object} opts Optional parameters
     * @param {String} opts.authorization the JWT
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteCustomersAuth(opts) {
        return this.deleteCustomersAuthWithHttpInfo(opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Deletes a customer's address by address name.
     * @param {String} customerId the id of the customer to delete the address for
     * @param {String} addressName the name of the address to delete
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    deleteCustomersByIDAddressesByIDWithHttpInfo(customerId, addressName) {
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling deleteCustomersByIDAddressesByID')
        }

        // verify the required parameter 'addressName' is set
        if (addressName === undefined || addressName === null) {
            throw new Error('Missing the required parameter \'addressName\' when calling deleteCustomersByIDAddressesByID')
        }


        const pathParams = {
            customer_id: customerId,
            address_name: addressName
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = null

        return this.apiClient.callApi(
            '/customers/{customer_id}/addresses/{address_name}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Deletes a customer's address by address name.
     * @param {String} customerId the id of the customer to delete the address for
     * @param {String} addressName the name of the address to delete
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteCustomersByIDAddressesByID(customerId, addressName) {
        return this.deleteCustomersByIDAddressesByIDWithHttpInfo(customerId, addressName)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Deletes a customer's payment instrument.
     * @param {String} customerId the id of the customer to delete the payment instrument for
     * @param {String} paymentInstrumentId the id of the payment instrument to be deleted
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    deleteCustomersByIDPaymentInstrumentsByIDWithHttpInfo(customerId, paymentInstrumentId) {
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling deleteCustomersByIDPaymentInstrumentsByID')
        }

        // verify the required parameter 'paymentInstrumentId' is set
        if (paymentInstrumentId === undefined || paymentInstrumentId === null) {
            throw new Error('Missing the required parameter \'paymentInstrumentId\' when calling deleteCustomersByIDPaymentInstrumentsByID')
        }


        const pathParams = {
            customer_id: customerId,
            payment_instrument_id: paymentInstrumentId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = null

        return this.apiClient.callApi(
            '/customers/{customer_id}/payment_instruments/{payment_instrument_id}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Deletes a customer's payment instrument.
     * @param {String} customerId the id of the customer to delete the payment instrument for
     * @param {String} paymentInstrumentId the id of the payment instrument to be deleted
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteCustomersByIDPaymentInstrumentsByID(customerId, paymentInstrumentId) {
        return this.deleteCustomersByIDPaymentInstrumentsByIDWithHttpInfo(customerId, paymentInstrumentId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Deletes a customer product list.
     * @param {String} customerId The customer id.
     * @param {String} listId The product list id.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    deleteCustomersByIDProductListsByIDWithHttpInfo(customerId, listId) {
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling deleteCustomersByIDProductListsByID')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling deleteCustomersByIDProductListsByID')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = null

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Deletes a customer product list.
     * @param {String} customerId The customer id.
     * @param {String} listId The product list id.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteCustomersByIDProductListsByID(customerId, listId) {
        return this.deleteCustomersByIDProductListsByIDWithHttpInfo(customerId, listId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Removes an item from a customer product list.
     * @param {String} customerId The id of the owner of the product list
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to delete.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    deleteCustomersByIDProductListsByIDItemsByIDWithHttpInfo(customerId, listId, itemId) {
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling deleteCustomersByIDProductListsByIDItemsByID')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling deleteCustomersByIDProductListsByIDItemsByID')
        }

        // verify the required parameter 'itemId' is set
        if (itemId === undefined || itemId === null) {
            throw new Error('Missing the required parameter \'itemId\' when calling deleteCustomersByIDProductListsByIDItemsByID')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId,
            item_id: itemId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = null

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}/items/{item_id}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Removes an item from a customer product list.
     * @param {String} customerId The id of the owner of the product list
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to delete.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteCustomersByIDProductListsByIDItemsByID(customerId, listId, itemId) {
        return this.deleteCustomersByIDProductListsByIDItemsByIDWithHttpInfo(customerId, listId, itemId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Gets a customer.
     * @param {String} customerId The customer id
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.expand
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Customer} and HTTP response
     */
    getCustomersByIDWithHttpInfo(customerId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByID')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
            expand: this.apiClient.buildCollectionParam(opts.expand, 'csv')
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = Customer

        return this.apiClient.callApi(
            '/customers/{customer_id}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Gets a customer.
     * @param {String} customerId The customer id
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.expand
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Customer}
     */
    getCustomersByID(customerId, opts) {
        return this.getCustomersByIDWithHttpInfo(customerId, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Returns a sorted pageable list of all customer addresses in the address book. The default page size is 10  customer addresses. The addresses are sorted so that the preferred address is always sorted first. The remaining  addresses are sorted alphabetically by ID.    When the customer cannot be found CustomerNotFoundException  is thrown in a case of an agent but an empty result list is returned in a case of JWT.
     * @param {String} customerId The customer uuid
     * @param {Object} opts Optional parameters
     * @param {Number} opts.start
     * @param {Number} opts.count
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerAddressResult} and HTTP response
     */
    getCustomersByIDAddressesWithHttpInfo(customerId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDAddresses')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
            start: opts.start,
            count: opts.count
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerAddressResult

        return this.apiClient.callApi(
            '/customers/{customer_id}/addresses', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Returns a sorted pageable list of all customer addresses in the address book. The default page size is 10  customer addresses. The addresses are sorted so that the preferred address is always sorted first. The remaining  addresses are sorted alphabetically by ID.    When the customer cannot be found CustomerNotFoundException  is thrown in a case of an agent but an empty result list is returned in a case of JWT.
     * @param {String} customerId The customer uuid
     * @param {Object} opts Optional parameters
     * @param {Number} opts.start
     * @param {Number} opts.count
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerAddressResult}
     */
    getCustomersByIDAddresses(customerId, opts) {
        return this.getCustomersByIDAddressesWithHttpInfo(customerId, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Retrieves a customer&#39;s address by address name.
     * @param {String} customerId the id of the customer to retrieve the address for
     * @param {String} addressName the name of the address to retrieve
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerAddress} and HTTP response
     */
    getCustomersByIDAddressesByIDWithHttpInfo(customerId, addressName) {
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDAddressesByID')
        }

        // verify the required parameter 'addressName' is set
        if (addressName === undefined || addressName === null) {
            throw new Error('Missing the required parameter \'addressName\' when calling getCustomersByIDAddressesByID')
        }


        const pathParams = {
            customer_id: customerId,
            address_name: addressName
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerAddress

        return this.apiClient.callApi(
            '/customers/{customer_id}/addresses/{address_name}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Retrieves a customer&#39;s address by address name.
     * @param {String} customerId the id of the customer to retrieve the address for
     * @param {String} addressName the name of the address to retrieve
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerAddress}
     */
    getCustomersByIDAddressesByID(customerId, addressName) {
        return this.getCustomersByIDAddressesByIDWithHttpInfo(customerId, addressName)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Gets the baskets of a customer.
     * @param {String} customerId the id of the customer to retrieve the baskets for
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/BasketsResult} and HTTP response
     */
    getCustomersByIDBasketsWithHttpInfo(customerId) {
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDBaskets')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = BasketsResult

        return this.apiClient.callApi(
            '/customers/{customer_id}/baskets', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Gets the baskets of a customer.
     * @param {String} customerId the id of the customer to retrieve the baskets for
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/BasketsResult}
     */
    getCustomersByIDBaskets(customerId) {
        return this.getCustomersByIDBasketsWithHttpInfo(customerId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Returns a pageable list of all customer&#39;s orders. The default page size is 10.
     * @param {String} customerId the customer uuid
     * @param {Object} opts Optional parameters
     * @param {Number} opts.start
     * @param {Number} opts.count
     * @param {Boolean} opts.crossSites
     * @param {String} opts.from
     * @param {String} opts.until
     * @param {String} opts.status
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerOrderResult} and HTTP response
     */
    getCustomersByIDOrdersWithHttpInfo(customerId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDOrders')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
            start: opts.start,
            count: opts.count,
            'cross-sites': opts.crossSites,
            from: opts.from,
            until: opts.until,
            status: opts.status
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerOrderResult

        return this.apiClient.callApi(
            '/customers/{customer_id}/orders', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Returns a pageable list of all customer&#39;s orders. The default page size is 10.
     * @param {String} customerId the customer uuid
     * @param {Object} opts Optional parameters
     * @param {Number} opts.start
     * @param {Number} opts.count
     * @param {Boolean} opts.crossSites
     * @param {String} opts.from
     * @param {String} opts.until
     * @param {String} opts.status
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerOrderResult}
     */
    getCustomersByIDOrders(customerId, opts) {
        return this.getCustomersByIDOrdersWithHttpInfo(customerId, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Gets customer payment instruments for an customer.  Can be limited to a specific payment  method by providing query parameter payment_method_id.    When the customer cannot be found CustomerNotFoundException  is thrown in a case of an agent but an empty result list is returned in a case of JWT.
     * @param {String} customerId the id of the customer to retrieve the payment instruments for
     * @param {Object} opts Optional parameters
     * @param {String} opts.paymentMethodId
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerPaymentInstrumentResult} and HTTP response
     */
    getCustomersByIDPaymentInstrumentsWithHttpInfo(customerId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDPaymentInstruments')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
            payment_method_id: opts.paymentMethodId
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerPaymentInstrumentResult

        return this.apiClient.callApi(
            '/customers/{customer_id}/payment_instruments', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Gets customer payment instruments for an customer.  Can be limited to a specific payment  method by providing query parameter payment_method_id.    When the customer cannot be found CustomerNotFoundException  is thrown in a case of an agent but an empty result list is returned in a case of JWT.
     * @param {String} customerId the id of the customer to retrieve the payment instruments for
     * @param {Object} opts Optional parameters
     * @param {String} opts.paymentMethodId
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerPaymentInstrumentResult}
     */
    getCustomersByIDPaymentInstruments(customerId, opts) {
        return this.getCustomersByIDPaymentInstrumentsWithHttpInfo(customerId, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Retrieves a customer&#39;s payment instrument by its id.
     * @param {String} customerId the id of the customer to retrieve the payment instrument for
     * @param {String} paymentInstrumentId the id of the payment instrument to be retrievedCustomer
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerPaymentInstrument} and HTTP response
     */
    getCustomersByIDPaymentInstrumentsByIDWithHttpInfo(customerId, paymentInstrumentId) {
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDPaymentInstrumentsByID')
        }

        // verify the required parameter 'paymentInstrumentId' is set
        if (paymentInstrumentId === undefined || paymentInstrumentId === null) {
            throw new Error('Missing the required parameter \'paymentInstrumentId\' when calling getCustomersByIDPaymentInstrumentsByID')
        }


        const pathParams = {
            customer_id: customerId,
            payment_instrument_id: paymentInstrumentId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerPaymentInstrument

        return this.apiClient.callApi(
            '/customers/{customer_id}/payment_instruments/{payment_instrument_id}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Retrieves a customer&#39;s payment instrument by its id.
     * @param {String} customerId the id of the customer to retrieve the payment instrument for
     * @param {String} paymentInstrumentId the id of the payment instrument to be retrievedCustomer
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerPaymentInstrument}
     */
    getCustomersByIDPaymentInstrumentsByID(customerId, paymentInstrumentId) {
        return this.getCustomersByIDPaymentInstrumentsByIDWithHttpInfo(customerId, paymentInstrumentId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Returns all customer product lists.
     * @param {String} customerId The customer id.
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.expand
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductListResult} and HTTP response
     */
    getCustomersByIDProductListsWithHttpInfo(customerId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDProductLists')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
            expand: this.apiClient.buildCollectionParam(opts.expand, 'csv')
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductListResult

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Returns all customer product lists.
     * @param {String} customerId The customer id.
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.expand
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductListResult}
     */
    getCustomersByIDProductLists(customerId, opts) {
        return this.getCustomersByIDProductListsWithHttpInfo(customerId, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Returns a customer product list of the given customer.
     * @param {String} customerId The customer id.
     * @param {String} listId The product list id.
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.expand
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductList} and HTTP response
     */
    getCustomersByIDProductListsByIDWithHttpInfo(customerId, listId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDProductListsByID')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling getCustomersByIDProductListsByID')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId
        }
        const queryParams = {
            expand: this.apiClient.buildCollectionParam(opts.expand, 'csv')
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductList

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Returns a customer product list of the given customer.
     * @param {String} customerId The customer id.
     * @param {String} listId The product list id.
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.expand
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductList}
     */
    getCustomersByIDProductListsByID(customerId, listId, opts) {
        return this.getCustomersByIDProductListsByIDWithHttpInfo(customerId, listId, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Returns a pageable list of all items of a customer&#39;s product list. The default page size is 10.
     * @param {String} customerId The id of the customer to retrieve the product list items for.
     * @param {String} listId The id of the product list.
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.expand
     * @param {Number} opts.start
     * @param {Number} opts.count
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductListItemResult} and HTTP response
     */
    getCustomersByIDProductListsByIDItemsWithHttpInfo(customerId, listId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDProductListsByIDItems')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling getCustomersByIDProductListsByIDItems')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId
        }
        const queryParams = {
            expand: this.apiClient.buildCollectionParam(opts.expand, 'csv'),
            start: opts.start,
            count: opts.count
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductListItemResult

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}/items', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Returns a pageable list of all items of a customer&#39;s product list. The default page size is 10.
     * @param {String} customerId The id of the customer to retrieve the product list items for.
     * @param {String} listId The id of the product list.
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.expand
     * @param {Number} opts.start
     * @param {Number} opts.count
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductListItemResult}
     */
    getCustomersByIDProductListsByIDItems(customerId, listId, opts) {
        return this.getCustomersByIDProductListsByIDItemsWithHttpInfo(customerId, listId, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Returns an item of a customer product list.
     * @param {String} customerId The id of the customer to retrieve the product list items for.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to retrieve.
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.expand
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductListItem} and HTTP response
     */
    getCustomersByIDProductListsByIDItemsByIDWithHttpInfo(customerId, listId, itemId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDProductListsByIDItemsByID')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling getCustomersByIDProductListsByIDItemsByID')
        }

        // verify the required parameter 'itemId' is set
        if (itemId === undefined || itemId === null) {
            throw new Error('Missing the required parameter \'itemId\' when calling getCustomersByIDProductListsByIDItemsByID')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId,
            item_id: itemId
        }
        const queryParams = {
            expand: this.apiClient.buildCollectionParam(opts.expand, 'csv')
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductListItem

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}/items/{item_id}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Returns an item of a customer product list.
     * @param {String} customerId The id of the customer to retrieve the product list items for.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to retrieve.
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.expand
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductListItem}
     */
    getCustomersByIDProductListsByIDItemsByID(customerId, listId, itemId, opts) {
        return this.getCustomersByIDProductListsByIDItemsByIDWithHttpInfo(customerId, listId, itemId, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Returns a list of all purchases of an item from a customer&#39;s product list.
     * @param {String} customerId The id of the customer to retrieve the product list item purchases for.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to retrieve from.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductListItemPurchaseResult} and HTTP response
     */
    getCustomersByIDProductListsByIDItemsByIDPurchasesWithHttpInfo(customerId, listId, itemId) {
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDProductListsByIDItemsByIDPurchases')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling getCustomersByIDProductListsByIDItemsByIDPurchases')
        }

        // verify the required parameter 'itemId' is set
        if (itemId === undefined || itemId === null) {
            throw new Error('Missing the required parameter \'itemId\' when calling getCustomersByIDProductListsByIDItemsByIDPurchases')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId,
            item_id: itemId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductListItemPurchaseResult

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}/items/{item_id}/purchases', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Returns a list of all purchases of an item from a customer&#39;s product list.
     * @param {String} customerId The id of the customer to retrieve the product list item purchases for.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to retrieve from.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductListItemPurchaseResult}
     */
    getCustomersByIDProductListsByIDItemsByIDPurchases(customerId, listId, itemId) {
        return this.getCustomersByIDProductListsByIDItemsByIDPurchasesWithHttpInfo(customerId, listId, itemId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Returns a purchase of an item from a customer&#39;s product list.
     * @param {String} customerId The id of the customer to retrieve the product list items for.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to retrieve.
     * @param {String} purchaseId The id of the product list item purchase to retrieve.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductListItemPurchase} and HTTP response
     */
    getCustomersByIDProductListsByIDItemsByIDPurchasesByIDWithHttpInfo(customerId, listId, itemId, purchaseId) {
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling getCustomersByIDProductListsByIDItemsByIDPurchasesByID')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling getCustomersByIDProductListsByIDItemsByIDPurchasesByID')
        }

        // verify the required parameter 'itemId' is set
        if (itemId === undefined || itemId === null) {
            throw new Error('Missing the required parameter \'itemId\' when calling getCustomersByIDProductListsByIDItemsByIDPurchasesByID')
        }

        // verify the required parameter 'purchaseId' is set
        if (purchaseId === undefined || purchaseId === null) {
            throw new Error('Missing the required parameter \'purchaseId\' when calling getCustomersByIDProductListsByIDItemsByIDPurchasesByID')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId,
            item_id: itemId,
            purchase_id: purchaseId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductListItemPurchase

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}/items/{item_id}/purchases/{purchase_id}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Returns a purchase of an item from a customer&#39;s product list.
     * @param {String} customerId The id of the customer to retrieve the product list items for.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to retrieve.
     * @param {String} purchaseId The id of the product list item purchase to retrieve.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductListItemPurchase}
     */
    getCustomersByIDProductListsByIDItemsByIDPurchasesByID(customerId, listId, itemId, purchaseId) {
        return this.getCustomersByIDProductListsByIDItemsByIDPurchasesByIDWithHttpInfo(customerId, listId, itemId, purchaseId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Updates a customer.
     * @param {String} customerId the customer id
     * @param {module:models/Customer} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Customer} and HTTP response
     */
    patchCustomersByIDWithHttpInfo(customerId, body) {
        const postBody = body

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling patchCustomersByID')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling patchCustomersByID')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = Customer

        return this.apiClient.callApi(
            '/customers/{customer_id}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Updates a customer.
     * @param {String} customerId the customer id
     * @param {module:models/Customer} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Customer}
     */
    patchCustomersByID(customerId, body) {
        return this.patchCustomersByIDWithHttpInfo(customerId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Updates a customer&#39;s address by address name.
     * @param {String} customerId the id of the customer to update the address for
     * @param {String} addressName the name of the address to update
     * @param {module:models/CustomerAddress} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerAddress} and HTTP response
     */
    patchCustomersByIDAddressesByIDWithHttpInfo(customerId, addressName, body) {
        const postBody = body

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling patchCustomersByIDAddressesByID')
        }

        // verify the required parameter 'addressName' is set
        if (addressName === undefined || addressName === null) {
            throw new Error('Missing the required parameter \'addressName\' when calling patchCustomersByIDAddressesByID')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling patchCustomersByIDAddressesByID')
        }


        const pathParams = {
            customer_id: customerId,
            address_name: addressName
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerAddress

        return this.apiClient.callApi(
            '/customers/{customer_id}/addresses/{address_name}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Updates a customer&#39;s address by address name.
     * @param {String} customerId the id of the customer to update the address for
     * @param {String} addressName the name of the address to update
     * @param {module:models/CustomerAddress} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerAddress}
     */
    patchCustomersByIDAddressesByID(customerId, addressName, body) {
        return this.patchCustomersByIDAddressesByIDWithHttpInfo(customerId, addressName, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Changes a product list. Changeable properties are the name, description and if the list is public.
     * @param {module:models/CustomerProductList} body
     * @param {String} customerId The customer id.
     * @param {String} listId The product list id.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductList} and HTTP response
     */
    patchCustomersByIDProductListsByIDWithHttpInfo(body, customerId, listId) {
        const postBody = body

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling patchCustomersByIDProductListsByID')
        }

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling patchCustomersByIDProductListsByID')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling patchCustomersByIDProductListsByID')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductList

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Changes a product list. Changeable properties are the name, description and if the list is public.
     * @param {module:models/CustomerProductList} body
     * @param {String} customerId The customer id.
     * @param {String} listId The product list id.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductList}
     */
    patchCustomersByIDProductListsByID(body, customerId, listId) {
        return this.patchCustomersByIDProductListsByIDWithHttpInfo(body, customerId, listId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Updates an item of a customer&#39;s product list.  Considered values from the request body are:    priority: This is the priority of the customer&#39;s product list item.  public: This is the flag whether the customer&#39;s product list item is public.  quantity: used for product item type only. This is the quantity of  the customer&#39;s product list item.  custom properties in the form c_&lt;CUSTOM_NAME&gt;: the custom property  must correspond to a custom attribute (&lt;CUSTOM_NAME&gt;) defined for ProductListItem.  The value of this property must be valid for the type of custom attribute defined for ProductListItem.
     * @param {String} customerId The id of the owner of the product list.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to update.
     * @param {module:models/CustomerProductListItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductListItem} and HTTP response
     */
    patchCustomersByIDProductListsByIDItemsByIDWithHttpInfo(customerId, listId, itemId, body) {
        const postBody = body

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling patchCustomersByIDProductListsByIDItemsByID')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling patchCustomersByIDProductListsByIDItemsByID')
        }

        // verify the required parameter 'itemId' is set
        if (itemId === undefined || itemId === null) {
            throw new Error('Missing the required parameter \'itemId\' when calling patchCustomersByIDProductListsByIDItemsByID')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling patchCustomersByIDProductListsByIDItemsByID')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId,
            item_id: itemId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductListItem

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}/items/{item_id}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Updates an item of a customer&#39;s product list.  Considered values from the request body are:    priority: This is the priority of the customer&#39;s product list item.  public: This is the flag whether the customer&#39;s product list item is public.  quantity: used for product item type only. This is the quantity of  the customer&#39;s product list item.  custom properties in the form c_&lt;CUSTOM_NAME&gt;: the custom property  must correspond to a custom attribute (&lt;CUSTOM_NAME&gt;) defined for ProductListItem.  The value of this property must be valid for the type of custom attribute defined for ProductListItem.
     * @param {String} customerId The id of the owner of the product list.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to update.
     * @param {module:models/CustomerProductListItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductListItem}
     */
    patchCustomersByIDProductListsByIDItemsByID(customerId, listId, itemId, body) {
        return this.patchCustomersByIDProductListsByIDItemsByIDWithHttpInfo(customerId, listId, itemId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Updates a purchase of an item from a customer&#39;s product list.  Considered values from the request body are:    custom properties in the form c_&lt;CUSTOM_NAME&gt;: the custom property  must correspond to a custom attribute (&lt;CUSTOM_NAME&gt;) defined for ProductListItemPurchase.  The value of this property must be valid for the type of custom attribute defined for ProductListItemPurchase.
     * @param {String} customerId The id of the customer to retrieve the product list item purchases for.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to retrieve.
     * @param {String} purchaseId The id of the product list item purchase to retrieve.
     * @param {module:models/CustomerProductListItemPurchase} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductListItemPurchase} and HTTP response
     */
    patchCustomersByIDProductListsByIDItemsByIDPurchasesByIDWithHttpInfo(customerId, listId, itemId, purchaseId, body) {
        const postBody = body

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling patchCustomersByIDProductListsByIDItemsByIDPurchasesByID')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling patchCustomersByIDProductListsByIDItemsByIDPurchasesByID')
        }

        // verify the required parameter 'itemId' is set
        if (itemId === undefined || itemId === null) {
            throw new Error('Missing the required parameter \'itemId\' when calling patchCustomersByIDProductListsByIDItemsByIDPurchasesByID')
        }

        // verify the required parameter 'purchaseId' is set
        if (purchaseId === undefined || purchaseId === null) {
            throw new Error('Missing the required parameter \'purchaseId\' when calling patchCustomersByIDProductListsByIDItemsByIDPurchasesByID')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling patchCustomersByIDProductListsByIDItemsByIDPurchasesByID')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId,
            item_id: itemId,
            purchase_id: purchaseId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductListItemPurchase

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}/items/{item_id}/purchases/{purchase_id}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Updates a purchase of an item from a customer&#39;s product list.  Considered values from the request body are:    custom properties in the form c_&lt;CUSTOM_NAME&gt;: the custom property  must correspond to a custom attribute (&lt;CUSTOM_NAME&gt;) defined for ProductListItemPurchase.  The value of this property must be valid for the type of custom attribute defined for ProductListItemPurchase.
     * @param {String} customerId The id of the customer to retrieve the product list item purchases for.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item to retrieve.
     * @param {String} purchaseId The id of the product list item purchase to retrieve.
     * @param {module:models/CustomerProductListItemPurchase} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductListItemPurchase}
     */
    patchCustomersByIDProductListsByIDItemsByIDPurchasesByID(customerId, listId, itemId, purchaseId, body) {
        return this.patchCustomersByIDProductListsByIDItemsByIDPurchasesByIDWithHttpInfo(customerId, listId, itemId, purchaseId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Registers a customer.  The mandatory data are the credentials and profile last name and email.  When using OAuth the password in the request must not be set, otherwise an InvalidPasswordException will be thrown.  When using JWT the password is required.
     * @param {module:models/CustomerRegistration} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Customer} and HTTP response
     */
    postCustomersWithHttpInfo(body) {
        const postBody = body

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCustomers')
        }


        const pathParams = {
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = Customer

        return this.apiClient.callApi(
            '/customers', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Registers a customer.  The mandatory data are the credentials and profile last name and email.  When using OAuth the password in the request must not be set, otherwise an InvalidPasswordException will be thrown.  When using JWT the password is required.
     * @param {module:models/CustomerRegistration} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Customer}
     */
    postCustomers(body) {
        return this.postCustomersWithHttpInfo(body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Obtains a new JWT (JSON Web Token) for a guest or registered  customer. Tokens are returned as a HTTP Authorization:Bearer response  header entry. These kinds of request are supported, as specified by the  type:    Type guest - creates a new guest (non-authenticated) customer  and returns a token for the customer.  Type credentials - authenticates credentials passed in the  HTTP Authorization:Basic request header, returning a token for a  successfully authenticated customer, otherwise it throws an  AuthenticationFailedException.  Type session - authenticates the customer (anonymous or registered)  based on the dwsid and dwsecuretoken cookies. It returns a token for a  successfully authenticated customer, otherwise it throws an  AuthenticationFailedException.  Type refresh - examines the token passed in the HTTP  Authorization:Bearer request header and when valid returns a new token  with an updated expiry time.     For a request of type credentials:    Updates profile attributes for the customer (for example,  \&quot;last-visited\&quot;).  Handles the maximum number of failed login attempts.    For a request of type session:    The session and corresponding dwsecuretoken must be active and valid. An expired session can&#39;t be  used. The dwsecuretoken cookie must have been used for at least one  previous HTTPS request with the same dwsid cookie.  Does not touch profile attributes for the registered customer (for example,  \&quot;last-visited\&quot;), since this is not a real login.  Returns different tokens for multiple requests with the same session id. Means, there should be  only one call per session.      About JWT The token contains 3 sections:    the header section (specifies token type and algorithm used)  the payload section (contains customer information, client id,  issue and expiration time)  finally the signature section records the token signature.    A token is created and returned to the client whenever a registered  customer logs in (type \&quot;credentials\&quot;) or a guest customer requests it (type  \&quot;guest\&quot;). The token is returned in the response header as   Authorization: Bearer --token--    The client has to include the token in the request header as   Authorization: Bearer --token--   in any follow up request. The server declines any follow up requests  without a token or which cannot be verified based on the token signature  or expiration time. A token nearing its expiration time should be  exchanged for a new one (type \&quot;refresh\&quot;).    See \&quot;API Usage &gt; JWT\&quot; for more details on using JWT as an authentication  mechanism.
     * @param {module:models/AuthRequest} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.authorization              Authorization:Basic for type credentials             Authorization:Bearer for type refresh
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Customer} and HTTP response
     */
    postCustomersAuthWithHttpInfo(body, opts) {
        opts = opts || {}
        const postBody = body

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCustomersAuth')
        }


        const pathParams = {
        }
        const queryParams = {
        }
        const headerParams = {
            Authorization: opts.authorization
        }
        const formParams = {
        }

        const authNames = ['client_id']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = Customer

        return this.apiClient.callApi(
            '/customers/auth', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        ).then((response) => {
            this.apiClient.defaultHeaders.authorization = response.response.header.authorization
            return response
        })
    }

    /**
     * Obtains a new JWT (JSON Web Token) for a guest or registered  customer. Tokens are returned as a HTTP Authorization:Bearer response  header entry. These kinds of request are supported, as specified by the  type:    Type guest - creates a new guest (non-authenticated) customer  and returns a token for the customer.  Type credentials - authenticates credentials passed in the  HTTP Authorization:Basic request header, returning a token for a  successfully authenticated customer, otherwise it throws an  AuthenticationFailedException.  Type session - authenticates the customer (anonymous or registered)  based on the dwsid and dwsecuretoken cookies. It returns a token for a  successfully authenticated customer, otherwise it throws an  AuthenticationFailedException.  Type refresh - examines the token passed in the HTTP  Authorization:Bearer request header and when valid returns a new token  with an updated expiry time.     For a request of type credentials:    Updates profile attributes for the customer (for example,  \&quot;last-visited\&quot;).  Handles the maximum number of failed login attempts.    For a request of type session:    The session and corresponding dwsecuretoken must be active and valid. An expired session can&#39;t be  used. The dwsecuretoken cookie must have been used for at least one  previous HTTPS request with the same dwsid cookie.  Does not touch profile attributes for the registered customer (for example,  \&quot;last-visited\&quot;), since this is not a real login.  Returns different tokens for multiple requests with the same session id. Means, there should be  only one call per session.      About JWT The token contains 3 sections:    the header section (specifies token type and algorithm used)  the payload section (contains customer information, client id,  issue and expiration time)  finally the signature section records the token signature.    A token is created and returned to the client whenever a registered  customer logs in (type \&quot;credentials\&quot;) or a guest customer requests it (type  \&quot;guest\&quot;). The token is returned in the response header as   Authorization: Bearer --token--    The client has to include the token in the request header as   Authorization: Bearer --token--   in any follow up request. The server declines any follow up requests  without a token or which cannot be verified based on the token signature  or expiration time. A token nearing its expiration time should be  exchanged for a new one (type \&quot;refresh\&quot;).    See \&quot;API Usage &gt; JWT\&quot; for more details on using JWT as an authentication  mechanism.
     * @param {module:models/AuthRequest} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.authorization              Authorization:Basic for type credentials             Authorization:Bearer for type refresh
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Customer}
     */
    postCustomersAuth(body, opts) {
        return this.postCustomersAuthWithHttpInfo(body, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Obtain the JWTs for registered customers whose credentials are stored using a third party system.              Accepts login_id and client_id      Returns a customer object in the response body, and the JWT generated against the client_id in the response header.
     * @param {module:models/TrustedSystemAuthRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Customer} and HTTP response
     */
    postCustomersAuthTrustedsystemWithHttpInfo(body) {
        const postBody = body

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCustomersAuthTrustedsystem')
        }


        const pathParams = {
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = Customer

        return this.apiClient.callApi(
            '/customers/auth/trustedsystem', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Obtain the JWTs for registered customers whose credentials are stored using a third party system.              Accepts login_id and client_id      Returns a customer object in the response body, and the JWT generated against the client_id in the response header.
     * @param {module:models/TrustedSystemAuthRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Customer}
     */
    postCustomersAuthTrustedsystem(body) {
        return this.postCustomersAuthTrustedsystemWithHttpInfo(body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Creates a new address with the given name for the given customer.
     * @param {String} customerId the id of the customer to create the address for
     * @param {module:models/CustomerAddress} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerAddress} and HTTP response
     */
    postCustomersByIDAddressesWithHttpInfo(customerId, body) {
        const postBody = body

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling postCustomersByIDAddresses')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCustomersByIDAddresses')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerAddress

        return this.apiClient.callApi(
            '/customers/{customer_id}/addresses', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Creates a new address with the given name for the given customer.
     * @param {String} customerId the id of the customer to create the address for
     * @param {module:models/CustomerAddress} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerAddress}
     */
    postCustomersByIDAddresses(customerId, body) {
        return this.postCustomersByIDAddressesWithHttpInfo(customerId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     *   Obtains a new agent on behalf token for a registered customer. Token is returned as a HTTP Authorization:Bearer  response header entry.      A token is created and returned to the client whenever an agent with Create_Order_On_Behalf_Of  permission calls the resource for a registered customer.      The token is returned in the response header as Authorization: Bearer --token--.      The client has to include the token in the request header as Authorization: Bearer --token--    in any follow up request, the agent will do on behalf of the customer.    About the order on behalf token      The token contains 3 sections:      the header section (specifies token type and algorithm used)  the payload section (contains customer information, client id, issue and expiration time)  finally the signature section records the token signature.      A token nearing its expiration time should be exchanged for a new one by calling this resource once more.
     * @param {String} customerId specifies the customer to act on behalf of
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Customer} and HTTP response
     */
    postCustomersByIDAuthWithHttpInfo(customerId) {
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling postCustomersByIDAuth')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = Customer

        return this.apiClient.callApi(
            '/customers/{customer_id}/auth', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     *   Obtains a new agent on behalf token for a registered customer. Token is returned as a HTTP Authorization:Bearer  response header entry.      A token is created and returned to the client whenever an agent with Create_Order_On_Behalf_Of  permission calls the resource for a registered customer.      The token is returned in the response header as Authorization: Bearer --token--.      The client has to include the token in the request header as Authorization: Bearer --token--    in any follow up request, the agent will do on behalf of the customer.    About the order on behalf token      The token contains 3 sections:      the header section (specifies token type and algorithm used)  the payload section (contains customer information, client id, issue and expiration time)  finally the signature section records the token signature.      A token nearing its expiration time should be exchanged for a new one by calling this resource once more.
     * @param {String} customerId specifies the customer to act on behalf of
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Customer}
     */
    postCustomersByIDAuth(customerId) {
        return this.postCustomersByIDAuthWithHttpInfo(customerId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Starts a password reset process. A password reset token is generated and passed together with the customer  resolved by the id provided as path parameter to a afterPOST hook. The hook  dw.ocapi.shop.customer.password_reset.afterPOST can utilize the provided reset token, for example to send a reset email.
     * @param {String} customerId the id of the customer
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    postCustomersByIDPasswordResetWithHttpInfo(customerId) {
        const postBody = null

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling postCustomersByIDPasswordReset')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = null

        return this.apiClient.callApi(
            '/customers/{customer_id}/password_reset', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Starts a password reset process. A password reset token is generated and passed together with the customer  resolved by the id provided as path parameter to a afterPOST hook. The hook  dw.ocapi.shop.customer.password_reset.afterPOST can utilize the provided reset token, for example to send a reset email.
     * @param {String} customerId the id of the customer
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    postCustomersByIDPasswordReset(customerId) {
        return this.postCustomersByIDPasswordResetWithHttpInfo(customerId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Adds a payment instrument to a customer information.
     * @param {String} customerId the id of the customer
     * @param {module:models/CustomerPaymentInstrumentRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerPaymentInstrument} and HTTP response
     */
    postCustomersByIDPaymentInstrumentsWithHttpInfo(customerId, body) {
        const postBody = body

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling postCustomersByIDPaymentInstruments')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCustomersByIDPaymentInstruments')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerPaymentInstrument

        return this.apiClient.callApi(
            '/customers/{customer_id}/payment_instruments', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Adds a payment instrument to a customer information.
     * @param {String} customerId the id of the customer
     * @param {module:models/CustomerPaymentInstrumentRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerPaymentInstrument}
     */
    postCustomersByIDPaymentInstruments(customerId, body) {
        return this.postCustomersByIDPaymentInstrumentsWithHttpInfo(customerId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Creates a customer product list.
     * @param {module:models/CustomerProductList} body
     * @param {String} customerId The customer id.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductList} and HTTP response
     */
    postCustomersByIDProductListsWithHttpInfo(body, customerId) {
        const postBody = body

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCustomersByIDProductLists')
        }

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling postCustomersByIDProductLists')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductList

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Creates a customer product list.
     * @param {module:models/CustomerProductList} body
     * @param {String} customerId The customer id.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductList}
     */
    postCustomersByIDProductLists(customerId, body) {
        return this.postCustomersByIDProductListsWithHttpInfo(body, customerId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Adds an item to the customer&#39;s product list. Considered values from the request body are:    type: a valid type, mandatory. This is the type of the item to be added to the customer&#39;s product  list.  priority: This is the priority of the item to be added to the customer&#39;s product list.  public: This is the flag whether the item to be added to the customer&#39;s product list is public.  product_id: a valid product id, used for product item type only. This is the id (sku)  of the product related to the item to be added to the customer&#39;s product list. It is mandatory for  product item type and it must be a valid product id, otherwise  ProductListProductIdMissingException or ProductListProductNotFoundException  will be thrown.  quantity: used for product item type only. This is the quantity of the item to be  added to the customer&#39;s product list.  custom properties in the form c_&lt;CUSTOM_NAME&gt;: the custom property must correspond to a custom  attribute (&lt;CUSTOM_NAME&gt;) defined for ProductListItem. The value of this property must be valid for the  type of custom attribute defined for ProductListItem.
     * @param {String} customerId The id of the customer - owner of the product list.
     * @param {String} listId The id of the product list
     * @param {module:models/CustomerProductListItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductListItem} and HTTP response
     */
    postCustomersByIDProductListsByIDItemsWithHttpInfo(customerId, listId, body) {
        const postBody = body

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling postCustomersByIDProductListsByIDItems')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling postCustomersByIDProductListsByIDItems')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCustomersByIDProductListsByIDItems')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductListItem

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}/items', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Adds an item to the customer&#39;s product list. Considered values from the request body are:    type: a valid type, mandatory. This is the type of the item to be added to the customer&#39;s product  list.  priority: This is the priority of the item to be added to the customer&#39;s product list.  public: This is the flag whether the item to be added to the customer&#39;s product list is public.  product_id: a valid product id, used for product item type only. This is the id (sku)  of the product related to the item to be added to the customer&#39;s product list. It is mandatory for  product item type and it must be a valid product id, otherwise  ProductListProductIdMissingException or ProductListProductNotFoundException  will be thrown.  quantity: used for product item type only. This is the quantity of the item to be  added to the customer&#39;s product list.  custom properties in the form c_&lt;CUSTOM_NAME&gt;: the custom property must correspond to a custom  attribute (&lt;CUSTOM_NAME&gt;) defined for ProductListItem. The value of this property must be valid for the  type of custom attribute defined for ProductListItem.
     * @param {String} customerId The id of the customer - owner of the product list.
     * @param {String} listId The id of the product list
     * @param {module:models/CustomerProductListItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductListItem}
     */
    postCustomersByIDProductListsByIDItems(customerId, listId, body) {
        return this.postCustomersByIDProductListsByIDItemsWithHttpInfo(customerId, listId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Adds a purchase to an item in the customer&#39;s product list. Considered values from the request body are:    purchaser_name: name of the purchaser, mandatory. This is the full name of the purchaser of this product  list item.  quantity: amount purchased, mandatory. This is the quantity of the items purchased from  the product list.  custom properties in the form c_&lt;CUSTOM_NAME&gt;: the custom property must correspond to a custom  attribute (&lt;CUSTOM_NAME&gt;) defined for ProductListItemPurchase. The value of this property must be valid for the  type of custom attribute defined for ProductListItemPurchase.
     * @param {String} customerId The id of the customer - owner of the product list.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item where to add the purchase.
     * @param {module:models/CustomerProductListItemPurchase} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CustomerProductListItemPurchase} and HTTP response
     */
    postCustomersByIDProductListsByIDItemsByIDPurchasesWithHttpInfo(customerId, listId, itemId, body) {
        const postBody = body

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling postCustomersByIDProductListsByIDItemsByIDPurchases')
        }

        // verify the required parameter 'listId' is set
        if (listId === undefined || listId === null) {
            throw new Error('Missing the required parameter \'listId\' when calling postCustomersByIDProductListsByIDItemsByIDPurchases')
        }

        // verify the required parameter 'itemId' is set
        if (itemId === undefined || itemId === null) {
            throw new Error('Missing the required parameter \'itemId\' when calling postCustomersByIDProductListsByIDItemsByIDPurchases')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCustomersByIDProductListsByIDItemsByIDPurchases')
        }


        const pathParams = {
            customer_id: customerId,
            list_id: listId,
            item_id: itemId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = CustomerProductListItemPurchase

        return this.apiClient.callApi(
            '/customers/{customer_id}/product_lists/{list_id}/items/{item_id}/purchases', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Adds a purchase to an item in the customer&#39;s product list. Considered values from the request body are:    purchaser_name: name of the purchaser, mandatory. This is the full name of the purchaser of this product  list item.  quantity: amount purchased, mandatory. This is the quantity of the items purchased from  the product list.  custom properties in the form c_&lt;CUSTOM_NAME&gt;: the custom property must correspond to a custom  attribute (&lt;CUSTOM_NAME&gt;) defined for ProductListItemPurchase. The value of this property must be valid for the  type of custom attribute defined for ProductListItemPurchase.
     * @param {String} customerId The id of the customer - owner of the product list.
     * @param {String} listId The id of the product list.
     * @param {String} itemId The id of the product list item where to add the purchase.
     * @param {module:models/CustomerProductListItemPurchase} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CustomerProductListItemPurchase}
     */
    postCustomersByIDProductListsByIDItemsByIDPurchases(customerId, listId, itemId, body) {
        return this.postCustomersByIDProductListsByIDItemsByIDPurchasesWithHttpInfo(customerId, listId, itemId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Returns a reset password token for the passed in customer&#39;s login that will be used   with the customers/reset_password endpoint to change the customer&#39;s password.    This differs from the customers/password_reset endpoint as it does not require or allow before or after hook processing.
     * @param {module:models/ResetPasswordTokenRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/ResetPasswordTokenResult} and HTTP response
     */
    postCustomersPasswordActionsCreateResetTokenWithHttpInfo(body) {
        const postBody = body

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCustomersPasswordActionsCreateResetToken')
        }


        const pathParams = {
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = ResetPasswordTokenResult

        return this.apiClient.callApi(
            '/customers/password/actions/create_reset_token', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Returns a reset password token for the passed in customer&#39;s login that will be used   with the customers/reset_password endpoint to change the customer&#39;s password.    This differs from the customers/password_reset endpoint as it does not require or allow before or after hook processing.
     * @param {module:models/ResetPasswordTokenRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/ResetPasswordTokenResult}
     */
    postCustomersPasswordActionsCreateResetToken(body) {
        return this.postCustomersPasswordActionsCreateResetTokenWithHttpInfo(body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Changes the customer&#39;s password to the new password value in the call using the reset   password token that was returned from the customers/reset_password_token endpoint.    This differs from the customers/password_reset endpoint as it does not require or allow before or after hook processing.
     * @param {module:models/ResetPasswordRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    postCustomersPasswordActionsResetWithHttpInfo(body) {
        const postBody = body

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCustomersPasswordActionsReset')
        }


        const pathParams = {
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'oauth2_application']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = null

        return this.apiClient.callApi(
            '/customers/password/actions/reset', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Changes the customer&#39;s password to the new password value in the call using the reset   password token that was returned from the customers/reset_password_token endpoint.    This differs from the customers/password_reset endpoint as it does not require or allow before or after hook processing.
     * @param {module:models/ResetPasswordRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    postCustomersPasswordActionsReset(body) {
        return this.postCustomersPasswordActionsResetWithHttpInfo(body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * First the beforePOST hook is called. After that the validation of the   customer information provided in the the password reset document is performed.   Then a password reset token is generated and together with the resolved   customer is passed to a afterPOST hook. The customer resolution is based   on the password reset request type. Both hooks are performed in a single  transaction.  Currently the resolution can be done by email or login. In case of  an email the password reset hook is only executed if one and only one  customer has been identified for that email. In the case that more than  one customers have been identified for the provided email the resource  does nothing.
     * @param {module:models/PasswordReset} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    postCustomersPasswordResetWithHttpInfo(body) {
        const postBody = body

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCustomersPasswordReset')
        }


        const pathParams = {
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = null

        return this.apiClient.callApi(
            '/customers/password_reset', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * First the beforePOST hook is called. After that the validation of the   customer information provided in the the password reset document is performed.   Then a password reset token is generated and together with the resolved   customer is passed to a afterPOST hook. The customer resolution is based   on the password reset request type. Both hooks are performed in a single  transaction.  Currently the resolution can be done by email or login. In case of  an email the password reset hook is only executed if one and only one  customer has been identified for that email. In the case that more than  one customers have been identified for the provided email the resource  does nothing.
     * @param {module:models/PasswordReset} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    postCustomersPasswordReset(body) {
        return this.postCustomersPasswordResetWithHttpInfo(body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Updates the customer&#39;s password.
     * @param {String} customerId the customer id
     * @param {module:models/PasswordChangeRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    putCustomersByIDPasswordWithHttpInfo(customerId, body) {
        const postBody = body

        // verify the required parameter 'customerId' is set
        if (customerId === undefined || customerId === null) {
            throw new Error('Missing the required parameter \'customerId\' when calling putCustomersByIDPassword')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling putCustomersByIDPassword')
        }


        const pathParams = {
            customer_id: customerId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['client_id', 'customers_auth']
        const contentTypes = ['application/json', 'text/xml', 'application/xml']
        const accepts = ['application/json', 'text/xml', 'application/xml']
        const returnType = null

        return this.apiClient.callApi(
            '/customers/{customer_id}/password', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Updates the customer&#39;s password.
     * @param {String} customerId the customer id
     * @param {module:models/PasswordChangeRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    putCustomersByIDPassword(customerId, body) {
        return this.putCustomersByIDPasswordWithHttpInfo(customerId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


}