Skip to content

Commit 08d5f8a

Browse files
chore: upkeep
1 parent 7bbc7ea commit 08d5f8a

File tree

7 files changed

+143
-29
lines changed

7 files changed

+143
-29
lines changed

.github/assets/repo-header-a3.png

14.1 KB
Loading

README.md

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# OpenApi NodeJS Client
1+
# Openapi NodeJS Client
22

33
## Installation
44

@@ -7,15 +7,15 @@ npm install @altravia/openapi
77
```
88

99
```js
10-
const OpenApi = require('@altravia/openapi').default;
10+
const Openapi = require('@altravia/openapi').default;
1111
```
1212

1313
## Usage
1414
In order to use the client, you need an active openapi.it account. You can register for free on [developers.openapi.it](developers.openapi.it).
1515

1616
We can now initialize the client with the credentials that we find in our dashboard and a **valid token**
1717
```js
18-
const client = await OpenApi.init('production', your@email.com, your_production_api_key, your_token);
18+
const client = await Openapi.init('production', your@email.com, your_production_api_key, your_token);
1919
```
2020
Where `production` (or `test`) is the environment we want to work in; please note that API Keys and tokens for the production and test environment are different.
2121

@@ -35,7 +35,7 @@ const scopes = [
3535
// Both syntax are accepted
3636
];
3737

38-
let client = await OpenApi.init('test', your@email.com, your_api_key);
38+
let client = await Openapi.init('test', your@email.com, your_api_key);
3939
const token = await client.generateToken(scopes);
4040

4141
// The new token will be set and returned,
@@ -107,3 +107,42 @@ While most of them are straight forward, some may need additional explanation. P
107107
[VISENGINE](/docs/visengine.md)
108108

109109
[SMS](/docs/sms.md)
110+
111+
## Contributing
112+
113+
Contributions are always welcome! Whether you want to report bugs, suggest new features, improve documentation, or contribute code, your help is appreciated.
114+
115+
See [docs/contributing.md](docs/contributing.md) for detailed instructions on how to get started. Please make sure to follow this project's [docs/code-of-conduct.md](docs/code-of-conduct.md) to help maintain a welcoming and collaborative environment.
116+
117+
## Authors
118+
119+
Meet the project authors:
120+
121+
- Michael Cuffaro ([@maiku1008](https://www.github.com/maiku1008))
122+
- Openapi Team ([@openapi-it](https://github.com/openapi-it))
123+
124+
## Partners
125+
126+
Meet our partners using Openapi or contributing to this SDK:
127+
128+
- [Blank](https://www.blank.app/)
129+
- [Credit Safe](https://www.creditsafe.com/)
130+
- [Deliveroo](https://deliveroo.it/)
131+
- [Gruppo MOL](https://molgroupitaly.it/it/)
132+
- [Jakala](https://www.jakala.com/)
133+
- [Octotelematics](https://www.octotelematics.com/)
134+
- [OTOQI](https://otoqi.com/)
135+
- [PWC](https://www.pwc.com/)
136+
- [QOMODO S.R.L.](https://www.qomodo.me/)
137+
- [SOUNDREEF S.P.A.](https://www.soundreef.com/)
138+
139+
## License
140+
141+
This project is licensed under the [MIT License](LICENSE).
142+
143+
The MIT License is a permissive open-source license that allows you to freely use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, provided that the original copyright notice and this permission notice are included in all copies or substantial portions of the software.
144+
145+
In short, you are free to use this SDK in your personal, academic, or commercial projects, with minimal restrictions. The project is provided "as-is", without any warranty of any kind, either expressed or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.
146+
147+
For more details, see the full license text at the [MIT License page](https://choosealicense.com/licenses/mit/).
148+

docs/code-of-conduct.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project a harassment-free experience for everyone.
6+
7+
## Our Standards
8+
9+
Examples of positive behavior:
10+
11+
- Using welcoming and inclusive language
12+
- Being respectful of differing viewpoints and experiences
13+
- Gracefully accepting constructive criticism
14+
- Focusing on what is best for the community
15+
- Showing empathy toward other community members
16+
17+
Examples of unacceptable behavior:
18+
19+
- Harassment, intimidation, or discrimination
20+
- Public or private insults and derogatory comments
21+
- Publishing others’ private information without consent
22+
- Any other conduct reasonably considered inappropriate
23+
24+
## Enforcement
25+
26+
Instances of unacceptable behavior may be reported by contacting the project team at `<hello@openapi.com>`. All complaints will be reviewed promptly and fairly.
27+
28+
## Attribution
29+
30+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.

docs/contributing.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Contributing to Openapi SDK
2+
3+
Thanks for considering contributing! 🎉
4+
We welcome all kinds of contributions: bug reports, feature requests, documentation improvements, and code enhancements.
5+
6+
## How to Contribute
7+
8+
1. **Fork the repository** and clone it locally:
9+
```bash
10+
git clone https://github.com/<username>/<repo>.git
11+
```
12+
13+
2. **Create a branch** for your feature or fix:
14+
```bash
15+
git checkout -b feature/your-feature-name
16+
```
17+
18+
3. **Make your changes** and commit them:
19+
```bash
20+
git commit -m "Add some feature"
21+
```
22+
23+
4. **Push your branch** to your fork:
24+
```bash
25+
git push origin feature/your-feature-name
26+
```
27+
28+
5. **Open a Pull Request** describing your changes.
29+
30+
## Guidelines
31+
32+
* Follow the existing **Rust coding style**.
33+
* Include **tests** for new features or bug fixes when applicable.
34+
* Keep **commit messages clear and concise**.
35+
* Update **documentation** as needed for your changes.
36+
37+
## Reporting Issues
38+
39+
To report bugs or request features, please **open an issue** on GitHub including:
40+
41+
* Clear description of the problem or feature.
42+
* Steps to reproduce (if applicable).
43+
* Relevant logs or screenshots.
44+
45+
Thank you for helping improve Openapi SDK! 🚀

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@altravia/openapi",
33
"version": "1.4.2",
4-
"description": "Official OpenApi NodeJS Client",
4+
"description": "Official Openapi NodeJS Client",
55
"main": "dist/index.js",
66
"files": [
77
"dist"
@@ -16,7 +16,7 @@
1616
"homepage": "https://developers.openapi.it",
1717
"repository": {
1818
"type": "git",
19-
"url": "https://github.com/openapi-it/OpenApi-NodeJS"
19+
"url": "https://github.com/openapi-it/Openapi-NodeJS"
2020
},
2121
"author": "Altravia Srl",
2222
"license": "MIT",

src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface Service {
3232
environment: Environment;
3333
}
3434

35-
class OpenApi {
35+
class Openapi {
3636
client?: AxiosInstance;
3737
environment: Environment;
3838
token?: string;
@@ -63,7 +63,7 @@ class OpenApi {
6363
}
6464

6565
/**
66-
* Crea il client di connessione con OpenApi
66+
* Crea il client di connessione con Openapi
6767
* Se l'autoRenew è attivo, controllerá lo stato del token
6868
* prima di istanziare il client, ed in caso lo rinnoverà
6969
*/
@@ -79,7 +79,7 @@ class OpenApi {
7979
if (tokenData.status === 200 ) {
8080
const scopes: Array<any> = tokenData.data.data[0].scopes;
8181
scopes.forEach(scope => {
82-
const url = OpenApi.splitScope(scope);
82+
const url = Openapi.splitScope(scope);
8383
this.scopes.push({ mode: scope.split(':', 1), domain: url[0], method: url[1] });
8484
})
8585

@@ -134,7 +134,7 @@ class OpenApi {
134134
scope = '*:' + scope.replace('/', '') + '/*';
135135
}
136136

137-
const url = OpenApi.splitScope(scope);
137+
const url = Openapi.splitScope(scope);
138138
return `${scope.split(':', 1)}:${this.prefix}${url[0].replace(/^test.|dev./, '')}/${url[1]}`
139139
});
140140

@@ -165,7 +165,7 @@ class OpenApi {
165165
}
166166

167167
static async init(environment: Environment, username: string, apiKey: string, token?: string, autoRenew = true) {
168-
const openapi = new OpenApi(environment, username, apiKey);
168+
const openapi = new Openapi(environment, username, apiKey);
169169

170170
if (token) {
171171
await openapi.createClient(token, autoRenew);
@@ -175,4 +175,4 @@ class OpenApi {
175175
}
176176
}
177177

178-
export default OpenApi;
178+
export default Openapi;

test/client.test.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// import OpenApi from '../dist/index';
1+
// import Openapi from '../dist/index';
22
const fs = require('fs');
3-
let OpenApi = require('../dist/index').default;
3+
let Openapi = require('../dist/index').default;
44

55
const scopes = [
66
"GET:ws.ufficiopostale.com/raccomandate",
@@ -30,27 +30,27 @@ const scopes = [
3030

3131
test('init', async function() {
3232

33-
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
33+
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
3434
const token = await client.generateToken(scopes);
3535
expect(typeof token === 'string').toBeTruthy()
3636
})
3737

3838
test('initWithString', async function() {
3939

40-
let client = await OpenApi.init('production', process.env.OPENAPI_USERNAME, process.env.API_KEY);
40+
let client = await Openapi.init('production', process.env.OPENAPI_USERNAME, process.env.API_KEY);
4141
const token = await client.generateToken('imprese.altravia.com');
4242
expect(typeof token === 'string').toBeTruthy()
4343
console.log(client.scopes);
4444
})
4545

4646
test('initWithToken', async function() {
47-
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
47+
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
4848
expect(client.comuni).toBeDefined();
4949
})
5050

5151
test('initWithOldToken', async function() {
5252

53-
let client = new OpenApi('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
53+
let client = new Openapi('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
5454

5555
const token = process.env.OLD_TOKEN;
5656
expect(typeof token === 'string').toBe(true);
@@ -60,7 +60,7 @@ test('initWithOldToken', async function() {
6060

6161
test('initWithSkip', async function() {
6262

63-
let client = new OpenApi('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
63+
let client = new Openapi('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
6464

6565
const token = process.env.TOKEN;
6666
expect(typeof token === 'string').toBe(true);
@@ -79,7 +79,7 @@ test('testComuni', async function() {
7979
const token = process.env.TOKEN;
8080
expect(typeof token === 'string').toBe(true);
8181

82-
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, token);
82+
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, token);
8383

8484

8585
const cap = await client.comuni.getCitiesByCap('00121')
@@ -98,7 +98,7 @@ test('testComuni', async function() {
9898
})
9999

100100
test('testImprese', async function() {
101-
let client = await OpenApi.init('production', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
101+
let client = await Openapi.init('production', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
102102
console.log(JSON.stringify(client.scopes, null, 2));
103103

104104
const piva = await client.imprese.getByPartitaIva('12485671007')
@@ -125,14 +125,14 @@ test('testImprese', async function() {
125125
})
126126

127127
test('testPa', async function() {
128-
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
128+
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
129129
client.generateToken(scopes)
130130
const piva = await client.pa.findPa('00559720982')
131131
expect(piva).toBeDefined();
132132
})
133133

134134
test('testFD', async function() {
135-
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
135+
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
136136
// const prodotti = await client.firmaDigitale.getProducts();
137137
// expect(prodotti).toBeDefined();
138138

@@ -161,13 +161,13 @@ test('testFD', async function() {
161161
})
162162

163163
test('testMT', async function() {
164-
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
164+
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
165165
const lotto = await client.marcheTemporali.checkLotto('FAKETSA.altravia16', 'FAKE9R155S9VF');
166166
expect(lotto.used).toBeDefined()
167167
})
168168

169169
test('testValutometro', async function() {
170-
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
170+
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
171171
const p = await client.valutometro.listPropertyTypes()
172172
expect(p[0]).toBeDefined()
173173

@@ -180,7 +180,7 @@ test('testValutometro', async function() {
180180
})
181181

182182
test('testVisengine', async function() {
183-
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
183+
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
184184
const s = await client.visengine.listServices()
185185
expect(s[0]).toBeDefined()
186186

@@ -199,7 +199,7 @@ test('testVisengine', async function() {
199199

200200

201201
test('testsms', async function() {
202-
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
202+
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
203203
// const list = await client.sms.getMessages()
204204
// console.log(list);
205205
const sms = await client.sms.send('test', 'Test sms', ['+39-3939989741'], 0, {}, true)
@@ -208,7 +208,7 @@ test('testsms', async function() {
208208
})
209209

210210
test('testUP', async function() {
211-
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
211+
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
212212
// const list = await client.ufficioPostale.listRaccomandate('NEW')
213213
// expect(list).toBeDefined()
214214
const mitt = {
@@ -263,7 +263,7 @@ test('testUP', async function() {
263263
})
264264

265265
test('testUPlol', async function() {
266-
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
266+
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
267267
await client.generateToken('ws.ufficiopostale.com');
268268
const mitt = {
269269
"titolo": "mr",

0 commit comments

Comments
 (0)