btrz-api-client 8.31.0 → 8.33.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/.cursor/rules/jsdoc-endpoints.mdc +1 -1
- package/lib/client-standalone-min.js +3 -3
- package/lib/client.js +5 -0
- package/lib/endpoints/accounts/agencies.js +52 -0
- package/lib/endpoints/accounts/application-settings.js +19 -18
- package/lib/endpoints/accounts/applications.js +8 -7
- package/lib/endpoints/accounts/customers.js +27 -24
- package/lib/endpoints/accounts/domains.js +16 -11
- package/lib/endpoints/accounts/email-settings.js +22 -18
- package/lib/endpoints/accounts/email-templates.js +8 -4
- package/lib/endpoints/accounts/exchange-rates.js +12 -7
- package/lib/endpoints/accounts/exchange-receipts.js +10 -6
- package/lib/endpoints/accounts/external-customers.js +50 -0
- package/lib/endpoints/accounts/goal-settings.js +8 -6
- package/lib/endpoints/accounts/images.js +14 -13
- package/lib/endpoints/accounts/interline.js +35 -27
- package/lib/endpoints/accounts/journey-prices-settings.js +8 -6
- package/lib/endpoints/accounts/lexicons.js +13 -13
- package/lib/endpoints/accounts/market-pricing-settings.js +7 -6
- package/lib/endpoints/accounts/multiproduct-sales-settings.js +7 -6
- package/lib/endpoints/accounts/network.js +28 -13
- package/lib/endpoints/accounts/operation-settings.js +8 -6
- package/lib/endpoints/accounts/people-lookups.js +17 -17
- package/lib/endpoints/accounts/point-to-point-settings.js +6 -6
- package/lib/endpoints/accounts/print-settings.js +9 -6
- package/lib/endpoints/accounts/print-templates.js +37 -21
- package/lib/endpoints/accounts/printers.js +10 -4
- package/lib/endpoints/accounts/rms-settings.js +19 -11
- package/lib/endpoints/accounts/salesforce-settings.js +8 -6
- package/lib/endpoints/accounts/shift-settings.js +7 -6
- package/lib/endpoints/accounts/shifts.js +13 -9
- package/lib/endpoints/accounts/sms-templates.js +28 -19
- package/lib/endpoints/accounts/sub-print-templates.js +5 -3
- package/lib/endpoints/accounts/ticket-movement-settings.js +8 -5
- package/lib/endpoints/accounts/travellers.js +18 -12
- package/lib/endpoints/accounts/trusted-machines.js +11 -8
- package/lib/endpoints/accounts/twilio-settings.js +8 -5
- package/lib/endpoints/accounts/users.js +105 -63
- package/lib/endpoints/accounts/verified-emails.js +130 -0
- package/lib/endpoints/accounts/websales-config.js +7 -5
- package/lib/endpoints/coltrane/healthcheck.js +35 -0
- package/lib/endpoints/coltrane/info.js +35 -0
- package/lib/endpoints/coltrane/paths.js +17 -13
- package/package.json +1 -1
- package/src/client.js +5 -0
- package/src/endpoints/accounts/agencies.js +40 -0
- package/src/endpoints/accounts/application-settings.js +19 -18
- package/src/endpoints/accounts/applications.js +8 -7
- package/src/endpoints/accounts/customers.js +27 -24
- package/src/endpoints/accounts/domains.js +16 -11
- package/src/endpoints/accounts/email-settings.js +22 -18
- package/src/endpoints/accounts/email-templates.js +8 -4
- package/src/endpoints/accounts/exchange-rates.js +12 -7
- package/src/endpoints/accounts/exchange-receipts.js +10 -6
- package/src/endpoints/accounts/external-customers.js +37 -0
- package/src/endpoints/accounts/goal-settings.js +8 -6
- package/src/endpoints/accounts/images.js +14 -13
- package/src/endpoints/accounts/interline.js +35 -28
- package/src/endpoints/accounts/journey-prices-settings.js +8 -6
- package/src/endpoints/accounts/lexicons.js +13 -13
- package/src/endpoints/accounts/market-pricing-settings.js +7 -6
- package/src/endpoints/accounts/multiproduct-sales-settings.js +7 -6
- package/src/endpoints/accounts/network.js +28 -14
- package/src/endpoints/accounts/operation-settings.js +8 -6
- package/src/endpoints/accounts/people-lookups.js +17 -17
- package/src/endpoints/accounts/point-to-point-settings.js +6 -6
- package/src/endpoints/accounts/print-settings.js +9 -7
- package/src/endpoints/accounts/print-templates.js +31 -19
- package/src/endpoints/accounts/printers.js +10 -5
- package/src/endpoints/accounts/rms-settings.js +19 -11
- package/src/endpoints/accounts/salesforce-settings.js +8 -6
- package/src/endpoints/accounts/shift-settings.js +7 -6
- package/src/endpoints/accounts/shifts.js +13 -9
- package/src/endpoints/accounts/sms-templates.js +28 -19
- package/src/endpoints/accounts/sub-print-templates.js +5 -3
- package/src/endpoints/accounts/ticket-movement-settings.js +8 -5
- package/src/endpoints/accounts/travellers.js +18 -12
- package/src/endpoints/accounts/trusted-machines.js +11 -8
- package/src/endpoints/accounts/twilio-settings.js +8 -5
- package/src/endpoints/accounts/users.js +42 -5
- package/src/endpoints/accounts/verified-emails.js +100 -0
- package/src/endpoints/accounts/websales-config.js +7 -5
- package/src/endpoints/coltrane/healthcheck.js +28 -0
- package/src/endpoints/coltrane/info.js +28 -0
- package/src/endpoints/coltrane/paths.js +17 -13
- package/test/endpoints/accounts/agencies.test.js +58 -0
- package/test/endpoints/accounts/external-customers.test.js +62 -0
- package/test/endpoints/accounts/users.js +10 -0
- package/test/endpoints/accounts/verified-emails.test.js +35 -0
- package/test/endpoints/coltrane/healthcheck.test.js +13 -0
- package/test/endpoints/coltrane/info.test.js +13 -0
- package/types/endpoints/accounts/users.d.ts +2 -1
- package/types/endpoints/accounts/verified-emails.d.ts +19 -0
|
@@ -4,6 +4,24 @@
|
|
|
4
4
|
var _require = require("./../endpoints_helpers.js"),
|
|
5
5
|
authorizationHeaders = _require.authorizationHeaders;
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Query params for GET /users (btrz-api-accounts). See get-users getSpec().
|
|
9
|
+
* @typedef {Object} GetUsersListQuery
|
|
10
|
+
* @property {number} [page] - Page number (1-based). When provided, response is limited to pageSize items.
|
|
11
|
+
* @property {string} [deleted] - "true" | "false" to filter by deleted flag
|
|
12
|
+
* @property {string} [firstName] - Filter by first name (prefix, case-insensitive)
|
|
13
|
+
* @property {string} [lastName] - Filter by last name (prefix, case-insensitive)
|
|
14
|
+
* @property {string} [display] - Filter by display name (prefix, case-insensitive)
|
|
15
|
+
* @property {string} [externalId] - Filter by external ID (exact)
|
|
16
|
+
* @property {string} [employeeNumber] - Filter by employee number (exact)
|
|
17
|
+
* @property {string} [email] - Filter by email (prefix, case-insensitive)
|
|
18
|
+
* @property {string} [assignableToManifest] - "true" | "false"
|
|
19
|
+
* @property {string} [role] - Filter users that have this role (role key)
|
|
20
|
+
* @property {string} [excludedRoles] - Comma-separated role keys to exclude
|
|
21
|
+
* @property {string} [preferredLocationId] - Filter by preferred location ID
|
|
22
|
+
* @property {string} [preferredLocationIds] - Filter by preferred location IDs
|
|
23
|
+
*/
|
|
24
|
+
|
|
7
25
|
/**
|
|
8
26
|
* Query params for GET /users/:userId/sequences (btrz-api-accounts). See get-user-sequences-handler getSpec().
|
|
9
27
|
* @typedef {Object} UserSequencesListQuery
|
|
@@ -16,7 +34,7 @@ var _require = require("./../endpoints_helpers.js"),
|
|
|
16
34
|
* @param {Object} deps
|
|
17
35
|
* @param {import("axios").AxiosInstance} deps.client
|
|
18
36
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
19
|
-
* @returns {{ get: function, getV2: function, all: function, create: function, login: function, update: function, createOrUpdateMany: function, impersonate: function, startMfa: function, confirmMfa: function, disableMfa: function, sequences: { get: function, all: function, create: function, update: function, transfer: function } }}
|
|
37
|
+
* @returns {{ get: function, getV2: function, all: function, create: function, login: function, update: function, delete: function, createOrUpdateMany: function, impersonate: function, startMfa: function, confirmMfa: function, disableMfa: function, sequences: { get: function, all: function, create: function, update: function, transfer: function } }}
|
|
20
38
|
*/
|
|
21
39
|
|
|
22
40
|
|
|
@@ -69,10 +87,11 @@ function usersFactory(_ref) {
|
|
|
69
87
|
}
|
|
70
88
|
|
|
71
89
|
/**
|
|
72
|
-
* GET /users - list users
|
|
90
|
+
* GET /users - list users with optional pagination and filters.
|
|
73
91
|
* @param {Object} opts
|
|
74
92
|
* @param {string} [opts.token] - API key
|
|
75
93
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
94
|
+
* @param {GetUsersListQuery} [opts.query] - Query params (page, deleted, firstName, lastName, display, externalId, employeeNumber, email, assignableToManifest, role, excludedRoles, preferredLocationId, preferredLocationIds)
|
|
76
95
|
* @param {Object} [opts.headers] - Optional headers
|
|
77
96
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
78
97
|
*/
|
|
@@ -137,14 +156,14 @@ function usersFactory(_ref) {
|
|
|
137
156
|
}
|
|
138
157
|
|
|
139
158
|
/**
|
|
140
|
-
* PUT /users/:userId - update a user.
|
|
159
|
+
* PUT /users/:userId - update a user. Emits webhook user.updated.
|
|
141
160
|
* @param {Object} opts
|
|
142
161
|
* @param {string} [opts.token] - API key
|
|
143
162
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
144
163
|
* @param {string} opts.userId - User id (ObjectId)
|
|
145
|
-
* @param {Object} opts.user - User payload
|
|
164
|
+
* @param {Object} opts.user - User payload (allowed fields per PUT /users/:userId spec)
|
|
146
165
|
* @param {Object} [opts.headers] - Optional headers
|
|
147
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
166
|
+
* @returns {Promise<import("axios").AxiosResponse<{ user: Object }>>}
|
|
148
167
|
*/
|
|
149
168
|
function update(_ref7) {
|
|
150
169
|
var token = _ref7.token,
|
|
@@ -162,20 +181,42 @@ function usersFactory(_ref) {
|
|
|
162
181
|
}
|
|
163
182
|
|
|
164
183
|
/**
|
|
165
|
-
*
|
|
184
|
+
* DELETE /users/:id - delete a user. Emits webhook user.deleted. Returns 204 on success.
|
|
166
185
|
* @param {Object} opts
|
|
167
186
|
* @param {string} [opts.token] - API key
|
|
168
187
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
169
|
-
* @param {
|
|
188
|
+
* @param {string} opts.id - User id (ObjectId)
|
|
170
189
|
* @param {Object} [opts.headers] - Optional headers
|
|
171
190
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
172
191
|
*/
|
|
173
|
-
function
|
|
192
|
+
function deleteUser(_ref8) {
|
|
174
193
|
var token = _ref8.token,
|
|
175
194
|
jwtToken = _ref8.jwtToken,
|
|
176
|
-
|
|
195
|
+
id = _ref8.id,
|
|
177
196
|
headers = _ref8.headers;
|
|
178
197
|
|
|
198
|
+
return client({
|
|
199
|
+
url: "/users/" + id,
|
|
200
|
+
method: "delete",
|
|
201
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* POST /users/import - create or update many users.
|
|
207
|
+
* @param {Object} opts
|
|
208
|
+
* @param {string} [opts.token] - API key
|
|
209
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
210
|
+
* @param {Array} opts.users - Array of user objects
|
|
211
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
212
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
213
|
+
*/
|
|
214
|
+
function createOrUpdateMany(_ref9) {
|
|
215
|
+
var token = _ref9.token,
|
|
216
|
+
jwtToken = _ref9.jwtToken,
|
|
217
|
+
users = _ref9.users,
|
|
218
|
+
headers = _ref9.headers;
|
|
219
|
+
|
|
179
220
|
return client({
|
|
180
221
|
url: "/users/import",
|
|
181
222
|
method: "post",
|
|
@@ -193,11 +234,11 @@ function usersFactory(_ref) {
|
|
|
193
234
|
* @param {Object} [opts.headers] - Optional headers
|
|
194
235
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
195
236
|
*/
|
|
196
|
-
function impersonate(
|
|
197
|
-
var token =
|
|
198
|
-
jwtToken =
|
|
199
|
-
offlineUserId =
|
|
200
|
-
headers =
|
|
237
|
+
function impersonate(_ref10) {
|
|
238
|
+
var token = _ref10.token,
|
|
239
|
+
jwtToken = _ref10.jwtToken,
|
|
240
|
+
offlineUserId = _ref10.offlineUserId,
|
|
241
|
+
headers = _ref10.headers;
|
|
201
242
|
|
|
202
243
|
return client({
|
|
203
244
|
url: "/users/impersonate",
|
|
@@ -216,11 +257,11 @@ function usersFactory(_ref) {
|
|
|
216
257
|
* @param {Object} [opts.headers] - Optional headers
|
|
217
258
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
218
259
|
*/
|
|
219
|
-
function startMfa(
|
|
220
|
-
var token =
|
|
221
|
-
jwtToken =
|
|
222
|
-
userId =
|
|
223
|
-
headers =
|
|
260
|
+
function startMfa(_ref11) {
|
|
261
|
+
var token = _ref11.token,
|
|
262
|
+
jwtToken = _ref11.jwtToken,
|
|
263
|
+
userId = _ref11.userId,
|
|
264
|
+
headers = _ref11.headers;
|
|
224
265
|
|
|
225
266
|
return client({
|
|
226
267
|
url: "/users/" + userId + "/mfa",
|
|
@@ -239,12 +280,12 @@ function usersFactory(_ref) {
|
|
|
239
280
|
* @param {Object} [opts.headers] - Optional headers
|
|
240
281
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
241
282
|
*/
|
|
242
|
-
function confirmMfa(
|
|
243
|
-
var token =
|
|
244
|
-
jwtToken =
|
|
245
|
-
userId =
|
|
246
|
-
totpToken =
|
|
247
|
-
headers =
|
|
283
|
+
function confirmMfa(_ref12) {
|
|
284
|
+
var token = _ref12.token,
|
|
285
|
+
jwtToken = _ref12.jwtToken,
|
|
286
|
+
userId = _ref12.userId,
|
|
287
|
+
totpToken = _ref12.totpToken,
|
|
288
|
+
headers = _ref12.headers;
|
|
248
289
|
|
|
249
290
|
return client({
|
|
250
291
|
url: "/users/" + userId + "/mfa",
|
|
@@ -263,11 +304,11 @@ function usersFactory(_ref) {
|
|
|
263
304
|
* @param {Object} [opts.headers] - Optional headers
|
|
264
305
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
265
306
|
*/
|
|
266
|
-
function disableMfa(
|
|
267
|
-
var token =
|
|
268
|
-
jwtToken =
|
|
269
|
-
userId =
|
|
270
|
-
headers =
|
|
307
|
+
function disableMfa(_ref13) {
|
|
308
|
+
var token = _ref13.token,
|
|
309
|
+
jwtToken = _ref13.jwtToken,
|
|
310
|
+
userId = _ref13.userId,
|
|
311
|
+
headers = _ref13.headers;
|
|
271
312
|
|
|
272
313
|
return client({
|
|
273
314
|
url: "/users/" + userId + "/mfa",
|
|
@@ -287,12 +328,12 @@ function usersFactory(_ref) {
|
|
|
287
328
|
* @param {Object} [opts.headers] - Optional headers
|
|
288
329
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
289
330
|
*/
|
|
290
|
-
get: function get(
|
|
291
|
-
var token =
|
|
292
|
-
jwtToken =
|
|
293
|
-
userId =
|
|
294
|
-
sequenceId =
|
|
295
|
-
headers =
|
|
331
|
+
get: function get(_ref14) {
|
|
332
|
+
var token = _ref14.token,
|
|
333
|
+
jwtToken = _ref14.jwtToken,
|
|
334
|
+
userId = _ref14.userId,
|
|
335
|
+
sequenceId = _ref14.sequenceId,
|
|
336
|
+
headers = _ref14.headers;
|
|
296
337
|
|
|
297
338
|
return client({
|
|
298
339
|
url: "/users/" + userId + "/sequences/" + sequenceId,
|
|
@@ -310,13 +351,13 @@ function usersFactory(_ref) {
|
|
|
310
351
|
* @param {Object} [opts.headers] - Optional headers
|
|
311
352
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
312
353
|
*/
|
|
313
|
-
all: function all(
|
|
314
|
-
var token =
|
|
315
|
-
jwtToken =
|
|
316
|
-
userId =
|
|
317
|
-
|
|
318
|
-
query =
|
|
319
|
-
headers =
|
|
354
|
+
all: function all(_ref15) {
|
|
355
|
+
var token = _ref15.token,
|
|
356
|
+
jwtToken = _ref15.jwtToken,
|
|
357
|
+
userId = _ref15.userId,
|
|
358
|
+
_ref15$query = _ref15.query,
|
|
359
|
+
query = _ref15$query === undefined ? {} : _ref15$query,
|
|
360
|
+
headers = _ref15.headers;
|
|
320
361
|
|
|
321
362
|
return client({
|
|
322
363
|
url: "/users/" + userId + "/sequences",
|
|
@@ -335,12 +376,12 @@ function usersFactory(_ref) {
|
|
|
335
376
|
* @param {Object} [opts.headers] - Optional headers
|
|
336
377
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
337
378
|
*/
|
|
338
|
-
create: function create(
|
|
339
|
-
var jwtToken =
|
|
340
|
-
token =
|
|
341
|
-
userId =
|
|
342
|
-
sequence =
|
|
343
|
-
headers =
|
|
379
|
+
create: function create(_ref16) {
|
|
380
|
+
var jwtToken = _ref16.jwtToken,
|
|
381
|
+
token = _ref16.token,
|
|
382
|
+
userId = _ref16.userId,
|
|
383
|
+
sequence = _ref16.sequence,
|
|
384
|
+
headers = _ref16.headers;
|
|
344
385
|
|
|
345
386
|
return client({
|
|
346
387
|
url: "/users/" + userId + "/sequences",
|
|
@@ -361,13 +402,13 @@ function usersFactory(_ref) {
|
|
|
361
402
|
* @param {Object} [opts.headers] - Optional headers
|
|
362
403
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
363
404
|
*/
|
|
364
|
-
update: function update(
|
|
365
|
-
var jwtToken =
|
|
366
|
-
token =
|
|
367
|
-
userId =
|
|
368
|
-
sequenceId =
|
|
369
|
-
sequence =
|
|
370
|
-
headers =
|
|
405
|
+
update: function update(_ref17) {
|
|
406
|
+
var jwtToken = _ref17.jwtToken,
|
|
407
|
+
token = _ref17.token,
|
|
408
|
+
userId = _ref17.userId,
|
|
409
|
+
sequenceId = _ref17.sequenceId,
|
|
410
|
+
sequence = _ref17.sequence,
|
|
411
|
+
headers = _ref17.headers;
|
|
371
412
|
|
|
372
413
|
return client({
|
|
373
414
|
url: "/users/" + userId + "/sequences/" + sequenceId,
|
|
@@ -388,13 +429,13 @@ function usersFactory(_ref) {
|
|
|
388
429
|
* @param {Object} [opts.headers] - Optional headers
|
|
389
430
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
390
431
|
*/
|
|
391
|
-
transfer: function transfer(
|
|
392
|
-
var jwtToken =
|
|
393
|
-
token =
|
|
394
|
-
userId =
|
|
395
|
-
sequenceId =
|
|
396
|
-
newUserId =
|
|
397
|
-
headers =
|
|
432
|
+
transfer: function transfer(_ref18) {
|
|
433
|
+
var jwtToken = _ref18.jwtToken,
|
|
434
|
+
token = _ref18.token,
|
|
435
|
+
userId = _ref18.userId,
|
|
436
|
+
sequenceId = _ref18.sequenceId,
|
|
437
|
+
newUserId = _ref18.newUserId,
|
|
438
|
+
headers = _ref18.headers;
|
|
398
439
|
|
|
399
440
|
return client({
|
|
400
441
|
url: "/users/" + userId + "/sequences/" + sequenceId,
|
|
@@ -415,6 +456,7 @@ function usersFactory(_ref) {
|
|
|
415
456
|
create: create,
|
|
416
457
|
login: login,
|
|
417
458
|
update: update,
|
|
459
|
+
delete: deleteUser,
|
|
418
460
|
createOrUpdateMany: createOrUpdateMany,
|
|
419
461
|
impersonate: impersonate,
|
|
420
462
|
startMfa: startMfa,
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("./../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Query params for GET /verified-emails (btrz-api-accounts). See get-handler getSpec().
|
|
8
|
+
* @typedef {Object} VerifiedEmailsListQuery
|
|
9
|
+
* @property {number} [page] - Page number (1-based). Default 1.
|
|
10
|
+
* @property {number} [pageSize] - Page size. Default 20.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Factory for verified-emails API (btrz-api-accounts).
|
|
15
|
+
* @param {Object} deps
|
|
16
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
17
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
18
|
+
* @returns {{ all: function, get: function, create: function, update: function }}
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
function verifiedEmailsFactory(_ref) {
|
|
23
|
+
var client = _ref.client,
|
|
24
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* GET /verified-emails - list verified emails for the account (paginated).
|
|
28
|
+
* @param {Object} opts
|
|
29
|
+
* @param {string} [opts.token] - API key
|
|
30
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
31
|
+
* @param {VerifiedEmailsListQuery} [opts.query] - Query params (page, pageSize)
|
|
32
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
33
|
+
* @returns {Promise<import("axios").AxiosResponse<{ verifiedEmails: Array }>>}
|
|
34
|
+
* Errors: 401, 500
|
|
35
|
+
*/
|
|
36
|
+
function all(_ref2) {
|
|
37
|
+
var token = _ref2.token,
|
|
38
|
+
jwtToken = _ref2.jwtToken,
|
|
39
|
+
_ref2$query = _ref2.query,
|
|
40
|
+
query = _ref2$query === undefined ? {} : _ref2$query,
|
|
41
|
+
headers = _ref2.headers;
|
|
42
|
+
|
|
43
|
+
return client({
|
|
44
|
+
url: "/verified-emails",
|
|
45
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
46
|
+
params: query
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* GET /verified-emails/:email - get a verified email by email address.
|
|
52
|
+
* @param {Object} opts
|
|
53
|
+
* @param {string} [opts.token] - API key
|
|
54
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
55
|
+
* @param {string} opts.email - Email address (path parameter)
|
|
56
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
57
|
+
* @returns {Promise<import("axios").AxiosResponse<{ verifiedEmail: Object }>>}
|
|
58
|
+
* Errors: 400 (WRONG_DATA), 401, 404 (VERIFIED_EMAIL_NOT_FOUND), 500
|
|
59
|
+
*/
|
|
60
|
+
function get(_ref3) {
|
|
61
|
+
var token = _ref3.token,
|
|
62
|
+
jwtToken = _ref3.jwtToken,
|
|
63
|
+
email = _ref3.email,
|
|
64
|
+
headers = _ref3.headers;
|
|
65
|
+
|
|
66
|
+
return client({
|
|
67
|
+
url: "/verified-emails/" + encodeURIComponent(email),
|
|
68
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* POST /verified-emails - create a verified email. Emits webhook verifiedEmails.created.
|
|
74
|
+
* @param {Object} opts
|
|
75
|
+
* @param {string} [opts.token] - API key
|
|
76
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
77
|
+
* @param {Object} opts.data - Body: email (required), status (BLACKLISTED | BLOCKED | WHITELISTED), optional QEVResponse
|
|
78
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
79
|
+
* @returns {Promise<import("axios").AxiosResponse<{ verifiedEmail: Object }>>}
|
|
80
|
+
* Errors: 400 (WRONG_DATA, INVALID_STATUS), 401, 500
|
|
81
|
+
*/
|
|
82
|
+
function create(_ref4) {
|
|
83
|
+
var token = _ref4.token,
|
|
84
|
+
jwtToken = _ref4.jwtToken,
|
|
85
|
+
data = _ref4.data,
|
|
86
|
+
headers = _ref4.headers;
|
|
87
|
+
|
|
88
|
+
return client({
|
|
89
|
+
url: "/verified-emails",
|
|
90
|
+
method: "post",
|
|
91
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
92
|
+
data: data
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* PUT /verified-emails/:email - update a verified email. Emits webhook verifiedEmails.updated.
|
|
98
|
+
* @param {Object} opts
|
|
99
|
+
* @param {string} [opts.token] - API key
|
|
100
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
101
|
+
* @param {string} opts.email - Email address (path parameter)
|
|
102
|
+
* @param {Object} opts.data - Body: status (BLACKLISTED | BLOCKED | WHITELISTED), optional QEVResponse
|
|
103
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
104
|
+
* @returns {Promise<import("axios").AxiosResponse<{ verifiedEmail: Object }>>}
|
|
105
|
+
* Errors: 400 (INVALID_STATUS, VERIFIED_EMAIL_BLOCKED), 401, 404 (VERIFIED_EMAIL_NOT_FOUND), 500
|
|
106
|
+
*/
|
|
107
|
+
function update(_ref5) {
|
|
108
|
+
var token = _ref5.token,
|
|
109
|
+
jwtToken = _ref5.jwtToken,
|
|
110
|
+
email = _ref5.email,
|
|
111
|
+
data = _ref5.data,
|
|
112
|
+
headers = _ref5.headers;
|
|
113
|
+
|
|
114
|
+
return client({
|
|
115
|
+
url: "/verified-emails/" + encodeURIComponent(email),
|
|
116
|
+
method: "put",
|
|
117
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
118
|
+
data: data
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
all: all,
|
|
124
|
+
get: get,
|
|
125
|
+
create: create,
|
|
126
|
+
update: update
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
module.exports = verifiedEmailsFactory;
|
|
@@ -25,13 +25,14 @@ function websalesConfigFactory(_ref) {
|
|
|
25
25
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* GET /websales-config - get websales config (
|
|
28
|
+
* GET /websales-config - get websales config list (paginated). Query: domain, providerId.
|
|
29
29
|
* @param {Object} opts
|
|
30
30
|
* @param {string} [opts.token] - API key
|
|
31
31
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
32
32
|
* @param {WebsalesConfigListQuery} [opts.query] - Query params (domain, providerId)
|
|
33
33
|
* @param {Object} [opts.headers] - Optional headers
|
|
34
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
34
|
+
* @returns {Promise<import("axios").AxiosResponse<{ websalesConfig: Array, next?: string, previous?: string, count?: number }>>}
|
|
35
|
+
* Errors: 401, 500
|
|
35
36
|
*/
|
|
36
37
|
function get(_ref2) {
|
|
37
38
|
var token = _ref2.token,
|
|
@@ -48,14 +49,15 @@ function websalesConfigFactory(_ref) {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
|
-
* PUT /websales-config/:websalesConfigId - update websales config.
|
|
52
|
+
* PUT /websales-config/:websalesConfigId - update websales config. Emits webhook websalesConfig.updated.
|
|
52
53
|
* @param {Object} opts
|
|
53
54
|
* @param {string} [opts.token] - API key
|
|
54
55
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
55
56
|
* @param {string} opts.websalesConfigId - Websales config id (ObjectId)
|
|
56
|
-
* @param {Object} opts.websalesConfig - Config payload
|
|
57
|
+
* @param {Object} opts.websalesConfig - Config payload (WebsalesConfigPutData; SSO cannot be updated)
|
|
57
58
|
* @param {Object} [opts.headers] - Optional headers
|
|
58
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
59
|
+
* @returns {Promise<import("axios").AxiosResponse<{ websalesConfig: Object }>>}
|
|
60
|
+
* Errors: 400, 401, 404 (WEBSALESCONFIG_NOT_FOUND), 409, 500
|
|
59
61
|
*/
|
|
60
62
|
function update(_ref3) {
|
|
61
63
|
var token = _ref3.token,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Factory for Coltrane healthcheck API (btrz-api-coltrane) — liveness probe.
|
|
5
|
+
* @param {Object} deps
|
|
6
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
7
|
+
* @returns {{ get: function }}
|
|
8
|
+
*/
|
|
9
|
+
function healthcheckFactory(_ref) {
|
|
10
|
+
var client = _ref.client;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* GET /healthcheck — liveness probe. Returns 200 with empty body when the service is running. No authentication required.
|
|
14
|
+
* @param {Object} [opts]
|
|
15
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
16
|
+
* @returns {Promise<import("axios").AxiosResponse<{ data: {} }>>}
|
|
17
|
+
* @throws {import("axios").AxiosError} 500 Service unhealthy or shutting down
|
|
18
|
+
*/
|
|
19
|
+
function get() {
|
|
20
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
21
|
+
headers = _ref2.headers;
|
|
22
|
+
|
|
23
|
+
return client({
|
|
24
|
+
url: "/healthcheck",
|
|
25
|
+
method: "get",
|
|
26
|
+
headers: headers || {}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
get: get
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = healthcheckFactory;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable max-len */
|
|
4
|
+
/**
|
|
5
|
+
* Factory for Coltrane info API (btrz-api-coltrane) — service and dependency status.
|
|
6
|
+
* @param {Object} deps
|
|
7
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
8
|
+
* @returns {{ get: function }}
|
|
9
|
+
*/
|
|
10
|
+
function infoFactory(_ref) {
|
|
11
|
+
var client = _ref.client;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* GET /info — get Coltrane API service status and dependency health. No authentication required.
|
|
15
|
+
* @param {Object} [opts]
|
|
16
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
17
|
+
* @returns {Promise<import("axios").AxiosResponse<{ data: { status: number, services: Array<{ name: string, status: number }>, build?: string, instanceId?: string, commit?: string } }>>}
|
|
18
|
+
* @throws {import("axios").AxiosError} 500 Internal server error or dependency check failure
|
|
19
|
+
*/
|
|
20
|
+
function get() {
|
|
21
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
22
|
+
headers = _ref2.headers;
|
|
23
|
+
|
|
24
|
+
return client({
|
|
25
|
+
url: "/info",
|
|
26
|
+
headers: headers || {}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
get: get
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = infoFactory;
|
|
@@ -5,15 +5,16 @@ var _require = require("./../endpoints_helpers.js"),
|
|
|
5
5
|
authorizationHeaders = _require.authorizationHeaders;
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Query params for GET /paths (btrz-api-coltrane).
|
|
8
|
+
* Query params for GET /paths (btrz-api-coltrane). All except metrics and preferredAlgorithm are required by the API.
|
|
9
9
|
* @typedef {Object} ColtranePathsListQuery
|
|
10
|
-
* @property {string} [providerId] - Account ID of the travel provider (
|
|
11
|
-
* @property {string} [productId] - Product ID belonging to the provider (
|
|
12
|
-
* @property {string} [originId] - Origin station
|
|
13
|
-
* @property {string} [destinationId] - Destination station
|
|
14
|
-
* @property {string} [departureFromDate] - Start of
|
|
15
|
-
* @property {string} [departureToDate] - End of
|
|
16
|
-
* @property {string} [
|
|
10
|
+
* @property {string} [providerId] - Account ID of the travel provider (24-char hex)
|
|
11
|
+
* @property {string} [productId] - Product ID belonging to the provider (24-char hex)
|
|
12
|
+
* @property {string} [originId] - Origin station ID (24-char hex); must differ from destinationId
|
|
13
|
+
* @property {string} [destinationId] - Destination station ID (24-char hex)
|
|
14
|
+
* @property {string} [departureFromDate] - Start of departure interval; ISO 8601 (e.g. 2021-10-07T17:30:00.000-0400)
|
|
15
|
+
* @property {string} [departureToDate] - End of departure interval; ISO 8601; interval max 25h, must be after departureFromDate
|
|
16
|
+
* @property {string} [preferredAlgorithm] - "search_algorithm_fast" or "search_algorithm_exhaustive"
|
|
17
|
+
* @property {string|boolean} [metrics] - If true, response includes metrics object (debugging)
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -30,12 +31,15 @@ function coltraneFactory(_ref) {
|
|
|
30
31
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
|
-
* GET /paths
|
|
34
|
+
* GET /paths — search for travel paths between two stations in a departure time interval.
|
|
34
35
|
* @param {Object} opts
|
|
35
|
-
* @param {string} [opts.token] - API key
|
|
36
|
-
* @param {ColtranePathsListQuery} [opts.query] - Query params
|
|
37
|
-
* @param {Object} [opts.headers] - Optional headers
|
|
38
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
36
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
37
|
+
* @param {ColtranePathsListQuery} [opts.query] - Query params; providerId, productId, originId, destinationId, departureFromDate, departureToDate required
|
|
38
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
39
|
+
* @returns {Promise<import("axios").AxiosResponse<{ data: { paths: Array<{ segments: Array<{ scheduleId: string, manifestDay: string, fromLegIndex: number, toLegIndex: number }> }>, metrics?: object } }>>}
|
|
40
|
+
* @throws {import("axios").AxiosError} 400 INVALID_QUERY_PARAMETERS (invalid params, originId=destinationId, interval > 25h, or invalid preferredAlgorithm)
|
|
41
|
+
* @throws {import("axios").AxiosError} 401 Unauthorized
|
|
42
|
+
* @throws {import("axios").AxiosError} 500 Internal server error
|
|
39
43
|
*/
|
|
40
44
|
function all(_ref2) {
|
|
41
45
|
var token = _ref2.token,
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -160,6 +160,8 @@ function createColtrane({baseURL, headers, timeout, overrideFn, internalAuthToke
|
|
|
160
160
|
|
|
161
161
|
return {
|
|
162
162
|
docs: require("./endpoints/coltrane/docs.js")({client}),
|
|
163
|
+
healthcheck: require("./endpoints/coltrane/healthcheck.js")({client}),
|
|
164
|
+
info: require("./endpoints/coltrane/info.js")({client}),
|
|
163
165
|
paths: require("./endpoints/coltrane/paths.js")({client, internalAuthTokenProvider}),
|
|
164
166
|
mergedFareTables: require("./endpoints/coltrane/merged-fare-tables.js")({client, internalAuthTokenProvider}),
|
|
165
167
|
__test: {
|
|
@@ -178,6 +180,7 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
|
|
|
178
180
|
|
|
179
181
|
return {
|
|
180
182
|
accounts: require("./endpoints/accounts/accounts.js")({client, internalAuthTokenProvider}),
|
|
183
|
+
agencies: require("./endpoints/accounts/agencies.js")({client, internalAuthTokenProvider}),
|
|
181
184
|
application: require("./endpoints/accounts/application.js")({client, internalAuthTokenProvider}),
|
|
182
185
|
applications: require("./endpoints/accounts/applications.js")({client, internalAuthTokenProvider}),
|
|
183
186
|
applicationSettings: require("./endpoints/accounts/application-settings.js")({client, internalAuthTokenProvider}),
|
|
@@ -193,6 +196,7 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
|
|
|
193
196
|
smsTemplates: require("./endpoints/accounts/sms-templates.js")({client, internalAuthTokenProvider}),
|
|
194
197
|
exchangeRates: require("./endpoints/accounts/exchange-rates.js")({client, internalAuthTokenProvider}),
|
|
195
198
|
exchangeReceipts: require("./endpoints/accounts/exchange-receipts.js")({client, internalAuthTokenProvider}),
|
|
199
|
+
externalCustomers: require("./endpoints/accounts/external-customers.js")({client, internalAuthTokenProvider}),
|
|
196
200
|
goalSettings: require("./endpoints/accounts/goal-settings.js")({client, internalAuthTokenProvider}),
|
|
197
201
|
images: require("./endpoints/accounts/images.js")({client, internalAuthTokenProvider}),
|
|
198
202
|
interline: require("./endpoints/accounts/interline.js")({client, internalAuthTokenProvider}),
|
|
@@ -231,6 +235,7 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
|
|
|
231
235
|
trustedMachines: require("./endpoints/accounts/trusted-machines.js")({client, internalAuthTokenProvider}),
|
|
232
236
|
twilioSettings: require("./endpoints/accounts/twilio-settings.js")({client, internalAuthTokenProvider}),
|
|
233
237
|
users: require("./endpoints/accounts/users.js")({client, internalAuthTokenProvider}),
|
|
238
|
+
verifiedEmails: require("./endpoints/accounts/verified-emails.js")({client, internalAuthTokenProvider}),
|
|
234
239
|
__test: {
|
|
235
240
|
client
|
|
236
241
|
},
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
const {
|
|
3
|
+
authorizationHeaders
|
|
4
|
+
} = require("../endpoints_helpers.js");
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Factory for agencies endpoints (btrz-api-accounts).
|
|
8
|
+
* @param {Object} deps
|
|
9
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
10
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
11
|
+
* @returns {{ putCreditLimit: function }}
|
|
12
|
+
*/
|
|
13
|
+
function agenciesFactory({client, internalAuthTokenProvider}) {
|
|
14
|
+
/**
|
|
15
|
+
* PUT /agencies/:agencyId/credit-limit - update credit limit for an agency (seller) in the provider's network.
|
|
16
|
+
* Requires BETTEREZ_APP audience. Request body can be { limitAmount, unlimited } or { creditLimit: { limitAmount, unlimited } }.
|
|
17
|
+
* Side effect: Emits webhook event creditlimit.updated.
|
|
18
|
+
* @param {Object} opts
|
|
19
|
+
* @param {string} [opts.token] - API key
|
|
20
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
21
|
+
* @param {string} opts.agencyId - Agency (seller) ID, 24-char hex ObjectId. Must not be the provider's own accountId.
|
|
22
|
+
* @param {Object} opts.data - Credit limit payload: { limitAmount: number, unlimited: boolean } or { creditLimit: { limitAmount, unlimited } }
|
|
23
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
24
|
+
* @returns {Promise<import("axios").AxiosResponse<{ creditLimit: { _id: string, sellerId: string, providerId: string, unlimited: boolean, overrideLimit: number, currentLimit: number } }>>}
|
|
25
|
+
*/
|
|
26
|
+
function putCreditLimit({token, jwtToken, agencyId, data, headers}) {
|
|
27
|
+
return client({
|
|
28
|
+
url: `/agencies/${agencyId}/credit-limit`,
|
|
29
|
+
method: "put",
|
|
30
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
31
|
+
data
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
putCreditLimit
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = agenciesFactory;
|