@verbatims/sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +61 -0
- package/dist/client.d.ts +35 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +156 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +51 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/pagination.d.ts +9 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +16 -0
- package/dist/pagination.js.map +1 -0
- package/dist/resources/authors.d.ts +145 -0
- package/dist/resources/authors.d.ts.map +1 -0
- package/dist/resources/authors.js +48 -0
- package/dist/resources/authors.js.map +1 -0
- package/dist/resources/collections.d.ts +57 -0
- package/dist/resources/collections.d.ts.map +1 -0
- package/dist/resources/collections.js +32 -0
- package/dist/resources/collections.js.map +1 -0
- package/dist/resources/index.d.ts +7 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +7 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/quotes.d.ts +226 -0
- package/dist/resources/quotes.d.ts.map +1 -0
- package/dist/resources/quotes.js +69 -0
- package/dist/resources/quotes.js.map +1 -0
- package/dist/resources/references.d.ts +135 -0
- package/dist/resources/references.d.ts.map +1 -0
- package/dist/resources/references.js +46 -0
- package/dist/resources/references.js.map +1 -0
- package/dist/resources/search.d.ts +36 -0
- package/dist/resources/search.d.ts.map +1 -0
- package/dist/resources/search.js +27 -0
- package/dist/resources/search.js.map +1 -0
- package/dist/resources/tags.d.ts +39 -0
- package/dist/resources/tags.d.ts.map +1 -0
- package/dist/resources/tags.js +26 -0
- package/dist/resources/tags.js.map +1 -0
- package/dist/types.d.ts +203 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +23 -0
- package/dist/types.js.map +1 -0
- package/nuxt/composables.ts +31 -0
- package/nuxt/module.ts +31 -0
- package/package.json +85 -0
- package/src/__tests__/client.test.ts +304 -0
- package/src/__tests__/errors.test.ts +85 -0
- package/src/__tests__/pagination.test.ts +100 -0
- package/src/client.ts +213 -0
- package/src/errors.ts +54 -0
- package/src/index.ts +58 -0
- package/src/pagination.ts +25 -0
- package/src/resources/__tests__/resources.test.ts +386 -0
- package/src/resources/authors.ts +58 -0
- package/src/resources/collections.ts +45 -0
- package/src/resources/index.ts +6 -0
- package/src/resources/quotes.ts +80 -0
- package/src/resources/references.ts +56 -0
- package/src/resources/search.ts +34 -0
- package/src/resources/tags.ts +32 -0
- package/src/types.ts +221 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { apiResponseSchema } from '../types';
|
|
3
|
+
import { paginate } from '../pagination';
|
|
4
|
+
const authorSchema = z.object({
|
|
5
|
+
id: z.number(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
is_fictional: z.boolean().optional(),
|
|
8
|
+
image_url: z.string().nullable().optional(),
|
|
9
|
+
job: z.string().nullable().optional(),
|
|
10
|
+
description: z.string().nullable().optional(),
|
|
11
|
+
birth_date: z.string().nullable().optional(),
|
|
12
|
+
birth_location: z.string().nullable().optional(),
|
|
13
|
+
death_date: z.string().nullable().optional(),
|
|
14
|
+
death_location: z.string().nullable().optional(),
|
|
15
|
+
views_count: z.number(),
|
|
16
|
+
likes_count: z.number(),
|
|
17
|
+
shares_count: z.number(),
|
|
18
|
+
quotes_count: z.number().optional(),
|
|
19
|
+
created_at: z.string(),
|
|
20
|
+
updated_at: z.string(),
|
|
21
|
+
});
|
|
22
|
+
const authorListResponseSchema = apiResponseSchema(z.array(authorSchema));
|
|
23
|
+
const authorSingleResponseSchema = apiResponseSchema(authorSchema);
|
|
24
|
+
export class AuthorsResource {
|
|
25
|
+
client;
|
|
26
|
+
constructor(client) {
|
|
27
|
+
this.client = client;
|
|
28
|
+
}
|
|
29
|
+
async list(params) {
|
|
30
|
+
return this.client.get('/authors', { params: params }, authorListResponseSchema);
|
|
31
|
+
}
|
|
32
|
+
paginate(params) {
|
|
33
|
+
return paginate((page) => this.list({ ...params, page }).then(r => ({
|
|
34
|
+
data: r.data,
|
|
35
|
+
pagination: r.pagination,
|
|
36
|
+
})));
|
|
37
|
+
}
|
|
38
|
+
async get(id) {
|
|
39
|
+
return this.client.get(`/authors/${id}`, {}, authorSingleResponseSchema);
|
|
40
|
+
}
|
|
41
|
+
async create(data) {
|
|
42
|
+
return this.client.post('/authors', data, {}, authorSingleResponseSchema);
|
|
43
|
+
}
|
|
44
|
+
async update(id, data) {
|
|
45
|
+
return this.client.put(`/authors/${id}`, data, {}, authorSingleResponseSchema);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=authors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authors.js","sourceRoot":"","sources":["../../src/resources/authors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACpC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC3C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACrC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CA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AC,CAAC,EAAE,CAAC,CAAC;YACxC,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,UAAU,EAAE,CAAC,CAAC,UAAU;SACzB,CAAC,CAAC,CACJ,CAAA;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,EAAE,0BAA0B,CAAC,CAAA;IAC1E,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAsB;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,0BAA0B,CAAC,CAAA;IAC3E,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,IAAsB;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,0BAA0B,CAAC,CAAA;IAChF,CAAC;CACF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { VerbatimsClient } from '../client';
|
|
2
|
+
import type { CreateCollectionData } from '../types';
|
|
3
|
+
export declare class CollectionsResource {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: VerbatimsClient);
|
|
6
|
+
create(data: CreateCollectionData): Promise<{
|
|
7
|
+
success: true;
|
|
8
|
+
data?: {
|
|
9
|
+
id: number;
|
|
10
|
+
name: string;
|
|
11
|
+
created_at: string;
|
|
12
|
+
updated_at: string;
|
|
13
|
+
description?: string | null | undefined;
|
|
14
|
+
is_public?: boolean | undefined;
|
|
15
|
+
quote_count?: number | undefined;
|
|
16
|
+
} | undefined;
|
|
17
|
+
message?: string | undefined;
|
|
18
|
+
pagination?: {
|
|
19
|
+
page: number;
|
|
20
|
+
limit: number;
|
|
21
|
+
total: number;
|
|
22
|
+
totalPages: number;
|
|
23
|
+
hasMore: boolean;
|
|
24
|
+
} | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
addQuote(collectionId: number, quoteId: number): Promise<{
|
|
27
|
+
success: true;
|
|
28
|
+
data?: undefined;
|
|
29
|
+
message?: string | undefined;
|
|
30
|
+
pagination?: {
|
|
31
|
+
page: number;
|
|
32
|
+
limit: number;
|
|
33
|
+
total: number;
|
|
34
|
+
totalPages: number;
|
|
35
|
+
hasMore: boolean;
|
|
36
|
+
} | undefined;
|
|
37
|
+
} | {
|
|
38
|
+
success: true;
|
|
39
|
+
message?: string | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
removeQuote(collectionId: number, quoteId: number): Promise<{
|
|
42
|
+
success: true;
|
|
43
|
+
data?: undefined;
|
|
44
|
+
message?: string | undefined;
|
|
45
|
+
pagination?: {
|
|
46
|
+
page: number;
|
|
47
|
+
limit: number;
|
|
48
|
+
total: number;
|
|
49
|
+
totalPages: number;
|
|
50
|
+
hasMore: boolean;
|
|
51
|
+
} | undefined;
|
|
52
|
+
} | {
|
|
53
|
+
success: true;
|
|
54
|
+
message?: string | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/resources/collections.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAkBpD,qBAAa,mBAAmB;IAClB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAErC,MAAM,CAAC,IAAI,EAAE,oBAAoB;;;;;;;;;;;;;;;;;;;;IAIjC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;IAS9C,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;CAOxD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { apiResponseSchema } from '../types';
|
|
3
|
+
const collectionSchema = z.object({
|
|
4
|
+
id: z.number(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
description: z.string().nullable().optional(),
|
|
7
|
+
is_public: z.boolean().optional(),
|
|
8
|
+
quote_count: z.number().optional(),
|
|
9
|
+
created_at: z.string(),
|
|
10
|
+
updated_at: z.string(),
|
|
11
|
+
});
|
|
12
|
+
const collectionResponseSchema = apiResponseSchema(collectionSchema);
|
|
13
|
+
const collectionActionResponseSchema = apiResponseSchema(z.undefined()).or(z.object({
|
|
14
|
+
success: z.literal(true),
|
|
15
|
+
message: z.string().optional(),
|
|
16
|
+
}));
|
|
17
|
+
export class CollectionsResource {
|
|
18
|
+
client;
|
|
19
|
+
constructor(client) {
|
|
20
|
+
this.client = client;
|
|
21
|
+
}
|
|
22
|
+
async create(data) {
|
|
23
|
+
return this.client.post('/collections', data, {}, collectionResponseSchema);
|
|
24
|
+
}
|
|
25
|
+
async addQuote(collectionId, quoteId) {
|
|
26
|
+
return this.client.post(`/collections/${collectionId}/quotes`, { quote_id: quoteId }, {}, collectionActionResponseSchema);
|
|
27
|
+
}
|
|
28
|
+
async removeQuote(collectionId, quoteId) {
|
|
29
|
+
return this.client.delete(`/collections/${collectionId}/quotes/${quoteId}`, {}, collectionActionResponseSchema);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/resources/collections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAG5C,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IAC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W,OAAO,EAAE,EAChD,EAAE,EACF,8BAA8B,CAC/B,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { QuotesResource } from './quotes';
|
|
2
|
+
export { AuthorsResource } from './authors';
|
|
3
|
+
export { ReferencesResource } from './references';
|
|
4
|
+
export { TagsResource } from './tags';
|
|
5
|
+
export { CollectionsResource } from './collections';
|
|
6
|
+
export { SearchResource } from './search';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { QuotesResource } from './quotes';
|
|
2
|
+
export { AuthorsResource } from './authors';
|
|
3
|
+
export { ReferencesResource } from './references';
|
|
4
|
+
export { TagsResource } from './tags';
|
|
5
|
+
export { CollectionsResource } from './collections';
|
|
6
|
+
export { SearchResource } from './search';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import type { VerbatimsClient } from '../client';
|
|
3
|
+
import type { ListQuotesParams, CreateQuoteData, UpdateQuoteData } from '../types';
|
|
4
|
+
declare const quoteSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodNumber;
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
language: z.ZodString;
|
|
8
|
+
author_id: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
reference_id: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
status: z.ZodString;
|
|
11
|
+
views_count: z.ZodNumber;
|
|
12
|
+
likes_count: z.ZodNumber;
|
|
13
|
+
shares_count: z.ZodNumber;
|
|
14
|
+
is_featured: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
created_at: z.ZodString;
|
|
16
|
+
updated_at: z.ZodString;
|
|
17
|
+
author: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
id: z.ZodNumber;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
is_fictional: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
image_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
reference: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
id: z.ZodNumber;
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
primary_type: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
30
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
}, z.core.$strip>>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
type QuoteItem = z.infer<typeof quoteSchema>;
|
|
36
|
+
export declare class QuotesResource {
|
|
37
|
+
private client;
|
|
38
|
+
constructor(client: VerbatimsClient);
|
|
39
|
+
list(params?: ListQuotesParams): Promise<{
|
|
40
|
+
success: true;
|
|
41
|
+
data?: {
|
|
42
|
+
id: number;
|
|
43
|
+
name: string;
|
|
44
|
+
language: string;
|
|
45
|
+
status: string;
|
|
46
|
+
views_count: number;
|
|
47
|
+
likes_count: number;
|
|
48
|
+
shares_count: number;
|
|
49
|
+
created_at: string;
|
|
50
|
+
updated_at: string;
|
|
51
|
+
author_id?: number | undefined;
|
|
52
|
+
reference_id?: number | undefined;
|
|
53
|
+
is_featured?: boolean | undefined;
|
|
54
|
+
author?: {
|
|
55
|
+
id: number;
|
|
56
|
+
name: string;
|
|
57
|
+
is_fictional?: boolean | undefined;
|
|
58
|
+
image_url?: string | null | undefined;
|
|
59
|
+
description?: string | null | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
reference?: {
|
|
62
|
+
id: number;
|
|
63
|
+
name: string;
|
|
64
|
+
primary_type?: string | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
tags?: {
|
|
67
|
+
name: string;
|
|
68
|
+
id?: number | undefined;
|
|
69
|
+
color?: string | null | undefined;
|
|
70
|
+
}[] | undefined;
|
|
71
|
+
}[] | undefined;
|
|
72
|
+
message?: string | undefined;
|
|
73
|
+
pagination?: {
|
|
74
|
+
page: number;
|
|
75
|
+
limit: number;
|
|
76
|
+
total: number;
|
|
77
|
+
totalPages: number;
|
|
78
|
+
hasMore: boolean;
|
|
79
|
+
} | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
paginate(params?: ListQuotesParams): AsyncGenerator<QuoteItem>;
|
|
82
|
+
get(id: number): Promise<{
|
|
83
|
+
success: true;
|
|
84
|
+
data?: {
|
|
85
|
+
id: number;
|
|
86
|
+
name: string;
|
|
87
|
+
language: string;
|
|
88
|
+
status: string;
|
|
89
|
+
views_count: number;
|
|
90
|
+
likes_count: number;
|
|
91
|
+
shares_count: number;
|
|
92
|
+
created_at: string;
|
|
93
|
+
updated_at: string;
|
|
94
|
+
author_id?: number | undefined;
|
|
95
|
+
reference_id?: number | undefined;
|
|
96
|
+
is_featured?: boolean | undefined;
|
|
97
|
+
author?: {
|
|
98
|
+
id: number;
|
|
99
|
+
name: string;
|
|
100
|
+
is_fictional?: boolean | undefined;
|
|
101
|
+
image_url?: string | null | undefined;
|
|
102
|
+
description?: string | null | undefined;
|
|
103
|
+
} | undefined;
|
|
104
|
+
reference?: {
|
|
105
|
+
id: number;
|
|
106
|
+
name: string;
|
|
107
|
+
primary_type?: string | undefined;
|
|
108
|
+
} | undefined;
|
|
109
|
+
tags?: {
|
|
110
|
+
name: string;
|
|
111
|
+
id?: number | undefined;
|
|
112
|
+
color?: string | null | undefined;
|
|
113
|
+
}[] | undefined;
|
|
114
|
+
} | undefined;
|
|
115
|
+
message?: string | undefined;
|
|
116
|
+
pagination?: {
|
|
117
|
+
page: number;
|
|
118
|
+
limit: number;
|
|
119
|
+
total: number;
|
|
120
|
+
totalPages: number;
|
|
121
|
+
hasMore: boolean;
|
|
122
|
+
} | undefined;
|
|
123
|
+
}>;
|
|
124
|
+
create(data: CreateQuoteData): Promise<{
|
|
125
|
+
success: true;
|
|
126
|
+
data?: {
|
|
127
|
+
id: number;
|
|
128
|
+
name: string;
|
|
129
|
+
language: string;
|
|
130
|
+
status: string;
|
|
131
|
+
views_count: number;
|
|
132
|
+
likes_count: number;
|
|
133
|
+
shares_count: number;
|
|
134
|
+
created_at: string;
|
|
135
|
+
updated_at: string;
|
|
136
|
+
author_id?: number | undefined;
|
|
137
|
+
reference_id?: number | undefined;
|
|
138
|
+
is_featured?: boolean | undefined;
|
|
139
|
+
author?: {
|
|
140
|
+
id: number;
|
|
141
|
+
name: string;
|
|
142
|
+
is_fictional?: boolean | undefined;
|
|
143
|
+
image_url?: string | null | undefined;
|
|
144
|
+
description?: string | null | undefined;
|
|
145
|
+
} | undefined;
|
|
146
|
+
reference?: {
|
|
147
|
+
id: number;
|
|
148
|
+
name: string;
|
|
149
|
+
primary_type?: string | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
tags?: {
|
|
152
|
+
name: string;
|
|
153
|
+
id?: number | undefined;
|
|
154
|
+
color?: string | null | undefined;
|
|
155
|
+
}[] | undefined;
|
|
156
|
+
} | undefined;
|
|
157
|
+
message?: string | undefined;
|
|
158
|
+
pagination?: {
|
|
159
|
+
page: number;
|
|
160
|
+
limit: number;
|
|
161
|
+
total: number;
|
|
162
|
+
totalPages: number;
|
|
163
|
+
hasMore: boolean;
|
|
164
|
+
} | undefined;
|
|
165
|
+
}>;
|
|
166
|
+
update(id: number, data: UpdateQuoteData): Promise<{
|
|
167
|
+
success: true;
|
|
168
|
+
data?: {
|
|
169
|
+
id: number;
|
|
170
|
+
name: string;
|
|
171
|
+
language: string;
|
|
172
|
+
status: string;
|
|
173
|
+
views_count: number;
|
|
174
|
+
likes_count: number;
|
|
175
|
+
shares_count: number;
|
|
176
|
+
created_at: string;
|
|
177
|
+
updated_at: string;
|
|
178
|
+
author_id?: number | undefined;
|
|
179
|
+
reference_id?: number | undefined;
|
|
180
|
+
is_featured?: boolean | undefined;
|
|
181
|
+
author?: {
|
|
182
|
+
id: number;
|
|
183
|
+
name: string;
|
|
184
|
+
is_fictional?: boolean | undefined;
|
|
185
|
+
image_url?: string | null | undefined;
|
|
186
|
+
description?: string | null | undefined;
|
|
187
|
+
} | undefined;
|
|
188
|
+
reference?: {
|
|
189
|
+
id: number;
|
|
190
|
+
name: string;
|
|
191
|
+
primary_type?: string | undefined;
|
|
192
|
+
} | undefined;
|
|
193
|
+
tags?: {
|
|
194
|
+
name: string;
|
|
195
|
+
id?: number | undefined;
|
|
196
|
+
color?: string | null | undefined;
|
|
197
|
+
}[] | undefined;
|
|
198
|
+
} | undefined;
|
|
199
|
+
message?: string | undefined;
|
|
200
|
+
pagination?: {
|
|
201
|
+
page: number;
|
|
202
|
+
limit: number;
|
|
203
|
+
total: number;
|
|
204
|
+
totalPages: number;
|
|
205
|
+
hasMore: boolean;
|
|
206
|
+
} | undefined;
|
|
207
|
+
}>;
|
|
208
|
+
delete(id: number): Promise<{
|
|
209
|
+
success: true;
|
|
210
|
+
data?: undefined;
|
|
211
|
+
message?: string | undefined;
|
|
212
|
+
pagination?: {
|
|
213
|
+
page: number;
|
|
214
|
+
limit: number;
|
|
215
|
+
total: number;
|
|
216
|
+
totalPages: number;
|
|
217
|
+
hasMore: boolean;
|
|
218
|
+
} | undefined;
|
|
219
|
+
} | {
|
|
220
|
+
success: true;
|
|
221
|
+
message?: string | undefined;
|
|
222
|
+
data?: unknown;
|
|
223
|
+
}>;
|
|
224
|
+
}
|
|
225
|
+
export {};
|
|
226
|
+
//# sourceMappingURL=quotes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../src/resources/quotes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAGhD,OAAO,KAAK,EAAsB,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAEtG,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8Bf,CAAA;AAUF,KAAK,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AAE5C,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAErC,IAAI,CAAC,MAAM,CAAC,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIpC,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,cAAc,CAAC,SAAS,CAAC;IASxD,GAAG,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAId,MAAM,CAAC,IAAI,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAI5B,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIxC,MAAM,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;CAGxB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { apiResponseSchema } from '../types';
|
|
3
|
+
import { paginate } from '../pagination';
|
|
4
|
+
const quoteSchema = z.object({
|
|
5
|
+
id: z.number(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
language: z.string(),
|
|
8
|
+
author_id: z.number().optional(),
|
|
9
|
+
reference_id: z.number().optional(),
|
|
10
|
+
status: z.string(),
|
|
11
|
+
views_count: z.number(),
|
|
12
|
+
likes_count: z.number(),
|
|
13
|
+
shares_count: z.number(),
|
|
14
|
+
is_featured: z.boolean().optional(),
|
|
15
|
+
created_at: z.string(),
|
|
16
|
+
updated_at: z.string(),
|
|
17
|
+
author: z.object({
|
|
18
|
+
id: z.number(),
|
|
19
|
+
name: z.string(),
|
|
20
|
+
is_fictional: z.boolean().optional(),
|
|
21
|
+
image_url: z.string().nullable().optional(),
|
|
22
|
+
description: z.string().nullable().optional(),
|
|
23
|
+
}).optional(),
|
|
24
|
+
reference: z.object({
|
|
25
|
+
id: z.number(),
|
|
26
|
+
name: z.string(),
|
|
27
|
+
primary_type: z.string().optional(),
|
|
28
|
+
}).optional(),
|
|
29
|
+
tags: z.array(z.object({
|
|
30
|
+
id: z.number().optional(),
|
|
31
|
+
name: z.string(),
|
|
32
|
+
color: z.string().nullable().optional(),
|
|
33
|
+
})).optional(),
|
|
34
|
+
});
|
|
35
|
+
const quoteListResponseSchema = apiResponseSchema(z.array(quoteSchema));
|
|
36
|
+
const quoteSingleResponseSchema = apiResponseSchema(quoteSchema);
|
|
37
|
+
const quoteDeleteResponseSchema = apiResponseSchema(z.undefined()).or(z.object({
|
|
38
|
+
success: z.literal(true),
|
|
39
|
+
message: z.string().optional(),
|
|
40
|
+
data: z.unknown().optional(),
|
|
41
|
+
}));
|
|
42
|
+
export class QuotesResource {
|
|
43
|
+
client;
|
|
44
|
+
constructor(client) {
|
|
45
|
+
this.client = client;
|
|
46
|
+
}
|
|
47
|
+
async list(params) {
|
|
48
|
+
return this.client.get('/quotes', { params: params }, quoteListResponseSchema);
|
|
49
|
+
}
|
|
50
|
+
paginate(params) {
|
|
51
|
+
return paginate((page) => this.list({ ...params, page }).then(r => ({
|
|
52
|
+
data: r.data,
|
|
53
|
+
pagination: r.pagination,
|
|
54
|
+
})));
|
|
55
|
+
}
|
|
56
|
+
async get(id) {
|
|
57
|
+
return this.client.get(`/quotes/${id}`, {}, quoteSingleResponseSchema);
|
|
58
|
+
}
|
|
59
|
+
async create(data) {
|
|
60
|
+
return this.client.post('/quotes', data, {}, quoteSingleResponseSchema);
|
|
61
|
+
}
|
|
62
|
+
async update(id, data) {
|
|
63
|
+
return this.client.put(`/quotes/${id}`, data, {}, quoteSingleResponseSchema);
|
|
64
|
+
}
|
|
65
|
+
async delete(id) {
|
|
66
|
+
return this.client.delete(`/quotes/${id}`, {}, quoteDeleteResponseSchema);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=quotes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotes.js","sourceRoot":"","sources":["../../src/resources/quotes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,QAA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;YACxC,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,UAAU,EAAE,CAAC,CAAC,UAAU;SACzB,CAAC,CAAC,CACJ,CAAA;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,EAAE,yBAAyB,CAAC,CAAA;IACxE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAqB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,yBAAyB,CAAC,CAAA;IACzE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,IAAqB;QAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,yBAAyB,CAAC,CAAA;IAC9E,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,EAAE,yBAAyB,CAAC,CAAA;IAC3E,CAAC;CACF"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import type { VerbatimsClient } from '../client';
|
|
3
|
+
import type { ListReferencesParams, CreateReferenceData, UpdateReferenceData } from '../types';
|
|
4
|
+
declare const referenceSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodNumber;
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
primary_type: z.ZodString;
|
|
8
|
+
secondary_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
original_language: z.ZodOptional<z.ZodString>;
|
|
10
|
+
release_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
+
image_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
views_count: z.ZodNumber;
|
|
14
|
+
likes_count: z.ZodNumber;
|
|
15
|
+
shares_count: z.ZodNumber;
|
|
16
|
+
quotes_count: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
created_at: z.ZodString;
|
|
18
|
+
updated_at: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
type ReferenceItem = z.infer<typeof referenceSchema>;
|
|
21
|
+
export declare class ReferencesResource {
|
|
22
|
+
private client;
|
|
23
|
+
constructor(client: VerbatimsClient);
|
|
24
|
+
list(params?: ListReferencesParams): Promise<{
|
|
25
|
+
success: true;
|
|
26
|
+
data?: {
|
|
27
|
+
id: number;
|
|
28
|
+
name: string;
|
|
29
|
+
primary_type: string;
|
|
30
|
+
views_count: number;
|
|
31
|
+
likes_count: number;
|
|
32
|
+
shares_count: number;
|
|
33
|
+
created_at: string;
|
|
34
|
+
updated_at: string;
|
|
35
|
+
secondary_type?: string | null | undefined;
|
|
36
|
+
original_language?: string | undefined;
|
|
37
|
+
release_date?: string | null | undefined;
|
|
38
|
+
description?: string | null | undefined;
|
|
39
|
+
image_url?: string | null | undefined;
|
|
40
|
+
quotes_count?: number | undefined;
|
|
41
|
+
}[] | undefined;
|
|
42
|
+
message?: string | undefined;
|
|
43
|
+
pagination?: {
|
|
44
|
+
page: number;
|
|
45
|
+
limit: number;
|
|
46
|
+
total: number;
|
|
47
|
+
totalPages: number;
|
|
48
|
+
hasMore: boolean;
|
|
49
|
+
} | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
paginate(params?: ListReferencesParams): AsyncGenerator<ReferenceItem>;
|
|
52
|
+
get(id: number): Promise<{
|
|
53
|
+
success: true;
|
|
54
|
+
data?: {
|
|
55
|
+
id: number;
|
|
56
|
+
name: string;
|
|
57
|
+
primary_type: string;
|
|
58
|
+
views_count: number;
|
|
59
|
+
likes_count: number;
|
|
60
|
+
shares_count: number;
|
|
61
|
+
created_at: string;
|
|
62
|
+
updated_at: string;
|
|
63
|
+
secondary_type?: string | null | undefined;
|
|
64
|
+
original_language?: string | undefined;
|
|
65
|
+
release_date?: string | null | undefined;
|
|
66
|
+
description?: string | null | undefined;
|
|
67
|
+
image_url?: string | null | undefined;
|
|
68
|
+
quotes_count?: number | undefined;
|
|
69
|
+
} | undefined;
|
|
70
|
+
message?: string | undefined;
|
|
71
|
+
pagination?: {
|
|
72
|
+
page: number;
|
|
73
|
+
limit: number;
|
|
74
|
+
total: number;
|
|
75
|
+
totalPages: number;
|
|
76
|
+
hasMore: boolean;
|
|
77
|
+
} | undefined;
|
|
78
|
+
}>;
|
|
79
|
+
create(data: CreateReferenceData): Promise<{
|
|
80
|
+
success: true;
|
|
81
|
+
data?: {
|
|
82
|
+
id: number;
|
|
83
|
+
name: string;
|
|
84
|
+
primary_type: string;
|
|
85
|
+
views_count: number;
|
|
86
|
+
likes_count: number;
|
|
87
|
+
shares_count: number;
|
|
88
|
+
created_at: string;
|
|
89
|
+
updated_at: string;
|
|
90
|
+
secondary_type?: string | null | undefined;
|
|
91
|
+
original_language?: string | undefined;
|
|
92
|
+
release_date?: string | null | undefined;
|
|
93
|
+
description?: string | null | undefined;
|
|
94
|
+
image_url?: string | null | undefined;
|
|
95
|
+
quotes_count?: number | undefined;
|
|
96
|
+
} | undefined;
|
|
97
|
+
message?: string | undefined;
|
|
98
|
+
pagination?: {
|
|
99
|
+
page: number;
|
|
100
|
+
limit: number;
|
|
101
|
+
total: number;
|
|
102
|
+
totalPages: number;
|
|
103
|
+
hasMore: boolean;
|
|
104
|
+
} | undefined;
|
|
105
|
+
}>;
|
|
106
|
+
update(id: number, data: UpdateReferenceData): Promise<{
|
|
107
|
+
success: true;
|
|
108
|
+
data?: {
|
|
109
|
+
id: number;
|
|
110
|
+
name: string;
|
|
111
|
+
primary_type: string;
|
|
112
|
+
views_count: number;
|
|
113
|
+
likes_count: number;
|
|
114
|
+
shares_count: number;
|
|
115
|
+
created_at: string;
|
|
116
|
+
updated_at: string;
|
|
117
|
+
secondary_type?: string | null | undefined;
|
|
118
|
+
original_language?: string | undefined;
|
|
119
|
+
release_date?: string | null | undefined;
|
|
120
|
+
description?: string | null | undefined;
|
|
121
|
+
image_url?: string | null | undefined;
|
|
122
|
+
quotes_count?: number | undefined;
|
|
123
|
+
} | undefined;
|
|
124
|
+
message?: string | undefined;
|
|
125
|
+
pagination?: {
|
|
126
|
+
page: number;
|
|
127
|
+
limit: number;
|
|
128
|
+
total: number;
|
|
129
|
+
totalPages: number;
|
|
130
|
+
hasMore: boolean;
|
|
131
|
+
} | undefined;
|
|
132
|
+
}>;
|
|
133
|
+
}
|
|
134
|
+
export {};
|
|
135
|
+
//# sourceMappingURL=references.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../src/resources/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAGhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAE9F,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;iBAenB,CAAA;AAKF,KAAK,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEpD,qBAAa,kBAAkB;IACjB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAErC,IAAI,CAAC,MAAM,CAAC,EAAE,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIxC,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,cAAc,CAAC,aAAa,CAAC;IAShE,GAAG,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;IAId,MAAM,CAAC,IAAI,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIhC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGnD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { apiResponseSchema } from '../types';
|
|
3
|
+
import { paginate } from '../pagination';
|
|
4
|
+
const referenceSchema = z.object({
|
|
5
|
+
id: z.number(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
primary_type: z.string(),
|
|
8
|
+
secondary_type: z.string().nullable().optional(),
|
|
9
|
+
original_language: z.string().optional(),
|
|
10
|
+
release_date: z.string().nullable().optional(),
|
|
11
|
+
description: z.string().nullable().optional(),
|
|
12
|
+
image_url: z.string().nullable().optional(),
|
|
13
|
+
views_count: z.number(),
|
|
14
|
+
likes_count: z.number(),
|
|
15
|
+
shares_count: z.number(),
|
|
16
|
+
quotes_count: z.number().optional(),
|
|
17
|
+
created_at: z.string(),
|
|
18
|
+
updated_at: z.string(),
|
|
19
|
+
});
|
|
20
|
+
const referenceListResponseSchema = apiResponseSchema(z.array(referenceSchema));
|
|
21
|
+
const referenceSingleResponseSchema = apiResponseSchema(referenceSchema);
|
|
22
|
+
export class ReferencesResource {
|
|
23
|
+
client;
|
|
24
|
+
constructor(client) {
|
|
25
|
+
this.client = client;
|
|
26
|
+
}
|
|
27
|
+
async list(params) {
|
|
28
|
+
return this.client.get('/references', { params: params }, referenceListResponseSchema);
|
|
29
|
+
}
|
|
30
|
+
paginate(params) {
|
|
31
|
+
return paginate((page) => this.list({ ...params, page }).then(r => ({
|
|
32
|
+
data: r.data,
|
|
33
|
+
pagination: r.pagination,
|
|
34
|
+
})));
|
|
35
|
+
}
|
|
36
|
+
async get(id) {
|
|
37
|
+
return this.client.get(`/references/${id}`, {}, referenceSingleResponseSchema);
|
|
38
|
+
}
|
|
39
|
+
async create(data) {
|
|
40
|
+
return this.client.post('/references', data, {}, referenceSingleResponseSchema);
|
|
41
|
+
}
|
|
42
|
+
async update(id, data) {
|
|
43
|
+
return this.client.put(`/references/${id}`, data, {}, referenceSingleResponseSchema);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=references.js.map
|