/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* 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 Content from '../models/Content'
import ContentResult from '../models/ContentResult'
/**
* Content service.
* @module api/ContentApi
* @version 20.4
*/
export default class ContentApi {
/**
* Constructs a new ContentApi.
* @alias module:api/ContentApi
* @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
}
/**
* To access a content asset, you construct a URL using the template shown below. This template requires you to specify a content asset id. In response, the server returns a corresponding content asset document. Only content assets, which are marked as online are returned. An assignment to a folder is not necessary.
* @param {String} id The id of the requested content asset.
* @param {Object} opts Optional parameters
* @param {String} opts.locale
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/Content} and HTTP response
*/
getContentByIDWithHttpInfo(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 getContentByID')
}
const pathParams = {
id
}
const queryParams = {
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 = Content
return this.apiClient.callApi(
'/content/{id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
)
}
/**
* To access a content asset, you construct a URL using the template shown below. This template requires you to specify a content asset id. In response, the server returns a corresponding content asset document. Only content assets, which are marked as online are returned. An assignment to a folder is not necessary.
* @param {String} id The id of the requested content asset.
* @param {Object} opts Optional parameters
* @param {String} opts.locale
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/Content}
*/
getContentByID(id, opts) {
return this.getContentByIDWithHttpInfo(id, opts)
.then((response_and_data) => {
return response_and_data.data
})
}
/**
* @param {Array.<String>} ids
* @param {Object} opts Optional parameters
* @param {String} opts.locale
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:models/ContentResult} and HTTP response
*/
getContentByIDsWithHttpInfo(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 getContentByIDs')
}
const pathParams = {
ids
}
const queryParams = {
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 = ContentResult
return this.apiClient.callApi(
'/content/({ids})', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
)
}
/**
* @param {Array.<String>} ids
* @param {Object} opts Optional parameters
* @param {String} opts.locale
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:models/ContentResult}
*/
getContentByIDs(ids, opts) {
return this.getContentByIDsWithHttpInfo(ids, opts)
.then((response_and_data) => {
return response_and_data.data
})
}
}