@arrowsphere/api-client 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
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.7.0] - 2022-03-03
7
+
8
+ ### Added
9
+
10
+ - Update object license for getLicense endpoint
11
+ - Add endpoint update license friendlyName
12
+
6
13
  ## [2.6.0] - 2022-02-22
7
14
 
8
15
  ### Added
@@ -121,10 +121,10 @@ class AbstractClient {
121
121
  getResponse(response) {
122
122
  const statusCode = response.status;
123
123
  if (statusCode === 404) {
124
- throw new exception_1.NotFoundException(`Resource not found on URL ${this.getUrl()}`);
124
+ throw new exception_1.NotFoundException(`Resource not found on URL ${this.getUrl()}`, response.data.error, statusCode);
125
125
  }
126
126
  if (statusCode >= 400 && statusCode <= 599) {
127
- throw new exception_1.PublicApiClientException(`Error: status code: ${statusCode}. URL: ${this.getUrl()}`);
127
+ throw new exception_1.PublicApiClientException(`Error: status code: ${statusCode}. URL: ${this.getUrl()}`, response.data.error, statusCode);
128
128
  }
129
129
  return response.data;
130
130
  }
@@ -1,3 +1,5 @@
1
1
  export declare class EntityValidationException extends Error {
2
- constructor(message: string);
2
+ httpCode: number;
3
+ httpError: string;
4
+ constructor(message: string, httpError?: string, httpCode?: number);
3
5
  }
@@ -2,8 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EntityValidationException = void 0;
4
4
  class EntityValidationException extends Error {
5
- constructor(message) {
5
+ constructor(message, httpError = '', httpCode = 0) {
6
6
  super(message);
7
+ this.httpCode = httpCode;
8
+ this.httpError = httpError;
7
9
  }
8
10
  }
9
11
  exports.EntityValidationException = EntityValidationException;
@@ -1,3 +1,5 @@
1
1
  export declare class NotFoundException extends Error {
2
- constructor(message: string);
2
+ httpCode: number;
3
+ httpError: string;
4
+ constructor(message: string, httpError?: string, httpCode?: number);
3
5
  }
@@ -2,8 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotFoundException = void 0;
4
4
  class NotFoundException extends Error {
5
- constructor(message) {
5
+ constructor(message, httpError = '', httpCode = 0) {
6
6
  super(message);
7
+ this.httpCode = httpCode;
8
+ this.httpError = httpError;
7
9
  }
8
10
  }
9
11
  exports.NotFoundException = NotFoundException;
@@ -1,3 +1,5 @@
1
1
  export declare class PublicApiClientException extends Error {
2
- constructor(message: string);
2
+ httpCode: number;
3
+ httpError: string;
4
+ constructor(message: string, httpError?: string, httpCode?: number);
3
5
  }
@@ -2,8 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PublicApiClientException = void 0;
4
4
  class PublicApiClientException extends Error {
5
- constructor(message) {
5
+ constructor(message, httpError = '', httpCode = 0) {
6
6
  super(message);
7
+ this.httpCode = httpCode;
8
+ this.httpError = httpError;
7
9
  }
8
10
  }
9
11
  exports.PublicApiClientException = PublicApiClientException;
@@ -10,6 +10,10 @@ export declare enum LicenseGetFields {
10
10
  COLUMN_FRIENDLY_NAME = "friendlyName",
11
11
  COLUMN_CUSTOMER_REF = "customer_ref",
12
12
  COLUMN_STATE = "state",
13
+ COLUMN_STATUS_CODE = "statusCode",
14
+ COLUMN_IS_TRIAL = "isTrial",
15
+ COLUMN_IS_ADDON = "isAddon",
16
+ COLUMN_CURRENCY = "currency",
13
17
  COLUMN_SERVICE_REF = "service_ref",
14
18
  COLUMN_SKU = "sku",
15
19
  COLUMN_NAME = "name",
@@ -38,6 +42,10 @@ export declare type LicenseGetData = {
38
42
  [LicenseGetFields.COLUMN_FRIENDLY_NAME]: string | null;
39
43
  [LicenseGetFields.COLUMN_CUSTOMER_REF]: string;
40
44
  [LicenseGetFields.COLUMN_STATE]: string;
45
+ [LicenseGetFields.COLUMN_STATUS_CODE]: number;
46
+ [LicenseGetFields.COLUMN_IS_TRIAL]: boolean;
47
+ [LicenseGetFields.COLUMN_IS_ADDON]: boolean;
48
+ [LicenseGetFields.COLUMN_CURRENCY]: string;
41
49
  [LicenseGetFields.COLUMN_SERVICE_REF]: string;
42
50
  [LicenseGetFields.COLUMN_SKU]: string;
43
51
  [LicenseGetFields.COLUMN_NAME]: string;
@@ -68,6 +76,10 @@ export declare class LicenseGetResult extends AbstractEntity<LicenseGetData> {
68
76
  get friendlyName(): string | null;
69
77
  get customerRef(): string;
70
78
  get state(): string;
79
+ get statusCode(): number;
80
+ get isTrial(): boolean;
81
+ get isAddon(): boolean;
82
+ get currency(): string;
71
83
  get serviceRef(): string;
72
84
  get sku(): string;
73
85
  get name(): string;
@@ -12,7 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  }
13
13
  return privateMap.get(receiver);
14
14
  };
15
- var _license_id, _parent_license_id, _friendlyName, _customer_ref, _state, _service_ref, _sku, _name, _seats, _activeSeats, _activation_datetime, _expiry_datetime, _autoRenew, _message, _actions, _actionMessages, _order_reference, _order, _vendor_license_id, _periodicity, _term, _category, _program, _associatedSubscriptionProgram, _price, _arrowSubCategories;
15
+ var _license_id, _parent_license_id, _friendlyName, _customer_ref, _state, _statusCode, _isTrial, _isAddon, _currency, _service_ref, _sku, _name, _seats, _activeSeats, _activation_datetime, _expiry_datetime, _autoRenew, _message, _actions, _actionMessages, _order_reference, _order, _vendor_license_id, _periodicity, _term, _category, _program, _associatedSubscriptionProgram, _price, _arrowSubCategories;
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.LicenseGetResult = exports.LicenseGetFields = void 0;
18
18
  const actionsGetResult_1 = require("./actionsGetResult");
@@ -28,6 +28,10 @@ var LicenseGetFields;
28
28
  LicenseGetFields["COLUMN_FRIENDLY_NAME"] = "friendlyName";
29
29
  LicenseGetFields["COLUMN_CUSTOMER_REF"] = "customer_ref";
30
30
  LicenseGetFields["COLUMN_STATE"] = "state";
31
+ LicenseGetFields["COLUMN_STATUS_CODE"] = "statusCode";
32
+ LicenseGetFields["COLUMN_IS_TRIAL"] = "isTrial";
33
+ LicenseGetFields["COLUMN_IS_ADDON"] = "isAddon";
34
+ LicenseGetFields["COLUMN_CURRENCY"] = "currency";
31
35
  LicenseGetFields["COLUMN_SERVICE_REF"] = "service_ref";
32
36
  LicenseGetFields["COLUMN_SKU"] = "sku";
33
37
  LicenseGetFields["COLUMN_NAME"] = "name";
@@ -59,6 +63,10 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
59
63
  _friendlyName.set(this, void 0);
60
64
  _customer_ref.set(this, void 0);
61
65
  _state.set(this, void 0);
66
+ _statusCode.set(this, void 0);
67
+ _isTrial.set(this, void 0);
68
+ _isAddon.set(this, void 0);
69
+ _currency.set(this, void 0);
62
70
  _service_ref.set(this, void 0);
63
71
  _sku.set(this, void 0);
64
72
  _name.set(this, void 0);
@@ -85,6 +93,10 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
85
93
  __classPrivateFieldSet(this, _friendlyName, licenseGetDataInput[LicenseGetFields.COLUMN_FRIENDLY_NAME]);
86
94
  __classPrivateFieldSet(this, _customer_ref, licenseGetDataInput[LicenseGetFields.COLUMN_CUSTOMER_REF]);
87
95
  __classPrivateFieldSet(this, _state, licenseGetDataInput[LicenseGetFields.COLUMN_STATE]);
96
+ __classPrivateFieldSet(this, _statusCode, licenseGetDataInput[LicenseGetFields.COLUMN_STATUS_CODE]);
97
+ __classPrivateFieldSet(this, _isTrial, licenseGetDataInput[LicenseGetFields.COLUMN_IS_TRIAL]);
98
+ __classPrivateFieldSet(this, _isAddon, licenseGetDataInput[LicenseGetFields.COLUMN_IS_ADDON]);
99
+ __classPrivateFieldSet(this, _currency, licenseGetDataInput[LicenseGetFields.COLUMN_CURRENCY]);
88
100
  __classPrivateFieldSet(this, _service_ref, licenseGetDataInput[LicenseGetFields.COLUMN_SERVICE_REF]);
89
101
  __classPrivateFieldSet(this, _sku, licenseGetDataInput[LicenseGetFields.COLUMN_SKU]);
90
102
  __classPrivateFieldSet(this, _name, licenseGetDataInput[LicenseGetFields.COLUMN_NAME]);
@@ -124,6 +136,18 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
124
136
  get state() {
125
137
  return __classPrivateFieldGet(this, _state);
126
138
  }
139
+ get statusCode() {
140
+ return __classPrivateFieldGet(this, _statusCode);
141
+ }
142
+ get isTrial() {
143
+ return __classPrivateFieldGet(this, _isTrial);
144
+ }
145
+ get isAddon() {
146
+ return __classPrivateFieldGet(this, _isAddon);
147
+ }
148
+ get currency() {
149
+ return __classPrivateFieldGet(this, _currency);
150
+ }
127
151
  get serviceRef() {
128
152
  return __classPrivateFieldGet(this, _service_ref);
129
153
  }
@@ -195,6 +219,10 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
195
219
  [LicenseGetFields.COLUMN_FRIENDLY_NAME]: this.friendlyName,
196
220
  [LicenseGetFields.COLUMN_CUSTOMER_REF]: this.customerRef,
197
221
  [LicenseGetFields.COLUMN_STATE]: this.state,
222
+ [LicenseGetFields.COLUMN_STATUS_CODE]: this.statusCode,
223
+ [LicenseGetFields.COLUMN_IS_TRIAL]: this.isTrial,
224
+ [LicenseGetFields.COLUMN_IS_ADDON]: this.isAddon,
225
+ [LicenseGetFields.COLUMN_CURRENCY]: this.currency,
198
226
  [LicenseGetFields.COLUMN_SERVICE_REF]: this.serviceRef,
199
227
  [LicenseGetFields.COLUMN_SKU]: this.sku,
200
228
  [LicenseGetFields.COLUMN_NAME]: this.name,
@@ -221,5 +249,5 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
221
249
  }
222
250
  }
223
251
  exports.LicenseGetResult = LicenseGetResult;
224
- _license_id = new WeakMap(), _parent_license_id = new WeakMap(), _friendlyName = new WeakMap(), _customer_ref = new WeakMap(), _state = new WeakMap(), _service_ref = new WeakMap(), _sku = new WeakMap(), _name = new WeakMap(), _seats = new WeakMap(), _activeSeats = new WeakMap(), _activation_datetime = new WeakMap(), _expiry_datetime = new WeakMap(), _autoRenew = new WeakMap(), _message = new WeakMap(), _actions = new WeakMap(), _actionMessages = new WeakMap(), _order_reference = new WeakMap(), _order = new WeakMap(), _vendor_license_id = new WeakMap(), _periodicity = new WeakMap(), _term = new WeakMap(), _category = new WeakMap(), _program = new WeakMap(), _associatedSubscriptionProgram = new WeakMap(), _price = new WeakMap(), _arrowSubCategories = new WeakMap();
252
+ _license_id = new WeakMap(), _parent_license_id = new WeakMap(), _friendlyName = new WeakMap(), _customer_ref = new WeakMap(), _state = new WeakMap(), _statusCode = new WeakMap(), _isTrial = new WeakMap(), _isAddon = new WeakMap(), _currency = new WeakMap(), _service_ref = new WeakMap(), _sku = new WeakMap(), _name = new WeakMap(), _seats = new WeakMap(), _activeSeats = new WeakMap(), _activation_datetime = new WeakMap(), _expiry_datetime = new WeakMap(), _autoRenew = new WeakMap(), _message = new WeakMap(), _actions = new WeakMap(), _actionMessages = new WeakMap(), _order_reference = new WeakMap(), _order = new WeakMap(), _vendor_license_id = new WeakMap(), _periodicity = new WeakMap(), _term = new WeakMap(), _category = new WeakMap(), _program = new WeakMap(), _associatedSubscriptionProgram = new WeakMap(), _price = new WeakMap(), _arrowSubCategories = new WeakMap();
225
253
  //# sourceMappingURL=licenseGetResult.js.map
@@ -184,6 +184,9 @@ export declare type LicenseFindRawPayload = {
184
184
  export declare type UpdateSeatsData = {
185
185
  [LicenseGetFields.COLUMN_SEATS]: number;
186
186
  };
187
+ export declare type PutFriendlyName = {
188
+ [LicenseGetFields.COLUMN_FRIENDLY_NAME]: string;
189
+ };
187
190
  export declare class LicensesClient extends AbstractClient {
188
191
  /**
189
192
  * The base path of the Licenses API
@@ -217,6 +220,10 @@ export declare class LicensesClient extends AbstractClient {
217
220
  * The path of cancel endpoint
218
221
  */
219
222
  private CANCEL_PATH;
223
+ /**
224
+ * The path of update friendlyName endpoint
225
+ */
226
+ private UPDATE_FRIENDLYNAME;
220
227
  /**
221
228
  * Returns the raw result from the find endpoint call
222
229
  *
@@ -247,4 +254,5 @@ export declare class LicensesClient extends AbstractClient {
247
254
  suspendLicense(licenseReference: string, parameters?: Parameters): Promise<void>;
248
255
  reactivateLicense(licenseReference: string, parameters?: Parameters): Promise<void>;
249
256
  cancelLicense(licenseReference: string, parameters?: Parameters): Promise<void>;
257
+ updateFriendlyName(licenseReference: string, putData: PutFriendlyName, parameters?: Parameters): Promise<void>;
250
258
  }
@@ -139,6 +139,10 @@ class LicensesClient extends abstractClient_1.AbstractClient {
139
139
  * The path of cancel endpoint
140
140
  */
141
141
  this.CANCEL_PATH = '/cancel';
142
+ /**
143
+ * The path of update friendlyName endpoint
144
+ */
145
+ this.UPDATE_FRIENDLYNAME = '/friendlyName';
142
146
  }
143
147
  /**
144
148
  * Returns the raw result from the find endpoint call
@@ -256,6 +260,10 @@ class LicensesClient extends abstractClient_1.AbstractClient {
256
260
  this.path = licenseReference + this.CANCEL_PATH;
257
261
  return this.put(undefined, parameters);
258
262
  }
263
+ async updateFriendlyName(licenseReference, putData, parameters = {}) {
264
+ this.path = licenseReference + this.UPDATE_FRIENDLYNAME;
265
+ return await this.put(putData, parameters);
266
+ }
259
267
  }
260
268
  exports.LicensesClient = LicensesClient;
261
269
  //# sourceMappingURL=licensesClient.js.map
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.6.0",
7
+ "version": "2.7.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",