@mx-space/api-client 0.0.5 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.cjs.js +411 -53
- 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 +463 -108
- package/build/index.esm.js +411 -53
- 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 +411 -53
- 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 +4 -0
- package/esm/core/attachRequest.js.map +1 -1
- package/esm/core/client.d.ts +2 -9
- package/esm/core/client.js +16 -2
- 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 +13 -2
- package/esm/core/controllers/all.js +38 -9
- package/esm/core/controllers/all.js.map +1 -1
- 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/index.d.ts +0 -2
- package/esm/core/controllers/index.js +0 -3
- package/esm/core/controllers/index.js.map +1 -1
- 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/project.d.ts +9 -0
- package/esm/core/controllers/project.js +10 -0
- package/esm/core/controllers/project.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/snippet.d.ts +18 -0
- package/esm/core/controllers/snippet.js +17 -0
- package/esm/core/controllers/snippet.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 +19 -0
- package/esm/core/define.js +12 -0
- package/esm/core/define.js.map +1 -0
- 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/request.d.ts +9 -3
- 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/category.d.ts +24 -0
- package/esm/models/category.js +6 -0
- package/esm/models/category.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/project.d.ts +16 -0
- package/esm/models/project.js +2 -0
- package/esm/models/project.js.map +1 -0
- 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/snippet.d.ts +14 -0
- package/esm/models/snippet.js +7 -0
- package/esm/models/snippet.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 +4 -0
- package/lib/core/attachRequest.js.map +1 -1
- package/lib/core/client.d.ts +2 -9
- package/lib/core/client.js +16 -2
- 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 +13 -2
- package/lib/core/controllers/all.js +52 -11
- package/lib/core/controllers/all.js.map +1 -1
- 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/index.d.ts +0 -2
- package/lib/core/controllers/index.js +0 -3
- package/lib/core/controllers/index.js.map +1 -1
- 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/project.d.ts +9 -0
- package/lib/core/controllers/project.js +14 -0
- package/lib/core/controllers/project.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/snippet.d.ts +18 -0
- package/lib/core/controllers/snippet.js +21 -0
- package/lib/core/controllers/snippet.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 +19 -0
- package/lib/core/define.js +16 -0
- package/lib/core/define.js.map +1 -0
- 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/request.d.ts +9 -3
- 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/category.d.ts +24 -0
- package/lib/models/category.js +9 -0
- package/lib/models/category.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/project.d.ts +16 -0
- package/lib/models/project.js +3 -0
- package/lib/models/project.js.map +1 -0
- 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/snippet.d.ts +14 -0
- package/lib/models/snippet.js +10 -0
- package/lib/models/snippet.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 +11 -11
package/build/index.d.ts
CHANGED
|
@@ -33,32 +33,16 @@ export interface IRequestHandler {
|
|
|
33
33
|
export declare type RequestProxyResult<T, R = {
|
|
34
34
|
data: T;
|
|
35
35
|
[key: string]: any;
|
|
36
|
-
}> = Promise<T
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
type: string;
|
|
47
|
-
accent?: string;
|
|
48
|
-
src: string;
|
|
49
|
-
}
|
|
50
|
-
export interface Pager {
|
|
51
|
-
total: number;
|
|
52
|
-
size: number;
|
|
53
|
-
currentPage: number;
|
|
54
|
-
totalPage: number;
|
|
55
|
-
hasPrevPage: boolean;
|
|
56
|
-
hasNextPage: boolean;
|
|
57
|
-
}
|
|
58
|
-
export interface PaginateResult<T> {
|
|
59
|
-
data: T[];
|
|
60
|
-
pagination: Pager;
|
|
61
|
-
}
|
|
36
|
+
}> = Promise<ResponseProxyExtraRaw<T, R>>;
|
|
37
|
+
export declare type ResponseProxyExtraRaw<T, R = any> = T & {
|
|
38
|
+
$raw: R;
|
|
39
|
+
$request: {
|
|
40
|
+
path: string;
|
|
41
|
+
method: string;
|
|
42
|
+
[k: string]: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export declare type SortOrder = "asc" | "desc";
|
|
62
46
|
export interface NoteModel {
|
|
63
47
|
id: string;
|
|
64
48
|
hide: boolean;
|
|
@@ -93,34 +77,56 @@ export interface NoteWrappedPayload {
|
|
|
93
77
|
next?: Partial<NoteModel>;
|
|
94
78
|
prev?: Partial<NoteModel>;
|
|
95
79
|
}
|
|
96
|
-
declare
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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;
|
|
103
|
+
}
|
|
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;
|
|
124
130
|
}
|
|
125
131
|
export interface PostModel {
|
|
126
132
|
commentsIndex: number;
|
|
@@ -148,47 +154,169 @@ export interface CategoryModel {
|
|
|
148
154
|
created: Date;
|
|
149
155
|
categoryId: string;
|
|
150
156
|
}
|
|
151
|
-
|
|
157
|
+
export interface SayModel {
|
|
158
|
+
id?: string;
|
|
159
|
+
text: string;
|
|
160
|
+
source?: string;
|
|
161
|
+
author?: string;
|
|
162
|
+
}
|
|
163
|
+
declare class SeoOptionModel {
|
|
164
|
+
title: string;
|
|
165
|
+
description: string;
|
|
166
|
+
icon?: string;
|
|
167
|
+
keywords?: string[];
|
|
168
|
+
}
|
|
169
|
+
export interface UserModel {
|
|
170
|
+
ok: number;
|
|
171
|
+
id: string;
|
|
172
|
+
introduce: string;
|
|
173
|
+
mail: string;
|
|
174
|
+
url: string;
|
|
175
|
+
name: string;
|
|
176
|
+
socialIDS: SocialIDS & Record<string, string>;
|
|
177
|
+
username: string;
|
|
178
|
+
created: Date;
|
|
179
|
+
modified: Date;
|
|
180
|
+
v: number;
|
|
181
|
+
lastLoginTime: string;
|
|
182
|
+
lastLoginIp?: string;
|
|
183
|
+
avatar: string;
|
|
184
|
+
postID: string;
|
|
185
|
+
}
|
|
186
|
+
export interface SocialIDS {
|
|
187
|
+
biliID: number;
|
|
188
|
+
neteaseID: number;
|
|
189
|
+
github: string;
|
|
190
|
+
}
|
|
191
|
+
export declare type TLogin = {
|
|
192
|
+
token: string;
|
|
193
|
+
expiresIn: number;
|
|
194
|
+
lastLoginTime: null | string;
|
|
195
|
+
lastLoginIp?: null | string;
|
|
196
|
+
} & Pick<UserModel, "name" | "username" | "created" | "url" | "mail" | "avatar" | "id">;
|
|
197
|
+
export interface AggregateRoot {
|
|
198
|
+
user: UserModel;
|
|
199
|
+
seo: SeoOptionModel;
|
|
200
|
+
categories: CategoryModel[];
|
|
201
|
+
pageMeta: Pick<PageModel, "title" | "id" | "slug" | "order">[] | null;
|
|
202
|
+
lastestNoteNid: number | null;
|
|
203
|
+
}
|
|
204
|
+
export interface AggregateTop {
|
|
205
|
+
notes: Pick<NoteModel, "id" | "title" | "created" | "nid">[];
|
|
206
|
+
posts: Pick<PostModel, "id" | "slug" | "created" | "title" | "category">[];
|
|
207
|
+
says: SayModel[];
|
|
208
|
+
}
|
|
209
|
+
declare enum TimelineType {
|
|
210
|
+
Post = 0,
|
|
211
|
+
Note = 1
|
|
212
|
+
}
|
|
213
|
+
export interface TimelineData {
|
|
214
|
+
notes?: Pick<NoteModel, "id" | "nid" | "title" | "weather" | "mood" | "created" | "modified" | "hasMemory">[];
|
|
215
|
+
posts?: (Pick<PostModel, "id" | "title" | "slug" | "created" | "modified" | "category"> & {
|
|
216
|
+
url: string;
|
|
217
|
+
})[];
|
|
218
|
+
}
|
|
219
|
+
export interface AggregateStat {
|
|
220
|
+
allComments: number;
|
|
221
|
+
categories: number;
|
|
222
|
+
comments: number;
|
|
223
|
+
linkApply: number;
|
|
224
|
+
links: number;
|
|
225
|
+
notes: number;
|
|
226
|
+
pages: number;
|
|
227
|
+
posts: number;
|
|
228
|
+
says: number;
|
|
229
|
+
recently: number;
|
|
230
|
+
unreadComments: number;
|
|
231
|
+
online: number;
|
|
232
|
+
todayMaxOnline: string;
|
|
233
|
+
todayOnlineTotal: string;
|
|
234
|
+
callTime: number;
|
|
235
|
+
uv: number;
|
|
236
|
+
todayIPAccessCount: number;
|
|
237
|
+
}
|
|
238
|
+
declare class AggregateController implements IController {
|
|
152
239
|
private client;
|
|
153
|
-
constructor(client: HTTPClient);
|
|
154
240
|
base: string;
|
|
155
241
|
name: string;
|
|
242
|
+
constructor(client: HTTPClient);
|
|
156
243
|
private get proxy();
|
|
157
244
|
/**
|
|
158
|
-
*
|
|
159
|
-
* @param page
|
|
160
|
-
* @param perPage
|
|
161
|
-
* @returns
|
|
162
|
-
*/
|
|
163
|
-
getList(page?: number, perPage?: number): RequestProxyResult<PaginateResult<PostModel>, {
|
|
164
|
-
[key: string]: any;
|
|
165
|
-
data: PaginateResult<PostModel>;
|
|
166
|
-
}>;
|
|
167
|
-
/**
|
|
168
|
-
* 根据分类和路径查找文章
|
|
169
|
-
* @param categoryName
|
|
170
|
-
* @param slug
|
|
245
|
+
* 获取聚合数据
|
|
171
246
|
*/
|
|
172
|
-
|
|
247
|
+
getAggregateData(): RequestProxyResult;
|
|
173
248
|
/**
|
|
174
|
-
*
|
|
175
|
-
* @param id
|
|
249
|
+
* 获取最新发布的内容
|
|
176
250
|
*/
|
|
177
|
-
|
|
251
|
+
getTop(size?: number): RequestProxyResult;
|
|
252
|
+
getTimeline(options?: {
|
|
253
|
+
sort?: SortOrder;
|
|
254
|
+
type?: TimelineType;
|
|
255
|
+
year?: number;
|
|
256
|
+
}): RequestProxyResult;
|
|
178
257
|
/**
|
|
179
|
-
*
|
|
258
|
+
* 获取聚合数据统计
|
|
180
259
|
*/
|
|
181
|
-
|
|
260
|
+
getStat(): RequestProxyResult;
|
|
261
|
+
}
|
|
262
|
+
declare enum CategoryType {
|
|
263
|
+
Category = 0,
|
|
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;
|
|
281
|
+
}
|
|
282
|
+
declare class CategoryController implements IController {
|
|
283
|
+
private client;
|
|
284
|
+
name: string;
|
|
285
|
+
base: string;
|
|
286
|
+
constructor(client: HTTPClient);
|
|
287
|
+
private get proxy();
|
|
288
|
+
getAllCategories(): import("~/interfaces/request").RequestProxyResult<{
|
|
289
|
+
data: CategoryModel[];
|
|
290
|
+
}, {
|
|
182
291
|
[key: string]: any;
|
|
183
|
-
data:
|
|
292
|
+
data: {
|
|
293
|
+
data: CategoryModel[];
|
|
294
|
+
};
|
|
184
295
|
}>;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
thumbsUp(id: string): RequestProxyResult<void, {
|
|
296
|
+
getAllTags(): import("~/interfaces/request").RequestProxyResult<{
|
|
297
|
+
data: TagModel[];
|
|
298
|
+
}, {
|
|
189
299
|
[key: string]: any;
|
|
190
|
-
data:
|
|
300
|
+
data: {
|
|
301
|
+
data: TagModel[];
|
|
302
|
+
};
|
|
191
303
|
}>;
|
|
304
|
+
getCategoryDetail(id: string): Promise<ResponseProxyExtraRaw<CategoryWithChildrenModel>>;
|
|
305
|
+
getCategoryDetail(ids: string[]): Promise<ResponseProxyExtraRaw<Map<string, CategoryWithChildrenModel>>>;
|
|
306
|
+
getCategoryByIdOrSlug(idOrSlug: string): Promise<ResponseProxyExtraRaw<CategoryWithChildrenModel, {
|
|
307
|
+
[key: string]: any;
|
|
308
|
+
data: CategoryWithChildrenModel;
|
|
309
|
+
}>>;
|
|
310
|
+
getTagByName(name: string): Promise<ResponseProxyExtraRaw<{
|
|
311
|
+
tag: string;
|
|
312
|
+
data: Pick<PostModel, "id" | "title" | "slug" | "category" | "created">[];
|
|
313
|
+
}, {
|
|
314
|
+
[key: string]: any;
|
|
315
|
+
data: {
|
|
316
|
+
tag: string;
|
|
317
|
+
data: Pick<PostModel, "id" | "title" | "slug" | "category" | "created">[];
|
|
318
|
+
};
|
|
319
|
+
}>>;
|
|
192
320
|
}
|
|
193
321
|
export interface PaginationParams {
|
|
194
322
|
size?: number;
|
|
@@ -242,29 +370,71 @@ declare class CommentController implements IController {
|
|
|
242
370
|
*/
|
|
243
371
|
reply(commentId: string, data: CommentDto): RequestProxyResult;
|
|
244
372
|
}
|
|
245
|
-
declare enum
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
"frame" = "frame"
|
|
373
|
+
declare enum LinkType {
|
|
374
|
+
Friend = 0,
|
|
375
|
+
Collection = 1
|
|
249
376
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
377
|
+
declare enum LinkState {
|
|
378
|
+
Pass = 0,
|
|
379
|
+
Audit = 1
|
|
380
|
+
}
|
|
381
|
+
export interface LinkModel {
|
|
253
382
|
id: string;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
383
|
+
name: string;
|
|
384
|
+
url: string;
|
|
385
|
+
avatar: string;
|
|
386
|
+
description?: string;
|
|
387
|
+
type: LinkType;
|
|
388
|
+
state: LinkState;
|
|
389
|
+
}
|
|
390
|
+
declare abstract class BaseCrudController<T> {
|
|
391
|
+
protected client: HTTPClient;
|
|
392
|
+
base: string;
|
|
393
|
+
constructor(client: HTTPClient);
|
|
394
|
+
protected get proxy(): IRequestHandler;
|
|
395
|
+
getById(id: string): RequestProxyResult;
|
|
396
|
+
getAll(): RequestProxyResult;
|
|
397
|
+
/**
|
|
398
|
+
* 带分页的查询
|
|
399
|
+
* @param page
|
|
400
|
+
* @param perPage
|
|
401
|
+
*/
|
|
402
|
+
getAllPaginated(page?: number, perPage?: number): RequestProxyResult;
|
|
403
|
+
}
|
|
404
|
+
declare class LinkController extends BaseCrudController<LinkModel> {
|
|
405
|
+
protected readonly client: HTTPClient;
|
|
406
|
+
constructor(client: HTTPClient);
|
|
407
|
+
name: string;
|
|
408
|
+
base: string;
|
|
409
|
+
}
|
|
410
|
+
declare class NoteController implements IController {
|
|
411
|
+
private client;
|
|
412
|
+
base: string;
|
|
413
|
+
name: string;
|
|
414
|
+
constructor(client: HTTPClient);
|
|
415
|
+
get proxy(): IRequestHandler;
|
|
416
|
+
/**
|
|
417
|
+
* 最新日记
|
|
418
|
+
*/
|
|
419
|
+
getLatest(): RequestProxyResult;
|
|
420
|
+
/**
|
|
421
|
+
* 获取一篇日记
|
|
422
|
+
* @param id id | nid
|
|
423
|
+
* @param password 访问密码
|
|
424
|
+
*/
|
|
425
|
+
getNoteById(id: string | number, password?: string): RequestProxyResult;
|
|
426
|
+
/**
|
|
427
|
+
* 日记列表分页
|
|
428
|
+
*/
|
|
429
|
+
getList(page?: number, perPage?: number): RequestProxyResult;
|
|
430
|
+
/**
|
|
431
|
+
* 获取当前日记的上下各 n / 2 篇日记
|
|
432
|
+
*/
|
|
433
|
+
getMiddleList(id: string, size?: number): RequestProxyResult;
|
|
434
|
+
/**
|
|
435
|
+
* 喜欢这篇日记
|
|
436
|
+
*/
|
|
437
|
+
likeIt(id: string): RequestProxyResult;
|
|
268
438
|
}
|
|
269
439
|
declare class PageController implements IController {
|
|
270
440
|
private readonly client;
|
|
@@ -287,16 +457,201 @@ declare class PageController implements IController {
|
|
|
287
457
|
*/
|
|
288
458
|
getBySlug(slug: string): RequestProxyResult;
|
|
289
459
|
}
|
|
290
|
-
declare
|
|
460
|
+
declare class PostController implements IController {
|
|
461
|
+
private client;
|
|
462
|
+
constructor(client: HTTPClient);
|
|
463
|
+
base: string;
|
|
464
|
+
name: string;
|
|
465
|
+
private get proxy();
|
|
466
|
+
/**
|
|
467
|
+
* 获取文章列表分页
|
|
468
|
+
* @param page
|
|
469
|
+
* @param perPage
|
|
470
|
+
* @returns
|
|
471
|
+
*/
|
|
472
|
+
getList(page?: number, perPage?: number): RequestProxyResult<PaginateResult<PostModel>, {
|
|
473
|
+
[key: string]: any;
|
|
474
|
+
data: PaginateResult<PostModel>;
|
|
475
|
+
}>;
|
|
476
|
+
/**
|
|
477
|
+
* 根据分类和路径查找文章
|
|
478
|
+
* @param categoryName
|
|
479
|
+
* @param slug
|
|
480
|
+
*/
|
|
481
|
+
getPost(categoryName: string, slug: string): RequestProxyResult<PostModel>;
|
|
482
|
+
/**
|
|
483
|
+
* 根据 ID 查找文章
|
|
484
|
+
* @param id
|
|
485
|
+
*/
|
|
486
|
+
getPost(id: string): RequestProxyResult<PostModel>;
|
|
487
|
+
/**
|
|
488
|
+
* 获取最新的文章
|
|
489
|
+
*/
|
|
490
|
+
getLatest(): RequestProxyResult<PostModel, {
|
|
491
|
+
[key: string]: any;
|
|
492
|
+
data: PostModel;
|
|
493
|
+
}>;
|
|
494
|
+
/**
|
|
495
|
+
* 点赞
|
|
496
|
+
*/
|
|
497
|
+
thumbsUp(id: string): RequestProxyResult<void, {
|
|
498
|
+
[key: string]: any;
|
|
499
|
+
data: void;
|
|
500
|
+
}>;
|
|
501
|
+
}
|
|
502
|
+
export interface ProjectModel {
|
|
503
|
+
id?: string;
|
|
504
|
+
name: string;
|
|
505
|
+
previewUrl?: string;
|
|
506
|
+
docUrl?: string;
|
|
507
|
+
projectUrl?: string;
|
|
508
|
+
images?: string[];
|
|
509
|
+
description: string;
|
|
510
|
+
avatar?: string;
|
|
511
|
+
text: string;
|
|
512
|
+
}
|
|
513
|
+
declare class ProjectController extends BaseCrudController<ProjectModel> {
|
|
514
|
+
protected readonly client: HTTPClient;
|
|
515
|
+
constructor(client: HTTPClient);
|
|
516
|
+
base: string;
|
|
517
|
+
name: string;
|
|
518
|
+
}
|
|
519
|
+
export interface RecentlyModel {
|
|
520
|
+
content: string;
|
|
521
|
+
created: string;
|
|
522
|
+
id: string;
|
|
523
|
+
}
|
|
524
|
+
declare class RecentlyController implements IController {
|
|
525
|
+
private readonly client;
|
|
526
|
+
base: string;
|
|
527
|
+
name: string;
|
|
528
|
+
constructor(client: HTTPClient);
|
|
529
|
+
get proxy(): IRequestHandler;
|
|
530
|
+
/**
|
|
531
|
+
* 获取最新一条
|
|
532
|
+
*/
|
|
533
|
+
getLatestOne(): RequestProxyResult;
|
|
534
|
+
getAll(): RequestProxyResult;
|
|
535
|
+
getList(before?: string | undefined, after?: string | undefined, size?: number | number): RequestProxyResult;
|
|
536
|
+
}
|
|
537
|
+
declare class SayController extends BaseCrudController<SayModel> implements IController {
|
|
538
|
+
protected client: HTTPClient;
|
|
539
|
+
base: string;
|
|
540
|
+
name: string;
|
|
541
|
+
constructor(client: HTTPClient);
|
|
542
|
+
protected get proxy(): IRequestHandler;
|
|
543
|
+
/**
|
|
544
|
+
* 获取随机一条
|
|
545
|
+
*/
|
|
546
|
+
getRandom(): RequestProxyResult;
|
|
547
|
+
}
|
|
548
|
+
export declare type SearchOption = {
|
|
549
|
+
orderBy?: string;
|
|
550
|
+
order?: number;
|
|
551
|
+
rawAlgolia?: boolean;
|
|
552
|
+
};
|
|
553
|
+
declare class SearchController implements IController {
|
|
554
|
+
private readonly client;
|
|
555
|
+
base: string;
|
|
556
|
+
name: string;
|
|
557
|
+
constructor(client: HTTPClient);
|
|
558
|
+
get proxy(): import("~/interfaces/request").IRequestHandler;
|
|
559
|
+
search(type: "note", keyword: string, options?: Omit<SearchOption, "rawAlgolia">): Promise<RequestProxyResult<PaginateResult<Pick<NoteModel, "modified" | "id" | "title" | "created" | "nid">>>>;
|
|
560
|
+
search(type: "post", keyword: string, options?: Omit<SearchOption, "rawAlgolia">): Promise<RequestProxyResult<PaginateResult<Pick<PostModel, "modified" | "id" | "title" | "created" | "slug" | "category">>>>;
|
|
561
|
+
/**
|
|
562
|
+
* 从 algolya 搜索
|
|
563
|
+
* https://www.algolia.com/doc/api-reference/api-methods/search/
|
|
564
|
+
* @param keyword
|
|
565
|
+
* @param options
|
|
566
|
+
* @returns
|
|
567
|
+
*/
|
|
568
|
+
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<Pick<PostModel, "created" | "id" | "modified" | "title" | "slug" | "category">> & {
|
|
569
|
+
/**
|
|
570
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
571
|
+
*/
|
|
572
|
+
raw?: any;
|
|
573
|
+
}, {
|
|
574
|
+
[key: string]: any;
|
|
575
|
+
data: PaginateResult<Pick<PostModel, "created" | "id" | "modified" | "title" | "slug" | "category">> & {
|
|
576
|
+
/**
|
|
577
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
578
|
+
*/
|
|
579
|
+
raw?: any;
|
|
580
|
+
};
|
|
581
|
+
}>, {
|
|
582
|
+
[key: string]: any;
|
|
583
|
+
data: RequestProxyResult<PaginateResult<Pick<PostModel, "created" | "id" | "modified" | "title" | "slug" | "category">> & {
|
|
584
|
+
/**
|
|
585
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
586
|
+
*/
|
|
587
|
+
raw?: any;
|
|
588
|
+
}, {
|
|
589
|
+
[key: string]: any;
|
|
590
|
+
data: PaginateResult<Pick<PostModel, "created" | "id" | "modified" | "title" | "slug" | "category">> & {
|
|
591
|
+
/**
|
|
592
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
593
|
+
*/
|
|
594
|
+
raw?: any;
|
|
595
|
+
};
|
|
596
|
+
}>;
|
|
597
|
+
}>;
|
|
598
|
+
}
|
|
599
|
+
declare enum SnippetType {
|
|
600
|
+
JSON = "json",
|
|
601
|
+
Text = "text"
|
|
602
|
+
}
|
|
603
|
+
export interface SnippetModel extends BaseModel {
|
|
604
|
+
type: SnippetType;
|
|
605
|
+
private: boolean;
|
|
606
|
+
raw: string;
|
|
607
|
+
name: string;
|
|
608
|
+
reference: string;
|
|
609
|
+
comment?: string;
|
|
610
|
+
metatype?: string;
|
|
611
|
+
}
|
|
612
|
+
declare class SnippetController implements IController {
|
|
613
|
+
protected client: HTTPClient;
|
|
614
|
+
base: string;
|
|
615
|
+
name: string;
|
|
616
|
+
constructor(client: HTTPClient);
|
|
617
|
+
get proxy(): IRequestHandler;
|
|
618
|
+
getById(id: string): RequestProxyResult;
|
|
619
|
+
getByReferenceAndName(reference: string, name: string): RequestProxyResult;
|
|
620
|
+
}
|
|
621
|
+
declare class UserController implements IController {
|
|
622
|
+
private readonly client;
|
|
623
|
+
constructor(client: HTTPClient);
|
|
624
|
+
base: string;
|
|
625
|
+
name: string;
|
|
626
|
+
protected get proxy(): IRequestHandler;
|
|
627
|
+
getMasterInfo(): RequestProxyResult;
|
|
628
|
+
login(username: string, password: string): RequestProxyResult;
|
|
629
|
+
checkTokenValid(token: string): RequestProxyResult;
|
|
630
|
+
}
|
|
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)[];
|
|
291
632
|
declare const allContollerNames: string[];
|
|
292
|
-
|
|
633
|
+
declare class HTTPControllerDefine {
|
|
634
|
+
aggregate: AggregateController;
|
|
635
|
+
category: CategoryController;
|
|
636
|
+
comment: CommentController;
|
|
637
|
+
link: LinkController;
|
|
638
|
+
note: NoteController;
|
|
639
|
+
page: PageController;
|
|
640
|
+
post: PostController;
|
|
641
|
+
project: ProjectController;
|
|
642
|
+
recently: RecentlyController;
|
|
643
|
+
say: SayController;
|
|
644
|
+
search: SearchController;
|
|
645
|
+
snippet: SnippetController;
|
|
646
|
+
user: UserController;
|
|
647
|
+
get master(): UserController;
|
|
648
|
+
get friend(): LinkController;
|
|
649
|
+
get shorthand(): RecentlyController;
|
|
650
|
+
}
|
|
651
|
+
export declare class HTTPClient extends HTTPControllerDefine {
|
|
293
652
|
private _endpoint;
|
|
294
653
|
private _instance;
|
|
295
654
|
private _proxy;
|
|
296
|
-
post: PostController;
|
|
297
|
-
note: NoteController;
|
|
298
|
-
page: PageController;
|
|
299
|
-
comment: CommentController;
|
|
300
655
|
constructor(_endpoint: string, _instance: IRequestAdapter);
|
|
301
656
|
private initGetClient;
|
|
302
657
|
injectControllers<T extends {
|