# {{projectName}}

{{moduleName}} - JavaScript client for {{projectName}}
{{#appDescription}}
{{{appDescription}}}
{{/appDescription}}
This SDK is automatically generated by Electrode Native API generator.
It uses swagger to gernerate bridge code for Swift, Android and React Native.

- API version: {{appVersion}}
- Package version: {{projectVersion}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}

## Installation

### For [Node.js](https://nodejs.org/)

#### npm

To publish the library as a [npm](https://www.npmjs.com/),
please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).

Then install it via:

```shell
npm install {{{projectName}}} --save
```

#### git
#
If the library is hosted at a git repository, e.g.
https://github.com/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}}
then install it via:

```shell
    npm install {{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}} --save
```

## Getting Started

Please follow the [installation](#installation) instruction and execute the following JS code:

```javascript
import { {{moduleName}} } from '{{{projectName}}}';
{{#apiInfo}}{{#apis.0}}{{#operations}}{{#operation.0}}{{#hasAuthMethods}}
const defaultClient = {{{moduleName}}}.ApiClient.instance;
{{#authMethods}}{{#isBasic}}
// Configure HTTP basic authorization: {{{name}}}
const {{{name}}} = defaultClient.authentications['{{{name}}}'];
{{{name}}}.username = 'YOUR USERNAME'
{{{name}}}.password = 'YOUR PASSWORD'{{/isBasic}}{{#isApiKey}}
// Configure API key authorization: {{{name}}}
const {{{name}}} = defaultClient.authentications['{{{name}}}'];
{{{name}}}.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//{{{name}}}.apiKeyPrefix['{{{keyParamName}}}'] = "Token"{{/isApiKey}}{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}}
const {{{name}}} = defaultClient.authentications['{{{name}}}'];
{{{name}}}.accessToken = "YOUR ACCESS TOKEN"{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}

const api = new {{{moduleName}}}.{{{classname}}}(){{#hasParams}}
{{#_hasRequiredParams}}{{#allParams}}{{#required}}
    const {{{paramName}}} = {{{example}}}; // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}}
{{/required}}{{/allParams}}{{/_hasRequiredParams}}{{#hasOptionalParams}}
    const opts = { {{#allParams}}{{^required}}
  '{{{paramName}}}': {{{example}}}{{#_hasMoreOptional}},{{/_hasMoreOptional}} // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}}{{/required}}{{/allParams}}
};{{/hasOptionalParams}}{{/hasParams}}
api.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#_hasMoreRequired}}, {{/_hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#_hasRequiredParams}}, {{/_hasRequiredParams}}opts{{/hasOptionalParams}}).then(function({{#returnType}}data{{/returnType}}) {
  {{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
}, function(error) {
  console.error(error);
});

{{/operation.0}}{{/operations}}{{/apis.0}}{{/apiInfo}}
```

## Documentation for API Endpoints

All URIs are relative to *{{{basePath}}}*

Class | Method |request type | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}.{{classname}}* | [**{{operationId}}**]({{{apiDocPath}}}{{classname}}.md#{{operationId}}) | **{{#isEvent}}event{{/isEvent}}{{^isEvent}}request{{/isEvent}}** {{{path}}} | {{#summary}}{{{summary}}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}

{{#models.0}}
## Documentation for Models
{{/models.0}}
{{#models}}{{#model}} - [{{moduleName}}.{{classname}}]({{{modelDocPath}}}{{classname}}.md)
{{/model}}{{/models}}

## Documentation for Authorization

{{^authMethods}} All endpoints do not require authorization.
{{/authMethods}}{{#authMethods.0}} Authentication schemes defined for the API:{{/authMethods.0}}
{{#authMethods}}### {{name}}

{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}}  - {{scope}}: {{{description}}}
{{/scopes}}
{{/isOAuth}}

{{/authMethods}}
