btrz-api-client 7.27.0 → 7.29.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/accounts/multiproduct-sales-settings.js +41 -0
- package/lib/endpoints/inventory/routes.js +40 -24
- package/package.json +1 -1
- package/src/client.js +1 -0
- package/src/endpoints/accounts/multiproduct-sales-settings.js +28 -0
- package/src/endpoints/inventory/routes.js +10 -0
- package/test/endpoints/accounts/multiproduct-sales-settings.test.js +36 -0
- package/test/endpoints/inventory/routes.test.js +23 -0
- package/types/client.d.ts +19 -0
- package/types/endpoints/accounts/multiproduct-sales-settings.d.ts +17 -0
- package/types/endpoints/inventory/routes.d.ts +6 -0
- package/types/initializedClient.d.ts +19 -0
package/lib/client.js
CHANGED
|
@@ -202,6 +202,7 @@ function createAccounts(_ref4) {
|
|
|
202
202
|
}),
|
|
203
203
|
pointToPointSettings: require("./endpoints/accounts/point-to-point-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
204
204
|
marketPricingSettings: require("./endpoints/accounts/market-pricing-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
205
|
+
multiproductSalesSettings: require("./endpoints/accounts/multiproduct-sales-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
205
206
|
printers: require("./endpoints/accounts/printers.js")({
|
|
206
207
|
client: client, internalAuthTokenProvider: internalAuthTokenProvider
|
|
207
208
|
}),
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function multiproductSalesSettingsFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
|
+
|
|
10
|
+
function get(_ref2) {
|
|
11
|
+
var token = _ref2.token,
|
|
12
|
+
jwtToken = _ref2.jwtToken,
|
|
13
|
+
headers = _ref2.headers;
|
|
14
|
+
|
|
15
|
+
return client({
|
|
16
|
+
url: "/multiproduct-sales-settings",
|
|
17
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function update(_ref3) {
|
|
22
|
+
var token = _ref3.token,
|
|
23
|
+
jwtToken = _ref3.jwtToken,
|
|
24
|
+
data = _ref3.data,
|
|
25
|
+
headers = _ref3.headers;
|
|
26
|
+
|
|
27
|
+
return client({
|
|
28
|
+
url: "/multiproduct-sales-settings",
|
|
29
|
+
method: "put",
|
|
30
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
31
|
+
data: data
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
get: get,
|
|
37
|
+
update: update
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
module.exports = multiproductSalesSettingsFactory;
|
|
@@ -95,12 +95,27 @@ function routesFactory(_ref) {
|
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
function remove(_ref8) {
|
|
99
|
+
var token = _ref8.token,
|
|
100
|
+
jwtToken = _ref8.jwtToken,
|
|
101
|
+
routeId = _ref8.routeId,
|
|
102
|
+
headers = _ref8.headers;
|
|
103
|
+
|
|
104
|
+
return client({
|
|
105
|
+
url: "/routes/" + routeId,
|
|
106
|
+
method: "delete",
|
|
107
|
+
headers: authorizationHeaders({
|
|
108
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
98
113
|
var fareTables = {
|
|
99
|
-
all: function all(
|
|
100
|
-
var token =
|
|
101
|
-
|
|
102
|
-
query =
|
|
103
|
-
headers =
|
|
114
|
+
all: function all(_ref9) {
|
|
115
|
+
var token = _ref9.token,
|
|
116
|
+
_ref9$query = _ref9.query,
|
|
117
|
+
query = _ref9$query === undefined ? {} : _ref9$query,
|
|
118
|
+
headers = _ref9.headers;
|
|
104
119
|
|
|
105
120
|
return client({
|
|
106
121
|
url: "/routes/fare-tables",
|
|
@@ -110,12 +125,12 @@ function routesFactory(_ref) {
|
|
|
110
125
|
})
|
|
111
126
|
});
|
|
112
127
|
},
|
|
113
|
-
create: function create(
|
|
114
|
-
var token =
|
|
115
|
-
jwtToken =
|
|
116
|
-
routeId =
|
|
117
|
-
fareTable =
|
|
118
|
-
headers =
|
|
128
|
+
create: function create(_ref10) {
|
|
129
|
+
var token = _ref10.token,
|
|
130
|
+
jwtToken = _ref10.jwtToken,
|
|
131
|
+
routeId = _ref10.routeId,
|
|
132
|
+
fareTable = _ref10.fareTable,
|
|
133
|
+
headers = _ref10.headers;
|
|
119
134
|
|
|
120
135
|
return client({
|
|
121
136
|
url: "/routes/" + routeId + "/fare-tables",
|
|
@@ -128,13 +143,13 @@ function routesFactory(_ref) {
|
|
|
128
143
|
}
|
|
129
144
|
});
|
|
130
145
|
},
|
|
131
|
-
update: function update(
|
|
132
|
-
var token =
|
|
133
|
-
jwtToken =
|
|
134
|
-
routeId =
|
|
135
|
-
fareTableId =
|
|
136
|
-
fareTable =
|
|
137
|
-
headers =
|
|
146
|
+
update: function update(_ref11) {
|
|
147
|
+
var token = _ref11.token,
|
|
148
|
+
jwtToken = _ref11.jwtToken,
|
|
149
|
+
routeId = _ref11.routeId,
|
|
150
|
+
fareTableId = _ref11.fareTableId,
|
|
151
|
+
fareTable = _ref11.fareTable,
|
|
152
|
+
headers = _ref11.headers;
|
|
138
153
|
|
|
139
154
|
return client({
|
|
140
155
|
url: "/routes/" + routeId + "/fare-tables/" + fareTableId,
|
|
@@ -149,12 +164,12 @@ function routesFactory(_ref) {
|
|
|
149
164
|
}
|
|
150
165
|
};
|
|
151
166
|
var stops = {
|
|
152
|
-
create: function create(
|
|
153
|
-
var token =
|
|
154
|
-
jwtToken =
|
|
155
|
-
routeId =
|
|
156
|
-
stop =
|
|
157
|
-
headers =
|
|
167
|
+
create: function create(_ref12) {
|
|
168
|
+
var token = _ref12.token,
|
|
169
|
+
jwtToken = _ref12.jwtToken,
|
|
170
|
+
routeId = _ref12.routeId,
|
|
171
|
+
stop = _ref12.stop,
|
|
172
|
+
headers = _ref12.headers;
|
|
158
173
|
|
|
159
174
|
return client({
|
|
160
175
|
url: "/routes/" + routeId + "/stops",
|
|
@@ -174,6 +189,7 @@ function routesFactory(_ref) {
|
|
|
174
189
|
stations: stations,
|
|
175
190
|
create: create,
|
|
176
191
|
update: update,
|
|
192
|
+
remove: remove,
|
|
177
193
|
fareTables: fareTables,
|
|
178
194
|
stops: stops
|
|
179
195
|
};
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -168,6 +168,7 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
|
|
|
168
168
|
}),
|
|
169
169
|
pointToPointSettings: require("./endpoints/accounts/point-to-point-settings.js")({client, internalAuthTokenProvider}),
|
|
170
170
|
marketPricingSettings: require("./endpoints/accounts/market-pricing-settings.js")({client, internalAuthTokenProvider}),
|
|
171
|
+
multiproductSalesSettings: require("./endpoints/accounts/multiproduct-sales-settings.js")({client, internalAuthTokenProvider}),
|
|
171
172
|
printers: require("./endpoints/accounts/printers.js")({
|
|
172
173
|
client, internalAuthTokenProvider
|
|
173
174
|
}),
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
function multiproductSalesSettingsFactory({client, internalAuthTokenProvider}) {
|
|
6
|
+
function get({token, jwtToken, headers}) {
|
|
7
|
+
return client({
|
|
8
|
+
url: "/multiproduct-sales-settings",
|
|
9
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function update({token, jwtToken, data, headers}) {
|
|
14
|
+
return client({
|
|
15
|
+
url: "/multiproduct-sales-settings",
|
|
16
|
+
method: "put",
|
|
17
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
18
|
+
data
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
get,
|
|
24
|
+
update
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = multiproductSalesSettingsFactory;
|
|
@@ -55,6 +55,15 @@ function routesFactory({client, internalAuthTokenProvider}) {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
function remove({token, jwtToken, routeId, headers}) {
|
|
59
|
+
return client({
|
|
60
|
+
url: `/routes/${routeId}`,
|
|
61
|
+
method: "delete",
|
|
62
|
+
headers: authorizationHeaders({
|
|
63
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
}
|
|
58
67
|
|
|
59
68
|
const fareTables = {
|
|
60
69
|
all({
|
|
@@ -117,6 +126,7 @@ function routesFactory({client, internalAuthTokenProvider}) {
|
|
|
117
126
|
stations,
|
|
118
127
|
create,
|
|
119
128
|
update,
|
|
129
|
+
remove,
|
|
120
130
|
fareTables,
|
|
121
131
|
stops
|
|
122
132
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const {axiosMock, expectRequest} = require("../../test-helpers.js");
|
|
2
|
+
const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
3
|
+
|
|
4
|
+
describe("accounts/multiproduct-sales-settings", () => {
|
|
5
|
+
const token = "I owe you a token";
|
|
6
|
+
const jwtToken = "secret";
|
|
7
|
+
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
axiosMock.reset();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should get the multiproduct sales settings", () => {
|
|
13
|
+
axiosMock.onGet("/multiproduct-sales-settings")
|
|
14
|
+
.reply(expectRequest({statusCode: 200, token}));
|
|
15
|
+
|
|
16
|
+
return api.accounts.multiproductSalesSettings.get({token, jwtToken});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should update multiproduct sales settings", () => {
|
|
20
|
+
const data = {
|
|
21
|
+
productsMapping: {"507f1f77bcf86cd799439011": ["507f1f77bcf86cd799439012"]},
|
|
22
|
+
stationsMapping: {"507f1f77bcf86cd799439014": ["507f1f77bcf86cd799439015"]}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
axiosMock.onPut("/multiproduct-sales-settings")
|
|
26
|
+
.reply(expectRequest({
|
|
27
|
+
statusCode: 200,
|
|
28
|
+
token,
|
|
29
|
+
jwtToken
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
return api.accounts.multiproductSalesSettings.update({
|
|
33
|
+
token, jwtToken, data
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -83,4 +83,27 @@ describe("inventory/route", () => {
|
|
|
83
83
|
token, jwtToken, routeId, stop
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
|
+
|
|
87
|
+
it("should update a route", () => {
|
|
88
|
+
const routeId = "507f1f77bcf86cd799439011";
|
|
89
|
+
const data = {
|
|
90
|
+
name: "Updated Route Name"
|
|
91
|
+
};
|
|
92
|
+
axiosMock.onPut(`/routes/${routeId}`).reply(expectRequest({
|
|
93
|
+
statusCode: 200, token, jwtToken
|
|
94
|
+
}));
|
|
95
|
+
return api.inventory.routes.update({
|
|
96
|
+
token, jwtToken, routeId, data
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("should delete a route", () => {
|
|
101
|
+
const routeId = "507f1f77bcf86cd799439011";
|
|
102
|
+
axiosMock.onDelete(`/routes/${routeId}`).reply(expectRequest({
|
|
103
|
+
statusCode: 200, token, jwtToken
|
|
104
|
+
}));
|
|
105
|
+
return api.inventory.routes.remove({
|
|
106
|
+
token, jwtToken, routeId
|
|
107
|
+
});
|
|
108
|
+
});
|
|
86
109
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -1322,6 +1322,12 @@ export function createApiClient(options: {
|
|
|
1322
1322
|
routeId: any;
|
|
1323
1323
|
headers: any;
|
|
1324
1324
|
}) => any;
|
|
1325
|
+
remove: ({ token, jwtToken, routeId, headers }: {
|
|
1326
|
+
token: any;
|
|
1327
|
+
jwtToken: any;
|
|
1328
|
+
routeId: any;
|
|
1329
|
+
headers: any;
|
|
1330
|
+
}) => any;
|
|
1325
1331
|
fareTables: {
|
|
1326
1332
|
all({ token, query, headers }: {
|
|
1327
1333
|
token: any;
|
|
@@ -2535,6 +2541,19 @@ export function createApiClient(options: {
|
|
|
2535
2541
|
headers: any;
|
|
2536
2542
|
}) => any;
|
|
2537
2543
|
};
|
|
2544
|
+
multiproductSalesSettings: {
|
|
2545
|
+
get: ({ token, jwtToken, headers }: {
|
|
2546
|
+
token: any;
|
|
2547
|
+
jwtToken: any;
|
|
2548
|
+
headers: any;
|
|
2549
|
+
}) => any;
|
|
2550
|
+
update: ({ token, jwtToken, data, headers }: {
|
|
2551
|
+
token: any;
|
|
2552
|
+
jwtToken: any;
|
|
2553
|
+
data: any;
|
|
2554
|
+
headers: any;
|
|
2555
|
+
}) => any;
|
|
2556
|
+
};
|
|
2538
2557
|
printers: {
|
|
2539
2558
|
all: ({ token, query, headers }: {
|
|
2540
2559
|
token: any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export = multiproductSalesSettingsFactory;
|
|
2
|
+
declare function multiproductSalesSettingsFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
get: ({ token, jwtToken, headers }: {
|
|
7
|
+
token: any;
|
|
8
|
+
jwtToken: any;
|
|
9
|
+
headers: any;
|
|
10
|
+
}) => any;
|
|
11
|
+
update: ({ token, jwtToken, data, headers }: {
|
|
12
|
+
token: any;
|
|
13
|
+
jwtToken: any;
|
|
14
|
+
data: any;
|
|
15
|
+
headers: any;
|
|
16
|
+
}) => any;
|
|
17
|
+
};
|
|
@@ -41,6 +41,12 @@ declare function routesFactory({ client, internalAuthTokenProvider }: {
|
|
|
41
41
|
routeId: any;
|
|
42
42
|
headers: any;
|
|
43
43
|
}) => any;
|
|
44
|
+
remove: ({ token, jwtToken, routeId, headers }: {
|
|
45
|
+
token: any;
|
|
46
|
+
jwtToken: any;
|
|
47
|
+
routeId: any;
|
|
48
|
+
headers: any;
|
|
49
|
+
}) => any;
|
|
44
50
|
fareTables: {
|
|
45
51
|
all({ token, query, headers }: {
|
|
46
52
|
token: any;
|
|
@@ -1276,6 +1276,12 @@ declare const _exports: {
|
|
|
1276
1276
|
routeId: any;
|
|
1277
1277
|
headers: any;
|
|
1278
1278
|
}) => any;
|
|
1279
|
+
remove: ({ token, jwtToken, routeId, headers }: {
|
|
1280
|
+
token: any;
|
|
1281
|
+
jwtToken: any;
|
|
1282
|
+
routeId: any;
|
|
1283
|
+
headers: any;
|
|
1284
|
+
}) => any;
|
|
1279
1285
|
fareTables: {
|
|
1280
1286
|
all({ token, query, headers }: {
|
|
1281
1287
|
token: any;
|
|
@@ -2489,6 +2495,19 @@ declare const _exports: {
|
|
|
2489
2495
|
headers: any;
|
|
2490
2496
|
}) => any;
|
|
2491
2497
|
};
|
|
2498
|
+
multiproductSalesSettings: {
|
|
2499
|
+
get: ({ token, jwtToken, headers }: {
|
|
2500
|
+
token: any;
|
|
2501
|
+
jwtToken: any;
|
|
2502
|
+
headers: any;
|
|
2503
|
+
}) => any;
|
|
2504
|
+
update: ({ token, jwtToken, data, headers }: {
|
|
2505
|
+
token: any;
|
|
2506
|
+
jwtToken: any;
|
|
2507
|
+
data: any;
|
|
2508
|
+
headers: any;
|
|
2509
|
+
}) => any;
|
|
2510
|
+
};
|
|
2492
2511
|
printers: {
|
|
2493
2512
|
all: ({ token, query, headers }: {
|
|
2494
2513
|
token: any;
|