Javascript.es6.api.mustache Maven / Gradle / Ivy
{{>licenseInfo}}
{{=< >=}}
import ApiClient from "../ApiClient";
<#imports>import from '../<#modelPackage><&modelPackage>/';
<#emitJSDoc>/**
* service.
* @module <#invokerPackage><&invokerPackage>/<#apiPackage><&apiPackage>/
* @version
*/
export default class {
<#emitJSDoc>/**
* Constructs a new <&classname>. <#description>
*
* @alias module:<#invokerPackage><&invokerPackage>/<#apiPackage>/
* @class
* @param {module:<#invokerPackage><&invokerPackage>/ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:<#invokerPackage><&invokerPackage>/ApiClient#instance} if unspecified.
*/
constructor(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
}
<#operations><#operation><#emitJSDoc><^usePromises>
/**
* Callback function to receive the result of the operation.
* @callback module:<#invokerPackage>/ <#apiPackage>/ ~Callback
* @param {String} error Error message, if any.
* @param <#vendorExtensions.x-jsdoc-type>{<&vendorExtensions.x-jsdoc-type>} data The data returned by the service call.<^vendorExtensions.x-jsdoc-type>data This operation does not return a value.
* @param {String} response The complete HTTP response.
*/
/**<#summary>
* <#notes>
* <#allParams><#required>
* @param {<&vendorExtensions.x-jsdoc-type>} <#hasOptionalParams>
* @param {Object} opts Optional parameters<#allParams><^required>
* @param {<&vendorExtensions.x-jsdoc-type>} opts. <#defaultValue> (default to <.>)<^usePromises>
* @param {module:<#invokerPackage><&invokerPackage>/<#apiPackage><&apiPackage>/<&classname>~Callback} callback The callback function, accepting three arguments: error, data, response<#returnType>
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}<#usePromises>
* @return {Promise} a {@link https://www.promisejs.org/|Promise}<#returnType>, with an object containing data of type {@link <&vendorExtensions.x-jsdoc-type>} and HTTP response<^returnType>, with an object containing HTTP response
*/
<#usePromises>WithHttpInfo() {<#hasOptionalParams>
opts = opts || {};
let postBody = <#bodyParam><#required><^required>opts['']<^bodyParam>null;
<#allParams><#required>
// verify the required parameter '' is set
if ( === undefined || === null) {
throw new Error("Missing the required parameter '' when calling ");
}
let pathParams = {<#pathParams>
'': <#required><^required>opts['']<#hasMore>,
};
let queryParams = {<#queryParams>
'': <#collectionFormat>this.apiClient.buildCollectionParam(<#required><^required>opts[''], '') <^collectionFormat><#required><^required>opts['']<#hasMore>,
};
let headerParams = {<#headerParams>
'': <#required><^required>opts['']<#hasMore>,
};
let formParams = {<#formParams>
'': <#collectionFormat>this.apiClient.buildCollectionParam(<#required><^required>opts[''], '') <^collectionFormat><#required><^required>opts['']<#hasMore>,
};
let authNames = [<#authMethods>''<#hasMore>, ];
let contentTypes = [<#consumes>'<& mediaType>'<#hasMore>, ];
let accepts = [<#produces>'<& mediaType>'<#hasMore>, ];
let returnType = <#vendorExtensions.x-return-type><&vendorExtensions.x-return-type><^vendorExtensions.x-return-type>null;
return this.apiClient.callApi(
'<&path>', '',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType<^usePromises>, callback
);
}
<#usePromises>
<#emitJSDoc>
/**<#summary>
* <#notes>
* <#allParams><#required>
* @param {<&vendorExtensions.x-jsdoc-type>} <#hasOptionalParams>
* @param {Object} opts Optional parameters<#allParams><^required>
* @param {<&vendorExtensions.x-jsdoc-type>} opts. <#defaultValue> (default to <.>)<^usePromises>
* @param {module:<#invokerPackage><&invokerPackage>/<#apiPackage><&apiPackage>/<&classname>~Callback} callback The callback function, accepting three arguments: error, data, response<#returnType>
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}<#usePromises>
* @return {Promise} a {@link https://www.promisejs.org/|Promise}<#returnType>, with data of type {@link <&vendorExtensions.x-jsdoc-type>}
*/
() {
return this.WithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
}
<={{ }}=>