btrz-api-client 9.8.0 → 9.9.1
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 +4 -4
- package/lib/endpoints/accounts/market-pricing-settings.js +4 -3
- package/lib/endpoints/notifications/manifest-notifications.js +24 -3
- package/lib/endpoints/notifications/notify.js +27 -0
- package/package.json +1 -1
- package/src/endpoints/accounts/market-pricing-settings.js +4 -3
- package/src/endpoints/notifications/manifest-notifications.js +24 -3
- package/src/endpoints/notifications/notify.js +17 -0
- package/test/endpoints/notifications/notify.test.js +17 -0
- package/types/endpoints/notifications/notify.d.ts +1 -0
|
@@ -20,7 +20,7 @@ function marketPricingSettingsFactory({
|
|
|
20
20
|
* @param {string} [opts.token] - API key
|
|
21
21
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
22
22
|
* @param {Object} [opts.headers] - Optional headers
|
|
23
|
-
* @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: { useOnlySpecificFareTable: boolean,
|
|
23
|
+
* @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: { useOnlySpecificFareTable: boolean, allowEachTripSegmentToBePricedIndividually: boolean } }>>}
|
|
24
24
|
*/
|
|
25
25
|
function get({
|
|
26
26
|
token,
|
|
@@ -39,11 +39,12 @@ function marketPricingSettingsFactory({
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* PUT /market-pricing-settings – Update market pricing settings. Body: MarketPricingSettings at root (useOnlySpecificFareTable
|
|
42
|
+
* PUT /market-pricing-settings – Update market pricing settings. Body: MarketPricingSettings at root (useOnlySpecificFareTable required).
|
|
43
|
+
* Optional: allowEachTripSegmentToBePricedIndividually.
|
|
43
44
|
* @param {Object} opts
|
|
44
45
|
* @param {string} [opts.token] - API key
|
|
45
46
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
46
|
-
* @param {Object} opts.marketPricingSettings - { useOnlySpecificFareTable: boolean,
|
|
47
|
+
* @param {Object} opts.marketPricingSettings - { useOnlySpecificFareTable: boolean, allowEachTripSegmentToBePricedIndividually?: boolean }
|
|
47
48
|
* @param {Object} [opts.headers] - Optional headers
|
|
48
49
|
* @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: object }>>}
|
|
49
50
|
*/
|
|
@@ -5,7 +5,28 @@ const {
|
|
|
5
5
|
/**
|
|
6
6
|
* Query params for GET /manifest-notifications (btrz-api-notifications). See get-manifest-notifications-handler getSpec().
|
|
7
7
|
* @typedef {Object} ManifestNotificationsListQuery
|
|
8
|
-
* @property {string} [manifestId] - Manifest id (ObjectId format)
|
|
8
|
+
* @property {string} [manifestId] - Manifest id (ObjectId format). When present, response includes attemptSummary.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Per-passenger attempt rollup returned when manifestId is provided on GET.
|
|
13
|
+
* @typedef {Object} ManifestNotificationAttemptSummary
|
|
14
|
+
* @property {Array<{id: string, subject?: string, hasReliableTracking: boolean, sentAt?: string|null}>} parents
|
|
15
|
+
* @property {number} trackedParentCount
|
|
16
|
+
* @property {Object<string, {attemptedCount: number, byParent: Object<string, string>}>} byTicket
|
|
17
|
+
* @property {{id: string, resendEligibleTicketIds: string[]}|null} latestParent
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* GET /manifest-notifications response when manifestId query param is used.
|
|
22
|
+
* @typedef {Object} ManifestNotificationsListResponse
|
|
23
|
+
* @property {Array<Object>} manifestNotifications
|
|
24
|
+
* @property {ManifestNotificationAttemptSummary} [attemptSummary]
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Optional query params forwarded to POST /manifest-notifications as-is.
|
|
29
|
+
* @typedef {Object.<string, *>} ManifestNotificationsCreateQuery
|
|
9
30
|
*/
|
|
10
31
|
|
|
11
32
|
/**
|
|
@@ -24,7 +45,7 @@ function manifestNotificationsFactory({
|
|
|
24
45
|
* @param {Object} opts
|
|
25
46
|
* @param {string} [opts.token] - API key
|
|
26
47
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
27
|
-
* @param {
|
|
48
|
+
* @param {ManifestNotificationsCreateQuery} [opts.query] - Optional query params (forwarded to API)
|
|
28
49
|
* @param {Object} opts.data - Request body
|
|
29
50
|
* @param {Object} [opts.headers] - Optional headers
|
|
30
51
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
@@ -56,7 +77,7 @@ function manifestNotificationsFactory({
|
|
|
56
77
|
* @param {string} [opts.token] - API key
|
|
57
78
|
* @param {ManifestNotificationsListQuery} [opts.query] - Query params (manifestId optional)
|
|
58
79
|
* @param {Object} [opts.headers] - Optional headers
|
|
59
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
80
|
+
* @returns {Promise<import("axios").AxiosResponse<ManifestNotificationsListResponse>>}
|
|
60
81
|
*/
|
|
61
82
|
function all({
|
|
62
83
|
token,
|
|
@@ -292,6 +292,33 @@ function notifyTicketFactory({
|
|
|
292
292
|
headers
|
|
293
293
|
})
|
|
294
294
|
});
|
|
295
|
+
},
|
|
296
|
+
/**
|
|
297
|
+
* POST /notify-manifest/{parentId}/resend - resend a parent manifest notification to
|
|
298
|
+
* Resend-eligible (unnotified) passengers. Server computes eligibility; no request body.
|
|
299
|
+
* @param {Object} opts
|
|
300
|
+
* @param {string} [opts.token] - API key
|
|
301
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
302
|
+
* @param {string} opts.parentId - Parent manifest notification shared id
|
|
303
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
304
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
305
|
+
*/
|
|
306
|
+
resend({
|
|
307
|
+
token,
|
|
308
|
+
jwtToken,
|
|
309
|
+
parentId,
|
|
310
|
+
headers
|
|
311
|
+
}) {
|
|
312
|
+
return client({
|
|
313
|
+
url: `/notify-manifest/${parentId}/resend`,
|
|
314
|
+
method: "post",
|
|
315
|
+
headers: authorizationHeaders({
|
|
316
|
+
token,
|
|
317
|
+
jwtToken,
|
|
318
|
+
internalAuthTokenProvider,
|
|
319
|
+
headers
|
|
320
|
+
})
|
|
321
|
+
});
|
|
295
322
|
}
|
|
296
323
|
}
|
|
297
324
|
};
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ function marketPricingSettingsFactory({client, internalAuthTokenProvider}) {
|
|
|
17
17
|
* @param {string} [opts.token] - API key
|
|
18
18
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
19
19
|
* @param {Object} [opts.headers] - Optional headers
|
|
20
|
-
* @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: { useOnlySpecificFareTable: boolean,
|
|
20
|
+
* @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: { useOnlySpecificFareTable: boolean, allowEachTripSegmentToBePricedIndividually: boolean } }>>}
|
|
21
21
|
*/
|
|
22
22
|
function get({token, jwtToken, headers}) {
|
|
23
23
|
return client({
|
|
@@ -27,11 +27,12 @@ function marketPricingSettingsFactory({client, internalAuthTokenProvider}) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* PUT /market-pricing-settings – Update market pricing settings. Body: MarketPricingSettings at root (useOnlySpecificFareTable
|
|
30
|
+
* PUT /market-pricing-settings – Update market pricing settings. Body: MarketPricingSettings at root (useOnlySpecificFareTable required).
|
|
31
|
+
* Optional: allowEachTripSegmentToBePricedIndividually.
|
|
31
32
|
* @param {Object} opts
|
|
32
33
|
* @param {string} [opts.token] - API key
|
|
33
34
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
34
|
-
* @param {Object} opts.marketPricingSettings - { useOnlySpecificFareTable: boolean,
|
|
35
|
+
* @param {Object} opts.marketPricingSettings - { useOnlySpecificFareTable: boolean, allowEachTripSegmentToBePricedIndividually?: boolean }
|
|
35
36
|
* @param {Object} [opts.headers] - Optional headers
|
|
36
37
|
* @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: object }>>}
|
|
37
38
|
*/
|
|
@@ -5,7 +5,28 @@ const {
|
|
|
5
5
|
/**
|
|
6
6
|
* Query params for GET /manifest-notifications (btrz-api-notifications). See get-manifest-notifications-handler getSpec().
|
|
7
7
|
* @typedef {Object} ManifestNotificationsListQuery
|
|
8
|
-
* @property {string} [manifestId] - Manifest id (ObjectId format)
|
|
8
|
+
* @property {string} [manifestId] - Manifest id (ObjectId format). When present, response includes attemptSummary.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Per-passenger attempt rollup returned when manifestId is provided on GET.
|
|
13
|
+
* @typedef {Object} ManifestNotificationAttemptSummary
|
|
14
|
+
* @property {Array<{id: string, subject?: string, hasReliableTracking: boolean, sentAt?: string|null}>} parents
|
|
15
|
+
* @property {number} trackedParentCount
|
|
16
|
+
* @property {Object<string, {attemptedCount: number, byParent: Object<string, string>}>} byTicket
|
|
17
|
+
* @property {{id: string, resendEligibleTicketIds: string[]}|null} latestParent
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* GET /manifest-notifications response when manifestId query param is used.
|
|
22
|
+
* @typedef {Object} ManifestNotificationsListResponse
|
|
23
|
+
* @property {Array<Object>} manifestNotifications
|
|
24
|
+
* @property {ManifestNotificationAttemptSummary} [attemptSummary]
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Optional query params forwarded to POST /manifest-notifications as-is.
|
|
29
|
+
* @typedef {Object.<string, *>} ManifestNotificationsCreateQuery
|
|
9
30
|
*/
|
|
10
31
|
|
|
11
32
|
/**
|
|
@@ -24,7 +45,7 @@ function manifestNotificationsFactory({
|
|
|
24
45
|
* @param {Object} opts
|
|
25
46
|
* @param {string} [opts.token] - API key
|
|
26
47
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
27
|
-
* @param {
|
|
48
|
+
* @param {ManifestNotificationsCreateQuery} [opts.query] - Optional query params (forwarded to API)
|
|
28
49
|
* @param {Object} opts.data - Request body
|
|
29
50
|
* @param {Object} [opts.headers] - Optional headers
|
|
30
51
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
@@ -47,7 +68,7 @@ function manifestNotificationsFactory({
|
|
|
47
68
|
* @param {string} [opts.token] - API key
|
|
48
69
|
* @param {ManifestNotificationsListQuery} [opts.query] - Query params (manifestId optional)
|
|
49
70
|
* @param {Object} [opts.headers] - Optional headers
|
|
50
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
71
|
+
* @returns {Promise<import("axios").AxiosResponse<ManifestNotificationsListResponse>>}
|
|
51
72
|
*/
|
|
52
73
|
function all({
|
|
53
74
|
token,
|
|
@@ -212,6 +212,23 @@ function notifyTicketFactory({
|
|
|
212
212
|
data,
|
|
213
213
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
214
214
|
});
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* POST /notify-manifest/{parentId}/resend - resend a parent manifest notification to
|
|
218
|
+
* Resend-eligible (unnotified) passengers. Server computes eligibility; no request body.
|
|
219
|
+
* @param {Object} opts
|
|
220
|
+
* @param {string} [opts.token] - API key
|
|
221
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
222
|
+
* @param {string} opts.parentId - Parent manifest notification shared id
|
|
223
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
224
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
225
|
+
*/
|
|
226
|
+
resend({token, jwtToken, parentId, headers}) {
|
|
227
|
+
return client({
|
|
228
|
+
url: `/notify-manifest/${parentId}/resend`,
|
|
229
|
+
method: "post",
|
|
230
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
231
|
+
});
|
|
215
232
|
}
|
|
216
233
|
}
|
|
217
234
|
};
|
|
@@ -118,6 +118,23 @@ describe("notifications/notify-manifest", () => {
|
|
|
118
118
|
headers: {}
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
|
+
|
|
122
|
+
it("should post a resend for a parent manifest notification", () => {
|
|
123
|
+
const parentId = "5f2a1b3c4d5e6f7a8b9c0d1e";
|
|
124
|
+
axiosMock.onPost(`/notify-manifest/${parentId}/resend`).reply(({headers}) => {
|
|
125
|
+
if (headers["x-api-key"] === token && headers.authorization === `Bearer ${jwtToken}`) {
|
|
126
|
+
return [200, {manifestNotifications: []}];
|
|
127
|
+
}
|
|
128
|
+
return [403];
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
return api.notifications.notify.manifest.resend({
|
|
132
|
+
token,
|
|
133
|
+
jwtToken,
|
|
134
|
+
parentId,
|
|
135
|
+
headers: {}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
121
138
|
});
|
|
122
139
|
|
|
123
140
|
describe("notifications/notify/email", () => {
|