mts-booking-library 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -96,9 +96,14 @@ export declare class TplBooking extends Booking {
96
96
  getTermsTypes(superAreaId: number): Promise<ErrorResponse | TermsType[]>;
97
97
  /**
98
98
  * This method fetches the list of available tariffs for the selected terms type in a given super area.
99
- * @returns An array of {@link GetTariffsResponse} if the call is successful, an {@link ErrorResponse} object otherwise.
99
+ * @param {number} superAreaId The id of the super area (as returned by the {@link getSuperAreas} method).
100
+ * @param {number | null} termsTypeId The id of the terms type (as returned by the {@link getTermsTypes} method).
101
+ * If null, tariffs from all terms types will be considered.
102
+ * @param {boolean} onlyTickets If true, only only return the tariffs that are for single tickets.
103
+ * @param {boolean} onlySubscriptions If true, only return the tariffs that are for subscriptions.
104
+ * @returns A {@link GetTariffsResponse} if the call is successful, an {@link ErrorResponse} object otherwise.
100
105
  */
101
- getTariffs(superAreaId: number, termsTypeId: number): Promise<ErrorResponse | GetTariffsResponse>;
106
+ getTariffs(superAreaId: number, termsTypeId: number | null, onlyTickets: boolean, onlySubscriptions: boolean): Promise<ErrorResponse | GetTariffsResponse>;
102
107
  /**
103
108
  * This method allows to create a TPL cart.
104
109
  * @param {Map<number, number>} tariffIdToQuantity A map that associates a tariff id (the one chosen by the user) to the number of tickets to buy for that tariff.
@@ -251,14 +251,20 @@ var TplBooking = /** @class */ (function (_super) {
251
251
  };
252
252
  /**
253
253
  * This method fetches the list of available tariffs for the selected terms type in a given super area.
254
- * @returns An array of {@link GetTariffsResponse} if the call is successful, an {@link ErrorResponse} object otherwise.
254
+ * @param {number} superAreaId The id of the super area (as returned by the {@link getSuperAreas} method).
255
+ * @param {number | null} termsTypeId The id of the terms type (as returned by the {@link getTermsTypes} method).
256
+ * If null, tariffs from all terms types will be considered.
257
+ * @param {boolean} onlyTickets If true, only only return the tariffs that are for single tickets.
258
+ * @param {boolean} onlySubscriptions If true, only return the tariffs that are for subscriptions.
259
+ * @returns A {@link GetTariffsResponse} if the call is successful, an {@link ErrorResponse} object otherwise.
255
260
  */
256
- TplBooking.prototype.getTariffs = function (superAreaId, termsTypeId) {
261
+ TplBooking.prototype.getTariffs = function (superAreaId, termsTypeId, onlyTickets, onlySubscriptions) {
257
262
  return __awaiter(this, void 0, void 0, function () {
258
263
  var searchParams, url;
259
264
  return __generator(this, function (_a) {
260
- searchParams = new URLSearchParams({ superAreaId: superAreaId.toString(), termsTypeId: termsTypeId.toString() });
265
+ searchParams = new URLSearchParams(__assign(__assign({ superAreaId: superAreaId.toString() }, (termsTypeId && { termsTypeId: termsTypeId.toString() })), { onlyTickets: onlyTickets.toString(), onlySubscriptions: onlySubscriptions.toString() }));
261
266
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/tpl/tariffs?").concat(searchParams);
267
+ // Call the API
262
268
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
263
269
  // Check for error
264
270
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "Library for using MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",