Source: api/AiApi.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 ProductRecommendationsResult from '../models/ProductRecommendationsResult'

/**
* Ai service.
* @module api/AiApi
* @version 20.4
*/
export default class AiApi {

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



    /**
     * This is a beta feature that has been canceled. A future release will include the ability to obtain product recommendations by making direct calls to the Commerce Cloud Einstein API.  Returns product recommendations based on the given product or category IDs.
     * @param {String} recommenderName The recommender name.
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.products
     * @param {Array.<String>} opts.categories
     * @param {String} opts.uuid
     * @param {Array.<String>} opts.expand
     * @param {Array.<String>} opts.inventoryIds
     * @param {String} opts.currency
     * @param {Boolean} opts.allImages
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/ProductRecommendationsResult} and HTTP response
     */
    getAiProductRecommendationsByIDWithHttpInfo(recommenderName, opts) {
        opts = opts || {}
        const postBody = null

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


        const pathParams = {
            recommender_name: recommenderName
        }
        const queryParams = {
            products: this.apiClient.buildCollectionParam(opts.products, 'csv'),
            categories: this.apiClient.buildCollectionParam(opts.categories, 'csv'),
            uuid: opts.uuid,
            expand: this.apiClient.buildCollectionParam(opts.expand, 'csv'),
            inventory_ids: this.apiClient.buildCollectionParam(opts.inventoryIds, 'csv'),
            currency: opts.currency,
            all_images: opts.allImages
        }
        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 = ProductRecommendationsResult

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

    /**
     * This is a beta feature that has been canceled. A future release will include the ability to obtain product recommendations by making direct calls to the Commerce Cloud Einstein API.  Returns product recommendations based on the given product or category IDs.
     * @param {String} recommenderName The recommender name.
     * @param {Object} opts Optional parameters
     * @param {Array.<String>} opts.products
     * @param {Array.<String>} opts.categories
     * @param {String} opts.uuid
     * @param {Array.<String>} opts.expand
     * @param {Array.<String>} opts.inventoryIds
     * @param {String} opts.currency
     * @param {Boolean} opts.allImages
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/ProductRecommendationsResult}
     */
    getAiProductRecommendationsByID(recommenderName, opts) {
        return this.getAiProductRecommendationsByIDWithHttpInfo(recommenderName, opts)
            .then((response_and_data) => {
                return response_and_data.data
            })
    }


}