btrz-api-client 9.14.0 → 9.16.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 +8 -8
- package/lib/client.js +8 -0
- package/lib/endpoints/accounts/email-template-settings.js +74 -0
- package/lib/endpoints/accounts/sms-template-settings.js +74 -0
- package/lib/endpoints/inventory/segments-information-tables.js +2 -2
- package/lib/endpoints/notifications/notify.js +2 -2
- package/lib/endpoints/operations/manifest.js +97 -21
- package/package.json +1 -1
- package/src/client.js +2 -0
- package/src/endpoints/accounts/email-template-settings.js +54 -0
- package/src/endpoints/accounts/sms-template-settings.js +54 -0
- package/src/endpoints/inventory/segments-information-tables.js +2 -2
- package/src/endpoints/notifications/notify.js +2 -2
- package/src/endpoints/operations/manifest.js +88 -31
- package/test/endpoints/operations/manifest.test.js +35 -0
- package/types/endpoints/inventory/segments-information-tables.d.ts +2 -2
package/lib/client.js
CHANGED
|
@@ -544,6 +544,14 @@ function createAccounts({
|
|
|
544
544
|
client,
|
|
545
545
|
internalAuthTokenProvider
|
|
546
546
|
}),
|
|
547
|
+
emailTemplateSettings: require("./endpoints/accounts/email-template-settings.js")({
|
|
548
|
+
client,
|
|
549
|
+
internalAuthTokenProvider
|
|
550
|
+
}),
|
|
551
|
+
smsTemplateSettings: require("./endpoints/accounts/sms-template-settings.js")({
|
|
552
|
+
client,
|
|
553
|
+
internalAuthTokenProvider
|
|
554
|
+
}),
|
|
547
555
|
emailTemplates: require("./endpoints/accounts/email-templates.js")({
|
|
548
556
|
client,
|
|
549
557
|
internalAuthTokenProvider
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("./../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Factory for email-template-settings API (btrz-api-accounts).
|
|
7
|
+
* @param {Object} deps
|
|
8
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
9
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
10
|
+
* @returns {{ get: function, update: function }}
|
|
11
|
+
*/
|
|
12
|
+
function emailTemplateSettingsFactory({
|
|
13
|
+
client,
|
|
14
|
+
internalAuthTokenProvider
|
|
15
|
+
}) {
|
|
16
|
+
/**
|
|
17
|
+
* GET /email-template-settings – email template flow preference for the account.
|
|
18
|
+
* @param {Object} opts
|
|
19
|
+
* @param {string} [opts.token] - API key
|
|
20
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
21
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
22
|
+
* @returns {Promise<import("axios").AxiosResponse<{ emailTemplateSettings: { useEmailTemplates: boolean } }>>}
|
|
23
|
+
*/
|
|
24
|
+
function get({
|
|
25
|
+
token,
|
|
26
|
+
jwtToken,
|
|
27
|
+
headers
|
|
28
|
+
}) {
|
|
29
|
+
return client({
|
|
30
|
+
url: "/email-template-settings",
|
|
31
|
+
headers: authorizationHeaders({
|
|
32
|
+
token,
|
|
33
|
+
jwtToken,
|
|
34
|
+
internalAuthTokenProvider,
|
|
35
|
+
headers
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* PUT /email-template-settings – update email template flow preference.
|
|
42
|
+
* @param {Object} opts
|
|
43
|
+
* @param {string} [opts.token] - API key
|
|
44
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
45
|
+
* @param {Object} opts.emailTemplateSettings - Payload with useEmailTemplates
|
|
46
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
47
|
+
* @returns {Promise<import("axios").AxiosResponse<{ emailTemplateSettings: { useEmailTemplates: boolean } }>>}
|
|
48
|
+
*/
|
|
49
|
+
function update({
|
|
50
|
+
token,
|
|
51
|
+
jwtToken,
|
|
52
|
+
emailTemplateSettings,
|
|
53
|
+
headers
|
|
54
|
+
}) {
|
|
55
|
+
return client({
|
|
56
|
+
url: "/email-template-settings",
|
|
57
|
+
method: "put",
|
|
58
|
+
headers: authorizationHeaders({
|
|
59
|
+
token,
|
|
60
|
+
jwtToken,
|
|
61
|
+
internalAuthTokenProvider,
|
|
62
|
+
headers
|
|
63
|
+
}),
|
|
64
|
+
data: {
|
|
65
|
+
emailTemplateSettings
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
get,
|
|
71
|
+
update
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
module.exports = emailTemplateSettingsFactory;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("./../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Factory for sms-template-settings API (btrz-api-accounts).
|
|
7
|
+
* @param {Object} deps
|
|
8
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
9
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
10
|
+
* @returns {{ get: function, update: function }}
|
|
11
|
+
*/
|
|
12
|
+
function smsTemplateSettingsFactory({
|
|
13
|
+
client,
|
|
14
|
+
internalAuthTokenProvider
|
|
15
|
+
}) {
|
|
16
|
+
/**
|
|
17
|
+
* GET /sms-template-settings – SMS template flow preference for the account.
|
|
18
|
+
* @param {Object} opts
|
|
19
|
+
* @param {string} [opts.token] - API key
|
|
20
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
21
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
22
|
+
* @returns {Promise<import("axios").AxiosResponse<{ smsTemplateSettings: { useSmsTemplates: boolean } }>>}
|
|
23
|
+
*/
|
|
24
|
+
function get({
|
|
25
|
+
token,
|
|
26
|
+
jwtToken,
|
|
27
|
+
headers
|
|
28
|
+
}) {
|
|
29
|
+
return client({
|
|
30
|
+
url: "/sms-template-settings",
|
|
31
|
+
headers: authorizationHeaders({
|
|
32
|
+
token,
|
|
33
|
+
jwtToken,
|
|
34
|
+
internalAuthTokenProvider,
|
|
35
|
+
headers
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* PUT /sms-template-settings – update SMS template flow preference.
|
|
42
|
+
* @param {Object} opts
|
|
43
|
+
* @param {string} [opts.token] - API key
|
|
44
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
45
|
+
* @param {Object} opts.smsTemplateSettings - Payload with useSmsTemplates
|
|
46
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
47
|
+
* @returns {Promise<import("axios").AxiosResponse<{ smsTemplateSettings: { useSmsTemplates: boolean } }>>}
|
|
48
|
+
*/
|
|
49
|
+
function update({
|
|
50
|
+
token,
|
|
51
|
+
jwtToken,
|
|
52
|
+
smsTemplateSettings,
|
|
53
|
+
headers
|
|
54
|
+
}) {
|
|
55
|
+
return client({
|
|
56
|
+
url: "/sms-template-settings",
|
|
57
|
+
method: "put",
|
|
58
|
+
headers: authorizationHeaders({
|
|
59
|
+
token,
|
|
60
|
+
jwtToken,
|
|
61
|
+
internalAuthTokenProvider,
|
|
62
|
+
headers
|
|
63
|
+
}),
|
|
64
|
+
data: {
|
|
65
|
+
smsTemplateSettings
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
get,
|
|
71
|
+
update
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
module.exports = smsTemplateSettingsFactory;
|
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
/**
|
|
7
7
|
* Query params for GET /segments-information-tables/:routeId (btrz-api-inventory-trips). See get-by-id-handler getSpec().
|
|
8
8
|
* @typedef {Object} SegmentsInformationTablesQuery
|
|
9
|
-
* @property {string} [providerId] - Provider
|
|
9
|
+
* @property {string} [providerId] - Provider account ID when route belongs to a provider in the requester's network
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -26,7 +26,7 @@ function segmentInformationTableFactory({
|
|
|
26
26
|
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
27
27
|
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
28
28
|
* @param {string} opts.routeId - Route id (24-char hex ObjectId)
|
|
29
|
-
* @param {SegmentsInformationTablesQuery} [opts.query] - Optional providerId
|
|
29
|
+
* @param {SegmentsInformationTablesQuery} [opts.query] - Optional query params (providerId)
|
|
30
30
|
* @param {Object} [opts.headers] - Optional headers
|
|
31
31
|
* @returns {Promise<import("axios").AxiosResponse<{ segmentInformationTables: { distances: Object, durations: Object, durationsHHMM: Object } }>>}
|
|
32
32
|
* @throws 400 INVALID_ROUTE_ID — routeId not 24 hex characters
|
|
@@ -6,12 +6,12 @@ const {
|
|
|
6
6
|
/**
|
|
7
7
|
* Request body for POST /notify/email (btrz-api-notifications). See post-notify-email-handler getSpec() and NotifyEmailPostData.
|
|
8
8
|
* @typedef {Object} NotifyEmailByTypePostData
|
|
9
|
-
* @property {string} type - Document/
|
|
9
|
+
* @property {string} type - Document/PDF type (e.g. order, voucher, movement, cancellation)
|
|
10
10
|
* @property {string} itemId - ObjectId of the item (24-char hex)
|
|
11
11
|
* @property {string} [to] - Recipient email (optional; derived from item when omitted)
|
|
12
12
|
* @property {string} [lang] - ISO language code (e.g. en-us)
|
|
13
13
|
* @property {string} [channel] - Channel filter for template selection
|
|
14
|
-
* @property {string} [family] -
|
|
14
|
+
* @property {string} [family] - When type is product or movement: ticket, reservation, parcel, etc.
|
|
15
15
|
* @property {string} [humanDate] - "mm" | "dd"
|
|
16
16
|
*/
|
|
17
17
|
|
|
@@ -3,7 +3,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
3
3
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
/* eslint-disable max-len */
|
|
7
6
|
const {
|
|
8
7
|
authorizationHeaders
|
|
9
8
|
} = require("./../endpoints_helpers.js");
|
|
@@ -80,6 +79,25 @@ const {
|
|
|
80
79
|
* @property {boolean} [bypassValidations] - If true, bypass driver validations
|
|
81
80
|
*/
|
|
82
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Query params for GET /manifests/item-capacity-over-limit (btrz-api-operations).
|
|
84
|
+
* @typedef {Object} ItemCapacityOverLimitQuery
|
|
85
|
+
* @property {string} itemId - Catalog item id (sourceItemId)
|
|
86
|
+
* @property {number|string} limit - Proposed Manifest Item Capacity Limit (>= 1)
|
|
87
|
+
* @property {number|string} [page] - Page number (>= 1)
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Query params for GET /manifests/item-capacity-used (btrz-api-operations).
|
|
92
|
+
* @typedef {Object} ItemCapacityUsedQuery
|
|
93
|
+
* @property {string} routeId - Route id
|
|
94
|
+
* @property {string} scheduleId - Schedule id (manifest schedule key)
|
|
95
|
+
* @property {string} date - Travel date yyyy-mm-dd
|
|
96
|
+
* @property {string} fromId - Origin station id
|
|
97
|
+
* @property {string} toId - Destination station id
|
|
98
|
+
* @property {string} [itemIds] - Optional comma-separated catalog item ids
|
|
99
|
+
*/
|
|
100
|
+
|
|
83
101
|
/**
|
|
84
102
|
* Factory for manifests API (btrz-api-operations).
|
|
85
103
|
* @param {Object} deps
|
|
@@ -209,6 +227,62 @@ function manifestFactory({
|
|
|
209
227
|
});
|
|
210
228
|
}
|
|
211
229
|
|
|
230
|
+
/**
|
|
231
|
+
* GET /manifests/item-capacity-over-limit - future manifests over a proposed item capacity limit.
|
|
232
|
+
* @param {Object} opts
|
|
233
|
+
* @param {string} [opts.token] - API key
|
|
234
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
235
|
+
* @param {ItemCapacityOverLimitQuery} opts.query - itemId, limit, optional page
|
|
236
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
237
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
238
|
+
*/
|
|
239
|
+
function itemCapacityOverLimit({
|
|
240
|
+
token,
|
|
241
|
+
jwtToken,
|
|
242
|
+
query = {},
|
|
243
|
+
headers
|
|
244
|
+
}) {
|
|
245
|
+
return client({
|
|
246
|
+
url: "/manifests/item-capacity-over-limit",
|
|
247
|
+
method: "get",
|
|
248
|
+
params: query,
|
|
249
|
+
headers: authorizationHeaders({
|
|
250
|
+
token,
|
|
251
|
+
jwtToken,
|
|
252
|
+
internalAuthTokenProvider,
|
|
253
|
+
headers
|
|
254
|
+
})
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* GET /manifests/item-capacity-used - path max qty used per attach-to-ticket item.
|
|
260
|
+
* @param {Object} opts
|
|
261
|
+
* @param {string} [opts.token] - API key
|
|
262
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
263
|
+
* @param {ItemCapacityUsedQuery} opts.query - routeId, scheduleId, date, fromId, toId, optional itemIds
|
|
264
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
265
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
266
|
+
*/
|
|
267
|
+
function itemCapacityUsed({
|
|
268
|
+
token,
|
|
269
|
+
jwtToken,
|
|
270
|
+
query = {},
|
|
271
|
+
headers
|
|
272
|
+
}) {
|
|
273
|
+
return client({
|
|
274
|
+
url: "/manifests/item-capacity-used",
|
|
275
|
+
method: "get",
|
|
276
|
+
params: query,
|
|
277
|
+
headers: authorizationHeaders({
|
|
278
|
+
token,
|
|
279
|
+
jwtToken,
|
|
280
|
+
internalAuthTokenProvider,
|
|
281
|
+
headers
|
|
282
|
+
})
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
212
286
|
/**
|
|
213
287
|
* GET /manifests/:manifestId - get manifest by id. API does not accept query params.
|
|
214
288
|
* @param {Object} opts
|
|
@@ -1030,16 +1104,16 @@ function manifestFactory({
|
|
|
1030
1104
|
};
|
|
1031
1105
|
|
|
1032
1106
|
/**
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1107
|
+
* POST manifests/:manifestId/boarding/:stationId - board passengers at station.
|
|
1108
|
+
* @param {Object} opts
|
|
1109
|
+
* @param {string} [opts.token] - API key
|
|
1110
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
1111
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
1112
|
+
* @param {string} opts.manifestId - Manifest id
|
|
1113
|
+
* @param {string} opts.stationId - Station id
|
|
1114
|
+
* @param {Object} opts.data - Request body
|
|
1115
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
1116
|
+
*/
|
|
1043
1117
|
function stationBoarding({
|
|
1044
1118
|
token,
|
|
1045
1119
|
jwtToken,
|
|
@@ -1098,16 +1172,16 @@ function manifestFactory({
|
|
|
1098
1172
|
}
|
|
1099
1173
|
|
|
1100
1174
|
/**
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1175
|
+
* POST manifests/:manifestId/sales-closure/:stationId - close sales at station.
|
|
1176
|
+
* @param {Object} opts
|
|
1177
|
+
* @param {string} [opts.token] - API key
|
|
1178
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
1179
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
1180
|
+
* @param {string} opts.manifestId - Manifest id
|
|
1181
|
+
* @param {string} opts.stationId - Station id
|
|
1182
|
+
* @param {Object} opts.data - Request body
|
|
1183
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
1184
|
+
*/
|
|
1111
1185
|
function stationSalesClosure({
|
|
1112
1186
|
token,
|
|
1113
1187
|
jwtToken,
|
|
@@ -1134,6 +1208,8 @@ function manifestFactory({
|
|
|
1134
1208
|
get,
|
|
1135
1209
|
getAll,
|
|
1136
1210
|
getById,
|
|
1211
|
+
itemCapacityOverLimit,
|
|
1212
|
+
itemCapacityUsed,
|
|
1137
1213
|
outlook,
|
|
1138
1214
|
patch,
|
|
1139
1215
|
save,
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -202,6 +202,8 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
|
|
|
202
202
|
dynamicForms: require("./endpoints/accounts/dynamic-forms.js")({client, internalAuthTokenProvider}),
|
|
203
203
|
qrMappings: require("./endpoints/accounts/qr-mappings.js")({client, internalAuthTokenProvider}),
|
|
204
204
|
emailSettings: require("./endpoints/accounts/email-settings.js")({client, internalAuthTokenProvider}),
|
|
205
|
+
emailTemplateSettings: require("./endpoints/accounts/email-template-settings.js")({client, internalAuthTokenProvider}),
|
|
206
|
+
smsTemplateSettings: require("./endpoints/accounts/sms-template-settings.js")({client, internalAuthTokenProvider}),
|
|
205
207
|
emailTemplates: require("./endpoints/accounts/email-templates.js")({client, internalAuthTokenProvider}),
|
|
206
208
|
smsTemplates: require("./endpoints/accounts/sms-templates.js")({client, internalAuthTokenProvider}),
|
|
207
209
|
exchangeRates: require("./endpoints/accounts/exchange-rates.js")({client, internalAuthTokenProvider}),
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("./../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Factory for email-template-settings API (btrz-api-accounts).
|
|
7
|
+
* @param {Object} deps
|
|
8
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
9
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
10
|
+
* @returns {{ get: function, update: function }}
|
|
11
|
+
*/
|
|
12
|
+
function emailTemplateSettingsFactory({client, internalAuthTokenProvider}) {
|
|
13
|
+
/**
|
|
14
|
+
* GET /email-template-settings – email template flow preference for the account.
|
|
15
|
+
* @param {Object} opts
|
|
16
|
+
* @param {string} [opts.token] - API key
|
|
17
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
18
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
+
* @returns {Promise<import("axios").AxiosResponse<{ emailTemplateSettings: { useEmailTemplates: boolean } }>>}
|
|
20
|
+
*/
|
|
21
|
+
function get({token, jwtToken, headers}) {
|
|
22
|
+
return client({
|
|
23
|
+
url: "/email-template-settings",
|
|
24
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* PUT /email-template-settings – update email template flow preference.
|
|
30
|
+
* @param {Object} opts
|
|
31
|
+
* @param {string} [opts.token] - API key
|
|
32
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
33
|
+
* @param {Object} opts.emailTemplateSettings - Payload with useEmailTemplates
|
|
34
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
35
|
+
* @returns {Promise<import("axios").AxiosResponse<{ emailTemplateSettings: { useEmailTemplates: boolean } }>>}
|
|
36
|
+
*/
|
|
37
|
+
function update({token, jwtToken, emailTemplateSettings, headers}) {
|
|
38
|
+
return client({
|
|
39
|
+
url: "/email-template-settings",
|
|
40
|
+
method: "put",
|
|
41
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
42
|
+
data: {
|
|
43
|
+
emailTemplateSettings
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
get,
|
|
50
|
+
update
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = emailTemplateSettingsFactory;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("./../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Factory for sms-template-settings API (btrz-api-accounts).
|
|
7
|
+
* @param {Object} deps
|
|
8
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
9
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
10
|
+
* @returns {{ get: function, update: function }}
|
|
11
|
+
*/
|
|
12
|
+
function smsTemplateSettingsFactory({client, internalAuthTokenProvider}) {
|
|
13
|
+
/**
|
|
14
|
+
* GET /sms-template-settings – SMS template flow preference for the account.
|
|
15
|
+
* @param {Object} opts
|
|
16
|
+
* @param {string} [opts.token] - API key
|
|
17
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
18
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
+
* @returns {Promise<import("axios").AxiosResponse<{ smsTemplateSettings: { useSmsTemplates: boolean } }>>}
|
|
20
|
+
*/
|
|
21
|
+
function get({token, jwtToken, headers}) {
|
|
22
|
+
return client({
|
|
23
|
+
url: "/sms-template-settings",
|
|
24
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* PUT /sms-template-settings – update SMS template flow preference.
|
|
30
|
+
* @param {Object} opts
|
|
31
|
+
* @param {string} [opts.token] - API key
|
|
32
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
33
|
+
* @param {Object} opts.smsTemplateSettings - Payload with useSmsTemplates
|
|
34
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
35
|
+
* @returns {Promise<import("axios").AxiosResponse<{ smsTemplateSettings: { useSmsTemplates: boolean } }>>}
|
|
36
|
+
*/
|
|
37
|
+
function update({token, jwtToken, smsTemplateSettings, headers}) {
|
|
38
|
+
return client({
|
|
39
|
+
url: "/sms-template-settings",
|
|
40
|
+
method: "put",
|
|
41
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
42
|
+
data: {
|
|
43
|
+
smsTemplateSettings
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
get,
|
|
50
|
+
update
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = smsTemplateSettingsFactory;
|
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
/**
|
|
7
7
|
* Query params for GET /segments-information-tables/:routeId (btrz-api-inventory-trips). See get-by-id-handler getSpec().
|
|
8
8
|
* @typedef {Object} SegmentsInformationTablesQuery
|
|
9
|
-
* @property {string} [providerId] - Provider
|
|
9
|
+
* @property {string} [providerId] - Provider account ID when route belongs to a provider in the requester's network
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -23,7 +23,7 @@ function segmentInformationTableFactory({client, internalAuthTokenProvider}) {
|
|
|
23
23
|
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
24
24
|
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
25
25
|
* @param {string} opts.routeId - Route id (24-char hex ObjectId)
|
|
26
|
-
* @param {SegmentsInformationTablesQuery} [opts.query] - Optional providerId
|
|
26
|
+
* @param {SegmentsInformationTablesQuery} [opts.query] - Optional query params (providerId)
|
|
27
27
|
* @param {Object} [opts.headers] - Optional headers
|
|
28
28
|
* @returns {Promise<import("axios").AxiosResponse<{ segmentInformationTables: { distances: Object, durations: Object, durationsHHMM: Object } }>>}
|
|
29
29
|
* @throws 400 INVALID_ROUTE_ID — routeId not 24 hex characters
|
|
@@ -6,12 +6,12 @@ const {
|
|
|
6
6
|
/**
|
|
7
7
|
* Request body for POST /notify/email (btrz-api-notifications). See post-notify-email-handler getSpec() and NotifyEmailPostData.
|
|
8
8
|
* @typedef {Object} NotifyEmailByTypePostData
|
|
9
|
-
* @property {string} type - Document/
|
|
9
|
+
* @property {string} type - Document/PDF type (e.g. order, voucher, movement, cancellation)
|
|
10
10
|
* @property {string} itemId - ObjectId of the item (24-char hex)
|
|
11
11
|
* @property {string} [to] - Recipient email (optional; derived from item when omitted)
|
|
12
12
|
* @property {string} [lang] - ISO language code (e.g. en-us)
|
|
13
13
|
* @property {string} [channel] - Channel filter for template selection
|
|
14
|
-
* @property {string} [family] -
|
|
14
|
+
* @property {string} [family] - When type is product or movement: ticket, reservation, parcel, etc.
|
|
15
15
|
* @property {string} [humanDate] - "mm" | "dd"
|
|
16
16
|
*/
|
|
17
17
|
|