btrz-api-client 5.236.0 → 5.237.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.js CHANGED
@@ -103,6 +103,7 @@ function createInventory(_ref) {
103
103
  scheduleGroups: require("./endpoints/inventory/schedule-groups.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
104
104
  bundles: require("./endpoints/inventory/bundles.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
105
105
  stationGroups: require("./endpoints/inventory/station-groups.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
106
+ stationTypes: require("./endpoints/inventory/station-types.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
106
107
  zonePrices: require("./endpoints/inventory/zone-prices.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
107
108
  zonePriceOverages: require("./endpoints/inventory/zone-price-overages.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
108
109
  travellerCardProviders: require("./endpoints/inventory/traveller-card-providers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ var _require = require("./../endpoints_helpers.js"),
4
+ authorizationHeaders = _require.authorizationHeaders;
5
+
6
+ function stationTypeFactory(_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({
18
+ url: "/station-types",
19
+ method: "get",
20
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
21
+ params: query
22
+ });
23
+ }
24
+
25
+ function get(_ref3) {
26
+ var token = _ref3.token,
27
+ jwtToken = _ref3.jwtToken,
28
+ stationTypeId = _ref3.stationTypeId,
29
+ _ref3$query = _ref3.query,
30
+ query = _ref3$query === undefined ? {} : _ref3$query,
31
+ headers = _ref3.headers;
32
+
33
+ return client({
34
+ url: "/station-types/" + stationTypeId,
35
+ method: "get",
36
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
37
+ params: query
38
+ });
39
+ }
40
+
41
+ function update(_ref4) {
42
+ var token = _ref4.token,
43
+ jwtToken = _ref4.jwtToken,
44
+ stationTypeId = _ref4.stationTypeId,
45
+ data = _ref4.data,
46
+ headers = _ref4.headers;
47
+
48
+ return client({
49
+ url: "/station-types/" + stationTypeId,
50
+ method: "put",
51
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
52
+ data: data
53
+ });
54
+ }
55
+
56
+ function remove(_ref5) {
57
+ var token = _ref5.token,
58
+ jwtToken = _ref5.jwtToken,
59
+ stationTypeId = _ref5.stationTypeId,
60
+ headers = _ref5.headers;
61
+
62
+ return client({
63
+ url: "/station-types/" + stationTypeId,
64
+ method: "delete",
65
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
66
+ });
67
+ }
68
+
69
+ function create(_ref6) {
70
+ var token = _ref6.token,
71
+ jwtToken = _ref6.jwtToken,
72
+ data = _ref6.data,
73
+ headers = _ref6.headers;
74
+
75
+ return client({
76
+ url: "/station-types",
77
+ method: "post",
78
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
79
+ data: data
80
+ });
81
+ }
82
+
83
+ return {
84
+ all: all,
85
+ get: get,
86
+ update: update,
87
+ remove: remove,
88
+ create: create
89
+ };
90
+ }
91
+
92
+ module.exports = stationTypeFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "5.236.0",
3
+ "version": "5.237.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/client.js CHANGED
@@ -90,6 +90,7 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
90
90
  scheduleGroups: require("./endpoints/inventory/schedule-groups.js")({client, internalAuthTokenProvider}),
91
91
  bundles: require("./endpoints/inventory/bundles.js")({client, internalAuthTokenProvider}),
92
92
  stationGroups: require("./endpoints/inventory/station-groups.js")({client, internalAuthTokenProvider}),
93
+ stationTypes: require("./endpoints/inventory/station-types.js")({client, internalAuthTokenProvider}),
93
94
  zonePrices: require("./endpoints/inventory/zone-prices.js")({client, internalAuthTokenProvider}),
94
95
  zonePriceOverages: require("./endpoints/inventory/zone-price-overages.js")({client, internalAuthTokenProvider}),
95
96
  travellerCardProviders: require("./endpoints/inventory/traveller-card-providers.js")({client, internalAuthTokenProvider}),
@@ -364,7 +365,7 @@ function createBtrzPay({baseURL, headers, timeout, overrideFn, internalAuthToken
364
365
  oxxo: require("./endpoints/btrzpay/oxxo.js")({client, internalAuthTokenProvider}),
365
366
  datalogic: require("./endpoints/btrzpay/datalogic.js")({client, internalAuthTokenProvider}),
366
367
  prismaTerminals: require("./endpoints/btrzpay/prismaTerminals.js")({client, internalAuthTokenProvider}),
367
- terminalPayments: require("./endpoints/btrzpay/terminalPayments.js")({ client, internalAuthTokenProvider}),
368
+ terminalPayments: require("./endpoints/btrzpay/terminalPayments.js")({client, internalAuthTokenProvider}),
368
369
  __test: {
369
370
  client
370
371
  }
@@ -0,0 +1,57 @@
1
+ const {authorizationHeaders} = require("./../endpoints_helpers.js");
2
+
3
+ function stationTypeFactory({client, internalAuthTokenProvider}) {
4
+ function all({token, jwtToken, query = {}, headers}) {
5
+ return client({
6
+ url: "/station-types",
7
+ method: "get",
8
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
9
+ params: query
10
+ });
11
+ }
12
+
13
+ function get({token, jwtToken, stationTypeId, query = {}, headers}) {
14
+ return client({
15
+ url: `/station-types/${stationTypeId}`,
16
+ method: "get",
17
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
18
+ params: query
19
+ });
20
+ }
21
+
22
+ function update({token, jwtToken, stationTypeId, data, headers}) {
23
+ return client({
24
+ url: `/station-types/${stationTypeId}`,
25
+ method: "put",
26
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
27
+ data
28
+ });
29
+ }
30
+
31
+ function remove({token, jwtToken, stationTypeId, headers}) {
32
+ return client({
33
+ url: `/station-types/${stationTypeId}`,
34
+ method: "delete",
35
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
36
+ });
37
+ }
38
+
39
+ function create({token, jwtToken, data, headers}) {
40
+ return client({
41
+ url: "/station-types",
42
+ method: "post",
43
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
44
+ data
45
+ });
46
+ }
47
+
48
+ return {
49
+ all,
50
+ get,
51
+ update,
52
+ remove,
53
+ create
54
+ };
55
+ }
56
+
57
+ module.exports = stationTypeFactory;
@@ -0,0 +1,52 @@
1
+ const {axiosMock, expectRequest} = require("./../../test-helpers.js");
2
+ const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
+
4
+ describe("inventory/station-types", () => {
5
+ const token = "I owe you a token";
6
+ const jwtToken = "I owe you a JWT token";
7
+
8
+ afterEach(() => {
9
+ axiosMock.restore();
10
+ });
11
+
12
+ it("should list station-types", () => {
13
+ axiosMock.onGet("/station-types").reply(expectRequest({statusCode: 200, token, jwtToken}));
14
+ return api.inventory.stationTypes.all({token, jwtToken});
15
+ });
16
+
17
+ it("should get a station-types", () => {
18
+ const stationTypeId = "123123123123";
19
+ axiosMock.onGet(`/station-types/${stationTypeId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
20
+ return api.inventory.stationTypes.get({token, jwtToken, stationTypeId});
21
+ });
22
+
23
+ it("should create a station-types", () => {
24
+ axiosMock.onPost("/station-types").reply(expectRequest({statusCode: 200, token, jwtToken}));
25
+ return api.inventory.stationTypes.create({
26
+ jwtToken,
27
+ token,
28
+ data: {
29
+ name: "example",
30
+ code: 20,
31
+ ord: 100
32
+ }
33
+ });
34
+ });
35
+
36
+ it("should update a station-types", () => {
37
+ const stationTypeId = "123123123123";
38
+ const data = {
39
+ name: "new",
40
+ code: 100,
41
+ ord: 10
42
+ };
43
+ axiosMock.onPut(`/station-types/${stationTypeId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
44
+ return api.inventory.stationTypes.update({jwtToken, token, stationTypeId, data});
45
+ });
46
+
47
+ it("should delete a station-types", () => {
48
+ const stationTypeId = "123123123123";
49
+ axiosMock.onDelete(`/station-types/${stationTypeId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
50
+ return api.inventory.stationTypes.remove({jwtToken, token, stationTypeId});
51
+ });
52
+ });
package/types/client.d.ts CHANGED
@@ -1359,6 +1359,40 @@ export function createApiClient(options: {
1359
1359
  headers: any;
1360
1360
  }) => any;
1361
1361
  };
1362
+ stationTypes: {
1363
+ all: ({ token, jwtToken, query, headers }: {
1364
+ token: any;
1365
+ jwtToken: any;
1366
+ query?: {};
1367
+ headers: any;
1368
+ }) => any;
1369
+ get: ({ token, jwtToken, stationTypeId, query, headers }: {
1370
+ token: any;
1371
+ jwtToken: any;
1372
+ stationTypeId: any;
1373
+ query?: {};
1374
+ headers: any;
1375
+ }) => any;
1376
+ update: ({ token, jwtToken, stationTypeId, data, headers }: {
1377
+ token: any;
1378
+ jwtToken: any;
1379
+ stationTypeId: any;
1380
+ data: any;
1381
+ headers: any;
1382
+ }) => any;
1383
+ remove: ({ token, jwtToken, stationTypeId, headers }: {
1384
+ token: any;
1385
+ jwtToken: any;
1386
+ stationTypeId: any;
1387
+ headers: any;
1388
+ }) => any;
1389
+ create: ({ token, jwtToken, data, headers }: {
1390
+ token: any;
1391
+ jwtToken: any;
1392
+ data: any;
1393
+ headers: any;
1394
+ }) => any;
1395
+ };
1362
1396
  zonePrices: {
1363
1397
  all: ({ token, query, headers }: {
1364
1398
  token: any;
@@ -0,0 +1,38 @@
1
+ export = stationTypeFactory;
2
+ declare function stationTypeFactory({ 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: ({ token, jwtToken, stationTypeId, query, headers }: {
13
+ token: any;
14
+ jwtToken: any;
15
+ stationTypeId: any;
16
+ query?: {};
17
+ headers: any;
18
+ }) => any;
19
+ update: ({ token, jwtToken, stationTypeId, data, headers }: {
20
+ token: any;
21
+ jwtToken: any;
22
+ stationTypeId: any;
23
+ data: any;
24
+ headers: any;
25
+ }) => any;
26
+ remove: ({ token, jwtToken, stationTypeId, headers }: {
27
+ token: any;
28
+ jwtToken: any;
29
+ stationTypeId: any;
30
+ headers: any;
31
+ }) => any;
32
+ create: ({ token, jwtToken, data, headers }: {
33
+ token: any;
34
+ jwtToken: any;
35
+ data: any;
36
+ headers: any;
37
+ }) => any;
38
+ };
@@ -1313,6 +1313,40 @@ declare const _exports: {
1313
1313
  headers: any;
1314
1314
  }) => any;
1315
1315
  };
1316
+ stationTypes: {
1317
+ all: ({ token, jwtToken, query, headers }: {
1318
+ token: any;
1319
+ jwtToken: any;
1320
+ query?: {};
1321
+ headers: any;
1322
+ }) => any;
1323
+ get: ({ token, jwtToken, stationTypeId, query, headers }: {
1324
+ token: any;
1325
+ jwtToken: any;
1326
+ stationTypeId: any;
1327
+ query?: {};
1328
+ headers: any;
1329
+ }) => any;
1330
+ update: ({ token, jwtToken, stationTypeId, data, headers }: {
1331
+ token: any;
1332
+ jwtToken: any;
1333
+ stationTypeId: any;
1334
+ data: any;
1335
+ headers: any;
1336
+ }) => any;
1337
+ remove: ({ token, jwtToken, stationTypeId, headers }: {
1338
+ token: any;
1339
+ jwtToken: any;
1340
+ stationTypeId: any;
1341
+ headers: any;
1342
+ }) => any;
1343
+ create: ({ token, jwtToken, data, headers }: {
1344
+ token: any;
1345
+ jwtToken: any;
1346
+ data: any;
1347
+ headers: any;
1348
+ }) => any;
1349
+ };
1316
1350
  zonePrices: {
1317
1351
  all: ({ token, query, headers }: {
1318
1352
  token: any;