btrz-api-client 7.15.0 → 7.16.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/change-requests.js +61 -0
- package/package.json +1 -1
- package/src/client.js +1 -0
- package/src/endpoints/inventory/change-requests.js +37 -0
- package/test/endpoints/inventory/change-requests.test.js +36 -0
- package/types/client.d.ts +22 -0
- package/types/endpoints/inventory/change-requests.d.ts +26 -0
- package/types/initializedClient.d.ts +22 -0
package/lib/client.js
CHANGED
|
@@ -97,6 +97,7 @@ function createInventory(_ref) {
|
|
|
97
97
|
serviceNumbers: require("./endpoints/inventory/service-numbers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
98
98
|
companies: require("./endpoints/inventory/companies.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
99
99
|
bundleFares: require("./endpoints/inventory/bundle-fares.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
100
|
+
changeRequests: require("./endpoints/inventory/change-requests.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
100
101
|
giftCertificateDefinitions: require("./endpoints/inventory/gift-certificate-definitions.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
101
102
|
amenities: require("./endpoints/inventory/amenities.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
102
103
|
amenityGroups: require("./endpoints/inventory/amenity-groups.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("./../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function changeRequestsFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
|
+
|
|
10
|
+
function get(_ref2) {
|
|
11
|
+
var changerequestId = _ref2.changerequestId,
|
|
12
|
+
token = _ref2.token,
|
|
13
|
+
jwtToken = _ref2.jwtToken,
|
|
14
|
+
_ref2$query = _ref2.query,
|
|
15
|
+
query = _ref2$query === undefined ? {} : _ref2$query,
|
|
16
|
+
headers = _ref2.headers;
|
|
17
|
+
|
|
18
|
+
return client({
|
|
19
|
+
url: "/change-requests/" + changerequestId + "/manifests",
|
|
20
|
+
params: query,
|
|
21
|
+
headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, jwtToken: jwtToken, headers: headers })
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function create(_ref3) {
|
|
26
|
+
var data = _ref3.data,
|
|
27
|
+
token = _ref3.token,
|
|
28
|
+
jwtToken = _ref3.jwtToken,
|
|
29
|
+
headers = _ref3.headers;
|
|
30
|
+
|
|
31
|
+
return client({
|
|
32
|
+
url: "/change-requests/manifests",
|
|
33
|
+
method: "post",
|
|
34
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
35
|
+
data: data
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function update(_ref4) {
|
|
40
|
+
var changerequestId = _ref4.changerequestId,
|
|
41
|
+
data = _ref4.data,
|
|
42
|
+
token = _ref4.token,
|
|
43
|
+
jwtToken = _ref4.jwtToken,
|
|
44
|
+
headers = _ref4.headers;
|
|
45
|
+
|
|
46
|
+
return client({
|
|
47
|
+
url: "/change-requests/" + changerequestId + "/manifests",
|
|
48
|
+
method: "put",
|
|
49
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
50
|
+
data: data
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
get: get,
|
|
56
|
+
create: create,
|
|
57
|
+
update: update
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = changeRequestsFactory;
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -84,6 +84,7 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
|
|
|
84
84
|
serviceNumbers: require("./endpoints/inventory/service-numbers.js")({client, internalAuthTokenProvider}),
|
|
85
85
|
companies: require("./endpoints/inventory/companies.js")({client, internalAuthTokenProvider}),
|
|
86
86
|
bundleFares: require("./endpoints/inventory/bundle-fares.js")({client, internalAuthTokenProvider}),
|
|
87
|
+
changeRequests: require("./endpoints/inventory/change-requests.js")({client, internalAuthTokenProvider}),
|
|
87
88
|
giftCertificateDefinitions: require("./endpoints/inventory/gift-certificate-definitions.js")({client, internalAuthTokenProvider}),
|
|
88
89
|
amenities: require("./endpoints/inventory/amenities.js")({client, internalAuthTokenProvider}),
|
|
89
90
|
amenityGroups: require("./endpoints/inventory/amenity-groups.js")({client, internalAuthTokenProvider}),
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
2
|
+
|
|
3
|
+
function changeRequestsFactory({client, internalAuthTokenProvider}) {
|
|
4
|
+
function get({changerequestId, token, jwtToken, query = {}, headers}) {
|
|
5
|
+
return client({
|
|
6
|
+
url: `/change-requests/${changerequestId}/manifests`,
|
|
7
|
+
params: query,
|
|
8
|
+
headers: authorizationHeaders({token, internalAuthTokenProvider, jwtToken, headers})
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function create({data, token, jwtToken, headers}) {
|
|
13
|
+
return client({
|
|
14
|
+
url: "/change-requests/manifests",
|
|
15
|
+
method: "post",
|
|
16
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
17
|
+
data
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function update({changerequestId, data, token, jwtToken, headers}) {
|
|
22
|
+
return client({
|
|
23
|
+
url: `/change-requests/${changerequestId}/manifests`,
|
|
24
|
+
method: "put",
|
|
25
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
26
|
+
data
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
get,
|
|
32
|
+
create,
|
|
33
|
+
update
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = changeRequestsFactory;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const {axiosMock, expectRequest} = require("./../../test-helpers");
|
|
2
|
+
const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
|
|
3
|
+
|
|
4
|
+
describe.only("inventory/change-requests", function() {
|
|
5
|
+
const token = "I owe you a token";
|
|
6
|
+
const jwtToken = "I owe you a JWT token";
|
|
7
|
+
|
|
8
|
+
afterEach(function() {
|
|
9
|
+
axiosMock.reset();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should get a change request by id", function() {
|
|
13
|
+
const changerequestId = "507f1f77bcf86cd799439011";
|
|
14
|
+
axiosMock.onGet(`/change-requests/${changerequestId}/manifests`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
15
|
+
return api.inventory.changeRequests.get({token, jwtToken, changerequestId});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should create a change request", function() {
|
|
19
|
+
const data = {
|
|
20
|
+
manifestId: "507f1f77bcf86cd799439012",
|
|
21
|
+
request: {
|
|
22
|
+
type: "update",
|
|
23
|
+
changes: {status: "approved"}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
axiosMock.onPost("/change-requests/manifests").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
27
|
+
return api.inventory.changeRequests.create({token, jwtToken, data});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("should update a change request", function() {
|
|
31
|
+
const data = {status: "approved"};
|
|
32
|
+
const changerequestId = "507f1f77bcf86cd799439011";
|
|
33
|
+
axiosMock.onPut(`/change-requests/${changerequestId}/manifests`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
34
|
+
return api.inventory.changeRequests.update({token, jwtToken, changerequestId, data});
|
|
35
|
+
});
|
|
36
|
+
});
|
package/types/client.d.ts
CHANGED
|
@@ -1235,6 +1235,28 @@ export function createApiClient(options: {
|
|
|
1235
1235
|
headers: any;
|
|
1236
1236
|
}) => any;
|
|
1237
1237
|
};
|
|
1238
|
+
changeRequests: {
|
|
1239
|
+
get: ({ changerequestId, token, jwtToken, query, headers }: {
|
|
1240
|
+
changerequestId: any;
|
|
1241
|
+
token: any;
|
|
1242
|
+
jwtToken: any;
|
|
1243
|
+
query?: {};
|
|
1244
|
+
headers: any;
|
|
1245
|
+
}) => any;
|
|
1246
|
+
create: ({ data, token, jwtToken, headers }: {
|
|
1247
|
+
data: any;
|
|
1248
|
+
token: any;
|
|
1249
|
+
jwtToken: any;
|
|
1250
|
+
headers: any;
|
|
1251
|
+
}) => any;
|
|
1252
|
+
update: ({ changerequestId, data, token, jwtToken, headers }: {
|
|
1253
|
+
changerequestId: any;
|
|
1254
|
+
data: any;
|
|
1255
|
+
token: any;
|
|
1256
|
+
jwtToken: any;
|
|
1257
|
+
headers: any;
|
|
1258
|
+
}) => any;
|
|
1259
|
+
};
|
|
1238
1260
|
giftCertificateDefinitions: {
|
|
1239
1261
|
all: ({ token, query, headers }: {
|
|
1240
1262
|
token: any;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export = changeRequestsFactory;
|
|
2
|
+
declare function changeRequestsFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
get: ({ changerequestId, token, jwtToken, query, headers }: {
|
|
7
|
+
changerequestId: any;
|
|
8
|
+
token: any;
|
|
9
|
+
jwtToken: any;
|
|
10
|
+
query?: {};
|
|
11
|
+
headers: any;
|
|
12
|
+
}) => any;
|
|
13
|
+
create: ({ data, token, jwtToken, headers }: {
|
|
14
|
+
data: any;
|
|
15
|
+
token: any;
|
|
16
|
+
jwtToken: any;
|
|
17
|
+
headers: any;
|
|
18
|
+
}) => any;
|
|
19
|
+
update: ({ changerequestId, data, token, jwtToken, headers }: {
|
|
20
|
+
changerequestId: any;
|
|
21
|
+
data: any;
|
|
22
|
+
token: any;
|
|
23
|
+
jwtToken: any;
|
|
24
|
+
headers: any;
|
|
25
|
+
}) => any;
|
|
26
|
+
};
|
|
@@ -1189,6 +1189,28 @@ declare const _exports: {
|
|
|
1189
1189
|
headers: any;
|
|
1190
1190
|
}) => any;
|
|
1191
1191
|
};
|
|
1192
|
+
changeRequests: {
|
|
1193
|
+
get: ({ changerequestId, token, jwtToken, query, headers }: {
|
|
1194
|
+
changerequestId: any;
|
|
1195
|
+
token: any;
|
|
1196
|
+
jwtToken: any;
|
|
1197
|
+
query?: {};
|
|
1198
|
+
headers: any;
|
|
1199
|
+
}) => any;
|
|
1200
|
+
create: ({ data, token, jwtToken, headers }: {
|
|
1201
|
+
data: any;
|
|
1202
|
+
token: any;
|
|
1203
|
+
jwtToken: any;
|
|
1204
|
+
headers: any;
|
|
1205
|
+
}) => any;
|
|
1206
|
+
update: ({ changerequestId, data, token, jwtToken, headers }: {
|
|
1207
|
+
changerequestId: any;
|
|
1208
|
+
data: any;
|
|
1209
|
+
token: any;
|
|
1210
|
+
jwtToken: any;
|
|
1211
|
+
headers: any;
|
|
1212
|
+
}) => any;
|
|
1213
|
+
};
|
|
1192
1214
|
giftCertificateDefinitions: {
|
|
1193
1215
|
all: ({ token, query, headers }: {
|
|
1194
1216
|
token: any;
|