Javascript.api.mustache Maven / Gradle / Ivy
The newest version!
{{>licenseInfo}}
{{=< >=}}(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['<#invokerPackage><&invokerPackage>/ApiClient'<#imports>, '<#invokerPackage><&invokerPackage>/<#modelPackage><&modelPackage>/'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient')<#imports>, require('../<#modelPackage><&modelPackage>/'));
} else {
// Browser globals (root is window)
if (!root.<&moduleName>) {
root.<&moduleName> = {};
}
root.<&moduleName>.<&classname> = factory(root.<&moduleName>.ApiClient<#imports>, root.<&moduleName>.);
}
}(this, function(ApiClient<#imports>, ) {
'use strict';
<#emitJSDoc> /**
* service.
* @module <#invokerPackage><&invokerPackage>/<#apiPackage><&apiPackage>/
* @version
*/
/**
* 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.
*/
var exports = function(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 data of type {@link <&vendorExtensions.x-jsdoc-type>}
*/
this. = function() {<#hasOptionalParams>
opts = opts || {};
var postBody = <#bodyParam><#required><^required>opts['']<^bodyParam>null;
<#allParams><#required>
// verify the required parameter '' is set
if ( == undefined || == null) {
throw "Missing the required parameter '' when calling ";
}
var pathParams = {<#pathParams>
'': <#required><^required>opts['']<#hasMore>,
};
var queryParams = {<#queryParams>
'': <#collectionFormat>this.apiClient.buildCollectionParam(<#required><^required>opts[''], '') <^collectionFormat><#required><^required>opts['']<#hasMore>,
};
var headerParams = {<#headerParams>
'': <#required><^required>opts['']<#hasMore>,
};
var formParams = {<#formParams>
'': <#collectionFormat>this.apiClient.buildCollectionParam(<#required><^required>opts[''], '') <^collectionFormat><#required><^required>opts['']<#hasMore>,
};
var authNames = [<#authMethods>''<#hasMore>, ];
var contentTypes = [<#consumes>'<& mediaType>'<#hasMore>, ];
var accepts = [<#produces>'<& mediaType>'<#hasMore>, ];
var returnType = <#returnType><&returnType><^returnType>null;
return this.apiClient.callApi(
'<&path>', '',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType<^usePromises>, callback
);
}
};
return exports;
}));<={{ }}=>