@arrowsphere/api-client 3.34.0-rc.bdj.1 → 3.35.0-rc-jpb.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/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
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
+
7
+ ## [3.35.0] - 2023-06-08
8
+
9
+ ### Changed
10
+
11
+ - Conditional logging of request and response
12
+
13
+ ## [3.34.0] - 2023-05-10
14
+
15
+ ### Changed
16
+
17
+ - add notification endpoint
18
+
6
19
  ## [3.33.0] - 2023-05-26
7
20
 
8
21
  ### Changed
@@ -50,6 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
50
63
 
51
64
  ## [3.27.0] - 2023-05-10
52
65
 
66
+ ### Changed
67
+
53
68
  - update create order client to add attributes for injection scenario
54
69
 
55
70
  ## [3.26.0] - 2023-04-20
@@ -7,6 +7,7 @@ export declare enum ParameterKeys {
7
7
  API_KEY = "apiKey",
8
8
  AUTHORIZATION = "Authorization",
9
9
  HEADERS = "headers",
10
+ IS_LOGGING = "is_logging",
10
11
  ORDER_BY = "order_by",
11
12
  PAGE = "page",
12
13
  PER_PAGE = "per_page",
@@ -32,6 +33,7 @@ export declare type Options = {
32
33
  export declare type ConfigurationsClient = {
33
34
  [ParameterKeys.API_KEY]?: string;
34
35
  [ParameterKeys.URL]?: string;
36
+ [ParameterKeys.IS_LOGGING]?: boolean;
35
37
  [ParameterKeys.HEADERS]?: Headers;
36
38
  };
37
39
  export declare type ExtraInformationType = {
@@ -17,6 +17,7 @@ var ParameterKeys;
17
17
  ParameterKeys["API_KEY"] = "apiKey";
18
18
  ParameterKeys["AUTHORIZATION"] = "Authorization";
19
19
  ParameterKeys["HEADERS"] = "headers";
20
+ ParameterKeys["IS_LOGGING"] = "is_logging";
20
21
  ParameterKeys["ORDER_BY"] = "order_by";
21
22
  ParameterKeys["PAGE"] = "page";
22
23
  ParameterKeys["PER_PAGE"] = "per_page";
@@ -52,7 +53,11 @@ class AbstractRestfulClient extends AbstractHttpClient_1.AbstractHttpClient {
52
53
  * Defines whether the pagination options are camel cased or not
53
54
  */
54
55
  this.isCamelPagination = false;
55
- this.client = axiosSingleton_1.AxiosSingleton.getInstance();
56
+ this.client = axiosSingleton_1.AxiosSingleton.getInstance({
57
+ isLogging: configuration
58
+ ? !!configuration[ParameterKeys.IS_LOGGING]
59
+ : false,
60
+ });
56
61
  this.setApiKey((_a = configuration === null || configuration === void 0 ? void 0 : configuration[ParameterKeys.API_KEY]) !== null && _a !== void 0 ? _a : '');
57
62
  this.setUrl((_b = configuration === null || configuration === void 0 ? void 0 : configuration[ParameterKeys.URL]) !== null && _b !== void 0 ? _b : '');
58
63
  this.setHeaders((_c = configuration === null || configuration === void 0 ? void 0 : configuration[ParameterKeys.HEADERS]) !== null && _c !== void 0 ? _c : {});
@@ -1,15 +1,21 @@
1
1
  import { AxiosInstance } from 'axios';
2
+ export declare type AxiosSingletonConfiguration = {
3
+ isLogging?: boolean;
4
+ };
2
5
  export declare class AxiosSingleton {
3
6
  private static _axiosInstance;
4
- static getInstance(): AxiosInstance;
7
+ private static _isLogging;
8
+ static getInstance(configuration?: AxiosSingletonConfiguration): AxiosInstance;
5
9
  private static _initializedRequestInterceptor;
6
10
  private static _initializedResponseInterceptor;
7
11
  /**
8
12
  * @param request - Axios Request
13
+ * @param isLogging - Must log
9
14
  */
10
15
  private static _handleRequest;
11
16
  /**
12
17
  * @param response - Axios Response
18
+ * @param isLogging - Must log
13
19
  */
14
20
  private static _handleResponse;
15
21
  /**
@@ -7,8 +7,9 @@ exports.AxiosSingleton = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
8
  const lodash_1 = require("lodash");
9
9
  class AxiosSingleton {
10
- static getInstance() {
10
+ static getInstance(configuration = {}) {
11
11
  if (!AxiosSingleton._axiosInstance) {
12
+ this._isLogging = !!configuration.isLogging;
12
13
  AxiosSingleton._axiosInstance = axios_1.default.create();
13
14
  AxiosSingleton._initializedRequestInterceptor();
14
15
  AxiosSingleton._initializedResponseInterceptor();
@@ -17,48 +18,59 @@ class AxiosSingleton {
17
18
  return AxiosSingleton._axiosInstance;
18
19
  }
19
20
  static _initializedRequestInterceptor() {
20
- this._axiosInstance.interceptors.request.use(this._handleRequest);
21
+ this._axiosInstance.interceptors.request.use((req) => this._handleRequest(req, this._isLogging));
21
22
  }
22
23
  static _initializedResponseInterceptor() {
23
- this._axiosInstance.interceptors.response.use(this._handleResponse);
24
+ this._axiosInstance.interceptors.response.use((req) => this._handleResponse(req, this._isLogging));
24
25
  }
25
26
  /**
26
27
  * @param request - Axios Request
28
+ * @param isLogging - Must log
27
29
  */
28
- static _handleRequest(request) {
29
- console.info('AXIOS - Request : ', AxiosSingleton.cleanRequestLog(request));
30
+ static _handleRequest(request, isLogging = false) {
31
+ if (isLogging) {
32
+ console.info('AXIOS - Request : ', AxiosSingleton.cleanRequestLog(request));
33
+ }
30
34
  return request;
31
35
  }
32
36
  /**
33
37
  * @param response - Axios Response
38
+ * @param isLogging - Must log
34
39
  */
35
- static _handleResponse(response) {
36
- console.info('AXIOS - Response : ', AxiosSingleton.cleanResponseLog(response));
40
+ static _handleResponse(response, isLogging = false) {
41
+ if (isLogging) {
42
+ console.info('AXIOS - Response : ', AxiosSingleton.cleanResponseLog(response));
43
+ }
37
44
  return response;
38
45
  }
39
46
  /**
40
47
  * @param request - Axios Request
41
48
  */
42
49
  static cleanRequestLog(request) {
43
- var _a;
50
+ var _a, _b;
44
51
  const tempRequest = (0, lodash_1.cloneDeep)(request);
45
- // coverage bug delete undefined element
46
- /* istanbul ignore next */
47
- (_a = tempRequest.headers) === null || _a === void 0 ? true : delete _a.apiKey;
52
+ if ((_a = tempRequest.headers) === null || _a === void 0 ? void 0 : _a.apiKey) {
53
+ const apiKey = (_b = tempRequest.headers) === null || _b === void 0 ? void 0 : _b.apiKey;
54
+ tempRequest.headers.apiKey =
55
+ '****************************' + apiKey.substring(apiKey.length - 4);
56
+ }
48
57
  return tempRequest;
49
58
  }
50
59
  /**
51
60
  * @param response - Axios Response
52
61
  */
53
62
  static cleanResponseLog(response) {
54
- var _a;
63
+ var _a, _b;
55
64
  const tempResponse = (0, lodash_1.cloneDeep)(response);
56
- // coverage bug delete undefined element
57
- /* istanbul ignore next */
58
- (_a = tempResponse.config.headers) === null || _a === void 0 ? true : delete _a.apiKey;
65
+ if ((_a = tempResponse.config.headers) === null || _a === void 0 ? void 0 : _a.apiKey) {
66
+ const apiKey = (_b = tempResponse.config.headers) === null || _b === void 0 ? void 0 : _b.apiKey;
67
+ tempResponse.config.headers.apiKey =
68
+ '****************************' + apiKey.substring(apiKey.length - 4);
69
+ }
59
70
  delete tempResponse.request;
60
71
  return tempResponse;
61
72
  }
62
73
  }
63
74
  exports.AxiosSingleton = AxiosSingleton;
75
+ AxiosSingleton._isLogging = false;
64
76
  //# sourceMappingURL=axiosSingleton.js.map
@@ -14,6 +14,7 @@ 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';
17
18
  export { AssetsCampaignAssets };
18
19
  export * from './entities/campaignAssets/campaignAssets';
19
20
  export * from './campaignClient';
@@ -44,6 +44,7 @@ __exportStar(require("./entities/v2/campaign/landingPage/landingPageFooter/landi
44
44
  __exportStar(require("./entities/v2/campaign/landingPage/landingPage"), exports);
45
45
  __exportStar(require("./entities/v2/campaign/landingPage/landingPageHeader"), exports);
46
46
  __exportStar(require("./entities/v2/campaign/campaign"), exports);
47
+ __exportStar(require("./entities/v2/campaignList"), exports);
47
48
  __exportStar(require("./entities/campaignAssets/campaignAssets"), exports);
48
49
  __exportStar(require("./campaignClient"), exports);
49
50
  //# sourceMappingURL=index.js.map
package/build/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export * from './general/';
12
12
  export * from './getResult';
13
13
  export * from './pagination';
14
14
  export * from './licenses/';
15
+ export * from './notifications/';
15
16
  export * from './orders/';
16
17
  export * from './publicApiClient';
17
18
  export * from './publicGraphQLClient';
package/build/index.js CHANGED
@@ -41,6 +41,7 @@ __exportStar(require("./general/"), exports);
41
41
  __exportStar(require("./getResult"), exports);
42
42
  __exportStar(require("./pagination"), exports);
43
43
  __exportStar(require("./licenses/"), exports);
44
+ __exportStar(require("./notifications/"), exports);
44
45
  __exportStar(require("./orders/"), exports);
45
46
  __exportStar(require("./publicApiClient"), exports);
46
47
  __exportStar(require("./publicGraphQLClient"), exports);
@@ -0,0 +1,31 @@
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
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _NotificationDetails_id, _NotificationDetails_userName, _NotificationDetails_created, _NotificationDetails_expires, _NotificationDetails_subject, _NotificationDetails_content, _NotificationDetails_hasBeenRead;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.NotificationDetails = exports.NotificationDetailsFields = void 0;
16
+ const abstractEntity_1 = require("../../../abstractEntity");
17
+ var NotificationDetailsFields;
18
+ (function (NotificationDetailsFields) {
19
+ NotificationDetailsFields["COLUMN_ID"] = "id";
20
+ NotificationDetailsFields["COLUMN_USERNAME"] = "userName";
21
+ NotificationDetailsFields["COLUMN_CREATED"] = "created";
22
+ NotificationDetailsFields["COLUMN_EXPIRES"] = "expires";
23
+ NotificationDetailsFields["COLUMN_SUBJECT"] = "subject";
24
+ NotificationDetailsFields["COLUMN_CONTENT"] = "content";
25
+ NotificationDetailsFields["COLUMN_HAS_BEEN_READ"] = "hasBeenRead";
26
+ })(NotificationDetailsFields = exports.NotificationDetailsFields || (exports.NotificationDetailsFields = {}));
27
+ class NotificationDetails extends abstractEntity_1.AbstractEntity {
28
+ constructor(notification) {
29
+ super(notification);
30
+ _NotificationDetails_id.set(this, void 0);
31
+ _NotificationDetails_userName.set(this, void 0);
32
+ _NotificationDetails_created.set(this, void 0);
33
+ _NotificationDetails_expires.set(this, void 0);
34
+ _NotificationDetails_subject.set(this, void 0);
35
+ _NotificationDetails_content.set(this, void 0);
36
+ _NotificationDetails_hasBeenRead.set(this, void 0);
37
+ __classPrivateFieldSet(this, _NotificationDetails_id, notification[NotificationDetailsFields.COLUMN_ID], "f");
38
+ __classPrivateFieldSet(this, _NotificationDetails_userName, notification[NotificationDetailsFields.COLUMN_USERNAME], "f");
39
+ __classPrivateFieldSet(this, _NotificationDetails_created, notification[NotificationDetailsFields.COLUMN_CREATED], "f");
40
+ __classPrivateFieldSet(this, _NotificationDetails_expires, notification[NotificationDetailsFields.COLUMN_EXPIRES], "f");
41
+ __classPrivateFieldSet(this, _NotificationDetails_subject, notification[NotificationDetailsFields.COLUMN_SUBJECT], "f");
42
+ __classPrivateFieldSet(this, _NotificationDetails_content, notification[NotificationDetailsFields.COLUMN_CONTENT], "f");
43
+ __classPrivateFieldSet(this, _NotificationDetails_hasBeenRead, notification[NotificationDetailsFields.COLUMN_HAS_BEEN_READ], "f");
44
+ }
45
+ get id() {
46
+ return __classPrivateFieldGet(this, _NotificationDetails_id, "f");
47
+ }
48
+ get userName() {
49
+ return __classPrivateFieldGet(this, _NotificationDetails_userName, "f");
50
+ }
51
+ get created() {
52
+ return __classPrivateFieldGet(this, _NotificationDetails_created, "f");
53
+ }
54
+ get expires() {
55
+ return __classPrivateFieldGet(this, _NotificationDetails_expires, "f");
56
+ }
57
+ get subject() {
58
+ return __classPrivateFieldGet(this, _NotificationDetails_subject, "f");
59
+ }
60
+ get content() {
61
+ return __classPrivateFieldGet(this, _NotificationDetails_content, "f");
62
+ }
63
+ get hasBeenRead() {
64
+ return __classPrivateFieldGet(this, _NotificationDetails_hasBeenRead, "f");
65
+ }
66
+ toJSON() {
67
+ return {
68
+ [NotificationDetailsFields.COLUMN_ID]: this.id,
69
+ [NotificationDetailsFields.COLUMN_USERNAME]: this.userName,
70
+ [NotificationDetailsFields.COLUMN_CREATED]: this.created,
71
+ [NotificationDetailsFields.COLUMN_EXPIRES]: this.expires,
72
+ [NotificationDetailsFields.COLUMN_SUBJECT]: this.subject,
73
+ [NotificationDetailsFields.COLUMN_CONTENT]: this.content,
74
+ [NotificationDetailsFields.COLUMN_HAS_BEEN_READ]: this.hasBeenRead,
75
+ };
76
+ }
77
+ }
78
+ exports.NotificationDetails = NotificationDetails;
79
+ _NotificationDetails_id = new WeakMap(), _NotificationDetails_userName = new WeakMap(), _NotificationDetails_created = new WeakMap(), _NotificationDetails_expires = new WeakMap(), _NotificationDetails_subject = new WeakMap(), _NotificationDetails_content = new WeakMap(), _NotificationDetails_hasBeenRead = new WeakMap();
80
+ //# sourceMappingURL=notificationDetails.js.map
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _Notification_notification;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Notification = exports.NotificationFields = void 0;
16
+ const notificationDetails_1 = require("./details/notificationDetails");
17
+ const abstractEntity_1 = require("../../abstractEntity");
18
+ var NotificationFields;
19
+ (function (NotificationFields) {
20
+ NotificationFields["COLUMN_NOTIFICATION"] = "notification";
21
+ })(NotificationFields = exports.NotificationFields || (exports.NotificationFields = {}));
22
+ class Notification extends abstractEntity_1.AbstractEntity {
23
+ constructor(notification) {
24
+ super(notification);
25
+ _Notification_notification.set(this, void 0);
26
+ __classPrivateFieldSet(this, _Notification_notification, new notificationDetails_1.NotificationDetails(notification[NotificationFields.COLUMN_NOTIFICATION]), "f");
27
+ }
28
+ get notification() {
29
+ return __classPrivateFieldGet(this, _Notification_notification, "f");
30
+ }
31
+ toJSON() {
32
+ return {
33
+ [NotificationFields.COLUMN_NOTIFICATION]: this.notification.toJSON(),
34
+ };
35
+ }
36
+ }
37
+ exports.Notification = Notification;
38
+ _Notification_notification = new WeakMap();
39
+ //# sourceMappingURL=notification.js.map
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _Notifications_notifications;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Notifications = exports.NotificationsFields = void 0;
16
+ const notificationDetails_1 = require("./details/notificationDetails");
17
+ const abstractEntity_1 = require("../../abstractEntity");
18
+ var NotificationsFields;
19
+ (function (NotificationsFields) {
20
+ NotificationsFields["COLUMN_NOTIFICATIONS"] = "notifications";
21
+ })(NotificationsFields = exports.NotificationsFields || (exports.NotificationsFields = {}));
22
+ class Notifications extends abstractEntity_1.AbstractEntity {
23
+ constructor(notification) {
24
+ super(notification);
25
+ _Notifications_notifications.set(this, void 0);
26
+ __classPrivateFieldSet(this, _Notifications_notifications, notification[NotificationsFields.COLUMN_NOTIFICATIONS].map((notification) => new notificationDetails_1.NotificationDetails(notification)), "f");
27
+ }
28
+ get notifications() {
29
+ return __classPrivateFieldGet(this, _Notifications_notifications, "f");
30
+ }
31
+ toJSON() {
32
+ return {
33
+ [NotificationsFields.COLUMN_NOTIFICATIONS]: this.notifications.map((notification) => notification.toJSON()),
34
+ };
35
+ }
36
+ }
37
+ exports.Notifications = Notifications;
38
+ _Notifications_notifications = new WeakMap();
39
+ //# sourceMappingURL=notifications.js.map
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _Total_total;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Total = exports.TotalFields = void 0;
16
+ const abstractEntity_1 = require("../../abstractEntity");
17
+ var TotalFields;
18
+ (function (TotalFields) {
19
+ TotalFields["COLUMN_TOTAL"] = "total";
20
+ })(TotalFields = exports.TotalFields || (exports.TotalFields = {}));
21
+ class Total extends abstractEntity_1.AbstractEntity {
22
+ constructor(total) {
23
+ super(total);
24
+ _Total_total.set(this, void 0);
25
+ __classPrivateFieldSet(this, _Total_total, total[TotalFields.COLUMN_TOTAL], "f");
26
+ }
27
+ get total() {
28
+ return __classPrivateFieldGet(this, _Total_total, "f");
29
+ }
30
+ toJSON() {
31
+ return {
32
+ [TotalFields.COLUMN_TOTAL]: this.total,
33
+ };
34
+ }
35
+ }
36
+ exports.Total = Total;
37
+ _Total_total = new WeakMap();
38
+ //# sourceMappingURL=total.js.map
@@ -0,0 +1,5 @@
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';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./entities/details/notificationDetails"), exports);
18
+ __exportStar(require("./entities/notifications"), exports);
19
+ __exportStar(require("./entities/notification"), exports);
20
+ __exportStar(require("./entities/total"), exports);
21
+ __exportStar(require("./notificationsClient"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,38 @@
1
+ import { AbstractRestfulClient, Parameters, ParametersWithPaginationType, Payload } from '../abstractRestfulClient';
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 AbstractRestfulClient {
27
+ /**
28
+ * The base path of the API
29
+ */
30
+ protected basePath: string;
31
+ list(parameters?: ListParametersType): Promise<GetResult<Notifications>>;
32
+ deleteAll(parameters?: Parameters): Promise<void>;
33
+ getOne(notificationId: string, parameters?: Parameters): Promise<GetResult<Notification>>;
34
+ deleteOne(notificationId: string, parameters?: Parameters): Promise<void>;
35
+ readAll(payload?: Payload, parameters?: Parameters): Promise<void>;
36
+ readOne(notificationId: string, payload?: Payload, parameters?: Parameters): Promise<void>;
37
+ count(parameters?: Parameters): Promise<GetResult<Total>>;
38
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationsClient = exports.CreatePayloadFields = exports.ListParametersFields = void 0;
4
+ const abstractRestfulClient_1 = require("../abstractRestfulClient");
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 abstractRestfulClient_1.AbstractRestfulClient {
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 deleteAll(parameters = {}) {
33
+ return await this.delete(parameters);
34
+ }
35
+ async getOne(notificationId, parameters = {}) {
36
+ this.path = `${notificationId}`;
37
+ return new getResult_1.GetResult(notification_1.Notification, await this.get(parameters));
38
+ }
39
+ async deleteOne(notificationId, parameters = {}) {
40
+ this.path = `${notificationId}`;
41
+ return await this.delete(parameters);
42
+ }
43
+ async readAll(payload = {}, parameters = {}) {
44
+ this.path = '/read';
45
+ return await this.patch(payload, parameters);
46
+ }
47
+ async readOne(notificationId, payload = {}, parameters = {}) {
48
+ this.path = `/${notificationId}/read`;
49
+ return await this.patch(payload, parameters);
50
+ }
51
+ async count(parameters = {}) {
52
+ this.path = '/count';
53
+ return new getResult_1.GetResult(total_1.Total, await this.get(parameters));
54
+ }
55
+ }
56
+ exports.NotificationsClient = NotificationsClient;
57
+ //# sourceMappingURL=notificationsClient.js.map
@@ -1,4 +1,4 @@
1
- import { AbstractRestfulClient } from './abstractRestfulClient';
1
+ import { AbstractRestfulClient, ConfigurationsClient } from './abstractRestfulClient';
2
2
  import { CheckDomainClient, WhoAmIClient } from './general';
3
3
  import { LicensesClient } from './licenses';
4
4
  import { SubscriptionsClient } from './subscriptions';
@@ -13,6 +13,7 @@ import { CartClient } from './cart/cartClient';
13
13
  import { SupportCenterClient } from './supportCenter';
14
14
  import { CatalogClient } from './catalog';
15
15
  import { UserClient } from './user';
16
+ import { NotificationsClient } from './notifications';
16
17
  /**
17
18
  * Public API Client class, should be the main entry point for your calls
18
19
  */
@@ -22,48 +23,49 @@ export declare class PublicApiClient extends AbstractRestfulClient {
22
23
  * Creates a new {@link CustomersClient} instance and returns it
23
24
  * @returns {@link CustomersClient}
24
25
  */
25
- getCustomersClient(): CustomersClient;
26
+ getCustomersClient(configuration?: ConfigurationsClient): CustomersClient;
26
27
  /**
27
28
  * Creates a new {@link WhoAmIClient} instance and returns it
28
29
  * @returns {@link WhoAmIClient}
29
30
  */
30
- getWhoamiClient(): WhoAmIClient;
31
+ getWhoamiClient(configuration?: ConfigurationsClient): WhoAmIClient;
31
32
  /**
32
33
  * Creates a new {@link LicensesClient} instance and returns it
33
34
  * @returns {@link LicensesClient}
34
35
  */
35
- getLicensesClient(): LicensesClient;
36
+ getLicensesClient(configuration?: ConfigurationsClient): LicensesClient;
36
37
  /**
37
38
  * Creates a new {@link CheckDomainClient} instance and returns it
38
39
  * @returns {@link CheckDomainClient}
39
40
  */
40
- getCheckDomainClient(): CheckDomainClient;
41
+ getCheckDomainClient(configuration?: ConfigurationsClient): CheckDomainClient;
41
42
  /**
42
43
  * Creates a new {@link SubscriptionsClient} instance and returns it
43
44
  * @returns {@link SubscriptionsClient}
44
45
  */
45
- getSubscriptionsClient(): SubscriptionsClient;
46
+ getSubscriptionsClient(configuration?: ConfigurationsClient): SubscriptionsClient;
46
47
  /**
47
48
  * Creates a new {@link OrdersClient} instance and returns it
48
49
  * @returns {@link OrdersClient}
49
50
  */
50
- getOrdersClient(): OrdersClient;
51
+ getOrdersClient(configuration?: ConfigurationsClient): OrdersClient;
51
52
  /**
52
53
  * Creates a new {@link ContactClient} instance and returns it
53
54
  * @returns {@link ContactClient}
54
55
  */
55
- getContactClient(): ContactClient;
56
+ getContactClient(configuration?: ConfigurationsClient): ContactClient;
56
57
  /**
57
58
  * Creates a new {@link ContactClient} instance and returns it
58
59
  * @returns {@link ContactClient}
59
60
  */
60
- getCampaignClient(): CampaignClient;
61
- getConsumptionClient(): ConsumptionClient;
62
- getSecurityStandardsClient(): StandardsClient;
63
- getSecurityRegisterClient(): RegisterClient;
64
- getCartClient(): CartClient;
65
- getSupportCenterClient(): SupportCenterClient;
66
- getCatalogClient(): CatalogClient;
67
- getUserClient(): UserClient;
61
+ getCampaignClient(configuration?: ConfigurationsClient): CampaignClient;
62
+ getConsumptionClient(configuration?: ConfigurationsClient): ConsumptionClient;
63
+ getSecurityStandardsClient(configuration?: ConfigurationsClient): StandardsClient;
64
+ getSecurityRegisterClient(configuration?: ConfigurationsClient): RegisterClient;
65
+ getCartClient(configuration?: ConfigurationsClient): CartClient;
66
+ getSupportCenterClient(configuration?: ConfigurationsClient): SupportCenterClient;
67
+ getCatalogClient(configuration?: ConfigurationsClient): CatalogClient;
68
+ getUserClient(configuration?: ConfigurationsClient): UserClient;
69
+ getNotificationsClient(configuration?: ConfigurationsClient): NotificationsClient;
68
70
  }
69
71
  export default PublicApiClient;
@@ -16,6 +16,7 @@ const cartClient_1 = require("./cart/cartClient");
16
16
  const supportCenter_1 = require("./supportCenter");
17
17
  const catalog_1 = require("./catalog");
18
18
  const user_1 = require("./user");
19
+ const notifications_1 = require("./notifications");
19
20
  /**
20
21
  * Public API Client class, should be the main entry point for your calls
21
22
  */
@@ -27,8 +28,8 @@ class PublicApiClient extends abstractRestfulClient_1.AbstractRestfulClient {
27
28
  * Creates a new {@link CustomersClient} instance and returns it
28
29
  * @returns {@link CustomersClient}
29
30
  */
30
- getCustomersClient() {
31
- return new customers_1.CustomersClient()
31
+ getCustomersClient(configuration) {
32
+ return new customers_1.CustomersClient(configuration)
32
33
  .setUrl(this.url)
33
34
  .setApiKey(this.apiKey)
34
35
  .setHeaders(this.headers)
@@ -38,8 +39,8 @@ class PublicApiClient extends abstractRestfulClient_1.AbstractRestfulClient {
38
39
  * Creates a new {@link WhoAmIClient} instance and returns it
39
40
  * @returns {@link WhoAmIClient}
40
41
  */
41
- getWhoamiClient() {
42
- return new general_1.WhoAmIClient()
42
+ getWhoamiClient(configuration) {
43
+ return new general_1.WhoAmIClient(configuration)
43
44
  .setUrl(this.url)
44
45
  .setApiKey(this.apiKey)
45
46
  .setHeaders(this.headers)
@@ -49,8 +50,8 @@ class PublicApiClient extends abstractRestfulClient_1.AbstractRestfulClient {
49
50
  * Creates a new {@link LicensesClient} instance and returns it
50
51
  * @returns {@link LicensesClient}
51
52
  */
52
- getLicensesClient() {
53
- return new licenses_1.LicensesClient()
53
+ getLicensesClient(configuration) {
54
+ return new licenses_1.LicensesClient(configuration)
54
55
  .setUrl(this.url)
55
56
  .setApiKey(this.apiKey)
56
57
  .setHeaders(this.headers)
@@ -60,8 +61,8 @@ class PublicApiClient extends abstractRestfulClient_1.AbstractRestfulClient {
60
61
  * Creates a new {@link CheckDomainClient} instance and returns it
61
62
  * @returns {@link CheckDomainClient}
62
63
  */
63
- getCheckDomainClient() {
64
- return new general_1.CheckDomainClient()
64
+ getCheckDomainClient(configuration) {
65
+ return new general_1.CheckDomainClient(configuration)
65
66
  .setUrl(this.url)
66
67
  .setApiKey(this.apiKey)
67
68
  .setHeaders(this.headers)
@@ -71,8 +72,8 @@ class PublicApiClient extends abstractRestfulClient_1.AbstractRestfulClient {
71
72
  * Creates a new {@link SubscriptionsClient} instance and returns it
72
73
  * @returns {@link SubscriptionsClient}
73
74
  */
74
- getSubscriptionsClient() {
75
- return new subscriptions_1.SubscriptionsClient()
75
+ getSubscriptionsClient(configuration) {
76
+ return new subscriptions_1.SubscriptionsClient(configuration)
76
77
  .setUrl(this.url)
77
78
  .setApiKey(this.apiKey)
78
79
  .setHeaders(this.headers)
@@ -82,8 +83,8 @@ class PublicApiClient extends abstractRestfulClient_1.AbstractRestfulClient {
82
83
  * Creates a new {@link OrdersClient} instance and returns it
83
84
  * @returns {@link OrdersClient}
84
85
  */
85
- getOrdersClient() {
86
- return new orders_1.OrdersClient()
86
+ getOrdersClient(configuration) {
87
+ return new orders_1.OrdersClient(configuration)
87
88
  .setUrl(this.url)
88
89
  .setApiKey(this.apiKey)
89
90
  .setHeaders(this.headers)
@@ -93,8 +94,8 @@ class PublicApiClient extends abstractRestfulClient_1.AbstractRestfulClient {
93
94
  * Creates a new {@link ContactClient} instance and returns it
94
95
  * @returns {@link ContactClient}
95
96
  */
96
- getContactClient() {
97
- return new contact_1.ContactClient()
97
+ getContactClient(configuration) {
98
+ return new contact_1.ContactClient(configuration)
98
99
  .setUrl(this.url)
99
100
  .setApiKey(this.apiKey)
100
101
  .setHeaders(this.headers)
@@ -104,62 +105,69 @@ class PublicApiClient extends abstractRestfulClient_1.AbstractRestfulClient {
104
105
  * Creates a new {@link ContactClient} instance and returns it
105
106
  * @returns {@link ContactClient}
106
107
  */
107
- getCampaignClient() {
108
- return new campaign_1.CampaignClient()
108
+ getCampaignClient(configuration) {
109
+ return new campaign_1.CampaignClient(configuration)
109
110
  .setUrl(this.url)
110
111
  .setApiKey(this.apiKey)
111
112
  .setHeaders(this.headers)
112
113
  .setHttpExceptionHandlers(this.httpExceptionHandlers);
113
114
  }
114
- getConsumptionClient() {
115
- return new consumption_1.ConsumptionClient()
115
+ getConsumptionClient(configuration) {
116
+ return new consumption_1.ConsumptionClient(configuration)
116
117
  .setUrl(this.url)
117
118
  .setApiKey(this.apiKey)
118
119
  .setHeaders(this.headers)
119
120
  .setHttpExceptionHandlers(this.httpExceptionHandlers);
120
121
  }
121
- getSecurityStandardsClient() {
122
- return new standardsClient_1.StandardsClient()
122
+ getSecurityStandardsClient(configuration) {
123
+ return new standardsClient_1.StandardsClient(configuration)
123
124
  .setUrl(this.url)
124
125
  .setApiKey(this.apiKey)
125
126
  .setHeaders(this.headers)
126
127
  .setHttpExceptionHandlers(this.httpExceptionHandlers);
127
128
  }
128
- getSecurityRegisterClient() {
129
- return new security_1.RegisterClient()
129
+ getSecurityRegisterClient(configuration) {
130
+ return new security_1.RegisterClient(configuration)
130
131
  .setUrl(this.url)
131
132
  .setApiKey(this.apiKey)
132
133
  .setHeaders(this.headers)
133
134
  .setHttpExceptionHandlers(this.httpExceptionHandlers);
134
135
  }
135
- getCartClient() {
136
- return new cartClient_1.CartClient()
136
+ getCartClient(configuration) {
137
+ return new cartClient_1.CartClient(configuration)
137
138
  .setUrl(this.url)
138
139
  .setApiKey(this.apiKey)
139
140
  .setHeaders(this.headers)
140
141
  .setHttpExceptionHandlers(this.httpExceptionHandlers);
141
142
  }
142
- getSupportCenterClient() {
143
- return new supportCenter_1.SupportCenterClient()
143
+ getSupportCenterClient(configuration) {
144
+ return new supportCenter_1.SupportCenterClient(configuration)
144
145
  .setUrl(this.url)
145
146
  .setApiKey(this.apiKey)
146
147
  .setHeaders(this.headers)
147
148
  .setHttpExceptionHandlers(this.httpExceptionHandlers);
148
149
  }
149
- getCatalogClient() {
150
- return new catalog_1.CatalogClient()
150
+ getCatalogClient(configuration) {
151
+ return new catalog_1.CatalogClient(configuration)
151
152
  .setUrl(this.url)
152
153
  .setApiKey(this.apiKey)
153
154
  .setHeaders(this.headers)
154
155
  .setHttpExceptionHandlers(this.httpExceptionHandlers);
155
156
  }
156
- getUserClient() {
157
- return new user_1.UserClient()
157
+ getUserClient(configuration) {
158
+ return new user_1.UserClient(configuration)
158
159
  .setUrl(this.url)
159
160
  .setApiKey(this.apiKey)
160
161
  .setHeaders(this.headers)
161
162
  .setHttpExceptionHandlers(this.httpExceptionHandlers);
162
163
  }
164
+ getNotificationsClient(configuration) {
165
+ return new notifications_1.NotificationsClient(configuration)
166
+ .setUrl(this.url)
167
+ .setToken(this.token)
168
+ .setHeaders(this.headers)
169
+ .setHttpExceptionHandlers(this.httpExceptionHandlers);
170
+ }
163
171
  }
164
172
  exports.PublicApiClient = PublicApiClient;
165
173
  exports.default = PublicApiClient;
package/package.json CHANGED
@@ -4,13 +4,13 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/ArrowSphere/nodejs-api-client.git"
6
6
  },
7
- "version": "3.34.0-rc.bdj.1",
7
+ "version": "3.35.0-rc-jpb.1",
8
8
  "description": "Node.js client for ArrowSphere's public API",
9
9
  "main": "build/index.js",
10
10
  "types": "build/index.d.ts",
11
11
  "scripts": {
12
12
  "build": "tsc --build",
13
- "clean": "rimraf build/",
13
+ "clean": "rm -rf build/",
14
14
  "doc": "typedoc ./src/index.ts ./src/**/index.ts",
15
15
  "lint": "eslint ./{src,tests}/**/*.ts && prettier --list-different ./{src,tests}/**/*.ts",
16
16
  "lint:fix": "eslint ./{src,tests}/**/*.ts --fix && prettier --write ./{src,tests}/**/*.ts",