@20syldev/api 3.3.8 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- github: [20syldev]
1
+ github: [20syldev]
@@ -1,27 +1,27 @@
1
- name: 20syldev/api package publish
2
-
3
- on:
4
- release:
5
- types: [created]
6
-
7
- jobs:
8
- build:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: actions/checkout@v4
12
- - uses: actions/setup-node@v4
13
- with:
14
- node-version: 20
15
-
16
- publish-npm:
17
- needs: build
18
- runs-on: ubuntu-latest
19
- steps:
20
- - uses: actions/checkout@v4
21
- - uses: actions/setup-node@v4
22
- with:
23
- node-version: 20
24
- registry-url: https://registry.npmjs.org/
25
- - run: npm publish
26
- env:
27
- NODE_AUTH_TOKEN: ${{secrets.npm_token}}
1
+ name: 20syldev/api package publish
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-node@v4
13
+ with:
14
+ node-version: 20
15
+
16
+ publish-npm:
17
+ needs: build
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: actions/setup-node@v4
22
+ with:
23
+ node-version: 20
24
+ registry-url: https://registry.npmjs.org/
25
+ - run: npm publish
26
+ env:
27
+ NODE_AUTH_TOKEN: ${{secrets.npm_token}}
package/LICENSE CHANGED
@@ -1,28 +1,28 @@
1
- BSD 3-Clause License
2
-
3
- Copyright (c) 2024, Sylvain L.
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
7
-
8
- 1. Redistributions of source code must retain the above copyright notice, this
9
- list of conditions and the following disclaimer.
10
-
11
- 2. Redistributions in binary form must reproduce the above copyright notice,
12
- this list of conditions and the following disclaimer in the documentation
13
- and/or other materials provided with the distribution.
14
-
15
- 3. Neither the name of the copyright holder nor the names of its
16
- contributors may be used to endorse or promote products derived from
17
- this software without specific prior written permission.
18
-
19
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, Sylvain L.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
28
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,60 +1,110 @@
1
- <div align="center">
2
- <a href="https://api.sylvain.pro"><img src="https://api.sylvain.pro/favicon.ico" alt="Logo" width="25%" height="auto"/></a>
3
-
4
- # API Personnelle
5
- [![Version](https://custom-icon-badges.demolab.com/badge/Version%20:-v3.3.8-6479ee?logo=api.sylvain.pro&labelColor=23272A)](https://github.com/20syldev/api/releases/latest)
6
- </div>
7
-
8
- ---
9
-
10
- ## À propos de l'API
11
- Voici mon API personnelle, disponible sur le domaine [api.sylvain.pro](https://api.sylvain.pro).
12
- L'API est développée avec Node.js et hébergée **24h/7j**. Elle est **simple d'utilisation** et a une **documentation** disponible sur [docs.sylvain.pro](https://docs.sylvain.pro) !
13
- > *Une limite de **2000** requêtes **par heure** est fixée. Elle change pour certains endpoints nécessitant plus de ressources. Si vous souhaitez une **augmentation** de cette limite, n'hésitez pas à visiter la [documentation](https://docs.sylvain.pro/pricing).*
14
-
15
- ## Installer le paquet de l'API sur votre machine
16
- ```console
17
- $ sudo apt install nodejs npm
18
- $ npm install @20syldev/api
19
- $ npm init
20
- ```
21
- > *Attention, vous devez configurer le type sur "**module**" dans votre fichier `package.json`.*
22
-
23
- Pour utiliser le **paquet** dans votre projet, **créez** un fichier **JavaScript**. Par exemple, `index.js` :
24
- ```js
25
- import '@20syldev/api';
26
- ```
27
-
28
- Puis, **démarrez** un serveur [Node.js](https://nodejs.org) pour utiliser l'**API** :
29
- ```console
30
- $ node index.js
31
- API is running on
32
- - http://127.0.0.1:3000
33
- - http://localhost:3000
34
- ```
35
- > *Remplacez `index.js` par le nom de votre fichier JavaScript.*
36
-
37
- ## Tester l'API sur votre machine
38
- **Téléchargez** la [dernière mise à jour](https://github.com/20syldev/api/releases/latest) de l'API, puis **extrayez** le contenu du fichier `.zip` ou `.tar.gz` dans un de vos **répertoires**.
39
- Ensuite, **déplacez-vous** dans le dossier du projet, via un terminal **Linux**, **Windows** ou **macOS** :
40
- ```console
41
- $ cd /chemin/vers/le/projet
42
- ```
43
-
44
- Enfin, **exécutez** le script de build, qui installera les **dépendances** et lancera le **serveur** de l'[API](https://api.sylvain.pro) :
45
- ```console
46
- $ npm run build
47
- ```
48
- ```console
49
- > @20syldev/api@3.3.8 build
50
- > npm install && node app.js
51
-
52
- [...]
53
-
54
- found 0 vulnerabilities
55
- API is running on
56
- - http://127.0.0.1:3000
57
- - http://localhost:3000
58
- ```
59
-
60
- *Visitez la [documentation](https://docs.sylvain.pro) dédiée, vous y retrouverez des exemples de requêtes et des codes simples pour tester l'[API](https://api.sylvain.pro) !*
1
+ <div align="center">
2
+ <a href="https://api.sylvain.pro"><img src="https://api.sylvain.pro/favicon.ico" alt="Logo" width="25%" height="auto"/></a>
3
+
4
+ # API Personnelle
5
+ [![Version](https://custom-icon-badges.demolab.com/badge/Version%20:-v3.4.0-6479ee?logo=api.sylvain.pro&labelColor=23272A)](https://github.com/20syldev/api/releases/latest)
6
+ </div>
7
+
8
+ ---
9
+
10
+ ## À propos de l'API
11
+ Voici mon API personnelle, disponible sur le domaine [api.sylvain.pro](https://api.sylvain.pro).
12
+ L'API est développée avec Node.js et hébergée **24h/7j**. Elle est **simple d'utilisation** et a une **documentation** disponible sur [docs.sylvain.pro](https://docs.sylvain.pro) !
13
+ > *Une limite de **2000** requêtes **par heure** est fixée. Elle change pour certains endpoints nécessitant plus de ressources. Si vous souhaitez une **augmentation** de cette limite, n'hésitez pas à visiter la [documentation](https://docs.sylvain.pro/pricing).*
14
+
15
+ ## Installer le paquet de l'API sur votre machine
16
+ ```console
17
+ $ sudo apt install nodejs npm
18
+ $ npm install @20syldev/api
19
+ $ npm init
20
+ ```
21
+ > *Attention, vous devez configurer le type sur "**module**" dans votre fichier `package.json`.*
22
+
23
+ ## Utiliser l'API
24
+
25
+ ### Option 1 : Démarrer un serveur local
26
+
27
+ Pour démarrer un serveur local avec tous les endpoints, créez un fichier JavaScript, par exemple `index.js` :
28
+ ```js
29
+ import '@20syldev/api';
30
+ ```
31
+
32
+ Puis, **démarrez** un serveur [Node.js](https://nodejs.org) :
33
+ ```console
34
+ $ node index.js
35
+ API is running on
36
+ - http://127.0.0.1:3000
37
+ - http://localhost:3000
38
+ ```
39
+
40
+ ### Option 2 : Utiliser les modules directement dans votre code
41
+
42
+ Vous pouvez également importer les modules spécifiques dont vous avez besoin :
43
+
44
+ ```js
45
+ // Importer des modules spécifiques depuis la v3
46
+ import { color, token, username } from '@20syldev/api/v3';
47
+
48
+ // Générer une couleur aléatoire
49
+ const couleur = color();
50
+ console.log(`Couleur HEX: ${couleur.hex}`);
51
+ console.log(`Couleur RGB: ${couleur.rgb}`);
52
+ console.log(`Couleur HSL: ${couleur.hsl}`);
53
+
54
+ // Générer un nom d'utilisateur aléatoire
55
+ const utilisateur = username();
56
+ console.log(`Nom d'utilisateur: ${utilisateur.username}`);
57
+
58
+ // Générer un jeton sécurisé
59
+ const jeton = token(16, 'hex');
60
+ console.log(`Jeton: ${jeton}`);
61
+ ```
62
+
63
+ ## Tester l'API sur votre machine
64
+ **Téléchargez** la [dernière mise à jour](https://github.com/20syldev/api/releases/latest) de l'API, puis **extrayez** le contenu du fichier `.zip` ou `.tar.gz` dans un de vos **répertoires**.
65
+ Ensuite, **déplacez-vous** dans le dossier du projet, via un terminal **Linux**, **Windows** ou **macOS** :
66
+ ```console
67
+ $ cd /chemin/vers/le/projet
68
+ ```
69
+
70
+ Enfin, **exécutez** le script de build, qui installera les **dépendances** et lancera le **serveur** de l'[API](https://api.sylvain.pro) :
71
+ ```console
72
+ $ npm run build
73
+ ```
74
+ ```console
75
+ > @20syldev/api@3.4.0 build
76
+ > npm install && node app.js
77
+
78
+ [...]
79
+
80
+ found 0 vulnerabilities
81
+ API is running on
82
+ - http://127.0.0.1:3000
83
+ - http://localhost:3000
84
+ ```
85
+
86
+ ## Modules disponibles
87
+
88
+ L'API v3 expose plusieurs modules que vous pouvez importer :
89
+
90
+ ```js
91
+ import {
92
+ algorithms, // Fonctions algorithmiques diverses
93
+ captcha, // Génération d'images captcha
94
+ chat, // Système de chat temporaire
95
+ color, // Génération de couleurs aléatoires
96
+ convert, // Conversions d'unités
97
+ domain, // Informations de domaine aléatoires
98
+ hash, // Hachage de texte
99
+ hyperplanning, // Analyse de calendriers
100
+ levenshtein, // Distance entre chaînes
101
+ personal, // Informations personnelles aléatoires
102
+ qrcode, // Génération de QR codes
103
+ tic_tac_toe, // Jeu de morpion
104
+ time, // Informations temporelles
105
+ token, // Génération de jetons sécurisés
106
+ username // Génération de noms d'utilisateur
107
+ } from '@20syldev/api/v3';
108
+ ```
109
+
110
+ *Visitez la [documentation](https://docs.sylvain.pro) dédiée, vous y retrouverez des exemples de requêtes et des codes simples pour tester l'[API](https://api.sylvain.pro) !*