btrz-api-client 7.31.0 → 7.32.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 +1 -1
- package/lib/endpoints/inventory/routes.js +39 -1
- package/lib/endpoints/operations/sold-items.js +3 -1
- package/package.json +1 -1
- package/src/endpoints/inventory/routes.js +27 -1
- package/src/endpoints/operations/sold-items.js +2 -1
- package/test/endpoints/inventory/routes.test.js +40 -0
- package/types/client.d.ts +18 -1
- package/types/endpoints/inventory/routes.d.ts +16 -0
- package/types/endpoints/operations/sold-items.d.ts +2 -1
- package/types/initializedClient.d.ts +18 -1
|
@@ -354,6 +354,43 @@ function routesFactory(_ref) {
|
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
|
|
357
|
+
var prorationTable = {
|
|
358
|
+
get: function get(_ref23) {
|
|
359
|
+
var token = _ref23.token,
|
|
360
|
+
jwtToken = _ref23.jwtToken,
|
|
361
|
+
routeId = _ref23.routeId,
|
|
362
|
+
productId = _ref23.productId,
|
|
363
|
+
headers = _ref23.headers;
|
|
364
|
+
|
|
365
|
+
var query = productId ? { productId: productId } : {};
|
|
366
|
+
return client({
|
|
367
|
+
url: "/routes/" + routeId + "/proration-table",
|
|
368
|
+
params: query,
|
|
369
|
+
headers: authorizationHeaders({
|
|
370
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
},
|
|
374
|
+
update: function update(_ref24) {
|
|
375
|
+
var token = _ref24.token,
|
|
376
|
+
jwtToken = _ref24.jwtToken,
|
|
377
|
+
routeId = _ref24.routeId,
|
|
378
|
+
prorationTableData = _ref24.prorationTable,
|
|
379
|
+
headers = _ref24.headers;
|
|
380
|
+
|
|
381
|
+
return client({
|
|
382
|
+
url: "/routes/" + routeId + "/proration-table",
|
|
383
|
+
method: "put",
|
|
384
|
+
headers: authorizationHeaders({
|
|
385
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
386
|
+
}),
|
|
387
|
+
data: {
|
|
388
|
+
prorationTable: prorationTableData
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
|
|
357
394
|
return {
|
|
358
395
|
get: get,
|
|
359
396
|
prices: prices,
|
|
@@ -366,7 +403,8 @@ function routesFactory(_ref) {
|
|
|
366
403
|
stops: stops,
|
|
367
404
|
fareRules: fareRules,
|
|
368
405
|
priceBuckets: priceBuckets,
|
|
369
|
-
crossBorderDistances: crossBorderDistances
|
|
406
|
+
crossBorderDistances: crossBorderDistances,
|
|
407
|
+
prorationTable: prorationTable
|
|
370
408
|
};
|
|
371
409
|
}
|
|
372
410
|
|
|
@@ -11,9 +11,11 @@ function soldItems(_ref) {
|
|
|
11
11
|
var token = _ref2.token,
|
|
12
12
|
jwtToken = _ref2.jwtToken,
|
|
13
13
|
soldItemId = _ref2.soldItemId,
|
|
14
|
-
headers = _ref2.headers
|
|
14
|
+
headers = _ref2.headers,
|
|
15
|
+
query = _ref2.query;
|
|
15
16
|
|
|
16
17
|
return client.get("/sold-items/" + soldItemId, {
|
|
18
|
+
params: query,
|
|
17
19
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
18
20
|
});
|
|
19
21
|
}
|
package/package.json
CHANGED
|
@@ -231,6 +231,31 @@ function routesFactory({client, internalAuthTokenProvider}) {
|
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
|
|
234
|
+
const prorationTable = {
|
|
235
|
+
get({token, jwtToken, routeId, productId, headers}) {
|
|
236
|
+
const query = productId ? {productId} : {};
|
|
237
|
+
return client({
|
|
238
|
+
url: `/routes/${routeId}/proration-table`,
|
|
239
|
+
params: query,
|
|
240
|
+
headers: authorizationHeaders({
|
|
241
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
242
|
+
})
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
update({token, jwtToken, routeId, prorationTable: prorationTableData, headers}) {
|
|
246
|
+
return client({
|
|
247
|
+
url: `/routes/${routeId}/proration-table`,
|
|
248
|
+
method: "put",
|
|
249
|
+
headers: authorizationHeaders({
|
|
250
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
251
|
+
}),
|
|
252
|
+
data: {
|
|
253
|
+
prorationTable: prorationTableData
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
|
|
234
259
|
return {
|
|
235
260
|
get,
|
|
236
261
|
prices,
|
|
@@ -243,7 +268,8 @@ function routesFactory({client, internalAuthTokenProvider}) {
|
|
|
243
268
|
stops,
|
|
244
269
|
fareRules,
|
|
245
270
|
priceBuckets,
|
|
246
|
-
crossBorderDistances
|
|
271
|
+
crossBorderDistances,
|
|
272
|
+
prorationTable
|
|
247
273
|
};
|
|
248
274
|
}
|
|
249
275
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
2
2
|
|
|
3
3
|
function soldItems({client, internalAuthTokenProvider}) {
|
|
4
|
-
function get({token, jwtToken, soldItemId, headers}) {
|
|
4
|
+
function get({token, jwtToken, soldItemId, headers, query}) {
|
|
5
5
|
return client.get(`/sold-items/${soldItemId}`, {
|
|
6
|
+
params: query,
|
|
6
7
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
7
8
|
});
|
|
8
9
|
}
|
|
@@ -225,4 +225,44 @@ describe("inventory/route", () => {
|
|
|
225
225
|
jwtToken, token, routeId, crossBorderDistances
|
|
226
226
|
});
|
|
227
227
|
});
|
|
228
|
+
|
|
229
|
+
it("should get a proration-table without productId", () => {
|
|
230
|
+
const routeId = "507f1f77bcf86cd799439011";
|
|
231
|
+
axiosMock.onGet(`/routes/${routeId}/proration-table`).reply(expectRequest({
|
|
232
|
+
statusCode: 200, token, jwtToken
|
|
233
|
+
}));
|
|
234
|
+
return api.inventory.routes.prorationTable.get({
|
|
235
|
+
jwtToken, token, routeId
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
it("should get a proration-table with productId", () => {
|
|
240
|
+
const routeId = "507f1f77bcf86cd799439011";
|
|
241
|
+
const productId = "507f1f77bcf86cd799439012";
|
|
242
|
+
axiosMock.onGet(`/routes/${routeId}/proration-table`, {params: {productId}}).reply(expectRequest({
|
|
243
|
+
statusCode: 200, token, jwtToken, query: {productId}
|
|
244
|
+
}));
|
|
245
|
+
return api.inventory.routes.prorationTable.get({
|
|
246
|
+
jwtToken, token, routeId, productId
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it("should update a proration-table", () => {
|
|
251
|
+
const routeId = "507f1f77bcf86cd799439011";
|
|
252
|
+
const prorationTable = {
|
|
253
|
+
productId: "507f1f77bcf86cd799439012",
|
|
254
|
+
faresById: {
|
|
255
|
+
"stop-1": {
|
|
256
|
+
"stop-2": 100,
|
|
257
|
+
"stop-3": 150
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
axiosMock.onPut(`/routes/${routeId}/proration-table`).reply(expectRequest({
|
|
262
|
+
statusCode: 200, token, jwtToken
|
|
263
|
+
}));
|
|
264
|
+
return api.inventory.routes.prorationTable.update({
|
|
265
|
+
jwtToken, token, routeId, prorationTable
|
|
266
|
+
});
|
|
267
|
+
});
|
|
228
268
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -1434,6 +1434,22 @@ export function createApiClient(options: {
|
|
|
1434
1434
|
headers: any;
|
|
1435
1435
|
}): any;
|
|
1436
1436
|
};
|
|
1437
|
+
prorationTable: {
|
|
1438
|
+
get({ token, jwtToken, routeId, productId, headers }: {
|
|
1439
|
+
token: any;
|
|
1440
|
+
jwtToken: any;
|
|
1441
|
+
routeId: any;
|
|
1442
|
+
productId: any;
|
|
1443
|
+
headers: any;
|
|
1444
|
+
}): any;
|
|
1445
|
+
update({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
|
|
1446
|
+
token: any;
|
|
1447
|
+
jwtToken: any;
|
|
1448
|
+
routeId: any;
|
|
1449
|
+
prorationTable: any;
|
|
1450
|
+
headers: any;
|
|
1451
|
+
}): any;
|
|
1452
|
+
};
|
|
1437
1453
|
};
|
|
1438
1454
|
scheduleGroups: {
|
|
1439
1455
|
all: ({ token, jwtToken, query, headers }: {
|
|
@@ -3996,11 +4012,12 @@ export function createApiClient(options: {
|
|
|
3996
4012
|
headers: any;
|
|
3997
4013
|
query: any;
|
|
3998
4014
|
}) => any;
|
|
3999
|
-
get: ({ token, jwtToken, soldItemId, headers }: {
|
|
4015
|
+
get: ({ token, jwtToken, soldItemId, headers, query }: {
|
|
4000
4016
|
token: any;
|
|
4001
4017
|
jwtToken: any;
|
|
4002
4018
|
soldItemId: any;
|
|
4003
4019
|
headers: any;
|
|
4020
|
+
query: any;
|
|
4004
4021
|
}) => any;
|
|
4005
4022
|
};
|
|
4006
4023
|
tickets: {
|
|
@@ -153,4 +153,20 @@ declare function routesFactory({ client, internalAuthTokenProvider }: {
|
|
|
153
153
|
headers: any;
|
|
154
154
|
}): any;
|
|
155
155
|
};
|
|
156
|
+
prorationTable: {
|
|
157
|
+
get({ token, jwtToken, routeId, productId, headers }: {
|
|
158
|
+
token: any;
|
|
159
|
+
jwtToken: any;
|
|
160
|
+
routeId: any;
|
|
161
|
+
productId: any;
|
|
162
|
+
headers: any;
|
|
163
|
+
}): any;
|
|
164
|
+
update({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
|
|
165
|
+
token: any;
|
|
166
|
+
jwtToken: any;
|
|
167
|
+
routeId: any;
|
|
168
|
+
prorationTable: any;
|
|
169
|
+
headers: any;
|
|
170
|
+
}): any;
|
|
171
|
+
};
|
|
156
172
|
};
|
|
@@ -9,10 +9,11 @@ declare function soldItems({ client, internalAuthTokenProvider }: {
|
|
|
9
9
|
headers: any;
|
|
10
10
|
query: any;
|
|
11
11
|
}) => any;
|
|
12
|
-
get: ({ token, jwtToken, soldItemId, headers }: {
|
|
12
|
+
get: ({ token, jwtToken, soldItemId, headers, query }: {
|
|
13
13
|
token: any;
|
|
14
14
|
jwtToken: any;
|
|
15
15
|
soldItemId: any;
|
|
16
16
|
headers: any;
|
|
17
|
+
query: any;
|
|
17
18
|
}) => any;
|
|
18
19
|
};
|
|
@@ -1388,6 +1388,22 @@ declare const _exports: {
|
|
|
1388
1388
|
headers: any;
|
|
1389
1389
|
}): any;
|
|
1390
1390
|
};
|
|
1391
|
+
prorationTable: {
|
|
1392
|
+
get({ token, jwtToken, routeId, productId, headers }: {
|
|
1393
|
+
token: any;
|
|
1394
|
+
jwtToken: any;
|
|
1395
|
+
routeId: any;
|
|
1396
|
+
productId: any;
|
|
1397
|
+
headers: any;
|
|
1398
|
+
}): any;
|
|
1399
|
+
update({ token, jwtToken, routeId, prorationTable: prorationTableData, headers }: {
|
|
1400
|
+
token: any;
|
|
1401
|
+
jwtToken: any;
|
|
1402
|
+
routeId: any;
|
|
1403
|
+
prorationTable: any;
|
|
1404
|
+
headers: any;
|
|
1405
|
+
}): any;
|
|
1406
|
+
};
|
|
1391
1407
|
};
|
|
1392
1408
|
scheduleGroups: {
|
|
1393
1409
|
all: ({ token, jwtToken, query, headers }: {
|
|
@@ -3950,11 +3966,12 @@ declare const _exports: {
|
|
|
3950
3966
|
headers: any;
|
|
3951
3967
|
query: any;
|
|
3952
3968
|
}) => any;
|
|
3953
|
-
get: ({ token, jwtToken, soldItemId, headers }: {
|
|
3969
|
+
get: ({ token, jwtToken, soldItemId, headers, query }: {
|
|
3954
3970
|
token: any;
|
|
3955
3971
|
jwtToken: any;
|
|
3956
3972
|
soldItemId: any;
|
|
3957
3973
|
headers: any;
|
|
3974
|
+
query: any;
|
|
3958
3975
|
}) => any;
|
|
3959
3976
|
};
|
|
3960
3977
|
tickets: {
|