@arrowsphere/api-client 3.28.0-rc.fdi.1 → 3.28.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +2 -4
  2. package/build/abstractClient.d.ts +0 -5
  3. package/build/abstractClient.js +0 -8
  4. package/build/campaign/index.d.ts +0 -1
  5. package/build/campaign/index.js +0 -1
  6. package/build/catalog/catalogClient.d.ts +12 -0
  7. package/build/catalog/catalogClient.js +26 -0
  8. package/build/catalog/entities/program.d.ts +66 -0
  9. package/build/catalog/entities/program.js +102 -0
  10. package/build/catalog/entities/programs.d.ts +9 -0
  11. package/build/{notifications/entities/total.js → catalog/entities/programs.js} +14 -19
  12. package/build/catalog/index.d.ts +3 -0
  13. package/build/catalog/index.js +3 -0
  14. package/build/catalog/types/catalogGraphQLTypes.d.ts +2 -2
  15. package/build/index.d.ts +0 -1
  16. package/build/index.js +0 -1
  17. package/build/publicApiClient.d.ts +2 -2
  18. package/build/publicApiClient.js +4 -4
  19. package/package.json +1 -1
  20. package/build/notifications/entities/details/notificationDetails.d.ts +0 -31
  21. package/build/notifications/entities/details/notificationDetails.js +0 -82
  22. package/build/notifications/entities/notification.d.ts +0 -14
  23. package/build/notifications/entities/notification.js +0 -41
  24. package/build/notifications/entities/notifications.d.ts +0 -14
  25. package/build/notifications/entities/notifications.js +0 -41
  26. package/build/notifications/entities/total.d.ts +0 -13
  27. package/build/notifications/index.d.ts +0 -5
  28. package/build/notifications/index.js +0 -18
  29. package/build/notifications/notificationsClient.d.ts +0 -39
  30. package/build/notifications/notificationsClient.js +0 -60
package/CHANGELOG.md CHANGED
@@ -3,16 +3,14 @@
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4
4
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
- ## [3.28.0] - 2023-05-10
6
+ ## [3.28.0] - 2023-05-22
7
7
 
8
8
  ### Changed
9
9
 
10
- - add notification endpoint
10
+ - Add catalog programs endpoints
11
11
 
12
12
  ## [3.27.0] - 2023-05-10
13
13
 
14
- ### Changed
15
-
16
14
  - update create order client to add attributes for injection scenario
17
15
 
18
16
  ## [3.26.0] - 2023-04-20
@@ -57,10 +57,6 @@ export declare abstract class AbstractClient {
57
57
  * ArrowSphere API key
58
58
  */
59
59
  protected apiKey: string;
60
- /**
61
- * ArrowSphere token
62
- */
63
- protected token: string;
64
60
  /**
65
61
  * Current pagination page number
66
62
  */
@@ -88,7 +84,6 @@ export declare abstract class AbstractClient {
88
84
  * @returns this
89
85
  */
90
86
  setApiKey(key: string): this;
91
- setToken(apiKey: string): this;
92
87
  /**
93
88
  * Sets the client ArrowSphere API url
94
89
  * @param url - API url
@@ -50,10 +50,6 @@ class AbstractClient {
50
50
  * ArrowSphere API key
51
51
  */
52
52
  this.apiKey = '';
53
- /**
54
- * ArrowSphere token
55
- */
56
- this.token = '';
57
53
  /**
58
54
  * Current pagination page number
59
55
  */
@@ -84,10 +80,6 @@ class AbstractClient {
84
80
  this.apiKey = key;
85
81
  return this;
86
82
  }
87
- setToken(apiKey) {
88
- this.token = apiKey;
89
- return this;
90
- }
91
83
  /**
92
84
  * Sets the client ArrowSphere API url
93
85
  * @param url - API url
@@ -14,7 +14,6 @@ export * from './entities/v2/campaign/landingPage/landingPageFooter/landingPageF
14
14
  export * from './entities/v2/campaign/landingPage/landingPage';
15
15
  export * from './entities/v2/campaign/landingPage/landingPageHeader';
16
16
  export * from './entities/v2/campaign/campaign';
17
- export * from './entities/v2/campaignList';
18
17
  export { AssetsCampaignAssets };
19
18
  export * from './entities/campaignAssets/campaignAssets';
20
19
  export * from './campaignClient';
@@ -40,7 +40,6 @@ __exportStar(require("./entities/v2/campaign/landingPage/landingPageFooter/landi
40
40
  __exportStar(require("./entities/v2/campaign/landingPage/landingPage"), exports);
41
41
  __exportStar(require("./entities/v2/campaign/landingPage/landingPageHeader"), exports);
42
42
  __exportStar(require("./entities/v2/campaign/campaign"), exports);
43
- __exportStar(require("./entities/v2/campaignList"), exports);
44
43
  __exportStar(require("./entities/campaignAssets/campaignAssets"), exports);
45
44
  __exportStar(require("./campaignClient"), exports);
46
45
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,12 @@
1
+ import { AbstractClient, Parameters } from '../abstractClient';
2
+ import { GetResult } from '../getResult';
3
+ import { Program } from './entities/program';
4
+ import { Programs } from './entities/programs';
5
+ export declare class CatalogClient extends AbstractClient {
6
+ /**
7
+ * The base path of the API
8
+ */
9
+ protected basePath: string;
10
+ listPrograms(category: string, parameters?: Parameters): Promise<GetResult<Programs>>;
11
+ getProgram(category: string, program: string, parameters?: Parameters): Promise<GetResult<Program>>;
12
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CatalogClient = void 0;
4
+ const abstractClient_1 = require("../abstractClient");
5
+ const getResult_1 = require("../getResult");
6
+ const program_1 = require("./entities/program");
7
+ const programs_1 = require("./entities/programs");
8
+ class CatalogClient extends abstractClient_1.AbstractClient {
9
+ constructor() {
10
+ super(...arguments);
11
+ /**
12
+ * The base path of the API
13
+ */
14
+ this.basePath = '/catalog';
15
+ }
16
+ async listPrograms(category, parameters = {}) {
17
+ this.path = `/categories/${category}/programs`;
18
+ return new getResult_1.GetResult(programs_1.Programs, await this.get(parameters));
19
+ }
20
+ async getProgram(category, program, parameters = {}) {
21
+ this.path = `/categories/${category}/programs/${program}`;
22
+ return new getResult_1.GetResult(program_1.Program, await this.get(parameters));
23
+ }
24
+ }
25
+ exports.CatalogClient = CatalogClient;
26
+ //# sourceMappingURL=catalogClient.js.map
@@ -0,0 +1,66 @@
1
+ import { AbstractEntity } from '../../abstractEntity';
2
+ export declare enum ProgramFields {
3
+ REFERENCE = "reference",
4
+ NAME = "name",
5
+ ASSOCIATED_SUBSCRIPTION_PROGRAM = "associatedSubscriptionProgram",
6
+ LOGO = "logo",
7
+ CATEGORY = "category",
8
+ LINKS = "links",
9
+ EXTRA_INFORMATION = "extraInformation"
10
+ }
11
+ export declare enum ProgramLinksFields {
12
+ PROGRAM = "program",
13
+ PRODUCTS = "products"
14
+ }
15
+ export declare enum ProgramExtraInfoFields {
16
+ RESELLER = "reseller",
17
+ END_CUSTOMER = "endCustomer",
18
+ ORDER = "order"
19
+ }
20
+ export declare enum ProgramExtraInfoItemFields {
21
+ NAME = "name",
22
+ LABEL = "label",
23
+ TYPE = "type",
24
+ REGEX = "regex",
25
+ MANDATORY = "mandatory"
26
+ }
27
+ export declare type ProgramType = {
28
+ [ProgramFields.REFERENCE]?: string;
29
+ [ProgramFields.NAME]: string;
30
+ [ProgramFields.ASSOCIATED_SUBSCRIPTION_PROGRAM]: string;
31
+ [ProgramFields.LOGO]: string;
32
+ [ProgramFields.CATEGORY]: string;
33
+ [ProgramFields.LINKS]: ProgramLinksType;
34
+ [ProgramFields.EXTRA_INFORMATION]: ExtraInfoType;
35
+ };
36
+ export declare type ProgramLinksType = {
37
+ [ProgramLinksFields.PROGRAM]: string;
38
+ [ProgramLinksFields.PRODUCTS]: string;
39
+ };
40
+ export declare type ExtraInfoType = {
41
+ [ProgramExtraInfoFields.RESELLER]: ExtraInfoItemType[];
42
+ [ProgramExtraInfoFields.END_CUSTOMER]: ExtraInfoItemType[];
43
+ [ProgramExtraInfoFields.ORDER]: ExtraInfoItemType[];
44
+ };
45
+ export declare type ExtraInfoItemType = {
46
+ [ProgramExtraInfoItemFields.NAME]: string;
47
+ [ProgramExtraInfoItemFields.LABEL]: string;
48
+ [ProgramExtraInfoItemFields.TYPE]: string;
49
+ [ProgramExtraInfoItemFields.REGEX]: string;
50
+ [ProgramExtraInfoItemFields.MANDATORY]: boolean;
51
+ };
52
+ export declare class Program extends AbstractEntity<ProgramType> {
53
+ #private;
54
+ constructor(input: ProgramType);
55
+ get reference(): string | undefined;
56
+ get name(): string;
57
+ get associatedSubscriptionProgram(): string;
58
+ get logo(): string;
59
+ get category(): string;
60
+ get links(): {
61
+ program: string;
62
+ products: string;
63
+ };
64
+ get extraInformation(): ExtraInfoType;
65
+ toJSON(): ProgramType;
66
+ }
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
+ if (!privateMap.has(receiver)) {
4
+ throw new TypeError("attempted to set private field on non-instance");
5
+ }
6
+ privateMap.set(receiver, value);
7
+ return value;
8
+ };
9
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
+ if (!privateMap.has(receiver)) {
11
+ throw new TypeError("attempted to get private field on non-instance");
12
+ }
13
+ return privateMap.get(receiver);
14
+ };
15
+ var _reference, _name, _associatedSubscriptionProgram, _logo, _category, _links, _extraInformation;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Program = exports.ProgramExtraInfoItemFields = exports.ProgramExtraInfoFields = exports.ProgramLinksFields = exports.ProgramFields = void 0;
18
+ const abstractEntity_1 = require("../../abstractEntity");
19
+ var ProgramFields;
20
+ (function (ProgramFields) {
21
+ ProgramFields["REFERENCE"] = "reference";
22
+ ProgramFields["NAME"] = "name";
23
+ ProgramFields["ASSOCIATED_SUBSCRIPTION_PROGRAM"] = "associatedSubscriptionProgram";
24
+ ProgramFields["LOGO"] = "logo";
25
+ ProgramFields["CATEGORY"] = "category";
26
+ ProgramFields["LINKS"] = "links";
27
+ ProgramFields["EXTRA_INFORMATION"] = "extraInformation";
28
+ })(ProgramFields = exports.ProgramFields || (exports.ProgramFields = {}));
29
+ var ProgramLinksFields;
30
+ (function (ProgramLinksFields) {
31
+ ProgramLinksFields["PROGRAM"] = "program";
32
+ ProgramLinksFields["PRODUCTS"] = "products";
33
+ })(ProgramLinksFields = exports.ProgramLinksFields || (exports.ProgramLinksFields = {}));
34
+ var ProgramExtraInfoFields;
35
+ (function (ProgramExtraInfoFields) {
36
+ ProgramExtraInfoFields["RESELLER"] = "reseller";
37
+ ProgramExtraInfoFields["END_CUSTOMER"] = "endCustomer";
38
+ ProgramExtraInfoFields["ORDER"] = "order";
39
+ })(ProgramExtraInfoFields = exports.ProgramExtraInfoFields || (exports.ProgramExtraInfoFields = {}));
40
+ var ProgramExtraInfoItemFields;
41
+ (function (ProgramExtraInfoItemFields) {
42
+ ProgramExtraInfoItemFields["NAME"] = "name";
43
+ ProgramExtraInfoItemFields["LABEL"] = "label";
44
+ ProgramExtraInfoItemFields["TYPE"] = "type";
45
+ ProgramExtraInfoItemFields["REGEX"] = "regex";
46
+ ProgramExtraInfoItemFields["MANDATORY"] = "mandatory";
47
+ })(ProgramExtraInfoItemFields = exports.ProgramExtraInfoItemFields || (exports.ProgramExtraInfoItemFields = {}));
48
+ class Program extends abstractEntity_1.AbstractEntity {
49
+ constructor(input) {
50
+ super(input);
51
+ _reference.set(this, void 0);
52
+ _name.set(this, void 0);
53
+ _associatedSubscriptionProgram.set(this, void 0);
54
+ _logo.set(this, void 0);
55
+ _category.set(this, void 0);
56
+ _links.set(this, void 0);
57
+ _extraInformation.set(this, void 0);
58
+ __classPrivateFieldSet(this, _reference, input[ProgramFields.REFERENCE]);
59
+ __classPrivateFieldSet(this, _name, input[ProgramFields.NAME]);
60
+ __classPrivateFieldSet(this, _associatedSubscriptionProgram, input[ProgramFields.ASSOCIATED_SUBSCRIPTION_PROGRAM]);
61
+ __classPrivateFieldSet(this, _logo, input[ProgramFields.LOGO]);
62
+ __classPrivateFieldSet(this, _category, input[ProgramFields.CATEGORY]);
63
+ __classPrivateFieldSet(this, _links, input[ProgramFields.LINKS]);
64
+ __classPrivateFieldSet(this, _extraInformation, input[ProgramFields.EXTRA_INFORMATION]);
65
+ }
66
+ get reference() {
67
+ return __classPrivateFieldGet(this, _reference);
68
+ }
69
+ get name() {
70
+ return __classPrivateFieldGet(this, _name);
71
+ }
72
+ get associatedSubscriptionProgram() {
73
+ return __classPrivateFieldGet(this, _associatedSubscriptionProgram);
74
+ }
75
+ get logo() {
76
+ return __classPrivateFieldGet(this, _logo);
77
+ }
78
+ get category() {
79
+ return __classPrivateFieldGet(this, _category);
80
+ }
81
+ get links() {
82
+ return __classPrivateFieldGet(this, _links);
83
+ }
84
+ get extraInformation() {
85
+ return __classPrivateFieldGet(this, _extraInformation);
86
+ }
87
+ toJSON() {
88
+ return {
89
+ [ProgramFields.REFERENCE]: this.reference,
90
+ [ProgramFields.NAME]: this.name,
91
+ [ProgramFields.ASSOCIATED_SUBSCRIPTION_PROGRAM]: this
92
+ .associatedSubscriptionProgram,
93
+ [ProgramFields.LOGO]: this.logo,
94
+ [ProgramFields.CATEGORY]: this.category,
95
+ [ProgramFields.LINKS]: this.links,
96
+ [ProgramFields.EXTRA_INFORMATION]: this.extraInformation,
97
+ };
98
+ }
99
+ }
100
+ exports.Program = Program;
101
+ _reference = new WeakMap(), _name = new WeakMap(), _associatedSubscriptionProgram = new WeakMap(), _logo = new WeakMap(), _category = new WeakMap(), _links = new WeakMap(), _extraInformation = new WeakMap();
102
+ //# sourceMappingURL=program.js.map
@@ -0,0 +1,9 @@
1
+ import { AbstractEntity } from '../../abstractEntity';
2
+ import { Program, ProgramType } from './program';
3
+ export declare type ProgramsType = Array<ProgramType>;
4
+ export declare class Programs extends AbstractEntity<ProgramsType> {
5
+ #private;
6
+ constructor(input: ProgramsType);
7
+ get list(): Program[];
8
+ toJSON(): ProgramsType;
9
+ }
@@ -12,29 +12,24 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  }
13
13
  return privateMap.get(receiver);
14
14
  };
15
- var _total;
15
+ var _list;
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Total = exports.TotalFields = void 0;
17
+ exports.Programs = void 0;
18
18
  const abstractEntity_1 = require("../../abstractEntity");
19
- var TotalFields;
20
- (function (TotalFields) {
21
- TotalFields["COLUMN_TOTAL"] = "total";
22
- })(TotalFields = exports.TotalFields || (exports.TotalFields = {}));
23
- class Total extends abstractEntity_1.AbstractEntity {
24
- constructor(total) {
25
- super(total);
26
- _total.set(this, void 0);
27
- __classPrivateFieldSet(this, _total, total[TotalFields.COLUMN_TOTAL]);
19
+ const program_1 = require("./program");
20
+ class Programs extends abstractEntity_1.AbstractEntity {
21
+ constructor(input) {
22
+ super(input);
23
+ _list.set(this, void 0);
24
+ __classPrivateFieldSet(this, _list, input.map((input) => new program_1.Program(input)));
28
25
  }
29
- get total() {
30
- return __classPrivateFieldGet(this, _total);
26
+ get list() {
27
+ return __classPrivateFieldGet(this, _list);
31
28
  }
32
29
  toJSON() {
33
- return {
34
- [TotalFields.COLUMN_TOTAL]: this.total,
35
- };
30
+ return this.list.map((item) => item.toJSON());
36
31
  }
37
32
  }
38
- exports.Total = Total;
39
- _total = new WeakMap();
40
- //# sourceMappingURL=total.js.map
33
+ exports.Programs = Programs;
34
+ _list = new WeakMap();
35
+ //# sourceMappingURL=programs.js.map
@@ -1,2 +1,5 @@
1
1
  export * from './catalogGraphQLClient';
2
+ export * from './catalogClient';
2
3
  export * from './types/catalogGraphQLTypes';
4
+ export * from './entities/program';
5
+ export * from './entities/programs';
@@ -11,5 +11,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./catalogGraphQLClient"), exports);
14
+ __exportStar(require("./catalogClient"), exports);
14
15
  __exportStar(require("./types/catalogGraphQLTypes"), exports);
16
+ __exportStar(require("./entities/program"), exports);
17
+ __exportStar(require("./entities/programs"), exports);
15
18
  //# sourceMappingURL=index.js.map
@@ -55,7 +55,7 @@ export declare type ProductType = {
55
55
  xspUrl?: string;
56
56
  saleConstraints?: SaleConstraintsType;
57
57
  vendor?: VendorType;
58
- program?: ProgramType;
58
+ program?: GraphqlProgramType;
59
59
  weightTopSales?: number;
60
60
  weightForced?: number;
61
61
  priceBand?: Array<PriceBandType>;
@@ -130,7 +130,7 @@ export declare type SaleConstraintsType = {
130
130
  export declare type VendorType = {
131
131
  name?: string;
132
132
  };
133
- export declare type ProgramType = {
133
+ export declare type GraphqlProgramType = {
134
134
  isEnabled?: boolean;
135
135
  legacyCode?: string;
136
136
  names?: ProgramNameType;
package/build/index.d.ts CHANGED
@@ -12,7 +12,6 @@ export * from './general/';
12
12
  export * from './getResult';
13
13
  export * from './pagination';
14
14
  export * from './licenses/';
15
- export * from './notifications/';
16
15
  export * from './orders/';
17
16
  export * from './publicApiClient';
18
17
  export * from './publicGraphQLClient';
package/build/index.js CHANGED
@@ -37,7 +37,6 @@ __exportStar(require("./general/"), exports);
37
37
  __exportStar(require("./getResult"), exports);
38
38
  __exportStar(require("./pagination"), exports);
39
39
  __exportStar(require("./licenses/"), exports);
40
- __exportStar(require("./notifications/"), exports);
41
40
  __exportStar(require("./orders/"), exports);
42
41
  __exportStar(require("./publicApiClient"), exports);
43
42
  __exportStar(require("./publicGraphQLClient"), exports);
@@ -11,7 +11,7 @@ import { StandardsClient } from './security/standards/standardsClient';
11
11
  import { RegisterClient } from './security';
12
12
  import { CartClient } from './cart/cartClient';
13
13
  import { SupportCenterClient } from './supportCenter';
14
- import { NotificationsClient } from './notifications';
14
+ import { CatalogClient } from './catalog';
15
15
  /**
16
16
  * Public API Client class, should be the main entry point for your calls
17
17
  */
@@ -62,6 +62,6 @@ export declare class PublicApiClient extends AbstractClient {
62
62
  getSecurityRegisterClient(): RegisterClient;
63
63
  getCartClient(): CartClient;
64
64
  getSupportCenterClient(): SupportCenterClient;
65
- getNotificationsClient(): NotificationsClient;
65
+ getCatalogClient(): CatalogClient;
66
66
  }
67
67
  export default PublicApiClient;
@@ -14,7 +14,7 @@ const standardsClient_1 = require("./security/standards/standardsClient");
14
14
  const security_1 = require("./security");
15
15
  const cartClient_1 = require("./cart/cartClient");
16
16
  const supportCenter_1 = require("./supportCenter");
17
- const notifications_1 = require("./notifications");
17
+ const catalog_1 = require("./catalog");
18
18
  /**
19
19
  * Public API Client class, should be the main entry point for your calls
20
20
  */
@@ -132,10 +132,10 @@ class PublicApiClient extends abstractClient_1.AbstractClient {
132
132
  .setApiKey(this.apiKey)
133
133
  .setHeaders(this.headers);
134
134
  }
135
- getNotificationsClient() {
136
- return new notifications_1.NotificationsClient()
135
+ getCatalogClient() {
136
+ return new catalog_1.CatalogClient()
137
137
  .setUrl(this.url)
138
- .setToken(this.token)
138
+ .setApiKey(this.apiKey)
139
139
  .setHeaders(this.headers);
140
140
  }
141
141
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/ArrowSphere/nodejs-api-client.git"
6
6
  },
7
- "version": "3.28.0-rc.fdi.1",
7
+ "version": "3.28.0",
8
8
  "description": "Node.js client for ArrowSphere's public API",
9
9
  "main": "build/index.js",
10
10
  "types": "build/index.d.ts",
@@ -1,31 +0,0 @@
1
- import { AbstractEntity } from '../../../abstractEntity';
2
- export declare enum NotificationDetailsFields {
3
- COLUMN_ID = "id",
4
- COLUMN_USERNAME = "userName",
5
- COLUMN_CREATED = "created",
6
- COLUMN_EXPIRES = "expires",
7
- COLUMN_SUBJECT = "subject",
8
- COLUMN_CONTENT = "content",
9
- COLUMN_HAS_BEEN_READ = "hasBeenRead"
10
- }
11
- export declare type NotificationDetailsType = {
12
- [NotificationDetailsFields.COLUMN_ID]: string;
13
- [NotificationDetailsFields.COLUMN_USERNAME]: string;
14
- [NotificationDetailsFields.COLUMN_CREATED]: number;
15
- [NotificationDetailsFields.COLUMN_EXPIRES]: number;
16
- [NotificationDetailsFields.COLUMN_SUBJECT]: string;
17
- [NotificationDetailsFields.COLUMN_CONTENT]: string;
18
- [NotificationDetailsFields.COLUMN_HAS_BEEN_READ]: number;
19
- };
20
- export declare class NotificationDetails extends AbstractEntity<NotificationDetailsType> {
21
- #private;
22
- constructor(notification: NotificationDetailsType);
23
- get id(): string;
24
- get userName(): string;
25
- get created(): number;
26
- get expires(): number;
27
- get subject(): string;
28
- get content(): string;
29
- get hasBeenRead(): number;
30
- toJSON(): NotificationDetailsType;
31
- }
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to set private field on non-instance");
5
- }
6
- privateMap.set(receiver, value);
7
- return value;
8
- };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to get private field on non-instance");
12
- }
13
- return privateMap.get(receiver);
14
- };
15
- var _id, _userName, _created, _expires, _subject, _content, _hasBeenRead;
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.NotificationDetails = exports.NotificationDetailsFields = void 0;
18
- const abstractEntity_1 = require("../../../abstractEntity");
19
- var NotificationDetailsFields;
20
- (function (NotificationDetailsFields) {
21
- NotificationDetailsFields["COLUMN_ID"] = "id";
22
- NotificationDetailsFields["COLUMN_USERNAME"] = "userName";
23
- NotificationDetailsFields["COLUMN_CREATED"] = "created";
24
- NotificationDetailsFields["COLUMN_EXPIRES"] = "expires";
25
- NotificationDetailsFields["COLUMN_SUBJECT"] = "subject";
26
- NotificationDetailsFields["COLUMN_CONTENT"] = "content";
27
- NotificationDetailsFields["COLUMN_HAS_BEEN_READ"] = "hasBeenRead";
28
- })(NotificationDetailsFields = exports.NotificationDetailsFields || (exports.NotificationDetailsFields = {}));
29
- class NotificationDetails extends abstractEntity_1.AbstractEntity {
30
- constructor(notification) {
31
- super(notification);
32
- _id.set(this, void 0);
33
- _userName.set(this, void 0);
34
- _created.set(this, void 0);
35
- _expires.set(this, void 0);
36
- _subject.set(this, void 0);
37
- _content.set(this, void 0);
38
- _hasBeenRead.set(this, void 0);
39
- __classPrivateFieldSet(this, _id, notification[NotificationDetailsFields.COLUMN_ID]);
40
- __classPrivateFieldSet(this, _userName, notification[NotificationDetailsFields.COLUMN_USERNAME]);
41
- __classPrivateFieldSet(this, _created, notification[NotificationDetailsFields.COLUMN_CREATED]);
42
- __classPrivateFieldSet(this, _expires, notification[NotificationDetailsFields.COLUMN_EXPIRES]);
43
- __classPrivateFieldSet(this, _subject, notification[NotificationDetailsFields.COLUMN_SUBJECT]);
44
- __classPrivateFieldSet(this, _content, notification[NotificationDetailsFields.COLUMN_CONTENT]);
45
- __classPrivateFieldSet(this, _hasBeenRead, notification[NotificationDetailsFields.COLUMN_HAS_BEEN_READ]);
46
- }
47
- get id() {
48
- return __classPrivateFieldGet(this, _id);
49
- }
50
- get userName() {
51
- return __classPrivateFieldGet(this, _userName);
52
- }
53
- get created() {
54
- return __classPrivateFieldGet(this, _created);
55
- }
56
- get expires() {
57
- return __classPrivateFieldGet(this, _expires);
58
- }
59
- get subject() {
60
- return __classPrivateFieldGet(this, _subject);
61
- }
62
- get content() {
63
- return __classPrivateFieldGet(this, _content);
64
- }
65
- get hasBeenRead() {
66
- return __classPrivateFieldGet(this, _hasBeenRead);
67
- }
68
- toJSON() {
69
- return {
70
- [NotificationDetailsFields.COLUMN_ID]: this.id,
71
- [NotificationDetailsFields.COLUMN_USERNAME]: this.userName,
72
- [NotificationDetailsFields.COLUMN_CREATED]: this.created,
73
- [NotificationDetailsFields.COLUMN_EXPIRES]: this.expires,
74
- [NotificationDetailsFields.COLUMN_SUBJECT]: this.subject,
75
- [NotificationDetailsFields.COLUMN_CONTENT]: this.content,
76
- [NotificationDetailsFields.COLUMN_HAS_BEEN_READ]: this.hasBeenRead,
77
- };
78
- }
79
- }
80
- exports.NotificationDetails = NotificationDetails;
81
- _id = new WeakMap(), _userName = new WeakMap(), _created = new WeakMap(), _expires = new WeakMap(), _subject = new WeakMap(), _content = new WeakMap(), _hasBeenRead = new WeakMap();
82
- //# sourceMappingURL=notificationDetails.js.map
@@ -1,14 +0,0 @@
1
- import { NotificationDetails, NotificationDetailsType } from './details/notificationDetails';
2
- import { AbstractEntity } from '../../abstractEntity';
3
- export declare enum NotificationFields {
4
- COLUMN_NOTIFICATION = "notification"
5
- }
6
- export declare type NotificationType = {
7
- [NotificationFields.COLUMN_NOTIFICATION]: NotificationDetailsType;
8
- };
9
- export declare class Notification extends AbstractEntity<NotificationType> {
10
- #private;
11
- constructor(notification: NotificationType);
12
- get notification(): NotificationDetails;
13
- toJSON(): NotificationType;
14
- }
@@ -1,41 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to set private field on non-instance");
5
- }
6
- privateMap.set(receiver, value);
7
- return value;
8
- };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to get private field on non-instance");
12
- }
13
- return privateMap.get(receiver);
14
- };
15
- var _notification;
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Notification = exports.NotificationFields = void 0;
18
- const notificationDetails_1 = require("./details/notificationDetails");
19
- const abstractEntity_1 = require("../../abstractEntity");
20
- var NotificationFields;
21
- (function (NotificationFields) {
22
- NotificationFields["COLUMN_NOTIFICATION"] = "notification";
23
- })(NotificationFields = exports.NotificationFields || (exports.NotificationFields = {}));
24
- class Notification extends abstractEntity_1.AbstractEntity {
25
- constructor(notification) {
26
- super(notification);
27
- _notification.set(this, void 0);
28
- __classPrivateFieldSet(this, _notification, new notificationDetails_1.NotificationDetails(notification[NotificationFields.COLUMN_NOTIFICATION]));
29
- }
30
- get notification() {
31
- return __classPrivateFieldGet(this, _notification);
32
- }
33
- toJSON() {
34
- return {
35
- [NotificationFields.COLUMN_NOTIFICATION]: this.notification.toJSON(),
36
- };
37
- }
38
- }
39
- exports.Notification = Notification;
40
- _notification = new WeakMap();
41
- //# sourceMappingURL=notification.js.map
@@ -1,14 +0,0 @@
1
- import { NotificationDetails, NotificationDetailsType } from './details/notificationDetails';
2
- import { AbstractEntity } from '../../abstractEntity';
3
- export declare enum NotificationsFields {
4
- COLUMN_NOTIFICATIONS = "notifications"
5
- }
6
- export declare type NotificationsType = {
7
- [NotificationsFields.COLUMN_NOTIFICATIONS]: NotificationDetailsType[];
8
- };
9
- export declare class Notifications extends AbstractEntity<NotificationsType> {
10
- #private;
11
- constructor(notification: NotificationsType);
12
- get notifications(): NotificationDetails[];
13
- toJSON(): NotificationsType;
14
- }
@@ -1,41 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to set private field on non-instance");
5
- }
6
- privateMap.set(receiver, value);
7
- return value;
8
- };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to get private field on non-instance");
12
- }
13
- return privateMap.get(receiver);
14
- };
15
- var _notifications;
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Notifications = exports.NotificationsFields = void 0;
18
- const notificationDetails_1 = require("./details/notificationDetails");
19
- const abstractEntity_1 = require("../../abstractEntity");
20
- var NotificationsFields;
21
- (function (NotificationsFields) {
22
- NotificationsFields["COLUMN_NOTIFICATIONS"] = "notifications";
23
- })(NotificationsFields = exports.NotificationsFields || (exports.NotificationsFields = {}));
24
- class Notifications extends abstractEntity_1.AbstractEntity {
25
- constructor(notification) {
26
- super(notification);
27
- _notifications.set(this, void 0);
28
- __classPrivateFieldSet(this, _notifications, notification[NotificationsFields.COLUMN_NOTIFICATIONS].map((notification) => new notificationDetails_1.NotificationDetails(notification)));
29
- }
30
- get notifications() {
31
- return __classPrivateFieldGet(this, _notifications);
32
- }
33
- toJSON() {
34
- return {
35
- [NotificationsFields.COLUMN_NOTIFICATIONS]: this.notifications.map((notification) => notification.toJSON()),
36
- };
37
- }
38
- }
39
- exports.Notifications = Notifications;
40
- _notifications = new WeakMap();
41
- //# sourceMappingURL=notifications.js.map
@@ -1,13 +0,0 @@
1
- import { AbstractEntity } from '../../abstractEntity';
2
- export declare enum TotalFields {
3
- COLUMN_TOTAL = "total"
4
- }
5
- export declare type TotalType = {
6
- [TotalFields.COLUMN_TOTAL]: number;
7
- };
8
- export declare class Total extends AbstractEntity<TotalType> {
9
- #private;
10
- constructor(total: TotalType);
11
- get total(): number;
12
- toJSON(): TotalType;
13
- }
@@ -1,5 +0,0 @@
1
- export * from './entities/details/notificationDetails';
2
- export * from './entities/notifications';
3
- export * from './entities/notification';
4
- export * from './entities/total';
5
- export * from './notificationsClient';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./entities/details/notificationDetails"), exports);
14
- __exportStar(require("./entities/notifications"), exports);
15
- __exportStar(require("./entities/notification"), exports);
16
- __exportStar(require("./entities/total"), exports);
17
- __exportStar(require("./notificationsClient"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1,39 +0,0 @@
1
- import { AbstractClient, Parameters, ParametersWithPaginationType, Payload } from '../abstractClient';
2
- import { GetResult } from '../getResult';
3
- import { Notifications } from './entities/notifications';
4
- import { Notification } from './entities/notification';
5
- import { Total } from './entities/total';
6
- export declare enum ListParametersFields {
7
- COLUMN_CREATED = "created",
8
- COLUMN_HAS_BEEN_READ = "hasBeenRead",
9
- COLUMN_SEARCH_AFTER = "searchAfter"
10
- }
11
- export declare type ListParametersType = ParametersWithPaginationType & {
12
- [ListParametersFields.COLUMN_CREATED]?: string;
13
- [ListParametersFields.COLUMN_HAS_BEEN_READ]?: string;
14
- [ListParametersFields.COLUMN_SEARCH_AFTER]?: string;
15
- };
16
- export declare enum CreatePayloadFields {
17
- COLUMN_USERNAME = "username",
18
- COLUMN_SUBJECT = "subject",
19
- COLUMN_CONTENT = "content"
20
- }
21
- export declare type CreatePayloadType = {
22
- [CreatePayloadFields.COLUMN_USERNAME]: string;
23
- [CreatePayloadFields.COLUMN_SUBJECT]: string;
24
- [CreatePayloadFields.COLUMN_CONTENT]: string;
25
- };
26
- export declare class NotificationsClient extends AbstractClient {
27
- /**
28
- * The base path of the API
29
- */
30
- protected basePath: string;
31
- list(parameters?: ListParametersType): Promise<GetResult<Notifications>>;
32
- create(payload: CreatePayloadType, parameters?: Parameters): Promise<GetResult<Notification>>;
33
- deleteAll(parameters?: Parameters): Promise<void>;
34
- getNotification(notificationId: string, parameters?: Parameters): Promise<GetResult<Notification>>;
35
- deleteNotification(notificationId: string, parameters?: Parameters): Promise<void>;
36
- readAll(payload?: Payload, parameters?: Parameters): Promise<void>;
37
- read(notificationId: string, payload?: Payload, parameters?: Parameters): Promise<void>;
38
- count(parameters?: Parameters): Promise<GetResult<Total>>;
39
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotificationsClient = exports.CreatePayloadFields = exports.ListParametersFields = void 0;
4
- const abstractClient_1 = require("../abstractClient");
5
- const getResult_1 = require("../getResult");
6
- const notifications_1 = require("./entities/notifications");
7
- const notification_1 = require("./entities/notification");
8
- const total_1 = require("./entities/total");
9
- var ListParametersFields;
10
- (function (ListParametersFields) {
11
- ListParametersFields["COLUMN_CREATED"] = "created";
12
- ListParametersFields["COLUMN_HAS_BEEN_READ"] = "hasBeenRead";
13
- ListParametersFields["COLUMN_SEARCH_AFTER"] = "searchAfter";
14
- })(ListParametersFields = exports.ListParametersFields || (exports.ListParametersFields = {}));
15
- var CreatePayloadFields;
16
- (function (CreatePayloadFields) {
17
- CreatePayloadFields["COLUMN_USERNAME"] = "username";
18
- CreatePayloadFields["COLUMN_SUBJECT"] = "subject";
19
- CreatePayloadFields["COLUMN_CONTENT"] = "content";
20
- })(CreatePayloadFields = exports.CreatePayloadFields || (exports.CreatePayloadFields = {}));
21
- class NotificationsClient extends abstractClient_1.AbstractClient {
22
- constructor() {
23
- super(...arguments);
24
- /**
25
- * The base path of the API
26
- */
27
- this.basePath = '/notification';
28
- }
29
- async list(parameters = {}) {
30
- return new getResult_1.GetResult(notifications_1.Notifications, await this.get(parameters));
31
- }
32
- async create(payload, parameters = {}) {
33
- return new getResult_1.GetResult(notification_1.Notification, await this.post(payload, parameters));
34
- }
35
- async deleteAll(parameters = {}) {
36
- return await this.delete(parameters);
37
- }
38
- async getNotification(notificationId, parameters = {}) {
39
- this.path = `${notificationId}`;
40
- return new getResult_1.GetResult(notification_1.Notification, await this.get(parameters));
41
- }
42
- async deleteNotification(notificationId, parameters = {}) {
43
- this.path = `${notificationId}`;
44
- return await this.delete(parameters);
45
- }
46
- async readAll(payload = {}, parameters = {}) {
47
- this.path = '/read';
48
- return await this.patch(payload, parameters);
49
- }
50
- async read(notificationId, payload = {}, parameters = {}) {
51
- this.path = `/${notificationId}/read`;
52
- return await this.patch(payload, parameters);
53
- }
54
- async count(parameters = {}) {
55
- this.path = '/count';
56
- return new getResult_1.GetResult(total_1.Total, await this.get(parameters));
57
- }
58
- }
59
- exports.NotificationsClient = NotificationsClient;
60
- //# sourceMappingURL=notificationsClient.js.map