@duffel/api 4.21.5 → 4.22.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.
Files changed (39) hide show
  1. package/dist/Cars/Bookings/Bookings.d.ts +45 -0
  2. package/dist/Cars/Bookings/Bookings.spec.d.ts +1 -0
  3. package/dist/Cars/Bookings/index.d.ts +1 -0
  4. package/dist/Cars/Cars.d.ts +20 -0
  5. package/dist/Cars/Cars.spec.d.ts +1 -0
  6. package/dist/Cars/CarsTypes.d.ts +185 -0
  7. package/dist/Cars/Quotes/Quotes.d.ts +16 -0
  8. package/dist/Cars/Quotes/Quotes.spec.d.ts +1 -0
  9. package/dist/Cars/Quotes/index.d.ts +1 -0
  10. package/dist/Cars/mocks.d.ts +17 -0
  11. package/dist/DuffelPayments/PaymentIntents/mockPaymentIntents.d.ts +3 -0
  12. package/dist/DuffelPayments/Refunds/mockRefunds.d.ts +2 -0
  13. package/dist/Places/Suggestions/mockSuggestions.d.ts +2 -0
  14. package/dist/Stays/mocks.d.ts +11 -0
  15. package/dist/booking/AirlineInitiatedChanges/mockAirlineInitiatedChanges.d.ts +3 -0
  16. package/dist/booking/BatchOfferRequests/mockBatchOfferRequest.d.ts +4 -0
  17. package/dist/booking/Identity/ComponentClientKey/mockComponentClientKey.d.ts +2 -0
  18. package/dist/booking/OfferRequests/mockOfferRequest.d.ts +3 -0
  19. package/dist/booking/Offers/mockOffer.d.ts +14 -0
  20. package/dist/booking/Offers/mockPartialOffer.d.ts +13 -0
  21. package/dist/booking/OrderCancellations/mockOrderCancellations.d.ts +2 -0
  22. package/dist/booking/OrderChangeOffers/OrderChangeOfferTypes.d.ts +10 -0
  23. package/dist/booking/OrderChangeOffers/mockOrderChangeOffer.d.ts +2 -0
  24. package/dist/booking/OrderChangeRequests/mockOrderChangeRequests.d.ts +4 -0
  25. package/dist/booking/OrderChanges/mockOrderChanges.d.ts +2 -0
  26. package/dist/booking/Orders/mockOrders.d.ts +6 -0
  27. package/dist/booking/PartialOfferRequests/mockPartialOfferRequest.d.ts +3 -0
  28. package/dist/booking/Payments/mockPayment.d.ts +2 -0
  29. package/dist/booking/SeatMaps/mockSeatMap.d.ts +2 -0
  30. package/dist/index.es.js +1 -1
  31. package/dist/index.es.js.map +1 -1
  32. package/dist/index.js +1 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/notifications/Webhooks/mockWebhooks.d.ts +24 -0
  35. package/dist/supportingResources/Aircraft/mockAircraft.d.ts +2 -0
  36. package/dist/supportingResources/Airlines/mockAirline.d.ts +2 -0
  37. package/dist/supportingResources/Airports/mockAirport.d.ts +2 -0
  38. package/dist/typings.d.ts +299 -0
  39. package/package.json +8 -7
package/dist/typings.d.ts CHANGED
@@ -12,6 +12,7 @@ declare module '@duffel/api' {
12
12
  import { Sessions } from '@duffel/api/Links';
13
13
  import { Webhooks } from '@duffel/api/notifications';
14
14
  import { Stays } from '@duffel/api/Stays/Stays';
15
+ import { Cars } from '@duffel/api/Cars/Cars';
15
16
  import { Cards } from '@duffel/api/Payments/Cards';
16
17
  import { ThreeDSecureSessions } from '@duffel/api/Payments/ThreeDSecureSessions';
17
18
  import { Identity } from '@duffel/api/Identity/Identity';
@@ -55,6 +56,7 @@ declare module '@duffel/api' {
55
56
  refunds: Refunds;
56
57
  webhooks: Webhooks;
57
58
  stays: Stays;
59
+ cars: Cars;
58
60
  three_d_secure_sessions: ThreeDSecureSessions;
59
61
  identity: Identity;
60
62
  cards: Cards;
@@ -174,6 +176,29 @@ declare module '@duffel/api/Stays/Stays' {
174
176
  }
175
177
  }
176
178
 
179
+ declare module '@duffel/api/Cars/Cars' {
180
+ import { Client } from '@duffel/api/Client';
181
+ import { CarsSearchParams, CarsSearch } from '@duffel/api/Cars/CarsTypes';
182
+ import { Resource } from '@duffel/api/Resource';
183
+ import { DuffelResponse } from '@duffel/api/types';
184
+ import { Bookings } from '@duffel/api/Cars/Bookings';
185
+ import { Quotes } from '@duffel/api/Cars/Quotes';
186
+ export class Cars extends Resource {
187
+ /**
188
+ * Endpoint path
189
+ */
190
+ path: string;
191
+ bookings: Bookings;
192
+ quotes: Quotes;
193
+ constructor(client: Client);
194
+ /**
195
+ * Search for available rental cars
196
+ * @param {object} params - The search parameters
197
+ */
198
+ search: (params: CarsSearchParams) => Promise<DuffelResponse<CarsSearch>>;
199
+ }
200
+ }
201
+
177
202
  declare module '@duffel/api/Payments/Cards' {
178
203
  export * from '@duffel/api/Payments/Cards/Cards';
179
204
  }
@@ -270,6 +295,7 @@ declare module '@duffel/api/types' {
270
295
  export * from '@duffel/api/DuffelPayments/PaymentIntents/PaymentIntentsType';
271
296
  export * from '@duffel/api/Places/Suggestions/SuggestionsType';
272
297
  export * from '@duffel/api/Stays/StaysTypes';
298
+ export * from '@duffel/api/Cars/CarsTypes';
273
299
  export * from '@duffel/api/booking/AirlineInitiatedChanges/AirlineInitiatedChangesTypes';
274
300
  export * from '@duffel/api/booking/OfferRequests/OfferRequestsTypes';
275
301
  export * from '@duffel/api/booking/BatchOfferRequests/BatchOfferRequestsTypes';
@@ -1046,6 +1072,202 @@ declare module '@duffel/api/Stays/SearchResults' {
1046
1072
  export * from '@duffel/api/Stays/SearchResults/SearchResults';
1047
1073
  }
1048
1074
 
1075
+ declare module '@duffel/api/Cars/CarsTypes' {
1076
+ export interface CarsGeographicCoordinates {
1077
+ latitude: number;
1078
+ longitude: number;
1079
+ }
1080
+ export interface CarsSearchLocation {
1081
+ radius?: number;
1082
+ geographic_coordinates: CarsGeographicCoordinates;
1083
+ }
1084
+ export interface CarsSearchDriver {
1085
+ age: number;
1086
+ residence_country_code: string;
1087
+ }
1088
+ export interface CarsSearchParams {
1089
+ pickup_date: string;
1090
+ pickup_time: string;
1091
+ dropoff_date: string;
1092
+ dropoff_time: string;
1093
+ pickup_location: CarsSearchLocation;
1094
+ dropoff_location: CarsSearchLocation;
1095
+ driver: CarsSearchDriver;
1096
+ }
1097
+ export type CarsPaymentType = 'postpaid' | 'guarantee' | 'prepaid';
1098
+ export type CarsMileageUnit = 'kilometres' | 'miles';
1099
+ export type CarsMileage = {
1100
+ type: 'unlimited';
1101
+ } | {
1102
+ type: 'limited';
1103
+ unit: CarsMileageUnit;
1104
+ limit: number;
1105
+ };
1106
+ export interface CarsSupplier {
1107
+ name: string;
1108
+ logo_url: string | null;
1109
+ }
1110
+ export type CarsCategory = 'mini' | 'mini_elite' | 'economy' | 'economy_elite' | 'compact' | 'compact_elite' | 'intermediate' | 'intermediate_elite' | 'standard' | 'standard_elite' | 'fullsize' | 'fullsize_elite' | 'premium' | 'premium_elite' | 'luxury' | 'luxury_elite' | 'special';
1111
+ export type CarsVehicleType = 'two_door' | 'two_or_four_door' | 'four_door' | 'wagon_estate' | 'passenger_van' | 'limousine' | 'sport' | 'convertible' | 'suv' | 'open_air_all_terrain' | 'special' | 'pickup_regular_cab' | 'pickup_extended_cab' | 'special_offer_car' | 'coupe' | 'monospace' | 'recreational_vehicle' | 'two_wheel_vehicle';
1112
+ export type CarsTransmission = 'manual' | 'automatic';
1113
+ export type CarsFuel = 'unspecified_fuel' | 'diesel' | 'hybrid' | 'electric' | 'lpg' | 'hydrogen' | 'multi_fuel' | 'petrol';
1114
+ export interface CarsBaggage {
1115
+ large: number;
1116
+ small: number;
1117
+ }
1118
+ export interface CarsImage {
1119
+ url: string;
1120
+ }
1121
+ export interface Car {
1122
+ name: string;
1123
+ /**
1124
+ * The ACRISS or SIPP code for this car. A four-letter code describing the car's attributes.
1125
+ */
1126
+ code: string;
1127
+ category: CarsCategory;
1128
+ type: CarsVehicleType;
1129
+ transmission: CarsTransmission;
1130
+ fuel: CarsFuel;
1131
+ air_conditioning: boolean;
1132
+ max_passengers: number | null;
1133
+ baggage: CarsBaggage | null;
1134
+ images: CarsImage[] | null;
1135
+ }
1136
+ export type CarsLocationAccess = 'in_terminal' | 'shuttle' | 'meet_and_greet' | 'call_for_pickup';
1137
+ export interface CarsLocationAdditionalInformation {
1138
+ title: string;
1139
+ text: string;
1140
+ }
1141
+ export interface CarsLocationOpeningHours {
1142
+ from: string;
1143
+ to: string;
1144
+ }
1145
+ export interface CarsLocationAddress {
1146
+ line_one: string | null;
1147
+ city_name: string | null;
1148
+ postal_code: string | null;
1149
+ region: string | null;
1150
+ country_code: string;
1151
+ }
1152
+ export interface CarsLocation {
1153
+ name: string;
1154
+ geographic_coordinates: CarsGeographicCoordinates;
1155
+ address: CarsLocationAddress;
1156
+ phone_number: string | null;
1157
+ access: CarsLocationAccess | null;
1158
+ additional_information: CarsLocationAdditionalInformation[];
1159
+ opening_hours: CarsLocationOpeningHours[];
1160
+ }
1161
+ export interface CarsRate {
1162
+ id: string;
1163
+ base_amount: string | null;
1164
+ base_currency: string | null;
1165
+ total_amount: string;
1166
+ total_currency: string;
1167
+ payment_type: CarsPaymentType;
1168
+ mileage: CarsMileage;
1169
+ supplier: CarsSupplier;
1170
+ car: Car;
1171
+ pickup_location: CarsLocation;
1172
+ dropoff_location: CarsLocation;
1173
+ }
1174
+ export interface CarsSearch {
1175
+ id: string;
1176
+ live_mode: boolean;
1177
+ created_at: string;
1178
+ pickup_date: string;
1179
+ pickup_time: string;
1180
+ dropoff_date: string;
1181
+ dropoff_time: string;
1182
+ pickup_location: CarsSearchLocation;
1183
+ dropoff_location: CarsSearchLocation;
1184
+ driver: CarsSearchDriver;
1185
+ rates: CarsRate[];
1186
+ }
1187
+ export interface CarsCharge {
1188
+ amount: string;
1189
+ currency: string;
1190
+ description: string | null;
1191
+ }
1192
+ export interface CarsCondition {
1193
+ title: string;
1194
+ text: string;
1195
+ }
1196
+ export interface CarsPrivacyPolicy {
1197
+ title: string;
1198
+ text: string;
1199
+ }
1200
+ export interface CarsQuote {
1201
+ id: string;
1202
+ live_mode: boolean;
1203
+ rate_id: string;
1204
+ search_id: string;
1205
+ base_amount: string | null;
1206
+ base_currency: string;
1207
+ total_amount: string;
1208
+ total_currency: string;
1209
+ charges: CarsCharge[] | null;
1210
+ payment_type: CarsPaymentType;
1211
+ mileage: CarsMileage;
1212
+ supplier: CarsSupplier;
1213
+ car: Car;
1214
+ conditions: CarsCondition[];
1215
+ privacy_policies: CarsPrivacyPolicy[] | null;
1216
+ pickup_location: CarsLocation;
1217
+ dropoff_location: CarsLocation;
1218
+ pickup_date: string;
1219
+ pickup_time: string;
1220
+ dropoff_date: string;
1221
+ dropoff_time: string;
1222
+ }
1223
+ export type CarsBookingStatus = 'confirmed' | 'cancelled';
1224
+ export interface CarsBookingDriver {
1225
+ given_name: string;
1226
+ family_name: string;
1227
+ date_of_birth: string;
1228
+ email: string;
1229
+ phone_number: string;
1230
+ user_id: string | null;
1231
+ }
1232
+ export interface CarsBooking {
1233
+ id: string;
1234
+ live_mode: boolean;
1235
+ reference: string;
1236
+ confirmed_at: string | null;
1237
+ cancelled_at: string | null;
1238
+ status: CarsBookingStatus;
1239
+ driver: CarsBookingDriver;
1240
+ quote_id: string;
1241
+ base_amount: string | null;
1242
+ base_currency: string;
1243
+ total_amount: string;
1244
+ total_currency: string;
1245
+ charges: CarsCharge[] | null;
1246
+ payment_type: CarsPaymentType;
1247
+ mileage: CarsMileage;
1248
+ supplier: CarsSupplier;
1249
+ metadata: Record<string, string> | null;
1250
+ users: string[];
1251
+ car: Car;
1252
+ conditions: CarsCondition[];
1253
+ privacy_policies: CarsPrivacyPolicy[] | null;
1254
+ pickup_location: CarsLocation;
1255
+ dropoff_location: CarsLocation;
1256
+ pickup_date: string;
1257
+ pickup_time: string;
1258
+ dropoff_date: string;
1259
+ dropoff_time: string;
1260
+ }
1261
+ }
1262
+
1263
+ declare module '@duffel/api/Cars/Bookings' {
1264
+ export * from '@duffel/api/Cars/Bookings/Bookings';
1265
+ }
1266
+
1267
+ declare module '@duffel/api/Cars/Quotes' {
1268
+ export * from '@duffel/api/Cars/Quotes/Quotes';
1269
+ }
1270
+
1049
1271
  declare module '@duffel/api/Payments/Cards/Cards' {
1050
1272
  import { Client } from '@duffel/api/Client';
1051
1273
  import { Resource } from '@duffel/api/Resource';
@@ -3234,6 +3456,16 @@ declare module '@duffel/api/booking/OrderChangeOffers/OrderChangeOfferTypes' {
3234
3456
  * The duration of the slice, represented as a [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) duration
3235
3457
  */
3236
3458
  duration?: string | null;
3459
+ /**
3460
+ * The name of the fare brand associated with this slice.
3461
+ * A fare brand specifies the travel conditions you get on your slice made available
3462
+ * by the airline. e.g. a British Airways Economy Basic fare will only include a hand baggage allowance.
3463
+ * It is worth noting that the fare brand names are defined by the airlines themselves and therefore they
3464
+ * are subject to change without any prior notice. We're in the process of adding support for fare_brand_name across
3465
+ * all our airlines, so for now, this field may be null in some offers.
3466
+ * This will become a non-nullable attribute in the near future.
3467
+ */
3468
+ fare_brand_name: string | null;
3237
3469
  /**
3238
3470
  * Duffel's unique identifier for the slice. It identifies the slice of an order (i.e. the same slice across orders will have different `id`s.
3239
3471
  */
@@ -5565,6 +5797,73 @@ declare module '@duffel/api/Stays/SearchResults/SearchResults' {
5565
5797
  }
5566
5798
  }
5567
5799
 
5800
+ declare module '@duffel/api/Cars/Bookings/Bookings' {
5801
+ import { Client } from '@duffel/api/Client';
5802
+ import { CarsBooking } from '@duffel/api/Cars/CarsTypes';
5803
+ import { Resource } from '@duffel/api/Resource';
5804
+ import { DuffelResponse } from '@duffel/api/types';
5805
+ export interface CarsBookingPayload {
5806
+ quote_id: string;
5807
+ driver: {
5808
+ given_name: string;
5809
+ family_name: string;
5810
+ email: string;
5811
+ phone_number: string;
5812
+ date_of_birth: string;
5813
+ user_id?: string;
5814
+ };
5815
+ inbound_flight_number?: string;
5816
+ supplier_loyalty_programme_account_number?: string;
5817
+ payment?: {
5818
+ method: 'card';
5819
+ card_id: string;
5820
+ };
5821
+ metadata?: Record<string, string>;
5822
+ users?: string[];
5823
+ }
5824
+ export class Bookings extends Resource {
5825
+ /**
5826
+ * Endpoint path
5827
+ */
5828
+ path: string;
5829
+ constructor(client: Client);
5830
+ /**
5831
+ * Create a booking from a quote
5832
+ * @param {object} payload - The booking payload, including quote id and driver information
5833
+ */
5834
+ create: (payload: CarsBookingPayload) => Promise<DuffelResponse<CarsBooking>>;
5835
+ /**
5836
+ * Get a booking by ID
5837
+ * @param {string} bookingId - The ID of the booking
5838
+ */
5839
+ get: (bookingId: string) => Promise<DuffelResponse<CarsBooking>>;
5840
+ /**
5841
+ * Cancel a booking
5842
+ * @param {string} bookingId - The ID of the booking to cancel
5843
+ */
5844
+ cancel: (bookingId: string) => Promise<DuffelResponse<CarsBooking>>;
5845
+ }
5846
+ }
5847
+
5848
+ declare module '@duffel/api/Cars/Quotes/Quotes' {
5849
+ import { Client } from '@duffel/api/Client';
5850
+ import { CarsQuote } from '@duffel/api/Cars/CarsTypes';
5851
+ import { Resource } from '@duffel/api/Resource';
5852
+ import { DuffelResponse } from '@duffel/api/types';
5853
+ export class Quotes extends Resource {
5854
+ /**
5855
+ * Endpoint path
5856
+ */
5857
+ path: string;
5858
+ constructor(client: Client);
5859
+ /**
5860
+ * Create a quote for the selected rate
5861
+ * @param {string} rateId - The ID of the rate to create a quote for
5862
+ */
5863
+ create: (rateId: string) => Promise<DuffelResponse<CarsQuote>>;
5864
+ }
5865
+ }
5866
+
5568
5867
  declare module '@duffel/api/booking/Identity/ComponentClientKey/ComponentClientKeys' {
5569
5868
  import { Resource } from '@duffel/api/Resource';
5570
5869
  import { type DuffelResponse } from '@duffel/api/types/ClientType';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duffel/api",
3
- "version": "4.21.5",
3
+ "version": "4.22.0",
4
4
  "description": "Javascript client library for the Duffel API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -64,14 +64,16 @@
64
64
  "node-fetch": "2.7.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@babel/core": "7.28.5",
68
- "@babel/preset-env": "7.28.5",
67
+ "@babel/core": "7.29.0",
68
+ "@babel/preset-env": "7.29.0",
69
69
  "@babel/preset-typescript": "7.28.5",
70
70
  "@commitlint/cli": "17.8.1",
71
71
  "@commitlint/config-angular": "17.8.1",
72
72
  "@commitlint/cz-commitlint": "17.8.1",
73
73
  "@rollup/plugin-commonjs": "25.0.8",
74
74
  "@rollup/plugin-node-resolve": "15.3.1",
75
+ "@rollup/plugin-terser": "0.4.4",
76
+ "@rollup/plugin-typescript": "^12.3.0",
75
77
  "@types/jest": "29.5.14",
76
78
  "@typescript-eslint/eslint-plugin": "6.7.5",
77
79
  "@typescript-eslint/parser": "6.7.5",
@@ -86,12 +88,10 @@
86
88
  "lint-staged": "15.5.2",
87
89
  "nock": "13.5.6",
88
90
  "prettier": "3.5.3",
89
- "rollup": "4.22.4",
91
+ "rollup": "3",
90
92
  "rollup-plugin-dts-bundle": "^1.0.0",
91
93
  "rollup-plugin-inject-process-env": "1.3.1",
92
94
  "rollup-plugin-peer-deps-external": "2.2.4",
93
- "@rollup/plugin-terser": "0.4.4",
94
- "rollup-plugin-typescript2": "0.36.0",
95
95
  "semantic-release": "22.0.12",
96
96
  "ts-jest": "29.4.6",
97
97
  "ts-node": "10.9.2",
@@ -120,5 +120,6 @@
120
120
  "branches": [
121
121
  "main"
122
122
  ]
123
- }
123
+ },
124
+ "packageManager": "yarn@4.12.0+sha512.f45ab632439a67f8bc759bf32ead036a1f413287b9042726b7cc4818b7b49e14e9423ba49b18f9e06ea4941c1ad062385b1d8760a8d5091a1a31e5f6219afca8"
124
125
  }