-
-
Notifications
You must be signed in to change notification settings - Fork 106
/
Copy pathschemas.js
380 lines (378 loc) · 11.4 KB
/
schemas.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
/**
* @swagger
* components:
* securitySchemes:
* BearerAuth:
* type: http
* scheme: bearer
* bearerFormat: JWT
* description: |
* JWT-based authentication for web app users. The token is obtained by authenticating via the login endpoint.
*
* ### How to authenticate:
* 1. Send a POST request to `/login` with your username and password
* 2. The server will respond with a JWT token (also set as a cookie in browsers)
* 3. Include this token in the `Authorization` header as `Bearer {token}`
*
* Example:
* ```
* Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
* ```
*
* JWT tokens are valid for 24 hours after issuance.
*
* ApiKeyAuth:
* type: apiKey
* in: header
* name: x-api-key
* description: |
* API key authentication for programmatic access. The API key can be generated or regenerated using the /api/key-regenerate endpoint.
*
* ### How to authenticate:
* 1. Access the API key from your application settings
* 2. Include the API key in the `x-api-key` HTTP header for all requests
*
* Example:
* ```
* x-api-key: 7c1f3f5e2b0a9d8c6e4b2a1d3f5e8c9b2a1d3f5e
* ```
*
* API keys do not expire unless regenerated.
*/
/**
* @swagger
* components:
* schemas:
* Error:
* type: object
* properties:
* error:
* type: string
* description: Error message
* example: Error resetting documents
*
* User:
* type: object
* required:
* - username
* - password
* properties:
* username:
* type: string
* description: User's username
* example: admin
* password:
* type: string
* format: password
* description: User's password (will be hashed)
* example: securePassword123
* id:
* type: integer
* description: User ID (auto-generated)
* example: 1
* readOnly: true
*
* LoginRequest:
* type: object
* required:
* - username
* - password
* properties:
* username:
* type: string
* description: User's username
* example: admin
* password:
* type: string
* format: password
* description: User's password
* example: securePassword123
*
* LoginResponse:
* type: object
* properties:
* token:
* type: string
* description: JWT token for authentication
* example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
* expiresIn:
* type: string
* description: Token expiration time
* example: 24h
*
* Document:
* type: object
* properties:
* id:
* type: integer
* description: Document ID
* example: 123
* title:
* type: string
* description: Document title
* example: Invoice #12345
* tags:
* type: array
* items:
* type: integer
* description: Array of tag IDs
* example: [1, 4, 7]
* correspondent:
* type: integer
* description: Correspondent ID
* example: 5
* created:
* type: string
* format: date-time
* description: Document creation date
* example: 2023-12-15T10:30:00Z
* document_type:
* type: integer
* description: Document type ID
* example: 2
* content:
* type: string
* description: Document text content
* example: "This is an invoice from Company XYZ..."
* language:
* type: string
* description: Document language code
* example: en
* custom_fields:
* type: array
* items:
* $ref: '#/components/schemas/CustomField'
* description: Custom field values for the document
*
* DocumentUpdateRequest:
* type: object
* properties:
* title:
* type: string
* description: New document title
* example: Updated Invoice #12345
* tags:
* type: array
* items:
* type: integer
* description: Array of tag IDs
* example: [1, 4, 7]
* correspondent:
* type: integer
* description: Correspondent ID
* example: 5
* document_type:
* type: integer
* description: Document type ID
* example: 2
* language:
* type: string
* description: Document language code
* example: en
* custom_fields:
* type: array
* items:
* $ref: '#/components/schemas/CustomField'
* description: Custom field values for the document
*
* CustomField:
* type: object
* required:
* - field
* - value
* properties:
* field:
* type: integer
* description: Custom field ID
* example: 3
* value:
* type: string
* description: Custom field value
* example: "123.45"
*
* AnalysisResult:
* type: object
* properties:
* document:
* type: object
* properties:
* title:
* type: string
* description: Suggested document title
* example: Invoice from ABC Corporation
* tags:
* type: array
* items:
* type: string
* description: Suggested tags
* example: ["invoice", "utilities", "2023"]
* correspondent:
* type: string
* description: Suggested correspondent name
* example: ABC Corporation
* document_type:
* type: string
* description: Suggested document type
* example: Invoice
* document_date:
* type: string
* format: date-time
* description: Extracted document date
* example: 2023-12-15T00:00:00Z
* language:
* type: string
* description: Detected document language
* example: en
* custom_fields:
* type: object
* additionalProperties:
* type: object
* properties:
* field_name:
* type: string
* description: Custom field name
* example: invoice_amount
* value:
* type: string
* description: Custom field value
* example: "123.45"
* metrics:
* type: object
* properties:
* promptTokens:
* type: integer
* description: Number of tokens in the prompt
* example: 450
* completionTokens:
* type: integer
* description: Number of tokens in the completion
* example: 120
* totalTokens:
* type: integer
* description: Total tokens used
* example: 570
* error:
* type: string
* description: Error message if analysis failed
* example: null
*
* Tag:
* type: object
* properties:
* id:
* type: integer
* description: Tag ID
* example: 5
* name:
* type: string
* description: Tag name
* example: Invoice
* color:
* type: string
* description: Tag color (hex code)
* example: "#FF5733"
* match:
* type: string
* enum: [ANY, ALL, LITERAL, REGEX]
* description: Tag matching algorithm
* example: ANY
*
* HistoryItem:
* type: object
* properties:
* document_id:
* type: integer
* description: Document ID
* example: 123
* title:
* type: string
* description: Document title
* example: Invoice #12345
* created_at:
* type: string
* format: date-time
* description: Date and time when the processing occurred
* example: 2023-12-15T10:30:00Z
* tags:
* type: array
* items:
* $ref: '#/components/schemas/Tag'
* correspondent:
* type: string
* description: Document correspondent name
* example: Acme Corp
* link:
* type: string
* description: Link to the document in Paperless-ngx
* example: http://paperless.example.com/documents/123/
*
* HistoryResponse:
* type: object
* properties:
* draw:
* type: integer
* description: DataTables draw counter echo
* example: 1
* recordsTotal:
* type: integer
* description: Total number of records in database
* example: 100
* recordsFiltered:
* type: integer
* description: Number of records after filtering
* example: 25
* data:
* type: array
* items:
* $ref: '#/components/schemas/HistoryItem'
*
* ChatMessage:
* type: object
* required:
* - documentId
* - message
* properties:
* documentId:
* type: integer
* description: ID of the document the chat is about
* example: 123
* message:
* type: string
* description: User's message to the AI
* example: What is the invoice amount?
*
* ChatInitResponse:
* type: object
* properties:
* success:
* type: boolean
* description: Whether initialization was successful
* example: true
* message:
* type: string
* description: Status message
* example: Chat initialized for document 123
*
* APIKeyResponse:
* type: object
* properties:
* success:
* type: string
* description: The newly generated API key
* example: 7c1f3f5e2b0a9d8c6e4b2a1d3f5e8c9b2a1d3f5e
*
* HealthResponse:
* type: object
* properties:
* status:
* type: string
* enum: [healthy, not_configured, error]
* description: System health status
* example: healthy
* message:
* type: string
* description: Additional status information (for non-healthy states)
* example: Application setup not completed
*/
// This file only contains JSDoc comments for Swagger schema definitions
// No actual code is needed