btrz-api-client 5.225.0 → 5.227.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/promos.js +23 -8
- package/lib/endpoints/operations/transport_regulations.js +32 -0
- package/package.json +1 -1
- package/src/client.js +1 -0
- package/src/endpoints/inventory/promos.js +22 -14
- package/src/endpoints/operations/transport_regulations.js +23 -0
- package/test/endpoints/operations/transport_regulations.js +35 -0
- package/types/client.d.ts +17 -0
- package/types/endpoints/inventory/promos.d.ts +7 -0
- package/types/endpoints/operations/transport_regulations.d.ts +14 -0
- package/types/initializedClient.d.ts +17 -0
package/lib/client.js
CHANGED
|
@@ -303,6 +303,7 @@ function createOperations(_ref6) {
|
|
|
303
303
|
vehicleAssignments: require("./endpoints/operations/vehicle_assignments.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
304
304
|
vouchers: require("./endpoints/operations/vouchers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
305
305
|
waitlists: require("./endpoints/operations/waitlists.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
306
|
+
transportRegulations: require("./endpoints/operations/transport_regulations.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
306
307
|
__test: {
|
|
307
308
|
client: client
|
|
308
309
|
}
|
|
@@ -7,7 +7,6 @@ function promosFactory(_ref) {
|
|
|
7
7
|
var client = _ref.client,
|
|
8
8
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
function all(_ref2) {
|
|
12
11
|
var token = _ref2.token,
|
|
13
12
|
_ref2$query = _ref2.query,
|
|
@@ -75,29 +74,44 @@ function promosFactory(_ref) {
|
|
|
75
74
|
});
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
function
|
|
77
|
+
function patch(_ref7) {
|
|
79
78
|
var jwtToken = _ref7.jwtToken,
|
|
80
79
|
token = _ref7.token,
|
|
81
80
|
promoId = _ref7.promoId,
|
|
82
|
-
|
|
81
|
+
operations = _ref7.operations,
|
|
83
82
|
headers = _ref7.headers;
|
|
84
83
|
|
|
85
84
|
return client({
|
|
86
|
-
url: "/
|
|
87
|
-
method: "
|
|
85
|
+
url: "/promo/" + promoId,
|
|
86
|
+
method: "patch",
|
|
88
87
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
89
|
-
data: {
|
|
88
|
+
data: { operations: operations }
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
function
|
|
92
|
+
function addRule(_ref8) {
|
|
94
93
|
var jwtToken = _ref8.jwtToken,
|
|
95
94
|
token = _ref8.token,
|
|
96
95
|
promoId = _ref8.promoId,
|
|
97
|
-
ruleId = _ref8.ruleId,
|
|
98
96
|
rule = _ref8.rule,
|
|
99
97
|
headers = _ref8.headers;
|
|
100
98
|
|
|
99
|
+
return client({
|
|
100
|
+
url: "/promos/" + promoId + "/rules",
|
|
101
|
+
method: "post",
|
|
102
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
103
|
+
data: { rule: rule }
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function updateRule(_ref9) {
|
|
108
|
+
var jwtToken = _ref9.jwtToken,
|
|
109
|
+
token = _ref9.token,
|
|
110
|
+
promoId = _ref9.promoId,
|
|
111
|
+
ruleId = _ref9.ruleId,
|
|
112
|
+
rule = _ref9.rule,
|
|
113
|
+
headers = _ref9.headers;
|
|
114
|
+
|
|
101
115
|
return client({
|
|
102
116
|
url: "/promos/" + promoId + "/rules/" + ruleId,
|
|
103
117
|
method: "put",
|
|
@@ -111,6 +125,7 @@ function promosFactory(_ref) {
|
|
|
111
125
|
get: get,
|
|
112
126
|
create: create,
|
|
113
127
|
update: update,
|
|
128
|
+
patch: patch,
|
|
114
129
|
remove: remove,
|
|
115
130
|
addRule: addRule,
|
|
116
131
|
updateRule: updateRule
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// /transport-regulations/cnrt/manifests
|
|
4
|
+
var _require = require("../endpoints_helpers.js"),
|
|
5
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
6
|
+
|
|
7
|
+
function transportRegulationsFactory(_ref) {
|
|
8
|
+
var client = _ref.client,
|
|
9
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
10
|
+
|
|
11
|
+
var cnrt = {
|
|
12
|
+
create: function create(_ref2) {
|
|
13
|
+
var data = _ref2.data,
|
|
14
|
+
token = _ref2.token,
|
|
15
|
+
jwtToken = _ref2.jwtToken,
|
|
16
|
+
headers = _ref2.headers;
|
|
17
|
+
|
|
18
|
+
return client({
|
|
19
|
+
url: "/transport-regulations/cnrt/manifests",
|
|
20
|
+
method: "post",
|
|
21
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
22
|
+
data: data
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
cnrt: cnrt
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = transportRegulationsFactory;
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -255,6 +255,7 @@ function createOperations({baseURL, headers, timeout, overrideFn, internalAuthTo
|
|
|
255
255
|
vehicleAssignments: require("./endpoints/operations/vehicle_assignments.js")({client, internalAuthTokenProvider}),
|
|
256
256
|
vouchers: require("./endpoints/operations/vouchers.js")({client, internalAuthTokenProvider}),
|
|
257
257
|
waitlists: require("./endpoints/operations/waitlists.js")({client, internalAuthTokenProvider}),
|
|
258
|
+
transportRegulations: require("./endpoints/operations/transport_regulations.js")({client, internalAuthTokenProvider}),
|
|
258
259
|
__test: {
|
|
259
260
|
client
|
|
260
261
|
}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {authorizationHeaders} = require("./../endpoints_helpers");
|
|
2
2
|
|
|
3
3
|
function promosFactory({client, internalAuthTokenProvider}) {
|
|
4
|
-
|
|
5
|
-
function all({ token, query = {}, headers }) {
|
|
4
|
+
function all({token, query = {}, headers}) {
|
|
6
5
|
return client.get("/promos", {
|
|
7
6
|
params: query,
|
|
8
7
|
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
9
8
|
});
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
function get({
|
|
11
|
+
function get({promoId, token, query = {}, headers}) {
|
|
13
12
|
return client.get(`/promos/${promoId}`, {
|
|
14
13
|
params: query,
|
|
15
14
|
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
16
15
|
});
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
function create({
|
|
18
|
+
function create({jwtToken, promo, token, headers}) {
|
|
20
19
|
return client({
|
|
21
20
|
url: "/promos",
|
|
22
21
|
method: "post",
|
|
23
22
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
24
|
-
data: {
|
|
23
|
+
data: {promo}
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
function remove({
|
|
27
|
+
function remove({jwtToken, promoId, token, headers}) {
|
|
29
28
|
return client({
|
|
30
29
|
url: `/promos/${promoId}`,
|
|
31
30
|
method: "delete",
|
|
@@ -33,30 +32,39 @@ function promosFactory({client, internalAuthTokenProvider}) {
|
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
function update({
|
|
35
|
+
function update({jwtToken, token, promoId, update, headers}) {
|
|
37
36
|
return client({
|
|
38
37
|
url: `/promos/${promoId}`,
|
|
39
38
|
method: "patch",
|
|
40
39
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
41
|
-
data: {
|
|
40
|
+
data: {update}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function patch({jwtToken, token, promoId, operations, headers}) {
|
|
45
|
+
return client({
|
|
46
|
+
url: `/promo/${promoId}`,
|
|
47
|
+
method: "patch",
|
|
48
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
49
|
+
data: {operations}
|
|
42
50
|
});
|
|
43
51
|
}
|
|
44
52
|
|
|
45
|
-
function addRule({
|
|
53
|
+
function addRule({jwtToken, token, promoId, rule, headers}) {
|
|
46
54
|
return client({
|
|
47
55
|
url: `/promos/${promoId}/rules`,
|
|
48
56
|
method: "post",
|
|
49
57
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
50
|
-
data: {
|
|
58
|
+
data: {rule}
|
|
51
59
|
});
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
function updateRule({
|
|
62
|
+
function updateRule({jwtToken, token, promoId, ruleId, rule, headers}) {
|
|
55
63
|
return client({
|
|
56
64
|
url: `/promos/${promoId}/rules/${ruleId}`,
|
|
57
65
|
method: "put",
|
|
58
66
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
59
|
-
data: {
|
|
67
|
+
data: {rule}
|
|
60
68
|
});
|
|
61
69
|
}
|
|
62
70
|
|
|
@@ -65,11 +73,11 @@ function promosFactory({client, internalAuthTokenProvider}) {
|
|
|
65
73
|
get,
|
|
66
74
|
create,
|
|
67
75
|
update,
|
|
76
|
+
patch,
|
|
68
77
|
remove,
|
|
69
78
|
addRule,
|
|
70
79
|
updateRule
|
|
71
80
|
};
|
|
72
|
-
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
module.exports = promosFactory;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// /transport-regulations/cnrt/manifests
|
|
2
|
+
const {
|
|
3
|
+
authorizationHeaders
|
|
4
|
+
} = require("../endpoints_helpers.js");
|
|
5
|
+
|
|
6
|
+
function transportRegulationsFactory({client, internalAuthTokenProvider}) {
|
|
7
|
+
const cnrt = {
|
|
8
|
+
create({data, token, jwtToken, headers}) {
|
|
9
|
+
return client({
|
|
10
|
+
url: "/transport-regulations/cnrt/manifests",
|
|
11
|
+
method: "post",
|
|
12
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
13
|
+
data
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
cnrt
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = transportRegulationsFactory;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const {
|
|
2
|
+
expect
|
|
3
|
+
} = require("chai");
|
|
4
|
+
const {
|
|
5
|
+
axiosMock,
|
|
6
|
+
expectRequest
|
|
7
|
+
} = require("../../test-helpers.js");
|
|
8
|
+
const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
9
|
+
|
|
10
|
+
describe("operations/transport-regulations", () => {
|
|
11
|
+
const token = "I owe you a token";
|
|
12
|
+
const jwtToken = "I owe you a JWT token";
|
|
13
|
+
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
axiosMock.reset();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should POST a new CNRT transpor-regulation", () => {
|
|
19
|
+
const data = {
|
|
20
|
+
manifestId: "123"
|
|
21
|
+
};
|
|
22
|
+
axiosMock.onPost("/transport-regulations/cnrt/manifests").reply(expectRequest({
|
|
23
|
+
statusCode: 200,
|
|
24
|
+
token,
|
|
25
|
+
jwtToken
|
|
26
|
+
}));
|
|
27
|
+
return api.operations.transportRegulations.cnrt.create({
|
|
28
|
+
token,
|
|
29
|
+
jwtToken,
|
|
30
|
+
data
|
|
31
|
+
}).then((httpResponse) => {
|
|
32
|
+
expect(httpResponse.status).eql(200);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
package/types/client.d.ts
CHANGED
|
@@ -332,6 +332,13 @@ export function createApiClient(options: {
|
|
|
332
332
|
update: any;
|
|
333
333
|
headers: any;
|
|
334
334
|
}) => any;
|
|
335
|
+
patch: ({ jwtToken, token, promoId, operations, headers }: {
|
|
336
|
+
jwtToken: any;
|
|
337
|
+
token: any;
|
|
338
|
+
promoId: any;
|
|
339
|
+
operations: any;
|
|
340
|
+
headers: any;
|
|
341
|
+
}) => any;
|
|
335
342
|
remove: ({ jwtToken, promoId, token, headers }: {
|
|
336
343
|
jwtToken: any;
|
|
337
344
|
promoId: any;
|
|
@@ -3824,6 +3831,16 @@ export function createApiClient(options: {
|
|
|
3824
3831
|
headers: any;
|
|
3825
3832
|
}) => any;
|
|
3826
3833
|
};
|
|
3834
|
+
transportRegulations: {
|
|
3835
|
+
cnrt: {
|
|
3836
|
+
create({ data, token, jwtToken, headers }: {
|
|
3837
|
+
data: any;
|
|
3838
|
+
token: any;
|
|
3839
|
+
jwtToken: any;
|
|
3840
|
+
headers: any;
|
|
3841
|
+
}): any;
|
|
3842
|
+
};
|
|
3843
|
+
};
|
|
3827
3844
|
__test: {
|
|
3828
3845
|
client: axios.AxiosInstance;
|
|
3829
3846
|
};
|
|
@@ -27,6 +27,13 @@ declare function promosFactory({ client, internalAuthTokenProvider }: {
|
|
|
27
27
|
update: any;
|
|
28
28
|
headers: any;
|
|
29
29
|
}) => any;
|
|
30
|
+
patch: ({ jwtToken, token, promoId, operations, headers }: {
|
|
31
|
+
jwtToken: any;
|
|
32
|
+
token: any;
|
|
33
|
+
promoId: any;
|
|
34
|
+
operations: any;
|
|
35
|
+
headers: any;
|
|
36
|
+
}) => any;
|
|
30
37
|
remove: ({ jwtToken, promoId, token, headers }: {
|
|
31
38
|
jwtToken: any;
|
|
32
39
|
promoId: any;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export = transportRegulationsFactory;
|
|
2
|
+
declare function transportRegulationsFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
cnrt: {
|
|
7
|
+
create({ data, token, jwtToken, headers }: {
|
|
8
|
+
data: any;
|
|
9
|
+
token: any;
|
|
10
|
+
jwtToken: any;
|
|
11
|
+
headers: any;
|
|
12
|
+
}): any;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -286,6 +286,13 @@ declare const _exports: {
|
|
|
286
286
|
update: any;
|
|
287
287
|
headers: any;
|
|
288
288
|
}) => any;
|
|
289
|
+
patch: ({ jwtToken, token, promoId, operations, headers }: {
|
|
290
|
+
jwtToken: any;
|
|
291
|
+
token: any;
|
|
292
|
+
promoId: any;
|
|
293
|
+
operations: any;
|
|
294
|
+
headers: any;
|
|
295
|
+
}) => any;
|
|
289
296
|
remove: ({ jwtToken, promoId, token, headers }: {
|
|
290
297
|
jwtToken: any;
|
|
291
298
|
promoId: any;
|
|
@@ -3778,6 +3785,16 @@ declare const _exports: {
|
|
|
3778
3785
|
headers: any;
|
|
3779
3786
|
}) => any;
|
|
3780
3787
|
};
|
|
3788
|
+
transportRegulations: {
|
|
3789
|
+
cnrt: {
|
|
3790
|
+
create({ data, token, jwtToken, headers }: {
|
|
3791
|
+
data: any;
|
|
3792
|
+
token: any;
|
|
3793
|
+
jwtToken: any;
|
|
3794
|
+
headers: any;
|
|
3795
|
+
}): any;
|
|
3796
|
+
};
|
|
3797
|
+
};
|
|
3781
3798
|
__test: {
|
|
3782
3799
|
client: import("axios").AxiosInstance;
|
|
3783
3800
|
};
|