@mx-space/api-client 1.3.2 → 1.3.4
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/.eslintcache +1 -1
- package/controllers/subscribe.ts +1 -1
- package/dist/adaptors/axios.cjs +4 -0
- package/dist/adaptors/axios.global.js +188 -85
- package/dist/adaptors/ky.cjs +4 -0
- package/dist/adaptors/ky.global.js +11 -1
- package/dist/adaptors/umi-request.global.js +137 -44
- package/dist/index.cjs +90 -1
- package/dist/index.global.js +90 -1
- package/dist/index.js +90 -1
- package/package.json +3 -11
- package/coverage/clover.xml +0 -591
- package/coverage/coverage-final.json +0 -5944
- package/coverage/lcov-report/adaptors/axios.ts.html +0 -201
- package/coverage/lcov-report/adaptors/index.html +0 -196
- package/coverage/lcov-report/adaptors/umi-request.ts.html +0 -186
- package/coverage/lcov-report/auto-bind.ts.html +0 -228
- package/coverage/lcov-report/base.css +0 -354
- package/coverage/lcov-report/block-navigation.js +0 -85
- package/coverage/lcov-report/controllers/aggregate.ts.html +0 -294
- package/coverage/lcov-report/controllers/base.ts.html +0 -183
- package/coverage/lcov-report/controllers/category.ts.html +0 -441
- package/coverage/lcov-report/controllers/comment.ts.html +0 -291
- package/coverage/lcov-report/controllers/index.html +0 -476
- package/coverage/lcov-report/controllers/index.ts.html +0 -297
- package/coverage/lcov-report/controllers/link.ts.html +0 -216
- package/coverage/lcov-report/controllers/note.ts.html +0 -375
- package/coverage/lcov-report/controllers/page.ts.html +0 -279
- package/coverage/lcov-report/controllers/post.ts.html +0 -369
- package/coverage/lcov-report/controllers/project.ts.html +0 -168
- package/coverage/lcov-report/controllers/recently.ts.html +0 -246
- package/coverage/lcov-report/controllers/say.ts.html +0 -207
- package/coverage/lcov-report/controllers/search.ts.html +0 -411
- package/coverage/lcov-report/controllers/severless.ts.html +0 -180
- package/coverage/lcov-report/controllers/snippet.ts.html +0 -195
- package/coverage/lcov-report/controllers/user.ts.html +0 -240
- package/coverage/lcov-report/core/attach-request.ts.html +0 -216
- package/coverage/lcov-report/core/client.ts.html +0 -786
- package/coverage/lcov-report/core/error.ts.html +0 -117
- package/coverage/lcov-report/core/index.html +0 -236
- package/coverage/lcov-report/core/index.ts.html +0 -93
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -276
- package/coverage/lcov-report/index.ts.html +0 -243
- package/coverage/lcov-report/models/aggregate.ts.html +0 -300
- package/coverage/lcov-report/models/category.ts.html +0 -162
- package/coverage/lcov-report/models/index.html +0 -196
- package/coverage/lcov-report/prettify.css +0 -101
- package/coverage/lcov-report/prettify.js +0 -1004
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -191
- package/coverage/lcov-report/utils/auto-bind.ts.html +0 -231
- package/coverage/lcov-report/utils/index.html +0 -216
- package/coverage/lcov-report/utils/index.ts.html +0 -246
- package/coverage/lcov-report/utils/path.ts.html +0 -105
- package/coverage/lcov.info +0 -1209
package/dist/index.global.js
CHANGED
|
@@ -110,9 +110,15 @@
|
|
|
110
110
|
get proxy() {
|
|
111
111
|
return this.client.proxy(this.base);
|
|
112
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* 获取聚合数据
|
|
115
|
+
*/
|
|
113
116
|
getAggregateData() {
|
|
114
117
|
return this.proxy.get();
|
|
115
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* 获取最新发布的内容
|
|
121
|
+
*/
|
|
116
122
|
getTop(size = 5) {
|
|
117
123
|
return this.proxy.top.get({ params: { size } });
|
|
118
124
|
}
|
|
@@ -126,6 +132,9 @@
|
|
|
126
132
|
}
|
|
127
133
|
});
|
|
128
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* 获取聚合数据统计
|
|
137
|
+
*/
|
|
129
138
|
getStat() {
|
|
130
139
|
return this.proxy.stat.get();
|
|
131
140
|
}
|
|
@@ -230,20 +239,33 @@
|
|
|
230
239
|
get proxy() {
|
|
231
240
|
return this.client.proxy(this.base);
|
|
232
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* 根据 comment id 获取评论, 包括子评论
|
|
244
|
+
*/
|
|
233
245
|
getById(id) {
|
|
234
246
|
return this.proxy(id).get();
|
|
235
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* 获取文章的评论列表
|
|
250
|
+
* @param refId 文章 Id
|
|
251
|
+
*/
|
|
236
252
|
getByRefId(refId, pagination = {}) {
|
|
237
253
|
const { page, size } = pagination;
|
|
238
254
|
return this.proxy.ref(refId).get({
|
|
239
255
|
params: { page: page || 1, size: size || 10 }
|
|
240
256
|
});
|
|
241
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* 评论
|
|
260
|
+
*/
|
|
242
261
|
comment(refId, data) {
|
|
243
262
|
return this.proxy(refId).post({
|
|
244
263
|
data
|
|
245
264
|
});
|
|
246
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* 回复评论
|
|
268
|
+
*/
|
|
247
269
|
reply(commentId, data) {
|
|
248
270
|
return this.proxy.reply(commentId).post({
|
|
249
271
|
data
|
|
@@ -266,6 +288,11 @@
|
|
|
266
288
|
getAll() {
|
|
267
289
|
return this.proxy.all.get();
|
|
268
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* 带分页的查询
|
|
293
|
+
* @param page
|
|
294
|
+
* @param perPage
|
|
295
|
+
*/
|
|
269
296
|
getAllPaginated(page, perPage, sortOption) {
|
|
270
297
|
return this.proxy.get({
|
|
271
298
|
params: { page, size: perPage, ...sortOption }
|
|
@@ -282,10 +309,12 @@
|
|
|
282
309
|
this.base = "links";
|
|
283
310
|
autoBind(this);
|
|
284
311
|
}
|
|
312
|
+
// 是否可以申请友链
|
|
285
313
|
async canApplyLink() {
|
|
286
314
|
const { can } = await this.proxy.audit.get();
|
|
287
315
|
return can;
|
|
288
316
|
}
|
|
317
|
+
// 申请友链
|
|
289
318
|
async applyLink(data) {
|
|
290
319
|
return await this.proxy.audit.post({ data });
|
|
291
320
|
}
|
|
@@ -302,6 +331,9 @@
|
|
|
302
331
|
get proxy() {
|
|
303
332
|
return this.client.proxy(this.base);
|
|
304
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* 最新日记
|
|
336
|
+
*/
|
|
305
337
|
getLatest() {
|
|
306
338
|
return this.proxy.latest.get();
|
|
307
339
|
}
|
|
@@ -315,6 +347,9 @@
|
|
|
315
347
|
return this.proxy(id).get();
|
|
316
348
|
}
|
|
317
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* 日记列表分页
|
|
352
|
+
*/
|
|
318
353
|
getList(page = 1, perPage = 10, options = {}) {
|
|
319
354
|
const { select, sortBy, sortOrder, year } = options;
|
|
320
355
|
return this.proxy.get({
|
|
@@ -328,14 +363,23 @@
|
|
|
328
363
|
}
|
|
329
364
|
});
|
|
330
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* 获取当前日记的上下各 n / 2 篇日记
|
|
368
|
+
*/
|
|
331
369
|
getMiddleList(id, size = 5) {
|
|
332
370
|
return this.proxy.list(id).get({
|
|
333
371
|
params: { size }
|
|
334
372
|
});
|
|
335
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* 喜欢这篇日记
|
|
376
|
+
*/
|
|
336
377
|
likeIt(id) {
|
|
337
378
|
return this.proxy.like(id).get();
|
|
338
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* 获取专栏内的所有日记
|
|
382
|
+
*/
|
|
339
383
|
getNoteByTopicId(topicId, page = 1, size = 10, sortOptions = {}) {
|
|
340
384
|
return this.proxy.topics(topicId).get({
|
|
341
385
|
params: { page, size, ...sortOptions }
|
|
@@ -354,6 +398,9 @@
|
|
|
354
398
|
get proxy() {
|
|
355
399
|
return this.client.proxy(this.base);
|
|
356
400
|
}
|
|
401
|
+
/**
|
|
402
|
+
* 页面列表
|
|
403
|
+
*/
|
|
357
404
|
getList(page = 1, perPage = 10, options = {}) {
|
|
358
405
|
const { select, sortBy, sortOrder } = options;
|
|
359
406
|
return this.proxy.get({
|
|
@@ -366,9 +413,17 @@
|
|
|
366
413
|
}
|
|
367
414
|
});
|
|
368
415
|
}
|
|
416
|
+
/**
|
|
417
|
+
* 页面详情
|
|
418
|
+
*/
|
|
369
419
|
getById(id) {
|
|
370
420
|
return this.proxy(id).get();
|
|
371
421
|
}
|
|
422
|
+
/**
|
|
423
|
+
* 根据路径获取页面
|
|
424
|
+
* @param slug 路径
|
|
425
|
+
* @returns
|
|
426
|
+
*/
|
|
372
427
|
getBySlug(slug) {
|
|
373
428
|
return this.proxy.slug(slug).get({});
|
|
374
429
|
}
|
|
@@ -385,6 +440,12 @@
|
|
|
385
440
|
get proxy() {
|
|
386
441
|
return this.client.proxy(this.base);
|
|
387
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* 获取文章列表分页
|
|
445
|
+
* @param page
|
|
446
|
+
* @param perPage
|
|
447
|
+
* @returns
|
|
448
|
+
*/
|
|
388
449
|
getList(page = 1, perPage = 10, options = {}) {
|
|
389
450
|
const { select, sortBy, sortOrder, year } = options;
|
|
390
451
|
return this.proxy.get({
|
|
@@ -405,9 +466,15 @@
|
|
|
405
466
|
return this.proxy(idOrCategoryName)(slug).get();
|
|
406
467
|
}
|
|
407
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* 获取最新的文章
|
|
471
|
+
*/
|
|
408
472
|
getLatest() {
|
|
409
473
|
return this.proxy.latest.get();
|
|
410
474
|
}
|
|
475
|
+
/**
|
|
476
|
+
* 点赞
|
|
477
|
+
*/
|
|
411
478
|
thumbsUp(id) {
|
|
412
479
|
return this.proxy("_thumbs-up").get({ params: { id } });
|
|
413
480
|
}
|
|
@@ -445,6 +512,9 @@
|
|
|
445
512
|
get proxy() {
|
|
446
513
|
return this.client.proxy(this.base);
|
|
447
514
|
}
|
|
515
|
+
/**
|
|
516
|
+
* 获取最新一条
|
|
517
|
+
*/
|
|
448
518
|
getLatestOne() {
|
|
449
519
|
return this.proxy.latest.get();
|
|
450
520
|
}
|
|
@@ -460,6 +530,7 @@
|
|
|
460
530
|
}
|
|
461
531
|
});
|
|
462
532
|
}
|
|
533
|
+
/** 表态:点赞,点踩 */
|
|
463
534
|
attitude(id, attitude) {
|
|
464
535
|
return this.proxy.attitude(id).get({
|
|
465
536
|
params: {
|
|
@@ -481,6 +552,9 @@
|
|
|
481
552
|
get proxy() {
|
|
482
553
|
return this.client.proxy(this.base);
|
|
483
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* 获取随机一条
|
|
557
|
+
*/
|
|
484
558
|
getRandom() {
|
|
485
559
|
return this.proxy.random.get();
|
|
486
560
|
}
|
|
@@ -502,6 +576,13 @@
|
|
|
502
576
|
params: { keyword, ...options }
|
|
503
577
|
});
|
|
504
578
|
}
|
|
579
|
+
/**
|
|
580
|
+
* 从 algolya 搜索
|
|
581
|
+
* https://www.algolia.com/doc/api-reference/api-methods/search/
|
|
582
|
+
* @param keyword
|
|
583
|
+
* @param options
|
|
584
|
+
* @returns
|
|
585
|
+
*/
|
|
505
586
|
searchByAlgolia(keyword, options) {
|
|
506
587
|
return this.proxy("algolia").get({ params: { keyword, ...options } });
|
|
507
588
|
}
|
|
@@ -534,6 +615,9 @@
|
|
|
534
615
|
get proxy() {
|
|
535
616
|
return this.client.proxy(this.base);
|
|
536
617
|
}
|
|
618
|
+
// getById(id: string) {
|
|
619
|
+
// return this.proxy(id).get<Omit<SnippetModel, 'data'>>()
|
|
620
|
+
// }
|
|
537
621
|
getByReferenceAndName(reference, name) {
|
|
538
622
|
return this.proxy(reference)(name).get();
|
|
539
623
|
}
|
|
@@ -550,12 +634,15 @@
|
|
|
550
634
|
get proxy() {
|
|
551
635
|
return this.client.proxy(this.base);
|
|
552
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* 检查开启状态
|
|
639
|
+
*/
|
|
553
640
|
check() {
|
|
554
641
|
return this.proxy.status.get();
|
|
555
642
|
}
|
|
556
643
|
subscribe(email, types) {
|
|
557
644
|
return this.proxy.post({
|
|
558
|
-
|
|
645
|
+
data: {
|
|
559
646
|
email,
|
|
560
647
|
types
|
|
561
648
|
}
|
|
@@ -662,6 +749,7 @@
|
|
|
662
749
|
"serverless",
|
|
663
750
|
"subscribe",
|
|
664
751
|
"user",
|
|
752
|
+
// alias,
|
|
665
753
|
"friend",
|
|
666
754
|
"master",
|
|
667
755
|
"shorthand"
|
|
@@ -847,6 +935,7 @@
|
|
|
847
935
|
route.push(name);
|
|
848
936
|
return new Proxy(noop, handler);
|
|
849
937
|
},
|
|
938
|
+
// @ts-ignore
|
|
850
939
|
apply(target, _, args) {
|
|
851
940
|
route.push(...args.filter((x) => x !== null));
|
|
852
941
|
return new Proxy(noop, handler);
|
package/dist/index.js
CHANGED
|
@@ -108,9 +108,15 @@ var AggregateController = class {
|
|
|
108
108
|
get proxy() {
|
|
109
109
|
return this.client.proxy(this.base);
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* 获取聚合数据
|
|
113
|
+
*/
|
|
111
114
|
getAggregateData() {
|
|
112
115
|
return this.proxy.get();
|
|
113
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* 获取最新发布的内容
|
|
119
|
+
*/
|
|
114
120
|
getTop(size = 5) {
|
|
115
121
|
return this.proxy.top.get({ params: { size } });
|
|
116
122
|
}
|
|
@@ -124,6 +130,9 @@ var AggregateController = class {
|
|
|
124
130
|
}
|
|
125
131
|
});
|
|
126
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* 获取聚合数据统计
|
|
135
|
+
*/
|
|
127
136
|
getStat() {
|
|
128
137
|
return this.proxy.stat.get();
|
|
129
138
|
}
|
|
@@ -228,20 +237,33 @@ var CommentController = class {
|
|
|
228
237
|
get proxy() {
|
|
229
238
|
return this.client.proxy(this.base);
|
|
230
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* 根据 comment id 获取评论, 包括子评论
|
|
242
|
+
*/
|
|
231
243
|
getById(id) {
|
|
232
244
|
return this.proxy(id).get();
|
|
233
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* 获取文章的评论列表
|
|
248
|
+
* @param refId 文章 Id
|
|
249
|
+
*/
|
|
234
250
|
getByRefId(refId, pagination = {}) {
|
|
235
251
|
const { page, size } = pagination;
|
|
236
252
|
return this.proxy.ref(refId).get({
|
|
237
253
|
params: { page: page || 1, size: size || 10 }
|
|
238
254
|
});
|
|
239
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* 评论
|
|
258
|
+
*/
|
|
240
259
|
comment(refId, data) {
|
|
241
260
|
return this.proxy(refId).post({
|
|
242
261
|
data
|
|
243
262
|
});
|
|
244
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* 回复评论
|
|
266
|
+
*/
|
|
245
267
|
reply(commentId, data) {
|
|
246
268
|
return this.proxy.reply(commentId).post({
|
|
247
269
|
data
|
|
@@ -264,6 +286,11 @@ var BaseCrudController = class {
|
|
|
264
286
|
getAll() {
|
|
265
287
|
return this.proxy.all.get();
|
|
266
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* 带分页的查询
|
|
291
|
+
* @param page
|
|
292
|
+
* @param perPage
|
|
293
|
+
*/
|
|
267
294
|
getAllPaginated(page, perPage, sortOption) {
|
|
268
295
|
return this.proxy.get({
|
|
269
296
|
params: { page, size: perPage, ...sortOption }
|
|
@@ -280,10 +307,12 @@ var LinkController = class extends BaseCrudController {
|
|
|
280
307
|
this.base = "links";
|
|
281
308
|
autoBind(this);
|
|
282
309
|
}
|
|
310
|
+
// 是否可以申请友链
|
|
283
311
|
async canApplyLink() {
|
|
284
312
|
const { can } = await this.proxy.audit.get();
|
|
285
313
|
return can;
|
|
286
314
|
}
|
|
315
|
+
// 申请友链
|
|
287
316
|
async applyLink(data) {
|
|
288
317
|
return await this.proxy.audit.post({ data });
|
|
289
318
|
}
|
|
@@ -300,6 +329,9 @@ var NoteController = class {
|
|
|
300
329
|
get proxy() {
|
|
301
330
|
return this.client.proxy(this.base);
|
|
302
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* 最新日记
|
|
334
|
+
*/
|
|
303
335
|
getLatest() {
|
|
304
336
|
return this.proxy.latest.get();
|
|
305
337
|
}
|
|
@@ -313,6 +345,9 @@ var NoteController = class {
|
|
|
313
345
|
return this.proxy(id).get();
|
|
314
346
|
}
|
|
315
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* 日记列表分页
|
|
350
|
+
*/
|
|
316
351
|
getList(page = 1, perPage = 10, options = {}) {
|
|
317
352
|
const { select, sortBy, sortOrder, year } = options;
|
|
318
353
|
return this.proxy.get({
|
|
@@ -326,14 +361,23 @@ var NoteController = class {
|
|
|
326
361
|
}
|
|
327
362
|
});
|
|
328
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* 获取当前日记的上下各 n / 2 篇日记
|
|
366
|
+
*/
|
|
329
367
|
getMiddleList(id, size = 5) {
|
|
330
368
|
return this.proxy.list(id).get({
|
|
331
369
|
params: { size }
|
|
332
370
|
});
|
|
333
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* 喜欢这篇日记
|
|
374
|
+
*/
|
|
334
375
|
likeIt(id) {
|
|
335
376
|
return this.proxy.like(id).get();
|
|
336
377
|
}
|
|
378
|
+
/**
|
|
379
|
+
* 获取专栏内的所有日记
|
|
380
|
+
*/
|
|
337
381
|
getNoteByTopicId(topicId, page = 1, size = 10, sortOptions = {}) {
|
|
338
382
|
return this.proxy.topics(topicId).get({
|
|
339
383
|
params: { page, size, ...sortOptions }
|
|
@@ -352,6 +396,9 @@ var PageController = class {
|
|
|
352
396
|
get proxy() {
|
|
353
397
|
return this.client.proxy(this.base);
|
|
354
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* 页面列表
|
|
401
|
+
*/
|
|
355
402
|
getList(page = 1, perPage = 10, options = {}) {
|
|
356
403
|
const { select, sortBy, sortOrder } = options;
|
|
357
404
|
return this.proxy.get({
|
|
@@ -364,9 +411,17 @@ var PageController = class {
|
|
|
364
411
|
}
|
|
365
412
|
});
|
|
366
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* 页面详情
|
|
416
|
+
*/
|
|
367
417
|
getById(id) {
|
|
368
418
|
return this.proxy(id).get();
|
|
369
419
|
}
|
|
420
|
+
/**
|
|
421
|
+
* 根据路径获取页面
|
|
422
|
+
* @param slug 路径
|
|
423
|
+
* @returns
|
|
424
|
+
*/
|
|
370
425
|
getBySlug(slug) {
|
|
371
426
|
return this.proxy.slug(slug).get({});
|
|
372
427
|
}
|
|
@@ -383,6 +438,12 @@ var PostController = class {
|
|
|
383
438
|
get proxy() {
|
|
384
439
|
return this.client.proxy(this.base);
|
|
385
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* 获取文章列表分页
|
|
443
|
+
* @param page
|
|
444
|
+
* @param perPage
|
|
445
|
+
* @returns
|
|
446
|
+
*/
|
|
386
447
|
getList(page = 1, perPage = 10, options = {}) {
|
|
387
448
|
const { select, sortBy, sortOrder, year } = options;
|
|
388
449
|
return this.proxy.get({
|
|
@@ -403,9 +464,15 @@ var PostController = class {
|
|
|
403
464
|
return this.proxy(idOrCategoryName)(slug).get();
|
|
404
465
|
}
|
|
405
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* 获取最新的文章
|
|
469
|
+
*/
|
|
406
470
|
getLatest() {
|
|
407
471
|
return this.proxy.latest.get();
|
|
408
472
|
}
|
|
473
|
+
/**
|
|
474
|
+
* 点赞
|
|
475
|
+
*/
|
|
409
476
|
thumbsUp(id) {
|
|
410
477
|
return this.proxy("_thumbs-up").get({ params: { id } });
|
|
411
478
|
}
|
|
@@ -443,6 +510,9 @@ var RecentlyController = class {
|
|
|
443
510
|
get proxy() {
|
|
444
511
|
return this.client.proxy(this.base);
|
|
445
512
|
}
|
|
513
|
+
/**
|
|
514
|
+
* 获取最新一条
|
|
515
|
+
*/
|
|
446
516
|
getLatestOne() {
|
|
447
517
|
return this.proxy.latest.get();
|
|
448
518
|
}
|
|
@@ -458,6 +528,7 @@ var RecentlyController = class {
|
|
|
458
528
|
}
|
|
459
529
|
});
|
|
460
530
|
}
|
|
531
|
+
/** 表态:点赞,点踩 */
|
|
461
532
|
attitude(id, attitude) {
|
|
462
533
|
return this.proxy.attitude(id).get({
|
|
463
534
|
params: {
|
|
@@ -479,6 +550,9 @@ var SayController = class extends BaseCrudController {
|
|
|
479
550
|
get proxy() {
|
|
480
551
|
return this.client.proxy(this.base);
|
|
481
552
|
}
|
|
553
|
+
/**
|
|
554
|
+
* 获取随机一条
|
|
555
|
+
*/
|
|
482
556
|
getRandom() {
|
|
483
557
|
return this.proxy.random.get();
|
|
484
558
|
}
|
|
@@ -500,6 +574,13 @@ var SearchController = class {
|
|
|
500
574
|
params: { keyword, ...options }
|
|
501
575
|
});
|
|
502
576
|
}
|
|
577
|
+
/**
|
|
578
|
+
* 从 algolya 搜索
|
|
579
|
+
* https://www.algolia.com/doc/api-reference/api-methods/search/
|
|
580
|
+
* @param keyword
|
|
581
|
+
* @param options
|
|
582
|
+
* @returns
|
|
583
|
+
*/
|
|
503
584
|
searchByAlgolia(keyword, options) {
|
|
504
585
|
return this.proxy("algolia").get({ params: { keyword, ...options } });
|
|
505
586
|
}
|
|
@@ -532,6 +613,9 @@ var SnippetController = class {
|
|
|
532
613
|
get proxy() {
|
|
533
614
|
return this.client.proxy(this.base);
|
|
534
615
|
}
|
|
616
|
+
// getById(id: string) {
|
|
617
|
+
// return this.proxy(id).get<Omit<SnippetModel, 'data'>>()
|
|
618
|
+
// }
|
|
535
619
|
getByReferenceAndName(reference, name) {
|
|
536
620
|
return this.proxy(reference)(name).get();
|
|
537
621
|
}
|
|
@@ -548,12 +632,15 @@ var SubscribeController = class {
|
|
|
548
632
|
get proxy() {
|
|
549
633
|
return this.client.proxy(this.base);
|
|
550
634
|
}
|
|
635
|
+
/**
|
|
636
|
+
* 检查开启状态
|
|
637
|
+
*/
|
|
551
638
|
check() {
|
|
552
639
|
return this.proxy.status.get();
|
|
553
640
|
}
|
|
554
641
|
subscribe(email, types) {
|
|
555
642
|
return this.proxy.post({
|
|
556
|
-
|
|
643
|
+
data: {
|
|
557
644
|
email,
|
|
558
645
|
types
|
|
559
646
|
}
|
|
@@ -660,6 +747,7 @@ var allContollerNames = [
|
|
|
660
747
|
"serverless",
|
|
661
748
|
"subscribe",
|
|
662
749
|
"user",
|
|
750
|
+
// alias,
|
|
663
751
|
"friend",
|
|
664
752
|
"master",
|
|
665
753
|
"shorthand"
|
|
@@ -845,6 +933,7 @@ var HTTPClient = class {
|
|
|
845
933
|
route.push(name);
|
|
846
934
|
return new Proxy(noop, handler);
|
|
847
935
|
},
|
|
936
|
+
// @ts-ignore
|
|
848
937
|
apply(target, _, args) {
|
|
849
938
|
route.push(...args.filter((x) => x !== null));
|
|
850
939
|
return new Proxy(noop, handler);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mx-space/api-client",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A api client for mx-space server@next",
|
|
6
6
|
"author": "Innei",
|
|
@@ -22,15 +22,7 @@
|
|
|
22
22
|
"import": "./dist/adaptors/*.js",
|
|
23
23
|
"require": "./dist/adaptors/*.cjs"
|
|
24
24
|
},
|
|
25
|
-
"./package.json": "./package.json"
|
|
26
|
-
"./adaptors/*": {
|
|
27
|
-
"import": {
|
|
28
|
-
"default": "./dist/adaptors/*.js"
|
|
29
|
-
},
|
|
30
|
-
"require": {
|
|
31
|
-
"default": "./dist/adaptors/*.cjs"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
25
|
+
"./package.json": "./package.json"
|
|
34
26
|
},
|
|
35
27
|
"husky": {
|
|
36
28
|
"hooks": {
|
|
@@ -79,7 +71,7 @@
|
|
|
79
71
|
"lodash": "4.17.21",
|
|
80
72
|
"node-fetch": "3.3.0",
|
|
81
73
|
"tsc-alias": "1.8.2",
|
|
82
|
-
"tsup": "6.
|
|
74
|
+
"tsup": "6.6.2",
|
|
83
75
|
"umi-request": "1.4.0"
|
|
84
76
|
}
|
|
85
77
|
}
|