@duffel/api 1.7.3 → 1.7.7

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.
@@ -511,7 +511,7 @@ interface OfferRequest {
511
511
  /**
512
512
  * The offers returned by the airlines
513
513
  */
514
- offers?: Omit<Offer, 'available_services'>[];
514
+ offers: Omit<Offer, 'available_services'>[];
515
515
  /**
516
516
  * The passengers who want to travel. A passenger will have only a type or an age.
517
517
  */
@@ -521,7 +521,7 @@ interface CreateOfferRequest {
521
521
  /**
522
522
  * The cabin that the passengers want to travel in
523
523
  */
524
- cabin_class: CabinClass;
524
+ cabin_class?: CabinClass;
525
525
  /**
526
526
  * The passengers who want to travel.
527
527
  * If you specify an age for a passenger, the type may differ for the same passenger in different offers due to airline's different rules. e.g. one airline may treat a 14 year old as an adult, and another as a young adult.
@@ -540,7 +540,7 @@ interface CreateOfferRequestQueryParameters {
540
540
  * To retrieve the associated `offers` later, use the [List Offers](https://duffel.com/docs/api/offers/get-offers) endpoint, specifying the `offer_request_id`.
541
541
  * 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.
542
542
  */
543
- return_offers: boolean;
543
+ return_offers?: boolean;
544
544
  }
545
545
 
546
546
  interface CreateOrderCancellation {
@@ -2185,7 +2185,7 @@ declare class OfferRequests extends Resource {
2185
2185
  * Endpoint path
2186
2186
  */
2187
2187
  path: string;
2188
- constructor(args: any);
2188
+ constructor(client: any);
2189
2189
  /**
2190
2190
  * Retrieves an offer request by its ID
2191
2191
  * @param {string} id - Duffel's unique identifier for the offer request
@@ -2207,11 +2207,14 @@ declare class OfferRequests extends Resource {
2207
2207
  * To search for flights, you'll need to create an `offer request`.
2208
2208
  * An offer request describes the passengers and where and when they want to travel (in the form of a list of `slices`).
2209
2209
  * It may also include additional filters (e.g. a particular cabin to travel in).
2210
- * @param {boolean} [return_offers] - When set to `true`, the offer request resource returned will include all the `offers` returned by the airlines.
2210
+ * @param {Object} [options] - the parameters for making an offer requests (required: slices, passengers; optional: cabin_class, return_offers)
2211
+ * When `return_offers` is set to `true`, the offer request resource returned will include all the `offers` returned by the airlines.
2211
2212
  * 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`.
2212
2213
  * @link https://duffel.com/docs/api/offer-requests/create-offer-request
2213
2214
  */
2214
- create: (options: Partial<CreateOfferRequest & CreateOfferRequestQueryParameters>) => Promise<DuffelResponse<OfferRequest>>;
2215
+ create: <QueryParams extends CreateOfferRequestQueryParameters>(options: CreateOfferRequest & QueryParams) => Promise<DuffelResponse<QueryParams extends {
2216
+ return_offers: false;
2217
+ } ? Omit<OfferRequest, "offers"> : OfferRequest>>;
2215
2218
  }
2216
2219
 
2217
2220
  interface UpdateOfferBodyParameters {
@@ -2219,9 +2222,6 @@ interface UpdateOfferBodyParameters {
2219
2222
  given_name: string;
2220
2223
  family_name: string;
2221
2224
  }
2222
- interface UpdateOfferBodyParametersWithoutLoyalty {
2223
- loyalty_programme_accounts: never;
2224
- }
2225
2225
  /**
2226
2226
  * Each offer represents flights you can buy from an airline at a particular price that meet your search criteria.
2227
2227
  * @class
@@ -2232,7 +2232,7 @@ declare class Offers extends Resource {
2232
2232
  * Endpoint path
2233
2233
  */
2234
2234
  path: string;
2235
- constructor(args: any);
2235
+ constructor(client: any);
2236
2236
  /**
2237
2237
  * Retrieves an offer by its ID
2238
2238
  * @param {string} id - Duffel's unique identifier for the offer
@@ -2260,11 +2260,11 @@ declare class Offers extends Resource {
2260
2260
  * Some offer passenger fields are updateable. Each field that can be updated is detailed in the request object.
2261
2261
  * @param {string} offerId - Duffel's unique identifier for the offer
2262
2262
  * @param {string} passengerId - The identifier for the passenger. This ID will be generated by Duffel
2263
- * @param {string} params.family_name - The passenger's family name. Only space, -, ', and letters from the ASCII, Latin-1 Supplement and Latin Extended-A (with the exceptions of Æ, æ, IJ, ij, Œ, œ, Þ, and ð) Unicode charts are accepted. All other characters will result in a validation error. The minimum length is 1 character, and the maximum is 20 characters. This is only required if you're also including Loyalty Programme Accounts.
2264
- * @param {string} params.given_name - The passenger's given name. Only space, -, ', and letters from the ASCII, Latin-1 Supplement and Latin Extended-A (with the exceptions of Æ, æ, IJ, ij, Œ, œ, Þ, and ð) Unicode charts are accepted. All other characters will result in a validation error. The minimum length is 1 character, and the maximum is 20 characters. This is only required if you're also including Loyalty Programme Accounts.
2263
+ * @param {string} params.family_name - The passenger's family name. Only space, -, ', and letters from the ASCII, Latin-1 Supplement and Latin Extended-A (with the exceptions of Æ, æ, IJ, ij, Œ, œ, Þ, and ð) Unicode charts are accepted. All other characters will result in a validation error. The minimum length is 1 character, and the maximum is 20 characters.
2264
+ * @param {string} params.given_name - The passenger's given name. Only space, -, ', and letters from the ASCII, Latin-1 Supplement and Latin Extended-A (with the exceptions of Æ, æ, IJ, ij, Œ, œ, Þ, and ð) Unicode charts are accepted. All other characters will result in a validation error. The minimum length is 1 character, and the maximum is 20 characters.
2265
2265
  * @param {Object.<LoyaltyProgrammeAccounts>} params.loyalty_programme_accounts - The Loyalty Programme Accounts for this passenger
2266
2266
  */
2267
- update: (offerId: string, passengerId: string, params?: UpdateOfferBodyParameters | UpdateOfferBodyParametersWithoutLoyalty | undefined) => Promise<DuffelResponse<UpdateOffer>>;
2267
+ update: (offerId: string, passengerId: string, params: UpdateOfferBodyParameters) => Promise<DuffelResponse<UpdateOffer>>;
2268
2268
  }
2269
2269
 
2270
2270
  declare class OrderCancellations extends Resource {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duffel/api",
3
- "version": "1.7.3",
3
+ "version": "1.7.7",
4
4
  "description": "Javascript client library for the Duffel API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@types/node": "^17.0.1",
51
- "isomorphic-unfetch": "^3.1.0"
51
+ "node-fetch": "^3.2.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@babel/core": "^7.15.5",
@@ -59,13 +59,13 @@
59
59
  "@commitlint/cz-commitlint": "^16.0.0",
60
60
  "@rollup/plugin-commonjs": "^21.0.0",
61
61
  "@rollup/plugin-multi-entry": "^4.0.0",
62
- "@rollup/plugin-node-resolve": "^13.0.0",
62
+ "@rollup/plugin-node-resolve": "^13.1.3",
63
63
  "@types/jest": "^27.0.1",
64
64
  "@typescript-eslint/eslint-plugin": "^4.26.1",
65
65
  "@typescript-eslint/parser": "^4.26.1",
66
66
  "colors": "^1.4.0",
67
67
  "commitizen": "^4.2.4",
68
- "dotenv": "^10.0.0",
68
+ "dotenv": "^14.2.0",
69
69
  "eslint": "^7.26.0",
70
70
  "eslint-config-prettier": "^8.3.0",
71
71
  "eslint-plugin-spellcheck": "^0.0.19",
@@ -74,8 +74,8 @@
74
74
  "lint-staged": "^12.0.1",
75
75
  "nock": "^13.1.0",
76
76
  "prettier": "^2.4.1",
77
- "rollup": "^2.51.2",
78
- "rollup-plugin-dts": "^4.0.0",
77
+ "rollup": "^2.66.1",
78
+ "rollup-plugin-dts": "^4.1.0",
79
79
  "rollup-plugin-inject-process-env": "^1.3.1",
80
80
  "rollup-plugin-peer-deps-external": "^2.2.4",
81
81
  "rollup-plugin-terser": "^7.0.2",
@@ -91,17 +91,17 @@
91
91
  "engines": {
92
92
  "node": ">=14.*"
93
93
  },
94
- "plugins": [
95
- [
96
- "@semantic-release/commit-analyzer"
97
- ],
98
- [
99
- "@semantic-release/release-notes-generator"
100
- ],
101
- "@semantic-release/npm",
102
- "@semantic-release/github"
103
- ],
104
94
  "release": {
95
+ "plugins": [
96
+ [
97
+ "@semantic-release/commit-analyzer"
98
+ ],
99
+ [
100
+ "@semantic-release/release-notes-generator"
101
+ ],
102
+ "@semantic-release/npm",
103
+ "@semantic-release/github"
104
+ ],
105
105
  "branches": [
106
106
  "main"
107
107
  ]