btrz-api-client 8.31.0 → 8.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/.cursor/rules/jsdoc-endpoints.mdc +1 -1
- package/lib/client-standalone-min.js +3 -3
- package/lib/client.js +3 -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/package.json +1 -1
- package/src/client.js +3 -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/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/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,
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -178,6 +178,7 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
|
|
|
178
178
|
|
|
179
179
|
return {
|
|
180
180
|
accounts: require("./endpoints/accounts/accounts.js")({client, internalAuthTokenProvider}),
|
|
181
|
+
agencies: require("./endpoints/accounts/agencies.js")({client, internalAuthTokenProvider}),
|
|
181
182
|
application: require("./endpoints/accounts/application.js")({client, internalAuthTokenProvider}),
|
|
182
183
|
applications: require("./endpoints/accounts/applications.js")({client, internalAuthTokenProvider}),
|
|
183
184
|
applicationSettings: require("./endpoints/accounts/application-settings.js")({client, internalAuthTokenProvider}),
|
|
@@ -193,6 +194,7 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
|
|
|
193
194
|
smsTemplates: require("./endpoints/accounts/sms-templates.js")({client, internalAuthTokenProvider}),
|
|
194
195
|
exchangeRates: require("./endpoints/accounts/exchange-rates.js")({client, internalAuthTokenProvider}),
|
|
195
196
|
exchangeReceipts: require("./endpoints/accounts/exchange-receipts.js")({client, internalAuthTokenProvider}),
|
|
197
|
+
externalCustomers: require("./endpoints/accounts/external-customers.js")({client, internalAuthTokenProvider}),
|
|
196
198
|
goalSettings: require("./endpoints/accounts/goal-settings.js")({client, internalAuthTokenProvider}),
|
|
197
199
|
images: require("./endpoints/accounts/images.js")({client, internalAuthTokenProvider}),
|
|
198
200
|
interline: require("./endpoints/accounts/interline.js")({client, internalAuthTokenProvider}),
|
|
@@ -231,6 +233,7 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
|
|
|
231
233
|
trustedMachines: require("./endpoints/accounts/trusted-machines.js")({client, internalAuthTokenProvider}),
|
|
232
234
|
twilioSettings: require("./endpoints/accounts/twilio-settings.js")({client, internalAuthTokenProvider}),
|
|
233
235
|
users: require("./endpoints/accounts/users.js")({client, internalAuthTokenProvider}),
|
|
236
|
+
verifiedEmails: require("./endpoints/accounts/verified-emails.js")({client, internalAuthTokenProvider}),
|
|
234
237
|
__test: {
|
|
235
238
|
client
|
|
236
239
|
},
|
|
@@ -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;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @typedef {Object} ApplicationSettingsQuery
|
|
5
|
-
* @property {string} [name] -
|
|
6
|
+
* @property {string} [name] - Optional. Filter by application name. When set, unauthenticated returns one object or 404; authenticated returns array with at most one item.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -14,14 +15,14 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
14
15
|
*/
|
|
15
16
|
function applicationSettingsFactory({client, internalAuthTokenProvider}) {
|
|
16
17
|
/**
|
|
17
|
-
* GET /application-settings/:providerId - get application settings for provider.
|
|
18
|
+
* GET /application-settings/:providerId - get application settings for a provider (account). Auth is optional: without auth returns one public object { key, settings, requestEndpoint }; with valid token returns array of application documents (see API docs for privateKey handling for internal apps).
|
|
18
19
|
* @param {Object} opts
|
|
19
20
|
* @param {string} [opts.token] - API key
|
|
20
21
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
21
|
-
* @param {string} opts.providerId -
|
|
22
|
-
* @param {ApplicationSettingsQuery} [opts.query] -
|
|
22
|
+
* @param {string} opts.providerId - Account (provider) ID whose application settings to return
|
|
23
|
+
* @param {ApplicationSettingsQuery} [opts.query] - Optional query; use name to filter by application name
|
|
23
24
|
* @param {Object} [opts.headers] - Optional headers
|
|
24
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
25
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: unauthenticated = { key, settings, requestEndpoint }; authenticated = array of application objects (see API docs)
|
|
25
26
|
*/
|
|
26
27
|
function get({token, providerId, jwtToken, query = {}, headers}) {
|
|
27
28
|
return client.get(`/application-settings/${providerId}`, {
|
|
@@ -31,14 +32,14 @@ function applicationSettingsFactory({client, internalAuthTokenProvider}) {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
|
-
* PUT /application-settings/:id - update application settings.
|
|
35
|
+
* PUT /application-settings/:id - update an application. Body can be { application: { name, description?, settings?, requestEndpoint?, enableUserSignOn?, channels?, roles? } } or direct. Emits webhook applications.updated.
|
|
35
36
|
* @param {Object} opts
|
|
36
37
|
* @param {string} [opts.token] - API key
|
|
37
38
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
38
|
-
* @param {string} opts.id - Application
|
|
39
|
-
* @param {Object} opts.application - Application payload
|
|
39
|
+
* @param {string} opts.id - Application id (24-char hex ObjectId)
|
|
40
|
+
* @param {Object} opts.application - Application payload (name required; optional description, settings, requestEndpoint, enableUserSignOn, channels, roles)
|
|
40
41
|
* @param {Object} [opts.headers] - Optional headers
|
|
41
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
42
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: { application }
|
|
42
43
|
*/
|
|
43
44
|
function update({jwtToken, token, id, application, headers}) {
|
|
44
45
|
return client({
|
|
@@ -50,13 +51,13 @@ function applicationSettingsFactory({client, internalAuthTokenProvider}) {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
|
-
* DELETE /application-settings/:id -
|
|
54
|
+
* DELETE /application-settings/:id - soft-delete an application. Emits webhook applications.deleted.
|
|
54
55
|
* @param {Object} opts
|
|
55
56
|
* @param {string} [opts.token] - API key
|
|
56
57
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
57
|
-
* @param {string} opts.id - Application
|
|
58
|
+
* @param {string} opts.id - Application id (24-char hex ObjectId)
|
|
58
59
|
* @param {Object} [opts.headers] - Optional headers
|
|
59
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
60
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: { id } (deleted application id)
|
|
60
61
|
*/
|
|
61
62
|
function remove({jwtToken, token, id, headers}) {
|
|
62
63
|
return client({
|
|
@@ -67,13 +68,13 @@ function applicationSettingsFactory({client, internalAuthTokenProvider}) {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
/**
|
|
70
|
-
* POST /application-settings/:id/keys - regenerate application keys.
|
|
71
|
+
* POST /application-settings/:id/keys - regenerate application keys; returns new key and privateKey. Emits webhook applications.updated.
|
|
71
72
|
* @param {Object} opts
|
|
72
73
|
* @param {string} [opts.token] - API key
|
|
73
74
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
74
|
-
* @param {string} opts.id - Application
|
|
75
|
+
* @param {string} opts.id - Application id (24-char hex ObjectId)
|
|
75
76
|
* @param {Object} [opts.headers] - Optional headers
|
|
76
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
77
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: { keys: { key, privateKey } }
|
|
77
78
|
*/
|
|
78
79
|
function regenerateKeys({jwtToken, token, id, headers}) {
|
|
79
80
|
return client({
|
|
@@ -84,13 +85,13 @@ function applicationSettingsFactory({client, internalAuthTokenProvider}) {
|
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
/**
|
|
87
|
-
* POST /application-settings - create application settings.
|
|
88
|
+
* POST /application-settings - create an application. Body can be { application: { name, description?, settings?, requestEndpoint?, enableUserSignOn?, channels?, roles? } } or direct. Emits webhook applications.created.
|
|
88
89
|
* @param {Object} opts
|
|
89
90
|
* @param {string} [opts.token] - API key
|
|
90
91
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
91
|
-
* @param {Object} opts.application - Application payload
|
|
92
|
+
* @param {Object} opts.application - Application payload (name required; optional description, settings, requestEndpoint, enableUserSignOn, channels, roles)
|
|
92
93
|
* @param {Object} [opts.headers] - Optional headers
|
|
93
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
94
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: { application }
|
|
94
95
|
*/
|
|
95
96
|
function create({jwtToken, token, application, headers}) {
|
|
96
97
|
return client({
|