diff --git a/.github/REPOINFO.txt b/.github/REPOINFO.txt new file mode 100644 index 0000000..e69de29 diff --git a/.github/assets/repo-header-a3.png b/.github/assets/repo-header-a3.png new file mode 100644 index 0000000..ccd009a Binary files /dev/null and b/.github/assets/repo-header-a3.png differ diff --git a/.github/assets/repo-header-a3.txt b/.github/assets/repo-header-a3.txt new file mode 100644 index 0000000..3ba3803 --- /dev/null +++ b/.github/assets/repo-header-a3.txt @@ -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. diff --git a/README.md b/README.md index ad5288e..213d1db 100644 --- a/README.md +++ b/README.md @@ -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/). + diff --git a/docs/code-of-conduct.md b/docs/code-of-conduct.md new file mode 100644 index 0000000..8908ea2 --- /dev/null +++ b/docs/code-of-conduct.md @@ -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 ``. 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. diff --git a/docs/contributing.md b/docs/contributing.md new file mode 100644 index 0000000..dad6238 --- /dev/null +++ b/docs/contributing.md @@ -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//.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! ๐Ÿš€ diff --git a/package.json b/package.json index 24a31cc..92c9f79 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/index.ts b/src/index.ts index c40ad73..1b1b2ed 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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: { diff --git a/test/client.test.js b/test/client.test.js index 302cba7..c15f015 100644 --- a/test/client.test.js +++ b/test/client.test.js @@ -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", @@ -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); @@ -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); @@ -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') @@ -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') @@ -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(); @@ -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() @@ -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() @@ -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) @@ -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 = { @@ -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",