@duffel/api 1.11.0 → 1.13.1

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.
@@ -0,0 +1,25 @@
1
+ import { Client } from 'Client';
2
+ import { Resource } from '../../Resource';
3
+ import { DuffelResponse, Places } from '../../types';
4
+ interface PlacesSuggestionsParameters {
5
+ /**
6
+ * A search string for finding matching Places.
7
+ */
8
+ query: string;
9
+ }
10
+ /**
11
+ * A Place is a city or airport that can serve as an origin or destination.
12
+ * * @link https://duffel.com/docs/api/places
13
+ */
14
+ export declare class Suggestions extends Resource {
15
+ /**
16
+ * Endpoint path
17
+ */
18
+ path: string;
19
+ constructor(client: Client);
20
+ /**
21
+ * Retrieves a list of Places matching the provided query
22
+ */
23
+ list: (params: PlacesSuggestionsParameters) => Promise<DuffelResponse<Places[]>>;
24
+ }
25
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,59 @@
1
+ import { Airport, City } from '../../types';
2
+ export interface Places {
3
+ /**
4
+ * The type of the place
5
+ */
6
+ type: string;
7
+ /**
8
+ * The time zone of the airport, specified by name from the tz database
9
+ */
10
+ time_zone: string | null;
11
+ /**
12
+ * The name of the place
13
+ */
14
+ name: string;
15
+ /**
16
+ * The longitude position of the airport represented in Decimal degrees with 6 decimal points with a range between -180° and 180°
17
+ */
18
+ longitude: number | null;
19
+ /**
20
+ * The latitude position of the airport represented in Decimal degrees with 6 decimal points with a range between -90° and 90°
21
+ */
22
+ latitude: number | null;
23
+ /**
24
+ * Duffel's unique identifier for the place
25
+ */
26
+ id: string;
27
+ /**
28
+ * The four-character ICAO code for the airport
29
+ */
30
+ icao_code: string | null;
31
+ /**
32
+ * The ISO 3166-1 alpha-2 code for the country where the city is located
33
+ */
34
+ iata_country_code: string;
35
+ /**
36
+ * The 3-letter IATA code for the place
37
+ */
38
+ iata_code: string;
39
+ /**
40
+ * The 3-letter IATA code for the city where the place is located. Only present for airports which are registered with IATA as belonging to a metropolitan area.
41
+ */
42
+ iata_city_code: string | null;
43
+ /**
44
+ * The name of the country where the city or airport is located
45
+ */
46
+ country_name: string | null;
47
+ /**
48
+ * The name of the city (or cities separated by a /) where the airport is located
49
+ */
50
+ city_name: string | null;
51
+ /**
52
+ * The metropolitan area where the airport is located. Only present for airports which are registered with IATA as belonging to a metropolitan area.
53
+ */
54
+ city: City | null;
55
+ /**
56
+ * The airports associated to a city. This will only be provided where the type is city.
57
+ */
58
+ airports: Airport[] | null;
59
+ }
@@ -0,0 +1 @@
1
+ export * from './Suggestions';
@@ -0,0 +1 @@
1
+ export * from './Suggestions';
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { PaymentIntents } from './DuffelPayments';
2
2
  import { OfferRequests, Offers, OrderCancellations, Orders, OrderChangeRequests, OrderChangeOffers, OrderChanges, Payments, SeatMaps } from './booking';
3
3
  import { Config, DuffelError as _DuffelError } from './Client';
4
4
  import { Aircraft, Airlines, Airports } from './supportingResources';
5
+ import { Suggestions } from './Places/Suggestions';
5
6
  export interface DuffelAPIClient {
6
7
  aircraft: Aircraft;
7
8
  airlines: Airlines;
@@ -31,6 +32,7 @@ export declare class Duffel {
31
32
  payments: Payments;
32
33
  seatMaps: SeatMaps;
33
34
  paymentIntents: PaymentIntents;
35
+ suggestions: Suggestions;
34
36
  constructor(config: Config);
35
37
  }
36
38
  export declare const DuffelError: typeof _DuffelError;
package/dist/index.es.js CHANGED
@@ -1,2 +1,2 @@
1
- import t from"node-fetch";import{URL as e,URLSearchParams as s}from"url";function i(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s}function r(t,e,s,i){return new(s||(s=Promise))((function(r,h){function a(t){try{o(i.next(t))}catch(t){h(t)}}function n(t){try{o(i.throw(t))}catch(t){h(t)}}function o(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}o((i=i.apply(t,e||[])).next())}))}function h(t){return this instanceof h?(this.v=t,this):new h(t)}function a(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=s.apply(t,e||[]),a=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){r[t]&&(i[t]=function(e){return new Promise((function(s,i){a.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=r[t](e)).value instanceof h?Promise.resolve(s.value.v).then(p,c):u(a[0][2],s)}catch(t){u(a[0][3],t)}var s}function p(t){o("next",t)}function c(t){o("throw",t)}function u(t,e){t(e),a.shift(),a.length&&o(a[0][0],a[0][1])}}!function(){const t={npm_package_version:"1.10.1"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class n{constructor(t){this.request=({method:t,path:e,data:s,params:i})=>r(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:i})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class o extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class p extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.create=t=>r(this,void 0,void 0,(function*(){const{return_offers:e}=t,s=i(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:s,params:Object.assign({},null!=e&&{return_offers:e})})})),this.path="air/offer_requests"}}class c extends n{constructor(t){super(t),this.get=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,s=i(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.listWithGenerator=t=>{var{offer_request_id:e}=t,s=i(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.update=(t,e,s)=>r(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class u extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=t=>this.paginatedRequest({path:this.path,params:t}),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class d extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:t})})),this.listWithGenerator=t=>this.paginatedRequest({path:"air/orders",params:t}),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.path="air/orders"}}class f extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/order_change_requests"}}class l extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/order_change_offers"}}class m extends n{constructor(t){super(t),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class v extends n{constructor(t){super(t),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class q extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}class g extends Error{constructor({meta:t,errors:e}){super(),this.meta=t,this.errors=e}}class y{constructor({token:i,basePath:h,apiVersion:a,debug:n,source:o}){this.request=({method:i,path:h,data:a,params:n,compress:o=!0})=>r(this,void 0,void 0,(function*(){var r;let p,c;const u=new e(h,this.basePath),d={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(n){const t=new s;Object.entries(n).sort().filter((t=>null!==t[0])).forEach((([e,s])=>{Array.isArray(s)?s.forEach((s=>t.append(e,s.toString()))):t.append(e,s.toString())})),u.search=t.toString()}a&&(p=JSON.stringify({data:Object.assign({},a)})),(null===(r=this.debug)||void 0===r?void 0:r.verbose)&&(console.info("Endpoint: ",u.href),console.info("Method: ",i),a&&console.info("Body Parameters: ",a),n&&console.info("Query Parameters: ",n));const f=yield t(u.href,{method:i,headers:d,body:p,compress:o}),l=f.headers.get("content-type");if(c=l&&l.includes("json")?yield f.json():yield f.text(),!f.ok||"errors"in c&&c.errors)throw new g(c);return c})),this.token=i,this.basePath=h||"https://api.duffel.com",this.apiVersion=a||"beta",this.debug=n,this.source=o}paginatedRequest({path:t,params:e}){return a(this,arguments,(function*(){let s=yield h(this.request({method:"GET",path:t,params:e}));for(const t of s.data)yield yield h({data:t});for(;s.meta&&"after"in s.meta&&s.meta.after;){s=yield h(this.request({method:"GET",path:t,params:{limit:s.meta.limit,after:s.meta.after}}));for(const t of s.data)yield yield h({data:t})}}))}}class $ extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/aircraft"}}class T extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airlines"}}class O extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}class b{constructor(t){this.client=new y(t),this.aircraft=new $(this.client),this.airlines=new T(this.client),this.airports=new O(this.client),this.offerRequests=new p(this.client),this.offers=new c(this.client),this.orders=new d(this.client),this.orderChangeRequests=new f(this.client),this.orderChangeOffers=new l(this.client),this.orderChanges=new m(this.client),this.orderCancellations=new u(this.client),this.payments=new v(this.client),this.seatMaps=new q(this.client),this.paymentIntents=new o(this.client)}}const w=g;export{b as Duffel,w as DuffelError};
1
+ import t from"node-fetch";import{URL as e,URLSearchParams as s}from"url";function i(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s}function r(t,e,s,i){return new(s||(s=Promise))((function(r,h){function a(t){try{o(i.next(t))}catch(t){h(t)}}function n(t){try{o(i.throw(t))}catch(t){h(t)}}function o(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}o((i=i.apply(t,e||[])).next())}))}function h(t){return this instanceof h?(this.v=t,this):new h(t)}function a(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=s.apply(t,e||[]),a=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){r[t]&&(i[t]=function(e){return new Promise((function(s,i){a.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=r[t](e)).value instanceof h?Promise.resolve(s.value.v).then(p,c):u(a[0][2],s)}catch(t){u(a[0][3],t)}var s}function p(t){o("next",t)}function c(t){o("throw",t)}function u(t,e){t(e),a.shift(),a.length&&o(a[0][0],a[0][1])}}!function(){const t={npm_package_version:"1.13.0"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class n{constructor(t){this.request=({method:t,path:e,data:s,params:i})=>r(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:i})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class o extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class p extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.create=t=>r(this,void 0,void 0,(function*(){const{return_offers:e}=t,s=i(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:s,params:Object.assign({},null!=e&&{return_offers:e})})})),this.path="air/offer_requests"}}class c extends n{constructor(t){super(t),this.get=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,s=i(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.listWithGenerator=t=>{var{offer_request_id:e}=t,s=i(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.update=(t,e,s)=>r(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class u extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=t=>this.paginatedRequest({path:this.path,params:t}),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class d extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:t})})),this.listWithGenerator=t=>this.paginatedRequest({path:"air/orders",params:t}),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.path="air/orders"}}class f extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/order_change_requests"}}class l extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/order_change_offers"}}class m extends n{constructor(t){super(t),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class v extends n{constructor(t){super(t),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class g extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}class q extends Error{constructor({meta:t,errors:e}){super(),this.meta=t,this.errors=e}}class y{constructor({token:i,basePath:h,apiVersion:a,debug:n,source:o}){this.request=({method:i,path:h,data:a,params:n,compress:o=!0})=>r(this,void 0,void 0,(function*(){var r;let p,c;const u=new e(h,this.basePath),d={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(n){const t=new s;Object.entries(n).sort().filter((t=>null!==t[0])).forEach((([e,s])=>{Array.isArray(s)?s.forEach((s=>t.append(e,s.toString()))):t.append(e,s.toString())})),u.search=t.toString()}a&&(p=JSON.stringify({data:Object.assign({},a)})),(null===(r=this.debug)||void 0===r?void 0:r.verbose)&&(console.info("Endpoint: ",u.href),console.info("Method: ",i),a&&console.info("Body Parameters: ",a),n&&console.info("Query Parameters: ",n));const f=yield t(u.href,{method:i,headers:d,body:p,compress:o}),l=f.headers.get("content-type");if(c=l&&l.includes("json")?yield f.json():yield f.text(),!f.ok||"errors"in c&&c.errors)throw new q(c);return c})),this.token=i,this.basePath=h||"https://api.duffel.com",this.apiVersion=a||"beta",this.debug=n,this.source=o}paginatedRequest({path:t,params:e}){return a(this,arguments,(function*(){let s=yield h(this.request({method:"GET",path:t,params:e}));for(const t of s.data)yield yield h({data:t});for(;s.meta&&"after"in s.meta&&s.meta.after;){s=yield h(this.request({method:"GET",path:t,params:{limit:s.meta.limit,after:s.meta.after}}));for(const t of s.data)yield yield h({data:t})}}))}}class $ extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/aircraft"}}class T extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airlines"}}class w extends n{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}class G extends n{constructor(t){super(t),this.list=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="places/suggestions"}}class O{constructor(t){this.client=new y(t),this.aircraft=new $(this.client),this.airlines=new T(this.client),this.airports=new w(this.client),this.offerRequests=new p(this.client),this.offers=new c(this.client),this.orders=new d(this.client),this.orderChangeRequests=new f(this.client),this.orderChangeOffers=new l(this.client),this.orderChanges=new m(this.client),this.orderCancellations=new u(this.client),this.payments=new v(this.client),this.seatMaps=new g(this.client),this.paymentIntents=new o(this.client),this.suggestions=new G(this.client)}}const b=q;export{O as Duffel,b as DuffelError};
2
2
  //# sourceMappingURL=index.es.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("node-fetch"),e=require("url");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=s(t);function r(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s}function h(t,e,s,i){return new(s||(s=Promise))((function(r,h){function a(t){try{o(i.next(t))}catch(t){h(t)}}function n(t){try{o(i.throw(t))}catch(t){h(t)}}function o(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}o((i=i.apply(t,e||[])).next())}))}function a(t){return this instanceof a?(this.v=t,this):new a(t)}function n(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=s.apply(t,e||[]),h=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){r[t]&&(i[t]=function(e){return new Promise((function(s,i){h.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=r[t](e)).value instanceof a?Promise.resolve(s.value.v).then(u,c):p(h[0][2],s)}catch(t){p(h[0][3],t)}var s}function u(t){o("next",t)}function c(t){o("throw",t)}function p(t,e){t(e),h.shift(),h.length&&o(h[0][0],h[0][1])}}!function(){const t={npm_package_version:"1.10.1"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class o{constructor(t){this.request=({method:t,path:e,data:s,params:i})=>h(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:i})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class u extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class c extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.create=t=>h(this,void 0,void 0,(function*(){const{return_offers:e}=t,s=r(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:s,params:Object.assign({},null!=e&&{return_offers:e})})})),this.path="air/offer_requests"}}class p extends o{constructor(t){super(t),this.get=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,s=r(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.listWithGenerator=t=>{var{offer_request_id:e}=t,s=r(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.update=(t,e,s)=>h(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class d extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=t=>this.paginatedRequest({path:this.path,params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class f extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:t})})),this.listWithGenerator=t=>this.paginatedRequest({path:"air/orders",params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.path="air/orders"}}class l extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/order_change_requests"}}class m extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/order_change_offers"}}class v extends o{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class q extends o{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class g extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}class y extends Error{constructor({meta:t,errors:e}){super(),this.meta=t,this.errors=e}}class ${constructor({token:t,basePath:s,apiVersion:r,debug:a,source:n}){this.request=({method:t,path:s,data:r,params:a,compress:n=!0})=>h(this,void 0,void 0,(function*(){var h;let o,u;const c=new e.URL(s,this.basePath),p={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(a){const t=new e.URLSearchParams;Object.entries(a).sort().filter((t=>null!==t[0])).forEach((([e,s])=>{Array.isArray(s)?s.forEach((s=>t.append(e,s.toString()))):t.append(e,s.toString())})),c.search=t.toString()}r&&(o=JSON.stringify({data:Object.assign({},r)})),(null===(h=this.debug)||void 0===h?void 0:h.verbose)&&(console.info("Endpoint: ",c.href),console.info("Method: ",t),r&&console.info("Body Parameters: ",r),a&&console.info("Query Parameters: ",a));const d=yield i.default(c.href,{method:t,headers:p,body:o,compress:n}),f=d.headers.get("content-type");if(u=f&&f.includes("json")?yield d.json():yield d.text(),!d.ok||"errors"in u&&u.errors)throw new y(u);return u})),this.token=t,this.basePath=s||"https://api.duffel.com",this.apiVersion=r||"beta",this.debug=a,this.source=n}paginatedRequest({path:t,params:e}){return n(this,arguments,(function*(){let s=yield a(this.request({method:"GET",path:t,params:e}));for(const t of s.data)yield yield a({data:t});for(;s.meta&&"after"in s.meta&&s.meta.after;){s=yield a(this.request({method:"GET",path:t,params:{limit:s.meta.limit,after:s.meta.after}}));for(const t of s.data)yield yield a({data:t})}}))}}class T extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/aircraft"}}class b extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airlines"}}class O extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}const _=y;exports.Duffel=class{constructor(t){this.client=new $(t),this.aircraft=new T(this.client),this.airlines=new b(this.client),this.airports=new O(this.client),this.offerRequests=new c(this.client),this.offers=new p(this.client),this.orders=new f(this.client),this.orderChangeRequests=new l(this.client),this.orderChangeOffers=new m(this.client),this.orderChanges=new v(this.client),this.orderCancellations=new d(this.client),this.payments=new q(this.client),this.seatMaps=new g(this.client),this.paymentIntents=new u(this.client)}},exports.DuffelError=_;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("node-fetch"),e=require("url");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=s(t);function r(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s}function h(t,e,s,i){return new(s||(s=Promise))((function(r,h){function a(t){try{o(i.next(t))}catch(t){h(t)}}function n(t){try{o(i.throw(t))}catch(t){h(t)}}function o(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}o((i=i.apply(t,e||[])).next())}))}function a(t){return this instanceof a?(this.v=t,this):new a(t)}function n(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=s.apply(t,e||[]),h=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){r[t]&&(i[t]=function(e){return new Promise((function(s,i){h.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=r[t](e)).value instanceof a?Promise.resolve(s.value.v).then(u,c):p(h[0][2],s)}catch(t){p(h[0][3],t)}var s}function u(t){o("next",t)}function c(t){o("throw",t)}function p(t,e){t(e),h.shift(),h.length&&o(h[0][0],h[0][1])}}!function(){const t={npm_package_version:"1.13.0"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class o{constructor(t){this.request=({method:t,path:e,data:s,params:i})=>h(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:i})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class u extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class c extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.create=t=>h(this,void 0,void 0,(function*(){const{return_offers:e}=t,s=r(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:s,params:Object.assign({},null!=e&&{return_offers:e})})})),this.path="air/offer_requests"}}class p extends o{constructor(t){super(t),this.get=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,s=r(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.listWithGenerator=t=>{var{offer_request_id:e}=t,s=r(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.update=(t,e,s)=>h(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class d extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=t=>this.paginatedRequest({path:this.path,params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class f extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:t})})),this.listWithGenerator=t=>this.paginatedRequest({path:"air/orders",params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.path="air/orders"}}class l extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/order_change_requests"}}class m extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/order_change_offers"}}class v extends o{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class g extends o{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class q extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}class y extends Error{constructor({meta:t,errors:e}){super(),this.meta=t,this.errors=e}}class ${constructor({token:t,basePath:s,apiVersion:r,debug:a,source:n}){this.request=({method:t,path:s,data:r,params:a,compress:n=!0})=>h(this,void 0,void 0,(function*(){var h;let o,u;const c=new e.URL(s,this.basePath),p={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(a){const t=new e.URLSearchParams;Object.entries(a).sort().filter((t=>null!==t[0])).forEach((([e,s])=>{Array.isArray(s)?s.forEach((s=>t.append(e,s.toString()))):t.append(e,s.toString())})),c.search=t.toString()}r&&(o=JSON.stringify({data:Object.assign({},r)})),(null===(h=this.debug)||void 0===h?void 0:h.verbose)&&(console.info("Endpoint: ",c.href),console.info("Method: ",t),r&&console.info("Body Parameters: ",r),a&&console.info("Query Parameters: ",a));const d=yield i.default(c.href,{method:t,headers:p,body:o,compress:n}),f=d.headers.get("content-type");if(u=f&&f.includes("json")?yield d.json():yield d.text(),!d.ok||"errors"in u&&u.errors)throw new y(u);return u})),this.token=t,this.basePath=s||"https://api.duffel.com",this.apiVersion=r||"beta",this.debug=a,this.source=n}paginatedRequest({path:t,params:e}){return n(this,arguments,(function*(){let s=yield a(this.request({method:"GET",path:t,params:e}));for(const t of s.data)yield yield a({data:t});for(;s.meta&&"after"in s.meta&&s.meta.after;){s=yield a(this.request({method:"GET",path:t,params:{limit:s.meta.limit,after:s.meta.after}}));for(const t of s.data)yield yield a({data:t})}}))}}class T extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/aircraft"}}class b extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airlines"}}class O extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}class _ extends o{constructor(t){super(t),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="places/suggestions"}}const w=y;exports.Duffel=class{constructor(t){this.client=new $(t),this.aircraft=new T(this.client),this.airlines=new b(this.client),this.airports=new O(this.client),this.offerRequests=new c(this.client),this.offers=new p(this.client),this.orders=new f(this.client),this.orderChangeRequests=new l(this.client),this.orderChangeOffers=new m(this.client),this.orderChanges=new v(this.client),this.orderCancellations=new d(this.client),this.payments=new g(this.client),this.seatMaps=new q(this.client),this.paymentIntents=new u(this.client),this.suggestions=new _(this.client)}},exports.DuffelError=w;
2
2
  //# sourceMappingURL=index.js.map
@@ -12,4 +12,6 @@ export interface Airline {
12
12
  */
13
13
  id: string;
14
14
  iata_code: string;
15
+ logo_lockup_url?: string;
16
+ logo_symbol_url?: string;
15
17
  }
@@ -1719,6 +1719,8 @@ interface Airline {
1719
1719
  */
1720
1720
  id: string;
1721
1721
  iata_code: string;
1722
+ logo_lockup_url?: string;
1723
+ logo_symbol_url?: string;
1722
1724
  }
1723
1725
 
1724
1726
  /**
@@ -1889,6 +1891,65 @@ interface CreatePaymentIntent {
1889
1891
  currency: string;
1890
1892
  }
1891
1893
 
1894
+ interface Places {
1895
+ /**
1896
+ * The type of the place
1897
+ */
1898
+ type: string;
1899
+ /**
1900
+ * The time zone of the airport, specified by name from the tz database
1901
+ */
1902
+ time_zone: string | null;
1903
+ /**
1904
+ * The name of the place
1905
+ */
1906
+ name: string;
1907
+ /**
1908
+ * The longitude position of the airport represented in Decimal degrees with 6 decimal points with a range between -180° and 180°
1909
+ */
1910
+ longitude: number | null;
1911
+ /**
1912
+ * The latitude position of the airport represented in Decimal degrees with 6 decimal points with a range between -90° and 90°
1913
+ */
1914
+ latitude: number | null;
1915
+ /**
1916
+ * Duffel's unique identifier for the place
1917
+ */
1918
+ id: string;
1919
+ /**
1920
+ * The four-character ICAO code for the airport
1921
+ */
1922
+ icao_code: string | null;
1923
+ /**
1924
+ * The ISO 3166-1 alpha-2 code for the country where the city is located
1925
+ */
1926
+ iata_country_code: string;
1927
+ /**
1928
+ * The 3-letter IATA code for the place
1929
+ */
1930
+ iata_code: string;
1931
+ /**
1932
+ * The 3-letter IATA code for the city where the place is located. Only present for airports which are registered with IATA as belonging to a metropolitan area.
1933
+ */
1934
+ iata_city_code: string | null;
1935
+ /**
1936
+ * The name of the country where the city or airport is located
1937
+ */
1938
+ country_name: string | null;
1939
+ /**
1940
+ * The name of the city (or cities separated by a /) where the airport is located
1941
+ */
1942
+ city_name: string | null;
1943
+ /**
1944
+ * The metropolitan area where the airport is located. Only present for airports which are registered with IATA as belonging to a metropolitan area.
1945
+ */
1946
+ city: City | null;
1947
+ /**
1948
+ * The airports associated to a city. This will only be provided where the type is city.
1949
+ */
1950
+ airports: Airport[] | null;
1951
+ }
1952
+
1892
1953
  /**
1893
1954
  * The metropolitan area where the airport is located.
1894
1955
  * Only present for airports which are registered with IATA as belonging to a metropolitan area.
@@ -2572,6 +2633,28 @@ declare class Airports extends Resource {
2572
2633
  listWithGenerator: () => AsyncGenerator<DuffelResponse<Airport>, void, unknown>;
2573
2634
  }
2574
2635
 
2636
+ interface PlacesSuggestionsParameters {
2637
+ /**
2638
+ * A search string for finding matching Places.
2639
+ */
2640
+ query: string;
2641
+ }
2642
+ /**
2643
+ * A Place is a city or airport that can serve as an origin or destination.
2644
+ * * @link https://duffel.com/docs/api/places
2645
+ */
2646
+ declare class Suggestions extends Resource {
2647
+ /**
2648
+ * Endpoint path
2649
+ */
2650
+ path: string;
2651
+ constructor(client: Client);
2652
+ /**
2653
+ * Retrieves a list of Places matching the provided query
2654
+ */
2655
+ list: (params: PlacesSuggestionsParameters) => Promise<DuffelResponse<Places[]>>;
2656
+ }
2657
+
2575
2658
  interface DuffelAPIClient {
2576
2659
  aircraft: Aircraft;
2577
2660
  airlines: Airlines;
@@ -2601,8 +2684,9 @@ declare class Duffel {
2601
2684
  payments: Payments;
2602
2685
  seatMaps: SeatMaps;
2603
2686
  paymentIntents: PaymentIntents;
2687
+ suggestions: Suggestions;
2604
2688
  constructor(config: Config);
2605
2689
  }
2606
2690
  declare const DuffelError: typeof DuffelError$1;
2607
2691
 
2608
- export { Aircraft$1 as Aircraft, Airline, Airport, ApiResponseError, ApiResponseMeta, BaggageType, CabinClass, City, ConfirmOrderChangePayment, CreateOfferRequest, CreateOfferRequestQueryParameters, CreateOrder, CreateOrderCancellation, CreateOrderChangeParameters, CreateOrderChangeRequest, CreateOrderPassenger, CreatePayment, CreatePaymentIntent, Duffel, DuffelAPIClient, DuffelError, DuffelPassengerGender, DuffelPassengerTitle, DuffelPassengerType, DuffelResponse, FlightsConditions, ListOffersParams, ListOrderCancellationsParams, ListParamsOrders, LoyaltyProgrammeAccount, LoyaltyProgrammeAccounts, Offer, OfferAvailableService, OfferAvailableServiceBaggageMetadata, OfferAvailableServiceMetadataMap, OfferAvailableServiceType, OfferPassenger, OfferRequest, OfferRequestPassenger, OfferRequestSlice, OfferSlice, OfferSliceSegment, OfferSliceSegmentPassenger, OfferSliceSegmentPassengerBaggage, Order, OrderCancellation, OrderChange, OrderChangeOffer, OrderChangeOfferSlice, OrderChangeOfferSlices, OrderChangeOffers$1 as OrderChangeOffers, OrderChangeRequestResponse, OrderChangeSliceResponse, OrderDocument, OrderDocumentsType, OrderPassenger, OrderPassengerIdentityDocument, OrderPayment, OrderPaymentStatus, OrderSegmentPassenger, OrderSegmentPassengerBaggage, OrderService, OrderServiceBaggageMetadata, OrderSlice, OrderSliceSegment, PaginationMeta, PassengerIdentityDocumentType, Payment, PaymentIntent, PaymentRequirements, PaymentType, Place, PlaceType, SDKOptions, Seat, SeatMap, SeatMapCabin, SeatMapCabinRow, SeatMapCabinRowSection, SeatMapCabinRowSectionAvailableService, SeatMapCabinRowSectionElement, SeatMapCabinRowSectionElementAmenity, SeatMapCabinRowSectionElementBassinet, SeatMapCabinRowSectionElementCloset, SeatMapCabinRowSectionElementEmpty, SeatMapCabinRowSectionElementExitRow, SeatMapCabinRowSectionElementGalley, SeatMapCabinRowSectionElementLavatory, SeatMapCabinRowSectionElementSeat, SeatMapCabinRowSectionElementStairs, SeatMapCabinRowSectionElementType, UpdateOffer, UpdateSingleOrder };
2692
+ export { Aircraft$1 as Aircraft, Airline, Airport, ApiResponseError, ApiResponseMeta, BaggageType, CabinClass, City, ConfirmOrderChangePayment, CreateOfferRequest, CreateOfferRequestQueryParameters, CreateOrder, CreateOrderCancellation, CreateOrderChangeParameters, CreateOrderChangeRequest, CreateOrderPassenger, CreatePayment, CreatePaymentIntent, Duffel, DuffelAPIClient, DuffelError, DuffelPassengerGender, DuffelPassengerTitle, DuffelPassengerType, DuffelResponse, FlightsConditions, ListOffersParams, ListOrderCancellationsParams, ListParamsOrders, LoyaltyProgrammeAccount, LoyaltyProgrammeAccounts, Offer, OfferAvailableService, OfferAvailableServiceBaggageMetadata, OfferAvailableServiceMetadataMap, OfferAvailableServiceType, OfferPassenger, OfferRequest, OfferRequestPassenger, OfferRequestSlice, OfferSlice, OfferSliceSegment, OfferSliceSegmentPassenger, OfferSliceSegmentPassengerBaggage, Order, OrderCancellation, OrderChange, OrderChangeOffer, OrderChangeOfferSlice, OrderChangeOfferSlices, OrderChangeOffers$1 as OrderChangeOffers, OrderChangeRequestResponse, OrderChangeSliceResponse, OrderDocument, OrderDocumentsType, OrderPassenger, OrderPassengerIdentityDocument, OrderPayment, OrderPaymentStatus, OrderSegmentPassenger, OrderSegmentPassengerBaggage, OrderService, OrderServiceBaggageMetadata, OrderSlice, OrderSliceSegment, PaginationMeta, PassengerIdentityDocumentType, Payment, PaymentIntent, PaymentRequirements, PaymentType, Place, PlaceType, Places, SDKOptions, Seat, SeatMap, SeatMapCabin, SeatMapCabinRow, SeatMapCabinRowSection, SeatMapCabinRowSectionAvailableService, SeatMapCabinRowSectionElement, SeatMapCabinRowSectionElementAmenity, SeatMapCabinRowSectionElementBassinet, SeatMapCabinRowSectionElementCloset, SeatMapCabinRowSectionElementEmpty, SeatMapCabinRowSectionElementExitRow, SeatMapCabinRowSectionElementGalley, SeatMapCabinRowSectionElementLavatory, SeatMapCabinRowSectionElementSeat, SeatMapCabinRowSectionElementStairs, SeatMapCabinRowSectionElementType, UpdateOffer, UpdateSingleOrder };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duffel/api",
3
- "version": "1.11.0",
3
+ "version": "1.13.1",
4
4
  "description": "Javascript client library for the Duffel API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -53,41 +53,41 @@
53
53
  "dependencies": {
54
54
  "@types/node": "^17.0.21",
55
55
  "@types/node-fetch": "^2.6.1",
56
- "node-fetch": "2.6.7"
56
+ "node-fetch": "3.2.8"
57
57
  },
58
58
  "devDependencies": {
59
- "@babel/core": "^7.15.5",
60
- "@babel/preset-env": "^7.15.4",
61
- "@babel/preset-typescript": "^7.14.5",
62
- "@commitlint/cli": "^17.0.1",
63
- "@commitlint/config-angular": "^17.0.0",
64
- "@commitlint/cz-commitlint": "^17.0.0",
65
- "@rollup/plugin-commonjs": "^22.0.0",
66
- "@rollup/plugin-multi-entry": "^4.0.0",
67
- "@rollup/plugin-node-resolve": "^13.1.3",
68
- "@types/jest": "^27.0.1",
69
- "@typescript-eslint/eslint-plugin": "^4.26.1",
70
- "@typescript-eslint/parser": "^4.26.1",
71
- "colors": "^1.4.0",
72
- "commitizen": "^4.2.4",
73
- "dotenv": "^16.0.0",
74
- "eslint": "^7.26.0",
75
- "eslint-config-prettier": "^8.3.0",
76
- "eslint-plugin-spellcheck": "^0.0.19",
77
- "husky": "^8.0.1",
78
- "jest": "^27.5.1",
79
- "lint-staged": "^13.0.0",
80
- "nock": "^13.1.0",
81
- "prettier": "^2.4.1",
82
- "rollup": "^2.66.1",
83
- "rollup-plugin-dts": "^4.1.0",
84
- "rollup-plugin-inject-process-env": "^1.3.1",
85
- "rollup-plugin-peer-deps-external": "^2.2.4",
86
- "rollup-plugin-terser": "^7.0.2",
87
- "rollup-plugin-typescript2": "^0.32.0",
88
- "ts-jest": "^27.1.2",
89
- "ts-node": "^10.0.0",
90
- "typescript": "^4.4.2"
59
+ "@babel/core": "7.18.6",
60
+ "@babel/preset-env": "7.18.6",
61
+ "@babel/preset-typescript": "7.18.6",
62
+ "@commitlint/cli": "17.0.3",
63
+ "@commitlint/config-angular": "17.0.3",
64
+ "@commitlint/cz-commitlint": "17.0.3",
65
+ "@rollup/plugin-commonjs": "22.0.1",
66
+ "@rollup/plugin-multi-entry": "4.1.0",
67
+ "@rollup/plugin-node-resolve": "13.3.0",
68
+ "@types/jest": "28.1.6",
69
+ "@typescript-eslint/eslint-plugin": "5.30.6",
70
+ "@typescript-eslint/parser": "5.30.6",
71
+ "colors": "1.4.0",
72
+ "commitizen": "4.2.5",
73
+ "dotenv": "16.0.1",
74
+ "eslint": "8.19.0",
75
+ "eslint-config-prettier": "8.5.0",
76
+ "eslint-plugin-spellcheck": "0.0.19",
77
+ "husky": "8.0.1",
78
+ "jest": "28.1.3",
79
+ "lint-staged": "13.0.3",
80
+ "nock": "13.2.8",
81
+ "prettier": "2.7.1",
82
+ "rollup": "2.76.0",
83
+ "rollup-plugin-dts": "4.2.2",
84
+ "rollup-plugin-inject-process-env": "1.3.1",
85
+ "rollup-plugin-peer-deps-external": "2.2.4",
86
+ "rollup-plugin-terser": "7.0.2",
87
+ "rollup-plugin-typescript2": "0.32.1",
88
+ "ts-jest": "28.0.6",
89
+ "ts-node": "10.9.1",
90
+ "typescript": "4.7.4"
91
91
  },
92
92
  "engines": {
93
93
  "node": ">=14.*"