@persei/perseed-api 4.34.36 → 5.0.0-beta.1

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.
Files changed (46) hide show
  1. package/README.md +73 -237
  2. package/dist/client.cjs +178 -0
  3. package/dist/client.cjs.map +1 -0
  4. package/dist/client.mjs +178 -0
  5. package/dist/client.mjs.map +1 -0
  6. package/dist/global-pagination.cjs +24 -0
  7. package/dist/global-pagination.cjs.map +1 -0
  8. package/dist/global-pagination.mjs +24 -0
  9. package/dist/global-pagination.mjs.map +1 -0
  10. package/dist/{schemas → src/schemas}/bulk_upload/update_bulk_upload_payload.schema.json +3 -0
  11. package/dist/{schemas → src/schemas}/dashboard_widget/create_widget_payload.schema.json +85 -23
  12. package/dist/{schemas → src/schemas}/dashboard_widget/update_widget_payload.schema.json +85 -23
  13. package/dist/v1/perseed-api.cjs +1459 -0
  14. package/dist/v1/perseed-api.cjs.map +1 -0
  15. package/dist/{perseed-api.mjs → v1/perseed-api.mjs} +347 -156
  16. package/dist/v1/perseed-api.mjs.map +1 -0
  17. package/package.json +36 -168
  18. package/dist/index.d.ts +0 -3073
  19. package/dist/perseed-api.umd.js +0 -1
  20. /package/dist/{schemas → src/schemas}/forms/create.schema.json +0 -0
  21. /package/dist/{schemas → src/schemas}/forms/update.schema.json +0 -0
  22. /package/dist/{schemas → src/schemas}/hospital/create.schema.json +0 -0
  23. /package/dist/{schemas → src/schemas}/mfa/mfa-login-data.schema.json +0 -0
  24. /package/dist/{schemas → src/schemas}/mobile/searchnotificationstatus.schema.json +0 -0
  25. /package/dist/{schemas → src/schemas}/notification_configuration/create_trigger_payload.schema.json +0 -0
  26. /package/dist/{schemas → src/schemas}/notification_configuration/update_trigger_payload.schema.json +0 -0
  27. /package/dist/{schemas → src/schemas}/patient/createFullPatient.schema.json +0 -0
  28. /package/dist/{schemas → src/schemas}/patient/createPatient.schema.json +0 -0
  29. /package/dist/{schemas → src/schemas}/process_log/create_process_log_payload.schema.json +0 -0
  30. /package/dist/{schemas → src/schemas}/process_log/update_process_log_payload.schema.json +0 -0
  31. /package/dist/{schemas → src/schemas}/project/createCategory.schema.json +0 -0
  32. /package/dist/{schemas → src/schemas}/project/export.schema.json +0 -0
  33. /package/dist/{schemas → src/schemas}/project/uploadDocument.schema.json +0 -0
  34. /package/dist/{schemas → src/schemas}/query/patch.schema.json +0 -0
  35. /package/dist/{schemas → src/schemas}/questionnaire/createQuestionnaire.schema.json +0 -0
  36. /package/dist/{schemas → src/schemas}/subform/create.schema.json +0 -0
  37. /package/dist/{schemas → src/schemas}/subform/update.schema.json +0 -0
  38. /package/dist/{schemas → src/schemas}/user_settings/APP_FONT_FACTOR.schema.json +0 -0
  39. /package/dist/{schemas → src/schemas}/user_settings/AUTH_SECURITY_CONFIG.schema.json +0 -0
  40. /package/dist/{schemas → src/schemas}/user_settings/GenericBooleanSetting.schema.json +0 -0
  41. /package/dist/{schemas → src/schemas}/users/activate.schema.json +0 -0
  42. /package/dist/{schemas → src/schemas}/users/contact.schema.json +0 -0
  43. /package/dist/{schemas → src/schemas}/users/create.schema.json +0 -0
  44. /package/dist/{schemas → src/schemas}/users/password.schema.json +0 -0
  45. /package/dist/{schemas → src/schemas}/users/selfregister.schema.json +0 -0
  46. /package/dist/{schemas → src/schemas}/users/unlinkProject.schema.json +0 -0
package/README.md CHANGED
@@ -1,280 +1,116 @@
1
- # Table of contents
1
+ # @persei/perseed-api
2
2
 
3
- 1. [Perseed API - NodeJS](#1-perseed-api-nodejs)
4
- 2. [Requirements](#2-requirements)
5
- 3. [Installation overview](#3-installation-overview)
6
- 4. [Tunneling database connection](#4-tunneling-database-connection)
7
- 5. [Local development without docker - NOT RECOMMENDED](#5-local-development-without-docker-not-recommended)
8
- 6. [Local development with docker-compose (with auto reload via nodemon) - RECOMMENDED](#6-local-development-with-docker-compose-with-auto-reload-via-nodemon-recommended)
9
- 7. [API documentation](#7-api-documentation)
10
- 8. [Redis cache and queue](#8-redis-cache-and-queue)
11
- 9. [Generating json schema from ts definitions](#9-generating-json-schema-from-ts-definitions)
12
- 10. [Add a new language](#10-add-a-new-language)
13
- 11. [Lib package build](#11-lib-package-build)
3
+ Shared TypeScript schemas, types, and constants from Perseed API.
14
4
 
15
- # 1 - Perseed API - NodeJs
5
+ ## Installation
16
6
 
17
- The perseed API (node js) provides a series of endpoints for clients to communicate
18
- to the Perseed ecosystem.
19
-
20
- As client, we understand that it can be:
21
-
22
- 1. A third party that is integrating with the API.
23
- 2. Internal or external mobile applications that want to consume the data provided by the API.
24
-
25
- This readme provides the basic guidance to get started.
26
-
27
- # 2 - Requirements
28
-
29
- For local development without docker:
30
-
31
- - NodeJs 10+ (Installation instructions [here](https://nodejs.org/en/download/package-manager)
32
- - NPM 6+
33
-
34
- For local development with docker and docker-compose:
35
-
36
- - docker engine installed (Installation instructions can be found [here](https://docs.docker.com/install))
37
- - docker-compose installed (Installation instructions can be found [here](https://docs.docker.com/compose/install))
38
-
39
- ## 2.1 - Setting up credentials file
40
-
41
- Disclaimer: this section is required for local setup with or without docker.
42
-
43
- 1. Copy the file ´config.local.example´ from the root of the project and past it in the credentials folder `config/credentials` as `local.js` (`cp config.local.example config/credentials/local.js`)
44
- 2. Copy the file ´config.local.example´ from the root of the project and past it in the credentials folder `config/credentials` as `test.js` (`cp config.local.example config/credentials/test.js`)
45
- 3. Copy the file ´~/.ssh/id_rsa.pub´ and paste it in the key folder `config/apiPublicKey` as `public.pem` (`cp ~/.ssh/id_rsa.pub config/apiPublicKey/public.pem`)
46
-
47
- # 3 - Installation overview
48
-
49
- Once cloned this repository, a few steps are required in order to get the API
50
- up and running, and they are as follows:
7
+ ```bash
8
+ npm install @persei/perseed-api
9
+ ```
51
10
 
52
- - set up a local credentials file, it includes the js files with secrets as well as the public key file.
53
- - Install dependencies
54
- - Start database tunneling
55
- - Start the API process
11
+ ## Usage
56
12
 
57
- For each item mentioned above, there is a section that follows what is needed to completed each step.
13
+ ### Module-specific Imports (Recommended)
58
14
 
59
- # 4 - Tunneling database connection - NOT RECOMMENDED
15
+ Import only what you need for optimal tree-shaking:
60
16
 
61
- As a suggested approach to not setup projects into local database, a ssh tunnel
62
- is the way to go, the following command can create a connection from the database
63
- to a local port:
17
+ ```typescript
18
+ // Pagination
19
+ import { paginatedQueryStringSchema, DEFAULT_PAGE_SIZE } from '@persei/perseed-api/global-pagination'
20
+ import type { PaginatedQuery } from '@persei/perseed-api/global-pagination'
64
21
 
22
+ // API Errors
23
+ import { apiErrorSchema, apiNotFoundErrorSchema } from '@persei/perseed-api/global-api-error'
65
24
  ```
66
- ssh perseedweb00-dev -L 3306:10.150.128.151:3306
67
- ```
68
-
69
- The command above exposes the port 3306 from the server (**10.150.128.151**) to the port 3306
70
- on the localhost. In this example, the IP **10.150.128.151** is the staging database,
71
- or as it is most common called in perseed, the TMP database serve.
72
25
 
73
- Quick note on tunneling connections: probably if your using a tunnel you would also like
74
- to set up the `/etc/hosts` accordingly, assuming the TMP database above, you should add the
75
- following entry on the hosts file:
26
+ ### V1 (Legacy) - Constants and Schemas
76
27
 
28
+ ```typescript
29
+ import { FORMS, PhoneCodes } from '@persei/perseed-api/v1'
30
+ import type { DashboardWidgetType } from '@persei/perseed-api/v1'
77
31
  ```
78
- 127.0.0.1 perseeddb00-dev.internal.persei.com.es
79
- ```
80
-
81
- # 5 - Local development without docker - NOT RECOMMENDED
82
32
 
83
- ## 5.1 - Install the dependencies
33
+ ## Available Modules
84
34
 
85
- The preferred way to install the project dependencies is through NPM, running the following command:
35
+ Modules are auto-discovered from `src/v2/modules/**/lib.ts`:
86
36
 
87
- `npm install`
37
+ - `@persei/perseed-api/global-pagination`
38
+ - `@persei/perseed-api/global-api-error`
39
+ - `@persei/perseed-api/project-document-category`
40
+ - ... (more as lib.ts files are added)
88
41
 
89
- In order to proceed to the API launch this command must exit with status 0, in other words, successfully.
90
42
 
91
- ## 5.2 - Start the api process (non development - without autoreload)
43
+ ### Building
92
44
 
93
- Once the previous two steps have been completed successfully, the api can be started running the following command:
94
-
95
- `npm run start`
96
-
97
- # 6 - Local development with docker-compose (with auto reload via nodemon) - RECOMMENDED
98
-
99
- The preferred command to use docker is through the `docker-compose` itself,
100
- the setup used by docker-compose, deploys two containers: nginx and the node js.
101
-
102
- To a clean installation make sure that there is no **node_modules** folder
103
- created in the root directory, then proceed to execute the first command
104
- to install the dependencies:
105
-
106
- Also this setup assumes that you are **NOT** using the tunneling approach, for
107
- tunneling, have a look at the command in the section 6.1.
108
-
109
- ```
110
- docker-compose -f docker-compose-dev.yml run --rm nodejs npm install --target_arch=x64 --target_platform=linux
111
- ```
112
-
113
- Once the command is finished, then, lunch the services (note: it will
114
- keep showing up logs in the terminal):
115
-
116
- ```
117
- docker-compose -f docker-compose-dev.yml up
45
+ ```bash
46
+ # In project root
47
+ npm run build:lib
118
48
  ```
119
49
 
120
- To double-check the setup, and in a new terminal window, run the following test
121
- suite:
50
+ ### Publishing
122
51
 
123
- ```
124
- docker-compose -f docker-compose-dev.yml run --rm nodejs npm run test-unit
52
+ ```bash
53
+ cd lib
54
+ npm version patch|minor|major
55
+ npm publish
125
56
  ```
126
57
 
127
- Besides that, the docker-compose setup comes with one single ecosystem (reseaarch) and
128
- the credentials are as follows:
58
+ ## Creating lib.ts for New Modules
129
59
 
130
- - Ecosystem admin (used to generate the JWT token):
60
+ To export a v2 module in this package:
131
61
 
132
- ```
133
- username: ecoadmin
134
- password: 1CarefulWithPersonalInfo2
135
- ```
62
+ 1. Create `src/v2/modules/your-module/lib.ts`:
136
63
 
137
- ## 6.1 Local development with docker with tunneling
64
+ ```typescript
65
+ // ✅ Export only schemas and types
66
+ export * from './your-module.schema'
138
67
 
139
- For more advanced developers that want to play with the raw image through docker
140
- a friendly command is provided below. For more information about the image
141
- please refer to the `Dockerfile` in the repository root directory.
142
-
143
- ```
144
- docker build . -t perseed_api && docker run -p 3005:3005 -it --net=host -v $(pwd):/var/www/perseed_api perseed_api npm run dev
68
+ // ❌ DO NOT export models, services, or controllers
69
+ // export * from './your-module.model' // NO!
145
70
  ```
146
71
 
147
- The command above will build the image, install npm dependencies and run the
148
- api. It is important to note that the `--net` is used explicitly for the tunneling,
149
- this way docker does not blocks the tunnel port. On the other hand, the docker
150
- compose file uses the network mode as host, which should change in the future.
72
+ 2. Build will auto-detect it - no config changes needed!
151
73
 
152
- # 7 - API documentation
74
+ 3. Module will be available as `@persei/perseed-api/[category]-[module]`
153
75
 
154
- The API documentation is build thanks to Swagger Tools that takes an OpenAPI Specification file (.yaml or .json) and generates code for Server and Client.
76
+ ### What NOT to Export
155
77
 
156
- In our case, we build the OpenAPI Spec file (swagger.yaml) directly from the API code comments using the **swagger_gen.py** script that can be found in this git repository.
78
+ Never export in `lib.ts`:
79
+ - ❌ Models (*.model.ts) - contain Objection/Knex dependencies
80
+ - ❌ Services (*.service.ts) - contain business logic
81
+ - ❌ Controllers (*.controller.ts) - contain Fastify code
82
+ - ❌ Middleware - server-only code
83
+ - ❌ Anything importing: BaseModel, RequestContext, Fastify, MySQL, Redis, etc.
157
84
 
158
- - This script goes through all the jsdocs files in the "routes" directory and parses all the comments that document the endpoints
85
+ ## API Client (TypeScript)
159
86
 
87
+ This package includes a type-safe API client generated from the OpenAPI schema.
160
88
 
161
- ## 7.1 How to document an endpoint directly in the API code comments:
162
- More info in confluence at [How To Document The API](https://confluence.persei.com.es/display/TBDC/How+to+document+the+API)
89
+ ### Setup
163
90
 
164
- To document an endpoint the comment should be right above of endpoint. It is important **follow the next template**:
165
-
166
- -----------------
167
- #### 1. The Body Request *IS A MODEL*:
168
- ```ruby
169
- /*@PA <endpoint_path>
170
- method: <HTTP_method>
171
- summary: <What_the_endpoint_does>
172
- tags: [<tag1>,...,<tagN>]
173
- responses: #/<Response_Content (has to be JSON format)>/#
174
- body: model <model> - <description>
175
- */
176
- ```
91
+ ```typescript
92
+ import { configureClient } from '@persei/perseed-api/client'
177
93
 
178
- #### 2. The Body Request is a *NOT A MODEL*:
179
- ```ruby
180
- /* @PA <endpoint_path>
181
- method: <HTTP_method>
182
- summary: <What_the_endpoint_does>
183
- tags: [<tag1>,...,<tagN>]
184
- responses: #/<Response_Content (has to be JSON format)>/#
185
- body: {<Body_Content>} - <description>
186
- required: [required_field1,...,required_fieldN]
94
+ configureClient({
95
+ baseUrl: 'https://api.example.com',
96
+ headers: {
97
+ Authorization: `Bearer ${token}`
98
+ }
99
+ })
187
100
  ```
188
- -------------------
189
- The API can return a response in two ways:
190
101
 
191
- 1. Returning as a response body ***A MODEL THAT ALREADY EXISTS***:
192
- 2. Returning as a response body ***A JSON (not extracted from a model)***:
102
+ ### Usage
193
103
 
194
- >#### (1)
195
- >>responses:
196
- >>>**#/**{*“<HTTP_code_response1>”* : {**“content-type”** : *”<content_type>”*, **“model_content”** : *“<model_name>”*, **“description”** : *“<description>”*},............................................................................................................................................................................
104
+ ```typescript
105
+ import { getSomeEndpoint, postAnotherEndpoint } from '@persei/perseed-api/client'
197
106
 
107
+ // GET request
108
+ const data = await getSomeEndpoint({
109
+ params: { query: { page: 1 } }
110
+ })
198
111
 
199
- >#### (2)
200
- >>>...........,*“<HTTP_code_responseN>”* : {**“content-type”** : *”<content_type>”*,**”json_content”** : *<JSON>*, **“description”** : *“<description>”*}}**/#**
201
-
202
- >#### (1) y (2)
203
-
204
- >>responses:
205
- >>>**#/**{*“<HTTP_code_response1>”* : {**“content-type”** : *”<content_type>”*, **“model_content”** : *“<model_name>”*, **“description”** : *“<description>”*} ,.........,
206
- *“<HTTP_code_responseN>”* : {**“content-type”** : *”<content_type>”*, **”json_content”** : *<JSON>*, **“description”** : *“<description>”*}}**/#**
207
-
208
- ## 7.2 Recommendations:
209
-
210
- 1. The code was developed specifically for this type and format of comments.
211
-
212
- 2. Be sure that the comment starts with : **/\* @PA** and ends with: **\*/**
213
-
214
- 3. Just in case you want to check if you are formatting the comments correctly: [Regex Help](https://regexr.com/)
215
-
216
- - 3.1 body field (NOT A MODEL):
217
-
218
- >`body:(?:.||\n.*){((?:.|\n)*)}(?:.*-|-|)(.*)`
219
-
220
- - 3.2 body field (MODEL):
221
-
222
- >`body: model(.*)`
223
-
224
- - 3.3 responses field:
225
-
226
- >`responses:(?:.|\n)*?#\/((?:.|\n*.*){(?:.|\n)*})(?:(?:.|\n)*)\/#`
227
-
228
- - 3.4 tags field:
229
-
230
- >`tags:.*\[(.*)\]`
231
-
232
- - 3.5 required field:
233
-
234
- >`required:.*\[((?:.|\n)*)\]`
235
-
236
- ## 8 Redis cache and queue
237
-
238
- The API can be configured to use a cache and/or queue system. Both are optional.
239
-
240
- To configure only redis cache set the env var REDIS_CACHE_URL with the connection url to redis server (for example redis://user:pass@host:6379/1).
241
-
242
- To configure only redis queue set the env var REDIS_QUEUE_URL with the connection url to redis server.
243
-
244
- To configure both at once set the env var REDIS_URL with the connection url to redis server.
245
-
246
- ### Local testing
247
-
248
- To create a local tunnel to the TMP redis cluster use:
112
+ // POST request
113
+ const result = await postAnotherEndpoint({
114
+ data: { name: 'John' }
115
+ })
249
116
  ```
250
- ssh perseedweb00-dev -g -L 6379:test-perseed-api-o3rygh.serverless.euc1.cache.amazonaws.com:6379 -N
251
- ```
252
-
253
- ## 9 Generating json schema from ts definitions
254
-
255
- The schema can be generated manually:
256
-
257
- `npx ts-json-schema-generator --path 'my/project/**/*.ts' --type 'My.Type.Name'`
258
-
259
- Or added to /schemas.json to be generated automatically on every precommit
260
-
261
- ## 10 Add a new language
262
-
263
- To add a new language:
264
-
265
- * Add to the `locales` array in `/i18next-parser.config.js`
266
- * Run `npm run i18n:generate` to generate the new locale file with the default values (in english). This file should be translated.
267
- * Done!
268
-
269
- ## 11 Lib package build
270
-
271
- To build the lib package:
272
- * Increase the package.json version
273
- * Run `npm run lib:build`
274
- * Commit changes
275
- * Run `npm publish`
276
-
277
-
278
- # API v2
279
-
280
- The API is in a process of being rewritten/optimized in the v2. The docs for the v2 are in ./src/v2/README.md
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const ListDocumentCategories403AllOfThreeStatusCode = {
4
+ NUMBER_403: 403
5
+ };
6
+ const ListDocumentCategories403AllOfThreeError = {
7
+ "forbidden-error": "forbidden-error"
8
+ };
9
+ const ListDocumentCategories404AllOfThreeStatusCode = {
10
+ NUMBER_404: 404
11
+ };
12
+ const ListDocumentCategories404AllOfThreeError = {
13
+ "not-found": "not-found"
14
+ };
15
+ const CreateDocumentCategory403AllOfThreeStatusCode = {
16
+ NUMBER_403: 403
17
+ };
18
+ const CreateDocumentCategory403AllOfThreeError = {
19
+ "forbidden-error": "forbidden-error"
20
+ };
21
+ const CreateDocumentCategory404AllOfThreeStatusCode = {
22
+ NUMBER_404: 404
23
+ };
24
+ const CreateDocumentCategory404AllOfThreeError = {
25
+ "not-found": "not-found"
26
+ };
27
+ const GetDocumentCategory403AllOfThreeStatusCode = {
28
+ NUMBER_403: 403
29
+ };
30
+ const GetDocumentCategory403AllOfThreeError = {
31
+ "forbidden-error": "forbidden-error"
32
+ };
33
+ const GetDocumentCategory404AllOfThreeStatusCode = {
34
+ NUMBER_404: 404
35
+ };
36
+ const GetDocumentCategory404AllOfThreeError = {
37
+ "not-found": "not-found"
38
+ };
39
+ const UpdateDocumentCategory403AllOfThreeStatusCode = {
40
+ NUMBER_403: 403
41
+ };
42
+ const UpdateDocumentCategory403AllOfThreeError = {
43
+ "forbidden-error": "forbidden-error"
44
+ };
45
+ const UpdateDocumentCategory404AllOfThreeStatusCode = {
46
+ NUMBER_404: 404
47
+ };
48
+ const UpdateDocumentCategory404AllOfThreeError = {
49
+ "not-found": "not-found"
50
+ };
51
+ const DeleteDocumentCategory403AllOfThreeStatusCode = {
52
+ NUMBER_403: 403
53
+ };
54
+ const DeleteDocumentCategory403AllOfThreeError = {
55
+ "forbidden-error": "forbidden-error"
56
+ };
57
+ const DeleteDocumentCategory404AllOfThreeStatusCode = {
58
+ NUMBER_404: 404
59
+ };
60
+ const DeleteDocumentCategory404AllOfThreeError = {
61
+ "not-found": "not-found"
62
+ };
63
+ const getPostV2AuthLoginGlobalUrl = () => {
64
+ return `/v2/auth/login/global`;
65
+ };
66
+ const postV2AuthLoginGlobal = async (options) => {
67
+ const res = await fetch(getPostV2AuthLoginGlobalUrl(), {
68
+ ...options,
69
+ method: "POST"
70
+ });
71
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
72
+ const data = body ? JSON.parse(body) : {};
73
+ return { data, status: res.status, headers: res.headers };
74
+ };
75
+ const getListDocumentCategoriesUrl = (ecosystemName, projectName, params) => {
76
+ const normalizedParams = new URLSearchParams();
77
+ Object.entries(params || {}).forEach(([key, value]) => {
78
+ if (value !== void 0) {
79
+ normalizedParams.append(key, value === null ? "null" : value.toString());
80
+ }
81
+ });
82
+ const stringifiedParams = normalizedParams.toString();
83
+ return stringifiedParams.length > 0 ? `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/?${stringifiedParams}` : `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/`;
84
+ };
85
+ const listDocumentCategories = async (ecosystemName, projectName, params, options) => {
86
+ const res = await fetch(getListDocumentCategoriesUrl(ecosystemName, projectName, params), {
87
+ ...options,
88
+ method: "GET"
89
+ });
90
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
91
+ const data = body ? JSON.parse(body) : {};
92
+ return { data, status: res.status, headers: res.headers };
93
+ };
94
+ const getCreateDocumentCategoryUrl = (ecosystemName, projectName) => {
95
+ return `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/`;
96
+ };
97
+ const createDocumentCategory = async (ecosystemName, projectName, createDocumentCategoryBody, options) => {
98
+ const res = await fetch(getCreateDocumentCategoryUrl(ecosystemName, projectName), {
99
+ ...options,
100
+ method: "POST",
101
+ headers: { "Content-Type": "application/json", ...options?.headers },
102
+ body: JSON.stringify(createDocumentCategoryBody)
103
+ });
104
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
105
+ const data = body ? JSON.parse(body) : {};
106
+ return { data, status: res.status, headers: res.headers };
107
+ };
108
+ const getGetDocumentCategoryUrl = (ecosystemName, projectName, id) => {
109
+ return `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/${id}`;
110
+ };
111
+ const getDocumentCategory = async (ecosystemName, projectName, id, options) => {
112
+ const res = await fetch(getGetDocumentCategoryUrl(ecosystemName, projectName, id), {
113
+ ...options,
114
+ method: "GET"
115
+ });
116
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
117
+ const data = body ? JSON.parse(body) : {};
118
+ return { data, status: res.status, headers: res.headers };
119
+ };
120
+ const getUpdateDocumentCategoryUrl = (ecosystemName, projectName, id) => {
121
+ return `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/${id}`;
122
+ };
123
+ const updateDocumentCategory = async (ecosystemName, projectName, id, updateDocumentCategoryBody, options) => {
124
+ const res = await fetch(getUpdateDocumentCategoryUrl(ecosystemName, projectName, id), {
125
+ ...options,
126
+ method: "PATCH",
127
+ headers: { "Content-Type": "application/json", ...options?.headers },
128
+ body: JSON.stringify(updateDocumentCategoryBody)
129
+ });
130
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
131
+ const data = body ? JSON.parse(body) : {};
132
+ return { data, status: res.status, headers: res.headers };
133
+ };
134
+ const getDeleteDocumentCategoryUrl = (ecosystemName, projectName, id) => {
135
+ return `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/${id}`;
136
+ };
137
+ const deleteDocumentCategory = async (ecosystemName, projectName, id, options) => {
138
+ const res = await fetch(getDeleteDocumentCategoryUrl(ecosystemName, projectName, id), {
139
+ ...options,
140
+ method: "DELETE"
141
+ });
142
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
143
+ const data = body ? JSON.parse(body) : {};
144
+ return { data, status: res.status, headers: res.headers };
145
+ };
146
+ exports.CreateDocumentCategory403AllOfThreeError = CreateDocumentCategory403AllOfThreeError;
147
+ exports.CreateDocumentCategory403AllOfThreeStatusCode = CreateDocumentCategory403AllOfThreeStatusCode;
148
+ exports.CreateDocumentCategory404AllOfThreeError = CreateDocumentCategory404AllOfThreeError;
149
+ exports.CreateDocumentCategory404AllOfThreeStatusCode = CreateDocumentCategory404AllOfThreeStatusCode;
150
+ exports.DeleteDocumentCategory403AllOfThreeError = DeleteDocumentCategory403AllOfThreeError;
151
+ exports.DeleteDocumentCategory403AllOfThreeStatusCode = DeleteDocumentCategory403AllOfThreeStatusCode;
152
+ exports.DeleteDocumentCategory404AllOfThreeError = DeleteDocumentCategory404AllOfThreeError;
153
+ exports.DeleteDocumentCategory404AllOfThreeStatusCode = DeleteDocumentCategory404AllOfThreeStatusCode;
154
+ exports.GetDocumentCategory403AllOfThreeError = GetDocumentCategory403AllOfThreeError;
155
+ exports.GetDocumentCategory403AllOfThreeStatusCode = GetDocumentCategory403AllOfThreeStatusCode;
156
+ exports.GetDocumentCategory404AllOfThreeError = GetDocumentCategory404AllOfThreeError;
157
+ exports.GetDocumentCategory404AllOfThreeStatusCode = GetDocumentCategory404AllOfThreeStatusCode;
158
+ exports.ListDocumentCategories403AllOfThreeError = ListDocumentCategories403AllOfThreeError;
159
+ exports.ListDocumentCategories403AllOfThreeStatusCode = ListDocumentCategories403AllOfThreeStatusCode;
160
+ exports.ListDocumentCategories404AllOfThreeError = ListDocumentCategories404AllOfThreeError;
161
+ exports.ListDocumentCategories404AllOfThreeStatusCode = ListDocumentCategories404AllOfThreeStatusCode;
162
+ exports.UpdateDocumentCategory403AllOfThreeError = UpdateDocumentCategory403AllOfThreeError;
163
+ exports.UpdateDocumentCategory403AllOfThreeStatusCode = UpdateDocumentCategory403AllOfThreeStatusCode;
164
+ exports.UpdateDocumentCategory404AllOfThreeError = UpdateDocumentCategory404AllOfThreeError;
165
+ exports.UpdateDocumentCategory404AllOfThreeStatusCode = UpdateDocumentCategory404AllOfThreeStatusCode;
166
+ exports.createDocumentCategory = createDocumentCategory;
167
+ exports.deleteDocumentCategory = deleteDocumentCategory;
168
+ exports.getCreateDocumentCategoryUrl = getCreateDocumentCategoryUrl;
169
+ exports.getDeleteDocumentCategoryUrl = getDeleteDocumentCategoryUrl;
170
+ exports.getDocumentCategory = getDocumentCategory;
171
+ exports.getGetDocumentCategoryUrl = getGetDocumentCategoryUrl;
172
+ exports.getListDocumentCategoriesUrl = getListDocumentCategoriesUrl;
173
+ exports.getPostV2AuthLoginGlobalUrl = getPostV2AuthLoginGlobalUrl;
174
+ exports.getUpdateDocumentCategoryUrl = getUpdateDocumentCategoryUrl;
175
+ exports.listDocumentCategories = listDocumentCategories;
176
+ exports.postV2AuthLoginGlobal = postV2AuthLoginGlobal;
177
+ exports.updateDocumentCategory = updateDocumentCategory;
178
+ //# sourceMappingURL=client.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.cjs","sources":["../src/generated/client.ts"],"sourcesContent":["/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * @fastify/swagger\n * OpenAPI spec version: 9.5.2\n */\nexport type ListDocumentCategoriesParams = {\n /**\n * Page number starting from 0\n */\n page?: number\n /**\n * The number of items per page\n */\n perPage?: number\n}\n\n/**\n * Document category data\n */\nexport type ListDocumentCategories200ResultsItemAllOf = {\n /** Unique identifier of the category */\n id: number\n /**\n * Name of the category\n * @maxLength 100\n */\n name: string\n}\n\nexport type ListDocumentCategories200ResultsItemAllOfTwo = {\n /** Number of documents in this category */\n documents_count: number\n}\n\n/**\n * Document category list item\n */\nexport type ListDocumentCategories200ResultsItem = ListDocumentCategories200ResultsItemAllOf &\n ListDocumentCategories200ResultsItemAllOfTwo\n\n/**\n * Paginated response\n */\nexport type ListDocumentCategories200 = {\n /** Array of items of the current page */\n results: ListDocumentCategories200ResultsItem[]\n /** Total number of items not in this page but in the whole query */\n total: number\n}\n\n/**\n * Debug information of the error\n */\nexport type ListDocumentCategories403AllOfDebug = { [key: string]: unknown }\n\nexport type ListDocumentCategories403AllOf = {\n /** HTTP status code */\n statusCode: number\n /** Error code */\n error: string\n /** Localized error message */\n message: string\n /** Debug information of the error */\n debug?: ListDocumentCategories403AllOfDebug\n}\n\nexport type ListDocumentCategories403AllOfThreeStatusCode =\n typeof ListDocumentCategories403AllOfThreeStatusCode[keyof typeof ListDocumentCategories403AllOfThreeStatusCode]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ListDocumentCategories403AllOfThreeStatusCode = {\n NUMBER_403: 403,\n} as const\n\nexport type ListDocumentCategories403AllOfThreeError =\n typeof ListDocumentCategories403AllOfThreeError[keyof typeof ListDocumentCategories403AllOfThreeError]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ListDocumentCategories403AllOfThreeError = {\n 'forbidden-error': 'forbidden-error',\n} as const\n\nexport type ListDocumentCategories403AllOfThree = {\n statusCode: ListDocumentCategories403AllOfThreeStatusCode\n error: ListDocumentCategories403AllOfThreeError\n}\n\n/**\n * Error when the user is forbidden to access the resource\n */\nexport type ListDocumentCategories403 = ListDocumentCategories403AllOf & ListDocumentCategories403AllOfThree\n\n/**\n * Debug information of the error\n */\nexport type ListDocumentCategories404AllOfDebug = { [key: string]: unknown }\n\nexport type ListDocumentCategories404AllOf = {\n /** HTTP status code */\n statusCode: number\n /** Error code */\n error: string\n /** Localized error message */\n message: string\n /** Debug information of the error */\n debug?: ListDocumentCategories404AllOfDebug\n}\n\nexport type ListDocumentCategories404AllOfThreeStatusCode =\n typeof ListDocumentCategories404AllOfThreeStatusCode[keyof typeof ListDocumentCategories404AllOfThreeStatusCode]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ListDocumentCategories404AllOfThreeStatusCode = {\n NUMBER_404: 404,\n} as const\n\nexport type ListDocumentCategories404AllOfThreeError =\n typeof ListDocumentCategories404AllOfThreeError[keyof typeof ListDocumentCategories404AllOfThreeError]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ListDocumentCategories404AllOfThreeError = {\n 'not-found': 'not-found',\n} as const\n\nexport type ListDocumentCategories404AllOfThree = {\n statusCode: ListDocumentCategories404AllOfThreeStatusCode\n error: ListDocumentCategories404AllOfThreeError\n}\n\n/**\n * Error when the resource is not found\n */\nexport type ListDocumentCategories404 = ListDocumentCategories404AllOf & ListDocumentCategories404AllOfThree\n\n/**\n * Document category creation payload\n */\nexport type CreateDocumentCategoryBody = {\n /**\n * Name of the category\n * @maxLength 100\n */\n name: string\n}\n\n/**\n * Document category data\n */\nexport type CreateDocumentCategory200 = {\n /** Unique identifier of the category */\n id: number\n /**\n * Name of the category\n * @maxLength 100\n */\n name: string\n}\n\n/**\n * Debug information of the error\n */\nexport type CreateDocumentCategory403AllOfDebug = { [key: string]: unknown }\n\nexport type CreateDocumentCategory403AllOf = {\n /** HTTP status code */\n statusCode: number\n /** Error code */\n error: string\n /** Localized error message */\n message: string\n /** Debug information of the error */\n debug?: CreateDocumentCategory403AllOfDebug\n}\n\nexport type CreateDocumentCategory403AllOfThreeStatusCode =\n typeof CreateDocumentCategory403AllOfThreeStatusCode[keyof typeof CreateDocumentCategory403AllOfThreeStatusCode]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const CreateDocumentCategory403AllOfThreeStatusCode = {\n NUMBER_403: 403,\n} as const\n\nexport type CreateDocumentCategory403AllOfThreeError =\n typeof CreateDocumentCategory403AllOfThreeError[keyof typeof CreateDocumentCategory403AllOfThreeError]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const CreateDocumentCategory403AllOfThreeError = {\n 'forbidden-error': 'forbidden-error',\n} as const\n\nexport type CreateDocumentCategory403AllOfThree = {\n statusCode: CreateDocumentCategory403AllOfThreeStatusCode\n error: CreateDocumentCategory403AllOfThreeError\n}\n\n/**\n * Error when the user is forbidden to access the resource\n */\nexport type CreateDocumentCategory403 = CreateDocumentCategory403AllOf & CreateDocumentCategory403AllOfThree\n\n/**\n * Debug information of the error\n */\nexport type CreateDocumentCategory404AllOfDebug = { [key: string]: unknown }\n\nexport type CreateDocumentCategory404AllOf = {\n /** HTTP status code */\n statusCode: number\n /** Error code */\n error: string\n /** Localized error message */\n message: string\n /** Debug information of the error */\n debug?: CreateDocumentCategory404AllOfDebug\n}\n\nexport type CreateDocumentCategory404AllOfThreeStatusCode =\n typeof CreateDocumentCategory404AllOfThreeStatusCode[keyof typeof CreateDocumentCategory404AllOfThreeStatusCode]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const CreateDocumentCategory404AllOfThreeStatusCode = {\n NUMBER_404: 404,\n} as const\n\nexport type CreateDocumentCategory404AllOfThreeError =\n typeof CreateDocumentCategory404AllOfThreeError[keyof typeof CreateDocumentCategory404AllOfThreeError]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const CreateDocumentCategory404AllOfThreeError = {\n 'not-found': 'not-found',\n} as const\n\nexport type CreateDocumentCategory404AllOfThree = {\n statusCode: CreateDocumentCategory404AllOfThreeStatusCode\n error: CreateDocumentCategory404AllOfThreeError\n}\n\n/**\n * Error when the resource is not found\n */\nexport type CreateDocumentCategory404 = CreateDocumentCategory404AllOf & CreateDocumentCategory404AllOfThree\n\n/**\n * Document category data\n */\nexport type GetDocumentCategory200 = {\n /** Unique identifier of the category */\n id: number\n /**\n * Name of the category\n * @maxLength 100\n */\n name: string\n}\n\n/**\n * Debug information of the error\n */\nexport type GetDocumentCategory403AllOfDebug = { [key: string]: unknown }\n\nexport type GetDocumentCategory403AllOf = {\n /** HTTP status code */\n statusCode: number\n /** Error code */\n error: string\n /** Localized error message */\n message: string\n /** Debug information of the error */\n debug?: GetDocumentCategory403AllOfDebug\n}\n\nexport type GetDocumentCategory403AllOfThreeStatusCode =\n typeof GetDocumentCategory403AllOfThreeStatusCode[keyof typeof GetDocumentCategory403AllOfThreeStatusCode]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const GetDocumentCategory403AllOfThreeStatusCode = {\n NUMBER_403: 403,\n} as const\n\nexport type GetDocumentCategory403AllOfThreeError =\n typeof GetDocumentCategory403AllOfThreeError[keyof typeof GetDocumentCategory403AllOfThreeError]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const GetDocumentCategory403AllOfThreeError = {\n 'forbidden-error': 'forbidden-error',\n} as const\n\nexport type GetDocumentCategory403AllOfThree = {\n statusCode: GetDocumentCategory403AllOfThreeStatusCode\n error: GetDocumentCategory403AllOfThreeError\n}\n\n/**\n * Error when the user is forbidden to access the resource\n */\nexport type GetDocumentCategory403 = GetDocumentCategory403AllOf & GetDocumentCategory403AllOfThree\n\n/**\n * Debug information of the error\n */\nexport type GetDocumentCategory404AllOfDebug = { [key: string]: unknown }\n\nexport type GetDocumentCategory404AllOf = {\n /** HTTP status code */\n statusCode: number\n /** Error code */\n error: string\n /** Localized error message */\n message: string\n /** Debug information of the error */\n debug?: GetDocumentCategory404AllOfDebug\n}\n\nexport type GetDocumentCategory404AllOfThreeStatusCode =\n typeof GetDocumentCategory404AllOfThreeStatusCode[keyof typeof GetDocumentCategory404AllOfThreeStatusCode]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const GetDocumentCategory404AllOfThreeStatusCode = {\n NUMBER_404: 404,\n} as const\n\nexport type GetDocumentCategory404AllOfThreeError =\n typeof GetDocumentCategory404AllOfThreeError[keyof typeof GetDocumentCategory404AllOfThreeError]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const GetDocumentCategory404AllOfThreeError = {\n 'not-found': 'not-found',\n} as const\n\nexport type GetDocumentCategory404AllOfThree = {\n statusCode: GetDocumentCategory404AllOfThreeStatusCode\n error: GetDocumentCategory404AllOfThreeError\n}\n\n/**\n * Error when the resource is not found\n */\nexport type GetDocumentCategory404 = GetDocumentCategory404AllOf & GetDocumentCategory404AllOfThree\n\n/**\n * Document category update payload\n */\nexport type UpdateDocumentCategoryBody = {\n /**\n * Name of the category\n * @maxLength 100\n */\n name?: string\n}\n\n/**\n * Document category data\n */\nexport type UpdateDocumentCategory200 = {\n /** Unique identifier of the category */\n id: number\n /**\n * Name of the category\n * @maxLength 100\n */\n name: string\n}\n\n/**\n * Debug information of the error\n */\nexport type UpdateDocumentCategory403AllOfDebug = { [key: string]: unknown }\n\nexport type UpdateDocumentCategory403AllOf = {\n /** HTTP status code */\n statusCode: number\n /** Error code */\n error: string\n /** Localized error message */\n message: string\n /** Debug information of the error */\n debug?: UpdateDocumentCategory403AllOfDebug\n}\n\nexport type UpdateDocumentCategory403AllOfThreeStatusCode =\n typeof UpdateDocumentCategory403AllOfThreeStatusCode[keyof typeof UpdateDocumentCategory403AllOfThreeStatusCode]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UpdateDocumentCategory403AllOfThreeStatusCode = {\n NUMBER_403: 403,\n} as const\n\nexport type UpdateDocumentCategory403AllOfThreeError =\n typeof UpdateDocumentCategory403AllOfThreeError[keyof typeof UpdateDocumentCategory403AllOfThreeError]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UpdateDocumentCategory403AllOfThreeError = {\n 'forbidden-error': 'forbidden-error',\n} as const\n\nexport type UpdateDocumentCategory403AllOfThree = {\n statusCode: UpdateDocumentCategory403AllOfThreeStatusCode\n error: UpdateDocumentCategory403AllOfThreeError\n}\n\n/**\n * Error when the user is forbidden to access the resource\n */\nexport type UpdateDocumentCategory403 = UpdateDocumentCategory403AllOf & UpdateDocumentCategory403AllOfThree\n\n/**\n * Debug information of the error\n */\nexport type UpdateDocumentCategory404AllOfDebug = { [key: string]: unknown }\n\nexport type UpdateDocumentCategory404AllOf = {\n /** HTTP status code */\n statusCode: number\n /** Error code */\n error: string\n /** Localized error message */\n message: string\n /** Debug information of the error */\n debug?: UpdateDocumentCategory404AllOfDebug\n}\n\nexport type UpdateDocumentCategory404AllOfThreeStatusCode =\n typeof UpdateDocumentCategory404AllOfThreeStatusCode[keyof typeof UpdateDocumentCategory404AllOfThreeStatusCode]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UpdateDocumentCategory404AllOfThreeStatusCode = {\n NUMBER_404: 404,\n} as const\n\nexport type UpdateDocumentCategory404AllOfThreeError =\n typeof UpdateDocumentCategory404AllOfThreeError[keyof typeof UpdateDocumentCategory404AllOfThreeError]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const UpdateDocumentCategory404AllOfThreeError = {\n 'not-found': 'not-found',\n} as const\n\nexport type UpdateDocumentCategory404AllOfThree = {\n statusCode: UpdateDocumentCategory404AllOfThreeStatusCode\n error: UpdateDocumentCategory404AllOfThreeError\n}\n\n/**\n * Error when the resource is not found\n */\nexport type UpdateDocumentCategory404 = UpdateDocumentCategory404AllOf & UpdateDocumentCategory404AllOfThree\n\n/**\n * Response when the request is successful\n */\nexport type DeleteDocumentCategory200 = {\n /** If the request success or not */\n success: boolean\n}\n\n/**\n * Debug information of the error\n */\nexport type DeleteDocumentCategory403AllOfDebug = { [key: string]: unknown }\n\nexport type DeleteDocumentCategory403AllOf = {\n /** HTTP status code */\n statusCode: number\n /** Error code */\n error: string\n /** Localized error message */\n message: string\n /** Debug information of the error */\n debug?: DeleteDocumentCategory403AllOfDebug\n}\n\nexport type DeleteDocumentCategory403AllOfThreeStatusCode =\n typeof DeleteDocumentCategory403AllOfThreeStatusCode[keyof typeof DeleteDocumentCategory403AllOfThreeStatusCode]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const DeleteDocumentCategory403AllOfThreeStatusCode = {\n NUMBER_403: 403,\n} as const\n\nexport type DeleteDocumentCategory403AllOfThreeError =\n typeof DeleteDocumentCategory403AllOfThreeError[keyof typeof DeleteDocumentCategory403AllOfThreeError]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const DeleteDocumentCategory403AllOfThreeError = {\n 'forbidden-error': 'forbidden-error',\n} as const\n\nexport type DeleteDocumentCategory403AllOfThree = {\n statusCode: DeleteDocumentCategory403AllOfThreeStatusCode\n error: DeleteDocumentCategory403AllOfThreeError\n}\n\n/**\n * Error when the user is forbidden to access the resource\n */\nexport type DeleteDocumentCategory403 = DeleteDocumentCategory403AllOf & DeleteDocumentCategory403AllOfThree\n\n/**\n * Debug information of the error\n */\nexport type DeleteDocumentCategory404AllOfDebug = { [key: string]: unknown }\n\nexport type DeleteDocumentCategory404AllOf = {\n /** HTTP status code */\n statusCode: number\n /** Error code */\n error: string\n /** Localized error message */\n message: string\n /** Debug information of the error */\n debug?: DeleteDocumentCategory404AllOfDebug\n}\n\nexport type DeleteDocumentCategory404AllOfThreeStatusCode =\n typeof DeleteDocumentCategory404AllOfThreeStatusCode[keyof typeof DeleteDocumentCategory404AllOfThreeStatusCode]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const DeleteDocumentCategory404AllOfThreeStatusCode = {\n NUMBER_404: 404,\n} as const\n\nexport type DeleteDocumentCategory404AllOfThreeError =\n typeof DeleteDocumentCategory404AllOfThreeError[keyof typeof DeleteDocumentCategory404AllOfThreeError]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const DeleteDocumentCategory404AllOfThreeError = {\n 'not-found': 'not-found',\n} as const\n\nexport type DeleteDocumentCategory404AllOfThree = {\n statusCode: DeleteDocumentCategory404AllOfThreeStatusCode\n error: DeleteDocumentCategory404AllOfThreeError\n}\n\n/**\n * Error when the resource is not found\n */\nexport type DeleteDocumentCategory404 = DeleteDocumentCategory404AllOf & DeleteDocumentCategory404AllOfThree\n\nexport type postV2AuthLoginGlobalResponse200 = {\n data: void\n status: 200\n}\n\nexport type postV2AuthLoginGlobalResponseSuccess = postV2AuthLoginGlobalResponse200 & {\n headers: Headers\n}\nexport type postV2AuthLoginGlobalResponse = postV2AuthLoginGlobalResponseSuccess\n\nexport const getPostV2AuthLoginGlobalUrl = () => {\n return `/v2/auth/login/global`\n}\n\nexport const postV2AuthLoginGlobal = async (options?: RequestInit): Promise<postV2AuthLoginGlobalResponse> => {\n const res = await fetch(getPostV2AuthLoginGlobalUrl(), {\n ...options,\n method: 'POST',\n })\n\n const body = [204, 205, 304].includes(res.status) ? null : await res.text()\n\n const data: postV2AuthLoginGlobalResponse['data'] = body ? JSON.parse(body) : {}\n return { data, status: res.status, headers: res.headers } as postV2AuthLoginGlobalResponse\n}\n\n/**\n * A paginated list of document categories with the number of documents in each category\n */\nexport type listDocumentCategoriesResponse200 = {\n data: ListDocumentCategories200\n status: 200\n}\n\nexport type listDocumentCategoriesResponse403 = {\n data: ListDocumentCategories403\n status: 403\n}\n\nexport type listDocumentCategoriesResponse404 = {\n data: ListDocumentCategories404\n status: 404\n}\n\nexport type listDocumentCategoriesResponseSuccess = listDocumentCategoriesResponse200 & {\n headers: Headers\n}\nexport type listDocumentCategoriesResponseError = (\n | listDocumentCategoriesResponse403\n | listDocumentCategoriesResponse404\n) & {\n headers: Headers\n}\n\nexport type listDocumentCategoriesResponse = listDocumentCategoriesResponseSuccess | listDocumentCategoriesResponseError\n\nexport const getListDocumentCategoriesUrl = (\n ecosystemName: string,\n projectName: string,\n params?: ListDocumentCategoriesParams,\n) => {\n const normalizedParams = new URLSearchParams()\n\n Object.entries(params || {}).forEach(([key, value]) => {\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : value.toString())\n }\n })\n\n const stringifiedParams = normalizedParams.toString()\n\n return stringifiedParams.length > 0\n ? `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/?${stringifiedParams}`\n : `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/`\n}\n\nexport const listDocumentCategories = async (\n ecosystemName: string,\n projectName: string,\n params?: ListDocumentCategoriesParams,\n options?: RequestInit,\n): Promise<listDocumentCategoriesResponse> => {\n const res = await fetch(getListDocumentCategoriesUrl(ecosystemName, projectName, params), {\n ...options,\n method: 'GET',\n })\n\n const body = [204, 205, 304].includes(res.status) ? null : await res.text()\n\n const data: listDocumentCategoriesResponse['data'] = body ? JSON.parse(body) : {}\n return { data, status: res.status, headers: res.headers } as listDocumentCategoriesResponse\n}\n\n/**\n * Creates a document category with the provided data\n */\nexport type createDocumentCategoryResponse200 = {\n data: CreateDocumentCategory200\n status: 200\n}\n\nexport type createDocumentCategoryResponse403 = {\n data: CreateDocumentCategory403\n status: 403\n}\n\nexport type createDocumentCategoryResponse404 = {\n data: CreateDocumentCategory404\n status: 404\n}\n\nexport type createDocumentCategoryResponseSuccess = createDocumentCategoryResponse200 & {\n headers: Headers\n}\nexport type createDocumentCategoryResponseError = (\n | createDocumentCategoryResponse403\n | createDocumentCategoryResponse404\n) & {\n headers: Headers\n}\n\nexport type createDocumentCategoryResponse = createDocumentCategoryResponseSuccess | createDocumentCategoryResponseError\n\nexport const getCreateDocumentCategoryUrl = (ecosystemName: string, projectName: string) => {\n return `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/`\n}\n\nexport const createDocumentCategory = async (\n ecosystemName: string,\n projectName: string,\n createDocumentCategoryBody: CreateDocumentCategoryBody,\n options?: RequestInit,\n): Promise<createDocumentCategoryResponse> => {\n const res = await fetch(getCreateDocumentCategoryUrl(ecosystemName, projectName), {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...options?.headers },\n body: JSON.stringify(createDocumentCategoryBody),\n })\n\n const body = [204, 205, 304].includes(res.status) ? null : await res.text()\n\n const data: createDocumentCategoryResponse['data'] = body ? JSON.parse(body) : {}\n return { data, status: res.status, headers: res.headers } as createDocumentCategoryResponse\n}\n\n/**\n * Get the data of a document category\n */\nexport type getDocumentCategoryResponse200 = {\n data: GetDocumentCategory200\n status: 200\n}\n\nexport type getDocumentCategoryResponse403 = {\n data: GetDocumentCategory403\n status: 403\n}\n\nexport type getDocumentCategoryResponse404 = {\n data: GetDocumentCategory404\n status: 404\n}\n\nexport type getDocumentCategoryResponseSuccess = getDocumentCategoryResponse200 & {\n headers: Headers\n}\nexport type getDocumentCategoryResponseError = (getDocumentCategoryResponse403 | getDocumentCategoryResponse404) & {\n headers: Headers\n}\n\nexport type getDocumentCategoryResponse = getDocumentCategoryResponseSuccess | getDocumentCategoryResponseError\n\nexport const getGetDocumentCategoryUrl = (ecosystemName: string, projectName: string, id: number) => {\n return `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/${id}`\n}\n\nexport const getDocumentCategory = async (\n ecosystemName: string,\n projectName: string,\n id: number,\n options?: RequestInit,\n): Promise<getDocumentCategoryResponse> => {\n const res = await fetch(getGetDocumentCategoryUrl(ecosystemName, projectName, id), {\n ...options,\n method: 'GET',\n })\n\n const body = [204, 205, 304].includes(res.status) ? null : await res.text()\n\n const data: getDocumentCategoryResponse['data'] = body ? JSON.parse(body) : {}\n return { data, status: res.status, headers: res.headers } as getDocumentCategoryResponse\n}\n\n/**\n * Updates (patch) a document category with the provided data\n */\nexport type updateDocumentCategoryResponse200 = {\n data: UpdateDocumentCategory200\n status: 200\n}\n\nexport type updateDocumentCategoryResponse403 = {\n data: UpdateDocumentCategory403\n status: 403\n}\n\nexport type updateDocumentCategoryResponse404 = {\n data: UpdateDocumentCategory404\n status: 404\n}\n\nexport type updateDocumentCategoryResponseSuccess = updateDocumentCategoryResponse200 & {\n headers: Headers\n}\nexport type updateDocumentCategoryResponseError = (\n | updateDocumentCategoryResponse403\n | updateDocumentCategoryResponse404\n) & {\n headers: Headers\n}\n\nexport type updateDocumentCategoryResponse = updateDocumentCategoryResponseSuccess | updateDocumentCategoryResponseError\n\nexport const getUpdateDocumentCategoryUrl = (ecosystemName: string, projectName: string, id: number) => {\n return `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/${id}`\n}\n\nexport const updateDocumentCategory = async (\n ecosystemName: string,\n projectName: string,\n id: number,\n updateDocumentCategoryBody: UpdateDocumentCategoryBody,\n options?: RequestInit,\n): Promise<updateDocumentCategoryResponse> => {\n const res = await fetch(getUpdateDocumentCategoryUrl(ecosystemName, projectName, id), {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...options?.headers },\n body: JSON.stringify(updateDocumentCategoryBody),\n })\n\n const body = [204, 205, 304].includes(res.status) ? null : await res.text()\n\n const data: updateDocumentCategoryResponse['data'] = body ? JSON.parse(body) : {}\n return { data, status: res.status, headers: res.headers } as updateDocumentCategoryResponse\n}\n\n/**\n * Deletes a document category with the provided ID\n */\nexport type deleteDocumentCategoryResponse200 = {\n data: DeleteDocumentCategory200\n status: 200\n}\n\nexport type deleteDocumentCategoryResponse403 = {\n data: DeleteDocumentCategory403\n status: 403\n}\n\nexport type deleteDocumentCategoryResponse404 = {\n data: DeleteDocumentCategory404\n status: 404\n}\n\nexport type deleteDocumentCategoryResponseSuccess = deleteDocumentCategoryResponse200 & {\n headers: Headers\n}\nexport type deleteDocumentCategoryResponseError = (\n | deleteDocumentCategoryResponse403\n | deleteDocumentCategoryResponse404\n) & {\n headers: Headers\n}\n\nexport type deleteDocumentCategoryResponse = deleteDocumentCategoryResponseSuccess | deleteDocumentCategoryResponseError\n\nexport const getDeleteDocumentCategoryUrl = (ecosystemName: string, projectName: string, id: number) => {\n return `/v2/ecosystem/${ecosystemName}/project/${projectName}/document-category/${id}`\n}\n\nexport const deleteDocumentCategory = async (\n ecosystemName: string,\n projectName: string,\n id: number,\n options?: RequestInit,\n): Promise<deleteDocumentCategoryResponse> => {\n const res = await fetch(getDeleteDocumentCategoryUrl(ecosystemName, projectName, id), {\n ...options,\n method: 'DELETE',\n })\n\n const body = [204, 205, 304].includes(res.status) ? null : await res.text()\n\n const data: deleteDocumentCategoryResponse['data'] = body ? JSON.parse(body) : {}\n return { data, status: res.status, headers: res.headers } as deleteDocumentCategoryResponse\n}\n"],"names":[],"mappings":";;AAuEO,MAAM,gDAAgD;AAAA,EAC3D,YAAY;AACd;AAMO,MAAM,2CAA2C;AAAA,EACtD,mBAAmB;AACrB;AAgCO,MAAM,gDAAgD;AAAA,EAC3D,YAAY;AACd;AAMO,MAAM,2CAA2C;AAAA,EACtD,aAAa;AACf;AAwDO,MAAM,gDAAgD;AAAA,EAC3D,YAAY;AACd;AAMO,MAAM,2CAA2C;AAAA,EACtD,mBAAmB;AACrB;AAgCO,MAAM,gDAAgD;AAAA,EAC3D,YAAY;AACd;AAMO,MAAM,2CAA2C;AAAA,EACtD,aAAa;AACf;AA6CO,MAAM,6CAA6C;AAAA,EACxD,YAAY;AACd;AAMO,MAAM,wCAAwC;AAAA,EACnD,m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