@duffel/api 1.7.4 → 1.7.8

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.
@@ -1,5 +1,3 @@
1
- import { Client as Client$1 } from 'Client';
2
-
3
1
  /**
4
2
  * Each offer represents flights you can buy from an airline at a particular price that meet your search criteria.
5
3
  * @link https://duffel.com/docs/api/offers/schema
@@ -513,7 +511,7 @@ interface OfferRequest {
513
511
  /**
514
512
  * The offers returned by the airlines
515
513
  */
516
- offers?: Omit<Offer, 'available_services'>[];
514
+ offers: Omit<Offer, 'available_services'>[];
517
515
  /**
518
516
  * The passengers who want to travel. A passenger will have only a type or an age.
519
517
  */
@@ -523,7 +521,7 @@ interface CreateOfferRequest {
523
521
  /**
524
522
  * The cabin that the passengers want to travel in
525
523
  */
526
- cabin_class: CabinClass;
524
+ cabin_class?: CabinClass;
527
525
  /**
528
526
  * The passengers who want to travel.
529
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.
@@ -542,7 +540,7 @@ interface CreateOfferRequestQueryParameters {
542
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`.
543
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.
544
542
  */
545
- return_offers: boolean;
543
+ return_offers?: boolean;
546
544
  }
547
545
 
548
546
  interface CreateOrderCancellation {
@@ -2187,7 +2185,7 @@ declare class OfferRequests extends Resource {
2187
2185
  * Endpoint path
2188
2186
  */
2189
2187
  path: string;
2190
- constructor(args: any);
2188
+ constructor(client: Client);
2191
2189
  /**
2192
2190
  * Retrieves an offer request by its ID
2193
2191
  * @param {string} id - Duffel's unique identifier for the offer request
@@ -2209,11 +2207,14 @@ declare class OfferRequests extends Resource {
2209
2207
  * To search for flights, you'll need to create an `offer request`.
2210
2208
  * An offer request describes the passengers and where and when they want to travel (in the form of a list of `slices`).
2211
2209
  * It may also include additional filters (e.g. a particular cabin to travel in).
2212
- * @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.
2213
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`.
2214
2213
  * @link https://duffel.com/docs/api/offer-requests/create-offer-request
2215
2214
  */
2216
- 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>>;
2217
2218
  }
2218
2219
 
2219
2220
  interface UpdateOfferBodyParameters {
@@ -2231,7 +2232,7 @@ declare class Offers extends Resource {
2231
2232
  * Endpoint path
2232
2233
  */
2233
2234
  path: string;
2234
- constructor(client: Client$1);
2235
+ constructor(client: Client);
2235
2236
  /**
2236
2237
  * Retrieves an offer by its ID
2237
2238
  * @param {string} id - Duffel's unique identifier for the offer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duffel/api",
3
- "version": "1.7.4",
3
+ "version": "1.7.8",
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
  ]