@duffel/api 4.25.0 → 4.27.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.
package/dist/typings.d.ts CHANGED
@@ -154,6 +154,7 @@ declare module '@duffel/api/Stays/Stays' {
154
154
  import { Brands } from '@duffel/api/Stays/Brands';
155
155
  import { LoyaltyProgrammes } from '@duffel/api/Stays/LoyaltyProgrammes';
156
156
  import { Bookings } from '@duffel/api/Stays/Bookings';
157
+ import { NegotiatedRates } from '@duffel/api/Stays/NegotiatedRates';
157
158
  import { Quotes } from '@duffel/api/Stays/Quotes';
158
159
  import { SearchResults } from '@duffel/api/Stays/SearchResults';
159
160
  export class Stays extends Resource {
@@ -164,6 +165,7 @@ declare module '@duffel/api/Stays/Stays' {
164
165
  accommodation: Accommodation;
165
166
  loyaltyProgrammes: LoyaltyProgrammes;
166
167
  brands: Brands;
168
+ negotiatedRates: NegotiatedRates;
167
169
  searchResults: SearchResults;
168
170
  quotes: Quotes;
169
171
  bookings: Bookings;
@@ -617,7 +619,11 @@ declare module '@duffel/api/Stays/StaysTypes' {
617
619
  }
618
620
  export interface StaysChain {
619
621
  /**
620
- * The hotel chain’s name
622
+ * Duffel ID for this chain
623
+ */
624
+ id: string;
625
+ /**
626
+ * The hotel chain's name
621
627
  */
622
628
  name: string;
623
629
  }
@@ -1040,6 +1046,130 @@ declare module '@duffel/api/Stays/StaysTypes' {
1040
1046
  */
1041
1047
  user_id?: string;
1042
1048
  };
1049
+ /**
1050
+ * A negotiated rate that enables passing rate access codes for stays accommodation.
1051
+ * Can be associated with either a chain or specific accommodations, but not both.
1052
+ */
1053
+ export interface StaysNegotiatedRate {
1054
+ /**
1055
+ * The ID of the Negotiated Rate
1056
+ *
1057
+ * Example: "nre_0000AvtkNoC81yBytDM9PE"
1058
+ */
1059
+ id: string;
1060
+ /**
1061
+ * The rate access code to be utilised when using this negotiated rate
1062
+ *
1063
+ * Example: "DUFFEL"
1064
+ */
1065
+ rate_access_code: string;
1066
+ /**
1067
+ * The display name of the negotiated rate
1068
+ *
1069
+ * Example: "2025 Negotiated Rate"
1070
+ */
1071
+ display_name: string;
1072
+ /**
1073
+ * Whether this negotiated rate is for live mode. When false, it is for test mode
1074
+ *
1075
+ * Example: false
1076
+ */
1077
+ live_mode: boolean;
1078
+ /**
1079
+ * The ID of the hotel chain this negotiated rate is valid for.
1080
+ * Mutually exclusive with accommodation_ids.
1081
+ *
1082
+ * Example: "chn_0000B6QFxO9EOY5cqw5kYK"
1083
+ */
1084
+ chain_id: string | null;
1085
+ /**
1086
+ * The accommodation ids this negotiated rate is valid for use with.
1087
+ * Mutually exclusive with chain_id.
1088
+ *
1089
+ * Example: ["acc_0000AWr2VsUNIF1Vl91xg0"]
1090
+ */
1091
+ accommodation_ids: string[] | null;
1092
+ }
1093
+ /**
1094
+ * Payload for creating a negotiated rate associated with a chain.
1095
+ * You must provide either chain_id or accommodation_ids, but not both.
1096
+ */
1097
+ export interface StaysNegotiatedRateCreatePayloadWithChain {
1098
+ /**
1099
+ * The rate access code to be utilised when using this negotiated rate
1100
+ *
1101
+ * Example: "DUFFEL"
1102
+ */
1103
+ rate_access_code: string;
1104
+ /**
1105
+ * The display name of the negotiated rate
1106
+ *
1107
+ * Example: "2025 Negotiated Rate"
1108
+ */
1109
+ display_name: string;
1110
+ /**
1111
+ * The ID of the hotel chain this negotiated rate is valid for
1112
+ *
1113
+ * Example: "chn_0000B6QFxO9EOY5cqw5kYK"
1114
+ */
1115
+ chain_id: string;
1116
+ }
1117
+ /**
1118
+ * Payload for creating a negotiated rate associated with accommodations.
1119
+ * You must provide either chain_id or accommodation_ids, but not both.
1120
+ */
1121
+ export interface StaysNegotiatedRateCreatePayloadWithAccommodations {
1122
+ /**
1123
+ * The rate access code to be utilised when using this negotiated rate
1124
+ *
1125
+ * Example: "DUFFEL"
1126
+ */
1127
+ rate_access_code: string;
1128
+ /**
1129
+ * The display name of the negotiated rate
1130
+ *
1131
+ * Example: "2025 Negotiated Rate"
1132
+ */
1133
+ display_name: string;
1134
+ /**
1135
+ * The accommodation ids this negotiated rate is valid for use with
1136
+ *
1137
+ * Example: ["acc_0000AWr2VsUNIF1Vl91xg0"]
1138
+ */
1139
+ accommodation_ids: string[];
1140
+ }
1141
+ /**
1142
+ * Payload for creating a negotiated rate.
1143
+ * You must provide either chain_id or accommodation_ids, but not both.
1144
+ */
1145
+ export type StaysNegotiatedRateCreatePayload = StaysNegotiatedRateCreatePayloadWithChain | StaysNegotiatedRateCreatePayloadWithAccommodations;
1146
+ /**
1147
+ * Payload for updating a negotiated rate.
1148
+ * You can update the display_name and change the association to chain_id or accommodation_ids.
1149
+ * If updating the association, you must provide only one of chain_id or accommodation_ids.
1150
+ */
1151
+ export interface StaysNegotiatedRateUpdatePayload {
1152
+ /**
1153
+ * The display name of the negotiated rate
1154
+ *
1155
+ * Example: "2025 Negotiated Rate"
1156
+ */
1157
+ display_name?: string;
1158
+ /**
1159
+ * The ID of the hotel chain this negotiated rate is valid for.
1160
+ * Setting this will remove any existing accommodation_ids association.
1161
+ *
1162
+ * Example: "chn_0000B6QFxO9EOY5cqw5kYK"
1163
+ */
1164
+ chain_id?: string;
1165
+ /**
1166
+ * The accommodation ids this negotiated rate is valid for use with.
1167
+ * Setting this will remove any existing chain_id association.
1168
+ *
1169
+ * Example: ["acc_0000AWr2VsUNIF1Vl91xg0"]
1170
+ */
1171
+ accommodation_ids?: string[];
1172
+ }
1043
1173
  export {};
1044
1174
  }
1045
1175
 
@@ -1077,6 +1207,10 @@ declare module '@duffel/api/Stays/Bookings' {
1077
1207
  export * from '@duffel/api/Stays/Bookings/Bookings';
1078
1208
  }
1079
1209
 
1210
+ declare module '@duffel/api/Stays/NegotiatedRates' {
1211
+ export * from '@duffel/api/Stays/NegotiatedRates/NegotiatedRates';
1212
+ }
1213
+
1080
1214
  declare module '@duffel/api/Stays/Quotes' {
1081
1215
  export * from '@duffel/api/Stays/Quotes/Quotes';
1082
1216
  }
@@ -1635,7 +1769,7 @@ declare module '@duffel/api/booking/BatchOfferRequests/BatchOfferRequests' {
1635
1769
  declare module '@duffel/api/booking/OfferRequests/OfferRequests' {
1636
1770
  import { Client } from '@duffel/api/Client';
1637
1771
  import { Resource } from '@duffel/api/Resource';
1638
- import { CreateOfferRequest, CreateOfferRequestQueryParameters, DuffelResponse, OfferRequest, PaginationMeta } from '@duffel/api/types';
1772
+ import { CreateOfferRequest, CreateOfferRequestQueryParameters, DuffelResponse, OfferRequest, OfferRequestItinerariesView, PaginationMeta } from '@duffel/api/types';
1639
1773
  /**
1640
1774
  * To search for flights, you'll need to create an `offer request`.
1641
1775
  * An offer request describes the passengers and where and when they want to travel (in the form of a list of `slices`).
@@ -1670,12 +1804,17 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequests' {
1670
1804
  * To search for flights, you'll need to create an `offer request`.
1671
1805
  * An offer request describes the passengers and where and when they want to travel (in the form of a list of `slices`).
1672
1806
  * It may also include additional filters (e.g. a particular cabin to travel in).
1673
- * @param {Object} [options] - the parameters for making an offer requests (required: slices, passengers; optional: cabin_class, return_offers)
1807
+ * @param {Object} [options] - the parameters for making an offer requests (required: slices, passengers; optional: cabin_class, return_offers, view, include_split_ticket)
1674
1808
  * When `return_offers` is set to `true`, the offer request resource returned will include all the `offers` returned by the airlines.
1675
1809
  * If set to false, the offer request resource won't include any `offers`. To retrieve the associated offers later, use the List Offers endpoint, specifying the `offer_request_id`.
1810
+ * When `view` is set to `'itineraries'`, offers are grouped per slice into a hierarchy of itineraries and fare brands.
1811
+ * Combine `view: 'itineraries'` with `include_split_ticket: true` to surface split-ticket candidates.
1676
1812
  * @link https://duffel.com/docs/api/offer-requests/create-offer-request
1813
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
1677
1814
  */
1678
1815
  create: <QueryParams extends CreateOfferRequestQueryParameters>(options: CreateOfferRequest & QueryParams) => Promise<DuffelResponse<QueryParams extends {
1816
+ view: "itineraries";
1817
+ } ? OfferRequestItinerariesView : QueryParams extends {
1679
1818
  return_offers: false;
1680
1819
  } ? Omit<OfferRequest, "offers"> : OfferRequest>>;
1681
1820
  }
@@ -2278,7 +2417,7 @@ declare module '@duffel/api/booking/AirlineInitiatedChanges/AirlineInitiatedChan
2278
2417
 
2279
2418
  declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
2280
2419
  import { Airline, CabinClass, PassengerType, Place, PlaceType } from '@duffel/api/types';
2281
- import { Offer } from '@duffel/api/booking/Offers/OfferTypes';
2420
+ import { Offer, OfferSliceSegment } from '@duffel/api/booking/Offers/OfferTypes';
2282
2421
  export interface OfferRequestSlice {
2283
2422
  /**
2284
2423
  * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date on which the passengers want to depart
@@ -2506,6 +2645,16 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
2506
2645
  * whereas return trips will need two.
2507
2646
  */
2508
2647
  slices: CreateOfferRequestSlice[];
2648
+ /**
2649
+ * When set to `true` and the offer request contains more than one slice,
2650
+ * Duffel will fire additional one-way searches per slice to find
2651
+ * split-ticket itinerary candidates. Split-ticket offers are only returned
2652
+ * when combined with the `view=itineraries` query parameter.
2653
+ *
2654
+ * Requires this capability to be enabled on your Duffel account.
2655
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
2656
+ */
2657
+ include_split_ticket?: boolean;
2509
2658
  }
2510
2659
  export type TimeRangeFilter = {
2511
2660
  from: string;
@@ -2536,6 +2685,18 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
2536
2685
  */
2537
2686
  departure_time: TimeRangeFilter | null;
2538
2687
  }
2688
+ /**
2689
+ * The shape of the offer request response.
2690
+ *
2691
+ * - `offers` (default) — a flat list of offers under `data.offers`.
2692
+ * - `itineraries` — offers are grouped per slice into a hierarchy of
2693
+ * itineraries and fare brands under `data.slices[].itineraries[]`. This is
2694
+ * the view required to surface split-ticket candidates created with
2695
+ * `include_split_ticket: true`.
2696
+ *
2697
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
2698
+ */
2699
+ export type OfferRequestView = 'offers' | 'itineraries';
2539
2700
  export interface CreateOfferRequestQueryParameters {
2540
2701
  /**
2541
2702
  * When set to `true`, the offer request resource returned will include all the offers returned by the airlines.
@@ -2544,6 +2705,14 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
2544
2705
  * You should use this option if you want to take advantage of the pagination, sorting and filtering that the [List Offers](https://duffel.com/docs/api/offers/get-offers) endpoint provides.
2545
2706
  */
2546
2707
  return_offers?: boolean;
2708
+ /**
2709
+ * Controls the shape of the response. Defaults to `offers`, which returns a
2710
+ * flat list of offers. Set to `itineraries` to receive offers grouped by
2711
+ * slice, itinerary and fare brand — required to retrieve split-ticket
2712
+ * candidates produced by `include_split_ticket: true`.
2713
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
2714
+ */
2715
+ view?: OfferRequestView;
2547
2716
  /**
2548
2717
  * The maximum amount of time in milliseconds to wait for each airline search to complete.
2549
2718
  * This timeout applies to the response time of the call to the airline and includes
@@ -2558,6 +2727,101 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
2558
2727
  */
2559
2728
  supplier_timeout?: number;
2560
2729
  }
2730
+ /**
2731
+ * Discriminator for offers returned under the `itineraries` view.
2732
+ *
2733
+ * - `single_ticket` — a single offer from one airline that covers every slice
2734
+ * in the original offer request.
2735
+ * - `split_ticket` — an offer that covers a single slice, intended to be
2736
+ * combined with offers for the remaining slices (potentially from a
2737
+ * different airline) to fulfil the journey.
2738
+ *
2739
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
2740
+ */
2741
+ export type ItineraryOfferType = 'single_ticket' | 'split_ticket';
2742
+ /**
2743
+ * An offer returned under the `itineraries` view.
2744
+ *
2745
+ * It is structurally the same as a regular {@link Offer} (minus
2746
+ * `available_services`, which is only populated by the Get single offer
2747
+ * endpoint) but carries a `type` discriminator describing whether the offer
2748
+ * covers the full journey or a single slice that needs to be combined with
2749
+ * other offers.
2750
+ */
2751
+ export interface ItineraryOffer extends Omit<Offer, 'available_services'> {
2752
+ /**
2753
+ * Whether the offer covers every slice from a single airline
2754
+ * (`single_ticket`) or only the slice it is nested under and needs to be
2755
+ * combined with other offers to complete the journey (`split_ticket`).
2756
+ */
2757
+ type: ItineraryOfferType;
2758
+ }
2759
+ /**
2760
+ * A fare brand grouping offers that share the same itinerary segments.
2761
+ */
2762
+ export interface ItineraryBrand {
2763
+ /**
2764
+ * The airline's marketing name for the fare brand, e.g. "Economy Basic".
2765
+ */
2766
+ fare_brand_name: string;
2767
+ /**
2768
+ * The offers available for this fare brand on this itinerary.
2769
+ */
2770
+ offers: ItineraryOffer[];
2771
+ }
2772
+ /**
2773
+ * One way the airline can fly a passenger from the slice's origin to its
2774
+ * destination. A single itinerary is a fixed list of segments which may be
2775
+ * sold under one or more fare brands.
2776
+ */
2777
+ export interface Itinerary {
2778
+ /**
2779
+ * The segments that make up this itinerary, in the order they are flown.
2780
+ */
2781
+ segments: OfferSliceSegment[];
2782
+ /**
2783
+ * The fare brands available for this itinerary, each carrying one or more
2784
+ * bookable offers.
2785
+ */
2786
+ brands: ItineraryBrand[];
2787
+ }
2788
+ /**
2789
+ * A slice as represented in the `itineraries` view of an offer request.
2790
+ *
2791
+ * Unlike {@link OfferRequestSlice}, it does not include the `departure_date`
2792
+ * or origin/destination type fields directly — the per-segment scheduling
2793
+ * lives inside `itineraries[].segments[]`.
2794
+ */
2795
+ export interface OfferRequestItinerariesViewSlice {
2796
+ /**
2797
+ * The city or airport the passengers want to depart from.
2798
+ */
2799
+ origin: Place;
2800
+ /**
2801
+ * The city or airport the passengers want to travel to.
2802
+ */
2803
+ destination: Place;
2804
+ /**
2805
+ * The itineraries available for this slice, each grouping offers by fare
2806
+ * brand.
2807
+ */
2808
+ itineraries: Itinerary[];
2809
+ }
2810
+ /**
2811
+ * The response payload returned when an offer request is created with the
2812
+ * `view=itineraries` query parameter. Offers are grouped per slice rather than
2813
+ * returned as a flat list, which is required to surface split-ticket
2814
+ * candidates produced by `include_split_ticket: true`.
2815
+ *
2816
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
2817
+ */
2818
+ export interface OfferRequestItinerariesView extends Omit<OfferRequest, 'slices' | 'offers'> {
2819
+ /**
2820
+ * The slices that make up this offer request, each carrying the itineraries
2821
+ * and offers available for that slice.
2822
+ */
2823
+ slices: OfferRequestItinerariesViewSlice[];
2824
+ }
2561
2825
  export {};
2562
2826
  }
2563
2827
 
@@ -5772,6 +6036,51 @@ declare module '@duffel/api/Stays/Bookings/Bookings' {
5772
6036
  }
5773
6037
  }
5774
6038
 
6039
+ declare module '@duffel/api/Stays/NegotiatedRates/NegotiatedRates' {
6040
+ import { Client } from '@duffel/api/Client';
6041
+ import { StaysNegotiatedRate, StaysNegotiatedRateCreatePayload, StaysNegotiatedRateUpdatePayload } from '@duffel/api/Stays/StaysTypes';
6042
+ import { Resource } from '@duffel/api/Resource';
6043
+ import { DuffelResponse, PaginationMeta } from '@duffel/api/types';
6044
+ export class NegotiatedRates extends Resource {
6045
+ /**
6046
+ * Endpoint path
6047
+ */
6048
+ path: string;
6049
+ constructor(client: Client);
6050
+ /**
6051
+ * Create a negotiated rate.
6052
+ * You must provide either chain_id or accommodation_id, but not both.
6053
+ * @param {object} payload - The negotiated rate payload
6054
+ */
6055
+ create: (payload: StaysNegotiatedRateCreatePayload) => Promise<DuffelResponse<StaysNegotiatedRate>>;
6056
+ /**
6057
+ * Get a negotiated rate by ID
6058
+ * @param {string} id - The ID of the negotiated rate
6059
+ */
6060
+ get: (id: string) => Promise<DuffelResponse<StaysNegotiatedRate>>;
6061
+ /**
6062
+ * Update a negotiated rate
6063
+ * @param {string} id - The ID of the negotiated rate
6064
+ * @param {object} payload - The update payload
6065
+ */
6066
+ update: (id: string, payload: StaysNegotiatedRateUpdatePayload) => Promise<DuffelResponse<StaysNegotiatedRate>>;
6067
+ /**
6068
+ * List negotiated rates
6069
+ * @param {Object} [options] - Pagination options (optional: limit, after, before)
6070
+ */
6071
+ list: (options?: PaginationMeta) => Promise<DuffelResponse<StaysNegotiatedRate[]>>;
6072
+ /**
6073
+ * Retrieves a generator of all negotiated rates. The results may be returned in any order.
6074
+ */
6075
+ listWithGenerator: () => AsyncGenerator<DuffelResponse<StaysNegotiatedRate>, void, unknown>;
6076
+ /**
6077
+ * Delete a negotiated rate
6078
+ * @param {string} id - The ID of the negotiated rate
6079
+ */
6080
+ delete: (id: string) => Promise<DuffelResponse<StaysNegotiatedRate>>;
6081
+ }
6082
+ }
6083
+
5775
6084
  declare module '@duffel/api/Stays/Quotes/Quotes' {
5776
6085
  import { Client } from '@duffel/api/Client';
5777
6086
  import { StaysQuote } from '@duffel/api/Stays/StaysTypes';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duffel/api",
3
- "version": "4.25.0",
3
+ "version": "4.27.0",
4
4
  "description": "Javascript client library for the Duffel API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -50,23 +50,25 @@
50
50
  "set-value": "4.0.1",
51
51
  "minimist": "1.2.8",
52
52
  "semver": "7.5.3",
53
- "@aashutoshrathi/word-wrap": "npm:word-wrap"
53
+ "@aashutoshrathi/word-wrap": "npm:word-wrap",
54
+ "@semantic-release/npm": "13.1.5"
54
55
  },
55
56
  "dependencies": {
56
57
  "@types/node": "18.0.0",
57
- "@types/node-fetch": "2.6.2",
58
+ "@types/node-fetch": "2.6.13",
58
59
  "node-fetch": "2.7.0"
59
60
  },
60
61
  "devDependencies": {
61
- "@babel/core": "7.29.0",
62
- "@babel/preset-env": "7.29.2",
63
- "@babel/preset-typescript": "7.28.5",
62
+ "@babel/core": "7.29.7",
63
+ "@babel/preset-env": "7.29.7",
64
+ "@babel/preset-typescript": "7.29.7",
64
65
  "@commitlint/cli": "17.8.1",
65
66
  "@commitlint/config-angular": "17.8.1",
66
67
  "@rollup/plugin-commonjs": "25.0.8",
67
68
  "@rollup/plugin-node-resolve": "15.3.1",
68
69
  "@rollup/plugin-terser": "1.0.0",
69
70
  "@rollup/plugin-typescript": "12.3.0",
71
+ "@semantic-release/npm": "13.1.5",
70
72
  "@types/jest": "29.5.14",
71
73
  "@typescript-eslint/eslint-plugin": "6.7.5",
72
74
  "@typescript-eslint/parser": "6.7.5",
@@ -80,12 +82,12 @@
80
82
  "lint-staged": "15.5.2",
81
83
  "nock": "13.5.6",
82
84
  "prettier": "3.5.3",
83
- "rollup": "4.60.1",
85
+ "rollup": "4.61.1",
84
86
  "rollup-plugin-dts-bundle": "1.0.0",
85
87
  "rollup-plugin-inject-process-env": "1.3.1",
86
88
  "rollup-plugin-peer-deps-external": "2.2.4",
87
- "semantic-release": "22.0.12",
88
- "ts-jest": "29.4.6",
89
+ "semantic-release": "24.2.9",
90
+ "ts-jest": "29.4.11",
89
91
  "ts-node": "10.9.2",
90
92
  "tslib": "2.8.1",
91
93
  "typescript": "5.9.3"