Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .github/REPOINFO.txt
Empty file.
Binary file added .github/assets/repo-header-a3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions .github/assets/repo-header-a3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Image Description Sheet
-----------------------

File Name: repo-header-a3.png
Format: PNG
Dimensions: 830 x 173 pixels

Short Description:
A banner image featuring the word "PHP" on the left, PHP code snippet in the background,
and the Openapi logo on the right.

Purpose:
This image is intended to be used as a header/banner for documentation or repository README.
It visually associates Rust programming language with the Openapi SDK/client,
giving a professional and modern look to the project materials.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,42 @@ The MIT License is a permissive open-source license that allows you to freely us
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.

For more details, see the full license text at the [MIT License page](https://choosealicense.com/licenses/mit/).

## Contributing

Contributions are always welcome! Whether you want to report bugs, suggest new features, improve documentation, or contribute code, your help is appreciated.

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.

## Authors

Meet the project authors:

- Michael Cuffaro ([@maiku1008](https://www.github.com/maiku1008))
- Openapi Team ([@openapi-it](https://github.com/openapi-it))

## Partners

Meet our partners using Openapi or contributing to this SDK:

- [Blank](https://www.blank.app/)
- [Credit Safe](https://www.creditsafe.com/)
- [Deliveroo](https://deliveroo.it/)
- [Gruppo MOL](https://molgroupitaly.it/it/)
- [Jakala](https://www.jakala.com/)
- [Octotelematics](https://www.octotelematics.com/)
- [OTOQI](https://otoqi.com/)
- [PWC](https://www.pwc.com/)
- [QOMODO S.R.L.](https://www.qomodo.me/)
- [SOUNDREEF S.P.A.](https://www.soundreef.com/)

## License

This project is licensed under the [MIT License](LICENSE).

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.

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.

For more details, see the full license text at the [MIT License page](https://choosealicense.com/licenses/mit/).

30 changes: 30 additions & 0 deletions docs/code-of-conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contributor Covenant Code of Conduct

## Our Pledge

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.

## Our Standards

Examples of positive behavior:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy toward other community members

Examples of unacceptable behavior:

- Harassment, intimidation, or discrimination
- Public or private insults and derogatory comments
- Publishing others’ private information without consent
- Any other conduct reasonably considered inappropriate

## Enforcement

Instances of unacceptable behavior may be reported by contacting the project team at `<hello@openapi.com>`. All complaints will be reviewed promptly and fairly.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
45 changes: 45 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributing to Openapi SDK

Thanks for considering contributing! 🎉
We welcome all kinds of contributions: bug reports, feature requests, documentation improvements, and code enhancements.

## How to Contribute

1. **Fork the repository** and clone it locally:
```bash
git clone https://github.com/<username>/<repo>.git
```

2. **Create a branch** for your feature or fix:
```bash
git checkout -b feature/your-feature-name
```

3. **Make your changes** and commit them:
```bash
git commit -m "Add some feature"
```

4. **Push your branch** to your fork:
```bash
git push origin feature/your-feature-name
```

5. **Open a Pull Request** describing your changes.

## Guidelines

* Follow the existing **Rust coding style**.
* Include **tests** for new features or bug fixes when applicable.
* Keep **commit messages clear and concise**.
* Update **documentation** as needed for your changes.

## Reporting Issues

To report bugs or request features, please **open an issue** on GitHub including:

* Clear description of the problem or feature.
* Steps to reproduce (if applicable).
* Relevant logs or screenshots.

Thank you for helping improve Openapi SDK! 🚀
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"homepage": "https://developers.openapi.it",
"repository": {
"type": "git",
"url": "https://github.com/openapi-it/OpenApi-NodeJS"
"url": "https://github.com/openapi-it/Openapi-NodeJS"
},
"bugs": {
"url": "https://github.com/openapi-it/OpenApi-NodeJS/issues"
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export class OauthClient {

constructor(username: string, apiKey: string, isTest: boolean = false) {
this.baseUrl = isTest ? 'https://test.oauth.altravia.com' : 'https://oauth.altravia.com';

const auth = Buffer.from(`${username}:${apiKey}`).toString('base64');

this.client = axios.create({
baseURL: this.baseUrl,
headers: {
Expand Down
34 changes: 17 additions & 17 deletions test/client.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import OpenApi from '../dist/index';
// import Openapi from '../dist/index';
const fs = require('fs');
let OpenApi = require('../dist/index').default;
let Openapi = require('../dist/index').default;

const scopes = [
"GET:ws.ufficiopostale.com/raccomandate",
Expand Down Expand Up @@ -30,27 +30,27 @@ const scopes = [

test('init', async function() {

let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
const token = await client.generateToken(scopes);
expect(typeof token === 'string').toBeTruthy()
})

test('initWithString', async function() {

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

test('initWithToken', async function() {
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
expect(client.comuni).toBeDefined();
})

test('initWithOldToken', async function() {

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

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

test('initWithSkip', async function() {

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

const token = process.env.TOKEN;
expect(typeof token === 'string').toBe(true);
Expand All @@ -79,7 +79,7 @@ test('testComuni', async function() {
const token = process.env.TOKEN;
expect(typeof token === 'string').toBe(true);

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


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

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

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

test('testPa', async function() {
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
client.generateToken(scopes)
const piva = await client.pa.findPa('00559720982')
expect(piva).toBeDefined();
})

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

Expand Down Expand Up @@ -161,13 +161,13 @@ test('testFD', async function() {
})

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

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

Expand All @@ -180,7 +180,7 @@ test('testValutometro', async function() {
})

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

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


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

test('testUP', async function() {
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
// const list = await client.ufficioPostale.listRaccomandate('NEW')
// expect(list).toBeDefined()
const mitt = {
Expand Down Expand Up @@ -263,7 +263,7 @@ test('testUP', async function() {
})

test('testUPlol', async function() {
let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
let client = await Openapi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY);
await client.generateToken('ws.ufficiopostale.com');
const mitt = {
"titolo": "mr",
Expand Down