@arrowsphere/api-client 2.6.0 → 3.0.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 +19 -0
- package/build/abstractClient.js +2 -2
- package/build/abstractGraphQLClient.d.ts +27 -0
- package/build/abstractGraphQLClient.js +57 -0
- package/build/catalog/catalogGraphQLClient.d.ts +17 -0
- package/build/catalog/catalogGraphQLClient.js +28 -0
- package/build/catalog/index.d.ts +2 -0
- package/build/catalog/index.js +15 -0
- package/build/catalog/types/catalogGraphQLTypes.d.ts +224 -0
- package/build/catalog/types/catalogGraphQLTypes.js +3 -0
- package/build/exception/entityValidationException.d.ts +3 -1
- package/build/exception/entityValidationException.js +3 -1
- package/build/exception/notFoundException.d.ts +3 -1
- package/build/exception/notFoundException.js +3 -1
- package/build/exception/publicApiClientException.d.ts +3 -1
- package/build/exception/publicApiClientException.js +3 -1
- package/build/index.d.ts +3 -0
- package/build/index.js +3 -0
- package/build/licenses/entities/getLicense/licenseGetResult.d.ts +9 -0
- package/build/licenses/entities/getLicense/licenseGetResult.js +23 -2
- package/build/licenses/entities/getLicense/licensePriceGetResult.d.ts +3 -0
- package/build/licenses/entities/getLicense/licensePriceGetResult.js +9 -2
- package/build/licenses/licensesClient.d.ts +8 -0
- package/build/licenses/licensesClient.js +8 -0
- package/build/publicGraphQLClient.d.ts +5 -0
- package/build/publicGraphQLClient.js +12 -0
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
4
4
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
5
|
|
|
6
|
+
## [3.0.0] - 2022-03-08
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- Moved the property `currency` of license from root to price object
|
|
11
|
+
|
|
12
|
+
## [2.8.0] - 2022-03-03
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Add endpoint graphQL
|
|
17
|
+
|
|
18
|
+
## [2.7.0] - 2022-03-03
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- Update object license for getLicense endpoint
|
|
23
|
+
- Add endpoint update license friendlyName
|
|
24
|
+
|
|
6
25
|
## [2.6.0] - 2022-02-22
|
|
7
26
|
|
|
8
27
|
### Added
|
package/build/abstractClient.js
CHANGED
|
@@ -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
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import * as Dom from 'graphql-request/dist/types.dom';
|
|
3
|
+
import { Options } from './abstractClient';
|
|
4
|
+
import { GetProductsType } from './catalog';
|
|
5
|
+
export declare type GraphQLResponseTypes = GetProductsType;
|
|
6
|
+
export declare abstract class AbstractGraphQLClient {
|
|
7
|
+
/**
|
|
8
|
+
* Base path for HTTP calls
|
|
9
|
+
*/
|
|
10
|
+
protected basePath: string;
|
|
11
|
+
/**
|
|
12
|
+
* Current path for HTTP calls
|
|
13
|
+
*/
|
|
14
|
+
protected path: string;
|
|
15
|
+
protected client: GraphQLClient;
|
|
16
|
+
protected url: string;
|
|
17
|
+
protected token: string;
|
|
18
|
+
protected optionsHeader?: Dom.RequestInit['headers'];
|
|
19
|
+
protected options: Options;
|
|
20
|
+
private getClient;
|
|
21
|
+
setToken(apiKey: string): this;
|
|
22
|
+
setUrl(url: string): this;
|
|
23
|
+
setOptionsHeader(options: Dom.RequestInit['headers']): this;
|
|
24
|
+
setOptions(options: Options): this;
|
|
25
|
+
protected post(query: string): Promise<GraphQLResponseTypes>;
|
|
26
|
+
protected generateUrl(): string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AbstractGraphQLClient = void 0;
|
|
7
|
+
const graphql_request_1 = require("graphql-request");
|
|
8
|
+
const url_1 = require("url");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
class AbstractGraphQLClient {
|
|
11
|
+
constructor() {
|
|
12
|
+
/**
|
|
13
|
+
* Base path for HTTP calls
|
|
14
|
+
*/
|
|
15
|
+
this.basePath = '';
|
|
16
|
+
/**
|
|
17
|
+
* Current path for HTTP calls
|
|
18
|
+
*/
|
|
19
|
+
this.path = '';
|
|
20
|
+
this.url = '';
|
|
21
|
+
this.token = '';
|
|
22
|
+
this.options = {};
|
|
23
|
+
}
|
|
24
|
+
getClient() {
|
|
25
|
+
this.client = new graphql_request_1.GraphQLClient(this.generateUrl());
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
setToken(apiKey) {
|
|
29
|
+
this.token = apiKey;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
setUrl(url) {
|
|
33
|
+
this.url = url;
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
setOptionsHeader(options) {
|
|
37
|
+
this.optionsHeader = options;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
setOptions(options) {
|
|
41
|
+
this.options = options;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
async post(query) {
|
|
45
|
+
this.getClient().client.setHeaders({
|
|
46
|
+
authorization: this.token,
|
|
47
|
+
...this.optionsHeader,
|
|
48
|
+
});
|
|
49
|
+
return await this.client.request(query);
|
|
50
|
+
}
|
|
51
|
+
generateUrl() {
|
|
52
|
+
const url = new url_1.URL(`${this.options.isAdmin ? path_1.default.join('admin', this.basePath) : this.basePath}${this.path}`, this.url);
|
|
53
|
+
return url.toString();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.AbstractGraphQLClient = AbstractGraphQLClient;
|
|
57
|
+
//# sourceMappingURL=abstractGraphQLClient.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AbstractGraphQLClient } from '../abstractGraphQLClient';
|
|
2
|
+
import { GetProductsType } from './types/catalogGraphQLTypes';
|
|
3
|
+
export declare class CatalogGraphQLClient extends AbstractGraphQLClient {
|
|
4
|
+
/**
|
|
5
|
+
* The base path of the Catalog API
|
|
6
|
+
*/
|
|
7
|
+
private ROOT_PATH;
|
|
8
|
+
/**
|
|
9
|
+
* The base path of the API
|
|
10
|
+
*/
|
|
11
|
+
protected basePath: string;
|
|
12
|
+
/**
|
|
13
|
+
* The Path of graphql catalog API
|
|
14
|
+
*/
|
|
15
|
+
private GRAPHQL;
|
|
16
|
+
find(request: string): Promise<GetProductsType>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CatalogGraphQLClient = void 0;
|
|
4
|
+
const abstractGraphQLClient_1 = require("../abstractGraphQLClient");
|
|
5
|
+
// import { inspect } from 'util';
|
|
6
|
+
class CatalogGraphQLClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
/**
|
|
10
|
+
* The base path of the Catalog API
|
|
11
|
+
*/
|
|
12
|
+
this.ROOT_PATH = 'catalog/';
|
|
13
|
+
/**
|
|
14
|
+
* The base path of the API
|
|
15
|
+
*/
|
|
16
|
+
this.basePath = this.ROOT_PATH;
|
|
17
|
+
/**
|
|
18
|
+
* The Path of graphql catalog API
|
|
19
|
+
*/
|
|
20
|
+
this.GRAPHQL = 'graphql';
|
|
21
|
+
}
|
|
22
|
+
async find(request) {
|
|
23
|
+
this.path = this.GRAPHQL;
|
|
24
|
+
return await this.post(request);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.CatalogGraphQLClient = CatalogGraphQLClient;
|
|
28
|
+
//# sourceMappingURL=catalogGraphQLClient.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./types/catalogGraphQLTypes"), exports);
|
|
14
|
+
__exportStar(require("./catalogGraphQLClient"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
export declare type GetProductsType = {
|
|
2
|
+
getProducts?: PaginatedProductsType;
|
|
3
|
+
};
|
|
4
|
+
export declare type PaginatedProductsType = {
|
|
5
|
+
filters?: Array<FiltersType>;
|
|
6
|
+
pagination?: PaginationType;
|
|
7
|
+
products?: Array<ProductType>;
|
|
8
|
+
topOffers?: Array<ProductType>;
|
|
9
|
+
};
|
|
10
|
+
export declare type FiltersType = {
|
|
11
|
+
name?: string;
|
|
12
|
+
values?: FiltersValuesType;
|
|
13
|
+
};
|
|
14
|
+
export declare type FiltersValuesType = {
|
|
15
|
+
value?: string;
|
|
16
|
+
count?: number;
|
|
17
|
+
};
|
|
18
|
+
export declare type PaginationType = {
|
|
19
|
+
perPage?: number;
|
|
20
|
+
currentPage?: number;
|
|
21
|
+
totalPage?: number;
|
|
22
|
+
total?: number;
|
|
23
|
+
next?: string;
|
|
24
|
+
previous?: string;
|
|
25
|
+
};
|
|
26
|
+
export declare type ProductType = {
|
|
27
|
+
id?: string;
|
|
28
|
+
identifiers?: IdentifiersType;
|
|
29
|
+
name?: string;
|
|
30
|
+
classification?: string;
|
|
31
|
+
arrowCategories?: Array<string>;
|
|
32
|
+
arrowSubCategories?: Array<string>;
|
|
33
|
+
licenseAgreementType?: string;
|
|
34
|
+
family?: FamilyType;
|
|
35
|
+
isAddon?: boolean;
|
|
36
|
+
hasAddons?: boolean;
|
|
37
|
+
actionFlags?: ActionFlagsType;
|
|
38
|
+
addonPrimaries?: Array<IdentifiersType>;
|
|
39
|
+
conversionOfferPrimaries?: Array<IdentifiersType>;
|
|
40
|
+
baseOfferPrimaries?: Array<IdentifiersType>;
|
|
41
|
+
assets?: AssetsType;
|
|
42
|
+
environmentAvailability?: string;
|
|
43
|
+
marketplace?: string;
|
|
44
|
+
isEnabled?: boolean;
|
|
45
|
+
isTrial?: boolean;
|
|
46
|
+
isIndirectBusiness?: boolean;
|
|
47
|
+
lastUpdate?: string;
|
|
48
|
+
marketingText?: MarketingTextType;
|
|
49
|
+
vendorOfferUrl?: string;
|
|
50
|
+
serviceDescription?: string;
|
|
51
|
+
eula?: string;
|
|
52
|
+
endCustomerEula?: string;
|
|
53
|
+
endCustomerRequirements?: string;
|
|
54
|
+
endCustomerFeatures?: string;
|
|
55
|
+
xspUrl?: string;
|
|
56
|
+
saleConstraints?: SaleConstraintsType;
|
|
57
|
+
vendor?: VendorType;
|
|
58
|
+
program?: ProgramType;
|
|
59
|
+
weightTopSales?: number;
|
|
60
|
+
weightForced?: number;
|
|
61
|
+
priceBand?: Array<PriceBandType>;
|
|
62
|
+
defaultPriceBand?: PriceBandType;
|
|
63
|
+
relatedOffers?: Array<RelatedOfferType>;
|
|
64
|
+
resellers?: OfferResellersType;
|
|
65
|
+
scope?: string;
|
|
66
|
+
};
|
|
67
|
+
export declare type IdentifiersType = {
|
|
68
|
+
arrowsphere?: ArrowsphereIdentifierType;
|
|
69
|
+
vendor?: VendorIdentifierType;
|
|
70
|
+
};
|
|
71
|
+
export declare type ArrowsphereIdentifierType = {
|
|
72
|
+
sku?: string;
|
|
73
|
+
skuXsp?: string;
|
|
74
|
+
skuXac?: string;
|
|
75
|
+
orderableSku?: string;
|
|
76
|
+
};
|
|
77
|
+
export declare type VendorIdentifierType = {
|
|
78
|
+
name?: string;
|
|
79
|
+
family?: string;
|
|
80
|
+
offerName?: string;
|
|
81
|
+
sku?: string;
|
|
82
|
+
attributes?: AttributesType;
|
|
83
|
+
};
|
|
84
|
+
export declare type AttributesType = {
|
|
85
|
+
cancelSubscription?: boolean;
|
|
86
|
+
canSwitchAutoRenew?: boolean;
|
|
87
|
+
decreaseSeats?: boolean;
|
|
88
|
+
increaseSeats?: boolean;
|
|
89
|
+
partIdentifier?: string;
|
|
90
|
+
periodicity?: number;
|
|
91
|
+
planId?: string;
|
|
92
|
+
productId?: string;
|
|
93
|
+
productSku?: string;
|
|
94
|
+
reactivateSubscription?: boolean;
|
|
95
|
+
suspendSubscription?: boolean;
|
|
96
|
+
term?: number;
|
|
97
|
+
unitType?: string;
|
|
98
|
+
};
|
|
99
|
+
export declare type FamilyType = {
|
|
100
|
+
id?: string;
|
|
101
|
+
name?: string;
|
|
102
|
+
};
|
|
103
|
+
export declare type ActionFlagsType = {
|
|
104
|
+
isAutoRenew?: boolean;
|
|
105
|
+
isManualProvisioning?: boolean;
|
|
106
|
+
renewalSku?: string;
|
|
107
|
+
};
|
|
108
|
+
export declare type AssetsType = {
|
|
109
|
+
featurePictureUrl?: string;
|
|
110
|
+
mainLogoUrl?: string;
|
|
111
|
+
pictureUrl?: string;
|
|
112
|
+
squareLogoUrl?: string;
|
|
113
|
+
};
|
|
114
|
+
export declare type MarketingTextType = {
|
|
115
|
+
overviewDescription?: string;
|
|
116
|
+
featuresShort?: string;
|
|
117
|
+
featuresFull?: string;
|
|
118
|
+
features?: string;
|
|
119
|
+
};
|
|
120
|
+
export declare type SaleConstraintsType = {
|
|
121
|
+
customerQualifications?: Array<string>;
|
|
122
|
+
resellerQualifications?: Array<string>;
|
|
123
|
+
minQuantity?: number;
|
|
124
|
+
maxQuantity?: number;
|
|
125
|
+
maxSubscriptionConstraint?: string;
|
|
126
|
+
maxSubscriptionPerCustomer?: number;
|
|
127
|
+
saleGroup?: string;
|
|
128
|
+
requiredAttributes?: Array<string>;
|
|
129
|
+
};
|
|
130
|
+
export declare type VendorType = {
|
|
131
|
+
name?: string;
|
|
132
|
+
};
|
|
133
|
+
export declare type ProgramType = {
|
|
134
|
+
isEnabled?: boolean;
|
|
135
|
+
legacyCode?: string;
|
|
136
|
+
names?: ProgramNameType;
|
|
137
|
+
};
|
|
138
|
+
export declare type ProgramNameType = {
|
|
139
|
+
full?: string;
|
|
140
|
+
};
|
|
141
|
+
export declare type PriceBandType = {
|
|
142
|
+
actionFlags?: PriceBandActionFlagsType;
|
|
143
|
+
attributes?: Array<AttributeType>;
|
|
144
|
+
billing?: BillingType;
|
|
145
|
+
currency?: string;
|
|
146
|
+
dynamicAttributes?: DynamicAttributesType;
|
|
147
|
+
family?: FamilyType;
|
|
148
|
+
identifiers?: PriceBandIdentifiersType;
|
|
149
|
+
isEnabled?: boolean;
|
|
150
|
+
marketplace?: string;
|
|
151
|
+
name?: string;
|
|
152
|
+
orderingType?: string;
|
|
153
|
+
prices?: PricesType;
|
|
154
|
+
saleConstraints?: PriceBandSaleConstraintsType;
|
|
155
|
+
uom?: UomType;
|
|
156
|
+
};
|
|
157
|
+
export declare type PriceBandActionFlagsType = {
|
|
158
|
+
canBeCancelled?: boolean;
|
|
159
|
+
canBeReactivated?: boolean;
|
|
160
|
+
canBeSuspended?: boolean;
|
|
161
|
+
canDecreaseSeats?: boolean;
|
|
162
|
+
canIncreaseSeats?: boolean;
|
|
163
|
+
};
|
|
164
|
+
export declare type AttributeType = {
|
|
165
|
+
name?: string;
|
|
166
|
+
value?: string;
|
|
167
|
+
};
|
|
168
|
+
export declare type BillingType = {
|
|
169
|
+
cycle?: number;
|
|
170
|
+
term?: number;
|
|
171
|
+
type?: string;
|
|
172
|
+
};
|
|
173
|
+
export declare type DynamicAttributesType = {
|
|
174
|
+
diskSize?: string;
|
|
175
|
+
ram?: string;
|
|
176
|
+
region?: string;
|
|
177
|
+
vCpu?: string;
|
|
178
|
+
reservationsAutofitGroup?: string;
|
|
179
|
+
acu?: string;
|
|
180
|
+
marketSegment?: string;
|
|
181
|
+
version?: string;
|
|
182
|
+
metric?: string;
|
|
183
|
+
};
|
|
184
|
+
export declare type PriceBandIdentifiersType = {
|
|
185
|
+
arrowsphere?: PriceBandArrowsphereIdentifierType;
|
|
186
|
+
erp?: ErpIdentifierType;
|
|
187
|
+
vendor?: PriceBandVendorIdentifierType;
|
|
188
|
+
};
|
|
189
|
+
export declare type PriceBandArrowsphereIdentifierType = {
|
|
190
|
+
sku?: string;
|
|
191
|
+
};
|
|
192
|
+
export declare type ErpIdentifierType = {
|
|
193
|
+
sku?: string;
|
|
194
|
+
};
|
|
195
|
+
export declare type PriceBandVendorIdentifierType = {
|
|
196
|
+
purchasePlan?: string;
|
|
197
|
+
sku?: string;
|
|
198
|
+
};
|
|
199
|
+
export declare type PricesType = {
|
|
200
|
+
buy?: string;
|
|
201
|
+
sell?: string;
|
|
202
|
+
public?: string;
|
|
203
|
+
};
|
|
204
|
+
export declare type PriceBandSaleConstraintsType = {
|
|
205
|
+
availableDate?: string;
|
|
206
|
+
expiryDate?: string;
|
|
207
|
+
minQuantity?: number;
|
|
208
|
+
maxQuantity?: number;
|
|
209
|
+
};
|
|
210
|
+
export declare type UomType = {
|
|
211
|
+
quantity?: number;
|
|
212
|
+
type?: string;
|
|
213
|
+
};
|
|
214
|
+
export declare type RelatedOfferType = {
|
|
215
|
+
vendor?: string;
|
|
216
|
+
sku?: string;
|
|
217
|
+
};
|
|
218
|
+
export declare type OfferResellersType = {
|
|
219
|
+
owner?: ResellerType;
|
|
220
|
+
viewers?: Array<ResellerType>;
|
|
221
|
+
};
|
|
222
|
+
export declare type ResellerType = {
|
|
223
|
+
xspRef?: string;
|
|
224
|
+
};
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './publicApiClient';
|
|
2
|
+
export * from './publicGraphQLClient';
|
|
2
3
|
export * from './abstractEntity';
|
|
3
4
|
export * from './abstractClient';
|
|
5
|
+
export * from './abstractGraphQLClient';
|
|
6
|
+
export * from './catalog/';
|
|
4
7
|
export * from './licenses/';
|
|
5
8
|
export * from './general/';
|
|
6
9
|
export * from './subscriptions/';
|
package/build/index.js
CHANGED
|
@@ -11,8 +11,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./publicApiClient"), exports);
|
|
14
|
+
__exportStar(require("./publicGraphQLClient"), exports);
|
|
14
15
|
__exportStar(require("./abstractEntity"), exports);
|
|
15
16
|
__exportStar(require("./abstractClient"), exports);
|
|
17
|
+
__exportStar(require("./abstractGraphQLClient"), exports);
|
|
18
|
+
__exportStar(require("./catalog/"), exports);
|
|
16
19
|
__exportStar(require("./licenses/"), exports);
|
|
17
20
|
__exportStar(require("./general/"), exports);
|
|
18
21
|
__exportStar(require("./subscriptions/"), exports);
|
|
@@ -10,6 +10,9 @@ 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",
|
|
13
16
|
COLUMN_SERVICE_REF = "service_ref",
|
|
14
17
|
COLUMN_SKU = "sku",
|
|
15
18
|
COLUMN_NAME = "name",
|
|
@@ -38,6 +41,9 @@ export declare type LicenseGetData = {
|
|
|
38
41
|
[LicenseGetFields.COLUMN_FRIENDLY_NAME]: string | null;
|
|
39
42
|
[LicenseGetFields.COLUMN_CUSTOMER_REF]: string;
|
|
40
43
|
[LicenseGetFields.COLUMN_STATE]: string;
|
|
44
|
+
[LicenseGetFields.COLUMN_STATUS_CODE]: number;
|
|
45
|
+
[LicenseGetFields.COLUMN_IS_TRIAL]: boolean;
|
|
46
|
+
[LicenseGetFields.COLUMN_IS_ADDON]: boolean;
|
|
41
47
|
[LicenseGetFields.COLUMN_SERVICE_REF]: string;
|
|
42
48
|
[LicenseGetFields.COLUMN_SKU]: string;
|
|
43
49
|
[LicenseGetFields.COLUMN_NAME]: string;
|
|
@@ -68,6 +74,9 @@ export declare class LicenseGetResult extends AbstractEntity<LicenseGetData> {
|
|
|
68
74
|
get friendlyName(): string | null;
|
|
69
75
|
get customerRef(): string;
|
|
70
76
|
get state(): string;
|
|
77
|
+
get statusCode(): number;
|
|
78
|
+
get isTrial(): boolean;
|
|
79
|
+
get isAddon(): boolean;
|
|
71
80
|
get serviceRef(): string;
|
|
72
81
|
get sku(): string;
|
|
73
82
|
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, _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,9 @@ 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";
|
|
31
34
|
LicenseGetFields["COLUMN_SERVICE_REF"] = "service_ref";
|
|
32
35
|
LicenseGetFields["COLUMN_SKU"] = "sku";
|
|
33
36
|
LicenseGetFields["COLUMN_NAME"] = "name";
|
|
@@ -59,6 +62,9 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
|
|
|
59
62
|
_friendlyName.set(this, void 0);
|
|
60
63
|
_customer_ref.set(this, void 0);
|
|
61
64
|
_state.set(this, void 0);
|
|
65
|
+
_statusCode.set(this, void 0);
|
|
66
|
+
_isTrial.set(this, void 0);
|
|
67
|
+
_isAddon.set(this, void 0);
|
|
62
68
|
_service_ref.set(this, void 0);
|
|
63
69
|
_sku.set(this, void 0);
|
|
64
70
|
_name.set(this, void 0);
|
|
@@ -85,6 +91,9 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
|
|
|
85
91
|
__classPrivateFieldSet(this, _friendlyName, licenseGetDataInput[LicenseGetFields.COLUMN_FRIENDLY_NAME]);
|
|
86
92
|
__classPrivateFieldSet(this, _customer_ref, licenseGetDataInput[LicenseGetFields.COLUMN_CUSTOMER_REF]);
|
|
87
93
|
__classPrivateFieldSet(this, _state, licenseGetDataInput[LicenseGetFields.COLUMN_STATE]);
|
|
94
|
+
__classPrivateFieldSet(this, _statusCode, licenseGetDataInput[LicenseGetFields.COLUMN_STATUS_CODE]);
|
|
95
|
+
__classPrivateFieldSet(this, _isTrial, licenseGetDataInput[LicenseGetFields.COLUMN_IS_TRIAL]);
|
|
96
|
+
__classPrivateFieldSet(this, _isAddon, licenseGetDataInput[LicenseGetFields.COLUMN_IS_ADDON]);
|
|
88
97
|
__classPrivateFieldSet(this, _service_ref, licenseGetDataInput[LicenseGetFields.COLUMN_SERVICE_REF]);
|
|
89
98
|
__classPrivateFieldSet(this, _sku, licenseGetDataInput[LicenseGetFields.COLUMN_SKU]);
|
|
90
99
|
__classPrivateFieldSet(this, _name, licenseGetDataInput[LicenseGetFields.COLUMN_NAME]);
|
|
@@ -124,6 +133,15 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
|
|
|
124
133
|
get state() {
|
|
125
134
|
return __classPrivateFieldGet(this, _state);
|
|
126
135
|
}
|
|
136
|
+
get statusCode() {
|
|
137
|
+
return __classPrivateFieldGet(this, _statusCode);
|
|
138
|
+
}
|
|
139
|
+
get isTrial() {
|
|
140
|
+
return __classPrivateFieldGet(this, _isTrial);
|
|
141
|
+
}
|
|
142
|
+
get isAddon() {
|
|
143
|
+
return __classPrivateFieldGet(this, _isAddon);
|
|
144
|
+
}
|
|
127
145
|
get serviceRef() {
|
|
128
146
|
return __classPrivateFieldGet(this, _service_ref);
|
|
129
147
|
}
|
|
@@ -195,6 +213,9 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
|
|
|
195
213
|
[LicenseGetFields.COLUMN_FRIENDLY_NAME]: this.friendlyName,
|
|
196
214
|
[LicenseGetFields.COLUMN_CUSTOMER_REF]: this.customerRef,
|
|
197
215
|
[LicenseGetFields.COLUMN_STATE]: this.state,
|
|
216
|
+
[LicenseGetFields.COLUMN_STATUS_CODE]: this.statusCode,
|
|
217
|
+
[LicenseGetFields.COLUMN_IS_TRIAL]: this.isTrial,
|
|
218
|
+
[LicenseGetFields.COLUMN_IS_ADDON]: this.isAddon,
|
|
198
219
|
[LicenseGetFields.COLUMN_SERVICE_REF]: this.serviceRef,
|
|
199
220
|
[LicenseGetFields.COLUMN_SKU]: this.sku,
|
|
200
221
|
[LicenseGetFields.COLUMN_NAME]: this.name,
|
|
@@ -221,5 +242,5 @@ class LicenseGetResult extends abstractEntity_1.AbstractEntity {
|
|
|
221
242
|
}
|
|
222
243
|
}
|
|
223
244
|
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();
|
|
245
|
+
_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(), _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
246
|
//# sourceMappingURL=licenseGetResult.js.map
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { BuySellData, BuySellFindResult } from './buySellFindResult';
|
|
2
2
|
import { AbstractEntity } from '../../../abstractEntity';
|
|
3
3
|
export declare enum LicensePriceGetFields {
|
|
4
|
+
COLUMN_CURRENCY = "currency",
|
|
4
5
|
COLUMN_UNIT = "unit",
|
|
5
6
|
COLUMN_TOTAL = "total"
|
|
6
7
|
}
|
|
7
8
|
export declare type LicensePriceGetData = {
|
|
9
|
+
[LicensePriceGetFields.COLUMN_CURRENCY]: string;
|
|
8
10
|
[LicensePriceGetFields.COLUMN_UNIT]: BuySellData;
|
|
9
11
|
[LicensePriceGetFields.COLUMN_TOTAL]: BuySellData;
|
|
10
12
|
};
|
|
11
13
|
export declare class LicensePriceGetResult extends AbstractEntity<LicensePriceGetData> {
|
|
12
14
|
#private;
|
|
13
15
|
constructor(data: LicensePriceGetData);
|
|
16
|
+
get currency(): string;
|
|
14
17
|
get unit(): BuySellFindResult;
|
|
15
18
|
get total(): BuySellFindResult;
|
|
16
19
|
toJSON(): LicensePriceGetData;
|
|
@@ -12,24 +12,30 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
}
|
|
13
13
|
return privateMap.get(receiver);
|
|
14
14
|
};
|
|
15
|
-
var _unit, _total;
|
|
15
|
+
var _currency, _unit, _total;
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.LicensePriceGetResult = exports.LicensePriceGetFields = void 0;
|
|
18
18
|
const buySellFindResult_1 = require("./buySellFindResult");
|
|
19
19
|
const abstractEntity_1 = require("../../../abstractEntity");
|
|
20
20
|
var LicensePriceGetFields;
|
|
21
21
|
(function (LicensePriceGetFields) {
|
|
22
|
+
LicensePriceGetFields["COLUMN_CURRENCY"] = "currency";
|
|
22
23
|
LicensePriceGetFields["COLUMN_UNIT"] = "unit";
|
|
23
24
|
LicensePriceGetFields["COLUMN_TOTAL"] = "total";
|
|
24
25
|
})(LicensePriceGetFields = exports.LicensePriceGetFields || (exports.LicensePriceGetFields = {}));
|
|
25
26
|
class LicensePriceGetResult extends abstractEntity_1.AbstractEntity {
|
|
26
27
|
constructor(data) {
|
|
27
28
|
super(data);
|
|
29
|
+
_currency.set(this, void 0);
|
|
28
30
|
_unit.set(this, void 0);
|
|
29
31
|
_total.set(this, void 0);
|
|
32
|
+
__classPrivateFieldSet(this, _currency, data[LicensePriceGetFields.COLUMN_CURRENCY]);
|
|
30
33
|
__classPrivateFieldSet(this, _unit, new buySellFindResult_1.BuySellFindResult(data[LicensePriceGetFields.COLUMN_UNIT]));
|
|
31
34
|
__classPrivateFieldSet(this, _total, new buySellFindResult_1.BuySellFindResult(data[LicensePriceGetFields.COLUMN_TOTAL]));
|
|
32
35
|
}
|
|
36
|
+
get currency() {
|
|
37
|
+
return __classPrivateFieldGet(this, _currency);
|
|
38
|
+
}
|
|
33
39
|
get unit() {
|
|
34
40
|
return __classPrivateFieldGet(this, _unit);
|
|
35
41
|
}
|
|
@@ -38,11 +44,12 @@ class LicensePriceGetResult extends abstractEntity_1.AbstractEntity {
|
|
|
38
44
|
}
|
|
39
45
|
toJSON() {
|
|
40
46
|
return {
|
|
47
|
+
[LicensePriceGetFields.COLUMN_CURRENCY]: __classPrivateFieldGet(this, _currency),
|
|
41
48
|
[LicensePriceGetFields.COLUMN_UNIT]: this.unit.toJSON(),
|
|
42
49
|
[LicensePriceGetFields.COLUMN_TOTAL]: this.total.toJSON(),
|
|
43
50
|
};
|
|
44
51
|
}
|
|
45
52
|
}
|
|
46
53
|
exports.LicensePriceGetResult = LicensePriceGetResult;
|
|
47
|
-
_unit = new WeakMap(), _total = new WeakMap();
|
|
54
|
+
_currency = new WeakMap(), _unit = new WeakMap(), _total = new WeakMap();
|
|
48
55
|
//# sourceMappingURL=licensePriceGetResult.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
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublicGraphQLClient = void 0;
|
|
4
|
+
const catalogGraphQLClient_1 = require("./catalog/catalogGraphQLClient");
|
|
5
|
+
const abstractGraphQLClient_1 = require("./abstractGraphQLClient");
|
|
6
|
+
class PublicGraphQLClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
|
|
7
|
+
getCatalogGraphQLClient() {
|
|
8
|
+
return new catalogGraphQLClient_1.CatalogGraphQLClient().setUrl(this.url).setToken(this.token);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.PublicGraphQLClient = PublicGraphQLClient;
|
|
12
|
+
//# sourceMappingURL=publicGraphQLClient.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": "
|
|
7
|
+
"version": "3.0.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",
|
|
@@ -80,6 +80,8 @@
|
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@types/validatorjs": "3.15.0",
|
|
82
82
|
"axios": "0.21.1",
|
|
83
|
+
"graphql": "^16.3.0",
|
|
84
|
+
"graphql-request": "^4.0.0",
|
|
83
85
|
"validatorjs": "3.22.1"
|
|
84
86
|
}
|
|
85
87
|
}
|