mts-booking-library 3.0.9 → 3.0.11
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.
|
@@ -5,7 +5,7 @@ import { GetBuyerPassengersDetailsResponse, Person } from "../types/common/Perso
|
|
|
5
5
|
import { AddReductionRequest } from "../types/common/Reduction";
|
|
6
6
|
import { TariffType, TermsType } from "../types/common/Tariffs";
|
|
7
7
|
import { GetTariffsResponse } from "../types/tpl/GetTariffsResponse";
|
|
8
|
-
import { GetSuperAreasRequest, SuperArea } from "../types/tpl/SuperArea";
|
|
8
|
+
import { GetCitiesRequest, GetSuperAreasRequest, SuperArea } from "../types/tpl/SuperArea";
|
|
9
9
|
import { BookingSkip, TplCart } from "../types/tpl/TplCart";
|
|
10
10
|
import { GetTripsResponse } from "../types/tpl/Trips";
|
|
11
11
|
import { ApiCallOptions } from "../utils/apiCall";
|
|
@@ -121,10 +121,11 @@ export declare class TplBooking extends Booking {
|
|
|
121
121
|
deleteCart(options?: ApiCallOptions): Promise<ErrorResponse | any>;
|
|
122
122
|
/**
|
|
123
123
|
* This method allows to get the list of cities where it is possible to book a TPL service.
|
|
124
|
+
* @param request Optional query options (e.g. {@link GetCitiesRequest.type}).
|
|
124
125
|
* @returns An array of {@link City} objects representing the cities where it is possible to book a TPL service
|
|
125
126
|
* if the call is successful, an {@link ErrorResponse} object otherwise.
|
|
126
127
|
*/
|
|
127
|
-
getCities(options?: ApiCallOptions): Promise<ErrorResponse | City[]>;
|
|
128
|
+
getCities(request?: GetCitiesRequest, options?: ApiCallOptions): Promise<ErrorResponse | City[]>;
|
|
128
129
|
/**
|
|
129
130
|
* This method fetches the list of super areas for a given city. A super area is a region of the city in which
|
|
130
131
|
* the TPL service is available at a certain price.
|
|
@@ -76,6 +76,7 @@ var config_1 = require("../config");
|
|
|
76
76
|
var mtsStorage_1 = require("../mtsStorage");
|
|
77
77
|
var ErrorResponse_1 = require("../types/ErrorResponse");
|
|
78
78
|
var Reduction_1 = require("../types/common/Reduction");
|
|
79
|
+
var SuperArea_1 = require("../types/tpl/SuperArea");
|
|
79
80
|
var processBookingSteps_1 = require("../utils/processBookingSteps");
|
|
80
81
|
var utils_1 = require("../utils/utils");
|
|
81
82
|
var booking_1 = require("./booking");
|
|
@@ -220,14 +221,20 @@ var TplBooking = /** @class */ (function (_super) {
|
|
|
220
221
|
};
|
|
221
222
|
/**
|
|
222
223
|
* This method allows to get the list of cities where it is possible to book a TPL service.
|
|
224
|
+
* @param request Optional query options (e.g. {@link GetCitiesRequest.type}).
|
|
223
225
|
* @returns An array of {@link City} objects representing the cities where it is possible to book a TPL service
|
|
224
226
|
* if the call is successful, an {@link ErrorResponse} object otherwise.
|
|
225
227
|
*/
|
|
226
|
-
TplBooking.prototype.getCities = function (options) {
|
|
228
|
+
TplBooking.prototype.getCities = function (request, options) {
|
|
227
229
|
return __awaiter(this, void 0, void 0, function () {
|
|
228
|
-
var url;
|
|
230
|
+
var searchParams, url;
|
|
229
231
|
return __generator(this, function (_a) {
|
|
230
|
-
|
|
232
|
+
searchParams = new URLSearchParams();
|
|
233
|
+
if ((request === null || request === void 0 ? void 0 : request.type) != null &&
|
|
234
|
+
request.type !== SuperArea_1.SuperAreasTypeFilter.ALL) {
|
|
235
|
+
searchParams.set("type", request.type);
|
|
236
|
+
}
|
|
237
|
+
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/tpl/cities?").concat(searchParams);
|
|
231
238
|
return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
|
|
232
239
|
return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response.cities;
|
|
233
240
|
})];
|
package/lib/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export { Service, ServiceTrip } from "./types/services/Service";
|
|
|
26
26
|
export { ServiceCart, ServiceBookingType } from "./types/services/ServiceCart";
|
|
27
27
|
export { ServiceInfo } from "./types/services/ServiceInfo";
|
|
28
28
|
export { GetTariffsResponse } from "./types/tpl/GetTariffsResponse";
|
|
29
|
-
export { SuperArea, GetSuperAreasRequest, SuperAreasTypeFilter } from "./types/tpl/SuperArea";
|
|
29
|
+
export { SuperArea, GetSuperAreasRequest, GetCitiesRequest, SuperAreasTypeFilter } from "./types/tpl/SuperArea";
|
|
30
30
|
export { TplCart, TplBookingType, TplBookingInfo } from "./types/tpl/TplCart";
|
|
31
31
|
export { Subscription } from "./types/subscriptions/Subscriptions";
|
|
32
32
|
export { GetSubscriptionAvailabilityRequest, GetSubscriptionAvailabilityResponse, SubscriptionCalendarDayPeriodInfo } from "./types/subscriptions/SubscriptionAvailabilities";
|
|
@@ -34,3 +34,13 @@ export type GetSuperAreasRequest = {
|
|
|
34
34
|
*/
|
|
35
35
|
type?: SuperAreasTypeFilter;
|
|
36
36
|
};
|
|
37
|
+
/** Request options for {@link TplBooking.getCities}. */
|
|
38
|
+
export type GetCitiesRequest = {
|
|
39
|
+
/**
|
|
40
|
+
* Filters cities by whether they are associated with tour or regular super areas (case-insensitive).
|
|
41
|
+
* Accepted values: "ALL" (default – no filter applied, all cities are returned; this is also the behaviour when the parameter is omitted),
|
|
42
|
+
* "TOURS_ONLY" (only cities associated with at least one super area whose tariffs are classified as tours), "REGULAR_ONLY" (only cities associated with at least one super area whose tariffs are classified as regular ticket).
|
|
43
|
+
* A city can be both a tour city and a regular city if it is associated with super areas of both types.
|
|
44
|
+
*/
|
|
45
|
+
type?: SuperAreasTypeFilter;
|
|
46
|
+
};
|