btrz-api-client 5.227.0 → 5.228.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/lib/client-standalone-min.js +3 -3
- package/lib/client.js +1 -0
- package/lib/endpoints/inventory/control-classes.js +89 -0
- package/package.json +1 -1
- package/src/client.js +1 -0
- package/src/endpoints/inventory/control-classes.js +63 -0
- package/test/endpoints/inventory/control-classes.js +66 -0
- package/types/client.d.ts +33 -0
- package/types/endpoints/inventory/control-classes.d.ts +37 -0
- package/types/initializedClient.d.ts +33 -0
package/lib/client.js
CHANGED
|
@@ -66,6 +66,7 @@ function createInventory(_ref) {
|
|
|
66
66
|
stationsZones: require("./endpoints/inventory/stations-zones.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
67
67
|
parcelZones: require("./endpoints/inventory/parcel-zones.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
68
68
|
countries: require("./endpoints/inventory/countries.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
69
|
+
controlClasses: require("./endpoints/inventory/control-classes.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
69
70
|
fares: require("./endpoints/inventory/fares.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
70
71
|
promos: require("./endpoints/inventory/promos.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
71
72
|
labels: require("./endpoints/inventory/labels.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("./../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function controlClassesFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
|
+
|
|
10
|
+
function all(_ref2) {
|
|
11
|
+
var token = _ref2.token,
|
|
12
|
+
jwtToken = _ref2.jwtToken,
|
|
13
|
+
_ref2$query = _ref2.query,
|
|
14
|
+
query = _ref2$query === undefined ? {} : _ref2$query,
|
|
15
|
+
headers = _ref2.headers;
|
|
16
|
+
|
|
17
|
+
return client.get("/control-classes", {
|
|
18
|
+
params: query,
|
|
19
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function get(_ref3) {
|
|
24
|
+
var controlClassId = _ref3.controlClassId,
|
|
25
|
+
token = _ref3.token,
|
|
26
|
+
headers = _ref3.headers,
|
|
27
|
+
jwtToken = _ref3.jwtToken;
|
|
28
|
+
|
|
29
|
+
return client.get("/control-classes/" + controlClassId, {
|
|
30
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function create(_ref4) {
|
|
35
|
+
var jwtToken = _ref4.jwtToken,
|
|
36
|
+
token = _ref4.token,
|
|
37
|
+
controlClass = _ref4.controlClass,
|
|
38
|
+
headers = _ref4.headers;
|
|
39
|
+
|
|
40
|
+
return client({
|
|
41
|
+
url: "/control-classes",
|
|
42
|
+
method: "post",
|
|
43
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
44
|
+
data: {
|
|
45
|
+
controlClass: controlClass
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function remove(_ref5) {
|
|
51
|
+
var jwtToken = _ref5.jwtToken,
|
|
52
|
+
controlClassId = _ref5.controlClassId,
|
|
53
|
+
token = _ref5.token,
|
|
54
|
+
headers = _ref5.headers;
|
|
55
|
+
|
|
56
|
+
return client({
|
|
57
|
+
url: "/control-classes/" + controlClassId,
|
|
58
|
+
method: "delete",
|
|
59
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function update(_ref6) {
|
|
64
|
+
var jwtToken = _ref6.jwtToken,
|
|
65
|
+
token = _ref6.token,
|
|
66
|
+
controlClassId = _ref6.controlClassId,
|
|
67
|
+
controlClass = _ref6.controlClass,
|
|
68
|
+
headers = _ref6.headers;
|
|
69
|
+
|
|
70
|
+
return client({
|
|
71
|
+
url: "/control-classes/" + controlClassId,
|
|
72
|
+
method: "put",
|
|
73
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
74
|
+
data: {
|
|
75
|
+
controlClass: controlClass
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
all: all,
|
|
82
|
+
get: get,
|
|
83
|
+
create: create,
|
|
84
|
+
update: update,
|
|
85
|
+
remove: remove
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
module.exports = controlClassesFactory;
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -53,6 +53,7 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
|
|
|
53
53
|
stationsZones: require("./endpoints/inventory/stations-zones.js")({client, internalAuthTokenProvider}),
|
|
54
54
|
parcelZones: require("./endpoints/inventory/parcel-zones.js")({client, internalAuthTokenProvider}),
|
|
55
55
|
countries: require("./endpoints/inventory/countries.js")({client, internalAuthTokenProvider}),
|
|
56
|
+
controlClasses: require("./endpoints/inventory/control-classes.js")({client, internalAuthTokenProvider}),
|
|
56
57
|
fares: require("./endpoints/inventory/fares.js")({client, internalAuthTokenProvider}),
|
|
57
58
|
promos: require("./endpoints/inventory/promos.js")({client, internalAuthTokenProvider}),
|
|
58
59
|
labels: require("./endpoints/inventory/labels.js")({client, internalAuthTokenProvider}),
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("./../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
function controlClassesFactory({client, internalAuthTokenProvider}) {
|
|
6
|
+
function all({
|
|
7
|
+
token,
|
|
8
|
+
jwtToken,
|
|
9
|
+
query = {},
|
|
10
|
+
headers
|
|
11
|
+
}) {
|
|
12
|
+
return client.get("/control-classes", {
|
|
13
|
+
params: query,
|
|
14
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function get({controlClassId, token, headers, jwtToken}) {
|
|
19
|
+
return client.get(`/control-classes/${controlClassId}`, {
|
|
20
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function create({jwtToken, token, controlClass, headers}) {
|
|
25
|
+
return client({
|
|
26
|
+
url: "/control-classes",
|
|
27
|
+
method: "post",
|
|
28
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
29
|
+
data: {
|
|
30
|
+
controlClass
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function remove({jwtToken, controlClassId, token, headers}) {
|
|
36
|
+
return client({
|
|
37
|
+
url: `/control-classes/${controlClassId}`,
|
|
38
|
+
method: "delete",
|
|
39
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function update({jwtToken, token, controlClassId, controlClass, headers}) {
|
|
44
|
+
return client({
|
|
45
|
+
url: `/control-classes/${controlClassId}`,
|
|
46
|
+
method: "put",
|
|
47
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
48
|
+
data: {
|
|
49
|
+
controlClass
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
all,
|
|
56
|
+
get,
|
|
57
|
+
create,
|
|
58
|
+
update,
|
|
59
|
+
remove
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
module.exports = controlClassesFactory;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const {
|
|
2
|
+
axiosMock, expectRequest
|
|
3
|
+
} = require("./../../test-helpers.js");
|
|
4
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
5
|
+
|
|
6
|
+
describe("inventory/control-classes", () => {
|
|
7
|
+
const token = "I owe you a token";
|
|
8
|
+
const jwtToken = "I owe you a JWT token";
|
|
9
|
+
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
axiosMock.reset();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("should create a control class", () => {
|
|
15
|
+
axiosMock.onPost("/control-classes").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
16
|
+
return api.inventory.controlClasses.create({
|
|
17
|
+
jwtToken,
|
|
18
|
+
token,
|
|
19
|
+
controlClass: {
|
|
20
|
+
name: "My controlClass"
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should get all pieces of controlClass", () => {
|
|
26
|
+
axiosMock.onGet("/control-classes").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
27
|
+
return api.inventory.controlClasses.all({
|
|
28
|
+
jwtToken,
|
|
29
|
+
token,
|
|
30
|
+
query: {}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("should update a controlClass", () => {
|
|
35
|
+
const controlClassId = "1234";
|
|
36
|
+
axiosMock.onPut(`/control-classes/${controlClassId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
37
|
+
return api.inventory.controlClasses.update({
|
|
38
|
+
jwtToken,
|
|
39
|
+
token,
|
|
40
|
+
controlClassId,
|
|
41
|
+
controlClass: {
|
|
42
|
+
name: "My Updated controlClass"
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("should get a controlClass", () => {
|
|
48
|
+
const controlClassId = "1234";
|
|
49
|
+
axiosMock.onGet(`/control-classes/${controlClassId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
50
|
+
return api.inventory.controlClasses.get({
|
|
51
|
+
jwtToken,
|
|
52
|
+
token,
|
|
53
|
+
controlClassId
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("should delete a controlClass", () => {
|
|
58
|
+
const controlClassId = "1234";
|
|
59
|
+
axiosMock.onDelete(`/control-classes/${controlClassId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
60
|
+
return api.inventory.controlClasses.remove({
|
|
61
|
+
jwtToken,
|
|
62
|
+
token,
|
|
63
|
+
controlClassId
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
package/types/client.d.ts
CHANGED
|
@@ -266,6 +266,39 @@ export function createApiClient(options: {
|
|
|
266
266
|
headers: any;
|
|
267
267
|
}) => any;
|
|
268
268
|
};
|
|
269
|
+
controlClasses: {
|
|
270
|
+
all: ({ token, jwtToken, query, headers }: {
|
|
271
|
+
token: any;
|
|
272
|
+
jwtToken: any;
|
|
273
|
+
query?: {};
|
|
274
|
+
headers: any;
|
|
275
|
+
}) => any;
|
|
276
|
+
get: ({ controlClassId, token, headers, jwtToken }: {
|
|
277
|
+
controlClassId: any;
|
|
278
|
+
token: any;
|
|
279
|
+
headers: any;
|
|
280
|
+
jwtToken: any;
|
|
281
|
+
}) => any;
|
|
282
|
+
create: ({ jwtToken, token, controlClass, headers }: {
|
|
283
|
+
jwtToken: any;
|
|
284
|
+
token: any;
|
|
285
|
+
controlClass: any;
|
|
286
|
+
headers: any;
|
|
287
|
+
}) => any;
|
|
288
|
+
update: ({ jwtToken, token, controlClassId, controlClass, headers }: {
|
|
289
|
+
jwtToken: any;
|
|
290
|
+
token: any;
|
|
291
|
+
controlClassId: any;
|
|
292
|
+
controlClass: any;
|
|
293
|
+
headers: any;
|
|
294
|
+
}) => any;
|
|
295
|
+
remove: ({ jwtToken, controlClassId, token, headers }: {
|
|
296
|
+
jwtToken: any;
|
|
297
|
+
controlClassId: any;
|
|
298
|
+
token: any;
|
|
299
|
+
headers: any;
|
|
300
|
+
}) => any;
|
|
301
|
+
};
|
|
269
302
|
fares: {
|
|
270
303
|
all: ({ token, query, headers }: {
|
|
271
304
|
token: any;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export = controlClassesFactory;
|
|
2
|
+
declare function controlClassesFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
all: ({ token, jwtToken, query, headers }: {
|
|
7
|
+
token: any;
|
|
8
|
+
jwtToken: any;
|
|
9
|
+
query?: {};
|
|
10
|
+
headers: any;
|
|
11
|
+
}) => any;
|
|
12
|
+
get: ({ controlClassId, token, headers, jwtToken }: {
|
|
13
|
+
controlClassId: any;
|
|
14
|
+
token: any;
|
|
15
|
+
headers: any;
|
|
16
|
+
jwtToken: any;
|
|
17
|
+
}) => any;
|
|
18
|
+
create: ({ jwtToken, token, controlClass, headers }: {
|
|
19
|
+
jwtToken: any;
|
|
20
|
+
token: any;
|
|
21
|
+
controlClass: any;
|
|
22
|
+
headers: any;
|
|
23
|
+
}) => any;
|
|
24
|
+
update: ({ jwtToken, token, controlClassId, controlClass, headers }: {
|
|
25
|
+
jwtToken: any;
|
|
26
|
+
token: any;
|
|
27
|
+
controlClassId: any;
|
|
28
|
+
controlClass: any;
|
|
29
|
+
headers: any;
|
|
30
|
+
}) => any;
|
|
31
|
+
remove: ({ jwtToken, controlClassId, token, headers }: {
|
|
32
|
+
jwtToken: any;
|
|
33
|
+
controlClassId: any;
|
|
34
|
+
token: any;
|
|
35
|
+
headers: any;
|
|
36
|
+
}) => any;
|
|
37
|
+
};
|
|
@@ -220,6 +220,39 @@ declare const _exports: {
|
|
|
220
220
|
headers: any;
|
|
221
221
|
}) => any;
|
|
222
222
|
};
|
|
223
|
+
controlClasses: {
|
|
224
|
+
all: ({ token, jwtToken, query, headers }: {
|
|
225
|
+
token: any;
|
|
226
|
+
jwtToken: any;
|
|
227
|
+
query?: {};
|
|
228
|
+
headers: any;
|
|
229
|
+
}) => any;
|
|
230
|
+
get: ({ controlClassId, token, headers, jwtToken }: {
|
|
231
|
+
controlClassId: any;
|
|
232
|
+
token: any;
|
|
233
|
+
headers: any;
|
|
234
|
+
jwtToken: any;
|
|
235
|
+
}) => any;
|
|
236
|
+
create: ({ jwtToken, token, controlClass, headers }: {
|
|
237
|
+
jwtToken: any;
|
|
238
|
+
token: any;
|
|
239
|
+
controlClass: any;
|
|
240
|
+
headers: any;
|
|
241
|
+
}) => any;
|
|
242
|
+
update: ({ jwtToken, token, controlClassId, controlClass, headers }: {
|
|
243
|
+
jwtToken: any;
|
|
244
|
+
token: any;
|
|
245
|
+
controlClassId: any;
|
|
246
|
+
controlClass: any;
|
|
247
|
+
headers: any;
|
|
248
|
+
}) => any;
|
|
249
|
+
remove: ({ jwtToken, controlClassId, token, headers }: {
|
|
250
|
+
jwtToken: any;
|
|
251
|
+
controlClassId: any;
|
|
252
|
+
token: any;
|
|
253
|
+
headers: any;
|
|
254
|
+
}) => any;
|
|
255
|
+
};
|
|
223
256
|
fares: {
|
|
224
257
|
all: ({ token, query, headers }: {
|
|
225
258
|
token: any;
|