@mx-space/api-client 0.0.4 → 0.3.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/build/index.cjs.js +526 -33
- 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 +542 -34
- package/build/index.esm.js +523 -30
- 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 +526 -33
- 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/attachRequest.js +29 -6
- package/esm/core/attachRequest.js.map +1 -1
- package/esm/core/client.d.ts +12 -15
- package/esm/core/client.js +21 -8
- package/esm/core/client.js.map +1 -1
- package/esm/core/controllers/aggregate.d.ts +44 -0
- package/esm/core/controllers/aggregate.js +40 -0
- package/esm/core/controllers/aggregate.js.map +1 -0
- package/esm/core/controllers/all.d.ts +14 -0
- package/esm/core/controllers/all.js +39 -0
- package/esm/core/controllers/all.js.map +1 -0
- package/esm/core/controllers/base.d.ts +29 -0
- package/esm/core/controllers/base.js +25 -0
- package/esm/core/controllers/base.js.map +1 -0
- package/esm/core/controllers/category.d.ts +44 -0
- package/esm/core/controllers/category.js +66 -0
- package/esm/core/controllers/category.js.map +1 -0
- package/esm/core/controllers/comment.d.ts +42 -0
- package/esm/core/controllers/comment.js +43 -0
- package/esm/core/controllers/comment.js.map +1 -0
- package/esm/core/controllers/index.d.ts +1 -0
- package/esm/core/controllers/index.js +2 -0
- package/esm/core/controllers/index.js.map +1 -0
- package/esm/core/controllers/link.d.ts +9 -0
- package/esm/core/controllers/link.js +10 -0
- package/esm/core/controllers/link.js.map +1 -0
- package/esm/core/controllers/note.d.ts +54 -0
- package/esm/core/controllers/note.js +54 -0
- package/esm/core/controllers/note.js.map +1 -0
- package/esm/core/controllers/page.d.ts +34 -0
- package/esm/core/controllers/page.js +33 -0
- package/esm/core/controllers/page.js.map +1 -0
- package/esm/core/controllers/post.d.ts +47 -0
- package/esm/core/controllers/post.js +42 -0
- package/esm/core/controllers/post.js.map +1 -0
- package/esm/core/controllers/recently.d.ts +33 -0
- package/esm/core/controllers/recently.js +32 -0
- package/esm/core/controllers/recently.js.map +1 -0
- package/esm/core/controllers/say.d.ts +22 -0
- package/esm/core/controllers/say.js +19 -0
- package/esm/core/controllers/say.js.map +1 -0
- package/esm/core/controllers/search.d.ts +58 -0
- package/esm/core/controllers/search.js +26 -0
- package/esm/core/controllers/search.js.map +1 -0
- package/esm/core/controllers/user.d.ts +28 -0
- package/esm/core/controllers/user.js +29 -0
- package/esm/core/controllers/user.js.map +1 -0
- package/esm/core/define.d.ts +17 -0
- package/esm/core/define.js +12 -0
- package/esm/core/define.js.map +1 -0
- package/esm/core/dtos/comment.d.ts +6 -0
- package/esm/core/dtos/comment.js +3 -0
- package/esm/core/dtos/comment.js.map +1 -0
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/interfaces/{client.d.ts → controller.d.ts} +1 -1
- package/esm/interfaces/controller.js +2 -0
- package/esm/interfaces/controller.js.map +1 -0
- package/esm/interfaces/instance.d.ts +3 -2
- package/esm/interfaces/options.d.ts +1 -0
- package/esm/interfaces/options.js +2 -0
- package/esm/interfaces/options.js.map +1 -0
- package/esm/interfaces/params.d.ts +4 -0
- package/esm/interfaces/params.js +2 -0
- package/esm/interfaces/params.js.map +1 -0
- package/esm/interfaces/request.d.ts +19 -9
- package/esm/models/aggregate.d.ts +47 -0
- package/esm/models/aggregate.js +6 -0
- package/esm/models/aggregate.js.map +1 -0
- package/esm/models/base.d.ts +1 -1
- package/esm/models/category.d.ts +24 -0
- package/esm/models/category.js +6 -0
- package/esm/models/category.js.map +1 -0
- package/esm/models/comment.d.ts +28 -0
- package/esm/models/comment.js +7 -0
- package/esm/models/comment.js.map +1 -0
- package/esm/models/link.d.ts +17 -0
- package/esm/models/link.js +11 -0
- package/esm/models/link.js.map +1 -0
- package/esm/models/note.d.ts +34 -0
- package/esm/models/note.js +2 -0
- package/esm/models/note.js.map +1 -0
- package/esm/models/page.d.ts +24 -0
- package/esm/models/page.js +7 -0
- package/esm/models/page.js.map +1 -0
- package/esm/models/post.d.ts +2 -7
- package/esm/models/recently.d.ts +5 -0
- package/esm/models/recently.js +2 -0
- package/esm/models/recently.js.map +1 -0
- package/esm/models/say.d.ts +6 -0
- package/esm/models/say.js +2 -0
- package/esm/models/say.js.map +1 -0
- package/esm/models/setting.d.ts +66 -0
- package/esm/models/setting.js +2 -0
- package/esm/models/setting.js.map +1 -0
- package/esm/models/user.d.ts +29 -0
- package/esm/models/user.js +2 -0
- package/esm/models/user.js.map +1 -0
- package/esm/utils/index.d.ts +4 -0
- package/esm/utils/index.js +38 -0
- package/esm/utils/index.js.map +1 -1
- package/lib/core/attachRequest.js +29 -6
- package/lib/core/attachRequest.js.map +1 -1
- package/lib/core/client.d.ts +12 -15
- package/lib/core/client.js +21 -8
- package/lib/core/client.js.map +1 -1
- package/lib/core/controllers/aggregate.d.ts +44 -0
- package/lib/core/controllers/aggregate.js +44 -0
- package/lib/core/controllers/aggregate.js.map +1 -0
- package/lib/core/controllers/all.d.ts +14 -0
- package/lib/core/controllers/all.js +52 -0
- package/lib/core/controllers/all.js.map +1 -0
- package/lib/core/controllers/base.d.ts +29 -0
- package/lib/core/controllers/base.js +29 -0
- package/lib/core/controllers/base.js.map +1 -0
- package/lib/core/controllers/category.d.ts +44 -0
- package/lib/core/controllers/category.js +70 -0
- package/lib/core/controllers/category.js.map +1 -0
- package/lib/core/controllers/comment.d.ts +42 -0
- package/lib/core/controllers/comment.js +47 -0
- package/lib/core/controllers/comment.js.map +1 -0
- package/lib/core/controllers/index.d.ts +1 -0
- package/lib/core/{clients → controllers}/index.js +0 -3
- package/lib/core/controllers/index.js.map +1 -0
- package/lib/core/controllers/link.d.ts +9 -0
- package/lib/core/controllers/link.js +14 -0
- package/lib/core/controllers/link.js.map +1 -0
- package/lib/core/controllers/note.d.ts +54 -0
- package/lib/core/controllers/note.js +58 -0
- package/lib/core/controllers/note.js.map +1 -0
- package/lib/core/controllers/page.d.ts +34 -0
- package/lib/core/controllers/page.js +37 -0
- package/lib/core/controllers/page.js.map +1 -0
- package/lib/core/controllers/post.d.ts +47 -0
- package/lib/core/controllers/post.js +46 -0
- package/lib/core/controllers/post.js.map +1 -0
- package/lib/core/controllers/recently.d.ts +33 -0
- package/lib/core/controllers/recently.js +36 -0
- package/lib/core/controllers/recently.js.map +1 -0
- package/lib/core/controllers/say.d.ts +22 -0
- package/lib/core/controllers/say.js +23 -0
- package/lib/core/controllers/say.js.map +1 -0
- package/lib/core/controllers/search.d.ts +58 -0
- package/lib/core/controllers/search.js +30 -0
- package/lib/core/controllers/search.js.map +1 -0
- package/lib/core/controllers/user.d.ts +28 -0
- package/lib/core/controllers/user.js +33 -0
- package/lib/core/controllers/user.js.map +1 -0
- package/lib/core/define.d.ts +17 -0
- package/lib/core/define.js +16 -0
- package/lib/core/define.js.map +1 -0
- package/lib/core/dtos/comment.d.ts +6 -0
- package/lib/core/dtos/comment.js +7 -0
- package/lib/core/dtos/comment.js.map +1 -0
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/interfaces/{client.d.ts → controller.d.ts} +1 -1
- package/lib/interfaces/controller.js +3 -0
- package/lib/interfaces/controller.js.map +1 -0
- package/lib/interfaces/instance.d.ts +3 -2
- package/lib/interfaces/options.d.ts +1 -0
- package/lib/interfaces/options.js +3 -0
- package/lib/interfaces/options.js.map +1 -0
- package/lib/interfaces/params.d.ts +4 -0
- package/lib/interfaces/{client.js → params.js} +1 -1
- package/lib/interfaces/params.js.map +1 -0
- package/lib/interfaces/request.d.ts +19 -9
- package/lib/models/aggregate.d.ts +47 -0
- package/lib/models/aggregate.js +9 -0
- package/lib/models/aggregate.js.map +1 -0
- package/lib/models/base.d.ts +1 -1
- package/lib/models/category.d.ts +24 -0
- package/lib/models/category.js +9 -0
- package/lib/models/category.js.map +1 -0
- package/lib/models/comment.d.ts +28 -0
- package/lib/models/comment.js +10 -0
- package/lib/models/comment.js.map +1 -0
- package/lib/models/link.d.ts +17 -0
- package/lib/models/link.js +14 -0
- package/lib/models/link.js.map +1 -0
- package/lib/models/note.d.ts +34 -0
- package/lib/models/note.js +3 -0
- package/lib/models/note.js.map +1 -0
- package/lib/models/page.d.ts +24 -0
- package/lib/models/page.js +10 -0
- package/lib/models/page.js.map +1 -0
- package/lib/models/post.d.ts +2 -7
- package/lib/models/recently.d.ts +5 -0
- package/lib/models/recently.js +3 -0
- package/lib/models/recently.js.map +1 -0
- package/lib/models/say.d.ts +6 -0
- package/lib/models/say.js +3 -0
- package/lib/models/say.js.map +1 -0
- package/lib/models/setting.d.ts +66 -0
- package/lib/models/setting.js +3 -0
- package/lib/models/setting.js.map +1 -0
- package/lib/models/user.d.ts +29 -0
- package/lib/models/user.js +3 -0
- package/lib/models/user.js.map +1 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +42 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +12 -11
- package/esm/core/clients/all.d.ts +0 -3
- package/esm/core/clients/all.js +0 -9
- package/esm/core/clients/all.js.map +0 -1
- package/esm/core/clients/index.d.ts +0 -3
- package/esm/core/clients/index.js +0 -5
- package/esm/core/clients/index.js.map +0 -1
- package/esm/core/clients/note.d.ts +0 -5
- package/esm/core/clients/note.js +0 -7
- package/esm/core/clients/note.js.map +0 -1
- package/esm/core/clients/post.d.ts +0 -16
- package/esm/core/clients/post.js +0 -23
- package/esm/core/clients/post.js.map +0 -1
- package/esm/interfaces/client.js +0 -2
- package/esm/interfaces/client.js.map +0 -1
- package/lib/core/clients/all.d.ts +0 -3
- package/lib/core/clients/all.js +0 -12
- package/lib/core/clients/all.js.map +0 -1
- package/lib/core/clients/index.d.ts +0 -3
- package/lib/core/clients/index.js.map +0 -1
- package/lib/core/clients/note.d.ts +0 -5
- package/lib/core/clients/note.js +0 -11
- package/lib/core/clients/note.js.map +0 -1
- package/lib/core/clients/post.d.ts +0 -16
- package/lib/core/clients/post.js +0 -27
- package/lib/core/clients/post.js.map +0 -1
- package/lib/interfaces/client.js.map +0 -1
package/build/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v5.9.0
|
|
2
2
|
|
|
3
|
-
export interface
|
|
3
|
+
export interface IController {
|
|
4
4
|
base: string;
|
|
5
5
|
name: string;
|
|
6
6
|
}
|
|
7
7
|
export interface RequestOptions {
|
|
8
8
|
method?: string;
|
|
9
|
-
data?: string
|
|
10
|
-
params?: Record<string, any
|
|
9
|
+
data?: Record<string, any>;
|
|
10
|
+
params?: Record<string, any> | URLSearchParams;
|
|
11
|
+
headers?: Record<string, string>;
|
|
11
12
|
[key: string]: any;
|
|
12
13
|
}
|
|
13
14
|
export interface IRequestAdapter {
|
|
@@ -17,24 +18,88 @@ export interface IRequestAdapter {
|
|
|
17
18
|
delete<P = unknown>(url: string, options?: RequestOptions): Promise<P>;
|
|
18
19
|
put<P = unknown>(url: string, options?: RequestOptions): Promise<P>;
|
|
19
20
|
}
|
|
20
|
-
export
|
|
21
|
+
export declare type NoStringIndex<T> = {
|
|
22
|
+
[K in keyof T as string extends K ? never : K]: T[K];
|
|
23
|
+
};
|
|
24
|
+
export interface IRequestHandler {
|
|
21
25
|
(id?: string): IRequestHandler;
|
|
22
|
-
get<P = unknown>(options?:
|
|
23
|
-
post<P = unknown>(options?:
|
|
24
|
-
patch<P = unknown>(options?:
|
|
25
|
-
delete<P = unknown>(options?:
|
|
26
|
-
put<P = unknown>(options?:
|
|
26
|
+
get<P = unknown>(options?: Omit<NoStringIndex<RequestOptions>, "data">): RequestProxyResult<P>;
|
|
27
|
+
post<P = unknown>(options?: RequestOptions): RequestProxyResult<P>;
|
|
28
|
+
patch<P = unknown>(options?: RequestOptions): RequestProxyResult<P>;
|
|
29
|
+
delete<P = unknown>(options?: Omit<NoStringIndex<RequestOptions>, "data">): RequestProxyResult<P>;
|
|
30
|
+
put<P = unknown>(options?: RequestOptions): RequestProxyResult<P>;
|
|
27
31
|
[key: string]: IRequestHandler;
|
|
28
32
|
}
|
|
29
33
|
export declare type RequestProxyResult<T, R = {
|
|
30
34
|
data: T;
|
|
31
35
|
[key: string]: any;
|
|
32
|
-
}> = Promise<T
|
|
36
|
+
}> = Promise<ResponseProxyExtraRaw<T, R>>;
|
|
37
|
+
export declare type ResponseProxyExtraRaw<T, R = any> = T & {
|
|
33
38
|
raw: R;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
request: {
|
|
40
|
+
path: string;
|
|
41
|
+
method: string;
|
|
42
|
+
[k: string]: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export declare type SortOrder = "asc" | "desc";
|
|
46
|
+
export interface NoteModel {
|
|
47
|
+
id: string;
|
|
48
|
+
hide: boolean;
|
|
49
|
+
count: {
|
|
50
|
+
read: number;
|
|
51
|
+
like: number;
|
|
52
|
+
};
|
|
53
|
+
title: string;
|
|
54
|
+
text: string;
|
|
55
|
+
mood?: string;
|
|
56
|
+
weather?: string;
|
|
57
|
+
hasMemory?: boolean;
|
|
58
|
+
created: string;
|
|
59
|
+
modified: string;
|
|
60
|
+
secret?: Date;
|
|
61
|
+
password?: string | null;
|
|
62
|
+
nid: number;
|
|
63
|
+
music?: NoteMusicRecord[];
|
|
64
|
+
location?: string;
|
|
65
|
+
coordinates?: Coordinate;
|
|
66
|
+
}
|
|
67
|
+
export interface NoteMusicRecord {
|
|
68
|
+
type: string;
|
|
69
|
+
id: string;
|
|
70
|
+
}
|
|
71
|
+
export interface Coordinate {
|
|
72
|
+
latitude: number;
|
|
73
|
+
longitude: number;
|
|
74
|
+
}
|
|
75
|
+
export interface NoteWrappedPayload {
|
|
76
|
+
data: NoteModel;
|
|
77
|
+
next?: Partial<NoteModel>;
|
|
78
|
+
prev?: Partial<NoteModel>;
|
|
79
|
+
}
|
|
80
|
+
declare enum EnumPageType {
|
|
81
|
+
"md" = "md",
|
|
82
|
+
"html" = "html",
|
|
83
|
+
"frame" = "frame"
|
|
84
|
+
}
|
|
85
|
+
export interface PageModel {
|
|
86
|
+
created: string;
|
|
87
|
+
modified: string;
|
|
88
|
+
id: string;
|
|
89
|
+
/** Slug */
|
|
90
|
+
slug: string;
|
|
91
|
+
/** Title */
|
|
92
|
+
title: string;
|
|
93
|
+
/** SubTitle */
|
|
94
|
+
subtitle?: string;
|
|
95
|
+
/** Order */
|
|
96
|
+
order?: number;
|
|
97
|
+
/** Text */
|
|
98
|
+
text: string;
|
|
99
|
+
/** Type (MD | html | frame) */
|
|
100
|
+
type?: EnumPageType;
|
|
101
|
+
/** Other Options */
|
|
102
|
+
options?: object;
|
|
38
103
|
}
|
|
39
104
|
export interface Count {
|
|
40
105
|
read: number;
|
|
@@ -55,8 +120,8 @@ export interface Pager {
|
|
|
55
120
|
hasPrevPage: boolean;
|
|
56
121
|
hasNextPage: boolean;
|
|
57
122
|
}
|
|
58
|
-
export interface
|
|
59
|
-
data:
|
|
123
|
+
export interface PaginateResult<T> {
|
|
124
|
+
data: T[];
|
|
60
125
|
pagination: Pager;
|
|
61
126
|
}
|
|
62
127
|
export interface PostModel {
|
|
@@ -75,7 +140,6 @@ export interface PostModel {
|
|
|
75
140
|
modified: string;
|
|
76
141
|
created: string;
|
|
77
142
|
category: CategoryModel;
|
|
78
|
-
datumID: string;
|
|
79
143
|
}
|
|
80
144
|
export interface CategoryModel {
|
|
81
145
|
type: number;
|
|
@@ -84,36 +148,473 @@ export interface CategoryModel {
|
|
|
84
148
|
name: string;
|
|
85
149
|
slug: string;
|
|
86
150
|
created: Date;
|
|
87
|
-
|
|
151
|
+
categoryId: string;
|
|
152
|
+
}
|
|
153
|
+
export interface SayModel {
|
|
154
|
+
id?: string;
|
|
155
|
+
text: string;
|
|
156
|
+
source?: string;
|
|
157
|
+
author?: string;
|
|
158
|
+
}
|
|
159
|
+
declare class SeoOptionModel {
|
|
160
|
+
title: string;
|
|
161
|
+
description: string;
|
|
162
|
+
icon?: string;
|
|
163
|
+
keywords?: string[];
|
|
164
|
+
}
|
|
165
|
+
export interface UserModel {
|
|
166
|
+
ok: number;
|
|
167
|
+
id: string;
|
|
168
|
+
introduce: string;
|
|
169
|
+
mail: string;
|
|
170
|
+
url: string;
|
|
171
|
+
name: string;
|
|
172
|
+
socialIDS: SocialIDS & Record<string, string>;
|
|
173
|
+
username: string;
|
|
174
|
+
created: Date;
|
|
175
|
+
modified: Date;
|
|
176
|
+
v: number;
|
|
177
|
+
lastLoginTime: string;
|
|
178
|
+
lastLoginIp?: string;
|
|
179
|
+
avatar: string;
|
|
180
|
+
postID: string;
|
|
181
|
+
}
|
|
182
|
+
export interface SocialIDS {
|
|
183
|
+
biliID: number;
|
|
184
|
+
neteaseID: number;
|
|
185
|
+
github: string;
|
|
186
|
+
}
|
|
187
|
+
export declare type TLogin = {
|
|
188
|
+
token: string;
|
|
189
|
+
expiresIn: number;
|
|
190
|
+
lastLoginTime: null | string;
|
|
191
|
+
lastLoginIp?: null | string;
|
|
192
|
+
} & Pick<UserModel, "name" | "username" | "created" | "url" | "mail" | "avatar" | "id">;
|
|
193
|
+
export interface AggregateRoot {
|
|
194
|
+
user: UserModel;
|
|
195
|
+
seo: SeoOptionModel;
|
|
196
|
+
categories: CategoryModel[];
|
|
197
|
+
pageMeta: Pick<PageModel, "title" | "id" | "slug" | "order">[] | null;
|
|
198
|
+
lastestNoteNid: number | null;
|
|
88
199
|
}
|
|
89
|
-
export
|
|
200
|
+
export interface AggregateTop {
|
|
201
|
+
notes: Pick<NoteModel, "id" | "title" | "created" | "nid">[];
|
|
202
|
+
posts: Pick<PostModel, "id" | "slug" | "created" | "title" | "category">[];
|
|
203
|
+
says: SayModel[];
|
|
204
|
+
}
|
|
205
|
+
declare enum TimelineType {
|
|
206
|
+
Post = 0,
|
|
207
|
+
Note = 1
|
|
208
|
+
}
|
|
209
|
+
export interface TimelineData {
|
|
210
|
+
notes?: Pick<NoteModel, "id" | "nid" | "title" | "weather" | "mood" | "created" | "modified" | "hasMemory">[];
|
|
211
|
+
posts?: (Pick<PostModel, "id" | "title" | "slug" | "created" | "modified" | "category"> & {
|
|
212
|
+
url: string;
|
|
213
|
+
})[];
|
|
214
|
+
}
|
|
215
|
+
export interface AggregateStat {
|
|
216
|
+
allComments: number;
|
|
217
|
+
categories: number;
|
|
218
|
+
comments: number;
|
|
219
|
+
linkApply: number;
|
|
220
|
+
links: number;
|
|
221
|
+
notes: number;
|
|
222
|
+
pages: number;
|
|
223
|
+
posts: number;
|
|
224
|
+
says: number;
|
|
225
|
+
recently: number;
|
|
226
|
+
unreadComments: number;
|
|
227
|
+
online: number;
|
|
228
|
+
todayMaxOnline: string;
|
|
229
|
+
todayOnlineTotal: string;
|
|
230
|
+
callTime: number;
|
|
231
|
+
uv: number;
|
|
232
|
+
todayIPAccessCount: number;
|
|
233
|
+
}
|
|
234
|
+
declare class AggregateController implements IController {
|
|
90
235
|
private client;
|
|
236
|
+
base: string;
|
|
237
|
+
name: string;
|
|
238
|
+
constructor(client: HTTPClient);
|
|
239
|
+
private get proxy();
|
|
240
|
+
/**
|
|
241
|
+
* 获取聚合数据
|
|
242
|
+
*/
|
|
243
|
+
getAggregateData(): RequestProxyResult;
|
|
244
|
+
/**
|
|
245
|
+
* 获取最新发布的内容
|
|
246
|
+
*/
|
|
247
|
+
getTop(size?: number): RequestProxyResult;
|
|
248
|
+
getTimeline(options?: {
|
|
249
|
+
sort?: SortOrder;
|
|
250
|
+
type?: TimelineType;
|
|
251
|
+
year?: number;
|
|
252
|
+
}): RequestProxyResult;
|
|
253
|
+
/**
|
|
254
|
+
* 获取聚合数据统计
|
|
255
|
+
*/
|
|
256
|
+
getStat(): RequestProxyResult;
|
|
257
|
+
}
|
|
258
|
+
declare enum CategoryType {
|
|
259
|
+
Category = 0,
|
|
260
|
+
Tag = 1
|
|
261
|
+
}
|
|
262
|
+
export interface CategoryModel {
|
|
263
|
+
type: CategoryType;
|
|
264
|
+
count: number;
|
|
265
|
+
id: string;
|
|
266
|
+
created: string;
|
|
267
|
+
slug: string;
|
|
268
|
+
name: string;
|
|
269
|
+
modified: string;
|
|
270
|
+
}
|
|
271
|
+
export declare type CategoryWithChildrenModel = CategoryModel & {
|
|
272
|
+
children: Pick<PostModel, "id" | "title" | "slug" | "modified" | "created">[];
|
|
273
|
+
};
|
|
274
|
+
export interface TagModel {
|
|
275
|
+
count: number;
|
|
276
|
+
name: string;
|
|
277
|
+
}
|
|
278
|
+
declare class CategoryController implements IController {
|
|
279
|
+
private client;
|
|
280
|
+
name: string;
|
|
281
|
+
base: string;
|
|
282
|
+
constructor(client: HTTPClient);
|
|
283
|
+
private get proxy();
|
|
284
|
+
getAllCategories(): import("~/interfaces/request").RequestProxyResult<{
|
|
285
|
+
data: CategoryModel[];
|
|
286
|
+
}, {
|
|
287
|
+
[key: string]: any;
|
|
288
|
+
data: {
|
|
289
|
+
data: CategoryModel[];
|
|
290
|
+
};
|
|
291
|
+
}>;
|
|
292
|
+
getAllTags(): import("~/interfaces/request").RequestProxyResult<{
|
|
293
|
+
data: TagModel[];
|
|
294
|
+
}, {
|
|
295
|
+
[key: string]: any;
|
|
296
|
+
data: {
|
|
297
|
+
data: TagModel[];
|
|
298
|
+
};
|
|
299
|
+
}>;
|
|
300
|
+
getCategoryDetail(id: string): Promise<ResponseProxyExtraRaw<CategoryWithChildrenModel>>;
|
|
301
|
+
getCategoryDetail(ids: string[]): Promise<ResponseProxyExtraRaw<Map<string, CategoryWithChildrenModel>>>;
|
|
302
|
+
getCategoryByIdOrSlug(idOrSlug: string): Promise<ResponseProxyExtraRaw<CategoryWithChildrenModel, {
|
|
303
|
+
[key: string]: any;
|
|
304
|
+
data: CategoryWithChildrenModel;
|
|
305
|
+
}>>;
|
|
306
|
+
getTagByName(name: string): Promise<ResponseProxyExtraRaw<{
|
|
307
|
+
tag: string;
|
|
308
|
+
data: Pick<PostModel, "id" | "title" | "slug" | "category" | "created">[];
|
|
309
|
+
}, {
|
|
310
|
+
[key: string]: any;
|
|
311
|
+
data: {
|
|
312
|
+
tag: string;
|
|
313
|
+
data: Pick<PostModel, "id" | "title" | "slug" | "category" | "created">[];
|
|
314
|
+
};
|
|
315
|
+
}>>;
|
|
316
|
+
}
|
|
317
|
+
export interface PaginationParams {
|
|
318
|
+
size?: number;
|
|
319
|
+
page?: number;
|
|
320
|
+
}
|
|
321
|
+
export interface CommentModel {
|
|
322
|
+
refType: string;
|
|
323
|
+
state: number;
|
|
324
|
+
children: CommentModel[];
|
|
325
|
+
commentsIndex: number;
|
|
326
|
+
id: string;
|
|
327
|
+
author: string;
|
|
328
|
+
text: string;
|
|
329
|
+
mail: string;
|
|
330
|
+
url: string;
|
|
331
|
+
ip: string;
|
|
332
|
+
agent: string;
|
|
333
|
+
key: string;
|
|
334
|
+
pid: string;
|
|
335
|
+
created: string;
|
|
336
|
+
modified: string;
|
|
337
|
+
avatar: string;
|
|
338
|
+
}
|
|
339
|
+
declare class CommentDto {
|
|
340
|
+
author: string;
|
|
341
|
+
text: string;
|
|
342
|
+
mail: string;
|
|
343
|
+
url?: string;
|
|
344
|
+
}
|
|
345
|
+
declare class CommentController implements IController {
|
|
346
|
+
private readonly client;
|
|
347
|
+
base: string;
|
|
348
|
+
name: string;
|
|
349
|
+
constructor(client: HTTPClient);
|
|
350
|
+
get proxy(): IRequestHandler;
|
|
351
|
+
/**
|
|
352
|
+
* 根据 comment id 获取评论, 包括子评论
|
|
353
|
+
*/
|
|
354
|
+
getById(id: string): RequestProxyResult;
|
|
355
|
+
/**
|
|
356
|
+
* 获取文章的评论列表
|
|
357
|
+
* @param refId 文章 Id
|
|
358
|
+
*/
|
|
359
|
+
getByRefId(refId: string, pagination?: PaginationParams): RequestProxyResult;
|
|
360
|
+
/**
|
|
361
|
+
* 评论
|
|
362
|
+
*/
|
|
363
|
+
comment(refId: string, data: CommentDto): RequestProxyResult;
|
|
364
|
+
/**
|
|
365
|
+
* 回复评论
|
|
366
|
+
*/
|
|
367
|
+
reply(commentId: string, data: CommentDto): RequestProxyResult;
|
|
368
|
+
}
|
|
369
|
+
declare enum LinkType {
|
|
370
|
+
Friend = 0,
|
|
371
|
+
Collection = 1
|
|
372
|
+
}
|
|
373
|
+
declare enum LinkState {
|
|
374
|
+
Pass = 0,
|
|
375
|
+
Audit = 1
|
|
376
|
+
}
|
|
377
|
+
export interface LinkModel {
|
|
378
|
+
id: string;
|
|
379
|
+
name: string;
|
|
380
|
+
url: string;
|
|
381
|
+
avatar: string;
|
|
382
|
+
description?: string;
|
|
383
|
+
type: LinkType;
|
|
384
|
+
state: LinkState;
|
|
385
|
+
}
|
|
386
|
+
declare abstract class BaseCrudController<T> {
|
|
387
|
+
protected client: HTTPClient;
|
|
388
|
+
base: string;
|
|
389
|
+
constructor(client: HTTPClient);
|
|
390
|
+
protected get proxy(): IRequestHandler;
|
|
391
|
+
getById(id: string): RequestProxyResult;
|
|
392
|
+
getAll(): RequestProxyResult;
|
|
393
|
+
/**
|
|
394
|
+
* 带分页的查询
|
|
395
|
+
* @param page
|
|
396
|
+
* @param perPage
|
|
397
|
+
*/
|
|
398
|
+
getAllPaginated(page?: number, perPage?: number): RequestProxyResult;
|
|
399
|
+
}
|
|
400
|
+
declare class LinkController extends BaseCrudController<LinkModel> {
|
|
401
|
+
protected readonly client: HTTPClient;
|
|
402
|
+
constructor(client: HTTPClient);
|
|
403
|
+
name: string;
|
|
404
|
+
base: string;
|
|
405
|
+
}
|
|
406
|
+
declare class NoteController implements IController {
|
|
407
|
+
private client;
|
|
408
|
+
base: string;
|
|
409
|
+
name: string;
|
|
410
|
+
constructor(client: HTTPClient);
|
|
411
|
+
get proxy(): IRequestHandler;
|
|
412
|
+
/**
|
|
413
|
+
* 最新日记
|
|
414
|
+
*/
|
|
415
|
+
getLatest(): RequestProxyResult;
|
|
416
|
+
/**
|
|
417
|
+
* 获取一篇日记
|
|
418
|
+
* @param id id | nid
|
|
419
|
+
* @param password 访问密码
|
|
420
|
+
*/
|
|
421
|
+
getNoteById(id: string | number, password?: string): RequestProxyResult;
|
|
422
|
+
/**
|
|
423
|
+
* 日记列表分页
|
|
424
|
+
*/
|
|
425
|
+
getList(page?: number, perPage?: number): RequestProxyResult;
|
|
426
|
+
/**
|
|
427
|
+
* 获取当前日记的上下各 n / 2 篇日记
|
|
428
|
+
*/
|
|
429
|
+
getMiddleList(id: string, size?: number): RequestProxyResult;
|
|
430
|
+
/**
|
|
431
|
+
* 喜欢这篇日记
|
|
432
|
+
*/
|
|
433
|
+
likeIt(id: string): RequestProxyResult;
|
|
434
|
+
}
|
|
435
|
+
declare class PageController implements IController {
|
|
436
|
+
private readonly client;
|
|
91
437
|
constructor(client: HTTPClient);
|
|
92
438
|
base: string;
|
|
93
439
|
name: string;
|
|
94
|
-
|
|
440
|
+
get proxy(): IRequestHandler;
|
|
441
|
+
/**
|
|
442
|
+
* 页面列表
|
|
443
|
+
*/
|
|
444
|
+
getList(page?: number, perPage?: number): RequestProxyResult;
|
|
445
|
+
/**
|
|
446
|
+
* 页面详情
|
|
447
|
+
*/
|
|
448
|
+
getById(id: string): RequestProxyResult;
|
|
449
|
+
/**
|
|
450
|
+
* 根据路径获取页面
|
|
451
|
+
* @param slug 路径
|
|
452
|
+
* @returns
|
|
453
|
+
*/
|
|
454
|
+
getBySlug(slug: string): RequestProxyResult;
|
|
455
|
+
}
|
|
456
|
+
declare class PostController implements IController {
|
|
457
|
+
private client;
|
|
458
|
+
constructor(client: HTTPClient);
|
|
459
|
+
base: string;
|
|
460
|
+
name: string;
|
|
461
|
+
private get proxy();
|
|
462
|
+
/**
|
|
463
|
+
* 获取文章列表分页
|
|
464
|
+
* @param page
|
|
465
|
+
* @param perPage
|
|
466
|
+
* @returns
|
|
467
|
+
*/
|
|
468
|
+
getList(page?: number, perPage?: number): RequestProxyResult<PaginateResult<PostModel>, {
|
|
95
469
|
[key: string]: any;
|
|
96
|
-
data:
|
|
470
|
+
data: PaginateResult<PostModel>;
|
|
97
471
|
}>;
|
|
472
|
+
/**
|
|
473
|
+
* 根据分类和路径查找文章
|
|
474
|
+
* @param categoryName
|
|
475
|
+
* @param slug
|
|
476
|
+
*/
|
|
98
477
|
getPost(categoryName: string, slug: string): RequestProxyResult<PostModel>;
|
|
478
|
+
/**
|
|
479
|
+
* 根据 ID 查找文章
|
|
480
|
+
* @param id
|
|
481
|
+
*/
|
|
99
482
|
getPost(id: string): RequestProxyResult<PostModel>;
|
|
483
|
+
/**
|
|
484
|
+
* 获取最新的文章
|
|
485
|
+
*/
|
|
486
|
+
getLatest(): RequestProxyResult<PostModel, {
|
|
487
|
+
[key: string]: any;
|
|
488
|
+
data: PostModel;
|
|
489
|
+
}>;
|
|
490
|
+
/**
|
|
491
|
+
* 点赞
|
|
492
|
+
*/
|
|
493
|
+
thumbsUp(id: string): RequestProxyResult<void, {
|
|
494
|
+
[key: string]: any;
|
|
495
|
+
data: void;
|
|
496
|
+
}>;
|
|
497
|
+
}
|
|
498
|
+
export interface RecentlyModel {
|
|
499
|
+
content: string;
|
|
500
|
+
created: string;
|
|
501
|
+
id: string;
|
|
502
|
+
}
|
|
503
|
+
declare class RecentlyController implements IController {
|
|
504
|
+
private readonly client;
|
|
505
|
+
base: string;
|
|
506
|
+
name: string;
|
|
507
|
+
constructor(client: HTTPClient);
|
|
508
|
+
get proxy(): IRequestHandler;
|
|
509
|
+
/**
|
|
510
|
+
* 获取最新一条
|
|
511
|
+
*/
|
|
512
|
+
getLatestOne(): RequestProxyResult;
|
|
513
|
+
getAll(): RequestProxyResult;
|
|
514
|
+
getList(before?: string | undefined, after?: string | undefined, size?: number | number): RequestProxyResult;
|
|
100
515
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
516
|
+
declare class SayController extends BaseCrudController<SayModel> implements IController {
|
|
517
|
+
protected client: HTTPClient;
|
|
518
|
+
base: string;
|
|
519
|
+
name: string;
|
|
520
|
+
constructor(client: HTTPClient);
|
|
521
|
+
protected get proxy(): IRequestHandler;
|
|
522
|
+
/**
|
|
523
|
+
* 获取随机一条
|
|
524
|
+
*/
|
|
525
|
+
getRandom(): RequestProxyResult;
|
|
526
|
+
}
|
|
527
|
+
export declare type SearchOption = {
|
|
528
|
+
orderBy?: string;
|
|
529
|
+
order?: number;
|
|
530
|
+
rawAlgolia?: boolean;
|
|
531
|
+
};
|
|
532
|
+
declare class SearchController implements IController {
|
|
533
|
+
private readonly client;
|
|
534
|
+
base: string;
|
|
535
|
+
name: string;
|
|
536
|
+
constructor(client: HTTPClient);
|
|
537
|
+
get proxy(): import("~/interfaces/request").IRequestHandler;
|
|
538
|
+
search(type: "note", keyword: string, options?: Omit<SearchOption, "rawAlgolia">): Promise<RequestProxyResult<PaginateResult<Pick<NoteModel, "modified" | "id" | "title" | "created" | "nid">>>>;
|
|
539
|
+
search(type: "post", keyword: string, options?: Omit<SearchOption, "rawAlgolia">): Promise<RequestProxyResult<PaginateResult<Pick<PostModel, "modified" | "id" | "title" | "created" | "slug" | "category">>>>;
|
|
540
|
+
/**
|
|
541
|
+
* 从 algolya 搜索
|
|
542
|
+
* https://www.algolia.com/doc/api-reference/api-methods/search/
|
|
543
|
+
* @param keyword
|
|
544
|
+
* @param options
|
|
545
|
+
* @returns
|
|
546
|
+
*/
|
|
547
|
+
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<Pick<PostModel, "created" | "id" | "modified" | "title" | "slug" | "category">> & {
|
|
548
|
+
/**
|
|
549
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
550
|
+
*/
|
|
551
|
+
raw?: any;
|
|
552
|
+
}, {
|
|
553
|
+
[key: string]: any;
|
|
554
|
+
data: PaginateResult<Pick<PostModel, "created" | "id" | "modified" | "title" | "slug" | "category">> & {
|
|
555
|
+
/**
|
|
556
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
557
|
+
*/
|
|
558
|
+
raw?: any;
|
|
559
|
+
};
|
|
560
|
+
}>, {
|
|
561
|
+
[key: string]: any;
|
|
562
|
+
data: RequestProxyResult<PaginateResult<Pick<PostModel, "created" | "id" | "modified" | "title" | "slug" | "category">> & {
|
|
563
|
+
/**
|
|
564
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
565
|
+
*/
|
|
566
|
+
raw?: any;
|
|
567
|
+
}, {
|
|
568
|
+
[key: string]: any;
|
|
569
|
+
data: PaginateResult<Pick<PostModel, "created" | "id" | "modified" | "title" | "slug" | "category">> & {
|
|
570
|
+
/**
|
|
571
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
572
|
+
*/
|
|
573
|
+
raw?: any;
|
|
574
|
+
};
|
|
575
|
+
}>;
|
|
576
|
+
}>;
|
|
577
|
+
}
|
|
578
|
+
declare class UserController implements IController {
|
|
579
|
+
private readonly client;
|
|
580
|
+
constructor(client: HTTPClient);
|
|
581
|
+
base: string;
|
|
582
|
+
name: string;
|
|
583
|
+
protected get proxy(): IRequestHandler;
|
|
584
|
+
getMasterInfo(): RequestProxyResult;
|
|
585
|
+
login(username: string, password: string): RequestProxyResult;
|
|
586
|
+
checkTokenValid(token: string): RequestProxyResult;
|
|
587
|
+
}
|
|
588
|
+
declare const allControllers: (typeof AggregateController | typeof CategoryController | typeof CommentController | typeof LinkController | typeof NoteController | typeof PageController | typeof PostController | typeof RecentlyController | typeof SayController | typeof SearchController | typeof UserController)[];
|
|
589
|
+
declare const allContollerNames: string[];
|
|
590
|
+
declare class HTTPControllerDefine {
|
|
591
|
+
aggregate: AggregateController;
|
|
592
|
+
category: CategoryController;
|
|
593
|
+
comment: CommentController;
|
|
594
|
+
link: LinkController;
|
|
595
|
+
note: NoteController;
|
|
596
|
+
page: PageController;
|
|
597
|
+
post: PostController;
|
|
598
|
+
recently: RecentlyController;
|
|
599
|
+
say: SayController;
|
|
600
|
+
search: SearchController;
|
|
601
|
+
user: UserController;
|
|
602
|
+
get master(): UserController;
|
|
603
|
+
get friend(): LinkController;
|
|
604
|
+
get shorthand(): RecentlyController;
|
|
605
|
+
}
|
|
606
|
+
export declare class HTTPClient extends HTTPControllerDefine {
|
|
104
607
|
private _endpoint;
|
|
105
608
|
private _instance;
|
|
106
609
|
private _proxy;
|
|
107
|
-
post: PostClient;
|
|
108
|
-
note: NoteClient;
|
|
109
610
|
constructor(_endpoint: string, _instance: IRequestAdapter);
|
|
110
611
|
private initGetClient;
|
|
111
|
-
|
|
112
|
-
new (client: HTTPClient):
|
|
113
|
-
}>(...
|
|
114
|
-
|
|
115
|
-
new (client: HTTPClient):
|
|
116
|
-
}>(
|
|
612
|
+
injectControllers<T extends {
|
|
613
|
+
new (client: HTTPClient): IController;
|
|
614
|
+
}>(...Controller: T[]): void;
|
|
615
|
+
injectControllers<T extends {
|
|
616
|
+
new (client: HTTPClient): IController;
|
|
617
|
+
}>(Controller: T[]): void;
|
|
117
618
|
get endpoint(): string;
|
|
118
619
|
get instance(): IRequestAdapter;
|
|
119
620
|
request(options: {
|
|
@@ -122,8 +623,8 @@ export declare class HTTPClient {
|
|
|
122
623
|
data?: any;
|
|
123
624
|
params?: any;
|
|
124
625
|
}): any;
|
|
125
|
-
get proxy(): IRequestHandler
|
|
126
|
-
resolveFullPath
|
|
626
|
+
get proxy(): IRequestHandler;
|
|
627
|
+
private resolveFullPath;
|
|
127
628
|
private buildRoute;
|
|
128
629
|
}
|
|
129
630
|
export declare function createClient<T extends IRequestAdapter>(adapter: T): (endpoint: string) => HTTPClient;
|
|
@@ -134,4 +635,11 @@ export declare class RequestError extends Error {
|
|
|
134
635
|
constructor(message: string, status: number, path: string, raw: any);
|
|
135
636
|
}
|
|
136
637
|
|
|
638
|
+
export {
|
|
639
|
+
NoteController as NoteClient,
|
|
640
|
+
PostController as PostClient,
|
|
641
|
+
allContollerNames as allClientName,
|
|
642
|
+
allControllers as allClients,
|
|
643
|
+
};
|
|
644
|
+
|
|
137
645
|
export {};
|