Source: api/BasketsApi.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 ApproachingDiscountResult from '../models/ApproachingDiscountResult'
import Basket from '../models/Basket'
import NotesResult from '../models/NotesResult'
import PaymentMethodResult from '../models/PaymentMethodResult'
import ShippingMethodResult from '../models/ShippingMethodResult'

/**
* Baskets service.
* @module api/BasketsApi
* @version 20.4
*/
export default class BasketsApi {

    /**
    * Constructs a new BasketsApi.
    * @alias module:api/BasketsApi
    * @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
    }



    /**
     * Removes a basket.
     * @param {String} basketId the id of the basket to be retrieved
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    deleteBasketsByIDWithHttpInfo(basketId) {
        const postBody = null

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


        const pathParams = {
            basket_id: basketId
        }
        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(
            '/baskets/{basket_id}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Removes a basket.
     * @param {String} basketId the id of the basket to be retrieved
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteBasketsByID(basketId) {
        return this.deleteBasketsByIDWithHttpInfo(basketId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Removes a coupon from the basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} couponItemId the id of the coupon item to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    deleteBasketsByIDCouponsByIDWithHttpInfo(basketId, couponItemId) {
        const postBody = null

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

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


        const pathParams = {
            basket_id: basketId,
            coupon_item_id: couponItemId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/coupons/{coupon_item_id}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Removes a coupon from the basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} couponItemId the id of the coupon item to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    deleteBasketsByIDCouponsByID(basketId, couponItemId) {
        return this.deleteBasketsByIDCouponsByIDWithHttpInfo(basketId, couponItemId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Deletes a gift certificate item from an existing basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} giftCertificateItemId the id of the gift certificate item to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    deleteBasketsByIDGiftCertificateItemsByIDWithHttpInfo(basketId, giftCertificateItemId) {
        const postBody = null

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

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


        const pathParams = {
            basket_id: basketId,
            gift_certificate_item_id: giftCertificateItemId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Deletes a gift certificate item from an existing basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} giftCertificateItemId the id of the gift certificate item to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    deleteBasketsByIDGiftCertificateItemsByID(basketId, giftCertificateItemId) {
        return this.deleteBasketsByIDGiftCertificateItemsByIDWithHttpInfo(basketId, giftCertificateItemId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Removes a product item from the basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} itemId the id of the product item to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    deleteBasketsByIDItemsByIDWithHttpInfo(basketId, itemId) {
        const postBody = null

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

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


        const pathParams = {
            basket_id: basketId,
            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 = Basket

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

    /**
     * Removes a product item from the basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} itemId the id of the product item to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    deleteBasketsByIDItemsByID(basketId, itemId) {
        return this.deleteBasketsByIDItemsByIDWithHttpInfo(basketId, itemId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Removes a basket note.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} noteId the id of the note to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    deleteBasketsByIDNotesByIDWithHttpInfo(basketId, noteId) {
        const postBody = null

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

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


        const pathParams = {
            basket_id: basketId,
            note_id: noteId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/notes/{note_id}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Removes a basket note.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} noteId the id of the note to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    deleteBasketsByIDNotesByID(basketId, noteId) {
        return this.deleteBasketsByIDNotesByIDWithHttpInfo(basketId, noteId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Removes a payment instrument of a basket.
     * @param {String} basketId the basket id
     * @param {String} paymentInstrumentId the id of the payment instrument to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    deleteBasketsByIDPaymentInstrumentsByIDWithHttpInfo(basketId, paymentInstrumentId) {
        const postBody = null

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

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


        const pathParams = {
            basket_id: basketId,
            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 = Basket

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

    /**
     * Removes a payment instrument of a basket.
     * @param {String} basketId the basket id
     * @param {String} paymentInstrumentId the id of the payment instrument to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    deleteBasketsByIDPaymentInstrumentsByID(basketId, paymentInstrumentId) {
        return this.deleteBasketsByIDPaymentInstrumentsByIDWithHttpInfo(basketId, paymentInstrumentId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Removes a custom manual price adjustment from the basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} priceAdjustmentId the uuid of the adjustment to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    deleteBasketsByIDPriceAdjustmentsByIDWithHttpInfo(basketId, priceAdjustmentId) {
        const postBody = null

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

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


        const pathParams = {
            basket_id: basketId,
            price_adjustment_id: priceAdjustmentId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/price_adjustments/{price_adjustment_id}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Removes a custom manual price adjustment from the basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} priceAdjustmentId the uuid of the adjustment to be removed
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    deleteBasketsByIDPriceAdjustmentsByID(basketId, priceAdjustmentId) {
        return this.deleteBasketsByIDPriceAdjustmentsByIDWithHttpInfo(basketId, priceAdjustmentId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Removes a specified shipment and all associated product, gift certificate,  shipping and price adjustment line items from a basket.  It is not permissible to remove the default shipment.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} shipmentId the id of the shipment to be deleted
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    deleteBasketsByIDShipmentsByIDWithHttpInfo(basketId, shipmentId) {
        const postBody = null

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

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


        const pathParams = {
            basket_id: basketId,
            shipment_id: shipmentId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/shipments/{shipment_id}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Removes a specified shipment and all associated product, gift certificate,  shipping and price adjustment line items from a basket.  It is not permissible to remove the default shipment.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} shipmentId the id of the shipment to be deleted
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    deleteBasketsByIDShipmentsByID(basketId, shipmentId) {
        return this.deleteBasketsByIDShipmentsByIDWithHttpInfo(basketId, shipmentId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Gets a basket.
     * @param {String} basketId the id of the basket to be retrieved
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    getBasketsByIDWithHttpInfo(basketId) {
        const postBody = null

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


        const pathParams = {
            basket_id: basketId
        }
        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 = Basket

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

    /**
     * Gets a basket.
     * @param {String} basketId the id of the basket to be retrieved
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    getBasketsByID(basketId) {
        return this.getBasketsByIDWithHttpInfo(basketId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Gets the approaching discounts of a basket
     * @param {String} basketId The id of the basket to be checked.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/ApproachingDiscountResult} and HTTP response
     */
    getBasketsByIDApproachingDiscountsWithHttpInfo(basketId) {
        const postBody = null

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


        const pathParams = {
            basket_id: basketId
        }
        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 = ApproachingDiscountResult

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

    /**
     * Gets the approaching discounts of a basket
     * @param {String} basketId The id of the basket to be checked.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/ApproachingDiscountResult}
     */
    getBasketsByIDApproachingDiscounts(basketId) {
        return this.getBasketsByIDApproachingDiscountsWithHttpInfo(basketId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Retrieves notes for a basket.
     * @param {String} basketId The id of the basket for which you want to retrieve the notes.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/NotesResult} and HTTP response
     */
    getBasketsByIDNotesWithHttpInfo(basketId) {
        const postBody = null

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


        const pathParams = {
            basket_id: basketId
        }
        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 = NotesResult

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

    /**
     * Retrieves notes for a basket.
     * @param {String} basketId The id of the basket for which you want to retrieve the notes.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/NotesResult}
     */
    getBasketsByIDNotes(basketId) {
        return this.getBasketsByIDNotesWithHttpInfo(basketId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Gets applicable payment methods for an existing basket considering the open payment amount only.
     * @param {String} basketId the basket id
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/PaymentMethodResult} and HTTP response
     */
    getBasketsByIDPaymentMethodsWithHttpInfo(basketId) {
        const postBody = null

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


        const pathParams = {
            basket_id: basketId
        }
        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 = PaymentMethodResult

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

    /**
     * Gets applicable payment methods for an existing basket considering the open payment amount only.
     * @param {String} basketId the basket id
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/PaymentMethodResult}
     */
    getBasketsByIDPaymentMethods(basketId) {
        return this.getBasketsByIDPaymentMethodsWithHttpInfo(basketId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Gets the applicable shipping methods for a certain shipment of a  basket.
     * @param {String} basketId the id of the basket
     * @param {String} shipmentId the id of the shipment
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/ShippingMethodResult} and HTTP response
     */
    getBasketsByIDShipmentsByIDShippingMethodsWithHttpInfo(basketId, shipmentId) {
        const postBody = null

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

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


        const pathParams = {
            basket_id: basketId,
            shipment_id: shipmentId
        }
        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 = ShippingMethodResult

        return this.apiClient.callApi(
            '/baskets/{basket_id}/shipments/{shipment_id}/shipping_methods', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Gets the applicable shipping methods for a certain shipment of a  basket.
     * @param {String} basketId the id of the basket
     * @param {String} shipmentId the id of the shipment
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/ShippingMethodResult}
     */
    getBasketsByIDShipmentsByIDShippingMethods(basketId, shipmentId) {
        return this.getBasketsByIDShipmentsByIDShippingMethodsWithHttpInfo(basketId, shipmentId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Updates a basket. Only the currency of the basket, source code, and the custom  properties of the basket and of the shipping items will be considered.
     * @param {String} basketId the id of the basket to be modified
     * @param {module:models/Basket} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    patchBasketsByIDWithHttpInfo(basketId, body) {
        const postBody = body

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

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


        const pathParams = {
            basket_id: basketId
        }
        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 = Basket

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

    /**
     * Updates a basket. Only the currency of the basket, source code, and the custom  properties of the basket and of the shipping items will be considered.
     * @param {String} basketId the id of the basket to be modified
     * @param {module:models/Basket} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    patchBasketsByID(basketId, body) {
        return this.patchBasketsByIDWithHttpInfo(basketId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Updates a gift certificate item of an existing basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} giftCertificateItemId the id of the gift certificate item to be updated
     * @param {module:models/GiftCertificateItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    patchBasketsByIDGiftCertificateItemsByIDWithHttpInfo(basketId, giftCertificateItemId, body) {
        const postBody = body

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

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

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


        const pathParams = {
            basket_id: basketId,
            gift_certificate_item_id: giftCertificateItemId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Updates a gift certificate item of an existing basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} giftCertificateItemId the id of the gift certificate item to be updated
     * @param {module:models/GiftCertificateItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    patchBasketsByIDGiftCertificateItemsByID(basketId, giftCertificateItemId, body) {
        return this.patchBasketsByIDGiftCertificateItemsByIDWithHttpInfo(basketId, giftCertificateItemId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Updates an item in a basket.  The  following values in the request body are considered by the server:    product_id: a valid product id. The purpose of this  value is to exchange a variation of a variation product.  shipment_id: a valid shipment id. The purpose of  this value is to move a product item to another shipment.  quantity: a number between 0 and 999. The purpose of  this value is to change quantity of the product item. If quantity is 0,  the product item is removed.  option_items/option_value_id: a valid option value  id. The purpose of this value is to exchange an option value for an  option item of an option product.   This is only possible if the product item is an option product. To change  option values a collection of option items to be changed need to be  provided in property option_items. Those  option_items need to contain option_id  and option_value_id. The provided values must be valid  for the option product that this product item represents. Otherwise  InvalidProductOptionItemException or  InvalidProductOptionValueItemException will be thrown.  custom properties c_<CUSTOM_NAME>: a  value corresponding to the type defined for custom attribute  <CUSTOM_NAME> of ProductLineItem. The purpose of this value is to  add or change the value of a custom attribute defined for  ProductLineItem.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} itemId the it of the item to be updated
     * @param {module:models/ProductItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    patchBasketsByIDItemsByIDWithHttpInfo(basketId, itemId, body) {
        const postBody = body

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

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

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


        const pathParams = {
            basket_id: basketId,
            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 = Basket

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

    /**
     * Updates an item in a basket.  The  following values in the request body are considered by the server:    product_id: a valid product id. The purpose of this  value is to exchange a variation of a variation product.  shipment_id: a valid shipment id. The purpose of  this value is to move a product item to another shipment.  quantity: a number between 0 and 999. The purpose of  this value is to change quantity of the product item. If quantity is 0,  the product item is removed.  option_items/option_value_id: a valid option value  id. The purpose of this value is to exchange an option value for an  option item of an option product.   This is only possible if the product item is an option product. To change  option values a collection of option items to be changed need to be  provided in property option_items. Those  option_items need to contain option_id  and option_value_id. The provided values must be valid  for the option product that this product item represents. Otherwise  InvalidProductOptionItemException or  InvalidProductOptionValueItemException will be thrown.  custom properties c_<CUSTOM_NAME>: a  value corresponding to the type defined for custom attribute  <CUSTOM_NAME> of ProductLineItem. The purpose of this value is to  add or change the value of a custom attribute defined for  ProductLineItem.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} itemId the it of the item to be updated
     * @param {module:models/ProductItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    patchBasketsByIDItemsByID(basketId, itemId, body) {
        return this.patchBasketsByIDItemsByIDWithHttpInfo(basketId, itemId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Updates a payment instrument of a basket.    Payment instruments are usually authorized after order creation, for example in a custom hook. The default  payment authorization process executes an authorization when a payment instrument is added to an order or  updated. See POST /orders/{order_no}/payment_instruments and PATCH  /orders/{order_no}/payment_instruments/{payment_instrument_id}
     * @param {String} basketId the basket id
     * @param {String} paymentInstrumentId the id of the payment instrument to be updated
     * @param {module:models/BasketPaymentInstrumentRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    patchBasketsByIDPaymentInstrumentsByIDWithHttpInfo(basketId, paymentInstrumentId, body) {
        const postBody = body

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

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

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


        const pathParams = {
            basket_id: basketId,
            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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/payment_instruments/{payment_instrument_id}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Updates a payment instrument of a basket.    Payment instruments are usually authorized after order creation, for example in a custom hook. The default  payment authorization process executes an authorization when a payment instrument is added to an order or  updated. See POST /orders/{order_no}/payment_instruments and PATCH  /orders/{order_no}/payment_instruments/{payment_instrument_id}
     * @param {String} basketId the basket id
     * @param {String} paymentInstrumentId the id of the payment instrument to be updated
     * @param {module:models/BasketPaymentInstrumentRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    patchBasketsByIDPaymentInstrumentsByID(basketId, paymentInstrumentId, body) {
        return this.patchBasketsByIDPaymentInstrumentsByIDWithHttpInfo(basketId, paymentInstrumentId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Updates a custom manual price adjustment on the basket. Only the following PATH values are considered for the  update: discount, item_text, reason_code and custom properties; all other attributes are ignored. The discount  type of a price adjustment cannot be updated and therefore, the value of the existing type must be passed. For an  adjustment of type PERCENTAGE, the 'percentage' attribute is mandatory. For adjustments of type AMOUNT and  FIXED_PRICE, the 'amount' attribute is mandatory.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} priceAdjustmentId the uuid of the adjustment to be updated
     * @param {module:models/PriceAdjustment} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    patchBasketsByIDPriceAdjustmentsByIDWithHttpInfo(basketId, priceAdjustmentId, body) {
        const postBody = body

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

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

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


        const pathParams = {
            basket_id: basketId,
            price_adjustment_id: priceAdjustmentId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/price_adjustments/{price_adjustment_id}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Updates a custom manual price adjustment on the basket. Only the following PATH values are considered for the  update: discount, item_text, reason_code and custom properties; all other attributes are ignored. The discount  type of a price adjustment cannot be updated and therefore, the value of the existing type must be passed. For an  adjustment of type PERCENTAGE, the 'percentage' attribute is mandatory. For adjustments of type AMOUNT and  FIXED_PRICE, the 'amount' attribute is mandatory.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} priceAdjustmentId the uuid of the adjustment to be updated
     * @param {module:models/PriceAdjustment} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    patchBasketsByIDPriceAdjustmentsByID(basketId, priceAdjustmentId, body) {
        return this.patchBasketsByIDPriceAdjustmentsByIDWithHttpInfo(basketId, priceAdjustmentId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Updates a shipment for a basket.    The shipment is initialized with values provided in the body  document and can be updated with further data API calls. Considered from  the body are the following properties if specified    the id  the shipping address  the shipping method  gift boolean flag  gift message  custom properties
     * @param {String} basketId the id of the basket to be modified
     * @param {String} shipmentId the id of the shipment to be modified
     * @param {module:models/Shipment} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    patchBasketsByIDShipmentsByIDWithHttpInfo(basketId, shipmentId, body) {
        const postBody = body

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

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

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


        const pathParams = {
            basket_id: basketId,
            shipment_id: shipmentId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/shipments/{shipment_id}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Updates a shipment for a basket.    The shipment is initialized with values provided in the body  document and can be updated with further data API calls. Considered from  the body are the following properties if specified    the id  the shipping address  the shipping method  gift boolean flag  gift message  custom properties
     * @param {String} basketId the id of the basket to be modified
     * @param {String} shipmentId the id of the shipment to be modified
     * @param {module:models/Shipment} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    patchBasketsByIDShipmentsByID(basketId, shipmentId, body) {
        return this.patchBasketsByIDShipmentsByIDWithHttpInfo(basketId, shipmentId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Creates a new basket. The created basket is initialized with default values. Data provided in the body document  will be populated into the created basket. It can be updated with further Shop API calls.   Considered values from the request body are:    customer information: PUT /baskets/{basket_id}/customer  billing address: PUT /baskets/{basket_id}/billing_address  shipments including shipping address and shipping method: POST /baskets/{basket_id}/shipments  product items: POST /baskets/{basket_id}/items  coupon items: POST /baskets/{basket_id}/coupons  gift certificate items: POST /baskets/{basket_id}/gift_certificates  payment method and card type: POST /baskets/{basket_id}/payment_instruments  custom properties: PATCH /baskets/{basket_id}    Related resource means with which resource you can specify the same data after the basket creation.   Identify the basket using the basket_id property, which  should be integrated into the path of an update request, for example a POST to  /baskets/{basket_id}/items.  The resource supports JWT or  OAuth tokens for authentication:    A customer must provide a JWT, which specifies exactly one customer (it may be a guest or a registered  customer). In this case the resource creates a basket for this customer.  An agent must provide an OAuth token. The agent can use this resource to create a basket for a new created  guest customer, and can later update the customer if desired.     The number of baskets which can be created per customer is limited. When a  basket is created it is said to be open. It remains open until either an order is created from it  using a POST to resource /orders or it is deleted using a DELETE to resource  /baskets/{basket_id}. The number of open baskets allowed depends on the authentication  method used:    When using JWT each customer can have just one open basket  When using OAuth each customer can have up to 4 open baskets (this is a quota setting which can be  updated by support)    Custom properties in the form c_<CUSTOM_NAME> are supported. A custom property must correspond to a custom  attribute (<CUSTOM_NAME>) defined for the Basket system object, and its value must be valid for that custom  attribute. Other basket properties like the channel type or source code cannot be set with this resource.
     * @param {Object} opts Optional parameters
     * @param {module:models/Basket} opts.body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    postBasketsWithHttpInfo(opts) {
        opts = opts || {}
        const postBody = opts.body


        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 = Basket

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

    /**
     * Creates a new basket. The created basket is initialized with default values. Data provided in the body document  will be populated into the created basket. It can be updated with further Shop API calls.   Considered values from the request body are:    customer information: PUT /baskets/{basket_id}/customer  billing address: PUT /baskets/{basket_id}/billing_address  shipments including shipping address and shipping method: POST /baskets/{basket_id}/shipments  product items: POST /baskets/{basket_id}/items  coupon items: POST /baskets/{basket_id}/coupons  gift certificate items: POST /baskets/{basket_id}/gift_certificates  payment method and card type: POST /baskets/{basket_id}/payment_instruments  custom properties: PATCH /baskets/{basket_id}    Related resource means with which resource you can specify the same data after the basket creation.   Identify the basket using the basket_id property, which  should be integrated into the path of an update request, for example a POST to  /baskets/{basket_id}/items.  The resource supports JWT or  OAuth tokens for authentication:    A customer must provide a JWT, which specifies exactly one customer (it may be a guest or a registered  customer). In this case the resource creates a basket for this customer.  An agent must provide an OAuth token. The agent can use this resource to create a basket for a new created  guest customer, and can later update the customer if desired.     The number of baskets which can be created per customer is limited. When a  basket is created it is said to be open. It remains open until either an order is created from it  using a POST to resource /orders or it is deleted using a DELETE to resource  /baskets/{basket_id}. The number of open baskets allowed depends on the authentication  method used:    When using JWT each customer can have just one open basket  When using OAuth each customer can have up to 4 open baskets (this is a quota setting which can be  updated by support)    Custom properties in the form c_<CUSTOM_NAME> are supported. A custom property must correspond to a custom  attribute (<CUSTOM_NAME>) defined for the Basket system object, and its value must be valid for that custom  attribute. Other basket properties like the channel type or source code cannot be set with this resource.
     * @param {Object} opts Optional parameters
     * @param {module:models/Basket} opts.body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    postBaskets(opts) {
        return this.postBasketsWithHttpInfo(opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Adds a coupon to an existing basket.
     * @param {String} basketId The id of the basket to be modified.
     * @param {module:models/CouponItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    postBasketsByIDCouponsWithHttpInfo(basketId, body) {
        const postBody = body

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

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


        const pathParams = {
            basket_id: basketId
        }
        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 = Basket

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

    /**
     * Adds a coupon to an existing basket.
     * @param {String} basketId The id of the basket to be modified.
     * @param {module:models/CouponItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    postBasketsByIDCoupons(basketId, body) {
        return this.postBasketsByIDCouponsWithHttpInfo(basketId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Adds a gift certificate item to an existing basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {module:models/GiftCertificateItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    postBasketsByIDGiftCertificateItemsWithHttpInfo(basketId, body) {
        const postBody = body

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

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


        const pathParams = {
            basket_id: basketId
        }
        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 = Basket

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

    /**
     * Adds a gift certificate item to an existing basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {module:models/GiftCertificateItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    postBasketsByIDGiftCertificateItems(basketId, body) {
        return this.postBasketsByIDGiftCertificateItemsWithHttpInfo(basketId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Adds new items to a basket.  The added items are associated with the  specified shipment. If no shipment id is specified, the added items are associated with the default shipment.   Considered values from the request body, for each item are:    product_id: a valid product id. This is the id of the product to be added to the basket. If the  product is already in the basket, the API either increments the quantity of the existing product line item or  creates a new product line item, based on the site preference 'Add Product Behavior'. For option products and  product bundles containing variation masters, the API creates a new product line item regardless of the site  preference.  shipment_id: a valid shipment id (optional). This is the id of the shipment in which the product item  is created.  quantity: a number between 0.01 and 999. This is the quantity of the product to order.  inventory_id: a valid inventory id (optional). This is the id of the inventory from which the item is  allocated.  bonus_discount_line_item_id: a valid bonus discount line item id (optional). This is the id of the  bonus discount line item for which the added product is a selected bonus product.  option_items/option_value_id: a valid option value id. This is an option value for an option item of  an option product.  This is only possible if the product item is an option  product. To set option values, you must specify a collection of option items in the option_items  property. These option items must contain option_id and option_value_id. Also,  the values you specify must be valid for the option product that this product item represents. Otherwise, the  server throws an InvalidProductOptionItemException or an  InvalidProductOptionValueItemException.  custom properties in the form c_<CUSTOM_NAME>: the custom property must correspond to a custom  attribute (<CUSTOM_NAME>) defined for ProductLineItem. The value of this property must be valid for the  type of custom attribute defined for ProductLineItem.
     * @param {String} basketId The id of the basket to be modified.
     * @param {module:models/ProductItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    postBasketsByIDItemsWithHttpInfo(basketId, body) {
        const postBody = body

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

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


        const pathParams = {
            basket_id: basketId
        }
        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 = Basket

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

    /**
     * Adds new items to a basket.  The added items are associated with the  specified shipment. If no shipment id is specified, the added items are associated with the default shipment.   Considered values from the request body, for each item are:    product_id: a valid product id. This is the id of the product to be added to the basket. If the  product is already in the basket, the API either increments the quantity of the existing product line item or  creates a new product line item, based on the site preference 'Add Product Behavior'. For option products and  product bundles containing variation masters, the API creates a new product line item regardless of the site  preference.  shipment_id: a valid shipment id (optional). This is the id of the shipment in which the product item  is created.  quantity: a number between 0.01 and 999. This is the quantity of the product to order.  inventory_id: a valid inventory id (optional). This is the id of the inventory from which the item is  allocated.  bonus_discount_line_item_id: a valid bonus discount line item id (optional). This is the id of the  bonus discount line item for which the added product is a selected bonus product.  option_items/option_value_id: a valid option value id. This is an option value for an option item of  an option product.  This is only possible if the product item is an option  product. To set option values, you must specify a collection of option items in the option_items  property. These option items must contain option_id and option_value_id. Also,  the values you specify must be valid for the option product that this product item represents. Otherwise, the  server throws an InvalidProductOptionItemException or an  InvalidProductOptionValueItemException.  custom properties in the form c_<CUSTOM_NAME>: the custom property must correspond to a custom  attribute (<CUSTOM_NAME>) defined for ProductLineItem. The value of this property must be valid for the  type of custom attribute defined for ProductLineItem.
     * @param {String} basketId The id of the basket to be modified.
     * @param {module:models/ProductItem} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    postBasketsByIDItems(basketId, body) {
        return this.postBasketsByIDItemsWithHttpInfo(basketId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Adds a note to an existing basket.
     * @param {String} basketId The id of the basket to be modified.
     * @param {module:models/Note} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    postBasketsByIDNotesWithHttpInfo(basketId, body) {
        const postBody = body

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

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


        const pathParams = {
            basket_id: basketId
        }
        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 = Basket

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

    /**
     * Adds a note to an existing basket.
     * @param {String} basketId The id of the basket to be modified.
     * @param {module:models/Note} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    postBasketsByIDNotes(basketId, body) {
        return this.postBasketsByIDNotesWithHttpInfo(basketId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Adds a payment instrument to a basket.    Payment instruments are usually authorized after order creation, for example in a custom hook. The default  payment authorization process executes an authorization when a payment instrument is added to an order or  updated. See POST /orders/{order_no}/payment_instruments and PATCH  /orders/{order_no}/payment_instruments/{payment_instrument_id}.  NOTE: If CREDIT_CARD is selected as the payment_method_id, it is mandatory to provide the property card_type.
     * @param {String} basketId the basket id
     * @param {module:models/BasketPaymentInstrumentRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    postBasketsByIDPaymentInstrumentsWithHttpInfo(basketId, body) {
        const postBody = body

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

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


        const pathParams = {
            basket_id: basketId
        }
        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 = Basket

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

    /**
     * Adds a payment instrument to a basket.    Payment instruments are usually authorized after order creation, for example in a custom hook. The default  payment authorization process executes an authorization when a payment instrument is added to an order or  updated. See POST /orders/{order_no}/payment_instruments and PATCH  /orders/{order_no}/payment_instruments/{payment_instrument_id}.  NOTE: If CREDIT_CARD is selected as the payment_method_id, it is mandatory to provide the property card_type.
     * @param {String} basketId the basket id
     * @param {module:models/BasketPaymentInstrumentRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    postBasketsByIDPaymentInstruments(basketId, body) {
        return this.postBasketsByIDPaymentInstrumentsWithHttpInfo(basketId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Adds a custom manual price adjustment to the basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {module:models/PriceAdjustmentRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    postBasketsByIDPriceAdjustmentsWithHttpInfo(basketId, body) {
        const postBody = body

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

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


        const pathParams = {
            basket_id: basketId
        }
        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 = Basket

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

    /**
     * Adds a custom manual price adjustment to the basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {module:models/PriceAdjustmentRequest} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    postBasketsByIDPriceAdjustments(basketId, body) {
        return this.postBasketsByIDPriceAdjustmentsWithHttpInfo(basketId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Creates a new shipment for a basket.    The created shipment is initialized with values provided in the body  document and can be updated with further data API calls. Considered from  the body are the following properties if specified:    the id  the shipping address  the shipping method  gift boolean flag  gift message  custom properties
     * @param {String} basketId the id of the basket to be modified
     * @param {module:models/Shipment} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    postBasketsByIDShipmentsWithHttpInfo(basketId, body) {
        const postBody = body

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

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


        const pathParams = {
            basket_id: basketId
        }
        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 = Basket

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

    /**
     * Creates a new shipment for a basket.    The created shipment is initialized with values provided in the body  document and can be updated with further data API calls. Considered from  the body are the following properties if specified:    the id  the shipping address  the shipping method  gift boolean flag  gift message  custom properties
     * @param {String} basketId the id of the basket to be modified
     * @param {module:models/Shipment} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    postBasketsByIDShipments(basketId, body) {
        return this.postBasketsByIDShipmentsWithHttpInfo(basketId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Creates a new basket based on a basket reference.    The returned basket will be a copy of the basket in the reference. The basket in the reference must be a basket  of an anonymous customer and the provided customer_id in the reference must match the anonymous customer in the  basket. In case customer_id not matching a BasketNotFoundException will be returned as fault. All personal data  like payment instruments and coupons will not be copied over to the new basket.
     * @param {module:models/BasketReference} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    postBasketsReferenceWithHttpInfo(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 postBasketsReference')
        }


        const pathParams = {
        }
        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 = Basket

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

    /**
     * Creates a new basket based on a basket reference.    The returned basket will be a copy of the basket in the reference. The basket in the reference must be a basket  of an anonymous customer and the provided customer_id in the reference must match the anonymous customer in the  basket. In case customer_id not matching a BasketNotFoundException will be returned as fault. All personal data  like payment instruments and coupons will not be copied over to the new basket.
     * @param {module:models/BasketReference} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    postBasketsReference(body) {
        return this.postBasketsReferenceWithHttpInfo(body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Marks a basket as an agent basket.
     * @param {String} basketId the basket id
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    putBasketsByIDAgentWithHttpInfo(basketId) {
        const postBody = null

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


        const pathParams = {
            basket_id: basketId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/agent', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Marks a basket as an agent basket.
     * @param {String} basketId the basket id
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    putBasketsByIDAgent(basketId) {
        return this.putBasketsByIDAgentWithHttpInfo(basketId)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Sets the billing address of a basket.
     * @param {String} basketId The id of the basket to be modified.
     * @param {Object} opts Optional parameters
     * @param {Boolean} opts.useAsShipping
     * @param {String} opts.customerAddressId
     * @param {module:models/OrderAddress} opts.body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    putBasketsByIDBillingAddressWithHttpInfo(basketId, opts) {
        opts = opts || {}
        const postBody = opts.body

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


        const pathParams = {
            basket_id: basketId
        }
        const queryParams = {
            use_as_shipping: opts.useAsShipping,
            customer_address_id: opts.customerAddressId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/billing_address', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Sets the billing address of a basket.
     * @param {String} basketId The id of the basket to be modified.
     * @param {Object} opts Optional parameters
     * @param {Boolean} opts.useAsShipping
     * @param {String} opts.customerAddressId
     * @param {module:models/OrderAddress} opts.body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    putBasketsByIDBillingAddress(basketId, opts) {
        return this.putBasketsByIDBillingAddressWithHttpInfo(basketId, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Sets customer information for an existing basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {module:models/CustomerInfo} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    putBasketsByIDCustomerWithHttpInfo(basketId, body) {
        const postBody = body

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

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


        const pathParams = {
            basket_id: basketId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/customer', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Sets customer information for an existing basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {module:models/CustomerInfo} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    putBasketsByIDCustomer(basketId, body) {
        return this.putBasketsByIDCustomerWithHttpInfo(basketId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Sets a shipping address of a specific shipment of a basket.
     * @param {String} basketId The id of the basket to be modified.
     * @param {String} shipmentId The id of the shipment to be modified.
     * @param {module:models/OrderAddress} body
     * @param {Object} opts Optional parameters
     * @param {Boolean} opts.useAsBilling
     * @param {String} opts.customerAddressId
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    putBasketsByIDShipmentsByIDShippingAddressWithHttpInfo(basketId, shipmentId, body, opts) {
        opts = opts || {}
        const postBody = body

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

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

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


        const pathParams = {
            basket_id: basketId,
            shipment_id: shipmentId
        }
        const queryParams = {
            use_as_billing: opts.useAsBilling,
            customer_address_id: opts.customerAddressId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/shipments/{shipment_id}/shipping_address', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Sets a shipping address of a specific shipment of a basket.
     * @param {String} basketId The id of the basket to be modified.
     * @param {String} shipmentId The id of the shipment to be modified.
     * @param {module:models/OrderAddress} body
     * @param {Object} opts Optional parameters
     * @param {Boolean} opts.useAsBilling
     * @param {String} opts.customerAddressId
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    putBasketsByIDShipmentsByIDShippingAddress(basketId, shipmentId, body, opts) {
        return this.putBasketsByIDShipmentsByIDShippingAddressWithHttpInfo(basketId, shipmentId, body, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Sets a shipping method to a specific shipment of a basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} shipmentId the id of the shipment to be modified
     * @param {module:models/ShippingMethod} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    putBasketsByIDShipmentsByIDShippingMethodWithHttpInfo(basketId, shipmentId, body) {
        const postBody = body

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

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

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


        const pathParams = {
            basket_id: basketId,
            shipment_id: shipmentId
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/shipments/{shipment_id}/shipping_method', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Sets a shipping method to a specific shipment of a basket.
     * @param {String} basketId the id of the basket to be modified
     * @param {String} shipmentId the id of the shipment to be modified
     * @param {module:models/ShippingMethod} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    putBasketsByIDShipmentsByIDShippingMethod(basketId, shipmentId, body) {
        return this.putBasketsByIDShipmentsByIDShippingMethodWithHttpInfo(basketId, shipmentId, body)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


    /**
     * Marks a basket as storefront basket.
     * @param {String} basketId the basket id
     * @param {Object} opts Optional parameters
     * @param {Boolean} opts.exchange
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Basket} and HTTP response
     */
    putBasketsByIDStorefrontWithHttpInfo(basketId, opts) {
        opts = opts || {}
        const postBody = null

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


        const pathParams = {
            basket_id: basketId
        }
        const queryParams = {
            exchange: opts.exchange
        }
        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 = Basket

        return this.apiClient.callApi(
            '/baskets/{basket_id}/storefront', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * Marks a basket as storefront basket.
     * @param {String} basketId the basket id
     * @param {Object} opts Optional parameters
     * @param {Boolean} opts.exchange
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Basket}
     */
    putBasketsByIDStorefront(basketId, opts) {
        return this.putBasketsByIDStorefrontWithHttpInfo(basketId, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


}