@mx-space/api-client 1.2.0 → 1.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/dist/index.cjs CHANGED
@@ -45,6 +45,7 @@ __export(api_client_exports, {
45
45
  ServerlessController: () => ServerlessController,
46
46
  SnippetController: () => SnippetController,
47
47
  SnippetType: () => SnippetType,
48
+ SubscribeController: () => SubscribeController,
48
49
  TimelineType: () => TimelineType,
49
50
  TopicController: () => TopicController,
50
51
  UserController: () => UserController,
@@ -595,6 +596,35 @@ var SnippetController = class {
595
596
  }
596
597
  };
597
598
 
599
+ // controllers/subscribe.ts
600
+ var SubscribeController = class {
601
+ constructor(client) {
602
+ this.client = client;
603
+ this.base = "subscribe";
604
+ this.name = "subscribe";
605
+ autoBind(this);
606
+ }
607
+ get proxy() {
608
+ return this.client.proxy(this.base);
609
+ }
610
+ subscribe(email, types) {
611
+ return this.proxy.post({
612
+ params: {
613
+ email,
614
+ types
615
+ }
616
+ });
617
+ }
618
+ unsubscribe(email, cancelToken) {
619
+ return this.proxy.unsubscribe.get({
620
+ params: {
621
+ email,
622
+ cancelToken
623
+ }
624
+ });
625
+ }
626
+ };
627
+
598
628
  // controllers/topic.ts
599
629
  var TopicController = class extends BaseCrudController {
600
630
  constructor(client) {
@@ -666,6 +696,7 @@ var allControllers = [
666
696
  SearchController,
667
697
  SnippetController,
668
698
  ServerlessController,
699
+ SubscribeController,
669
700
  UserController
670
701
  ];
671
702
  var allContollerNames = [
@@ -683,6 +714,7 @@ var allContollerNames = [
683
714
  "search",
684
715
  "snippet",
685
716
  "serverless",
717
+ "subscribe",
686
718
  "user",
687
719
  "friend",
688
720
  "master",
@@ -987,6 +1019,7 @@ var api_client_default = createClient;
987
1019
  ServerlessController,
988
1020
  SnippetController,
989
1021
  SnippetType,
1022
+ SubscribeController,
990
1023
  TimelineType,
991
1024
  TopicController,
992
1025
  UserController,
package/dist/index.d.ts CHANGED
@@ -1438,6 +1438,45 @@ declare class SnippetController<ResponseWrapper> implements IController {
1438
1438
  }>;
1439
1439
  }
1440
1440
 
1441
+ declare const SubscribeTypeToBitMap: {
1442
+ post_c: number;
1443
+ note_c: number;
1444
+ say_c: number;
1445
+ recently_c: number;
1446
+ all: number;
1447
+ };
1448
+
1449
+ type SubscribeType = keyof typeof SubscribeTypeToBitMap;
1450
+
1451
+ declare module '@mx-space/api-client' {
1452
+ interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
1453
+ subscribe: SubscribeController<ResponseWrapper>;
1454
+ }
1455
+ }
1456
+ declare class SubscribeController<ResponseWrapper> implements IController {
1457
+ protected client: HTTPClient;
1458
+ base: string;
1459
+ name: string;
1460
+ constructor(client: HTTPClient);
1461
+ get proxy(): IRequestHandler<ResponseWrapper>;
1462
+ subscribe(email: string, types: SubscribeType[]): RequestProxyResult<never, ResponseWrapper, ResponseWrapper extends unknown ? {
1463
+ [key: string]: any;
1464
+ data: never;
1465
+ } : ResponseWrapper extends {
1466
+ data: never;
1467
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1468
+ data: never;
1469
+ }>;
1470
+ unsubscribe(email: string, cancelToken: string): RequestProxyResult<string, ResponseWrapper, ResponseWrapper extends unknown ? {
1471
+ [key: string]: any;
1472
+ data: string;
1473
+ } : ResponseWrapper extends {
1474
+ data: string;
1475
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1476
+ data: string;
1477
+ }>;
1478
+ }
1479
+
1441
1480
  declare module '@mx-space/api-client' {
1442
1481
  interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
1443
1482
  topic: TopicController<ResponseWrapper>;
@@ -1525,8 +1564,8 @@ declare class UserController<ResponseWrapper> implements IController {
1525
1564
  }>;
1526
1565
  }
1527
1566
 
1528
- 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 ServerlessController | typeof SnippetController | typeof TopicController | typeof UserController)[];
1529
- declare const allContollerNames: readonly ["aggregate", "category", "comment", "link", "note", "page", "post", "project", "topic", "recently", "say", "search", "snippet", "serverless", "user", "friend", "master", "shorthand"];
1567
+ 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 ServerlessController | typeof SnippetController | typeof SubscribeController | typeof TopicController | typeof UserController)[];
1568
+ declare const allContollerNames: readonly ["aggregate", "category", "comment", "link", "note", "page", "post", "project", "topic", "recently", "say", "search", "snippet", "serverless", "subscribe", "user", "friend", "master", "shorthand"];
1530
1569
 
1531
1570
  declare enum SnippetType {
1532
1571
  JSON = "json",
@@ -1552,4 +1591,4 @@ interface SnippetModel<T = unknown> extends BaseModel {
1552
1591
  */
1553
1592
  declare const camelcaseKeys: <T = any>(obj: any) => T;
1554
1593
 
1555
- export { AdminExtraModel, AggregateController, AggregateRoot, AggregateStat, AggregateTop, AlgoliaSearchOptionsModel, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, HTTPClient, IConfig, IConfigKeys, Image, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, NoteController, NoteModel, NoteMusicRecord, NoteWrappedPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, PostModel, ProjectController, ProjectModel, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RefType, RequestError, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, Url, UrlOptionModel, UserController, UserModel, allContollerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
1594
+ export { AdminExtraModel, AggregateController, AggregateRoot, AggregateStat, AggregateTop, AlgoliaSearchOptionsModel, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, HTTPClient, IConfig, IConfigKeys, Image, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, NoteController, NoteModel, NoteMusicRecord, NoteWrappedPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, PostModel, ProjectController, ProjectModel, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RefType, RequestError, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeController, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, Url, UrlOptionModel, UserController, UserModel, allContollerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
@@ -539,6 +539,35 @@
539
539
  }
540
540
  };
541
541
 
542
+ // controllers/subscribe.ts
543
+ var SubscribeController = class {
544
+ constructor(client) {
545
+ this.client = client;
546
+ this.base = "subscribe";
547
+ this.name = "subscribe";
548
+ autoBind(this);
549
+ }
550
+ get proxy() {
551
+ return this.client.proxy(this.base);
552
+ }
553
+ subscribe(email, types) {
554
+ return this.proxy.post({
555
+ params: {
556
+ email,
557
+ types
558
+ }
559
+ });
560
+ }
561
+ unsubscribe(email, cancelToken) {
562
+ return this.proxy.unsubscribe.get({
563
+ params: {
564
+ email,
565
+ cancelToken
566
+ }
567
+ });
568
+ }
569
+ };
570
+
542
571
  // controllers/topic.ts
543
572
  var TopicController = class extends BaseCrudController {
544
573
  constructor(client) {
@@ -610,6 +639,7 @@
610
639
  SearchController,
611
640
  SnippetController,
612
641
  ServerlessController,
642
+ SubscribeController,
613
643
  UserController
614
644
  ];
615
645
  var allContollerNames = [
@@ -627,6 +657,7 @@
627
657
  "search",
628
658
  "snippet",
629
659
  "serverless",
660
+ "subscribe",
630
661
  "user",
631
662
  "friend",
632
663
  "master",
package/dist/index.js CHANGED
@@ -537,6 +537,35 @@ var SnippetController = class {
537
537
  }
538
538
  };
539
539
 
540
+ // controllers/subscribe.ts
541
+ var SubscribeController = class {
542
+ constructor(client) {
543
+ this.client = client;
544
+ this.base = "subscribe";
545
+ this.name = "subscribe";
546
+ autoBind(this);
547
+ }
548
+ get proxy() {
549
+ return this.client.proxy(this.base);
550
+ }
551
+ subscribe(email, types) {
552
+ return this.proxy.post({
553
+ params: {
554
+ email,
555
+ types
556
+ }
557
+ });
558
+ }
559
+ unsubscribe(email, cancelToken) {
560
+ return this.proxy.unsubscribe.get({
561
+ params: {
562
+ email,
563
+ cancelToken
564
+ }
565
+ });
566
+ }
567
+ };
568
+
540
569
  // controllers/topic.ts
541
570
  var TopicController = class extends BaseCrudController {
542
571
  constructor(client) {
@@ -608,6 +637,7 @@ var allControllers = [
608
637
  SearchController,
609
638
  SnippetController,
610
639
  ServerlessController,
640
+ SubscribeController,
611
641
  UserController
612
642
  ];
613
643
  var allContollerNames = [
@@ -625,6 +655,7 @@ var allContollerNames = [
625
655
  "search",
626
656
  "snippet",
627
657
  "serverless",
658
+ "subscribe",
628
659
  "user",
629
660
  "friend",
630
661
  "master",
@@ -928,6 +959,7 @@ export {
928
959
  ServerlessController,
929
960
  SnippetController,
930
961
  SnippetType,
962
+ SubscribeController,
931
963
  TimelineType,
932
964
  TopicController,
933
965
  UserController,
@@ -0,0 +1,5 @@
1
+ import { SubscribeTypeToBitMap } from '@core/modules/subscribe/subscribe.constant'
2
+
3
+ export * from '@core/modules/subscribe/subscribe.constant'
4
+
5
+ export type SubscribeType = keyof typeof SubscribeTypeToBitMap
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-space/api-client",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "description": "A api client for mx-space server@next",
6
6
  "author": "Innei",
@@ -66,17 +66,17 @@
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/cors": "2.8.13",
69
- "@types/express": "4.17.15",
70
- "@types/lodash": "4.14.186",
69
+ "@types/express": "4.17.16",
70
+ "@types/lodash": "4.14.191",
71
71
  "abort-controller": "3.0.0",
72
- "axios": "^1.2.2",
72
+ "axios": "^1.3.1",
73
73
  "camelcase-keys": "*",
74
74
  "cors": "2.8.5",
75
75
  "express": "4.18.2",
76
76
  "isomorphic-unfetch": "3.1.0",
77
77
  "ky": "0.33.2",
78
78
  "lodash": "4.17.21",
79
- "node-fetch": "3.2.10",
79
+ "node-fetch": "3.3.0",
80
80
  "tsc-alias": "1.8.2",
81
81
  "tsup": "6.5.0",
82
82
  "umi-request": "1.4.0"
package/tsconfig.json CHANGED
@@ -21,7 +21,10 @@
21
21
  "paths": {
22
22
  "~/*": [
23
23
  "*"
24
- ]
24
+ ],
25
+ "@core/*": [
26
+ "../../src/*"
27
+ ],
25
28
  }
26
29
  },
27
30
  "exclude": [