-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: updating templates for typescript-axios sdk
- Loading branch information
1 parent
fffdaf0
commit 3f4c5f4
Showing
5 changed files
with
50 additions
and
126 deletions.
There are no files selected for viewing
117 changes: 25 additions & 92 deletions
117
templates/openapi-generator/typescript-axios/README.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,46 @@ | ||
# FattureInCloud TypeScript SDK | ||
|
||
[![NPM](https://img.shields.io/npm/v/@fattureincloud/fattureincloud-ts-sdk?color=g)](https://www.npmjs.com/package/@fattureincloud/fattureincloud-ts-sdk) ![unit tests](https://github.com/fattureincloud/fattureincloud-ts-sdk/actions/workflows/validate.yml/badge.svg) | ||
|
||
{{npmName}} - TypeScript/JavaScript client for Fatture in Cloud API. | ||
|
||
## {{npmName}}@{{npmVersion}} | ||
|
||
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: | ||
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments: | ||
|
||
- API version: {{appVersion}} | ||
- Package version: {{npmVersion}} | ||
Environment | ||
* Node.js | ||
* Webpack | ||
* Browserify | ||
|
||
Language level | ||
* ES5 - you must have a Promises/A+ library installed | ||
* ES6 | ||
|
||
Module system | ||
* CommonJS | ||
* ES6 module system | ||
|
||
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) | ||
|
||
|
||
{{#infoUrl}} | ||
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) | ||
{{/infoUrl}} | ||
It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html)) | ||
|
||
## Installation | ||
### Building | ||
|
||
### For [Node.js](https://nodejs.org/) | ||
|
||
Using npm: | ||
|
||
```shell | ||
npm install {{{npmName}}} | ||
To build and compile the typescript sources to javascript use: | ||
``` | ||
|
||
Using yarn: | ||
|
||
```shell | ||
yarn add {{{npmName}}} | ||
npm install | ||
npm run build | ||
``` | ||
|
||
## Getting Started | ||
|
||
Please follow the [installation](#installation) instruction and execute the following TS code: | ||
### Publishing | ||
|
||
```javascript | ||
import { Configuration, ArchiveApi , CreateArchiveDocumentRequest } from '@fattureincloud/fattureincloud-ts-sdk'; | ||
First build the package then run `npm publish` | ||
|
||
// Configure OAuth2 access token for authorization: | ||
const apiConfig = new Configuration({ | ||
accessToken: "YOUR ACCESS TOKEN" | ||
}); | ||
### Consuming | ||
|
||
let apiInstance = new ArchiveApi(apiConfig); | ||
let companyId = 12345; // Number | The ID of the company. | ||
navigate to the folder of your consuming project and run one of the following commands. | ||
|
||
let createArchiveDocumentRequest: CreateArchiveDocumentRequest = {"data":{"date":"2021-08-20","category":"Altri documenti","description":"spesa 1","attachment_token":"ibfjdbf94ey9w94g3w894qbasrga"}} // CreateArchiveDocumentRequest | The Archive Document. | ||
_published:_ | ||
|
||
apiInstance.createArchiveDocument(companyId, createArchiveDocumentRequest).then((data) => { | ||
console.log('API called successfully. Returned data: ' + data); | ||
}, (error) => { | ||
console.error(error); | ||
}); | ||
``` | ||
npm install {{npmName}}@{{npmVersion}} --save | ||
``` | ||
|
||
## Documentation for API Endpoints | ||
|
||
All URIs are relative to *{{basePath}}* | ||
|
||
Class | Method | HTTP request | Description | ||
------------ | ------------- | ------------- | ------------- | ||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**](docs/{{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | ||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} | ||
|
||
## Documentation for Models | ||
|
||
{{#models}}{{#model}} - [{{classname}}](docs/{{modelDocPath}}{{classname}}.md) | ||
{{/model}}{{/models}} | ||
|
||
## Documentation for Authorization | ||
|
||
{{^authMethods}} | ||
All endpoints do not require authorization. | ||
{{/authMethods}} | ||
{{#authMethods}} | ||
{{#last}} Authentication schemes defined for the API:{{/last}} | ||
|
||
### {{name}} | ||
|
||
{{#isApiKey}} | ||
|
||
- **Type**: API key | ||
- **API key parameter name**: {{keyParamName}} | ||
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} | ||
{{/isApiKey}} | ||
{{#isBasic}} | ||
{{#isBasicBasic}} | ||
- **Type**: HTTP basic authentication | ||
{{/isBasicBasic}} | ||
{{#isBasicBearer}} | ||
- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} | ||
{{/isBasicBearer}} | ||
{{/isBasic}} | ||
{{#isOAuth}} | ||
|
||
- **Type**: OAuth | ||
- **Flow**: {{flow}} | ||
- **Authorization URL**: {{authorizationUrl}} | ||
- **Scopes**: {{^scopes}}N/A{{/scopes}} | ||
{{#scopes}} - _{{scope}}_: {{description}} | ||
{{/scopes}} | ||
{{/isOAuth}} | ||
_unPublished (not recommended):_ | ||
|
||
{{/authMethods}} | ||
``` | ||
npm install PATH_TO_GENERATED_PACKAGE --save | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 12 additions & 25 deletions
37
templates/openapi-generator/typescript-axios/package.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters