@gt6/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/README.md +453 -0
- package/dist/core/client.d.ts +29 -0
- package/dist/core/client.d.ts.map +1 -0
- package/dist/core/types.d.ts +119 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/gt6-sdk.cjs.js +385 -0
- package/dist/gt6-sdk.cjs.js.map +1 -0
- package/dist/gt6-sdk.esm.js +377 -0
- package/dist/gt6-sdk.esm.js.map +1 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/modules/articles.d.ts +72 -0
- package/dist/modules/articles.d.ts.map +1 -0
- package/package.json +83 -0
package/README.md
ADDED
@@ -0,0 +1,453 @@
|
|
1
|
+
# @gt6/sdk
|
2
|
+
|
3
|
+
GT6 SDK 是一个用于管理文章、分类和标签的JavaScript/TypeScript库,专门为GT6平台设计。
|
4
|
+
|
5
|
+
## 安装
|
6
|
+
|
7
|
+
```bash
|
8
|
+
npm install @gt6/sdk
|
9
|
+
```
|
10
|
+
|
11
|
+
## 快速开始
|
12
|
+
|
13
|
+
### 基本使用
|
14
|
+
|
15
|
+
```typescript
|
16
|
+
import { GT6SDK } from '@gt6/sdk';
|
17
|
+
|
18
|
+
// 初始化SDK
|
19
|
+
const sdk = new GT6SDK({
|
20
|
+
baseUrl: 'https://data.shopasb.io',
|
21
|
+
platformId: '1750838492',
|
22
|
+
rootCategoryId: '671920', // 可选,默认为671920
|
23
|
+
tagAlias: '001' // 可选,默认为001
|
24
|
+
});
|
25
|
+
|
26
|
+
// 获取文章详情
|
27
|
+
const article = await sdk.getArticle(921546067);
|
28
|
+
console.log(article.title);
|
29
|
+
|
30
|
+
// 获取分类列表
|
31
|
+
const categories = await sdk.getCategories();
|
32
|
+
console.log('分类列表:', categories.map(cat => cat.categoryName));
|
33
|
+
|
34
|
+
// 获取标签列表
|
35
|
+
const tags = await sdk.getTags();
|
36
|
+
console.log('标签列表:', tags.map(tag => tag.tagName));
|
37
|
+
|
38
|
+
// 根据分类获取文章
|
39
|
+
const categoryArticles = await sdk.getArticlesByCategory(782714);
|
40
|
+
console.log(`分类文章总数: ${categoryArticles.total}`);
|
41
|
+
|
42
|
+
// 根据标签获取文章
|
43
|
+
const tagArticles = await sdk.getArticlesByTag(136424);
|
44
|
+
console.log(`标签文章总数: ${tagArticles.total}`);
|
45
|
+
|
46
|
+
// 获取分类层级路径
|
47
|
+
const categoryPath = await sdk.getCategoryPath(782714);
|
48
|
+
console.log('面包屑路径:', categoryPath.breadcrumbs.map(crumb => crumb.categoryName).join(' > '));
|
49
|
+
|
50
|
+
// 获取子分类
|
51
|
+
const subCategories = await sdk.getSubCategories(671920);
|
52
|
+
console.log(`子分类数量: ${subCategories.total}`);
|
53
|
+
```
|
54
|
+
|
55
|
+
### 高级功能
|
56
|
+
|
57
|
+
```typescript
|
58
|
+
// 按分类获取文章
|
59
|
+
const categoryArticles = await sdk.getArticlesByCategory(782714);
|
60
|
+
|
61
|
+
// 按标签获取文章
|
62
|
+
const tagArticles = await sdk.getArticlesByTag(136424);
|
63
|
+
|
64
|
+
// 获取分类层级路径(用于面包屑导航)
|
65
|
+
const categoryPath = await sdk.getCategoryPath(782714);
|
66
|
+
|
67
|
+
// 获取子分类
|
68
|
+
const subCategories = await sdk.getSubCategories(671920);
|
69
|
+
|
70
|
+
// 获取已发布的文章
|
71
|
+
const publishedArticles = await sdk.articles.getPublishedArticles();
|
72
|
+
|
73
|
+
// 搜索文章
|
74
|
+
const searchResults = await sdk.articles.searchArticles('CRM');
|
75
|
+
|
76
|
+
// 获取文章统计信息
|
77
|
+
const stats = await sdk.articles.getArticleStats();
|
78
|
+
console.log(`总文章数: ${stats.total}`);
|
79
|
+
console.log(`已发布: ${stats.published}`);
|
80
|
+
console.log(`草稿: ${stats.draft}`);
|
81
|
+
|
82
|
+
// 获取推荐文章
|
83
|
+
const recommended = await sdk.articles.getRecommendedArticles(921546067, 5);
|
84
|
+
```
|
85
|
+
|
86
|
+
### 在Astro项目中使用
|
87
|
+
|
88
|
+
```typescript
|
89
|
+
// [id].astro
|
90
|
+
---
|
91
|
+
import { GT6SDK } from '@gt6/sdk';
|
92
|
+
|
93
|
+
const sdk = new GT6SDK({
|
94
|
+
baseUrl: 'https://data.shopasb.io',
|
95
|
+
platformId: '1750838492'
|
96
|
+
});
|
97
|
+
|
98
|
+
const { id } = Astro.params;
|
99
|
+
const article = await sdk.getArticle(id);
|
100
|
+
const recommended = await sdk.articles.getRecommendedArticles(Number(id), 3);
|
101
|
+
---
|
102
|
+
|
103
|
+
<html>
|
104
|
+
<head>
|
105
|
+
<title>{article.title}</title>
|
106
|
+
</head>
|
107
|
+
<body>
|
108
|
+
<h1>{article.title}</h1>
|
109
|
+
<div set:html={article.content}></div>
|
110
|
+
|
111
|
+
<h2>推荐文章</h2>
|
112
|
+
<ul>
|
113
|
+
{recommended.map(rec => (
|
114
|
+
<li><a href={`/articles/${rec.articleId}`}>{rec.title}</a></li>
|
115
|
+
))}
|
116
|
+
</ul>
|
117
|
+
</body>
|
118
|
+
</html>
|
119
|
+
```
|
120
|
+
|
121
|
+
### 新方法使用示例
|
122
|
+
|
123
|
+
#### 根据分类获取文章
|
124
|
+
|
125
|
+
```typescript
|
126
|
+
// 获取单个分类的文章
|
127
|
+
const result = await sdk.getArticlesByCategory(782714);
|
128
|
+
console.log(`分类文章总数: ${result.total}`);
|
129
|
+
console.log(`返回文章数: ${result.articles.length}`);
|
130
|
+
|
131
|
+
// 获取多个分类的文章(去重)
|
132
|
+
const multiResult = await sdk.getArticlesByCategory([782714, 821172]);
|
133
|
+
console.log(`多分类文章总数: ${multiResult.total}`);
|
134
|
+
|
135
|
+
// 使用分页和状态过滤
|
136
|
+
const paginatedResult = await sdk.getArticlesByCategory(782714, {
|
137
|
+
offset: 0,
|
138
|
+
limit: 10,
|
139
|
+
status: 'published'
|
140
|
+
});
|
141
|
+
```
|
142
|
+
|
143
|
+
#### 根据标签获取文章
|
144
|
+
|
145
|
+
```typescript
|
146
|
+
// 获取单个标签的文章
|
147
|
+
const result = await sdk.getArticlesByTag(136424);
|
148
|
+
console.log(`标签文章总数: ${result.total}`);
|
149
|
+
|
150
|
+
// 获取多个标签的文章(去重)
|
151
|
+
const multiResult = await sdk.getArticlesByTag([136424, 136425]);
|
152
|
+
console.log(`多标签文章总数: ${multiResult.total}`);
|
153
|
+
|
154
|
+
// 使用分页和状态过滤
|
155
|
+
const paginatedResult = await sdk.getArticlesByTag(136424, {
|
156
|
+
offset: 0,
|
157
|
+
limit: 10,
|
158
|
+
status: 'published'
|
159
|
+
});
|
160
|
+
```
|
161
|
+
|
162
|
+
#### 获取分类层级路径(面包屑导航)
|
163
|
+
|
164
|
+
```typescript
|
165
|
+
// 获取分类的完整层级路径
|
166
|
+
const pathResult = await sdk.getCategoryPath(821172);
|
167
|
+
|
168
|
+
// 输出面包屑导航数据
|
169
|
+
console.log('当前分类:', pathResult.currentCategory?.categoryName);
|
170
|
+
console.log('完整路径:', pathResult.path.map(cat => cat.categoryName).join(' > '));
|
171
|
+
|
172
|
+
// 前端面包屑导航使用
|
173
|
+
pathResult.breadcrumbs.forEach((crumb, index) => {
|
174
|
+
if (index < pathResult.breadcrumbs.length - 1) {
|
175
|
+
console.log(`<a href="/category/${crumb.categoryId}">${crumb.categoryName}</a> >`);
|
176
|
+
} else {
|
177
|
+
console.log(`<span>${crumb.categoryName}</span>`);
|
178
|
+
}
|
179
|
+
});
|
180
|
+
```
|
181
|
+
|
182
|
+
#### 获取子分类
|
183
|
+
|
184
|
+
```typescript
|
185
|
+
// 获取直接子分类
|
186
|
+
const result = await sdk.getSubCategories(671920);
|
187
|
+
console.log(`子分类数量: ${result.total}`);
|
188
|
+
console.log(`递归深度: ${result.depth}`);
|
189
|
+
|
190
|
+
// 递归获取所有层级的子分类
|
191
|
+
const recursiveResult = await sdk.getSubCategories(671920, {
|
192
|
+
recursive: true
|
193
|
+
});
|
194
|
+
console.log(`所有子分类数量: ${recursiveResult.total}`);
|
195
|
+
|
196
|
+
// 包含当前分类
|
197
|
+
const includeCurrentResult = await sdk.getSubCategories(671920, {
|
198
|
+
includeCurrent: true
|
199
|
+
});
|
200
|
+
console.log(`包含当前分类的总数量: ${includeCurrentResult.total}`);
|
201
|
+
|
202
|
+
// 限制递归深度
|
203
|
+
const limitedResult = await sdk.getSubCategories(671920, {
|
204
|
+
recursive: true,
|
205
|
+
maxDepth: 2
|
206
|
+
});
|
207
|
+
console.log(`限制深度后的子分类数量: ${limitedResult.total}`);
|
208
|
+
```
|
209
|
+
|
210
|
+
#### 在Astro中使用面包屑导航
|
211
|
+
|
212
|
+
```astro
|
213
|
+
---
|
214
|
+
// Breadcrumb.astro
|
215
|
+
import { GT6SDK } from '@gt6/sdk';
|
216
|
+
|
217
|
+
const { categoryId } = Astro.props;
|
218
|
+
const sdk = new GT6SDK({ baseUrl: 'https://data.shopasb.io', platformId: '1750838492' });
|
219
|
+
const pathResult = await sdk.articles.getCategoryPath(categoryId);
|
220
|
+
---
|
221
|
+
|
222
|
+
<nav class="breadcrumb">
|
223
|
+
<ol>
|
224
|
+
<li><a href="/">首页</a></li>
|
225
|
+
{pathResult.breadcrumbs.map((crumb, index) => (
|
226
|
+
<li>
|
227
|
+
{index === pathResult.breadcrumbs.length - 1 ? (
|
228
|
+
<span>{crumb.categoryName}</span>
|
229
|
+
) : (
|
230
|
+
<a href={`/category/${crumb.categoryId}`}>{crumb.categoryName}</a>
|
231
|
+
)}
|
232
|
+
{index < pathResult.breadcrumbs.length - 1 && <span> > </span>}
|
233
|
+
</li>
|
234
|
+
))}
|
235
|
+
</ol>
|
236
|
+
</nav>
|
237
|
+
```
|
238
|
+
|
239
|
+
#### 在Astro中使用分类树导航
|
240
|
+
|
241
|
+
```astro
|
242
|
+
---
|
243
|
+
// CategoryTree.astro
|
244
|
+
import { GT6SDK } from '@gt6/sdk';
|
245
|
+
|
246
|
+
const { categoryId, recursive = false, maxDepth = 3 } = Astro.props;
|
247
|
+
const sdk = new GT6SDK({ baseUrl: 'https://data.shopasb.io', platformId: '1750838492' });
|
248
|
+
const result = await sdk.articles.getSubCategories(categoryId, { recursive, maxDepth });
|
249
|
+
---
|
250
|
+
|
251
|
+
<div class="category-tree">
|
252
|
+
<h3>{result.currentCategory?.categoryName}</h3>
|
253
|
+
<ul>
|
254
|
+
{result.subCategories.map(category => (
|
255
|
+
<li>
|
256
|
+
<a href={`/category/${category.categoryId}`}>
|
257
|
+
{category.categoryName} ({category.articleIds.length})
|
258
|
+
</a>
|
259
|
+
</li>
|
260
|
+
))}
|
261
|
+
</ul>
|
262
|
+
</div>
|
263
|
+
```
|
264
|
+
|
265
|
+
## API 参考
|
266
|
+
|
267
|
+
### GT6SDK 类
|
268
|
+
|
269
|
+
#### 构造函数
|
270
|
+
|
271
|
+
```typescript
|
272
|
+
new GT6SDK(config: GT6Config)
|
273
|
+
```
|
274
|
+
|
275
|
+
**配置参数:**
|
276
|
+
|
277
|
+
- `baseUrl` (string): API基础URL
|
278
|
+
- `platformId` (string | number): 平台ID
|
279
|
+
- `rootCategoryId` (string | number, 可选): 根分类ID,默认为'671920'
|
280
|
+
- `tagAlias` (string, 可选): 标签别名,默认为'001'
|
281
|
+
- `timeout` (number, 可选): 请求超时时间,默认为10000ms
|
282
|
+
- `cache` (object, 可选): 缓存配置
|
283
|
+
- `enabled` (boolean): 是否启用缓存,默认为true
|
284
|
+
- `ttl` (number): 缓存时间,默认为300000ms (5分钟)
|
285
|
+
|
286
|
+
#### 方法
|
287
|
+
|
288
|
+
##### 便捷方法
|
289
|
+
|
290
|
+
- `getArticle(articleId: number | string): Promise<Article>`
|
291
|
+
- `getCategories(rootCategoryId?: number | string): Promise<Category[]>`
|
292
|
+
- `getTags(tagAlias?: string): Promise<Tag[]>`
|
293
|
+
- `getArticlesByCategory(categoryId: number | number[], options?: { offset?: number; limit?: number; status?: string }): Promise<{ articles: Article[]; total: number; categoryIds: number[] }>`
|
294
|
+
- `getArticlesByTag(tagId: number | number[], options?: { offset?: number; limit?: number; status?: string }): Promise<{ articles: Article[]; total: number; tagIds: number[] }>`
|
295
|
+
- `getCategoryPath(categoryId: number): Promise<{ path: Category[]; currentCategory: Category | null; breadcrumbs: Array<{ categoryId: number; categoryName: string; level: number }> }>`
|
296
|
+
- `getSubCategories(categoryId: number, options?: { recursive?: boolean; includeCurrent?: boolean; maxDepth?: number }): Promise<{ subCategories: Category[]; currentCategory: Category | null; total: number; depth: number }>`
|
297
|
+
|
298
|
+
##### 缓存管理
|
299
|
+
|
300
|
+
- `clearCache(): void` - 清除所有缓存
|
301
|
+
- `getCacheStats()` - 获取缓存统计信息
|
302
|
+
|
303
|
+
### ArticlesAPI 类
|
304
|
+
|
305
|
+
#### 文章相关方法
|
306
|
+
|
307
|
+
- `getArticle(articleId: number | string): Promise<Article>`
|
308
|
+
- `getArticles(params?: ArticleQueryParams): Promise<Article[]>`
|
309
|
+
- `getArticleList(params?: ArticleQueryParams): Promise<ArticleListItem[]>`
|
310
|
+
- `getArticlesByCategory(categoryId: number | number[], options?: { offset?: number; limit?: number; status?: string }): Promise<{ articles: Article[]; total: number; categoryIds: number[] }>`
|
311
|
+
- `getArticlesByTag(tagId: number | number[], options?: { offset?: number; limit?: number; status?: string }): Promise<{ articles: Article[]; total: number; tagIds: number[] }>`
|
312
|
+
- `getCategoryPath(categoryId: number): Promise<{ path: Category[]; currentCategory: Category | null; breadcrumbs: Array<{ categoryId: number; categoryName: string; level: number }> }>`
|
313
|
+
- `getSubCategories(categoryId: number, options?: { recursive?: boolean; includeCurrent?: boolean; maxDepth?: number }): Promise<{ subCategories: Category[]; currentCategory: Category | null; total: number; depth: number }>`
|
314
|
+
- `getPublishedArticles(params?: Omit<ArticleQueryParams, 'status'>): Promise<Article[]>`
|
315
|
+
- `searchArticles(query: string, params?: ArticleQueryParams): Promise<Article[]>`
|
316
|
+
- `getRecommendedArticles(articleId: number, limit?: number): Promise<Article[]>`
|
317
|
+
|
318
|
+
#### 分类和标签方法
|
319
|
+
|
320
|
+
- `getCategories(rootCategoryId?: number | string): Promise<Category[]>`
|
321
|
+
- `getTags(tagAlias?: string): Promise<Tag[]>`
|
322
|
+
|
323
|
+
#### 统计方法
|
324
|
+
|
325
|
+
- `getArticleStats(): Promise<ArticleStats>`
|
326
|
+
|
327
|
+
## 数据类型
|
328
|
+
|
329
|
+
### Article (文章)
|
330
|
+
|
331
|
+
```typescript
|
332
|
+
interface Article {
|
333
|
+
articleId: number;
|
334
|
+
title: string;
|
335
|
+
content: string;
|
336
|
+
status: 'published' | 'draft' | 'archived';
|
337
|
+
publishedAt: string;
|
338
|
+
templateId: number;
|
339
|
+
aiId: number;
|
340
|
+
platformId: number;
|
341
|
+
isVisible: boolean;
|
342
|
+
displayTemplate: string;
|
343
|
+
createdAt: any;
|
344
|
+
updatedAt: any;
|
345
|
+
categories: Category[];
|
346
|
+
tags: Tag[];
|
347
|
+
metaData: ArticleMetaData[];
|
348
|
+
images: ArticleImage[];
|
349
|
+
generatedAt: string;
|
350
|
+
}
|
351
|
+
```
|
352
|
+
|
353
|
+
### Category (分类)
|
354
|
+
|
355
|
+
```typescript
|
356
|
+
interface Category {
|
357
|
+
categoryId: number;
|
358
|
+
categoryName: string;
|
359
|
+
categoryDescription: string;
|
360
|
+
metaKeywords: string;
|
361
|
+
status: number;
|
362
|
+
parentId: number;
|
363
|
+
sortOrder: number;
|
364
|
+
createdAt: any;
|
365
|
+
updatedAt: any;
|
366
|
+
platformId: number;
|
367
|
+
articleIds: number[];
|
368
|
+
children: Category[];
|
369
|
+
}
|
370
|
+
```
|
371
|
+
|
372
|
+
### Tag (标签)
|
373
|
+
|
374
|
+
```typescript
|
375
|
+
interface Tag {
|
376
|
+
tagId: number;
|
377
|
+
tagName: string;
|
378
|
+
type: number;
|
379
|
+
platformId: number;
|
380
|
+
aliases: string;
|
381
|
+
createdAt: any;
|
382
|
+
articleIds: number[];
|
383
|
+
}
|
384
|
+
```
|
385
|
+
|
386
|
+
## 错误处理
|
387
|
+
|
388
|
+
SDK使用自定义的 `GT6Error` 类来处理错误:
|
389
|
+
|
390
|
+
```typescript
|
391
|
+
import { GT6Error } from '@gt6/sdk';
|
392
|
+
|
393
|
+
try {
|
394
|
+
const article = await sdk.getArticle(999999);
|
395
|
+
} catch (error) {
|
396
|
+
if (error instanceof GT6Error) {
|
397
|
+
console.error(`错误: ${error.message}`);
|
398
|
+
console.error(`状态码: ${error.status}`);
|
399
|
+
}
|
400
|
+
}
|
401
|
+
```
|
402
|
+
|
403
|
+
## 缓存机制
|
404
|
+
|
405
|
+
SDK内置缓存机制,默认缓存5分钟:
|
406
|
+
|
407
|
+
```typescript
|
408
|
+
const sdk = new GT6SDK({
|
409
|
+
baseUrl: 'https://data.shopasb.io',
|
410
|
+
platformId: '1750838492',
|
411
|
+
cache: {
|
412
|
+
enabled: true,
|
413
|
+
ttl: 300000 // 5分钟
|
414
|
+
}
|
415
|
+
});
|
416
|
+
|
417
|
+
// 清除缓存
|
418
|
+
sdk.clearCache();
|
419
|
+
|
420
|
+
// 获取缓存统计
|
421
|
+
const stats = sdk.getCacheStats();
|
422
|
+
console.log(`缓存条目数: ${stats.size}`);
|
423
|
+
```
|
424
|
+
|
425
|
+
## 开发
|
426
|
+
|
427
|
+
### 安装依赖
|
428
|
+
|
429
|
+
```bash
|
430
|
+
npm install
|
431
|
+
```
|
432
|
+
|
433
|
+
### 构建
|
434
|
+
|
435
|
+
```bash
|
436
|
+
npm run build
|
437
|
+
```
|
438
|
+
|
439
|
+
### 测试
|
440
|
+
|
441
|
+
```bash
|
442
|
+
npm test
|
443
|
+
```
|
444
|
+
|
445
|
+
### 类型检查
|
446
|
+
|
447
|
+
```bash
|
448
|
+
npm run type-check
|
449
|
+
```
|
450
|
+
|
451
|
+
## 许可证
|
452
|
+
|
453
|
+
MIT
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { GT6Config } from './types';
|
2
|
+
export declare class GT6Client {
|
3
|
+
private config;
|
4
|
+
private cache;
|
5
|
+
constructor(config: GT6Config);
|
6
|
+
/**
|
7
|
+
* 发起HTTP请求
|
8
|
+
*/
|
9
|
+
request<T>(endpoint: string, options?: RequestInit): Promise<T>;
|
10
|
+
/**
|
11
|
+
* 获取配置
|
12
|
+
*/
|
13
|
+
getConfig(): GT6Config;
|
14
|
+
/**
|
15
|
+
* 清除缓存
|
16
|
+
*/
|
17
|
+
clearCache(): void;
|
18
|
+
/**
|
19
|
+
* 获取缓存统计
|
20
|
+
*/
|
21
|
+
getCacheStats(): {
|
22
|
+
size: number;
|
23
|
+
entries: Array<{
|
24
|
+
key: string;
|
25
|
+
age: number;
|
26
|
+
}>;
|
27
|
+
};
|
28
|
+
}
|
29
|
+
//# sourceMappingURL=client.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,SAAS,CAAC;AAE9C,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,KAAK,CAAgD;gBAEjD,MAAM,EAAE,SAAS;IAY7B;;OAEG;IACG,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,CAAC,CAAC;IAuDzE;;OAEG;IACH,SAAS,IAAI,SAAS;IAItB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,aAAa,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;CAWhF"}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
export interface GT6Config {
|
2
|
+
baseUrl: string;
|
3
|
+
platformId: string | number;
|
4
|
+
rootCategoryId?: string | number;
|
5
|
+
tagAlias?: string;
|
6
|
+
timeout?: number;
|
7
|
+
cache?: {
|
8
|
+
enabled: boolean;
|
9
|
+
ttl: number;
|
10
|
+
};
|
11
|
+
}
|
12
|
+
export interface Category {
|
13
|
+
categoryId: number;
|
14
|
+
categoryName: string;
|
15
|
+
categoryDescription: string;
|
16
|
+
metaKeywords: string;
|
17
|
+
status: number;
|
18
|
+
parentId: number;
|
19
|
+
sortOrder: number;
|
20
|
+
createdAt: any;
|
21
|
+
updatedAt: any;
|
22
|
+
platformId: number;
|
23
|
+
articleIds: number[];
|
24
|
+
children: Category[];
|
25
|
+
}
|
26
|
+
export interface CategoryResponse {
|
27
|
+
platformId: number;
|
28
|
+
categories: Category[];
|
29
|
+
generatedAt: string;
|
30
|
+
}
|
31
|
+
export interface Tag {
|
32
|
+
tagId: number;
|
33
|
+
tagName: string;
|
34
|
+
type: number;
|
35
|
+
platformId: number;
|
36
|
+
aliases: string;
|
37
|
+
createdAt: any;
|
38
|
+
articleIds: number[];
|
39
|
+
}
|
40
|
+
export interface TagResponse {
|
41
|
+
platformId: number;
|
42
|
+
tags: Tag[];
|
43
|
+
generatedAt: string;
|
44
|
+
}
|
45
|
+
export interface ArticleMetaData {
|
46
|
+
metaId: number;
|
47
|
+
articleId: number;
|
48
|
+
metaKey: string;
|
49
|
+
metaValue: string;
|
50
|
+
type: number;
|
51
|
+
templateId: number;
|
52
|
+
groupId: number;
|
53
|
+
sortOrder: number;
|
54
|
+
aiId: number;
|
55
|
+
fieldId: number;
|
56
|
+
createdAt: any;
|
57
|
+
updatedAt: any;
|
58
|
+
}
|
59
|
+
export interface ArticleImage {
|
60
|
+
imageId: number;
|
61
|
+
articleId: number;
|
62
|
+
metaId: number | null;
|
63
|
+
imageUrl: string;
|
64
|
+
imageType: 'cover' | 'content';
|
65
|
+
sortOrder: number;
|
66
|
+
createdAt: any;
|
67
|
+
updatedAt: any;
|
68
|
+
}
|
69
|
+
export interface Article {
|
70
|
+
articleId: number;
|
71
|
+
title: string;
|
72
|
+
content: string;
|
73
|
+
status: 'published' | 'draft' | 'archived';
|
74
|
+
publishedAt: string;
|
75
|
+
templateId: number;
|
76
|
+
aiId: number;
|
77
|
+
platformId: number;
|
78
|
+
isVisible: boolean;
|
79
|
+
displayTemplate: string;
|
80
|
+
createdAt: any;
|
81
|
+
updatedAt: any;
|
82
|
+
categories: Category[];
|
83
|
+
tags: Tag[];
|
84
|
+
metaData: ArticleMetaData[];
|
85
|
+
images: ArticleImage[];
|
86
|
+
generatedAt: string;
|
87
|
+
}
|
88
|
+
export interface ArticleListItem {
|
89
|
+
articleId: number;
|
90
|
+
title: string;
|
91
|
+
status: string;
|
92
|
+
publishedAt: string;
|
93
|
+
categories: Category[];
|
94
|
+
tags: Tag[];
|
95
|
+
coverImage?: string;
|
96
|
+
}
|
97
|
+
export declare class GT6Error extends Error {
|
98
|
+
status?: number | undefined;
|
99
|
+
code?: string | undefined;
|
100
|
+
constructor(message: string, status?: number | undefined, code?: string | undefined);
|
101
|
+
}
|
102
|
+
export interface ArticleQueryParams {
|
103
|
+
categoryId?: number;
|
104
|
+
tagId?: number;
|
105
|
+
status?: string;
|
106
|
+
limit?: number;
|
107
|
+
offset?: number;
|
108
|
+
sortBy?: 'publishedAt' | 'title' | 'sortOrder';
|
109
|
+
sortOrder?: 'asc' | 'desc';
|
110
|
+
}
|
111
|
+
export interface ArticleStats {
|
112
|
+
total: number;
|
113
|
+
published: number;
|
114
|
+
draft: number;
|
115
|
+
archived: number;
|
116
|
+
byCategory: Record<number, number>;
|
117
|
+
byTag: Record<number, number>;
|
118
|
+
}
|
119
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;I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