@arrowsphere/api-client 2.1.0 → 2.2.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,38 @@
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
+ ## [2.2.1] - 2022-02-10
7
+
8
+ ### Added
9
+
10
+ - Fixed Class GetResult
11
+ - Add Class GetLicenseResult for intermediate level between GetResult Class and LicenseGetResult
12
+ - Refactoring of Units Tests
13
+ - Refactoring names of variable in class LicenseGetResult
14
+
15
+ ## [2.2.0] - 2022-01-04
16
+
17
+ ### Added
18
+
19
+ - Add endpoint update seats
20
+
21
+ ## [2.1.2] - 2022-02-01
22
+
23
+ ### Changed
24
+
25
+ - Fixed type of `GetLicense` endpoint
26
+ - Fixed type of `ActionMessagesGetResult` object
27
+ - Fixed type of `ActionsGetResult` object
28
+ - Fixed type of `BuySellFindResult` object
29
+ - Fixed type of `LicenseGetResult` object
30
+ - Fixed type of `OrderGetResult` object
31
+
32
+ ## [2.1.1] - 2022-01-27
33
+
34
+ ### Changed
35
+
36
+ - Fixed type of `GetLicense` endpoint
37
+
6
38
  ## [2.1.0] - 2022-01-25
7
39
 
8
40
  ### Added
@@ -109,6 +109,7 @@ export declare abstract class AbstractClient {
109
109
  * @param headers - Headers to be sent in the request
110
110
  */
111
111
  protected post(payload?: Payload, parameters?: Parameters, headers?: Headers, options?: Options): Promise<AxiosResponse['data']>;
112
+ protected put(payload?: Payload, parameters?: Parameters, headers?: Headers, options?: Options): Promise<void>;
112
113
  /**
113
114
  * Generates the full url for request
114
115
  * @param parameters - Parameters to serialize
@@ -149,6 +149,12 @@ class AbstractClient {
149
149
  });
150
150
  return this.getResponse(response);
151
151
  }
152
+ async put(payload = {}, parameters = {}, headers = {}, options = {}) {
153
+ const response = await this.client.put(this.generateUrl(parameters, options), payload, {
154
+ headers: this.prepareHeaders(headers),
155
+ });
156
+ return this.getResponse(response);
157
+ }
152
158
  /**
153
159
  * Generates the full url for request
154
160
  * @param parameters - Parameters to serialize
@@ -3,6 +3,7 @@ import { ErrorMessages, Rules } from 'validatorjs';
3
3
  * Class AbstractEntity
4
4
  */
5
5
  export declare abstract class AbstractEntity<T> {
6
+ #private;
6
7
  protected VALIDATION_RULES: Rules;
7
8
  protected VALIDATION_MESSAGES: ErrorMessages;
8
9
  /**
@@ -14,6 +15,7 @@ export declare abstract class AbstractEntity<T> {
14
15
  * @param data - Data that will be used in the Entity
15
16
  */
16
17
  protected constructor(data: T);
18
+ get entityDataInput(): T;
17
19
  /**
18
20
  * Checks whether or not the entity data passes the validation rules
19
21
  * @param data - Data to validate
@@ -1,7 +1,21 @@
1
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
+ };
2
15
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
16
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
17
  };
18
+ var _entityDataInput;
5
19
  Object.defineProperty(exports, "__esModule", { value: true });
6
20
  exports.AbstractEntity = void 0;
7
21
  const validatorjs_1 = __importDefault(require("validatorjs"));
@@ -15,6 +29,7 @@ class AbstractEntity {
15
29
  * @param data - Data that will be used in the Entity
16
30
  */
17
31
  constructor(data) {
32
+ _entityDataInput.set(this, void 0);
18
33
  this.VALIDATION_RULES = {};
19
34
  this.VALIDATION_MESSAGES = {};
20
35
  /**
@@ -22,6 +37,10 @@ class AbstractEntity {
22
37
  */
23
38
  this.enableValidation = false;
24
39
  this.validate(data);
40
+ __classPrivateFieldSet(this, _entityDataInput, data);
41
+ }
42
+ get entityDataInput() {
43
+ return __classPrivateFieldGet(this, _entityDataInput);
25
44
  }
26
45
  /**
27
46
  * Checks whether or not the entity data passes the validation rules
@@ -49,4 +68,5 @@ class AbstractEntity {
49
68
  }
50
69
  }
51
70
  exports.AbstractEntity = AbstractEntity;
71
+ _entityDataInput = new WeakMap();
52
72
  //# sourceMappingURL=abstractEntity.js.map
@@ -8,18 +8,18 @@ export declare enum ActionMessagesGetResultFields {
8
8
  }
9
9
  export declare type ActionMessagesGetResultData = {
10
10
  [ActionMessagesGetResultFields.COLUMN_ACTION]: string;
11
- [ActionMessagesGetResultFields.COLUMN_MESSAGE]: string;
12
- [ActionMessagesGetResultFields.COLUMN_MAX_DECREASE]: number;
13
- [ActionMessagesGetResultFields.COLUMN_SUPPORTED_UNTIL]: string;
14
- [ActionMessagesGetResultFields.COLUMN_SUSPEND_DATE]: string;
11
+ [ActionMessagesGetResultFields.COLUMN_MESSAGE]?: string;
12
+ [ActionMessagesGetResultFields.COLUMN_MAX_DECREASE]?: number;
13
+ [ActionMessagesGetResultFields.COLUMN_SUPPORTED_UNTIL]?: string;
14
+ [ActionMessagesGetResultFields.COLUMN_SUSPEND_DATE]?: string;
15
15
  };
16
16
  export declare class ActionMessagesGetResult extends AbstractEntity<ActionMessagesGetResultData> {
17
17
  #private;
18
18
  constructor(data: ActionMessagesGetResultData);
19
19
  get action(): string;
20
- get message(): string;
21
- get maxDecrease(): number;
22
- get supportedUntil(): string;
23
- get suspendDate(): string;
20
+ get message(): string | undefined;
21
+ get maxDecrease(): number | undefined;
22
+ get supportedUntil(): string | undefined;
23
+ get suspendDate(): string | undefined;
24
24
  toJSON(): ActionMessagesGetResultData;
25
25
  }
@@ -13,28 +13,28 @@ export declare enum ActionsGetFields {
13
13
  }
14
14
  export declare type ActionsGetData = {
15
15
  [ActionsGetFields.COLUMN_HISTORY]: string;
16
- [ActionsGetFields.COLUMN_UPDATE]: string;
17
- [ActionsGetFields.COLUMN_INCREASE_SEATS]: string;
18
- [ActionsGetFields.COLUMN_DECREASE_SEATS]: string;
19
- [ActionsGetFields.COLUMN_ADDONS_CATALOG]: string;
20
- [ActionsGetFields.COLUMN_SUSPEND]: string;
21
- [ActionsGetFields.COLUMN_REACTIVATE]: string;
22
- [ActionsGetFields.COLUMN_AUTO_RENEW_OFF]: string;
23
- [ActionsGetFields.COLUMN_AUTO_RENEW_ON]: string;
24
- [ActionsGetFields.COLUMN_CANCEL]: string;
16
+ [ActionsGetFields.COLUMN_UPDATE]?: string;
17
+ [ActionsGetFields.COLUMN_INCREASE_SEATS]?: string;
18
+ [ActionsGetFields.COLUMN_DECREASE_SEATS]?: string;
19
+ [ActionsGetFields.COLUMN_ADDONS_CATALOG]?: string;
20
+ [ActionsGetFields.COLUMN_SUSPEND]?: string;
21
+ [ActionsGetFields.COLUMN_REACTIVATE]?: string;
22
+ [ActionsGetFields.COLUMN_AUTO_RENEW_OFF]?: string;
23
+ [ActionsGetFields.COLUMN_AUTO_RENEW_ON]?: string;
24
+ [ActionsGetFields.COLUMN_CANCEL]?: string;
25
25
  };
26
26
  export declare class ActionsGetResult extends AbstractEntity<ActionsGetData> {
27
27
  #private;
28
28
  constructor(data: ActionsGetData);
29
29
  get history(): string;
30
- get update(): string;
31
- get increaseSeats(): string;
32
- get decreaseSeats(): string;
33
- get addonsCatalog(): string;
34
- get suspend(): string;
35
- get reactivate(): string;
36
- get autoRenewOff(): string;
37
- get autoRenewOn(): string;
38
- get cancel(): string;
30
+ get update(): string | undefined;
31
+ get increaseSeats(): string | undefined;
32
+ get decreaseSeats(): string | undefined;
33
+ get addonsCatalog(): string | undefined;
34
+ get suspend(): string | undefined;
35
+ get reactivate(): string | undefined;
36
+ get autoRenewOff(): string | undefined;
37
+ get autoRenewOn(): string | undefined;
38
+ get cancel(): string | undefined;
39
39
  toJSON(): ActionsGetData;
40
40
  }
@@ -4,13 +4,13 @@ export declare enum BuySellFields {
4
4
  COLUMN_SELL = "sell"
5
5
  }
6
6
  export declare type BuySellData = {
7
- [BuySellFields.COLUMN_BUY]: number;
8
- [BuySellFields.COLUMN_SELL]: number;
7
+ [BuySellFields.COLUMN_BUY]?: number;
8
+ [BuySellFields.COLUMN_SELL]?: number;
9
9
  };
10
10
  export declare class BuySellFindResult extends AbstractEntity<BuySellData> {
11
11
  #private;
12
12
  constructor(data: BuySellData);
13
- get buy(): number;
14
- get sell(): number;
13
+ get buy(): number | undefined;
14
+ get sell(): number | undefined;
15
15
  toJSON(): BuySellData;
16
16
  }
@@ -1,5 +1,5 @@
1
1
  import { ActionsGetData, ActionsGetResult } from './actionsGetResult';
2
- import { ActionMessagesGetResultData } from './actionMessagesGetResult';
2
+ import { ActionMessagesGetResult, ActionMessagesGetResultData } from './actionMessagesGetResult';
3
3
  import { OrderGetData, OrderGetResult } from './orderGetResult';
4
4
  import { LicensePriceGetData, LicensePriceGetResult } from './licensePriceGetResult';
5
5
  import { AbstractEntity } from '../../../abstractEntity';
@@ -34,8 +34,8 @@ export declare enum LicenseGetFields {
34
34
  }
35
35
  export declare type LicenseGetData = {
36
36
  [LicenseGetFields.COLUMN_LICENSE_ID]: string;
37
- [LicenseGetFields.COLUMN_PARENT_LICENSE_ID]: string;
38
- [LicenseGetFields.COLUMN_FRIENDLY_NAME]: string;
37
+ [LicenseGetFields.COLUMN_PARENT_LICENSE_ID]: string | null;
38
+ [LicenseGetFields.COLUMN_FRIENDLY_NAME]: string | null;
39
39
  [LicenseGetFields.COLUMN_CUSTOMER_REF]: string;
40
40
  [LicenseGetFields.COLUMN_STATE]: string;
41
41
  [LicenseGetFields.COLUMN_SERVICE_REF]: string;
@@ -43,29 +43,29 @@ export declare type LicenseGetData = {
43
43
  [LicenseGetFields.COLUMN_NAME]: string;
44
44
  [LicenseGetFields.COLUMN_SEATS]: number;
45
45
  [LicenseGetFields.COLUMN_ACTIVE_SEATS]: ActiveSeatsFindResultData;
46
- [LicenseGetFields.COLUMN_ACTIVATION_DATETIME]: string;
47
- [LicenseGetFields.COLUMN_EXPIRY_DATETIME]: string;
48
- [LicenseGetFields.COLUMN_AUTO_RENEW]: boolean;
46
+ [LicenseGetFields.COLUMN_ACTIVATION_DATETIME]: string | null;
47
+ [LicenseGetFields.COLUMN_EXPIRY_DATETIME]: string | null;
48
+ [LicenseGetFields.COLUMN_AUTO_RENEW]?: boolean;
49
49
  [LicenseGetFields.COLUMN_MESSAGE]: string;
50
- [LicenseGetFields.COLUMN_ACTIONS]: ActionsGetData;
51
- [LicenseGetFields.COLUMN_ACTION_MESSAGES]: Array<ActionMessagesGetResultData>;
50
+ [LicenseGetFields.COLUMN_ACTIONS]?: ActionsGetData;
51
+ [LicenseGetFields.COLUMN_ACTION_MESSAGES]?: Array<ActionMessagesGetResultData>;
52
52
  [LicenseGetFields.COLUMN_ORDER_REFERENCE]: string;
53
53
  [LicenseGetFields.COLUMN_ORDER]: OrderGetData;
54
- [LicenseGetFields.COLUMN_VENDOR_LICENSE_ID]: string;
54
+ [LicenseGetFields.COLUMN_VENDOR_LICENSE_ID]: string | null;
55
55
  [LicenseGetFields.COLUMN_PERIODICITY]: string;
56
56
  [LicenseGetFields.COLUMN_TERM]: string;
57
57
  [LicenseGetFields.COLUMN_CATEGORY]: string;
58
58
  [LicenseGetFields.COLUMN_PROGRAM]: string;
59
59
  [LicenseGetFields.COLUMN_ASSOCIATED_SUBSCRIPTION_PROGRAM]: string;
60
60
  [LicenseGetFields.COLUMN_PRICE]: LicensePriceGetData;
61
- [LicenseGetFields.COLUMN_ARROW_SUB_CATEGORIES]: Array<string>;
61
+ [LicenseGetFields.COLUMN_ARROW_SUB_CATEGORIES]?: Array<string> | null;
62
62
  };
63
63
  export declare class LicenseGetResult extends AbstractEntity<LicenseGetData> {
64
64
  #private;
65
- constructor(data: LicenseGetData);
65
+ constructor(licenseGetDataInput: LicenseGetData);
66
66
  get id(): string;
67
- get parentLicenseId(): string;
68
- get friendlyName(): string;
67
+ get parentLicenseId(): string | null;
68
+ get friendlyName(): string | null;
69
69
  get customerRef(): string;
70
70
  get state(): string;
71
71
  get serviceRef(): string;
@@ -73,21 +73,21 @@ export declare class LicenseGetResult extends AbstractEntity<LicenseGetData> {
73
73
  get name(): string;
74
74
  get seats(): number;
75
75
  get activeSeats(): ActiveSeatsFindResult;
76
- get activationDatetime(): string;
77
- get expiryDatetime(): string;
78
- get autoRenew(): boolean;
76
+ get activationDatetime(): string | null;
77
+ get expiryDatetime(): string | null;
78
+ get autoRenew(): boolean | undefined;
79
79
  get message(): string;
80
- get actions(): ActionsGetResult;
81
- get actionMessages(): Array<ActionMessagesGetResultData>;
80
+ get actions(): ActionsGetResult | undefined;
81
+ get actionMessages(): Array<ActionMessagesGetResult> | undefined;
82
82
  get orderReference(): string;
83
83
  get order(): OrderGetResult;
84
- get vendorLicenseId(): string;
84
+ get vendorLicenseId(): string | null;
85
85
  get periodicity(): string;
86
86
  get term(): string;
87
87
  get category(): string;
88
88
  get program(): string;
89
89
  get associatedSubscriptionProgram(): string;
90
90
  get price(): LicensePriceGetResult;
91
- get arrowSubCategories(): Array<string>;
91
+ get arrowSubCategories(): Array<string> | null | undefined;
92
92
  toJSON(): LicenseGetData;
93
93
  }
@@ -16,6 +16,7 @@ var _license_id, _parent_license_id, _friendlyName, _customer_ref, _state, _serv
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.LicenseGetResult = exports.LicenseGetFields = void 0;
18
18
  const actionsGetResult_1 = require("./actionsGetResult");
19
+ const actionMessagesGetResult_1 = require("./actionMessagesGetResult");
19
20
  const orderGetResult_1 = require("./orderGetResult");
20
21
  const licensePriceGetResult_1 = require("./licensePriceGetResult");
21
22
  const abstractEntity_1 = require("../../../abstractEntity");
@@ -50,8 +51,9 @@ var LicenseGetFields;
50
51
  LicenseGetFields["COLUMN_ARROW_SUB_CATEGORIES"] = "arrowSubCategories";
51
52
  })(LicenseGetFields = exports.LicenseGetFields || (exports.LicenseGetFields = {}));
52
53
  class LicenseGetResult extends abstractEntity_1.AbstractEntity {
53
- constructor(data) {
54
- super(data);
54
+ constructor(licenseGetDataInput) {
55
+ var _a;
56
+ super(licenseGetDataInput);
55
57
  _license_id.set(this, void 0);
56
58
  _parent_license_id.set(this, void 0);
57
59
  _friendlyName.set(this, void 0);
@@ -78,56 +80,34 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
78
80
  _associatedSubscriptionProgram.set(this, void 0);
79
81
  _price.set(this, void 0);
80
82
  _arrowSubCategories.set(this, void 0);
81
- __classPrivateFieldSet(this, _license_id, data[LicenseGetFields.COLUMN_LICENSE_ID]);
82
- __classPrivateFieldSet(this, _parent_license_id, data[LicenseGetFields.COLUMN_PARENT_LICENSE_ID]);
83
- __classPrivateFieldSet(this, _friendlyName, data[LicenseGetFields.COLUMN_FRIENDLY_NAME]);
84
- __classPrivateFieldSet(this, _customer_ref, data[LicenseGetFields.COLUMN_CUSTOMER_REF]);
85
- __classPrivateFieldSet(this, _state, data[LicenseGetFields.COLUMN_STATE]);
86
- __classPrivateFieldSet(this, _service_ref, data[LicenseGetFields.COLUMN_SERVICE_REF]);
87
- __classPrivateFieldSet(this, _sku, data[LicenseGetFields.COLUMN_SKU]);
88
- __classPrivateFieldSet(this, _name, data[LicenseGetFields.COLUMN_NAME]);
89
- __classPrivateFieldSet(this, _seats, data[LicenseGetFields.COLUMN_SEATS]);
90
- const activeSeats = {
91
- [activeSeatsFindResult_1.ActiveSeatsFindResultFields.COLUMN_NUMBER]: data[LicenseGetFields.COLUMN_ACTIVE_SEATS][activeSeatsFindResult_1.ActiveSeatsFindResultFields.COLUMN_NUMBER],
92
- [activeSeatsFindResult_1.ActiveSeatsFindResultFields.COLUMN_LAST_UPDATE]: data[LicenseGetFields.COLUMN_ACTIVE_SEATS][activeSeatsFindResult_1.ActiveSeatsFindResultFields.COLUMN_LAST_UPDATE],
93
- };
94
- __classPrivateFieldSet(this, _activeSeats, new activeSeatsFindResult_1.ActiveSeatsFindResult(activeSeats));
95
- __classPrivateFieldSet(this, _activation_datetime, data[LicenseGetFields.COLUMN_ACTIVATION_DATETIME]);
96
- __classPrivateFieldSet(this, _expiry_datetime, data[LicenseGetFields.COLUMN_EXPIRY_DATETIME]);
97
- __classPrivateFieldSet(this, _autoRenew, data[LicenseGetFields.COLUMN_AUTO_RENEW]);
98
- __classPrivateFieldSet(this, _message, data[LicenseGetFields.COLUMN_MESSAGE]);
99
- const actions = {
100
- [actionsGetResult_1.ActionsGetFields.COLUMN_HISTORY]: data[LicenseGetFields.COLUMN_ACTIONS][actionsGetResult_1.ActionsGetFields.COLUMN_HISTORY],
101
- [actionsGetResult_1.ActionsGetFields.COLUMN_UPDATE]: data[LicenseGetFields.COLUMN_ACTIONS][actionsGetResult_1.ActionsGetFields.COLUMN_UPDATE],
102
- [actionsGetResult_1.ActionsGetFields.COLUMN_INCREASE_SEATS]: data[LicenseGetFields.COLUMN_ACTIONS][actionsGetResult_1.ActionsGetFields.COLUMN_INCREASE_SEATS],
103
- [actionsGetResult_1.ActionsGetFields.COLUMN_DECREASE_SEATS]: data[LicenseGetFields.COLUMN_ACTIONS][actionsGetResult_1.ActionsGetFields.COLUMN_DECREASE_SEATS],
104
- [actionsGetResult_1.ActionsGetFields.COLUMN_ADDONS_CATALOG]: data[LicenseGetFields.COLUMN_ACTIONS][actionsGetResult_1.ActionsGetFields.COLUMN_ADDONS_CATALOG],
105
- [actionsGetResult_1.ActionsGetFields.COLUMN_SUSPEND]: data[LicenseGetFields.COLUMN_ACTIONS][actionsGetResult_1.ActionsGetFields.COLUMN_SUSPEND],
106
- [actionsGetResult_1.ActionsGetFields.COLUMN_REACTIVATE]: data[LicenseGetFields.COLUMN_ACTIONS][actionsGetResult_1.ActionsGetFields.COLUMN_REACTIVATE],
107
- [actionsGetResult_1.ActionsGetFields.COLUMN_AUTO_RENEW_OFF]: data[LicenseGetFields.COLUMN_ACTIONS][actionsGetResult_1.ActionsGetFields.COLUMN_AUTO_RENEW_OFF],
108
- [actionsGetResult_1.ActionsGetFields.COLUMN_AUTO_RENEW_ON]: data[LicenseGetFields.COLUMN_ACTIONS][actionsGetResult_1.ActionsGetFields.COLUMN_AUTO_RENEW_ON],
109
- [actionsGetResult_1.ActionsGetFields.COLUMN_CANCEL]: data[LicenseGetFields.COLUMN_ACTIONS][actionsGetResult_1.ActionsGetFields.COLUMN_CANCEL],
110
- };
111
- __classPrivateFieldSet(this, _actions, new actionsGetResult_1.ActionsGetResult(actions));
112
- __classPrivateFieldSet(this, _actionMessages, data[LicenseGetFields.COLUMN_ACTION_MESSAGES]);
113
- const order = {
114
- [orderGetResult_1.OrderGetFields.COLUMN_REFERENCE]: data[LicenseGetFields.COLUMN_ORDER][orderGetResult_1.OrderGetFields.COLUMN_REFERENCE],
115
- [orderGetResult_1.OrderGetFields.COLUMN_LINK]: data[LicenseGetFields.COLUMN_ORDER][orderGetResult_1.OrderGetFields.COLUMN_LINK],
116
- };
117
- __classPrivateFieldSet(this, _order_reference, data[LicenseGetFields.COLUMN_ORDER_REFERENCE]);
118
- __classPrivateFieldSet(this, _order, new orderGetResult_1.OrderGetResult(order));
119
- __classPrivateFieldSet(this, _vendor_license_id, data[LicenseGetFields.COLUMN_VENDOR_LICENSE_ID]);
120
- __classPrivateFieldSet(this, _periodicity, data[LicenseGetFields.COLUMN_PERIODICITY]);
121
- __classPrivateFieldSet(this, _term, data[LicenseGetFields.COLUMN_TERM]);
122
- __classPrivateFieldSet(this, _category, data[LicenseGetFields.COLUMN_CATEGORY]);
123
- __classPrivateFieldSet(this, _program, data[LicenseGetFields.COLUMN_PROGRAM]);
124
- __classPrivateFieldSet(this, _associatedSubscriptionProgram, data[LicenseGetFields.COLUMN_ASSOCIATED_SUBSCRIPTION_PROGRAM]);
125
- const price = {
126
- [licensePriceGetResult_1.LicensePriceGetFields.COLUMN_UNIT]: data[LicenseGetFields.COLUMN_PRICE][licensePriceGetResult_1.LicensePriceGetFields.COLUMN_UNIT],
127
- [licensePriceGetResult_1.LicensePriceGetFields.COLUMN_TOTAL]: data[LicenseGetFields.COLUMN_PRICE][licensePriceGetResult_1.LicensePriceGetFields.COLUMN_TOTAL],
128
- };
129
- __classPrivateFieldSet(this, _price, new licensePriceGetResult_1.LicensePriceGetResult(price));
130
- __classPrivateFieldSet(this, _arrowSubCategories, data[LicenseGetFields.COLUMN_ARROW_SUB_CATEGORIES]);
83
+ __classPrivateFieldSet(this, _license_id, licenseGetDataInput[LicenseGetFields.COLUMN_LICENSE_ID]);
84
+ __classPrivateFieldSet(this, _parent_license_id, licenseGetDataInput[LicenseGetFields.COLUMN_PARENT_LICENSE_ID]);
85
+ __classPrivateFieldSet(this, _friendlyName, licenseGetDataInput[LicenseGetFields.COLUMN_FRIENDLY_NAME]);
86
+ __classPrivateFieldSet(this, _customer_ref, licenseGetDataInput[LicenseGetFields.COLUMN_CUSTOMER_REF]);
87
+ __classPrivateFieldSet(this, _state, licenseGetDataInput[LicenseGetFields.COLUMN_STATE]);
88
+ __classPrivateFieldSet(this, _service_ref, licenseGetDataInput[LicenseGetFields.COLUMN_SERVICE_REF]);
89
+ __classPrivateFieldSet(this, _sku, licenseGetDataInput[LicenseGetFields.COLUMN_SKU]);
90
+ __classPrivateFieldSet(this, _name, licenseGetDataInput[LicenseGetFields.COLUMN_NAME]);
91
+ __classPrivateFieldSet(this, _seats, licenseGetDataInput[LicenseGetFields.COLUMN_SEATS]);
92
+ __classPrivateFieldSet(this, _activeSeats, new activeSeatsFindResult_1.ActiveSeatsFindResult(licenseGetDataInput[LicenseGetFields.COLUMN_ACTIVE_SEATS]));
93
+ __classPrivateFieldSet(this, _activation_datetime, licenseGetDataInput[LicenseGetFields.COLUMN_ACTIVATION_DATETIME]);
94
+ __classPrivateFieldSet(this, _expiry_datetime, licenseGetDataInput[LicenseGetFields.COLUMN_EXPIRY_DATETIME]);
95
+ __classPrivateFieldSet(this, _autoRenew, licenseGetDataInput[LicenseGetFields.COLUMN_AUTO_RENEW]);
96
+ __classPrivateFieldSet(this, _message, licenseGetDataInput[LicenseGetFields.COLUMN_MESSAGE]);
97
+ __classPrivateFieldSet(this, _actions, licenseGetDataInput[LicenseGetFields.COLUMN_ACTIONS]
98
+ ? new actionsGetResult_1.ActionsGetResult(licenseGetDataInput[LicenseGetFields.COLUMN_ACTIONS])
99
+ : undefined);
100
+ __classPrivateFieldSet(this, _actionMessages, (_a = licenseGetDataInput[LicenseGetFields.COLUMN_ACTION_MESSAGES]) === null || _a === void 0 ? void 0 : _a.map((result) => new actionMessagesGetResult_1.ActionMessagesGetResult(result)));
101
+ __classPrivateFieldSet(this, _order_reference, licenseGetDataInput[LicenseGetFields.COLUMN_ORDER_REFERENCE]);
102
+ __classPrivateFieldSet(this, _order, new orderGetResult_1.OrderGetResult(licenseGetDataInput[LicenseGetFields.COLUMN_ORDER]));
103
+ __classPrivateFieldSet(this, _vendor_license_id, licenseGetDataInput[LicenseGetFields.COLUMN_VENDOR_LICENSE_ID]);
104
+ __classPrivateFieldSet(this, _periodicity, licenseGetDataInput[LicenseGetFields.COLUMN_PERIODICITY]);
105
+ __classPrivateFieldSet(this, _term, licenseGetDataInput[LicenseGetFields.COLUMN_TERM]);
106
+ __classPrivateFieldSet(this, _category, licenseGetDataInput[LicenseGetFields.COLUMN_CATEGORY]);
107
+ __classPrivateFieldSet(this, _program, licenseGetDataInput[LicenseGetFields.COLUMN_PROGRAM]);
108
+ __classPrivateFieldSet(this, _associatedSubscriptionProgram, licenseGetDataInput[LicenseGetFields.COLUMN_ASSOCIATED_SUBSCRIPTION_PROGRAM]);
109
+ __classPrivateFieldSet(this, _price, new licensePriceGetResult_1.LicensePriceGetResult(licenseGetDataInput[LicenseGetFields.COLUMN_PRICE]));
110
+ __classPrivateFieldSet(this, _arrowSubCategories, licenseGetDataInput[LicenseGetFields.COLUMN_ARROW_SUB_CATEGORIES]);
131
111
  }
132
112
  get id() {
133
113
  return __classPrivateFieldGet(this, _license_id);
@@ -208,6 +188,7 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
208
188
  return __classPrivateFieldGet(this, _arrowSubCategories);
209
189
  }
210
190
  toJSON() {
191
+ var _a, _b;
211
192
  return {
212
193
  [LicenseGetFields.COLUMN_LICENSE_ID]: this.id,
213
194
  [LicenseGetFields.COLUMN_PARENT_LICENSE_ID]: this.parentLicenseId,
@@ -223,8 +204,8 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
223
204
  [LicenseGetFields.COLUMN_EXPIRY_DATETIME]: this.expiryDatetime,
224
205
  [LicenseGetFields.COLUMN_AUTO_RENEW]: this.autoRenew,
225
206
  [LicenseGetFields.COLUMN_MESSAGE]: this.message,
226
- [LicenseGetFields.COLUMN_ACTIONS]: this.actions.toJSON(),
227
- [LicenseGetFields.COLUMN_ACTION_MESSAGES]: this.actionMessages,
207
+ [LicenseGetFields.COLUMN_ACTIONS]: (_a = this.actions) === null || _a === void 0 ? void 0 : _a.toJSON(),
208
+ [LicenseGetFields.COLUMN_ACTION_MESSAGES]: (_b = this.actionMessages) === null || _b === void 0 ? void 0 : _b.map((result) => result.toJSON()),
228
209
  [LicenseGetFields.COLUMN_ORDER_REFERENCE]: this.orderReference,
229
210
  [LicenseGetFields.COLUMN_ORDER]: this.order.toJSON(),
230
211
  [LicenseGetFields.COLUMN_VENDOR_LICENSE_ID]: this.vendorLicenseId,
@@ -27,16 +27,8 @@ class LicensePriceGetResult extends abstractEntity_1.AbstractEntity {
27
27
  super(data);
28
28
  _unit.set(this, void 0);
29
29
  _total.set(this, void 0);
30
- const unit = {
31
- [buySellFindResult_1.BuySellFields.COLUMN_BUY]: data[LicensePriceGetFields.COLUMN_UNIT][buySellFindResult_1.BuySellFields.COLUMN_BUY],
32
- [buySellFindResult_1.BuySellFields.COLUMN_SELL]: data[LicensePriceGetFields.COLUMN_UNIT][buySellFindResult_1.BuySellFields.COLUMN_SELL],
33
- };
34
- __classPrivateFieldSet(this, _unit, new buySellFindResult_1.BuySellFindResult(unit));
35
- const total = {
36
- [buySellFindResult_1.BuySellFields.COLUMN_BUY]: data[LicensePriceGetFields.COLUMN_TOTAL][buySellFindResult_1.BuySellFields.COLUMN_BUY],
37
- [buySellFindResult_1.BuySellFields.COLUMN_SELL]: data[LicensePriceGetFields.COLUMN_TOTAL][buySellFindResult_1.BuySellFields.COLUMN_SELL],
38
- };
39
- __classPrivateFieldSet(this, _total, new buySellFindResult_1.BuySellFindResult(total));
30
+ __classPrivateFieldSet(this, _unit, new buySellFindResult_1.BuySellFindResult(data[LicensePriceGetFields.COLUMN_UNIT]));
31
+ __classPrivateFieldSet(this, _total, new buySellFindResult_1.BuySellFindResult(data[LicensePriceGetFields.COLUMN_TOTAL]));
40
32
  }
41
33
  get unit() {
42
34
  return __classPrivateFieldGet(this, _unit);
@@ -4,13 +4,13 @@ export declare enum OrderGetFields {
4
4
  COLUMN_LINK = "link"
5
5
  }
6
6
  export declare type OrderGetData = {
7
- [OrderGetFields.COLUMN_REFERENCE]: string;
7
+ [OrderGetFields.COLUMN_REFERENCE]: string | null;
8
8
  [OrderGetFields.COLUMN_LINK]: string;
9
9
  };
10
10
  export declare class OrderGetResult extends AbstractEntity<OrderGetData> {
11
11
  #private;
12
12
  constructor(data: OrderGetData);
13
- get reference(): string;
13
+ get reference(): string | null;
14
14
  get link(): string;
15
15
  toJSON(): OrderGetData;
16
16
  }
@@ -0,0 +1,14 @@
1
+ import { AbstractEntity } from '../../../abstractEntity';
2
+ import { LicenseGetData, LicenseGetResult } from '../getLicense/licenseGetResult';
3
+ export declare enum GetLicenseResultFields {
4
+ COLUMN_LICENSE = "license"
5
+ }
6
+ export declare type GetLicenseResultData = {
7
+ [GetLicenseResultFields.COLUMN_LICENSE]: LicenseGetData;
8
+ };
9
+ export declare class GetLicenseResult extends AbstractEntity<GetLicenseResultData> {
10
+ #private;
11
+ constructor(getLicenseResultDataInput: GetLicenseResultData);
12
+ get license(): LicenseGetResult;
13
+ toJSON(): GetLicenseResultData;
14
+ }
@@ -0,0 +1,41 @@
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 _license;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.GetLicenseResult = exports.GetLicenseResultFields = void 0;
18
+ const abstractEntity_1 = require("../../../abstractEntity");
19
+ const licenseGetResult_1 = require("../getLicense/licenseGetResult");
20
+ var GetLicenseResultFields;
21
+ (function (GetLicenseResultFields) {
22
+ GetLicenseResultFields["COLUMN_LICENSE"] = "license";
23
+ })(GetLicenseResultFields = exports.GetLicenseResultFields || (exports.GetLicenseResultFields = {}));
24
+ class GetLicenseResult extends abstractEntity_1.AbstractEntity {
25
+ constructor(getLicenseResultDataInput) {
26
+ super(getLicenseResultDataInput);
27
+ _license.set(this, void 0);
28
+ __classPrivateFieldSet(this, _license, new licenseGetResult_1.LicenseGetResult(getLicenseResultDataInput[GetLicenseResultFields.COLUMN_LICENSE]));
29
+ }
30
+ get license() {
31
+ return __classPrivateFieldGet(this, _license);
32
+ }
33
+ toJSON() {
34
+ return {
35
+ [GetLicenseResultFields.COLUMN_LICENSE]: this.license.toJSON(),
36
+ };
37
+ }
38
+ }
39
+ exports.GetLicenseResult = GetLicenseResult;
40
+ _license = new WeakMap();
41
+ //# sourceMappingURL=getLicenseResult.js.map
@@ -0,0 +1,34 @@
1
+ import { LicenseGetData } from './getLicense/licenseGetResult';
2
+ import { AbstractEntity } from '../../abstractEntity';
3
+ export declare enum GetResultFields {
4
+ COLUMN_STATUS = "status",
5
+ COLUMN_DATA = "data"
6
+ }
7
+ /**
8
+ * @deprecated please use GetLicenseResultData for license
9
+ */
10
+ export declare type LicenseGet = {
11
+ license: LicenseGetData;
12
+ };
13
+ export declare type GetData<Entity> = {
14
+ [GetResultFields.COLUMN_STATUS]: number;
15
+ [GetResultFields.COLUMN_DATA]: Entity;
16
+ };
17
+ /**
18
+ * This interface is use toJSON function in objects (data properties) you want to use
19
+ */
20
+ interface AbstractEntityGet<Entity extends AbstractEntityGet<Entity>> extends AbstractEntity<Entity['entityDataInput']> {
21
+ toJSON: () => Entity['entityDataInput'];
22
+ }
23
+ /**
24
+ * WARNING: use this class only when the Entity in data properties is an object not an array or other type
25
+ * Use this class for get call when the response of API is a type of GetData<Entity>
26
+ */
27
+ export declare class GetResult<Entity extends AbstractEntityGet<Entity>> extends AbstractEntity<GetData<Entity['entityDataInput']>> {
28
+ #private;
29
+ constructor(cls: new (data: Entity['entityDataInput']) => Entity, getResultDataInput: GetData<Entity['entityDataInput']>);
30
+ get status(): number;
31
+ get data(): Entity;
32
+ toJSON(): GetData<Entity['entityDataInput']>;
33
+ }
34
+ export {};
@@ -0,0 +1,51 @@
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 _status, _data;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.GetResult = exports.GetResultFields = void 0;
18
+ const abstractEntity_1 = require("../../abstractEntity");
19
+ var GetResultFields;
20
+ (function (GetResultFields) {
21
+ GetResultFields["COLUMN_STATUS"] = "status";
22
+ GetResultFields["COLUMN_DATA"] = "data";
23
+ })(GetResultFields = exports.GetResultFields || (exports.GetResultFields = {}));
24
+ /**
25
+ * WARNING: use this class only when the Entity in data properties is an object not an array or other type
26
+ * Use this class for get call when the response of API is a type of GetData<Entity>
27
+ */
28
+ class GetResult extends abstractEntity_1.AbstractEntity {
29
+ constructor(cls, getResultDataInput) {
30
+ super(getResultDataInput);
31
+ _status.set(this, void 0);
32
+ _data.set(this, void 0);
33
+ __classPrivateFieldSet(this, _status, getResultDataInput.status);
34
+ __classPrivateFieldSet(this, _data, new cls(getResultDataInput.data));
35
+ }
36
+ get status() {
37
+ return __classPrivateFieldGet(this, _status);
38
+ }
39
+ get data() {
40
+ return __classPrivateFieldGet(this, _data);
41
+ }
42
+ toJSON() {
43
+ return JSON.parse(JSON.stringify({
44
+ [GetResultFields.COLUMN_STATUS]: this.status,
45
+ [GetResultFields.COLUMN_DATA]: this.data.toJSON(),
46
+ }));
47
+ }
48
+ }
49
+ exports.GetResult = GetResult;
50
+ _status = new WeakMap(), _data = new WeakMap();
51
+ //# sourceMappingURL=getResult.js.map
@@ -21,3 +21,4 @@ export * from '../licenses/entities/getLicense/licensePriceGetResult';
21
21
  export * from '../licenses/entities/getLicense/orderGetResult';
22
22
  export * from './entities/filterFindResult';
23
23
  export * from './entities/findResult';
24
+ export * from './entities/getResult';
@@ -33,4 +33,5 @@ __exportStar(require("../licenses/entities/getLicense/licensePriceGetResult"), e
33
33
  __exportStar(require("../licenses/entities/getLicense/orderGetResult"), exports);
34
34
  __exportStar(require("./entities/filterFindResult"), exports);
35
35
  __exportStar(require("./entities/findResult"), exports);
36
+ __exportStar(require("./entities/getResult"), exports);
36
37
  //# sourceMappingURL=index.js.map
@@ -11,7 +11,9 @@ import { PriceFindResultDataKeywords, PriceFindResutDataSortParameters } from '.
11
11
  import { OfferFindResultDataFiltersParameters, OfferFindResultDataKeywords, OfferFindResultDataSortParameters } from './entities/offer/offerFindResult';
12
12
  import { ActionFlagsFindResultDataKeywords, ActionFlagsFindResultDataSortParameters } from './entities/offer/actionFlagsFindResult';
13
13
  import { PriceBandFindResultDataKeywords, PriceBandFindResultDataSortParameters } from './entities/offer/priceBandFindResult';
14
- import { LicenseGetData } from './entities/getLicense/licenseGetResult';
14
+ import { GetResult } from './entities/getResult';
15
+ import { LicenseGetFields } from './entities/getLicense/licenseGetResult';
16
+ import { GetLicenseResult } from './entities/getResult/getLicenseResult';
15
17
  /**
16
18
  * Parameters passable to the request for refining search.
17
19
  */
@@ -179,6 +181,9 @@ export declare type LicenseFindRawPayload = {
179
181
  };
180
182
  [LicenseFindParameters.DATA_HIGHLIGHT]?: boolean;
181
183
  };
184
+ export declare type UpdateSeatsData = {
185
+ [LicenseGetFields.COLUMN_SEATS]: number;
186
+ };
182
187
  export declare class LicensesClient extends AbstractClient {
183
188
  /**
184
189
  * The base path of the Licenses API
@@ -196,6 +201,10 @@ export declare class LicensesClient extends AbstractClient {
196
201
  * The path of the Configs endpoint
197
202
  */
198
203
  private CONFIGS_PATH;
204
+ /**
205
+ * The path of the Seats endpoint
206
+ */
207
+ private SEATS_PATH;
199
208
  /**
200
209
  * Returns the raw result from the find endpoint call
201
210
  *
@@ -221,5 +230,6 @@ export declare class LicensesClient extends AbstractClient {
221
230
  getConfigs(reference: string): AsyncGenerator<ConfigFindResultData>;
222
231
  updateConfigRaw(reference: string, config: ConfigFindResult): Promise<ConfigFindResultData>;
223
232
  updateConfig(reference: string, config: ConfigFindResult): Promise<ConfigFindResult>;
224
- getLicense(licenseReference: string, parameters?: Parameters): Promise<LicenseGetData>;
233
+ getLicense(licenseReference: string, parameters?: Parameters): Promise<GetResult<GetLicenseResult>>;
234
+ updateSeats(licenseReference: string, putData: UpdateSeatsData, parameters?: Parameters): Promise<void>;
225
235
  }
@@ -7,6 +7,9 @@ exports.LicensesClient = exports.LicenseFindParameters = void 0;
7
7
  const abstractClient_1 = require("../abstractClient");
8
8
  const findResult_1 = require("./entities/findResult");
9
9
  const configFindResult_1 = require("./entities/license/configFindResult");
10
+ const getResult_1 = require("./entities/getResult");
11
+ const licenseGetResult_1 = require("./entities/getLicense/licenseGetResult");
12
+ const getLicenseResult_1 = require("./entities/getResult/getLicenseResult");
10
13
  /**
11
14
  * Parameters passable to the request for refining search.
12
15
  */
@@ -120,6 +123,10 @@ class LicensesClient extends abstractClient_1.AbstractClient {
120
123
  * The path of the Configs endpoint
121
124
  */
122
125
  this.CONFIGS_PATH = '/configs';
126
+ /**
127
+ * The path of the Seats endpoint
128
+ */
129
+ this.SEATS_PATH = '/seats';
123
130
  }
124
131
  /**
125
132
  * Returns the raw result from the find endpoint call
@@ -217,9 +224,13 @@ class LicensesClient extends abstractClient_1.AbstractClient {
217
224
  const rawResponse = await this.updateConfigRaw(reference, config);
218
225
  return new configFindResult_1.ConfigFindResult(rawResponse);
219
226
  }
220
- getLicense(licenseReference, parameters = {}) {
227
+ async getLicense(licenseReference, parameters = {}) {
221
228
  this.path = licenseReference;
222
- return this.get(parameters);
229
+ return new getResult_1.GetResult(getLicenseResult_1.GetLicenseResult, await this.get(parameters));
230
+ }
231
+ updateSeats(licenseReference, putData, parameters = {}) {
232
+ this.path = licenseReference + this.SEATS_PATH;
233
+ return this.put(putData, parameters);
223
234
  }
224
235
  }
225
236
  exports.LicensesClient = LicensesClient;
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": "2.1.0",
7
+ "version": "2.2.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",