@qite/tide-client 1.1.67 → 1.1.69
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/build/types/booking-v2/response/booking-package-flight-combination.d.ts +5 -0
- package/build/types/booking-v2/response/booking-package-flight-info.d.ts +7 -0
- package/build/types/booking-v2/response/booking-package-flight-route.d.ts +4 -0
- package/build/types/booking-v2/response/index.d.ts +3 -0
- package/build/types/booking-v2/shared/booking-package-flight.d.ts +3 -0
- package/build/types/booking-v2/shared/booking-package.d.ts +2 -0
- package/package.json +1 -1
- package/src/index.ts +0 -43
- package/src/services/odata.service.ts +0 -158
- package/src/types/booking-v2/index.ts +0 -3
- package/src/types/booking-v2/request/available-countries-request.ts +0 -4
- package/src/types/booking-v2/request/available-flights-request.ts +0 -8
- package/src/types/booking-v2/request/bookable-dates-request.ts +0 -4
- package/src/types/booking-v2/request/booking-package-address.ts +0 -14
- package/src/types/booking-v2/request/booking-package-book-request.ts +0 -26
- package/src/types/booking-v2/request/booking-package-customer-request.ts +0 -4
- package/src/types/booking-v2/request/booking-package-destination.ts +0 -9
- package/src/types/booking-v2/request/booking-package-details-request.ts +0 -30
- package/src/types/booking-v2/request/booking-package-flight-pool-request.ts +0 -13
- package/src/types/booking-v2/request/booking-package-request.ts +0 -5
- package/src/types/booking-v2/request/booking-package-search-request.ts +0 -32
- package/src/types/booking-v2/request/booking-package-update-request.ts +0 -5
- package/src/types/booking-v2/request/booking-package-voucher-request.ts +0 -4
- package/src/types/booking-v2/request/index.ts +0 -18
- package/src/types/booking-v2/request/prices-request.ts +0 -19
- package/src/types/booking-v2/request/selected-flight.ts +0 -10
- package/src/types/booking-v2/request/selected-hotel.ts +0 -5
- package/src/types/booking-v2/request/tour-codes.request.ts +0 -3
- package/src/types/booking-v2/request/transport-dates-request.ts +0 -14
- package/src/types/booking-v2/response/available-country.ts +0 -5
- package/src/types/booking-v2/response/available-flight.ts +0 -4
- package/src/types/booking-v2/response/base-price.ts +0 -7
- package/src/types/booking-v2/response/bookable-dates.ts +0 -4
- package/src/types/booking-v2/response/booking-package-allotment-info.ts +0 -17
- package/src/types/booking-v2/response/booking-package-dossier.ts +0 -6
- package/src/types/booking-v2/response/booking-package-flight-pool.ts +0 -6
- package/src/types/booking-v2/response/booking-package-hotel-pool.ts +0 -5
- package/src/types/booking-v2/response/booking-package-item.ts +0 -40
- package/src/types/booking-v2/response/booking-price-detail.ts +0 -20
- package/src/types/booking-v2/response/booking-price-details.ts +0 -15
- package/src/types/booking-v2/response/booking-price-per-pax.ts +0 -4
- package/src/types/booking-v2/response/booking-product-notification.ts +0 -7
- package/src/types/booking-v2/response/booking-room-status-option.ts +0 -5
- package/src/types/booking-v2/response/booking-room-status.ts +0 -6
- package/src/types/booking-v2/response/booking-travel-agent.ts +0 -7
- package/src/types/booking-v2/response/booking-validity-line.ts +0 -4
- package/src/types/booking-v2/response/booking-voucher-result.ts +0 -3
- package/src/types/booking-v2/response/changed-line.ts +0 -4
- package/src/types/booking-v2/response/index.ts +0 -22
- package/src/types/booking-v2/response/tide-response.ts +0 -6
- package/src/types/booking-v2/response/tour-codes-response.ts +0 -3
- package/src/types/booking-v2/response/transport-dates-response.ts +0 -4
- package/src/types/booking-v2/shared/airline-booking-package-option.ts +0 -3
- package/src/types/booking-v2/shared/airport-booking-package-option.ts +0 -3
- package/src/types/booking-v2/shared/booking-airline-group.ts +0 -7
- package/src/types/booking-v2/shared/booking-airport-group.ts +0 -7
- package/src/types/booking-v2/shared/booking-option-group.ts +0 -5
- package/src/types/booking-v2/shared/booking-option-pax.ts +0 -14
- package/src/types/booking-v2/shared/booking-option-unit.ts +0 -13
- package/src/types/booking-v2/shared/booking-package-availability.ts +0 -9
- package/src/types/booking-v2/shared/booking-package-flight-meta-data-line.ts +0 -18
- package/src/types/booking-v2/shared/booking-package-flight-meta-data.ts +0 -11
- package/src/types/booking-v2/shared/booking-package-flight.ts +0 -16
- package/src/types/booking-v2/shared/booking-package-hotel-option.ts +0 -10
- package/src/types/booking-v2/shared/booking-package-hotel-room.ts +0 -6
- package/src/types/booking-v2/shared/booking-package-hotel.ts +0 -27
- package/src/types/booking-v2/shared/booking-package-line.ts +0 -18
- package/src/types/booking-v2/shared/booking-package-option.ts +0 -55
- package/src/types/booking-v2/shared/booking-package-pax.ts +0 -19
- package/src/types/booking-v2/shared/booking-package-request-room.ts +0 -6
- package/src/types/booking-v2/shared/booking-package-room-option.ts +0 -22
- package/src/types/booking-v2/shared/booking-package-room.ts +0 -6
- package/src/types/booking-v2/shared/booking-package-tag.ts +0 -5
- package/src/types/booking-v2/shared/booking-package.ts +0 -13
- package/src/types/booking-v2/shared/index.ts +0 -27
- package/src/types/booking-v2/shared/per-booking-package-option.ts +0 -10
- package/src/types/booking-v2/shared/per-package-option.ts +0 -10
- package/src/types/booking-v2/shared/per-pax-package-option.ts +0 -6
- package/src/types/booking-v2/shared/per-unit-package-option.ts +0 -8
- package/src/types/booking-v2/shared/room-option-pax-type.ts +0 -4
- package/src/types/company/agent/agent-invoice-item.ts +0 -9
- package/src/types/company/agent/change-entry-agent-surcharge-action.model.ts +0 -5
- package/src/types/company/agent/entry-totals.ts +0 -7
- package/src/types/company/agent/index.ts +0 -3
- package/src/types/company/agent-print-action-request.ts +0 -11
- package/src/types/company/agent-print-action.ts +0 -7
- package/src/types/company/custom-entry-status-item.ts +0 -6
- package/src/types/company/index.ts +0 -5
- package/src/types/company/number-string-pair.ts +0 -4
- package/src/types/enums/allotment-type.ts +0 -5
- package/src/types/enums/availability-search-type.ts +0 -4
- package/src/types/enums/data-type.ts +0 -14
- package/src/types/enums/dossier-type.ts +0 -6
- package/src/types/enums/entry-line-flag.ts +0 -6
- package/src/types/enums/entry-line-status.ts +0 -19
- package/src/types/enums/entry-status.ts +0 -8
- package/src/types/enums/export-status.ts +0 -5
- package/src/types/enums/gender.ts +0 -5
- package/src/types/enums/index.ts +0 -17
- package/src/types/enums/meta-data-type.ts +0 -10
- package/src/types/enums/payment-type.ts +0 -6
- package/src/types/enums/price-chart-type.ts +0 -4
- package/src/types/enums/print-action-group.ts +0 -10
- package/src/types/enums/requirement-type.ts +0 -5
- package/src/types/enums/room-type.ts +0 -8
- package/src/types/enums/sale-type.ts +0 -4
- package/src/types/enums/service-type.ts +0 -33
- package/src/types/hubs/index.ts +0 -1
- package/src/types/hubs/search/flight-search-finish-response.ts +0 -4
- package/src/types/hubs/search/flight-search-request.ts +0 -26
- package/src/types/hubs/search/flight-search-response.ts +0 -42
- package/src/types/hubs/search/index.ts +0 -3
- package/src/types/index.ts +0 -10
- package/src/types/mollie/index.ts +0 -2
- package/src/types/mollie/mollie-payment-request.ts +0 -6
- package/src/types/mollie/mollie-payment.ts +0 -3
- package/src/types/odata/column.ts +0 -8
- package/src/types/odata/filter-item.ts +0 -14
- package/src/types/odata/index.ts +0 -4
- package/src/types/odata/odata-params.ts +0 -3
- package/src/types/odata/page-result.ts +0 -5
- package/src/types/offer/confirmed-dossier-check.ts +0 -6
- package/src/types/offer/country-item.ts +0 -5
- package/src/types/offer/crm-contact-request.ts +0 -37
- package/src/types/offer/customer-request.ts +0 -5
- package/src/types/offer/dossier-default-product.ts +0 -14
- package/src/types/offer/dossier-pax-item.Ts +0 -4
- package/src/types/offer/dossier-view-result.ts +0 -49
- package/src/types/offer/entry-check-response.ts +0 -5
- package/src/types/offer/entry-line-meta-data.ts +0 -5
- package/src/types/offer/entry-line-pax.ts +0 -9
- package/src/types/offer/entry-line.ts +0 -74
- package/src/types/offer/entry-price-line.ts +0 -40
- package/src/types/offer/entry-room2.ts +0 -5
- package/src/types/offer/entry.ts +0 -66
- package/src/types/offer/flight-meta-data-line.ts +0 -16
- package/src/types/offer/flight-meta-data.ts +0 -14
- package/src/types/offer/flight-pool.ts +0 -6
- package/src/types/offer/index.ts +0 -39
- package/src/types/offer/item-tag.ts +0 -3
- package/src/types/offer/language.ts +0 -5
- package/src/types/offer/member-confirmation-request.ts +0 -5
- package/src/types/offer/member-forgot-password-request.ts +0 -4
- package/src/types/offer/member-info.ts +0 -11
- package/src/types/offer/member-login-request.ts +0 -4
- package/src/types/offer/member-login-response.ts +0 -3
- package/src/types/offer/member-reset-password-request.ts +0 -4
- package/src/types/offer/note.ts +0 -16
- package/src/types/offer/pax.ts +0 -30
- package/src/types/offer/payment.ts +0 -20
- package/src/types/offer/person-country-preference.ts +0 -7
- package/src/types/offer/person-location-preference.ts +0 -7
- package/src/types/offer/person-oord-preference.ts +0 -7
- package/src/types/offer/person-period-date-range-preference.ts +0 -6
- package/src/types/offer/person-period-preference.ts +0 -7
- package/src/types/offer/person-region-preference.ts +0 -7
- package/src/types/offer/person-tour-group-preference.ts +0 -7
- package/src/types/offer/product-notification-result.ts +0 -9
- package/src/types/offer/web-contact-form-request.ts +0 -13
- package/src/types/offer/web-contact-has-tag-request.ts +0 -4
- package/src/types/shared/date-struct.ts +0 -5
- package/src/types/shared/index.ts +0 -1
- package/src/types/tide-client-config.ts +0 -5
- package/src/types/web/affiliate.ts +0 -5
- package/src/types/web/airport.ts +0 -11
- package/src/types/web/contact-form-request.ts +0 -11
- package/src/types/web/generate-booking-accommodation-request.ts +0 -6
- package/src/types/web/index.ts +0 -4
- package/src/utils/api.ts +0 -82
- package/src/utils/booking-v2-client.ts +0 -318
- package/src/utils/common-client.ts +0 -77
- package/src/utils/json.ts +0 -26
- package/src/utils/member-client.ts +0 -76
- package/src/utils/mollie-client.ts +0 -27
- package/src/utils/search-client.ts +0 -33
- package/src/utils/web-agent-client.ts +0 -176
- package/src/utils/web-client.ts +0 -96
- package/src/utils/web-contact-client.ts +0 -43
- package/src/utils/web-file.ts +0 -45
- package/tests/webClient.test.ts +0 -38
- package/tests/webContactClient.test.ts +0 -61
- package/tsconfig.json +0 -23
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
import { TideClientConfig } from "..";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
AvailableCountriesRequest,
|
|
5
|
-
AvailableCountry,
|
|
6
|
-
AvailableFlight,
|
|
7
|
-
AvailableFlightsRequest,
|
|
8
|
-
BasePrice,
|
|
9
|
-
BookableDates,
|
|
10
|
-
BookableDatesRequest,
|
|
11
|
-
BookingPackage,
|
|
12
|
-
BookingPackageAvailability,
|
|
13
|
-
BookingPackageBookRequest,
|
|
14
|
-
BookingPackageDetailsRequest,
|
|
15
|
-
BookingPackageDossier,
|
|
16
|
-
BookingPackageFlightPool,
|
|
17
|
-
BookingPackageFlightPoolRequest,
|
|
18
|
-
BookingPackageHotelPool,
|
|
19
|
-
BookingPackageItem,
|
|
20
|
-
BookingPackageRequest,
|
|
21
|
-
BookingPackageSearchRequest,
|
|
22
|
-
BookingPackageUpdateRequest,
|
|
23
|
-
BookingPackageVoucherRequest,
|
|
24
|
-
BookingPriceDetails,
|
|
25
|
-
BookingTravelAgent,
|
|
26
|
-
BookingVoucherResult,
|
|
27
|
-
EntryStatus,
|
|
28
|
-
PricesRequest,
|
|
29
|
-
TideResponse,
|
|
30
|
-
TourCodesRequest,
|
|
31
|
-
TourCodesResponse,
|
|
32
|
-
TransportDatesRequest,
|
|
33
|
-
TransportDatesResponse,
|
|
34
|
-
} from "../types";
|
|
35
|
-
import { get, patch, post } from "./common-client";
|
|
36
|
-
|
|
37
|
-
const ENDPOINT = "/api/web/booking/v2";
|
|
38
|
-
const ENDPOINT_AVAILABLE_FLIGHTS = `${ENDPOINT}/available-flights`;
|
|
39
|
-
const ENDPOINT_TRANSPORT_DATES = `${ENDPOINT}/transport-dates`;
|
|
40
|
-
const ENDPOINT_PRICES = `${ENDPOINT}/prices`;
|
|
41
|
-
const ENDPOINT_AVAILABLE_COUNTRIES = `${ENDPOINT}/available-countries`;
|
|
42
|
-
const ENDPOINT_SEARCH = `${ENDPOINT}/search`;
|
|
43
|
-
const ENDPOINT_SEARCH_WITH_ERROR_MAPPING = `${ENDPOINT}/search-with-error-mapping`;
|
|
44
|
-
// const ENDPOINT_ELASTIC = `${ENDPOINT}/elastic`; // TODO
|
|
45
|
-
const ENDPOINT_DETAILS = `${ENDPOINT}/details`;
|
|
46
|
-
const ENDPOINT_VALIDATE_VOUCHER = `${ENDPOINT}/validate-voucher`;
|
|
47
|
-
const ENDPOINT_ALTERNATE_HOTELS = (transactionId: string, optionId: string) =>
|
|
48
|
-
`${ENDPOINT}/details/${transactionId}/alternate-hotels/${optionId}`;
|
|
49
|
-
const ENDPOINT_ALTERNATE_FLIGHTS = (transactionId: string) =>
|
|
50
|
-
`${ENDPOINT}/details/${transactionId}/alternate-flights`;
|
|
51
|
-
const ENDPOINT_BOOKABLE_DATES = `${ENDPOINT}/bookable-dates`;
|
|
52
|
-
const ENDPOINT_PRICE_DETAILS = `${ENDPOINT}/price-details`;
|
|
53
|
-
const ENDPOINT_BOOK = `${ENDPOINT}/book`;
|
|
54
|
-
const ENDPOINT_UPDATE = `${ENDPOINT}/update`;
|
|
55
|
-
const ENDPOINT_AGENTS = `${ENDPOINT}/agents`;
|
|
56
|
-
const ENDPOINT_AVAILABLE_ALLOTMENTS = (eventId: string, productCode: string) =>
|
|
57
|
-
`${ENDPOINT}/get-allotment-availability/${eventId}/${productCode}`;
|
|
58
|
-
const ENDPOINT_FLIGHT_POOL = `${ENDPOINT}/flight-pool`;
|
|
59
|
-
const ENDPOINT_TOUR_CODES = `${ENDPOINT}/tourcodes`;
|
|
60
|
-
const ENDPOINT_CUSTOM_ENTRY_STATUS = (
|
|
61
|
-
dossierNumber: string,
|
|
62
|
-
customEntryStatusId: number
|
|
63
|
-
) => `${ENDPOINT}/custom-entry-status/${dossierNumber}/${customEntryStatusId}`;
|
|
64
|
-
const ENDPOINT_ENTRY_STATUS = (dossierNumber: string, entryStatus: number) =>
|
|
65
|
-
`${ENDPOINT}/custom-entry-status/${dossierNumber}/${entryStatus}`;
|
|
66
|
-
|
|
67
|
-
export const availableFlights = (
|
|
68
|
-
config: TideClientConfig,
|
|
69
|
-
request: AvailableFlightsRequest,
|
|
70
|
-
signal?: AbortSignal
|
|
71
|
-
): Promise<AvailableFlight[]> => {
|
|
72
|
-
const url = `${config.host}${ENDPOINT_AVAILABLE_FLIGHTS}`;
|
|
73
|
-
const apiKey = config.apiKey;
|
|
74
|
-
const body = JSON.stringify(request);
|
|
75
|
-
|
|
76
|
-
return post(url, apiKey, body, config.token, signal, true);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const transportDates = (
|
|
80
|
-
config: TideClientConfig,
|
|
81
|
-
request: TransportDatesRequest,
|
|
82
|
-
signal?: AbortSignal
|
|
83
|
-
): Promise<TransportDatesResponse> => {
|
|
84
|
-
const url = `${config.host}${ENDPOINT_TRANSPORT_DATES}`;
|
|
85
|
-
const apiKey = config.apiKey;
|
|
86
|
-
const body = JSON.stringify(request);
|
|
87
|
-
|
|
88
|
-
return post(url, apiKey, body, config.token, signal, true);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const prices = (
|
|
92
|
-
config: TideClientConfig,
|
|
93
|
-
request: PricesRequest,
|
|
94
|
-
signal?: AbortSignal
|
|
95
|
-
): Promise<BasePrice[]> => {
|
|
96
|
-
const url = `${config.host}${ENDPOINT_PRICES}`;
|
|
97
|
-
const apiKey = config.apiKey;
|
|
98
|
-
const body = JSON.stringify(request);
|
|
99
|
-
|
|
100
|
-
return post(url, apiKey, body, config.token, signal, true);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export const availableCountries = (
|
|
104
|
-
config: TideClientConfig,
|
|
105
|
-
request: AvailableCountriesRequest,
|
|
106
|
-
signal?: AbortSignal
|
|
107
|
-
): Promise<AvailableCountry[]> => {
|
|
108
|
-
const url = `${config.host}${ENDPOINT_AVAILABLE_COUNTRIES}`;
|
|
109
|
-
const apiKey = config.apiKey;
|
|
110
|
-
const body = JSON.stringify(request);
|
|
111
|
-
|
|
112
|
-
return post(url, apiKey, body, config.token, signal, true);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
// PACKAGE SEARCH
|
|
116
|
-
export const search = (
|
|
117
|
-
config: TideClientConfig,
|
|
118
|
-
request: BookingPackageRequest<BookingPackageSearchRequest>,
|
|
119
|
-
signal?: AbortSignal
|
|
120
|
-
): Promise<BookingPackageItem[]> => {
|
|
121
|
-
const url = `${config.host}${ENDPOINT_SEARCH}`;
|
|
122
|
-
const apiKey = config.apiKey;
|
|
123
|
-
const body = JSON.stringify(request);
|
|
124
|
-
|
|
125
|
-
return post(url, apiKey, body, config.token, signal, true);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
export const searchWithErrorMapping = (
|
|
129
|
-
config: TideClientConfig,
|
|
130
|
-
request: BookingPackageRequest<BookingPackageSearchRequest>,
|
|
131
|
-
signal?: AbortSignal
|
|
132
|
-
): Promise<TideResponse<BookingPackageItem[]>> => {
|
|
133
|
-
const url = `${config.host}${ENDPOINT_SEARCH_WITH_ERROR_MAPPING}`;
|
|
134
|
-
const apiKey = config.apiKey;
|
|
135
|
-
const body = JSON.stringify(request);
|
|
136
|
-
|
|
137
|
-
return post(url, apiKey, body, config.token, signal, true);
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
export const details = (
|
|
141
|
-
config: TideClientConfig,
|
|
142
|
-
request: BookingPackageRequest<BookingPackageDetailsRequest>,
|
|
143
|
-
signal?: AbortSignal,
|
|
144
|
-
languageCode?: string
|
|
145
|
-
): Promise<TideResponse<BookingPackage>> => {
|
|
146
|
-
const url = `${config.host}${ENDPOINT_DETAILS}`;
|
|
147
|
-
const apiKey = config.apiKey;
|
|
148
|
-
const body = JSON.stringify(request);
|
|
149
|
-
|
|
150
|
-
return post(url, apiKey, body, config.token, signal, true, languageCode);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export const validateVoucher = (
|
|
154
|
-
config: TideClientConfig,
|
|
155
|
-
request: BookingPackageRequest<BookingPackageVoucherRequest>,
|
|
156
|
-
signal?: AbortSignal
|
|
157
|
-
): Promise<BookingVoucherResult> => {
|
|
158
|
-
const url = `${config.host}${ENDPOINT_VALIDATE_VOUCHER}`;
|
|
159
|
-
const apiKey = config.apiKey;
|
|
160
|
-
const body = JSON.stringify(request);
|
|
161
|
-
|
|
162
|
-
return post(url, apiKey, body, config.token, signal, true);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export const alternateHotels = (
|
|
166
|
-
config: TideClientConfig,
|
|
167
|
-
transactionId: string,
|
|
168
|
-
optionId: string,
|
|
169
|
-
signal?: AbortSignal
|
|
170
|
-
): Promise<BookingPackageHotelPool> => {
|
|
171
|
-
const url = `${config.host}${ENDPOINT_ALTERNATE_HOTELS(
|
|
172
|
-
transactionId,
|
|
173
|
-
optionId
|
|
174
|
-
)}`;
|
|
175
|
-
const apiKey = config.apiKey;
|
|
176
|
-
|
|
177
|
-
return get(url, apiKey, config.token, signal, true);
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
export const alternateFlights = (
|
|
181
|
-
config: TideClientConfig,
|
|
182
|
-
transactionId: string,
|
|
183
|
-
signal?: AbortSignal
|
|
184
|
-
): Promise<BookingPackageFlightPool> => {
|
|
185
|
-
const url = `${config.host}${ENDPOINT_ALTERNATE_FLIGHTS(transactionId)}`;
|
|
186
|
-
const apiKey = config.apiKey;
|
|
187
|
-
|
|
188
|
-
return get(url, apiKey, config.token, signal, true);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
export const bookableDates = (
|
|
192
|
-
config: TideClientConfig,
|
|
193
|
-
request: BookableDatesRequest,
|
|
194
|
-
signal?: AbortSignal
|
|
195
|
-
): Promise<BookableDates> => {
|
|
196
|
-
const url = `${config.host}${ENDPOINT_BOOKABLE_DATES}`;
|
|
197
|
-
const apiKey = config.apiKey;
|
|
198
|
-
const body = JSON.stringify(request);
|
|
199
|
-
|
|
200
|
-
return post(url, apiKey, body, config.token, signal, true);
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
export const priceDetails = (
|
|
204
|
-
config: TideClientConfig,
|
|
205
|
-
request: BookingPackageRequest<BookingPackageBookRequest>,
|
|
206
|
-
signal?: AbortSignal,
|
|
207
|
-
languageCode?: string
|
|
208
|
-
): Promise<BookingPriceDetails> => {
|
|
209
|
-
const url = `${config.host}${ENDPOINT_PRICE_DETAILS}`;
|
|
210
|
-
const apiKey = config.apiKey;
|
|
211
|
-
const body = JSON.stringify(request);
|
|
212
|
-
|
|
213
|
-
return post(url, apiKey, body, config.token, signal, true, languageCode);
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export const book = (
|
|
217
|
-
config: TideClientConfig,
|
|
218
|
-
request: BookingPackageRequest<BookingPackageBookRequest>,
|
|
219
|
-
signal?: AbortSignal,
|
|
220
|
-
languageCode?: string
|
|
221
|
-
): Promise<BookingPackageDossier> => {
|
|
222
|
-
const url = `${config.host}${ENDPOINT_BOOK}`;
|
|
223
|
-
const apiKey = config.apiKey;
|
|
224
|
-
const body = JSON.stringify(request);
|
|
225
|
-
|
|
226
|
-
return post(url, apiKey, body, config.token, signal, true, languageCode);
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
export const update = (
|
|
230
|
-
config: TideClientConfig,
|
|
231
|
-
request: BookingPackageRequest<BookingPackageUpdateRequest>,
|
|
232
|
-
signal?: AbortSignal
|
|
233
|
-
): Promise<BookingPackageDossier> => {
|
|
234
|
-
const url = `${config.host}${ENDPOINT_UPDATE}`;
|
|
235
|
-
const apiKey = config.apiKey;
|
|
236
|
-
const body = JSON.stringify(request);
|
|
237
|
-
|
|
238
|
-
return post(url, apiKey, body, config.token, signal, true);
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
export const agents = (
|
|
242
|
-
config: TideClientConfig,
|
|
243
|
-
signal?: AbortSignal
|
|
244
|
-
): Promise<BookingTravelAgent[]> => {
|
|
245
|
-
const url = `${config.host}${ENDPOINT_AGENTS}`;
|
|
246
|
-
const apiKey = config.apiKey;
|
|
247
|
-
|
|
248
|
-
return get(url, apiKey, config.token, signal, true);
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
export const getAllotmentAvailability = (
|
|
252
|
-
config: TideClientConfig,
|
|
253
|
-
eventId: string,
|
|
254
|
-
productCode: string,
|
|
255
|
-
signal?: AbortSignal
|
|
256
|
-
): Promise<BookingPackageAvailability[]> => {
|
|
257
|
-
const url = `${config.host}${ENDPOINT_AVAILABLE_ALLOTMENTS(
|
|
258
|
-
eventId,
|
|
259
|
-
productCode
|
|
260
|
-
)}`;
|
|
261
|
-
const apiKey = config.apiKey;
|
|
262
|
-
|
|
263
|
-
return get(url, apiKey, config.token, signal, true);
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
export const searchFlightPool = (
|
|
267
|
-
config: TideClientConfig,
|
|
268
|
-
request: BookingPackageRequest<BookingPackageFlightPoolRequest>,
|
|
269
|
-
signal?: AbortSignal
|
|
270
|
-
): Promise<BookingPackageFlightPool> => {
|
|
271
|
-
const url = `${config.host}${ENDPOINT_FLIGHT_POOL}`;
|
|
272
|
-
const apiKey = config.apiKey;
|
|
273
|
-
const body = JSON.stringify(request);
|
|
274
|
-
|
|
275
|
-
return post(url, apiKey, body, config.token, signal, true);
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
export const tourCodes = (
|
|
279
|
-
config: TideClientConfig,
|
|
280
|
-
request: TourCodesRequest,
|
|
281
|
-
signal?: AbortSignal
|
|
282
|
-
): Promise<TourCodesResponse> => {
|
|
283
|
-
const url = `${config.host}${ENDPOINT_TOUR_CODES}`;
|
|
284
|
-
const apiKey = config.apiKey;
|
|
285
|
-
const body = JSON.stringify(request);
|
|
286
|
-
|
|
287
|
-
return post(url, apiKey, body, config.token, signal, true);
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
export const setCustomEntryStatus = (
|
|
291
|
-
config: TideClientConfig,
|
|
292
|
-
dossierNumber: string,
|
|
293
|
-
customEntryStatusId: number,
|
|
294
|
-
signal?: AbortSignal
|
|
295
|
-
): Promise<BookingPackageAvailability[]> => {
|
|
296
|
-
const url = `${config.host}${ENDPOINT_CUSTOM_ENTRY_STATUS(
|
|
297
|
-
dossierNumber,
|
|
298
|
-
customEntryStatusId
|
|
299
|
-
)}`;
|
|
300
|
-
const apiKey = config.apiKey;
|
|
301
|
-
|
|
302
|
-
return get(url, apiKey, config.token, signal, true);
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
export const setEntryStatus = (
|
|
306
|
-
config: TideClientConfig,
|
|
307
|
-
dossierNumber: string,
|
|
308
|
-
entryStatus: EntryStatus,
|
|
309
|
-
signal?: AbortSignal
|
|
310
|
-
): Promise<BookingPackageAvailability[]> => {
|
|
311
|
-
const url = `${config.host}${ENDPOINT_ENTRY_STATUS(
|
|
312
|
-
dossierNumber,
|
|
313
|
-
entryStatus
|
|
314
|
-
)}`;
|
|
315
|
-
const apiKey = config.apiKey;
|
|
316
|
-
|
|
317
|
-
return patch(url, apiKey, null, config.token, signal, true);
|
|
318
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { post as apiPost, get as apiGet, patch as apiPatch } from "./api";
|
|
2
|
-
import { reviver } from "./json";
|
|
3
|
-
|
|
4
|
-
export const post = async <T>(
|
|
5
|
-
url: string,
|
|
6
|
-
apiKey: string,
|
|
7
|
-
body?: string | null,
|
|
8
|
-
token?: string,
|
|
9
|
-
signal?: AbortSignal,
|
|
10
|
-
skipReviver?: boolean,
|
|
11
|
-
languageCode?: string
|
|
12
|
-
): Promise<T> => {
|
|
13
|
-
const response = await apiPost(
|
|
14
|
-
url,
|
|
15
|
-
apiKey,
|
|
16
|
-
body,
|
|
17
|
-
token,
|
|
18
|
-
signal,
|
|
19
|
-
languageCode
|
|
20
|
-
);
|
|
21
|
-
const responseBody = await response.text();
|
|
22
|
-
|
|
23
|
-
if (!responseBody) {
|
|
24
|
-
return null as unknown as T;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const result: T = skipReviver
|
|
28
|
-
? JSON.parse(responseBody)
|
|
29
|
-
: JSON.parse(responseBody, reviver);
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const patch = async <T>(
|
|
34
|
-
url: string,
|
|
35
|
-
apiKey: string,
|
|
36
|
-
body?: string | null,
|
|
37
|
-
token?: string,
|
|
38
|
-
signal?: AbortSignal,
|
|
39
|
-
skipReviver?: boolean,
|
|
40
|
-
languageCode?: string
|
|
41
|
-
): Promise<T> => {
|
|
42
|
-
const response = await apiPatch(
|
|
43
|
-
url,
|
|
44
|
-
apiKey,
|
|
45
|
-
body,
|
|
46
|
-
token,
|
|
47
|
-
signal,
|
|
48
|
-
languageCode
|
|
49
|
-
);
|
|
50
|
-
const responseBody = await response.text();
|
|
51
|
-
|
|
52
|
-
if (!responseBody) {
|
|
53
|
-
return {} as T;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const result: T = skipReviver
|
|
57
|
-
? JSON.parse(responseBody)
|
|
58
|
-
: JSON.parse(responseBody, reviver);
|
|
59
|
-
return result;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const get = async <T>(
|
|
63
|
-
url: string,
|
|
64
|
-
apiKey: string,
|
|
65
|
-
token?: string,
|
|
66
|
-
signal?: AbortSignal,
|
|
67
|
-
skipReviver?: boolean,
|
|
68
|
-
languageCode?: string
|
|
69
|
-
): Promise<T> => {
|
|
70
|
-
const response = await apiGet(url, apiKey, token, signal, languageCode);
|
|
71
|
-
const responseBody = await response.text();
|
|
72
|
-
|
|
73
|
-
const result: T = skipReviver
|
|
74
|
-
? JSON.parse(responseBody)
|
|
75
|
-
: JSON.parse(responseBody, reviver);
|
|
76
|
-
return result;
|
|
77
|
-
};
|
package/src/utils/json.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import moment from "moment";
|
|
2
|
-
|
|
3
|
-
export const reviver = (_: any, value: any) => {
|
|
4
|
-
const formats = [moment.ISO_8601, "MM/DD/YYYY"];
|
|
5
|
-
if (typeof value === "string") {
|
|
6
|
-
if (moment(value, formats, true).isValid()) {
|
|
7
|
-
return new Date(value);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return value;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const replacer = (_: any, value: any) => {
|
|
14
|
-
if (typeof value === "string") {
|
|
15
|
-
if (Date.parse(value)) {
|
|
16
|
-
const date = new Date(value);
|
|
17
|
-
if (date.toISOString() === value) {
|
|
18
|
-
const year = date.getFullYear();
|
|
19
|
-
const month = date.getMonth() + 1;
|
|
20
|
-
const day = date.getDate();
|
|
21
|
-
return `${year}-${month}-${day}`;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return value;
|
|
26
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { TideClientConfig } from "..";
|
|
2
|
-
import {
|
|
3
|
-
MemberConfirmationRequest,
|
|
4
|
-
MemberForgotPasswordRequest,
|
|
5
|
-
MemberLoginRequest,
|
|
6
|
-
MemberLoginResponse,
|
|
7
|
-
MemberResetPasswordRequest,
|
|
8
|
-
} from "../types";
|
|
9
|
-
import { post } from "./common-client";
|
|
10
|
-
import { post as apiPost } from "./api";
|
|
11
|
-
|
|
12
|
-
const ENDPOINT = "/api/member";
|
|
13
|
-
const ENDPOINT_LOGIN = `${ENDPOINT}/login`;
|
|
14
|
-
const ENDPOINT_LOGOUT = `${ENDPOINT}/logout`;
|
|
15
|
-
const ENDPOINT_CONFIRM = `${ENDPOINT}/confirm`;
|
|
16
|
-
const ENDPOINT_FORGOT_PASSWORD = `${ENDPOINT}/forgot-password`;
|
|
17
|
-
const ENDPOINT_RESET_PASSWORD = `${ENDPOINT}/reset-password`;
|
|
18
|
-
|
|
19
|
-
export const login = (
|
|
20
|
-
config: TideClientConfig,
|
|
21
|
-
request: MemberLoginRequest,
|
|
22
|
-
signal?: AbortSignal
|
|
23
|
-
): Promise<MemberLoginResponse> => {
|
|
24
|
-
const url = `${config.host}${ENDPOINT_LOGIN}`;
|
|
25
|
-
const apiKey = config.apiKey;
|
|
26
|
-
const body = JSON.stringify(request);
|
|
27
|
-
|
|
28
|
-
return post(url, apiKey, body, config.token, signal);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const logout = (
|
|
32
|
-
config: TideClientConfig,
|
|
33
|
-
signal?: AbortSignal
|
|
34
|
-
): Promise<Response> => {
|
|
35
|
-
const url = `${config.host}${ENDPOINT_LOGOUT}`;
|
|
36
|
-
const apiKey = config.apiKey;
|
|
37
|
-
const body = "";
|
|
38
|
-
|
|
39
|
-
return apiPost(url, apiKey, body, config.token, signal);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const confirm = (
|
|
43
|
-
config: TideClientConfig,
|
|
44
|
-
request: MemberConfirmationRequest,
|
|
45
|
-
signal?: AbortSignal
|
|
46
|
-
): Promise<Response> => {
|
|
47
|
-
const url = `${config.host}${ENDPOINT_CONFIRM}`;
|
|
48
|
-
const apiKey = config.apiKey;
|
|
49
|
-
const body = JSON.stringify(request);
|
|
50
|
-
|
|
51
|
-
return apiPost(url, apiKey, body, config.token, signal);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const forgotPassword = (
|
|
55
|
-
config: TideClientConfig,
|
|
56
|
-
request: MemberForgotPasswordRequest,
|
|
57
|
-
signal?: AbortSignal
|
|
58
|
-
): Promise<Response> => {
|
|
59
|
-
const url = `${config.host}${ENDPOINT_FORGOT_PASSWORD}`;
|
|
60
|
-
const apiKey = config.apiKey;
|
|
61
|
-
const body = JSON.stringify(request);
|
|
62
|
-
|
|
63
|
-
return apiPost(url, apiKey, body, config.token, signal);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const resetPassword = (
|
|
67
|
-
config: TideClientConfig,
|
|
68
|
-
request: MemberResetPasswordRequest,
|
|
69
|
-
signal?: AbortSignal
|
|
70
|
-
): Promise<Response> => {
|
|
71
|
-
const url = `${config.host}${ENDPOINT_RESET_PASSWORD}`;
|
|
72
|
-
const apiKey = config.apiKey;
|
|
73
|
-
const body = JSON.stringify(request);
|
|
74
|
-
|
|
75
|
-
return apiPost(url, apiKey, body, config.token, signal);
|
|
76
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MolliePayment,
|
|
3
|
-
MolliePaymentRequest,
|
|
4
|
-
TideClientConfig,
|
|
5
|
-
} from "../types";
|
|
6
|
-
|
|
7
|
-
import { post } from "./common-client";
|
|
8
|
-
|
|
9
|
-
const ENDPOINT = "/api/mollie";
|
|
10
|
-
const ENDPOINT_CREATE_PAYMENTS = `${ENDPOINT}/create-payment`;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* api/mollie/create-payment
|
|
14
|
-
* @param request
|
|
15
|
-
* @returns mollie payment url
|
|
16
|
-
*/
|
|
17
|
-
export const getMolliePayment = (
|
|
18
|
-
config: TideClientConfig,
|
|
19
|
-
request: MolliePaymentRequest,
|
|
20
|
-
signal?: AbortSignal
|
|
21
|
-
): Promise<MolliePayment> => {
|
|
22
|
-
const url = `${config.host}${ENDPOINT_CREATE_PAYMENTS}`;
|
|
23
|
-
const apiKey = config.apiKey;
|
|
24
|
-
const body = JSON.stringify(request);
|
|
25
|
-
|
|
26
|
-
return post(url, apiKey, body, config.token, signal);
|
|
27
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Airport, CountryItem, PageResult, TideClientConfig } from "../types";
|
|
2
|
-
import { get } from "./common-client";
|
|
3
|
-
|
|
4
|
-
const ENDPOINT = "/api/web/search";
|
|
5
|
-
const ENDPOINT_COUNTRIES = `${ENDPOINT}/countries`;
|
|
6
|
-
const ENDPOINT_AIRPORTS = `${ENDPOINT}/airports`;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* api/search/countries
|
|
10
|
-
* Gets all Countries
|
|
11
|
-
* @param config
|
|
12
|
-
* @param signal
|
|
13
|
-
* @returns OK if succeeded.
|
|
14
|
-
*/
|
|
15
|
-
export const getCountries = (
|
|
16
|
-
config: TideClientConfig,
|
|
17
|
-
signal?: AbortSignal
|
|
18
|
-
): Promise<PageResult<CountryItem>> => {
|
|
19
|
-
const url = `${config.host}${ENDPOINT_COUNTRIES}`;
|
|
20
|
-
const apiKey = config.apiKey;
|
|
21
|
-
|
|
22
|
-
return get(url, apiKey, config.token, signal, true);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const getAirports = (
|
|
26
|
-
config: TideClientConfig,
|
|
27
|
-
signal?: AbortSignal
|
|
28
|
-
): Promise<Airport> => {
|
|
29
|
-
const url = `${config.host}${ENDPOINT_AIRPORTS}`;
|
|
30
|
-
const apiKey = config.apiKey;
|
|
31
|
-
|
|
32
|
-
return get(url, apiKey, config.token, signal, true);
|
|
33
|
-
};
|