@arrowsphere/api-client 3.24.0-rc.4 → 3.24.0-rc.6
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.
|
@@ -4,7 +4,6 @@ import { AxiosInstance, AxiosResponse } from 'axios';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare enum ParameterKeys {
|
|
6
6
|
API_KEY = "apiKey",
|
|
7
|
-
EXTRA_INFORMATION = "extraInformation",
|
|
8
7
|
HEADERS = "headers",
|
|
9
8
|
ORDER_BY = "order_by",
|
|
10
9
|
PAGE = "page",
|
|
@@ -13,9 +12,11 @@ export declare enum ParameterKeys {
|
|
|
13
12
|
SORT_BY = "sort_by",
|
|
14
13
|
URL = "url"
|
|
15
14
|
}
|
|
15
|
+
export declare enum ExtraInformationFields {
|
|
16
|
+
COLUMN_EXTRA_INFORMATION = "extraInformation"
|
|
17
|
+
}
|
|
16
18
|
export declare type Parameters = Record<string, string | string[] | number | number[] | boolean | null | undefined>;
|
|
17
19
|
export declare type Headers = Record<string, string>;
|
|
18
|
-
export declare type ExtraInformation = Record<string, unknown> | undefined;
|
|
19
20
|
export declare type Payload = Record<string, unknown>;
|
|
20
21
|
export declare type Options = {
|
|
21
22
|
isAdmin?: boolean;
|
|
@@ -24,8 +25,8 @@ export declare type ConfigurationsClient = {
|
|
|
24
25
|
[ParameterKeys.API_KEY]?: string;
|
|
25
26
|
[ParameterKeys.URL]?: string;
|
|
26
27
|
[ParameterKeys.HEADERS]?: Headers;
|
|
27
|
-
[ParameterKeys.EXTRA_INFORMATION]?: ExtraInformation;
|
|
28
28
|
};
|
|
29
|
+
export declare type ExtraInformationType = Record<string, unknown>;
|
|
29
30
|
export declare abstract class AbstractClient {
|
|
30
31
|
/**
|
|
31
32
|
* Base path for HTTP calls
|
|
@@ -63,10 +64,6 @@ export declare abstract class AbstractClient {
|
|
|
63
64
|
* Defines header information for axios call
|
|
64
65
|
*/
|
|
65
66
|
protected headers: Headers;
|
|
66
|
-
/**
|
|
67
|
-
* Defines extra information in payload
|
|
68
|
-
*/
|
|
69
|
-
protected extraInformation: Record<string, unknown>;
|
|
70
67
|
/**
|
|
71
68
|
* AbstractClient constructor.
|
|
72
69
|
* @returns AbstractClient
|
|
@@ -107,7 +104,6 @@ export declare abstract class AbstractClient {
|
|
|
107
104
|
* @returns AbstractClient
|
|
108
105
|
*/
|
|
109
106
|
setHeaders(headers: Record<string, string>): this;
|
|
110
|
-
setExtraInformation(extraInformation: ExtraInformation): this;
|
|
111
107
|
/**
|
|
112
108
|
* Sends a GET request and returns the response
|
|
113
109
|
* @param parameters - Query parameters to send
|
|
@@ -176,5 +172,4 @@ export declare abstract class AbstractClient {
|
|
|
176
172
|
* @returns {@link Parameters}
|
|
177
173
|
*/
|
|
178
174
|
private generatePagination;
|
|
179
|
-
private generatePayload;
|
|
180
175
|
}
|
package/build/abstractClient.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AbstractClient = exports.ParameterKeys = void 0;
|
|
6
|
+
exports.AbstractClient = exports.ExtraInformationFields = exports.ParameterKeys = void 0;
|
|
7
7
|
const exception_1 = require("./exception");
|
|
8
8
|
const querystring_1 = __importDefault(require("querystring"));
|
|
9
9
|
const url_1 = require("url");
|
|
@@ -15,7 +15,6 @@ const axiosSingleton_1 = require("./axiosSingleton");
|
|
|
15
15
|
var ParameterKeys;
|
|
16
16
|
(function (ParameterKeys) {
|
|
17
17
|
ParameterKeys["API_KEY"] = "apiKey";
|
|
18
|
-
ParameterKeys["EXTRA_INFORMATION"] = "extraInformation";
|
|
19
18
|
ParameterKeys["HEADERS"] = "headers";
|
|
20
19
|
ParameterKeys["ORDER_BY"] = "order_by";
|
|
21
20
|
ParameterKeys["PAGE"] = "page";
|
|
@@ -24,13 +23,17 @@ var ParameterKeys;
|
|
|
24
23
|
ParameterKeys["SORT_BY"] = "sort_by";
|
|
25
24
|
ParameterKeys["URL"] = "url";
|
|
26
25
|
})(ParameterKeys = exports.ParameterKeys || (exports.ParameterKeys = {}));
|
|
26
|
+
var ExtraInformationFields;
|
|
27
|
+
(function (ExtraInformationFields) {
|
|
28
|
+
ExtraInformationFields["COLUMN_EXTRA_INFORMATION"] = "extraInformation";
|
|
29
|
+
})(ExtraInformationFields = exports.ExtraInformationFields || (exports.ExtraInformationFields = {}));
|
|
27
30
|
class AbstractClient {
|
|
28
31
|
/**
|
|
29
32
|
* AbstractClient constructor.
|
|
30
33
|
* @returns AbstractClient
|
|
31
34
|
*/
|
|
32
35
|
constructor(configuration) {
|
|
33
|
-
var _a, _b, _c
|
|
36
|
+
var _a, _b, _c;
|
|
34
37
|
/**
|
|
35
38
|
* Base path for HTTP calls
|
|
36
39
|
*/
|
|
@@ -63,15 +66,10 @@ class AbstractClient {
|
|
|
63
66
|
* Defines header information for axios call
|
|
64
67
|
*/
|
|
65
68
|
this.headers = {};
|
|
66
|
-
/**
|
|
67
|
-
* Defines extra information in payload
|
|
68
|
-
*/
|
|
69
|
-
this.extraInformation = {};
|
|
70
69
|
this.client = axiosSingleton_1.AxiosSingleton.getInstance();
|
|
71
70
|
this.setApiKey((_a = configuration === null || configuration === void 0 ? void 0 : configuration[ParameterKeys.API_KEY]) !== null && _a !== void 0 ? _a : '');
|
|
72
71
|
this.setUrl((_b = configuration === null || configuration === void 0 ? void 0 : configuration[ParameterKeys.URL]) !== null && _b !== void 0 ? _b : '');
|
|
73
72
|
this.setHeaders((_c = configuration === null || configuration === void 0 ? void 0 : configuration[ParameterKeys.HEADERS]) !== null && _c !== void 0 ? _c : {});
|
|
74
|
-
this.setExtraInformation((_d = configuration === null || configuration === void 0 ? void 0 : configuration[ParameterKeys.EXTRA_INFORMATION]) !== null && _d !== void 0 ? _d : undefined);
|
|
75
73
|
}
|
|
76
74
|
/**
|
|
77
75
|
* Sets the Client ArrowSphere API key
|
|
@@ -125,12 +123,6 @@ class AbstractClient {
|
|
|
125
123
|
this.headers = headers;
|
|
126
124
|
return this;
|
|
127
125
|
}
|
|
128
|
-
setExtraInformation(extraInformation) {
|
|
129
|
-
this.extraInformation = extraInformation
|
|
130
|
-
? { extraInformation: extraInformation }
|
|
131
|
-
: {};
|
|
132
|
-
return this;
|
|
133
|
-
}
|
|
134
126
|
/**
|
|
135
127
|
* Sends a GET request and returns the response
|
|
136
128
|
* @param parameters - Query parameters to send
|
|
@@ -180,7 +172,7 @@ class AbstractClient {
|
|
|
180
172
|
* @param options - Options to send
|
|
181
173
|
*/
|
|
182
174
|
async post(payload = {}, parameters = {}, headers = {}, options = {}) {
|
|
183
|
-
const response = await this.client.post(this.generateUrl(parameters, options),
|
|
175
|
+
const response = await this.client.post(this.generateUrl(parameters, options), payload, {
|
|
184
176
|
headers: this.prepareHeaders(headers),
|
|
185
177
|
});
|
|
186
178
|
return this.getResponse(response);
|
|
@@ -194,7 +186,7 @@ class AbstractClient {
|
|
|
194
186
|
* @returns Promise\<void\>
|
|
195
187
|
*/
|
|
196
188
|
async put(payload = {}, parameters = {}, headers = {}, options = {}) {
|
|
197
|
-
const response = await this.client.put(this.generateUrl(parameters, options),
|
|
189
|
+
const response = await this.client.put(this.generateUrl(parameters, options), payload, {
|
|
198
190
|
headers: this.prepareHeaders(headers),
|
|
199
191
|
});
|
|
200
192
|
return this.getResponse(response);
|
|
@@ -260,12 +252,6 @@ class AbstractClient {
|
|
|
260
252
|
}
|
|
261
253
|
return params;
|
|
262
254
|
}
|
|
263
|
-
generatePayload(payload) {
|
|
264
|
-
return {
|
|
265
|
-
...payload,
|
|
266
|
-
...this.extraInformation,
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
255
|
}
|
|
270
256
|
exports.AbstractClient = AbstractClient;
|
|
271
257
|
//# sourceMappingURL=abstractClient.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Class LicensesClient
|
|
3
3
|
*/
|
|
4
|
-
import { AbstractClient, Parameters } from '../abstractClient';
|
|
4
|
+
import { AbstractClient, ExtraInformationFields, ExtraInformationType, Parameters } from '../abstractClient';
|
|
5
5
|
import { FindConfig, FindData, FindResult } from './entities/findResult';
|
|
6
6
|
import { ConfigFindResult, ConfigFindResultData, ConfigFindResultDataKeywords, ConfigFindResultDataSortParameters } from './entities/license/configFindResult';
|
|
7
7
|
import { LicenceFindDataFiltersParameters, LicenceFindDataKeywords, LicenceFindDataSortParameters } from './entities/license/licenseFindResult';
|
|
@@ -190,9 +190,26 @@ export declare type LicenseFindRawPayload = {
|
|
|
190
190
|
};
|
|
191
191
|
export declare type UpdateSeatsData = {
|
|
192
192
|
[LicenseGetFields.COLUMN_SEATS]: number;
|
|
193
|
+
[ExtraInformationFields.COLUMN_EXTRA_INFORMATION]?: ExtraInformationType;
|
|
193
194
|
};
|
|
194
195
|
export declare type PutFriendlyName = {
|
|
195
196
|
[LicenseGetFields.COLUMN_FRIENDLY_NAME]: string;
|
|
197
|
+
[ExtraInformationFields.COLUMN_EXTRA_INFORMATION]?: ExtraInformationType;
|
|
198
|
+
};
|
|
199
|
+
export declare type PutReactivate = {
|
|
200
|
+
[ExtraInformationFields.COLUMN_EXTRA_INFORMATION]?: ExtraInformationType;
|
|
201
|
+
};
|
|
202
|
+
export declare type PutSuspend = {
|
|
203
|
+
[ExtraInformationFields.COLUMN_EXTRA_INFORMATION]?: ExtraInformationType;
|
|
204
|
+
};
|
|
205
|
+
export declare type PutCancel = {
|
|
206
|
+
[ExtraInformationFields.COLUMN_EXTRA_INFORMATION]?: ExtraInformationType;
|
|
207
|
+
};
|
|
208
|
+
export declare type PutCancelAutoRenew = {
|
|
209
|
+
[ExtraInformationFields.COLUMN_EXTRA_INFORMATION]?: ExtraInformationType;
|
|
210
|
+
};
|
|
211
|
+
export declare type PutReactivateAutoRenew = {
|
|
212
|
+
[ExtraInformationFields.COLUMN_EXTRA_INFORMATION]?: ExtraInformationType;
|
|
196
213
|
};
|
|
197
214
|
export declare class LicensesClient extends AbstractClient {
|
|
198
215
|
/**
|
|
@@ -266,11 +283,11 @@ export declare class LicensesClient extends AbstractClient {
|
|
|
266
283
|
updateConfig(reference: string, config: ConfigFindResult): Promise<ConfigFindResult>;
|
|
267
284
|
getLicense(licenseReference: string, parameters?: Parameters): Promise<GetResult<GetLicenseResult>>;
|
|
268
285
|
updateSeats(licenseReference: string, putData: UpdateSeatsData, parameters?: Parameters): Promise<void>;
|
|
269
|
-
suspendLicense(licenseReference: string, parameters?: Parameters): Promise<void>;
|
|
270
|
-
reactivateLicense(licenseReference: string, parameters?: Parameters): Promise<void>;
|
|
271
|
-
cancelLicense(licenseReference: string, parameters?: Parameters): Promise<void>;
|
|
286
|
+
suspendLicense(licenseReference: string, payload?: PutSuspend, parameters?: Parameters): Promise<void>;
|
|
287
|
+
reactivateLicense(licenseReference: string, payload?: PutReactivate, parameters?: Parameters): Promise<void>;
|
|
288
|
+
cancelLicense(licenseReference: string, payload?: PutCancel, parameters?: Parameters): Promise<void>;
|
|
272
289
|
updateFriendlyName(licenseReference: string, putData: PutFriendlyName, parameters?: Parameters): Promise<void>;
|
|
273
290
|
getHistory(licenseReference: string, parameters?: Parameters): Promise<GetResult<LicenceHistoryResult>>;
|
|
274
|
-
cancelAutoRenew(licenseReference: string, parameters?: Parameters): Promise<void>;
|
|
275
|
-
reactivateAutoRenew(licenseReference: string, parameters?: Parameters): Promise<void>;
|
|
291
|
+
cancelAutoRenew(licenseReference: string, payload?: PutCancelAutoRenew, parameters?: Parameters): Promise<void>;
|
|
292
|
+
reactivateAutoRenew(licenseReference: string, payload?: PutReactivateAutoRenew, parameters?: Parameters): Promise<void>;
|
|
276
293
|
}
|
|
@@ -274,17 +274,17 @@ class LicensesClient extends abstractClient_1.AbstractClient {
|
|
|
274
274
|
this.path = licenseReference + this.SEATS_PATH;
|
|
275
275
|
return this.put(putData, parameters);
|
|
276
276
|
}
|
|
277
|
-
suspendLicense(licenseReference, parameters = {}) {
|
|
277
|
+
suspendLicense(licenseReference, payload, parameters = {}) {
|
|
278
278
|
this.path = licenseReference + this.SUSPEND_PATH;
|
|
279
|
-
return this.put(
|
|
279
|
+
return this.put(payload, parameters);
|
|
280
280
|
}
|
|
281
|
-
reactivateLicense(licenseReference, parameters = {}) {
|
|
281
|
+
reactivateLicense(licenseReference, payload, parameters = {}) {
|
|
282
282
|
this.path = licenseReference + this.REACTIVATE_PATH;
|
|
283
|
-
return this.put(
|
|
283
|
+
return this.put(payload, parameters);
|
|
284
284
|
}
|
|
285
|
-
cancelLicense(licenseReference, parameters = {}) {
|
|
285
|
+
cancelLicense(licenseReference, payload, parameters = {}) {
|
|
286
286
|
this.path = licenseReference + this.CANCEL_PATH;
|
|
287
|
-
return this.put(
|
|
287
|
+
return this.put(payload, parameters);
|
|
288
288
|
}
|
|
289
289
|
async updateFriendlyName(licenseReference, putData, parameters = {}) {
|
|
290
290
|
this.path = licenseReference + this.UPDATE_FRIENDLYNAME_PATH;
|
|
@@ -294,13 +294,13 @@ class LicensesClient extends abstractClient_1.AbstractClient {
|
|
|
294
294
|
this.path = licenseReference + this.GET_LICENSE_HISTORY_PATH;
|
|
295
295
|
return new getResult_1.GetResult(licenceHistoryResult_1.LicenceHistoryResult, await this.get(parameters));
|
|
296
296
|
}
|
|
297
|
-
async cancelAutoRenew(licenseReference, parameters = {}) {
|
|
297
|
+
async cancelAutoRenew(licenseReference, payload, parameters = {}) {
|
|
298
298
|
this.path = licenseReference + this.CANCEL_AUTO_RENEW_PATH;
|
|
299
|
-
return await this.put(
|
|
299
|
+
return await this.put(payload, parameters);
|
|
300
300
|
}
|
|
301
|
-
async reactivateAutoRenew(licenseReference, parameters = {}) {
|
|
301
|
+
async reactivateAutoRenew(licenseReference, payload, parameters = {}) {
|
|
302
302
|
this.path = licenseReference + this.REACTIVATE_AUTO_RENEW_PATH;
|
|
303
|
-
return await this.put(
|
|
303
|
+
return await this.put(payload, parameters);
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
exports.LicensesClient = LicensesClient;
|
package/package.json
CHANGED