All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Javascript.libraries.javascript.api.mustache Maven / Gradle / Ivy

There is a newer version: 7.7.0
Show newest version
{{>licenseInfo}}

{{=< >=}}
import ApiClient from "../ApiClient";
<#imports>import <&import> from '../<#modelPackage><&modelPackage>/';


<#emitJSDoc>/**
*  service.
* @module <#invokerPackage><&invokerPackage>/<#apiPackage><&apiPackage>/
* @version <&projectVersion>
*/
export default class <&classname> {

    <#emitJSDoc>/**
    * Constructs a new <&classname>. <#description>
    * 
    * @alias module:<#invokerPackage><&invokerPackage>/<#apiPackage><&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 <&operationId> operation.
     * @callback module:<#invokerPackage><&invokerPackage>/<#apiPackage><&apiPackage>/<&classname>~<&operationId>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>
     * <&summary><#notes>
     * <¬es><#allParams><#required>
     * @param {<&vendorExtensions.x-jsdoc-type>} <¶mName> <&description><#hasOptionalParams>
     * @param {Object} opts Optional parameters<#allParams><^required>
     * @param {<&vendorExtensions.x-jsdoc-type>} [<¶mName><#defaultValue> = <&.>)] <&description><^usePromises>
     * @param {module:<#invokerPackage><&invokerPackage>/<#apiPackage><&apiPackage>/<&classname>~<&operationId>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() {
      <#vendorExtensions.x-codegen-has-optional-params>
      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['']<^-last>,
      };
      let queryParams = {<#queryParams>
        '': <#collectionFormat>this.apiClient.buildCollectionParam(<#required><^required>opts[''], '')<^collectionFormat><#required><^required>opts['']<^-last>,
      };
      let headerParams = {<#headerParams>
        '': <#required><^required>opts['']<^-last>,
      };
      let formParams = {<#formParams>
        '': <#collectionFormat>this.apiClient.buildCollectionParam(<#required><^required>opts[''], '')<^collectionFormat><#required><^required>opts['']<^-last>,
      };

      let authNames = [<#authMethods>''<^-last>, ];
      let contentTypes = [<#consumes>'<& mediaType>'<^-last>, ];
      let accepts = [<#produces>'<& mediaType>'<^-last>, ];
      let returnType = <#vendorExtensions.x-return-type><&vendorExtensions.x-return-type><^vendorExtensions.x-return-type>null;
      <#servers.0>
      let basePaths = [<#servers>''<^-last>, ];
      let basePath = basePaths[0]; // by default use the first one in "servers" defined in OpenAPI
      if (typeof opts['_base_path_index'] !== 'undefined') {
        if (opts['_base_path_index']  >= basePaths.length || opts['_base_path_index'] <  0) {
          throw new Error("Invalid index " + opts['_base_path_index'] + " when selecting the host settings. Must be less than " + basePaths.length);
        }
        basePath = basePaths[opts['_base_path_index']];
      }

      
      return this.apiClient.callApi(
        '<&path>', '',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, <#servers.0>basePath<^servers.0>null<^usePromises>, callback
      );
    }
<#usePromises>
<#emitJSDoc>

    /**<#summary>
     * <&summary><#notes>
     * <¬es><#allParams><#required>
     * @param {<&vendorExtensions.x-jsdoc-type>} <¶mName> <&description><#hasOptionalParams>
     * @param {Object} opts Optional parameters<#allParams><^required>
     * @param {<&vendorExtensions.x-jsdoc-type>} opts.<¶mName> <&description><#defaultValue> (default to <&.>)<^usePromises>
     * @param {module:<#invokerPackage><&invokerPackage>/<#apiPackage><&apiPackage>/<&classname>~<&operationId>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;
        });
    }



}
<={{ }}=>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy