/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Copyright (c) 2017 Mobify Research & Development Inc. All rights reserved. */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* OCC No description provided (generated by Swagger Codegen
* https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: v2
*
*
* 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 Voucher from '../models/Voucher'
/**
* Vouchers service.
* @module api/VouchersApi
* @version v2
*/
export default class VouchersApi {
/**
* Constructs a new VouchersApi.
* @alias module:api/VouchersApi
* @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
}
/**
* getVoucher Returns details of a single voucher according to a voucher
* code. Security: Permitted only for trusted client
* @param {String} code Voucher identifier (code)
* @param {Object} opts Optional parameters
* @param {String} opts.fields Response configuration (list of fields, which
* should be returned in response)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
* object containing data of type {@link module:models/Voucher} and
* HTTP response
*/
vouchersByCodeWithHttpInfo(code, opts) {
opts = opts || {}
const postBody = null
// verify the required parameter 'code' is set
if (code === undefined || code === null) {
throw new Error('Missing the required parameter \'code\' when calling getVoucher')
}
const pathParams = {
code
}
const queryParams = {
fields: opts.fields
}
const headerParams = {
}
const formParams = {
}
const authNames = ['auth']
const contentTypes = ['application/json']
const accepts = ['application/json']
const returnType = Voucher
return this.apiClient.callApi(
'/vouchers/{code}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
)
}
/**
* getVoucher Returns details of a single voucher according to a voucher
* code. Security: Permitted only for trusted client
* @param {String} code Voucher identifier (code)
* @param {Object} opts Optional parameters
* @param {String} opts.fields Response configuration (list of fields, which
* should be returned in response)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
* of type {@link module:models/Voucher}
*/
getVoucher(code, opts) {
return this.vouchersByCodeWithHttpInfo(code, opts)
.then((response) => {
return response.data
})
}
}