@mx-space/api-client 0.3.1 → 0.3.5
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/build/index.cjs.js +60 -21
- package/build/index.cjs.js.map +1 -1
- package/build/index.cjs.min.js +1 -1
- package/build/index.cjs.min.js.map +1 -1
- package/build/index.d.ts +245 -149
- package/build/index.esm.js +46 -18
- package/build/index.esm.js.map +1 -1
- package/build/index.esm.min.js +1 -1
- package/build/index.esm.min.js.map +1 -1
- package/build/index.umd.js +60 -21
- package/build/index.umd.js.map +1 -1
- package/build/index.umd.min.js +1 -1
- package/build/index.umd.min.js.map +1 -1
- package/esm/core/client.d.ts +5 -7
- package/esm/core/client.js +7 -2
- package/esm/core/client.js.map +1 -1
- package/esm/core/controllers/aggregate.d.ts +5 -7
- package/esm/core/controllers/aggregate.js.map +1 -1
- package/esm/core/controllers/base.d.ts +5 -7
- package/esm/core/controllers/base.js.map +1 -1
- package/esm/core/controllers/category.d.ts +6 -16
- package/esm/core/controllers/category.js +2 -2
- package/esm/core/controllers/category.js.map +1 -1
- package/esm/core/controllers/comment.d.ts +6 -8
- package/esm/core/controllers/comment.js.map +1 -1
- package/esm/core/controllers/note.d.ts +15 -10
- package/esm/core/controllers/note.js +10 -2
- package/esm/core/controllers/note.js.map +1 -1
- package/esm/core/controllers/page.d.ts +11 -4
- package/esm/core/controllers/page.js +9 -2
- package/esm/core/controllers/page.js.map +1 -1
- package/esm/core/controllers/post.d.ts +8 -1
- package/esm/core/controllers/post.js +10 -2
- package/esm/core/controllers/post.js.map +1 -1
- package/esm/core/controllers/recently.d.ts +5 -4
- package/esm/core/controllers/recently.js.map +1 -1
- package/esm/core/controllers/say.d.ts +3 -2
- package/esm/core/controllers/say.js.map +1 -1
- package/esm/core/controllers/search.d.ts +6 -6
- package/esm/core/controllers/snippet.d.ts +4 -3
- package/esm/core/controllers/snippet.js.map +1 -1
- package/esm/core/controllers/user.d.ts +5 -4
- package/esm/core/controllers/user.js.map +1 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/index.js.map +1 -1
- package/esm/interfaces/client.d.ts +5 -0
- package/esm/interfaces/client.js +2 -0
- package/esm/interfaces/client.js.map +1 -0
- package/esm/models/aggregate.d.ts +2 -1
- package/esm/models/aggregate.js.map +1 -1
- package/esm/models/post.d.ts +1 -9
- package/lib/core/client.d.ts +5 -7
- package/lib/core/client.js +7 -2
- package/lib/core/client.js.map +1 -1
- package/lib/core/controllers/aggregate.d.ts +5 -7
- package/lib/core/controllers/aggregate.js.map +1 -1
- package/lib/core/controllers/base.d.ts +5 -7
- package/lib/core/controllers/base.js.map +1 -1
- package/lib/core/controllers/category.d.ts +6 -16
- package/lib/core/controllers/category.js +3 -3
- package/lib/core/controllers/category.js.map +1 -1
- package/lib/core/controllers/comment.d.ts +6 -8
- package/lib/core/controllers/comment.js.map +1 -1
- package/lib/core/controllers/note.d.ts +15 -10
- package/lib/core/controllers/note.js +10 -2
- package/lib/core/controllers/note.js.map +1 -1
- package/lib/core/controllers/page.d.ts +11 -4
- package/lib/core/controllers/page.js +9 -2
- package/lib/core/controllers/page.js.map +1 -1
- package/lib/core/controllers/post.d.ts +8 -1
- package/lib/core/controllers/post.js +10 -2
- package/lib/core/controllers/post.js.map +1 -1
- package/lib/core/controllers/recently.d.ts +5 -4
- package/lib/core/controllers/recently.js.map +1 -1
- package/lib/core/controllers/say.d.ts +3 -2
- package/lib/core/controllers/say.js.map +1 -1
- package/lib/core/controllers/search.d.ts +6 -6
- package/lib/core/controllers/snippet.d.ts +4 -3
- package/lib/core/controllers/snippet.js.map +1 -1
- package/lib/core/controllers/user.d.ts +5 -4
- package/lib/core/controllers/user.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +14 -5
- package/lib/index.js.map +1 -1
- package/lib/interfaces/client.d.ts +5 -0
- package/lib/interfaces/client.js +3 -0
- package/lib/interfaces/client.js.map +1 -0
- package/lib/models/aggregate.d.ts +2 -1
- package/lib/models/aggregate.js.map +1 -1
- package/lib/models/post.d.ts +1 -9
- package/package.json +8 -8
package/build/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator
|
|
1
|
+
// Generated by dts-bundle-generator v6.1.0
|
|
2
2
|
|
|
3
|
+
export type Class<T> = new (...args: any[]) => T;
|
|
4
|
+
export type SelectFields<T extends string> = `${"+" | "-" | ""}${T}`[];
|
|
3
5
|
export interface IController {
|
|
4
6
|
base: string;
|
|
5
7
|
name: string;
|
|
6
8
|
}
|
|
9
|
+
export declare type ClientOptions = {
|
|
10
|
+
controllers?: Class<IController>[];
|
|
11
|
+
};
|
|
7
12
|
export interface RequestOptions {
|
|
8
13
|
method?: string;
|
|
9
14
|
data?: Record<string, any>;
|
|
@@ -43,6 +48,70 @@ export declare type ResponseProxyExtraRaw<T, R = any> = T & {
|
|
|
43
48
|
};
|
|
44
49
|
};
|
|
45
50
|
export declare type SortOrder = "asc" | "desc";
|
|
51
|
+
export interface Count {
|
|
52
|
+
read: number;
|
|
53
|
+
like: number;
|
|
54
|
+
}
|
|
55
|
+
export interface Image {
|
|
56
|
+
height: number;
|
|
57
|
+
width: number;
|
|
58
|
+
type: string;
|
|
59
|
+
accent?: string;
|
|
60
|
+
src: string;
|
|
61
|
+
}
|
|
62
|
+
export interface Pager {
|
|
63
|
+
total: number;
|
|
64
|
+
size: number;
|
|
65
|
+
currentPage: number;
|
|
66
|
+
totalPage: number;
|
|
67
|
+
hasPrevPage: boolean;
|
|
68
|
+
hasNextPage: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface PaginateResult<T> {
|
|
71
|
+
data: T[];
|
|
72
|
+
pagination: Pager;
|
|
73
|
+
}
|
|
74
|
+
declare class BaseModel {
|
|
75
|
+
created?: Date;
|
|
76
|
+
id?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface PostModel {
|
|
79
|
+
commentsIndex: number;
|
|
80
|
+
allowComment: boolean;
|
|
81
|
+
hide: boolean;
|
|
82
|
+
copyright: boolean;
|
|
83
|
+
tags: string[];
|
|
84
|
+
count: Count;
|
|
85
|
+
id: string;
|
|
86
|
+
text: string;
|
|
87
|
+
title: string;
|
|
88
|
+
slug: string;
|
|
89
|
+
categoryId: string;
|
|
90
|
+
images: Image[];
|
|
91
|
+
modified: string;
|
|
92
|
+
created: string;
|
|
93
|
+
category: CategoryModel;
|
|
94
|
+
}
|
|
95
|
+
declare enum CategoryType {
|
|
96
|
+
Category = 0,
|
|
97
|
+
Tag = 1
|
|
98
|
+
}
|
|
99
|
+
export interface CategoryModel {
|
|
100
|
+
type: CategoryType;
|
|
101
|
+
count: number;
|
|
102
|
+
id: string;
|
|
103
|
+
created: string;
|
|
104
|
+
slug: string;
|
|
105
|
+
name: string;
|
|
106
|
+
modified: string;
|
|
107
|
+
}
|
|
108
|
+
export declare type CategoryWithChildrenModel = CategoryModel & {
|
|
109
|
+
children: Pick<PostModel, "id" | "title" | "slug" | "modified" | "created">[];
|
|
110
|
+
};
|
|
111
|
+
export interface TagModel {
|
|
112
|
+
count: number;
|
|
113
|
+
name: string;
|
|
114
|
+
}
|
|
46
115
|
export interface NoteModel {
|
|
47
116
|
id: string;
|
|
48
117
|
hide: boolean;
|
|
@@ -101,59 +170,6 @@ export interface PageModel {
|
|
|
101
170
|
/** Other Options */
|
|
102
171
|
options?: object;
|
|
103
172
|
}
|
|
104
|
-
export interface Count {
|
|
105
|
-
read: number;
|
|
106
|
-
like: number;
|
|
107
|
-
}
|
|
108
|
-
export interface Image {
|
|
109
|
-
height: number;
|
|
110
|
-
width: number;
|
|
111
|
-
type: string;
|
|
112
|
-
accent?: string;
|
|
113
|
-
src: string;
|
|
114
|
-
}
|
|
115
|
-
export interface Pager {
|
|
116
|
-
total: number;
|
|
117
|
-
size: number;
|
|
118
|
-
currentPage: number;
|
|
119
|
-
totalPage: number;
|
|
120
|
-
hasPrevPage: boolean;
|
|
121
|
-
hasNextPage: boolean;
|
|
122
|
-
}
|
|
123
|
-
export interface PaginateResult<T> {
|
|
124
|
-
data: T[];
|
|
125
|
-
pagination: Pager;
|
|
126
|
-
}
|
|
127
|
-
declare class BaseModel {
|
|
128
|
-
created?: Date;
|
|
129
|
-
id?: string;
|
|
130
|
-
}
|
|
131
|
-
export interface PostModel {
|
|
132
|
-
commentsIndex: number;
|
|
133
|
-
allowComment: boolean;
|
|
134
|
-
hide: boolean;
|
|
135
|
-
copyright: boolean;
|
|
136
|
-
tags: string[];
|
|
137
|
-
count: Count;
|
|
138
|
-
id: string;
|
|
139
|
-
text: string;
|
|
140
|
-
title: string;
|
|
141
|
-
slug: string;
|
|
142
|
-
categoryId: string;
|
|
143
|
-
images: Image[];
|
|
144
|
-
modified: string;
|
|
145
|
-
created: string;
|
|
146
|
-
category: CategoryModel;
|
|
147
|
-
}
|
|
148
|
-
export interface CategoryModel {
|
|
149
|
-
type: number;
|
|
150
|
-
count: number;
|
|
151
|
-
id: string;
|
|
152
|
-
name: string;
|
|
153
|
-
slug: string;
|
|
154
|
-
created: Date;
|
|
155
|
-
categoryId: string;
|
|
156
|
-
}
|
|
157
173
|
export interface SayModel {
|
|
158
174
|
id?: string;
|
|
159
175
|
text: string;
|
|
@@ -235,7 +251,7 @@ export interface AggregateStat {
|
|
|
235
251
|
uv: number;
|
|
236
252
|
todayIPAccessCount: number;
|
|
237
253
|
}
|
|
238
|
-
declare class AggregateController implements IController {
|
|
254
|
+
export declare class AggregateController implements IController {
|
|
239
255
|
private client;
|
|
240
256
|
base: string;
|
|
241
257
|
name: string;
|
|
@@ -244,62 +260,45 @@ declare class AggregateController implements IController {
|
|
|
244
260
|
/**
|
|
245
261
|
* 获取聚合数据
|
|
246
262
|
*/
|
|
247
|
-
getAggregateData(): RequestProxyResult
|
|
263
|
+
getAggregateData(): RequestProxyResult<AggregateRoot>;
|
|
248
264
|
/**
|
|
249
265
|
* 获取最新发布的内容
|
|
250
266
|
*/
|
|
251
|
-
getTop(size?: number): RequestProxyResult
|
|
267
|
+
getTop(size?: number): RequestProxyResult<AggregateTop, {
|
|
268
|
+
[key: string]: any;
|
|
269
|
+
data: AggregateTop;
|
|
270
|
+
}>;
|
|
252
271
|
getTimeline(options?: {
|
|
253
272
|
sort?: SortOrder;
|
|
254
273
|
type?: TimelineType;
|
|
255
274
|
year?: number;
|
|
256
|
-
}): RequestProxyResult
|
|
275
|
+
}): RequestProxyResult<{
|
|
276
|
+
data: TimelineData;
|
|
277
|
+
}, {
|
|
278
|
+
[key: string]: any;
|
|
279
|
+
data: {
|
|
280
|
+
data: TimelineData;
|
|
281
|
+
};
|
|
282
|
+
}>;
|
|
257
283
|
/**
|
|
258
284
|
* 获取聚合数据统计
|
|
259
285
|
*/
|
|
260
|
-
getStat(): RequestProxyResult
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
Tag = 1
|
|
265
|
-
}
|
|
266
|
-
export interface CategoryModel {
|
|
267
|
-
type: CategoryType;
|
|
268
|
-
count: number;
|
|
269
|
-
id: string;
|
|
270
|
-
created: string;
|
|
271
|
-
slug: string;
|
|
272
|
-
name: string;
|
|
273
|
-
modified: string;
|
|
274
|
-
}
|
|
275
|
-
export declare type CategoryWithChildrenModel = CategoryModel & {
|
|
276
|
-
children: Pick<PostModel, "id" | "title" | "slug" | "modified" | "created">[];
|
|
277
|
-
};
|
|
278
|
-
export interface TagModel {
|
|
279
|
-
count: number;
|
|
280
|
-
name: string;
|
|
286
|
+
getStat(): RequestProxyResult<AggregateStat, {
|
|
287
|
+
[key: string]: any;
|
|
288
|
+
data: AggregateStat;
|
|
289
|
+
}>;
|
|
281
290
|
}
|
|
282
|
-
declare class CategoryController implements IController {
|
|
291
|
+
export declare class CategoryController implements IController {
|
|
283
292
|
private client;
|
|
284
293
|
name: string;
|
|
285
294
|
base: string;
|
|
286
295
|
constructor(client: HTTPClient);
|
|
287
296
|
private get proxy();
|
|
288
|
-
getAllCategories():
|
|
297
|
+
getAllCategories(): RequestProxyResult<{
|
|
289
298
|
data: CategoryModel[];
|
|
290
|
-
}, {
|
|
291
|
-
[key: string]: any;
|
|
292
|
-
data: {
|
|
293
|
-
data: CategoryModel[];
|
|
294
|
-
};
|
|
295
299
|
}>;
|
|
296
|
-
getAllTags():
|
|
300
|
+
getAllTags(): RequestProxyResult<{
|
|
297
301
|
data: TagModel[];
|
|
298
|
-
}, {
|
|
299
|
-
[key: string]: any;
|
|
300
|
-
data: {
|
|
301
|
-
data: TagModel[];
|
|
302
|
-
};
|
|
303
302
|
}>;
|
|
304
303
|
getCategoryDetail(id: string): Promise<ResponseProxyExtraRaw<CategoryWithChildrenModel>>;
|
|
305
304
|
getCategoryDetail(ids: string[]): Promise<ResponseProxyExtraRaw<Map<string, CategoryWithChildrenModel>>>;
|
|
@@ -346,7 +345,7 @@ declare class CommentDto {
|
|
|
346
345
|
mail: string;
|
|
347
346
|
url?: string;
|
|
348
347
|
}
|
|
349
|
-
declare class CommentController implements IController {
|
|
348
|
+
export declare class CommentController implements IController {
|
|
350
349
|
private readonly client;
|
|
351
350
|
base: string;
|
|
352
351
|
name: string;
|
|
@@ -355,20 +354,29 @@ declare class CommentController implements IController {
|
|
|
355
354
|
/**
|
|
356
355
|
* 根据 comment id 获取评论, 包括子评论
|
|
357
356
|
*/
|
|
358
|
-
getById(id: string): RequestProxyResult
|
|
357
|
+
getById(id: string): RequestProxyResult<CommentModel>;
|
|
359
358
|
/**
|
|
360
359
|
* 获取文章的评论列表
|
|
361
360
|
* @param refId 文章 Id
|
|
362
361
|
*/
|
|
363
|
-
getByRefId(refId: string, pagination?: PaginationParams): RequestProxyResult
|
|
362
|
+
getByRefId(refId: string, pagination?: PaginationParams): RequestProxyResult<PaginateResult<CommentModel>, {
|
|
363
|
+
[key: string]: any;
|
|
364
|
+
data: PaginateResult<CommentModel>;
|
|
365
|
+
}>;
|
|
364
366
|
/**
|
|
365
367
|
* 评论
|
|
366
368
|
*/
|
|
367
|
-
comment(refId: string, data: CommentDto): RequestProxyResult
|
|
369
|
+
comment(refId: string, data: CommentDto): RequestProxyResult<CommentModel, {
|
|
370
|
+
[key: string]: any;
|
|
371
|
+
data: CommentModel;
|
|
372
|
+
}>;
|
|
368
373
|
/**
|
|
369
374
|
* 回复评论
|
|
370
375
|
*/
|
|
371
|
-
reply(commentId: string, data: CommentDto): RequestProxyResult
|
|
376
|
+
reply(commentId: string, data: CommentDto): RequestProxyResult<CommentModel, {
|
|
377
|
+
[key: string]: any;
|
|
378
|
+
data: CommentModel;
|
|
379
|
+
}>;
|
|
372
380
|
}
|
|
373
381
|
declare enum LinkType {
|
|
374
382
|
Friend = 0,
|
|
@@ -392,22 +400,38 @@ declare abstract class BaseCrudController<T> {
|
|
|
392
400
|
base: string;
|
|
393
401
|
constructor(client: HTTPClient);
|
|
394
402
|
protected get proxy(): IRequestHandler;
|
|
395
|
-
getById(id: string): RequestProxyResult
|
|
396
|
-
getAll(): RequestProxyResult
|
|
403
|
+
getById(id: string): RequestProxyResult<T>;
|
|
404
|
+
getAll(): RequestProxyResult<{
|
|
405
|
+
data: T[];
|
|
406
|
+
}, {
|
|
407
|
+
[key: string]: any;
|
|
408
|
+
data: {
|
|
409
|
+
data: T[];
|
|
410
|
+
};
|
|
411
|
+
}>;
|
|
397
412
|
/**
|
|
398
413
|
* 带分页的查询
|
|
399
414
|
* @param page
|
|
400
415
|
* @param perPage
|
|
401
416
|
*/
|
|
402
|
-
getAllPaginated(page?: number, perPage?: number): RequestProxyResult
|
|
417
|
+
getAllPaginated(page?: number, perPage?: number): RequestProxyResult<PaginateResult<T>, {
|
|
418
|
+
[key: string]: any;
|
|
419
|
+
data: PaginateResult<T>;
|
|
420
|
+
}>;
|
|
403
421
|
}
|
|
404
|
-
declare class LinkController extends BaseCrudController<LinkModel> {
|
|
422
|
+
export declare class LinkController extends BaseCrudController<LinkModel> {
|
|
405
423
|
protected readonly client: HTTPClient;
|
|
406
424
|
constructor(client: HTTPClient);
|
|
407
425
|
name: string;
|
|
408
426
|
base: string;
|
|
409
427
|
}
|
|
410
|
-
declare
|
|
428
|
+
export declare type NoteListOptions = {
|
|
429
|
+
select?: SelectFields<keyof NoteModel>;
|
|
430
|
+
year?: number;
|
|
431
|
+
sortBy?: "weather" | "mood" | "title" | "created" | "modified";
|
|
432
|
+
sortOrder?: 1 | -1;
|
|
433
|
+
};
|
|
434
|
+
export declare class NoteController implements IController {
|
|
411
435
|
private client;
|
|
412
436
|
base: string;
|
|
413
437
|
name: string;
|
|
@@ -416,27 +440,50 @@ declare class NoteController implements IController {
|
|
|
416
440
|
/**
|
|
417
441
|
* 最新日记
|
|
418
442
|
*/
|
|
419
|
-
getLatest(): RequestProxyResult
|
|
443
|
+
getLatest(): RequestProxyResult<NoteWrappedPayload>;
|
|
420
444
|
/**
|
|
421
445
|
* 获取一篇日记
|
|
422
446
|
* @param id id | nid
|
|
423
447
|
* @param password 访问密码
|
|
424
448
|
*/
|
|
425
|
-
getNoteById(id: string | number, password?: string): RequestProxyResult
|
|
449
|
+
getNoteById(id: string | number, password?: string): RequestProxyResult<NoteWrappedPayload, {
|
|
450
|
+
[key: string]: any;
|
|
451
|
+
data: NoteWrappedPayload;
|
|
452
|
+
}>;
|
|
426
453
|
/**
|
|
427
454
|
* 日记列表分页
|
|
428
455
|
*/
|
|
429
|
-
getList(page?: number, perPage?: number): RequestProxyResult
|
|
456
|
+
getList(page?: number, perPage?: number, options?: NoteListOptions): RequestProxyResult<PaginateResult<NoteModel>, {
|
|
457
|
+
[key: string]: any;
|
|
458
|
+
data: PaginateResult<NoteModel>;
|
|
459
|
+
}>;
|
|
430
460
|
/**
|
|
431
461
|
* 获取当前日记的上下各 n / 2 篇日记
|
|
432
462
|
*/
|
|
433
|
-
getMiddleList(id: string, size?: number): RequestProxyResult
|
|
463
|
+
getMiddleList(id: string, size?: number): RequestProxyResult<{
|
|
464
|
+
data: Pick<NoteModel, "id" | "title" | "nid" | "created">[];
|
|
465
|
+
size: number;
|
|
466
|
+
}, {
|
|
467
|
+
[key: string]: any;
|
|
468
|
+
data: {
|
|
469
|
+
data: Pick<NoteModel, "id" | "title" | "nid" | "created">[];
|
|
470
|
+
size: number;
|
|
471
|
+
};
|
|
472
|
+
}>;
|
|
434
473
|
/**
|
|
435
474
|
* 喜欢这篇日记
|
|
436
475
|
*/
|
|
437
|
-
likeIt(id: string): RequestProxyResult
|
|
476
|
+
likeIt(id: string): RequestProxyResult<never, {
|
|
477
|
+
[key: string]: any;
|
|
478
|
+
data: never;
|
|
479
|
+
}>;
|
|
438
480
|
}
|
|
439
|
-
declare
|
|
481
|
+
export declare type PageListOptions = {
|
|
482
|
+
select?: SelectFields<keyof PageModel>;
|
|
483
|
+
sortBy?: "order" | "subtitle" | "title" | "created" | "modified";
|
|
484
|
+
sortOrder?: 1 | -1;
|
|
485
|
+
};
|
|
486
|
+
export declare class PageController implements IController {
|
|
440
487
|
private readonly client;
|
|
441
488
|
constructor(client: HTTPClient);
|
|
442
489
|
base: string;
|
|
@@ -445,19 +492,34 @@ declare class PageController implements IController {
|
|
|
445
492
|
/**
|
|
446
493
|
* 页面列表
|
|
447
494
|
*/
|
|
448
|
-
getList(page?: number, perPage?: number): RequestProxyResult
|
|
495
|
+
getList(page?: number, perPage?: number, options?: PageListOptions): RequestProxyResult<PaginateResult<PageModel>, {
|
|
496
|
+
[key: string]: any;
|
|
497
|
+
data: PaginateResult<PageModel>;
|
|
498
|
+
}>;
|
|
449
499
|
/**
|
|
450
500
|
* 页面详情
|
|
451
501
|
*/
|
|
452
|
-
getById(id: string): RequestProxyResult
|
|
502
|
+
getById(id: string): RequestProxyResult<PageModel, {
|
|
503
|
+
[key: string]: any;
|
|
504
|
+
data: PageModel;
|
|
505
|
+
}>;
|
|
453
506
|
/**
|
|
454
507
|
* 根据路径获取页面
|
|
455
508
|
* @param slug 路径
|
|
456
509
|
* @returns
|
|
457
510
|
*/
|
|
458
|
-
getBySlug(slug: string): RequestProxyResult
|
|
511
|
+
getBySlug(slug: string): RequestProxyResult<PageModel, {
|
|
512
|
+
[key: string]: any;
|
|
513
|
+
data: PageModel;
|
|
514
|
+
}>;
|
|
459
515
|
}
|
|
460
|
-
declare
|
|
516
|
+
export declare type PostListOptions = {
|
|
517
|
+
select?: SelectFields<keyof PostModel>;
|
|
518
|
+
year?: number;
|
|
519
|
+
sortBy?: "categoryId" | "title" | "created" | "modified";
|
|
520
|
+
sortOrder?: 1 | -1;
|
|
521
|
+
};
|
|
522
|
+
export declare class PostController implements IController {
|
|
461
523
|
private client;
|
|
462
524
|
constructor(client: HTTPClient);
|
|
463
525
|
base: string;
|
|
@@ -469,7 +531,7 @@ declare class PostController implements IController {
|
|
|
469
531
|
* @param perPage
|
|
470
532
|
* @returns
|
|
471
533
|
*/
|
|
472
|
-
getList(page?: number, perPage?: number): RequestProxyResult<PaginateResult<PostModel>, {
|
|
534
|
+
getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<PostModel>, {
|
|
473
535
|
[key: string]: any;
|
|
474
536
|
data: PaginateResult<PostModel>;
|
|
475
537
|
}>;
|
|
@@ -510,7 +572,7 @@ export interface ProjectModel {
|
|
|
510
572
|
avatar?: string;
|
|
511
573
|
text: string;
|
|
512
574
|
}
|
|
513
|
-
declare class ProjectController extends BaseCrudController<ProjectModel> {
|
|
575
|
+
export declare class ProjectController extends BaseCrudController<ProjectModel> {
|
|
514
576
|
protected readonly client: HTTPClient;
|
|
515
577
|
constructor(client: HTTPClient);
|
|
516
578
|
base: string;
|
|
@@ -521,7 +583,7 @@ export interface RecentlyModel {
|
|
|
521
583
|
created: string;
|
|
522
584
|
id: string;
|
|
523
585
|
}
|
|
524
|
-
declare class RecentlyController implements IController {
|
|
586
|
+
export declare class RecentlyController implements IController {
|
|
525
587
|
private readonly client;
|
|
526
588
|
base: string;
|
|
527
589
|
name: string;
|
|
@@ -530,11 +592,28 @@ declare class RecentlyController implements IController {
|
|
|
530
592
|
/**
|
|
531
593
|
* 获取最新一条
|
|
532
594
|
*/
|
|
533
|
-
getLatestOne(): RequestProxyResult
|
|
534
|
-
|
|
535
|
-
|
|
595
|
+
getLatestOne(): RequestProxyResult<RecentlyModel, {
|
|
596
|
+
[key: string]: any;
|
|
597
|
+
data: RecentlyModel;
|
|
598
|
+
}>;
|
|
599
|
+
getAll(): RequestProxyResult<{
|
|
600
|
+
data: RecentlyModel[];
|
|
601
|
+
}, {
|
|
602
|
+
[key: string]: any;
|
|
603
|
+
data: {
|
|
604
|
+
data: RecentlyModel[];
|
|
605
|
+
};
|
|
606
|
+
}>;
|
|
607
|
+
getList(before?: string | undefined, after?: string | undefined, size?: number | number): RequestProxyResult<{
|
|
608
|
+
data: RecentlyModel[];
|
|
609
|
+
}, {
|
|
610
|
+
[key: string]: any;
|
|
611
|
+
data: {
|
|
612
|
+
data: RecentlyModel[];
|
|
613
|
+
};
|
|
614
|
+
}>;
|
|
536
615
|
}
|
|
537
|
-
declare class SayController extends BaseCrudController<SayModel> implements IController {
|
|
616
|
+
export declare class SayController extends BaseCrudController<SayModel> implements IController {
|
|
538
617
|
protected client: HTTPClient;
|
|
539
618
|
base: string;
|
|
540
619
|
name: string;
|
|
@@ -543,19 +622,26 @@ declare class SayController extends BaseCrudController<SayModel> implements ICon
|
|
|
543
622
|
/**
|
|
544
623
|
* 获取随机一条
|
|
545
624
|
*/
|
|
546
|
-
getRandom(): RequestProxyResult
|
|
625
|
+
getRandom(): RequestProxyResult<{
|
|
626
|
+
data: SayModel | null;
|
|
627
|
+
}, {
|
|
628
|
+
[key: string]: any;
|
|
629
|
+
data: {
|
|
630
|
+
data: SayModel | null;
|
|
631
|
+
};
|
|
632
|
+
}>;
|
|
547
633
|
}
|
|
548
634
|
export declare type SearchOption = {
|
|
549
635
|
orderBy?: string;
|
|
550
636
|
order?: number;
|
|
551
637
|
rawAlgolia?: boolean;
|
|
552
638
|
};
|
|
553
|
-
declare class SearchController implements IController {
|
|
639
|
+
export declare class SearchController implements IController {
|
|
554
640
|
private readonly client;
|
|
555
641
|
base: string;
|
|
556
642
|
name: string;
|
|
557
643
|
constructor(client: HTTPClient);
|
|
558
|
-
get proxy():
|
|
644
|
+
get proxy(): IRequestHandler;
|
|
559
645
|
search(type: "note", keyword: string, options?: Omit<SearchOption, "rawAlgolia">): Promise<RequestProxyResult<PaginateResult<Pick<NoteModel, "modified" | "id" | "title" | "created" | "nid">>>>;
|
|
560
646
|
search(type: "post", keyword: string, options?: Omit<SearchOption, "rawAlgolia">): Promise<RequestProxyResult<PaginateResult<Pick<PostModel, "modified" | "id" | "title" | "created" | "slug" | "category">>>>;
|
|
561
647
|
/**
|
|
@@ -565,14 +651,14 @@ declare class SearchController implements IController {
|
|
|
565
651
|
* @param options
|
|
566
652
|
* @returns
|
|
567
653
|
*/
|
|
568
|
-
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<Pick<PostModel, "
|
|
654
|
+
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category">> & {
|
|
569
655
|
/**
|
|
570
656
|
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
571
657
|
*/
|
|
572
658
|
raw?: any;
|
|
573
659
|
}, {
|
|
574
660
|
[key: string]: any;
|
|
575
|
-
data: PaginateResult<Pick<PostModel, "
|
|
661
|
+
data: PaginateResult<Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category">> & {
|
|
576
662
|
/**
|
|
577
663
|
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
578
664
|
*/
|
|
@@ -580,14 +666,14 @@ declare class SearchController implements IController {
|
|
|
580
666
|
};
|
|
581
667
|
}>, {
|
|
582
668
|
[key: string]: any;
|
|
583
|
-
data: RequestProxyResult<PaginateResult<Pick<PostModel, "
|
|
669
|
+
data: RequestProxyResult<PaginateResult<Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category">> & {
|
|
584
670
|
/**
|
|
585
671
|
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
586
672
|
*/
|
|
587
673
|
raw?: any;
|
|
588
674
|
}, {
|
|
589
675
|
[key: string]: any;
|
|
590
|
-
data: PaginateResult<Pick<PostModel, "
|
|
676
|
+
data: PaginateResult<Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category">> & {
|
|
591
677
|
/**
|
|
592
678
|
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
593
679
|
*/
|
|
@@ -609,27 +695,48 @@ export interface SnippetModel extends BaseModel {
|
|
|
609
695
|
comment?: string;
|
|
610
696
|
metatype?: string;
|
|
611
697
|
}
|
|
612
|
-
declare class SnippetController implements IController {
|
|
698
|
+
export declare class SnippetController implements IController {
|
|
613
699
|
protected client: HTTPClient;
|
|
614
700
|
base: string;
|
|
615
701
|
name: string;
|
|
616
702
|
constructor(client: HTTPClient);
|
|
617
703
|
get proxy(): IRequestHandler;
|
|
618
|
-
getById(id: string): RequestProxyResult
|
|
619
|
-
|
|
704
|
+
getById(id: string): RequestProxyResult<SnippetModel, {
|
|
705
|
+
[key: string]: any;
|
|
706
|
+
data: SnippetModel;
|
|
707
|
+
}>;
|
|
708
|
+
getByReferenceAndName(reference: string, name: string): RequestProxyResult<SnippetModel, {
|
|
709
|
+
[key: string]: any;
|
|
710
|
+
data: SnippetModel;
|
|
711
|
+
}>;
|
|
620
712
|
}
|
|
621
|
-
declare class UserController implements IController {
|
|
713
|
+
export declare class UserController implements IController {
|
|
622
714
|
private readonly client;
|
|
623
715
|
constructor(client: HTTPClient);
|
|
624
716
|
base: string;
|
|
625
717
|
name: string;
|
|
626
718
|
protected get proxy(): IRequestHandler;
|
|
627
|
-
getMasterInfo(): RequestProxyResult
|
|
628
|
-
|
|
629
|
-
|
|
719
|
+
getMasterInfo(): RequestProxyResult<UserModel, {
|
|
720
|
+
[key: string]: any;
|
|
721
|
+
data: UserModel;
|
|
722
|
+
}>;
|
|
723
|
+
login(username: string, password: string): RequestProxyResult<TLogin, {
|
|
724
|
+
[key: string]: any;
|
|
725
|
+
data: TLogin;
|
|
726
|
+
}>;
|
|
727
|
+
checkTokenValid(token: string): RequestProxyResult<{
|
|
728
|
+
ok: number;
|
|
729
|
+
isGuest: boolean;
|
|
730
|
+
}, {
|
|
731
|
+
[key: string]: any;
|
|
732
|
+
data: {
|
|
733
|
+
ok: number;
|
|
734
|
+
isGuest: boolean;
|
|
735
|
+
};
|
|
736
|
+
}>;
|
|
630
737
|
}
|
|
631
|
-
declare const allControllers: (typeof AggregateController | typeof CategoryController | typeof CommentController | typeof LinkController | typeof NoteController | typeof PageController | typeof PostController | typeof ProjectController | typeof RecentlyController | typeof SayController | typeof SearchController | typeof SnippetController | typeof UserController)[];
|
|
632
|
-
declare const allContollerNames: string[];
|
|
738
|
+
export declare const allControllers: (typeof AggregateController | typeof CategoryController | typeof CommentController | typeof LinkController | typeof NoteController | typeof PageController | typeof PostController | typeof ProjectController | typeof RecentlyController | typeof SayController | typeof SearchController | typeof SnippetController | typeof UserController)[];
|
|
739
|
+
export declare const allContollerNames: string[];
|
|
633
740
|
declare class HTTPControllerDefine {
|
|
634
741
|
aggregate: AggregateController;
|
|
635
742
|
category: CategoryController;
|
|
@@ -654,12 +761,8 @@ export declare class HTTPClient extends HTTPControllerDefine {
|
|
|
654
761
|
private _proxy;
|
|
655
762
|
constructor(_endpoint: string, _instance: IRequestAdapter);
|
|
656
763
|
private initGetClient;
|
|
657
|
-
injectControllers<
|
|
658
|
-
|
|
659
|
-
}>(...Controller: T[]): void;
|
|
660
|
-
injectControllers<T extends {
|
|
661
|
-
new (client: HTTPClient): IController;
|
|
662
|
-
}>(Controller: T[]): void;
|
|
764
|
+
injectControllers(...Controller: Class<IController>[]): void;
|
|
765
|
+
injectControllers(Controller: Class<IController>[]): void;
|
|
663
766
|
get endpoint(): string;
|
|
664
767
|
get instance(): IRequestAdapter;
|
|
665
768
|
request(options: {
|
|
@@ -672,7 +775,7 @@ export declare class HTTPClient extends HTTPControllerDefine {
|
|
|
672
775
|
private resolveFullPath;
|
|
673
776
|
private buildRoute;
|
|
674
777
|
}
|
|
675
|
-
export declare function createClient<T extends IRequestAdapter>(adapter: T): (endpoint: string) => HTTPClient;
|
|
778
|
+
export declare function createClient<T extends IRequestAdapter>(adapter: T): (endpoint: string, options?: ClientOptions | undefined) => HTTPClient;
|
|
676
779
|
export declare class RequestError extends Error {
|
|
677
780
|
status: number;
|
|
678
781
|
path: string;
|
|
@@ -680,11 +783,4 @@ export declare class RequestError extends Error {
|
|
|
680
783
|
constructor(message: string, status: number, path: string, raw: any);
|
|
681
784
|
}
|
|
682
785
|
|
|
683
|
-
export {
|
|
684
|
-
NoteController as NoteClient,
|
|
685
|
-
PostController as PostClient,
|
|
686
|
-
allContollerNames as allClientName,
|
|
687
|
-
allControllers as allClients,
|
|
688
|
-
};
|
|
689
|
-
|
|
690
786
|
export {};
|