btrz-api-client 5.236.0 → 6.0.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
@@ -62,7 +62,6 @@ function createInventory(_ref) {
62
62
  insurancesCost: require("./endpoints/inventory/insurancesCost.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
63
63
  stations: require("./endpoints/inventory/stations.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
64
64
  stationsProvinces: require("./endpoints/inventory/stations-provinces.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
65
- stationsTypes: require("./endpoints/inventory/stations-types.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
66
65
  stationsZones: require("./endpoints/inventory/stations-zones.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
67
66
  parcelZones: require("./endpoints/inventory/parcel-zones.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
68
67
  countries: require("./endpoints/inventory/countries.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
@@ -103,6 +102,7 @@ function createInventory(_ref) {
103
102
  scheduleGroups: require("./endpoints/inventory/schedule-groups.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
104
103
  bundles: require("./endpoints/inventory/bundles.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
105
104
  stationGroups: require("./endpoints/inventory/station-groups.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
105
+ stationTypes: require("./endpoints/inventory/station-types.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
106
106
  zonePrices: require("./endpoints/inventory/zone-prices.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
107
107
  zonePriceOverages: require("./endpoints/inventory/zone-price-overages.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
108
108
  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": "6.0.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/client.js CHANGED
@@ -49,7 +49,6 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
49
49
  insurancesCost: require("./endpoints/inventory/insurancesCost.js")({client, internalAuthTokenProvider}),
50
50
  stations: require("./endpoints/inventory/stations.js")({client, internalAuthTokenProvider}),
51
51
  stationsProvinces: require("./endpoints/inventory/stations-provinces.js")({client, internalAuthTokenProvider}),
52
- stationsTypes: require("./endpoints/inventory/stations-types.js")({client, internalAuthTokenProvider}),
53
52
  stationsZones: require("./endpoints/inventory/stations-zones.js")({client, internalAuthTokenProvider}),
54
53
  parcelZones: require("./endpoints/inventory/parcel-zones.js")({client, internalAuthTokenProvider}),
55
54
  countries: require("./endpoints/inventory/countries.js")({client, internalAuthTokenProvider}),
@@ -90,6 +89,7 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
90
89
  scheduleGroups: require("./endpoints/inventory/schedule-groups.js")({client, internalAuthTokenProvider}),
91
90
  bundles: require("./endpoints/inventory/bundles.js")({client, internalAuthTokenProvider}),
92
91
  stationGroups: require("./endpoints/inventory/station-groups.js")({client, internalAuthTokenProvider}),
92
+ stationTypes: require("./endpoints/inventory/station-types.js")({client, internalAuthTokenProvider}),
93
93
  zonePrices: require("./endpoints/inventory/zone-prices.js")({client, internalAuthTokenProvider}),
94
94
  zonePriceOverages: require("./endpoints/inventory/zone-price-overages.js")({client, internalAuthTokenProvider}),
95
95
  travellerCardProviders: require("./endpoints/inventory/traveller-card-providers.js")({client, internalAuthTokenProvider}),
@@ -364,7 +364,7 @@ function createBtrzPay({baseURL, headers, timeout, overrideFn, internalAuthToken
364
364
  oxxo: require("./endpoints/btrzpay/oxxo.js")({client, internalAuthTokenProvider}),
365
365
  datalogic: require("./endpoints/btrzpay/datalogic.js")({client, internalAuthTokenProvider}),
366
366
  prismaTerminals: require("./endpoints/btrzpay/prismaTerminals.js")({client, internalAuthTokenProvider}),
367
- terminalPayments: require("./endpoints/btrzpay/terminalPayments.js")({ client, internalAuthTokenProvider}),
367
+ terminalPayments: require("./endpoints/btrzpay/terminalPayments.js")({client, internalAuthTokenProvider}),
368
368
  __test: {
369
369
  client
370
370
  }
@@ -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
@@ -225,13 +225,6 @@ export function createApiClient(options: {
225
225
  headers: any;
226
226
  }) => any;
227
227
  };
228
- stationsTypes: {
229
- all: ({ token, query, headers }: {
230
- token: any;
231
- query?: {};
232
- headers: any;
233
- }) => any;
234
- };
235
228
  stationsZones: {
236
229
  get: ({ token, query, headers }: {
237
230
  token: any;
@@ -1359,6 +1352,40 @@ export function createApiClient(options: {
1359
1352
  headers: any;
1360
1353
  }) => any;
1361
1354
  };
1355
+ stationTypes: {
1356
+ all: ({ token, jwtToken, query, headers }: {
1357
+ token: any;
1358
+ jwtToken: any;
1359
+ query?: {};
1360
+ headers: any;
1361
+ }) => any;
1362
+ get: ({ token, jwtToken, stationTypeId, query, headers }: {
1363
+ token: any;
1364
+ jwtToken: any;
1365
+ stationTypeId: any;
1366
+ query?: {};
1367
+ headers: any;
1368
+ }) => any;
1369
+ update: ({ token, jwtToken, stationTypeId, data, headers }: {
1370
+ token: any;
1371
+ jwtToken: any;
1372
+ stationTypeId: any;
1373
+ data: any;
1374
+ headers: any;
1375
+ }) => any;
1376
+ remove: ({ token, jwtToken, stationTypeId, headers }: {
1377
+ token: any;
1378
+ jwtToken: any;
1379
+ stationTypeId: any;
1380
+ headers: any;
1381
+ }) => any;
1382
+ create: ({ token, jwtToken, data, headers }: {
1383
+ token: any;
1384
+ jwtToken: any;
1385
+ data: any;
1386
+ headers: any;
1387
+ }) => any;
1388
+ };
1362
1389
  zonePrices: {
1363
1390
  all: ({ token, query, headers }: {
1364
1391
  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
+ };
@@ -179,13 +179,6 @@ declare const _exports: {
179
179
  headers: any;
180
180
  }) => any;
181
181
  };
182
- stationsTypes: {
183
- all: ({ token, query, headers }: {
184
- token: any;
185
- query?: {};
186
- headers: any;
187
- }) => any;
188
- };
189
182
  stationsZones: {
190
183
  get: ({ token, query, headers }: {
191
184
  token: any;
@@ -1313,6 +1306,40 @@ declare const _exports: {
1313
1306
  headers: any;
1314
1307
  }) => any;
1315
1308
  };
1309
+ stationTypes: {
1310
+ all: ({ token, jwtToken, query, headers }: {
1311
+ token: any;
1312
+ jwtToken: any;
1313
+ query?: {};
1314
+ headers: any;
1315
+ }) => any;
1316
+ get: ({ token, jwtToken, stationTypeId, query, headers }: {
1317
+ token: any;
1318
+ jwtToken: any;
1319
+ stationTypeId: any;
1320
+ query?: {};
1321
+ headers: any;
1322
+ }) => any;
1323
+ update: ({ token, jwtToken, stationTypeId, data, headers }: {
1324
+ token: any;
1325
+ jwtToken: any;
1326
+ stationTypeId: any;
1327
+ data: any;
1328
+ headers: any;
1329
+ }) => any;
1330
+ remove: ({ token, jwtToken, stationTypeId, headers }: {
1331
+ token: any;
1332
+ jwtToken: any;
1333
+ stationTypeId: any;
1334
+ headers: any;
1335
+ }) => any;
1336
+ create: ({ token, jwtToken, data, headers }: {
1337
+ token: any;
1338
+ jwtToken: any;
1339
+ data: any;
1340
+ headers: any;
1341
+ }) => any;
1342
+ };
1316
1343
  zonePrices: {
1317
1344
  all: ({ token, query, headers }: {
1318
1345
  token: any;
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- var _require = require("../endpoints_helpers.js"),
4
- authorizationHeaders = _require.authorizationHeaders;
5
-
6
- function stationsTypesFactory(_ref) {
7
- var client = _ref.client,
8
- internalAuthTokenProvider = _ref.internalAuthTokenProvider;
9
-
10
- function all(_ref2) {
11
- var token = _ref2.token,
12
- _ref2$query = _ref2.query,
13
- query = _ref2$query === undefined ? {} : _ref2$query,
14
- headers = _ref2.headers;
15
-
16
- return client({
17
- url: "/stations/types",
18
- params: query,
19
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
20
- });
21
- }
22
-
23
- return {
24
- all: all
25
- };
26
- }
27
-
28
- module.exports = stationsTypesFactory;
@@ -1,19 +0,0 @@
1
- const {
2
- authorizationHeaders
3
- } = require("../endpoints_helpers.js");
4
-
5
- function stationsTypesFactory({client, internalAuthTokenProvider}) {
6
- function all({token, query = {}, headers}) {
7
- return client({
8
- url: "/stations/types",
9
- params: query,
10
- headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
11
- });
12
- }
13
-
14
- return {
15
- all
16
- };
17
- }
18
-
19
- module.exports = stationsTypesFactory;
@@ -1,21 +0,0 @@
1
- const {
2
- axiosMock, expectRequest
3
- } = require("./../../test-helpers.js");
4
- const api = require("./../../../src/client.js").createApiClient({
5
- baseURL: "http://test.com"
6
- });
7
-
8
- describe("inventory/stations/types", () => {
9
- const token = "I owe you a token";
10
-
11
- afterEach(() => {
12
- axiosMock.reset();
13
- });
14
-
15
- it("should list zones", () => {
16
- axiosMock.onGet("/stations/types").reply(expectRequest({statusCode: 200, token}));
17
- return api.inventory.stationsTypes.all({
18
- token
19
- });
20
- });
21
- });