@verbatims/sdk 1.4.0 → 1.4.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.
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -2
- package/dist/client.js.map +1 -1
- package/dist/resources/authors.d.ts +60 -55
- package/dist/resources/authors.d.ts.map +1 -1
- package/dist/resources/authors.js +14 -11
- package/dist/resources/authors.js.map +1 -1
- package/dist/resources/quotes.d.ts +77 -77
- package/dist/resources/quotes.d.ts.map +1 -1
- package/dist/resources/quotes.js +31 -27
- package/dist/resources/quotes.js.map +1 -1
- package/dist/resources/references.d.ts +35 -40
- package/dist/resources/references.d.ts.map +1 -1
- package/dist/resources/references.js +8 -8
- package/dist/resources/references.js.map +1 -1
- package/dist/resources/search.d.ts +32 -10
- package/dist/resources/search.d.ts.map +1 -1
- package/dist/resources/search.js +18 -5
- package/dist/resources/search.js.map +1 -1
- package/dist/resources/tags.d.ts +8 -4
- package/dist/resources/tags.d.ts.map +1 -1
- package/dist/resources/tags.js +4 -2
- package/dist/resources/tags.js.map +1 -1
- package/dist/types.d.ts +49 -37
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/client.ts +4 -2
- package/src/resources/__tests__/resources.test.ts +22 -22
- package/src/resources/authors.ts +16 -11
- package/src/resources/quotes.ts +35 -27
- package/src/resources/references.ts +9 -8
- package/src/resources/search.ts +21 -6
- package/src/resources/tags.ts +4 -2
- package/src/types.ts +54 -38
|
@@ -38,7 +38,7 @@ describe('QuotesResource', () => {
|
|
|
38
38
|
it('calls GET /quotes with params', async () => {
|
|
39
39
|
fetchFn.mockResolvedValue(mockResponse({
|
|
40
40
|
success: true,
|
|
41
|
-
data: [{ id: 1,
|
|
41
|
+
data: [{ id: 1, content: 'Test', language: 'fr', stats: { views: 0, likes: 0, shares: 0 }, created_at: '2024-01-01', updated_at: '2024-01-01' }],
|
|
42
42
|
pagination: { page: 1, limit: 10, total: 1, totalPages: 1, hasMore: false },
|
|
43
43
|
}))
|
|
44
44
|
|
|
@@ -52,7 +52,7 @@ describe('QuotesResource', () => {
|
|
|
52
52
|
expect(parsed.searchParams.get('limit')).toBe('10')
|
|
53
53
|
expect(result.success).toBe(true)
|
|
54
54
|
expect(result.data).toHaveLength(1)
|
|
55
|
-
expect(result.data![0].
|
|
55
|
+
expect(result.data![0].content).toBe('Test')
|
|
56
56
|
})
|
|
57
57
|
})
|
|
58
58
|
|
|
@@ -60,7 +60,7 @@ describe('QuotesResource', () => {
|
|
|
60
60
|
it('calls GET /quotes/:id', async () => {
|
|
61
61
|
fetchFn.mockResolvedValue(mockResponse({
|
|
62
62
|
success: true,
|
|
63
|
-
data: { id: 42,
|
|
63
|
+
data: { id: 42, content: 'Quote 42', language: 'en', stats: { views: 10, likes: 5, shares: 2 }, created_at: '2024-01-01', updated_at: '2024-01-01' },
|
|
64
64
|
}))
|
|
65
65
|
|
|
66
66
|
const result = await quotes.get(42)
|
|
@@ -74,7 +74,7 @@ describe('QuotesResource', () => {
|
|
|
74
74
|
it('calls POST /quotes with body', async () => {
|
|
75
75
|
fetchFn.mockResolvedValue(mockResponse({
|
|
76
76
|
success: true,
|
|
77
|
-
data: { id: 1,
|
|
77
|
+
data: { id: 1, content: 'New quote', language: 'en', stats: { views: 0, likes: 0, shares: 0 }, created_at: '2024-01-01', updated_at: '2024-01-01' },
|
|
78
78
|
}))
|
|
79
79
|
|
|
80
80
|
await quotes.create({ name: 'New quote', language: 'en' })
|
|
@@ -88,7 +88,7 @@ describe('QuotesResource', () => {
|
|
|
88
88
|
it('calls PUT /quotes/:id with body', async () => {
|
|
89
89
|
fetchFn.mockResolvedValue(mockResponse({
|
|
90
90
|
success: true,
|
|
91
|
-
data: { id: 1,
|
|
91
|
+
data: { id: 1, content: 'Updated', language: 'en', stats: { views: 0, likes: 0, shares: 0 }, created_at: '2024-01-01', updated_at: '2024-01-01' },
|
|
92
92
|
}))
|
|
93
93
|
|
|
94
94
|
await quotes.update(1, { name: 'Updated' })
|
|
@@ -113,12 +113,12 @@ describe('QuotesResource', () => {
|
|
|
113
113
|
fetchFn
|
|
114
114
|
.mockResolvedValueOnce(mockResponse({
|
|
115
115
|
success: true,
|
|
116
|
-
data: [{ id: 1,
|
|
116
|
+
data: [{ id: 1, content: 'A', language: 'fr', stats: { views: 0, likes: 0, shares: 0 }, created_at: '2024-01-01', updated_at: '2024-01-01' }],
|
|
117
117
|
pagination: { page: 1, limit: 1, total: 2, totalPages: 2, hasMore: true },
|
|
118
118
|
}))
|
|
119
119
|
.mockResolvedValueOnce(mockResponse({
|
|
120
120
|
success: true,
|
|
121
|
-
data: [{ id: 2,
|
|
121
|
+
data: [{ id: 2, content: 'B', language: 'fr', stats: { views: 0, likes: 0, shares: 0 }, created_at: '2024-01-01', updated_at: '2024-01-01' }],
|
|
122
122
|
pagination: { page: 2, limit: 1, total: 2, totalPages: 2, hasMore: false },
|
|
123
123
|
}))
|
|
124
124
|
|
|
@@ -148,7 +148,7 @@ describe('AuthorsResource', () => {
|
|
|
148
148
|
it('list calls GET /authors', async () => {
|
|
149
149
|
fetchFn.mockResolvedValue(mockResponse({
|
|
150
150
|
success: true,
|
|
151
|
-
data: [{ id: 1, name: 'Author',
|
|
151
|
+
data: [{ id: 1, name: 'Author', stats: { views: 0, likes: 0 }, created_at: '2024-01-01' }],
|
|
152
152
|
pagination: { page: 1, limit: 10, total: 1, totalPages: 1, hasMore: false },
|
|
153
153
|
}))
|
|
154
154
|
|
|
@@ -163,7 +163,7 @@ describe('AuthorsResource', () => {
|
|
|
163
163
|
it('get calls GET /authors/:id', async () => {
|
|
164
164
|
fetchFn.mockResolvedValue(mockResponse({
|
|
165
165
|
success: true,
|
|
166
|
-
data: { id: 5, name: 'Author 5',
|
|
166
|
+
data: { id: 5, name: 'Author 5', stats: { views: 0, likes: 0 }, created_at: '2024-01-01' },
|
|
167
167
|
}))
|
|
168
168
|
|
|
169
169
|
await authors.get(5)
|
|
@@ -174,7 +174,7 @@ describe('AuthorsResource', () => {
|
|
|
174
174
|
it('create calls POST /authors', async () => {
|
|
175
175
|
fetchFn.mockResolvedValue(mockResponse({
|
|
176
176
|
success: true,
|
|
177
|
-
data: { id: 1, name: 'New Author',
|
|
177
|
+
data: { id: 1, name: 'New Author', stats: { views: 0, likes: 0 }, created_at: '2024-01-01' },
|
|
178
178
|
}))
|
|
179
179
|
|
|
180
180
|
await authors.create({ name: 'New Author', is_fictional: true })
|
|
@@ -186,7 +186,7 @@ describe('AuthorsResource', () => {
|
|
|
186
186
|
it('update calls PUT /authors/:id', async () => {
|
|
187
187
|
fetchFn.mockResolvedValue(mockResponse({
|
|
188
188
|
success: true,
|
|
189
|
-
data: { id: 1, name: 'Updated',
|
|
189
|
+
data: { id: 1, name: 'Updated', stats: { views: 0, likes: 0 }, created_at: '2024-01-01' },
|
|
190
190
|
}))
|
|
191
191
|
|
|
192
192
|
await authors.update(1, { name: 'Updated' })
|
|
@@ -208,7 +208,7 @@ describe('ReferencesResource', () => {
|
|
|
208
208
|
it('list calls GET /references', async () => {
|
|
209
209
|
fetchFn.mockResolvedValue(mockResponse({
|
|
210
210
|
success: true,
|
|
211
|
-
data: [{ id: 1, name: 'Ref',
|
|
211
|
+
data: [{ id: 1, name: 'Ref', type: 'book', stats: { views: 0, likes: 0 }, created_at: '2024-01-01' }],
|
|
212
212
|
pagination: { page: 1, limit: 10, total: 1, totalPages: 1, hasMore: false },
|
|
213
213
|
}))
|
|
214
214
|
|
|
@@ -222,7 +222,7 @@ describe('ReferencesResource', () => {
|
|
|
222
222
|
it('get calls GET /references/:id', async () => {
|
|
223
223
|
fetchFn.mockResolvedValue(mockResponse({
|
|
224
224
|
success: true,
|
|
225
|
-
data: { id: 3, name: 'Ref 3',
|
|
225
|
+
data: { id: 3, name: 'Ref 3', type: 'book', stats: { views: 0, likes: 0 }, created_at: '2024-01-01' },
|
|
226
226
|
}))
|
|
227
227
|
|
|
228
228
|
await references.get(3)
|
|
@@ -233,7 +233,7 @@ describe('ReferencesResource', () => {
|
|
|
233
233
|
it('create calls POST /references', async () => {
|
|
234
234
|
fetchFn.mockResolvedValue(mockResponse({
|
|
235
235
|
success: true,
|
|
236
|
-
data: { id: 1, name: 'New Ref',
|
|
236
|
+
data: { id: 1, name: 'New Ref', type: 'movie', stats: { views: 0, likes: 0 }, created_at: '2024-01-01' },
|
|
237
237
|
}))
|
|
238
238
|
|
|
239
239
|
await references.create({ name: 'New Ref', primary_type: 'movie' })
|
|
@@ -244,7 +244,7 @@ describe('ReferencesResource', () => {
|
|
|
244
244
|
it('update calls PUT /references/:id', async () => {
|
|
245
245
|
fetchFn.mockResolvedValue(mockResponse({
|
|
246
246
|
success: true,
|
|
247
|
-
data: { id: 1, name: 'Updated',
|
|
247
|
+
data: { id: 1, name: 'Updated', type: 'book', stats: { views: 0, likes: 0 }, created_at: '2024-01-01' },
|
|
248
248
|
}))
|
|
249
249
|
|
|
250
250
|
await references.update(1, { name: 'Updated' })
|
|
@@ -266,7 +266,7 @@ describe('TagsResource', () => {
|
|
|
266
266
|
it('list calls GET /tags', async () => {
|
|
267
267
|
fetchFn.mockResolvedValue(mockResponse({
|
|
268
268
|
success: true,
|
|
269
|
-
data: [{ id: 1, name: 'wisdom' }],
|
|
269
|
+
data: [{ id: 1, name: 'wisdom', color: '#6C757D' }],
|
|
270
270
|
pagination: { page: 1, limit: 10, total: 1, totalPages: 1, hasMore: false },
|
|
271
271
|
}))
|
|
272
272
|
|
|
@@ -280,12 +280,12 @@ describe('TagsResource', () => {
|
|
|
280
280
|
fetchFn
|
|
281
281
|
.mockResolvedValueOnce(mockResponse({
|
|
282
282
|
success: true,
|
|
283
|
-
data: [{ id: 1, name: 'tag1' }],
|
|
283
|
+
data: [{ id: 1, name: 'tag1', color: '#6C757D' }],
|
|
284
284
|
pagination: { page: 1, limit: 1, total: 2, totalPages: 2, hasMore: true },
|
|
285
285
|
}))
|
|
286
286
|
.mockResolvedValueOnce(mockResponse({
|
|
287
287
|
success: true,
|
|
288
|
-
data: [{ id: 2, name: 'tag2' }],
|
|
288
|
+
data: [{ id: 2, name: 'tag2', color: '#6C757D' }],
|
|
289
289
|
pagination: { page: 2, limit: 1, total: 2, totalPages: 2, hasMore: false },
|
|
290
290
|
}))
|
|
291
291
|
|
|
@@ -351,7 +351,7 @@ describe('SearchResource', () => {
|
|
|
351
351
|
it('query calls GET /search with q param', async () => {
|
|
352
352
|
fetchFn.mockResolvedValue(mockResponse({
|
|
353
353
|
success: true,
|
|
354
|
-
data: [{ id: 1,
|
|
354
|
+
data: [{ id: 1, content: 'Life is...', language: 'en', created_at: null }],
|
|
355
355
|
pagination: { page: 1, limit: 10, total: 1, totalPages: 1, hasMore: false },
|
|
356
356
|
}))
|
|
357
357
|
|
|
@@ -361,19 +361,19 @@ describe('SearchResource', () => {
|
|
|
361
361
|
const parsed = new URL(url, 'http://localhost')
|
|
362
362
|
expect(parsed.searchParams.get('q')).toBe('life')
|
|
363
363
|
expect(parsed.searchParams.get('type')).toBe('quotes')
|
|
364
|
-
expect(result.data![0].
|
|
364
|
+
expect(result.data![0].content).toBe('Life is...')
|
|
365
365
|
})
|
|
366
366
|
|
|
367
367
|
it('paginate searches across pages', async () => {
|
|
368
368
|
fetchFn
|
|
369
369
|
.mockResolvedValueOnce(mockResponse({
|
|
370
370
|
success: true,
|
|
371
|
-
data: [{ id: 1,
|
|
371
|
+
data: [{ id: 1, content: 'A', language: 'en', created_at: null }],
|
|
372
372
|
pagination: { page: 1, limit: 1, total: 2, totalPages: 2, hasMore: true },
|
|
373
373
|
}))
|
|
374
374
|
.mockResolvedValueOnce(mockResponse({
|
|
375
375
|
success: true,
|
|
376
|
-
data: [{ id: 2,
|
|
376
|
+
data: [{ id: 2, content: 'B', language: 'en', created_at: null }],
|
|
377
377
|
pagination: { page: 2, limit: 1, total: 2, totalPages: 2, hasMore: false },
|
|
378
378
|
}))
|
|
379
379
|
|
package/src/resources/authors.ts
CHANGED
|
@@ -4,23 +4,28 @@ import { apiResponseSchema } from '../types'
|
|
|
4
4
|
import { paginate } from '../pagination'
|
|
5
5
|
import type { Author, ListAuthorsParams, CreateAuthorData, UpdateAuthorData } from '../types'
|
|
6
6
|
|
|
7
|
+
const authorStatsSchema = z.object({
|
|
8
|
+
views: z.number(),
|
|
9
|
+
likes: z.number(),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const authorDatesSchema = z.object({
|
|
13
|
+
birth: z.string().nullable().optional(),
|
|
14
|
+
death: z.string().nullable().optional(),
|
|
15
|
+
birth_location: z.string().nullable().optional(),
|
|
16
|
+
death_location: z.string().nullable().optional(),
|
|
17
|
+
})
|
|
18
|
+
|
|
7
19
|
const authorSchema = z.object({
|
|
8
20
|
id: z.number(),
|
|
9
21
|
name: z.string(),
|
|
10
|
-
|
|
22
|
+
fictional: z.boolean().optional(),
|
|
11
23
|
image_url: z.string().nullable().optional(),
|
|
12
24
|
job: z.string().nullable().optional(),
|
|
13
25
|
description: z.string().nullable().optional(),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
death_location: z.string().nullable().optional(),
|
|
18
|
-
views_count: z.number(),
|
|
19
|
-
likes_count: z.number(),
|
|
20
|
-
shares_count: z.number(),
|
|
21
|
-
quotes_count: z.number().optional(),
|
|
22
|
-
created_at: z.string(),
|
|
23
|
-
updated_at: z.string(),
|
|
26
|
+
dates: authorDatesSchema.optional(),
|
|
27
|
+
stats: authorStatsSchema.optional(),
|
|
28
|
+
created_at: z.string().nullable(),
|
|
24
29
|
})
|
|
25
30
|
|
|
26
31
|
const authorListResponseSchema = apiResponseSchema(z.array(authorSchema))
|
package/src/resources/quotes.ts
CHANGED
|
@@ -4,36 +4,44 @@ import { apiResponseSchema } from '../types'
|
|
|
4
4
|
import { paginate } from '../pagination'
|
|
5
5
|
import type { QuoteWithRelations, ListQuotesParams, CreateQuoteData, UpdateQuoteData } from '../types'
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const quoteStatsSchema = z.object({
|
|
8
|
+
views: z.number(),
|
|
9
|
+
likes: z.number(),
|
|
10
|
+
shares: z.number().optional(),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const quoteAuthorSchema = z.object({
|
|
14
|
+
id: z.number(),
|
|
15
|
+
name: z.string(),
|
|
16
|
+
fictional: z.boolean().optional(),
|
|
17
|
+
image_url: z.string().nullable().optional(),
|
|
18
|
+
description: z.string().nullable().optional(),
|
|
19
|
+
job: z.string().nullable().optional(),
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const quoteReferenceSchema = z.object({
|
|
8
23
|
id: z.number(),
|
|
9
24
|
name: z.string(),
|
|
25
|
+
type: z.string().optional(),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const quoteTagSchema = z.object({
|
|
29
|
+
id: z.number(),
|
|
30
|
+
name: z.string(),
|
|
31
|
+
color: z.string().nullable().optional(),
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const quoteSchema = z.object({
|
|
35
|
+
id: z.number(),
|
|
36
|
+
content: z.string(),
|
|
10
37
|
language: z.string(),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
created_at: z.string(),
|
|
19
|
-
updated_at: z.string(),
|
|
20
|
-
author: z.object({
|
|
21
|
-
id: z.number(),
|
|
22
|
-
name: z.string(),
|
|
23
|
-
is_fictional: z.boolean().optional(),
|
|
24
|
-
image_url: z.string().nullable().optional(),
|
|
25
|
-
description: z.string().nullable().optional(),
|
|
26
|
-
}).optional(),
|
|
27
|
-
reference: z.object({
|
|
28
|
-
id: z.number(),
|
|
29
|
-
name: z.string(),
|
|
30
|
-
primary_type: z.string().optional(),
|
|
31
|
-
}).optional(),
|
|
32
|
-
tags: z.array(z.object({
|
|
33
|
-
id: z.number().optional(),
|
|
34
|
-
name: z.string(),
|
|
35
|
-
color: z.string().nullable().optional(),
|
|
36
|
-
})).optional(),
|
|
38
|
+
stats: quoteStatsSchema.optional(),
|
|
39
|
+
featured: z.boolean().optional(),
|
|
40
|
+
author: quoteAuthorSchema.nullable().optional(),
|
|
41
|
+
reference: quoteReferenceSchema.nullable().optional(),
|
|
42
|
+
tags: z.array(quoteTagSchema).optional(),
|
|
43
|
+
created_at: z.string().nullable(),
|
|
44
|
+
updated_at: z.string().nullable(),
|
|
37
45
|
})
|
|
38
46
|
|
|
39
47
|
const quoteListResponseSchema = apiResponseSchema(z.array(quoteSchema))
|
|
@@ -4,21 +4,22 @@ import { apiResponseSchema } from '../types'
|
|
|
4
4
|
import { paginate } from '../pagination'
|
|
5
5
|
import type { ListReferencesParams, CreateReferenceData, UpdateReferenceData } from '../types'
|
|
6
6
|
|
|
7
|
+
const referenceStatsSchema = z.object({
|
|
8
|
+
views: z.number(),
|
|
9
|
+
likes: z.number(),
|
|
10
|
+
})
|
|
11
|
+
|
|
7
12
|
const referenceSchema = z.object({
|
|
8
13
|
id: z.number(),
|
|
9
14
|
name: z.string(),
|
|
10
|
-
|
|
15
|
+
type: z.string(),
|
|
11
16
|
secondary_type: z.string().nullable().optional(),
|
|
12
|
-
|
|
17
|
+
language: z.string().optional(),
|
|
13
18
|
release_date: z.string().nullable().optional(),
|
|
14
19
|
description: z.string().nullable().optional(),
|
|
15
20
|
image_url: z.string().nullable().optional(),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
shares_count: z.number(),
|
|
19
|
-
quotes_count: z.number().optional(),
|
|
20
|
-
created_at: z.string(),
|
|
21
|
-
updated_at: z.string(),
|
|
21
|
+
stats: referenceStatsSchema.optional(),
|
|
22
|
+
created_at: z.string().nullable(),
|
|
22
23
|
})
|
|
23
24
|
|
|
24
25
|
const referenceListResponseSchema = apiResponseSchema(z.array(referenceSchema))
|
package/src/resources/search.ts
CHANGED
|
@@ -4,17 +4,32 @@ import { apiResponseSchema } from '../types'
|
|
|
4
4
|
import { paginate } from '../pagination'
|
|
5
5
|
import type { SearchParams } from '../types'
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const searchAuthorSchema = z.object({
|
|
8
8
|
id: z.number(),
|
|
9
|
-
type: z.string(),
|
|
10
9
|
name: z.string(),
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
fictional: z.boolean().optional(),
|
|
11
|
+
image_url: z.string().nullable().optional(),
|
|
12
|
+
job: z.string().nullable().optional(),
|
|
13
13
|
})
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const searchReferenceSchema = z.object({
|
|
16
|
+
id: z.number(),
|
|
17
|
+
name: z.string(),
|
|
18
|
+
type: z.string().optional(),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const searchQuoteSchema = z.object({
|
|
22
|
+
id: z.number(),
|
|
23
|
+
content: z.string(),
|
|
24
|
+
language: z.string(),
|
|
25
|
+
author: searchAuthorSchema.nullable().optional(),
|
|
26
|
+
reference: searchReferenceSchema.nullable().optional(),
|
|
27
|
+
created_at: z.string().nullable(),
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
type SearchResultItem = z.infer<typeof searchQuoteSchema>
|
|
16
31
|
|
|
17
|
-
const searchResponseSchema = apiResponseSchema(z.array(
|
|
32
|
+
const searchResponseSchema = apiResponseSchema(z.array(searchQuoteSchema))
|
|
18
33
|
|
|
19
34
|
export class SearchResource {
|
|
20
35
|
constructor(private client: VerbatimsClient) {}
|
package/src/resources/tags.ts
CHANGED
|
@@ -6,8 +6,10 @@ import { paginate } from '../pagination'
|
|
|
6
6
|
const tagSchema = z.object({
|
|
7
7
|
id: z.number(),
|
|
8
8
|
name: z.string(),
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
description: z.string().nullable().optional(),
|
|
10
|
+
category: z.string().nullable().optional(),
|
|
11
|
+
color: z.string().nullable(),
|
|
12
|
+
quote_count: z.number().optional(),
|
|
11
13
|
})
|
|
12
14
|
|
|
13
15
|
type TagItem = z.infer<typeof tagSchema>
|
package/src/types.ts
CHANGED
|
@@ -34,74 +34,82 @@ export interface ApiResponse<T = unknown> {
|
|
|
34
34
|
pagination?: PaginationMeta
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
// --- API entity types
|
|
37
|
+
// --- API entity types ---
|
|
38
38
|
|
|
39
39
|
export interface QuoteAuthor {
|
|
40
40
|
id: number
|
|
41
41
|
name: string
|
|
42
|
-
|
|
42
|
+
fictional?: boolean
|
|
43
43
|
image_url?: string | null
|
|
44
44
|
description?: string | null
|
|
45
|
+
job?: string | null
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export interface QuoteReferenceInfo {
|
|
48
49
|
id: number
|
|
49
50
|
name: string
|
|
50
|
-
|
|
51
|
+
type?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface QuoteStats {
|
|
55
|
+
views: number
|
|
56
|
+
likes: number
|
|
57
|
+
shares?: number
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
export interface QuoteWithRelations {
|
|
54
61
|
id: number
|
|
55
|
-
|
|
62
|
+
content: string
|
|
56
63
|
language: string
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
stats?: QuoteStats
|
|
65
|
+
featured?: boolean
|
|
66
|
+
author?: QuoteAuthor | null
|
|
67
|
+
reference?: QuoteReferenceInfo | null
|
|
68
|
+
tags?: Array<{ id: number; name: string; color?: string | null }>
|
|
69
|
+
created_at: string | null
|
|
70
|
+
updated_at: string | null
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface AuthorDates {
|
|
74
|
+
birth?: string | null
|
|
75
|
+
death?: string | null
|
|
76
|
+
birth_location?: string | null
|
|
77
|
+
death_location?: string | null
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface AuthorStats {
|
|
81
|
+
views: number
|
|
82
|
+
likes: number
|
|
69
83
|
}
|
|
70
84
|
|
|
71
85
|
export interface Author {
|
|
72
86
|
id: number
|
|
73
87
|
name: string
|
|
74
|
-
|
|
88
|
+
fictional?: boolean
|
|
75
89
|
image_url?: string | null
|
|
76
90
|
job?: string | null
|
|
77
91
|
description?: string | null
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
created_at: string
|
|
87
|
-
updated_at: string
|
|
92
|
+
dates?: AuthorDates
|
|
93
|
+
stats?: AuthorStats
|
|
94
|
+
created_at: string | null
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface ReferenceStats {
|
|
98
|
+
views: number
|
|
99
|
+
likes: number
|
|
88
100
|
}
|
|
89
101
|
|
|
90
102
|
export interface QuoteReference {
|
|
91
103
|
id: number
|
|
92
104
|
name: string
|
|
93
|
-
|
|
105
|
+
type: string
|
|
94
106
|
secondary_type?: string | null
|
|
95
|
-
|
|
107
|
+
language?: string
|
|
96
108
|
release_date?: string | null
|
|
97
109
|
description?: string | null
|
|
98
110
|
image_url?: string | null
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
shares_count: number
|
|
102
|
-
quotes_count?: number
|
|
103
|
-
created_at: string
|
|
104
|
-
updated_at: string
|
|
111
|
+
stats?: ReferenceStats
|
|
112
|
+
created_at: string | null
|
|
105
113
|
}
|
|
106
114
|
|
|
107
115
|
// --- Parameter types for SDK methods ---
|
|
@@ -139,7 +147,8 @@ export interface SearchParams {
|
|
|
139
147
|
}
|
|
140
148
|
|
|
141
149
|
export interface CreateQuoteData {
|
|
142
|
-
|
|
150
|
+
content?: string
|
|
151
|
+
name?: string
|
|
143
152
|
language?: string
|
|
144
153
|
author_id?: number
|
|
145
154
|
reference_id?: number
|
|
@@ -160,6 +169,7 @@ export interface CreateQuoteData {
|
|
|
160
169
|
}
|
|
161
170
|
|
|
162
171
|
export interface UpdateQuoteData {
|
|
172
|
+
content?: string
|
|
163
173
|
name?: string
|
|
164
174
|
language?: string
|
|
165
175
|
author_id?: number | null
|
|
@@ -168,6 +178,7 @@ export interface UpdateQuoteData {
|
|
|
168
178
|
|
|
169
179
|
export interface CreateAuthorData {
|
|
170
180
|
name: string
|
|
181
|
+
fictional?: boolean
|
|
171
182
|
is_fictional?: boolean
|
|
172
183
|
job?: string | null
|
|
173
184
|
description?: string | null
|
|
@@ -181,9 +192,10 @@ export interface CreateAuthorData {
|
|
|
181
192
|
|
|
182
193
|
export interface UpdateAuthorData {
|
|
183
194
|
name?: string
|
|
195
|
+
fictional?: boolean
|
|
184
196
|
is_fictional?: boolean
|
|
185
|
-
job?: string | null
|
|
186
197
|
description?: string | null
|
|
198
|
+
job?: string | null
|
|
187
199
|
birth_date?: string | null
|
|
188
200
|
birth_location?: string | null
|
|
189
201
|
death_date?: string | null
|
|
@@ -194,10 +206,12 @@ export interface UpdateAuthorData {
|
|
|
194
206
|
|
|
195
207
|
export interface CreateReferenceData {
|
|
196
208
|
name: string
|
|
197
|
-
|
|
209
|
+
type?: string
|
|
210
|
+
primary_type?: string
|
|
198
211
|
secondary_type?: string | null
|
|
199
212
|
description?: string | null
|
|
200
213
|
release_date?: string | null
|
|
214
|
+
language?: string
|
|
201
215
|
original_language?: string
|
|
202
216
|
image_url?: string | null
|
|
203
217
|
urls?: Record<string, string> | null
|
|
@@ -205,10 +219,12 @@ export interface CreateReferenceData {
|
|
|
205
219
|
|
|
206
220
|
export interface UpdateReferenceData {
|
|
207
221
|
name?: string
|
|
222
|
+
type?: string
|
|
208
223
|
primary_type?: string
|
|
209
224
|
secondary_type?: string | null
|
|
210
225
|
description?: string | null
|
|
211
226
|
release_date?: string | null
|
|
227
|
+
language?: string
|
|
212
228
|
original_language?: string
|
|
213
229
|
image_url?: string | null
|
|
214
230
|
urls?: Record<string, string> | null
|