auto-code-generator-client-ts 1.0.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.
- package/LICENSE +72 -0
- package/README.md +68 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying under this License.
|
|
48
|
+
|
|
49
|
+
You may convey a covered work under this License. If you are
|
|
50
|
+
distributing under this License, you must include the license terms.
|
|
51
|
+
|
|
52
|
+
3. Use with the GNU GPL.
|
|
53
|
+
|
|
54
|
+
You may convey copies of the Library and/or works based on it under
|
|
55
|
+
the terms of the GNU GPL. However, all copies must be accompanied by
|
|
56
|
+
the complete corresponding machine-readable source code.
|
|
57
|
+
|
|
58
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
59
|
+
Copyright (C) 2025 Luca Gualandi
|
|
60
|
+
|
|
61
|
+
This program is free software: you can redistribute it and/or modify
|
|
62
|
+
it under the terms of the GNU Lesser General Public License as published
|
|
63
|
+
by the Free Software Foundation, either version 3 of the License, or
|
|
64
|
+
(at your option) any later version.
|
|
65
|
+
|
|
66
|
+
This program is distributed in the hope that it will be useful,
|
|
67
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
68
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
69
|
+
GNU Lesser General Public License for more details.
|
|
70
|
+
|
|
71
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
72
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# auto-code-generator-client-ts
|
|
2
|
+
|
|
3
|
+
Generic API client library for auto-code generator projects.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install auto-code-generator-client-ts
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Basic Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { GenericApiClient } from 'auto-code-generator-client-ts';
|
|
17
|
+
|
|
18
|
+
const client = new GenericApiClient('https://api.example.com');
|
|
19
|
+
|
|
20
|
+
// GET request
|
|
21
|
+
const users = await client.get('/users');
|
|
22
|
+
|
|
23
|
+
// POST request
|
|
24
|
+
const newUser = await client.post('/users', { name: 'John', email: 'john@example.com' });
|
|
25
|
+
|
|
26
|
+
// PUT request
|
|
27
|
+
const updatedUser = await client.put('/users/1', { name: 'John Doe' });
|
|
28
|
+
|
|
29
|
+
// DELETE request
|
|
30
|
+
await client.delete('/users/1');
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Using Utility Functions
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { formatDate, parseDate } from 'auto-code-generator-client-ts/utility';
|
|
37
|
+
|
|
38
|
+
const formattedDate = formatDate(new Date());
|
|
39
|
+
const parsedDate = parseDate('2023-12-01');
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## API Reference
|
|
43
|
+
|
|
44
|
+
### GenericApiClient
|
|
45
|
+
|
|
46
|
+
The main API client class for making HTTP requests.
|
|
47
|
+
|
|
48
|
+
#### Constructor
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
new GenericApiClient(baseURL: string, options?: AxiosRequestConfig)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### Methods
|
|
55
|
+
|
|
56
|
+
- `get<T>(url: string, config?: AxiosRequestConfig): Promise<T>`
|
|
57
|
+
- `post<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>`
|
|
58
|
+
- `put<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>`
|
|
59
|
+
- `patch<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>`
|
|
60
|
+
- `delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>`
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
LGPL-3.0-or-later
|
|
65
|
+
|
|
66
|
+
## Author
|
|
67
|
+
|
|
68
|
+
Luca Gualandi
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "auto-code-generator-client-ts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Generic API client for auto-code",
|
|
5
|
+
"license": "LGPL-3.0-or-later",
|
|
6
|
+
"author": "Luca Gualandi",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./api-client": {
|
|
16
|
+
"import": "./dist/GenericApiClient.js",
|
|
17
|
+
"types": "./dist/GenericApiClient.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./utility": {
|
|
20
|
+
"import": "./dist/utility/index.js",
|
|
21
|
+
"types": "./dist/utility/index.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist/**/*",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"keywords": [
|
|
30
|
+
"api-client",
|
|
31
|
+
"typescript",
|
|
32
|
+
"auto-code-generator",
|
|
33
|
+
"rest-client",
|
|
34
|
+
"http-client"
|
|
35
|
+
],
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://bitbucket.org/omniadev/crud-generator-client.git",
|
|
39
|
+
"directory": "packages/client"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://bitbucket.org/omniadev/crud-generator-client#readme",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://bitbucket.org/omniadev/crud-generator-client/issues"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc",
|
|
47
|
+
"clean": "rmdir /s /q dist 2>nul || echo \"Directory already clean\"",
|
|
48
|
+
"prebuild": "npm run clean",
|
|
49
|
+
"prepublishOnly": "npm run build",
|
|
50
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^24.2.0"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"axios": "^1.11.0",
|
|
57
|
+
"date-fns": "^4.1.0",
|
|
58
|
+
"qs": "^6.14.0"
|
|
59
|
+
}
|
|
60
|
+
}
|