opex792 commited on
Commit
8b34dfb
·
verified ·
1 Parent(s): 3a586c1

Create openapi.yaml

Browse files
Files changed (1) hide show
  1. openapi.yaml +374 -0
openapi.yaml ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ openapi: 3.0.0
2
+ info:
3
+ title: StihiRus Reader API
4
+ description: Provides access to author data and poems from stihirus.ru via the stihirus-reader library.
5
+ version: 1.2.0
6
+ servers:
7
+ - url: /
8
+ description: Current server
9
+
10
+ paths:
11
+ /author/{identifier}:
12
+ get:
13
+ summary: Get Author Data and Poems
14
+ description: Fetches author profile information and optionally poems based on the page parameter.
15
+ parameters:
16
+ - name: identifier
17
+ in: path
18
+ required: true
19
+ description: Author identifier (numeric ID or string username/URL part).
20
+ schema:
21
+ type: string # Use string even for ID to simplify path handling
22
+ example: "oreh-orehov"
23
+ - name: page
24
+ in: query
25
+ required: false
26
+ description: Controls poem fetching. `null` or empty = all poems, `0` = profile only, `N > 0` = specific page N. Defaults to `null`.
27
+ schema:
28
+ type: string # Allow 'null', '0', or positive integers as strings
29
+ example: "1"
30
+ - name: delay
31
+ in: query
32
+ required: false
33
+ description: Delay in ms between requests when fetching all pages (`page=null`). Defaults to 500ms.
34
+ schema:
35
+ type: integer
36
+ format: int32
37
+ minimum: 0
38
+ example: 500
39
+ responses:
40
+ '200':
41
+ description: Successful response with author data.
42
+ content:
43
+ application/json:
44
+ schema:
45
+ $ref: '#/components/schemas/StihirusSuccessResponse'
46
+ '400':
47
+ description: Invalid input parameter (identifier, page, or delay).
48
+ content:
49
+ application/json:
50
+ schema:
51
+ $ref: '#/components/schemas/StihirusErrorResponse'
52
+ '404':
53
+ description: Author not found.
54
+ content:
55
+ application/json:
56
+ schema:
57
+ $ref: '#/components/schemas/StihirusErrorResponse'
58
+ '500':
59
+ description: Internal server error or error fetching/parsing data from stihirus.ru.
60
+ content:
61
+ application/json:
62
+ schema:
63
+ $ref: '#/components/schemas/StihirusErrorResponse'
64
+ '502':
65
+ description: Bad Gateway (HTTP error from stihirus.ru).
66
+ content:
67
+ application/json:
68
+ schema:
69
+ $ref: '#/components/schemas/StihirusErrorResponse'
70
+ '503':
71
+ description: Service Unavailable (Network error connecting to stihirus.ru).
72
+ content:
73
+ application/json:
74
+ schema:
75
+ $ref: '#/components/schemas/StihirusErrorResponse'
76
+
77
+ /author/{identifier}/filters:
78
+ get:
79
+ summary: Get Author Poem Filters
80
+ description: Fetches available filter options (rubrics, dates) for an author's poems.
81
+ parameters:
82
+ - name: identifier
83
+ in: path
84
+ required: true
85
+ description: Author identifier (numeric ID or string username/URL part).
86
+ schema:
87
+ type: string
88
+ example: "14260"
89
+ responses:
90
+ '200':
91
+ description: Successful response with filter data.
92
+ content:
93
+ application/json:
94
+ schema:
95
+ $ref: '#/components/schemas/StihirusFiltersSuccessResponse'
96
+ '400':
97
+ description: Invalid identifier format.
98
+ content:
99
+ application/json:
100
+ schema:
101
+ $ref: '#/components/schemas/StihirusErrorResponse'
102
+ '404':
103
+ description: Author not found.
104
+ content:
105
+ application/json:
106
+ schema:
107
+ $ref: '#/components/schemas/StihirusErrorResponse'
108
+ '500':
109
+ description: Internal server error or error fetching/parsing data from stihirus.ru.
110
+ content:
111
+ application/json:
112
+ schema:
113
+ $ref: '#/components/schemas/StihirusErrorResponse'
114
+ '502':
115
+ description: Bad Gateway (HTTP error from stihirus.ru).
116
+ content:
117
+ application/json:
118
+ schema:
119
+ $ref: '#/components/schemas/StihirusErrorResponse'
120
+ '503':
121
+ description: Service Unavailable (Network error connecting to stihirus.ru).
122
+ content:
123
+ application/json:
124
+ schema:
125
+ $ref: '#/components/schemas/StihirusErrorResponse'
126
+
127
+ components:
128
+ schemas:
129
+ StihirusError:
130
+ type: object
131
+ properties:
132
+ code:
133
+ type: integer
134
+ format: int32
135
+ description: HTTP status or custom error code.
136
+ message:
137
+ type: string
138
+ description: Error message.
139
+ originalMessage:
140
+ type: string
141
+ description: Optional underlying error message.
142
+ required:
143
+ - code
144
+ - message
145
+
146
+ StihirusErrorResponse:
147
+ type: object
148
+ properties:
149
+ status:
150
+ type: string
151
+ enum: [error]
152
+ error:
153
+ $ref: '#/components/schemas/StihirusError'
154
+ required:
155
+ - status
156
+ - error
157
+
158
+ StihirusAuthorStats:
159
+ type: object
160
+ properties:
161
+ poems:
162
+ type: integer
163
+ description: Total number of poems (from profile HTML).
164
+ reviewsSent:
165
+ type: integer
166
+ description: Number of reviews sent.
167
+ reviewsReceived:
168
+ type: integer
169
+ description: Number of reviews received.
170
+ required:
171
+ - poems
172
+ - reviewsSent
173
+ - reviewsReceived
174
+
175
+ StihirusCollectionInfo:
176
+ type: object
177
+ properties:
178
+ name:
179
+ type: string
180
+ description: Collection name.
181
+ url:
182
+ type: string
183
+ format: url
184
+ description: Full URL to the collection.
185
+ required:
186
+ - name
187
+ - url
188
+
189
+ StihirusPoemRubric:
190
+ type: object
191
+ properties:
192
+ name:
193
+ type: string
194
+ description: Rubric name.
195
+ url:
196
+ type: string
197
+ format: url
198
+ nullable: true
199
+ description: Full URL to the rubric page, or null.
200
+ required:
201
+ - name
202
+ - url
203
+
204
+ StihirusPoem:
205
+ type: object
206
+ properties:
207
+ id:
208
+ type: integer
209
+ format: int64
210
+ description: Unique ID.
211
+ title:
212
+ type: string
213
+ description: Title (or '***').
214
+ text:
215
+ type: string
216
+ description: Full text.
217
+ created:
218
+ type: string
219
+ description: Creation date/time string (e.g., "27.03.2025 20:19").
220
+ rubric:
221
+ $ref: '#/components/schemas/StihirusPoemRubric'
222
+ collection:
223
+ type: string
224
+ nullable: true
225
+ description: Author's collection name, or null.
226
+ rating:
227
+ type: integer
228
+ description: Likes count.
229
+ commentsCount:
230
+ type: integer
231
+ description: Comments count.
232
+ imageUrl:
233
+ type: string
234
+ format: url
235
+ nullable: true
236
+ description: URL to poem's image, or null.
237
+ hasCertificate:
238
+ type: boolean
239
+ description: Whether it has a certificate.
240
+ required:
241
+ - id
242
+ - title
243
+ - text
244
+ - created
245
+ - rubric
246
+ - collection
247
+ - rating
248
+ - commentsCount
249
+ - imageUrl
250
+ - hasCertificate
251
+
252
+ StihirusAuthorData:
253
+ type: object
254
+ properties:
255
+ authorId:
256
+ type: integer
257
+ format: int64
258
+ username:
259
+ type: string
260
+ profileUrl:
261
+ type: string
262
+ format: url
263
+ canonicalUsername:
264
+ type: string
265
+ description:
266
+ type: string
267
+ avatarUrl:
268
+ type: string
269
+ format: url
270
+ nullable: true
271
+ headerUrl:
272
+ type: string
273
+ format: url
274
+ nullable: true
275
+ status:
276
+ type: string
277
+ lastVisit:
278
+ type: string
279
+ stats:
280
+ $ref: '#/components/schemas/StihirusAuthorStats'
281
+ collections:
282
+ type: array
283
+ items:
284
+ $ref: '#/components/schemas/StihirusCollectionInfo'
285
+ poems:
286
+ type: array
287
+ items:
288
+ $ref: '#/components/schemas/StihirusPoem'
289
+ required:
290
+ - authorId
291
+ - username
292
+ - profileUrl
293
+ - canonicalUsername
294
+ - description
295
+ - avatarUrl
296
+ - headerUrl
297
+ - status
298
+ - lastVisit
299
+ - stats
300
+ - collections
301
+ - poems
302
+
303
+ StihirusSuccessResponse:
304
+ type: object
305
+ properties:
306
+ status:
307
+ type: string
308
+ enum: [success]
309
+ data:
310
+ $ref: '#/components/schemas/StihirusAuthorData'
311
+ required:
312
+ - status
313
+ - data
314
+
315
+ StihirusFilterRubric:
316
+ type: object
317
+ properties:
318
+ id:
319
+ type: integer
320
+ description: Rubric ID used for filtering.
321
+ name:
322
+ type: string
323
+ description: Display name of the rubric.
324
+ count:
325
+ type: integer
326
+ description: Number of poems in this rubric.
327
+ required:
328
+ - id
329
+ - name
330
+ - count
331
+
332
+ StihirusFilterDate:
333
+ type: object
334
+ properties:
335
+ year:
336
+ type: integer
337
+ description: Year used for filtering.
338
+ month:
339
+ type: integer
340
+ description: Month used for filtering (1-12).
341
+ count:
342
+ type: integer
343
+ description: Number of poems published in this month/year.
344
+ required:
345
+ - year
346
+ - month
347
+ - count
348
+
349
+ StihirusAuthorFiltersData:
350
+ type: object
351
+ properties:
352
+ rubrics:
353
+ type: array
354
+ items:
355
+ $ref: '#/components/schemas/StihirusFilterRubric'
356
+ dates:
357
+ type: array
358
+ items:
359
+ $ref: '#/components/schemas/StihirusFilterDate'
360
+ required:
361
+ - rubrics
362
+ - dates
363
+
364
+ StihirusFiltersSuccessResponse:
365
+ type: object
366
+ properties:
367
+ status:
368
+ type: string
369
+ enum: [success]
370
+ data:
371
+ $ref: '#/components/schemas/StihirusAuthorFiltersData'
372
+ required:
373
+ - status
374
+ - data