/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* 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 Category from '../models/Category'
import CategoryResult from '../models/CategoryResult'
/**
* Categories service.
* @module api/CategoriesApi
* @version 20.4
*/
export default class CategoriesApi {
/**
* Constructs a new CategoriesApi.
* @alias module:api/CategoriesApi
* @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
}
/**
* When you use the URL template below, the server returns a category identified by its id; by default, the server also returns the first level of subcategories, but you can specify another level by setting the levels parameter. The server only returns online categories.
* @param {String} id The id of the requested category.
* @param {Object} opts Optional parameters
* @param {Number} opts.levels
* @param {String} opts.locale
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Category} and HTTP response
*/
getCategoriesByIDWithHttpInfo(id, opts) {
opts = opts || {}
const postBody = null
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error('Missing the required parameter \'id\' when calling getCategoriesByID')
}
const pathParams = {
id
}
const queryParams = {
levels: opts.levels,
locale: opts.locale
}
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 = Category
return this.apiClient.callApi(
'/categories/{id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
)
}
/**
* When you use the URL template below, the server returns a category identified by its id; by default, the server also returns the first level of subcategories, but you can specify another level by setting the levels parameter. The server only returns online categories.
* @param {String} id The id of the requested category.
* @param {Object} opts Optional parameters
* @param {Number} opts.levels
* @param {String} opts.locale
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Category}
*/
getCategoriesByID(id, opts) {
return this.getCategoriesByIDWithHttpInfo(id, opts)
.then((response_and_data) => {
return response_and_data.data
})
}
/**
* @param {Array.<String>} ids
* @param {Object} opts Optional parameters
* @param {Number} opts.levels
* @param {String} opts.locale
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/CategoryResult} and HTTP response
*/
getCategoriesByIDsWithHttpInfo(ids, opts) {
opts = opts || {}
const postBody = null
// verify the required parameter 'ids' is set
if (ids === undefined || ids === null) {
throw new Error('Missing the required parameter \'ids\' when calling getCategoriesByIDs')
}
const pathParams = {
ids
}
const queryParams = {
levels: opts.levels,
locale: opts.locale
}
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 = CategoryResult
return this.apiClient.callApi(
'/categories/({ids})', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
)
}
/**
* @param {Array.<String>} ids
* @param {Object} opts Optional parameters
* @param {Number} opts.levels
* @param {String} opts.locale
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/CategoryResult}
*/
getCategoriesByIDs(ids, opts) {
return this.getCategoriesByIDsWithHttpInfo(ids, opts)
.then((response_and_data) => {
return response_and_data.data
})
}
}