btrz-api-client 8.49.0 → 8.50.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.
@@ -28,12 +28,17 @@ var _require = require("./../endpoints_helpers.js"),
28
28
  * @property {string} [orderDir] - 'asc' (1) or 'desc' (-1)
29
29
  */
30
30
 
31
+ /**
32
+ * Promo rule payload for POST/PUT rule endpoints (subset; see inventory PromoRule model).
33
+ * @typedef {Object} PromoRulePayload
34
+ * @property {boolean} [requireSameOperation] - When true and minPassengersQty > 0, minimum is evaluated per journey.
35
+ * @property {string[]} [excludedFareTypes] - When fareId is empty and minPassengersQty > 0, passengers with these fare types are excluded from the minimum count. Must be empty when fareId is set.
36
+ */
37
+
31
38
  /**
32
39
  * Promo create / PATCH update body (subset; see inventory API models for full shape).
40
+ * Group-style behavior is configured per rule via minPassengersQty, requireSameOperation, and excludedFareTypes (not on the promo root).
33
41
  * @typedef {Object} PromoUpdateRequest
34
- * @property {boolean} [groupDiscount] - When true, min passenger rules use group semantics in sales.
35
- * @property {boolean} [requireSameOperation] - When true with group discount, cart context is scoped by journeyId.
36
- * @property {string[]} [groupDiscountEligibleFareIds] - Non-empty: only these fare IDs count toward minimum and may receive discount; empty: all fares.
37
42
  */
38
43
 
39
44
  /**
@@ -177,7 +182,7 @@ function promosFactory(_ref) {
177
182
  * @param {string} opts.promoId - Promo id
178
183
  * @param {Object} opts.operations - Array of PromoUpdateOperation (op, path, value).
179
184
  * @param {Object} [opts.headers] - Optional headers
180
- * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with PatchedPromos.
185
+ * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with body `{ results, promo? }`: patch outcome plus full persisted promo after a successful update (same document emitted on `promo.updated`).
181
186
  * @throws When the request fails (400/401/404/500).
182
187
  */
183
188
  function patch(_ref7) {
@@ -201,7 +206,7 @@ function promosFactory(_ref) {
201
206
  * @param {string} [opts.token] - API key
202
207
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
203
208
  * @param {string} opts.promoId - Promo id
204
- * @param {Object} opts.rule - Rule payload (PromoRule).
209
+ * @param {PromoRulePayload} opts.rule - Rule payload (subset of PromoRule).
205
210
  * @param {Object} [opts.headers] - Optional headers
206
211
  * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with Promo including new rule.
207
212
  * @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INVALID_PRODUCT_ID, INVALID_FARE_ID, etc.
@@ -228,7 +233,7 @@ function promosFactory(_ref) {
228
233
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
229
234
  * @param {string} opts.promoId - Promo id
230
235
  * @param {string} opts.ruleId - Rule id
231
- * @param {Object} opts.rule - Full rule payload (PromoRule).
236
+ * @param {PromoRulePayload} opts.rule - Full rule payload (subset of PromoRule).
232
237
  * @param {Object} [opts.headers] - Optional headers
233
238
  * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with updated Promo.
234
239
  * @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INVALID_PRODUCT_ID, INVALID_FARE_ID, etc.
@@ -284,7 +284,9 @@ function schedulesFactory(_ref) {
284
284
  jwtToken = _ref11.jwtToken,
285
285
  data = _ref11.data,
286
286
  scheduleId = _ref11.scheduleId,
287
- headers = _ref11.headers;
287
+ headers = _ref11.headers,
288
+ _ref11$query = _ref11.query,
289
+ query = _ref11$query === undefined ? {} : _ref11$query;
288
290
 
289
291
  return client({
290
292
  url: "/schedules/" + scheduleId + "/schedule-exceptions",
@@ -292,7 +294,8 @@ function schedulesFactory(_ref) {
292
294
  headers: authorizationHeaders({
293
295
  token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
294
296
  }),
295
- data: data
297
+ data: data,
298
+ params: query
296
299
  });
297
300
  },
298
301
  /**
@@ -310,14 +313,17 @@ function schedulesFactory(_ref) {
310
313
  jwtToken = _ref12.jwtToken,
311
314
  scheduleId = _ref12.scheduleId,
312
315
  exceptionId = _ref12.exceptionId,
313
- headers = _ref12.headers;
316
+ headers = _ref12.headers,
317
+ _ref12$query = _ref12.query,
318
+ query = _ref12$query === undefined ? {} : _ref12$query;
314
319
 
315
320
  return client({
316
321
  url: "/schedules/" + scheduleId + "/schedule-exceptions/" + exceptionId,
317
322
  method: "delete",
318
323
  headers: authorizationHeaders({
319
324
  token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
320
- })
325
+ }),
326
+ params: query
321
327
  });
322
328
  },
323
329
  /**
@@ -337,7 +343,9 @@ function schedulesFactory(_ref) {
337
343
  data = _ref13.data,
338
344
  scheduleId = _ref13.scheduleId,
339
345
  exceptionId = _ref13.exceptionId,
340
- headers = _ref13.headers;
346
+ headers = _ref13.headers,
347
+ _ref13$query = _ref13.query,
348
+ query = _ref13$query === undefined ? {} : _ref13$query;
341
349
 
342
350
  return client({
343
351
  url: "/schedules/" + scheduleId + "/schedule-exceptions/" + exceptionId,
@@ -345,7 +353,8 @@ function schedulesFactory(_ref) {
345
353
  headers: authorizationHeaders({
346
354
  token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
347
355
  }),
348
- data: data
356
+ data: data,
357
+ params: query
349
358
  });
350
359
  }
351
360
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "8.49.0",
3
+ "version": "8.50.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,12 +25,17 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
25
25
  * @property {string} [orderDir] - 'asc' (1) or 'desc' (-1)
26
26
  */
27
27
 
28
+ /**
29
+ * Promo rule payload for POST/PUT rule endpoints (subset; see inventory PromoRule model).
30
+ * @typedef {Object} PromoRulePayload
31
+ * @property {boolean} [requireSameOperation] - When true and minPassengersQty &gt; 0, minimum is evaluated per journey.
32
+ * @property {string[]} [excludedFareTypes] - When fareId is empty and minPassengersQty &gt; 0, passengers with these fare types are excluded from the minimum count. Must be empty when fareId is set.
33
+ */
34
+
28
35
  /**
29
36
  * Promo create / PATCH update body (subset; see inventory API models for full shape).
37
+ * Group-style behavior is configured per rule via minPassengersQty, requireSameOperation, and excludedFareTypes (not on the promo root).
30
38
  * @typedef {Object} PromoUpdateRequest
31
- * @property {boolean} [groupDiscount] - When true, min passenger rules use group semantics in sales.
32
- * @property {boolean} [requireSameOperation] - When true with group discount, cart context is scoped by journeyId.
33
- * @property {string[]} [groupDiscountEligibleFareIds] - Non-empty: only these fare IDs count toward minimum and may receive discount; empty: all fares.
34
39
  */
35
40
 
36
41
  /**
@@ -142,7 +147,7 @@ function promosFactory({client, internalAuthTokenProvider}) {
142
147
  * @param {string} opts.promoId - Promo id
143
148
  * @param {Object} opts.operations - Array of PromoUpdateOperation (op, path, value).
144
149
  * @param {Object} [opts.headers] - Optional headers
145
- * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with PatchedPromos.
150
+ * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with body `{ results, promo? }`: patch outcome plus full persisted promo after a successful update (same document emitted on `promo.updated`).
146
151
  * @throws When the request fails (400/401/404/500).
147
152
  */
148
153
  function patch({jwtToken, token, promoId, operations, headers}) {
@@ -160,7 +165,7 @@ function promosFactory({client, internalAuthTokenProvider}) {
160
165
  * @param {string} [opts.token] - API key
161
166
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
162
167
  * @param {string} opts.promoId - Promo id
163
- * @param {Object} opts.rule - Rule payload (PromoRule).
168
+ * @param {PromoRulePayload} opts.rule - Rule payload (subset of PromoRule).
164
169
  * @param {Object} [opts.headers] - Optional headers
165
170
  * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with Promo including new rule.
166
171
  * @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INVALID_PRODUCT_ID, INVALID_FARE_ID, etc.
@@ -181,7 +186,7 @@ function promosFactory({client, internalAuthTokenProvider}) {
181
186
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
182
187
  * @param {string} opts.promoId - Promo id
183
188
  * @param {string} opts.ruleId - Rule id
184
- * @param {Object} opts.rule - Full rule payload (PromoRule).
189
+ * @param {PromoRulePayload} opts.rule - Full rule payload (subset of PromoRule).
185
190
  * @param {Object} [opts.headers] - Optional headers
186
191
  * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with updated Promo.
187
192
  * @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INVALID_PRODUCT_ID, INVALID_FARE_ID, etc.
@@ -216,14 +216,15 @@ function schedulesFactory({client, internalAuthTokenProvider}) {
216
216
  * @param {Object} [opts.headers] - Optional headers
217
217
  * @returns {Promise<import("axios").AxiosResponse>}
218
218
  */
219
- create: ({token, jwtToken, data, scheduleId, headers}) => {
219
+ create: ({token, jwtToken, data, scheduleId, headers, query = {}}) => {
220
220
  return client({
221
221
  url: `/schedules/${scheduleId}/schedule-exceptions`,
222
222
  method: "post",
223
223
  headers: authorizationHeaders({
224
224
  token, jwtToken, internalAuthTokenProvider, headers
225
225
  }),
226
- data
226
+ data,
227
+ params: query
227
228
  });
228
229
  },
229
230
  /**
@@ -236,13 +237,14 @@ function schedulesFactory({client, internalAuthTokenProvider}) {
236
237
  * @param {Object} [opts.headers] - Optional headers
237
238
  * @returns {Promise<import("axios").AxiosResponse>}
238
239
  */
239
- delete: ({token, jwtToken, scheduleId, exceptionId, headers}) => {
240
+ delete: ({token, jwtToken, scheduleId, exceptionId, headers, query = {}}) => {
240
241
  return client({
241
242
  url: `/schedules/${scheduleId}/schedule-exceptions/${exceptionId}`,
242
243
  method: "delete",
243
244
  headers: authorizationHeaders({
244
245
  token, jwtToken, internalAuthTokenProvider, headers
245
- })
246
+ }),
247
+ params: query
246
248
  });
247
249
  },
248
250
  /**
@@ -256,14 +258,15 @@ function schedulesFactory({client, internalAuthTokenProvider}) {
256
258
  * @param {Object} [opts.headers] - Optional headers
257
259
  * @returns {Promise<import("axios").AxiosResponse>}
258
260
  */
259
- update: ({token, jwtToken, data, scheduleId, exceptionId, headers}) => {
261
+ update: ({token, jwtToken, data, scheduleId, exceptionId, headers, query = {}}) => {
260
262
  return client({
261
263
  url: `/schedules/${scheduleId}/schedule-exceptions/${exceptionId}`,
262
264
  method: "put",
263
265
  headers: authorizationHeaders({
264
266
  token, jwtToken, internalAuthTokenProvider, headers
265
267
  }),
266
- data
268
+ data,
269
+ params: query
267
270
  });
268
271
  }
269
272
  };