@duffel/api 2.6.7 → 2.7.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.
|
@@ -389,6 +389,9 @@ export interface StaysQuote {
|
|
|
389
389
|
rooms: number;
|
|
390
390
|
}
|
|
391
391
|
export type StaysBookingStatus = 'confirmed' | 'cancelled';
|
|
392
|
+
export interface StaysBookingKeyCollection {
|
|
393
|
+
instructions: string;
|
|
394
|
+
}
|
|
392
395
|
export interface StaysBooking {
|
|
393
396
|
/**
|
|
394
397
|
* The ID of the booking
|
|
@@ -442,6 +445,10 @@ export interface StaysBooking {
|
|
|
442
445
|
* The number of rooms in the booking.
|
|
443
446
|
*/
|
|
444
447
|
rooms: number;
|
|
448
|
+
/**
|
|
449
|
+
* Instructions to access the accommodation in the booking
|
|
450
|
+
*/
|
|
451
|
+
key_collection: StaysBookingKeyCollection | null;
|
|
445
452
|
}
|
|
446
453
|
interface CommonStaysSearchParams {
|
|
447
454
|
check_in_date: string;
|
|
@@ -50,7 +50,7 @@ interface CreateOfferRequestPassengerCommon {
|
|
|
50
50
|
*/
|
|
51
51
|
loyalty_programme_accounts?: LoyaltyProgrammeAccount[];
|
|
52
52
|
}
|
|
53
|
-
interface CreateOfferRequestAdultPassenger extends CreateOfferRequestPassengerCommon {
|
|
53
|
+
export interface CreateOfferRequestAdultPassenger extends CreateOfferRequestPassengerCommon {
|
|
54
54
|
age?: never;
|
|
55
55
|
fare_type?: never;
|
|
56
56
|
/**
|
|
@@ -61,7 +61,7 @@ interface CreateOfferRequestAdultPassenger extends CreateOfferRequestPassengerCo
|
|
|
61
61
|
*/
|
|
62
62
|
type: Extract<DuffelPassengerType, 'adult'>;
|
|
63
63
|
}
|
|
64
|
-
interface CreateOfferRequestNonAdultPassenger extends CreateOfferRequestPassengerCommon {
|
|
64
|
+
export interface CreateOfferRequestNonAdultPassenger extends CreateOfferRequestPassengerCommon {
|
|
65
65
|
/**
|
|
66
66
|
* The age of the passenger on the `departure_date` of the final slice. e.g.
|
|
67
67
|
* if you a searching for a round trip and the passenger is 15 years old at
|
package/dist/index.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"node-fetch";import{URL as s,URLSearchParams as e}from"url";function i(t,s){var e={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&s.indexOf(i)<0&&(e[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(i=Object.getOwnPropertySymbols(t);h<i.length;h++)s.indexOf(i[h])<0&&Object.prototype.propertyIsEnumerable.call(t,i[h])&&(e[i[h]]=t[i[h]])}return e}function h(t,s,e,i){return new(e||(e=Promise))((function(h,r){function a(t){try{o(i.next(t))}catch(t){r(t)}}function n(t){try{o(i.throw(t))}catch(t){r(t)}}function o(t){var s;t.done?h(t.value):(s=t.value,s instanceof e?s:new e((function(t){t(s)}))).then(a,n)}o((i=i.apply(t,s||[])).next())}))}function r(t){return this instanceof r?(this.v=t,this):new r(t)}function a(t,s,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,h=e.apply(t,s||[]),a=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){h[t]&&(i[t]=function(s){return new Promise((function(e,i){a.push([t,s,e,i])>1||o(t,s)}))})}function o(t,s){try{(e=h[t](s)).value instanceof r?Promise.resolve(e.value.v).then(u,c):d(a[0][2],e)}catch(t){d(a[0][3],t)}var e}function u(t){o("next",t)}function c(t){o("throw",t)}function d(t,s){t(s),a.shift(),a.length&&o(a[0][0],a[0][1])}}!function(){const t={npm_package_version:"2.6.6"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}(),"function"==typeof SuppressedError&&SuppressedError;class n{constructor(t){this.request=({method:t,path:s,data:e,params:i})=>h(this,void 0,void 0,(function*(){return this.client.request({method:t,path:s,data:e,params:i})})),this.paginatedRequest=({path:t,params:s})=>this.client.paginatedRequest({path:t,params:s}),this.client=t}}class o extends n{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 u extends n{constructor(t){super(t),this.update=(t,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{action_taken:s}})})),this.accept=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/accept`})})),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:{order_id:t}})})),this.path="air/airline_initiated_changes"}}class c extends n{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:s}=t,e=i(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:e,params:Object.assign({},null!=s&&{return_offers:s})})})),this.path="air/offer_requests"}}class d extends n{constructor(t){super(t),this.get=(t,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:s})})),this.list=t=>{var{offer_request_id:s}=t,e=i(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},e),{offer_request_id:s})})},this.listWithGenerator=t=>{var{offer_request_id:s}=t,e=i(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},e),{offer_request_id:s})})},this.update=(t,s,e)=>h(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${s}`},e&&{data:e}))})),this.path="air/offers"}}class p extends n{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 n{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,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:s}})})),this.getAvailableServices=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:s})})),this.path="air/orders"}}class l extends n{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 v extends n{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 m extends n{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,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:s})})),this.path="air/order_changes"}}class q extends n{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 n{constructor(t){super(t),this.get=(t,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:s})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/fares`,params:s})})),this.path="air/partial_offer_requests"}}class $ extends n{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"}}let T=class extends Error{constructor({meta:t,errors:s,headers:e}){super(),this.meta=t,this.errors=s,this.headers=e}};class O{constructor({token:i,basePath:r,apiVersion:a,debug:n,source:o}){this.request=({method:i,path:r,data:a,params:n,compress:o=!0})=>h(this,void 0,void 0,(function*(){var h,u;let c,d;const p=new s(r,this.basePath),f={"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 e;Object.entries(n).sort().filter((t=>null!==t[0])).forEach((([s,e])=>{Array.isArray(e)?e.forEach((e=>t.append(s,e.toString()))):t.append(s,e.toString())})),p.search=t.toString()}a&&(c=JSON.stringify({data:Object.assign({},a)})),(null===(h=this.debug)||void 0===h?void 0:h.verbose)&&(console.info("Endpoint: ",p.href),console.info("Method: ",i),a&&console.info("Body Parameters: ",a),n&&console.info("Query Parameters: ",n));const l=yield t(p.href,{method:i,headers:f,body:c,compress:o});(null===(u=this.debug)||void 0===u?void 0:u.verbose)&&l.headers.get("x-request-id")&&console.info("Request ID: ",l.headers.get("x-request-id"));const v=l.headers.get("content-type");if(d=v&&v.includes("json")?yield l.json():yield l.text(),!l.ok||"errors"in d&&d.errors)throw new T(Object.assign(Object.assign({},d),{headers:l.headers}));return Object.assign(Object.assign({},d),{headers:l.headers})})),this.token=i,this.basePath=r||"https://api.duffel.com",this.apiVersion=a||"v1",this.debug=n,this.source=o}paginatedRequest({path:t,params:s}){return a(this,arguments,(function*(){let e=yield r(this.request({method:"GET",path:t,params:s}));for(const t of e.data)yield yield r({data:t});for(;e.meta&&"after"in e.meta&&e.meta.after;){e=yield r(this.request({method:"GET",path:t,params:{limit:e.meta.limit,after:e.meta.after}}));for(const t of e.data)yield yield r({data:t})}}))}}class y extends n{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 n{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 E extends n{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 w extends n{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"}}class G extends n{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="payments/refunds"}}class _ extends n{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="links/sessions"}}class P extends n{constructor(t){super(t),this.redeliver=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/events/${t}/actions/redeliver`})})),this.ping=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/ping`})})),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/events/${t}`})})),this.listDeliveries=t=>h(this,void 0,void 0,(function*(){var s=i(t,[]);return this.request({method:"GET",path:`${this.path}/deliveries`,params:Object.assign({},s)})})),this.delete=t=>h(this,void 0,void 0,(function*(){return this.request({method:"DELETE",path:`${this.path}/${t}`})})),this.update=(t,{active:s,events:e,url:i})=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{active:s,events:e,url:i}})})),this.list=t=>h(this,void 0,void 0,(function*(){var s=i(t,[]);return this.request({method:"GET",path:this.path,params:Object.assign({},s)})})),this.create=({events:t,url:s})=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{events:t,url:s}})})),this.path="air/webhooks"}}class S extends n{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.list=()=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path})})),this.cancel=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/cancel`})})),this.path="stays/bookings"}}class x extends n{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{rate_id:t}})})),this.path="stays/quotes"}}class j extends n{constructor(t){super(t),this.fetchAllRates=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/fetch_all_rates`})})),this.path="stays/search_results"}}class R extends n{constructor(t){super(t),this.search=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/search`,data:t})})),this.path="stays",this.searchResults=new j(t),this.quotes=new x(t),this.bookings=new S(t)}}class k extends n{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="vault/cards"}}class A{constructor(t){this.client=new O(t),this.aircraft=new y(this.client),this.airlines=new b(this.client),this.airports=new E(this.client),this.airlineInitiatedChanges=new u(this.client),this.links=new _(this.client),this.offerRequests=new c(this.client),this.offers=new d(this.client),this.orders=new f(this.client),this.orderChangeRequests=new l(this.client),this.orderChangeOffers=new v(this.client),this.orderChanges=new m(this.client),this.orderCancellations=new p(this.client),this.payments=new q(this.client),this.seatMaps=new $(this.client),this.paymentIntents=new o(this.client),this.partialOfferRequests=new g(this.client),this.suggestions=new w(this.client),this.refunds=new G(this.client),this.webhooks=new P(this.client),this.stays=new R(this.client),this.cardsClient=new O(Object.assign(Object.assign({},t),{basePath:"https://api.duffel.cards"})),this.cards=new k(this.cardsClient)}}const C=T;export{A as Duffel,C as DuffelError};
|
|
1
|
+
import t from"node-fetch";import{URL as s,URLSearchParams as e}from"url";function i(t,s){var e={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&s.indexOf(i)<0&&(e[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(i=Object.getOwnPropertySymbols(t);h<i.length;h++)s.indexOf(i[h])<0&&Object.prototype.propertyIsEnumerable.call(t,i[h])&&(e[i[h]]=t[i[h]])}return e}function h(t,s,e,i){return new(e||(e=Promise))((function(h,r){function a(t){try{o(i.next(t))}catch(t){r(t)}}function n(t){try{o(i.throw(t))}catch(t){r(t)}}function o(t){var s;t.done?h(t.value):(s=t.value,s instanceof e?s:new e((function(t){t(s)}))).then(a,n)}o((i=i.apply(t,s||[])).next())}))}function r(t){return this instanceof r?(this.v=t,this):new r(t)}function a(t,s,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,h=e.apply(t,s||[]),a=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){h[t]&&(i[t]=function(s){return new Promise((function(e,i){a.push([t,s,e,i])>1||o(t,s)}))})}function o(t,s){try{(e=h[t](s)).value instanceof r?Promise.resolve(e.value.v).then(u,c):d(a[0][2],e)}catch(t){d(a[0][3],t)}var e}function u(t){o("next",t)}function c(t){o("throw",t)}function d(t,s){t(s),a.shift(),a.length&&o(a[0][0],a[0][1])}}!function(){const t={npm_package_version:"2.6.8"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}(),"function"==typeof SuppressedError&&SuppressedError;class n{constructor(t){this.request=({method:t,path:s,data:e,params:i})=>h(this,void 0,void 0,(function*(){return this.client.request({method:t,path:s,data:e,params:i})})),this.paginatedRequest=({path:t,params:s})=>this.client.paginatedRequest({path:t,params:s}),this.client=t}}class o extends n{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 u extends n{constructor(t){super(t),this.update=(t,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{action_taken:s}})})),this.accept=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/accept`})})),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:{order_id:t}})})),this.path="air/airline_initiated_changes"}}class c extends n{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:s}=t,e=i(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:e,params:Object.assign({},null!=s&&{return_offers:s})})})),this.path="air/offer_requests"}}class d extends n{constructor(t){super(t),this.get=(t,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:s})})),this.list=t=>{var{offer_request_id:s}=t,e=i(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},e),{offer_request_id:s})})},this.listWithGenerator=t=>{var{offer_request_id:s}=t,e=i(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},e),{offer_request_id:s})})},this.update=(t,s,e)=>h(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${s}`},e&&{data:e}))})),this.path="air/offers"}}class p extends n{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 n{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,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:s}})})),this.getAvailableServices=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:s})})),this.path="air/orders"}}class l extends n{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 v extends n{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 m extends n{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,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:s})})),this.path="air/order_changes"}}class q extends n{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 n{constructor(t){super(t),this.get=(t,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:s})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,s)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/fares`,params:s})})),this.path="air/partial_offer_requests"}}class $ extends n{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"}}let T=class extends Error{constructor({meta:t,errors:s,headers:e}){super(),this.meta=t,this.errors=s,this.headers=e}};class O{constructor({token:i,basePath:r,apiVersion:a,debug:n,source:o}){this.request=({method:i,path:r,data:a,params:n,compress:o=!0})=>h(this,void 0,void 0,(function*(){var h,u;let c,d;const p=new s(r,this.basePath),f={"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 e;Object.entries(n).sort().filter((t=>null!==t[0])).forEach((([s,e])=>{Array.isArray(e)?e.forEach((e=>t.append(s,e.toString()))):t.append(s,e.toString())})),p.search=t.toString()}a&&(c=JSON.stringify({data:Object.assign({},a)})),(null===(h=this.debug)||void 0===h?void 0:h.verbose)&&(console.info("Endpoint: ",p.href),console.info("Method: ",i),a&&console.info("Body Parameters: ",a),n&&console.info("Query Parameters: ",n));const l=yield t(p.href,{method:i,headers:f,body:c,compress:o});(null===(u=this.debug)||void 0===u?void 0:u.verbose)&&l.headers.get("x-request-id")&&console.info("Request ID: ",l.headers.get("x-request-id"));const v=l.headers.get("content-type");if(d=v&&v.includes("json")?yield l.json():yield l.text(),!l.ok||"errors"in d&&d.errors)throw new T(Object.assign(Object.assign({},d),{headers:l.headers}));return Object.assign(Object.assign({},d),{headers:l.headers})})),this.token=i,this.basePath=r||"https://api.duffel.com",this.apiVersion=a||"v1",this.debug=n,this.source=o}paginatedRequest({path:t,params:s}){return a(this,arguments,(function*(){let e=yield r(this.request({method:"GET",path:t,params:s}));for(const t of e.data)yield yield r({data:t});for(;e.meta&&"after"in e.meta&&e.meta.after;){e=yield r(this.request({method:"GET",path:t,params:{limit:e.meta.limit,after:e.meta.after}}));for(const t of e.data)yield yield r({data:t})}}))}}class y extends n{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 n{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 E extends n{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 w extends n{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"}}class G extends n{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="payments/refunds"}}class _ extends n{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="links/sessions"}}class P extends n{constructor(t){super(t),this.redeliver=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/events/${t}/actions/redeliver`})})),this.ping=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/ping`})})),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/events/${t}`})})),this.listDeliveries=t=>h(this,void 0,void 0,(function*(){var s=i(t,[]);return this.request({method:"GET",path:`${this.path}/deliveries`,params:Object.assign({},s)})})),this.delete=t=>h(this,void 0,void 0,(function*(){return this.request({method:"DELETE",path:`${this.path}/${t}`})})),this.update=(t,{active:s,events:e,url:i})=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{active:s,events:e,url:i}})})),this.list=t=>h(this,void 0,void 0,(function*(){var s=i(t,[]);return this.request({method:"GET",path:this.path,params:Object.assign({},s)})})),this.create=({events:t,url:s})=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{events:t,url:s}})})),this.path="air/webhooks"}}class S extends n{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.list=()=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path})})),this.cancel=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/cancel`})})),this.path="stays/bookings"}}class x extends n{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{rate_id:t}})})),this.path="stays/quotes"}}class j extends n{constructor(t){super(t),this.fetchAllRates=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/fetch_all_rates`})})),this.path="stays/search_results"}}class R extends n{constructor(t){super(t),this.search=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/search`,data:t})})),this.path="stays",this.searchResults=new j(t),this.quotes=new x(t),this.bookings=new S(t)}}class k extends n{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="vault/cards"}}class A{constructor(t){this.client=new O(t),this.aircraft=new y(this.client),this.airlines=new b(this.client),this.airports=new E(this.client),this.airlineInitiatedChanges=new u(this.client),this.links=new _(this.client),this.offerRequests=new c(this.client),this.offers=new d(this.client),this.orders=new f(this.client),this.orderChangeRequests=new l(this.client),this.orderChangeOffers=new v(this.client),this.orderChanges=new m(this.client),this.orderCancellations=new p(this.client),this.payments=new q(this.client),this.seatMaps=new $(this.client),this.paymentIntents=new o(this.client),this.partialOfferRequests=new g(this.client),this.suggestions=new w(this.client),this.refunds=new G(this.client),this.webhooks=new P(this.client),this.stays=new R(this.client),this.cardsClient=new O(Object.assign(Object.assign({},t),{basePath:"https://api.duffel.cards"})),this.cards=new k(this.cardsClient)}}const C=T;export{A as Duffel,C as DuffelError};
|
|
2
2
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("node-fetch"),s=require("url");function e(t,s){var e={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&s.indexOf(i)<0&&(e[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(i=Object.getOwnPropertySymbols(t);h<i.length;h++)s.indexOf(i[h])<0&&Object.prototype.propertyIsEnumerable.call(t,i[h])&&(e[i[h]]=t[i[h]])}return e}function i(t,s,e,i){return new(e||(e=Promise))((function(h,r){function a(t){try{o(i.next(t))}catch(t){r(t)}}function n(t){try{o(i.throw(t))}catch(t){r(t)}}function o(t){var s;t.done?h(t.value):(s=t.value,s instanceof e?s:new e((function(t){t(s)}))).then(a,n)}o((i=i.apply(t,s||[])).next())}))}function h(t){return this instanceof h?(this.v=t,this):new h(t)}function r(t,s,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=e.apply(t,s||[]),a=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){r[t]&&(i[t]=function(s){return new Promise((function(e,i){a.push([t,s,e,i])>1||o(t,s)}))})}function o(t,s){try{(e=r[t](s)).value instanceof h?Promise.resolve(e.value.v).then(u,c):d(a[0][2],e)}catch(t){d(a[0][3],t)}var e}function u(t){o("next",t)}function c(t){o("throw",t)}function d(t,s){t(s),a.shift(),a.length&&o(a[0][0],a[0][1])}}!function(){const t={npm_package_version:"2.6.6"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}(),"function"==typeof SuppressedError&&SuppressedError;class a{constructor(t){this.request=({method:t,path:s,data:e,params:h})=>i(this,void 0,void 0,(function*(){return this.client.request({method:t,path:s,data:e,params:h})})),this.paginatedRequest=({path:t,params:s})=>this.client.paginatedRequest({path:t,params:s}),this.client=t}}class n extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class o extends a{constructor(t){super(t),this.update=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{action_taken:s}})})),this.accept=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/accept`})})),this.list=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:{order_id:t}})})),this.path="air/airline_initiated_changes"}}class u extends a{constructor(t){super(t),this.get=t=>i(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=>i(this,void 0,void 0,(function*(){const{return_offers:s}=t,i=e(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:i,params:Object.assign({},null!=s&&{return_offers:s})})})),this.path="air/offer_requests"}}class c extends a{constructor(t){super(t),this.get=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:s})})),this.list=t=>{var{offer_request_id:s}=t,i=e(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},i),{offer_request_id:s})})},this.listWithGenerator=t=>{var{offer_request_id:s}=t,i=e(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},i),{offer_request_id:s})})},this.update=(t,s,e)=>i(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${s}`},e&&{data:e}))})),this.path="air/offers"}}class d extends a{constructor(t){super(t),this.get=t=>i(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=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class p extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>i(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=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:s}})})),this.getAvailableServices=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:s})})),this.path="air/orders"}}class f extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>i(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 a{constructor(t){super(t),this.get=t=>i(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 a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:s})})),this.path="air/order_changes"}}class m extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class q extends a{constructor(t){super(t),this.get=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:s})})),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/fares`,params:s})})),this.path="air/partial_offer_requests"}}class g extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}let $=class extends Error{constructor({meta:t,errors:s,headers:e}){super(),this.meta=t,this.errors=s,this.headers=e}};class T{constructor({token:e,basePath:h,apiVersion:r,debug:a,source:n}){this.request=({method:e,path:h,data:r,params:a,compress:n=!0})=>i(this,void 0,void 0,(function*(){var i,o;let u,c;const d=new s.URL(h,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 s.URLSearchParams;Object.entries(a).sort().filter((t=>null!==t[0])).forEach((([s,e])=>{Array.isArray(e)?e.forEach((e=>t.append(s,e.toString()))):t.append(s,e.toString())})),d.search=t.toString()}r&&(u=JSON.stringify({data:Object.assign({},r)})),(null===(i=this.debug)||void 0===i?void 0:i.verbose)&&(console.info("Endpoint: ",d.href),console.info("Method: ",e),r&&console.info("Body Parameters: ",r),a&&console.info("Query Parameters: ",a));const f=yield t(d.href,{method:e,headers:p,body:u,compress:n});(null===(o=this.debug)||void 0===o?void 0:o.verbose)&&f.headers.get("x-request-id")&&console.info("Request ID: ",f.headers.get("x-request-id"));const 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 $(Object.assign(Object.assign({},c),{headers:f.headers}));return Object.assign(Object.assign({},c),{headers:f.headers})})),this.token=e,this.basePath=h||"https://api.duffel.com",this.apiVersion=r||"v1",this.debug=a,this.source=n}paginatedRequest({path:t,params:s}){return r(this,arguments,(function*(){let e=yield h(this.request({method:"GET",path:t,params:s}));for(const t of e.data)yield yield h({data:t});for(;e.meta&&"after"in e.meta&&e.meta.after;){e=yield h(this.request({method:"GET",path:t,params:{limit:e.meta.limit,after:e.meta.after}}));for(const t of e.data)yield yield h({data:t})}}))}}class O extends a{constructor(t){super(t),this.get=t=>i(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 y extends a{constructor(t){super(t),this.get=t=>i(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 b extends a{constructor(t){super(t),this.get=t=>i(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 E extends a{constructor(t){super(t),this.list=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="places/suggestions"}}class w extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/refunds"}}class G extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="links/sessions"}}class P extends a{constructor(t){super(t),this.redeliver=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/events/${t}/actions/redeliver`})})),this.ping=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/ping`})})),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/events/${t}`})})),this.listDeliveries=t=>i(this,void 0,void 0,(function*(){var s=e(t,[]);return this.request({method:"GET",path:`${this.path}/deliveries`,params:Object.assign({},s)})})),this.delete=t=>i(this,void 0,void 0,(function*(){return this.request({method:"DELETE",path:`${this.path}/${t}`})})),this.update=(t,{active:s,events:e,url:h})=>i(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{active:s,events:e,url:h}})})),this.list=t=>i(this,void 0,void 0,(function*(){var s=e(t,[]);return this.request({method:"GET",path:this.path,params:Object.assign({},s)})})),this.create=({events:t,url:s})=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{events:t,url:s}})})),this.path="air/webhooks"}}class _ extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=()=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path})})),this.cancel=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/cancel`})})),this.path="stays/bookings"}}class S extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{rate_id:t}})})),this.path="stays/quotes"}}class x extends a{constructor(t){super(t),this.fetchAllRates=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/fetch_all_rates`})})),this.path="stays/search_results"}}class j extends a{constructor(t){super(t),this.search=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/search`,data:t})})),this.path="stays",this.searchResults=new x(t),this.quotes=new S(t),this.bookings=new _(t)}}class R extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="vault/cards"}}const k=$;exports.Duffel=class{constructor(t){this.client=new T(t),this.aircraft=new O(this.client),this.airlines=new y(this.client),this.airports=new b(this.client),this.airlineInitiatedChanges=new o(this.client),this.links=new G(this.client),this.offerRequests=new u(this.client),this.offers=new c(this.client),this.orders=new p(this.client),this.orderChangeRequests=new f(this.client),this.orderChangeOffers=new l(this.client),this.orderChanges=new v(this.client),this.orderCancellations=new d(this.client),this.payments=new m(this.client),this.seatMaps=new g(this.client),this.paymentIntents=new n(this.client),this.partialOfferRequests=new q(this.client),this.suggestions=new E(this.client),this.refunds=new w(this.client),this.webhooks=new P(this.client),this.stays=new j(this.client),this.cardsClient=new T(Object.assign(Object.assign({},t),{basePath:"https://api.duffel.cards"})),this.cards=new R(this.cardsClient)}},exports.DuffelError=k;
|
|
1
|
+
"use strict";var t=require("node-fetch"),s=require("url");function e(t,s){var e={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&s.indexOf(i)<0&&(e[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(i=Object.getOwnPropertySymbols(t);h<i.length;h++)s.indexOf(i[h])<0&&Object.prototype.propertyIsEnumerable.call(t,i[h])&&(e[i[h]]=t[i[h]])}return e}function i(t,s,e,i){return new(e||(e=Promise))((function(h,r){function a(t){try{o(i.next(t))}catch(t){r(t)}}function n(t){try{o(i.throw(t))}catch(t){r(t)}}function o(t){var s;t.done?h(t.value):(s=t.value,s instanceof e?s:new e((function(t){t(s)}))).then(a,n)}o((i=i.apply(t,s||[])).next())}))}function h(t){return this instanceof h?(this.v=t,this):new h(t)}function r(t,s,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=e.apply(t,s||[]),a=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){r[t]&&(i[t]=function(s){return new Promise((function(e,i){a.push([t,s,e,i])>1||o(t,s)}))})}function o(t,s){try{(e=r[t](s)).value instanceof h?Promise.resolve(e.value.v).then(u,c):d(a[0][2],e)}catch(t){d(a[0][3],t)}var e}function u(t){o("next",t)}function c(t){o("throw",t)}function d(t,s){t(s),a.shift(),a.length&&o(a[0][0],a[0][1])}}!function(){const t={npm_package_version:"2.6.8"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}(),"function"==typeof SuppressedError&&SuppressedError;class a{constructor(t){this.request=({method:t,path:s,data:e,params:h})=>i(this,void 0,void 0,(function*(){return this.client.request({method:t,path:s,data:e,params:h})})),this.paginatedRequest=({path:t,params:s})=>this.client.paginatedRequest({path:t,params:s}),this.client=t}}class n extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class o extends a{constructor(t){super(t),this.update=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{action_taken:s}})})),this.accept=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/accept`})})),this.list=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:{order_id:t}})})),this.path="air/airline_initiated_changes"}}class u extends a{constructor(t){super(t),this.get=t=>i(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=>i(this,void 0,void 0,(function*(){const{return_offers:s}=t,i=e(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:i,params:Object.assign({},null!=s&&{return_offers:s})})})),this.path="air/offer_requests"}}class c extends a{constructor(t){super(t),this.get=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:s})})),this.list=t=>{var{offer_request_id:s}=t,i=e(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},i),{offer_request_id:s})})},this.listWithGenerator=t=>{var{offer_request_id:s}=t,i=e(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},i),{offer_request_id:s})})},this.update=(t,s,e)=>i(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${s}`},e&&{data:e}))})),this.path="air/offers"}}class d extends a{constructor(t){super(t),this.get=t=>i(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=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class p extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>i(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=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:s}})})),this.getAvailableServices=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:s})})),this.path="air/orders"}}class f extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>i(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 a{constructor(t){super(t),this.get=t=>i(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 a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:s})})),this.path="air/order_changes"}}class m extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class q extends a{constructor(t){super(t),this.get=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:s})})),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,s)=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/fares`,params:s})})),this.path="air/partial_offer_requests"}}class g extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}let $=class extends Error{constructor({meta:t,errors:s,headers:e}){super(),this.meta=t,this.errors=s,this.headers=e}};class T{constructor({token:e,basePath:h,apiVersion:r,debug:a,source:n}){this.request=({method:e,path:h,data:r,params:a,compress:n=!0})=>i(this,void 0,void 0,(function*(){var i,o;let u,c;const d=new s.URL(h,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 s.URLSearchParams;Object.entries(a).sort().filter((t=>null!==t[0])).forEach((([s,e])=>{Array.isArray(e)?e.forEach((e=>t.append(s,e.toString()))):t.append(s,e.toString())})),d.search=t.toString()}r&&(u=JSON.stringify({data:Object.assign({},r)})),(null===(i=this.debug)||void 0===i?void 0:i.verbose)&&(console.info("Endpoint: ",d.href),console.info("Method: ",e),r&&console.info("Body Parameters: ",r),a&&console.info("Query Parameters: ",a));const f=yield t(d.href,{method:e,headers:p,body:u,compress:n});(null===(o=this.debug)||void 0===o?void 0:o.verbose)&&f.headers.get("x-request-id")&&console.info("Request ID: ",f.headers.get("x-request-id"));const 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 $(Object.assign(Object.assign({},c),{headers:f.headers}));return Object.assign(Object.assign({},c),{headers:f.headers})})),this.token=e,this.basePath=h||"https://api.duffel.com",this.apiVersion=r||"v1",this.debug=a,this.source=n}paginatedRequest({path:t,params:s}){return r(this,arguments,(function*(){let e=yield h(this.request({method:"GET",path:t,params:s}));for(const t of e.data)yield yield h({data:t});for(;e.meta&&"after"in e.meta&&e.meta.after;){e=yield h(this.request({method:"GET",path:t,params:{limit:e.meta.limit,after:e.meta.after}}));for(const t of e.data)yield yield h({data:t})}}))}}class O extends a{constructor(t){super(t),this.get=t=>i(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 y extends a{constructor(t){super(t),this.get=t=>i(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 b extends a{constructor(t){super(t),this.get=t=>i(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 E extends a{constructor(t){super(t),this.list=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="places/suggestions"}}class w extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/refunds"}}class G extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="links/sessions"}}class P extends a{constructor(t){super(t),this.redeliver=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/events/${t}/actions/redeliver`})})),this.ping=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/ping`})})),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/events/${t}`})})),this.listDeliveries=t=>i(this,void 0,void 0,(function*(){var s=e(t,[]);return this.request({method:"GET",path:`${this.path}/deliveries`,params:Object.assign({},s)})})),this.delete=t=>i(this,void 0,void 0,(function*(){return this.request({method:"DELETE",path:`${this.path}/${t}`})})),this.update=(t,{active:s,events:e,url:h})=>i(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{active:s,events:e,url:h}})})),this.list=t=>i(this,void 0,void 0,(function*(){var s=e(t,[]);return this.request({method:"GET",path:this.path,params:Object.assign({},s)})})),this.create=({events:t,url:s})=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{events:t,url:s}})})),this.path="air/webhooks"}}class _ extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=()=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path})})),this.cancel=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/cancel`})})),this.path="stays/bookings"}}class S extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{rate_id:t}})})),this.path="stays/quotes"}}class x extends a{constructor(t){super(t),this.fetchAllRates=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/fetch_all_rates`})})),this.path="stays/search_results"}}class j extends a{constructor(t){super(t),this.search=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/search`,data:t})})),this.path="stays",this.searchResults=new x(t),this.quotes=new S(t),this.bookings=new _(t)}}class R extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="vault/cards"}}const k=$;exports.Duffel=class{constructor(t){this.client=new T(t),this.aircraft=new O(this.client),this.airlines=new y(this.client),this.airports=new b(this.client),this.airlineInitiatedChanges=new o(this.client),this.links=new G(this.client),this.offerRequests=new u(this.client),this.offers=new c(this.client),this.orders=new p(this.client),this.orderChangeRequests=new f(this.client),this.orderChangeOffers=new l(this.client),this.orderChanges=new v(this.client),this.orderCancellations=new d(this.client),this.payments=new m(this.client),this.seatMaps=new g(this.client),this.paymentIntents=new n(this.client),this.partialOfferRequests=new q(this.client),this.suggestions=new E(this.client),this.refunds=new w(this.client),this.webhooks=new P(this.client),this.stays=new j(this.client),this.cardsClient=new T(Object.assign(Object.assign({},t),{basePath:"https://api.duffel.cards"})),this.cards=new R(this.cardsClient)}},exports.DuffelError=k;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/typings.d.ts
CHANGED
|
@@ -207,6 +207,9 @@ declare module '@duffel/api/booking/SeatMaps' {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
declare module '@duffel/api/types' {
|
|
210
|
+
export * from '@duffel/api/DuffelPayments/PaymentIntents/PaymentIntentsType';
|
|
211
|
+
export * from '@duffel/api/Places/Suggestions/SuggestionsType';
|
|
212
|
+
export * from '@duffel/api/Stays/StaysTypes';
|
|
210
213
|
export * from '@duffel/api/booking/AirlineInitiatedChanges/AirlineInitiatedChangesTypes';
|
|
211
214
|
export * from '@duffel/api/booking/OfferRequests/OfferRequestsTypes';
|
|
212
215
|
export * from '@duffel/api/booking/Offers/OfferTypes';
|
|
@@ -217,15 +220,13 @@ declare module '@duffel/api/types' {
|
|
|
217
220
|
export * from '@duffel/api/booking/Orders/OrdersTypes';
|
|
218
221
|
export * from '@duffel/api/booking/Payments/PaymentsTypes';
|
|
219
222
|
export * from '@duffel/api/booking/SeatMaps/SeatMapTypes';
|
|
223
|
+
export * from '@duffel/api/notifications/Webhooks/WebhooksType';
|
|
220
224
|
export * from '@duffel/api/supportingResources/Aircraft/AircraftTypes';
|
|
221
225
|
export * from '@duffel/api/supportingResources/Airlines/AirlinesTypes';
|
|
222
226
|
export * from '@duffel/api/supportingResources/Airports/AirportsTypes';
|
|
223
|
-
export * from '@duffel/api/DuffelPayments/PaymentIntents/PaymentIntentsType';
|
|
224
|
-
export * from '@duffel/api/Places/Suggestions/SuggestionsType';
|
|
225
|
-
export * from '@duffel/api/types/shared';
|
|
226
227
|
export * from '@duffel/api/types/ClientType';
|
|
227
|
-
export * from '@duffel/api/
|
|
228
|
-
export * from '@duffel/api/
|
|
228
|
+
export * from '@duffel/api/types/Identity';
|
|
229
|
+
export * from '@duffel/api/types/shared';
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
declare module '@duffel/api/supportingResources/Aircraft' {
|
|
@@ -711,6 +712,9 @@ declare module '@duffel/api/Stays/StaysTypes' {
|
|
|
711
712
|
rooms: number;
|
|
712
713
|
}
|
|
713
714
|
export type StaysBookingStatus = 'confirmed' | 'cancelled';
|
|
715
|
+
export interface StaysBookingKeyCollection {
|
|
716
|
+
instructions: string;
|
|
717
|
+
}
|
|
714
718
|
export interface StaysBooking {
|
|
715
719
|
/**
|
|
716
720
|
* The ID of the booking
|
|
@@ -764,6 +768,10 @@ declare module '@duffel/api/Stays/StaysTypes' {
|
|
|
764
768
|
* The number of rooms in the booking.
|
|
765
769
|
*/
|
|
766
770
|
rooms: number;
|
|
771
|
+
/**
|
|
772
|
+
* Instructions to access the accommodation in the booking
|
|
773
|
+
*/
|
|
774
|
+
key_collection: StaysBookingKeyCollection | null;
|
|
767
775
|
}
|
|
768
776
|
interface CommonStaysSearchParams {
|
|
769
777
|
check_in_date: string;
|
|
@@ -1380,6 +1388,183 @@ declare module '@duffel/api/booking/SeatMaps/SeatMaps' {
|
|
|
1380
1388
|
}
|
|
1381
1389
|
}
|
|
1382
1390
|
|
|
1391
|
+
declare module '@duffel/api/DuffelPayments/PaymentIntents/PaymentIntentsType' {
|
|
1392
|
+
export interface PaymentIntent {
|
|
1393
|
+
/**
|
|
1394
|
+
* The amount of the Payment Intent that covers the cost of the flight being sold and any additional markup.
|
|
1395
|
+
* The card payment will be charged this amount.
|
|
1396
|
+
*/
|
|
1397
|
+
amount: string;
|
|
1398
|
+
/**
|
|
1399
|
+
* The [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code of the country that issued the card used to confirm the Payment Intent.
|
|
1400
|
+
* It will be null until the Payment Intent is confirmed.
|
|
1401
|
+
*/
|
|
1402
|
+
card_country_code: string | null;
|
|
1403
|
+
/**
|
|
1404
|
+
* The last four digits of the card used to confirm the Payment Intent.
|
|
1405
|
+
* It will be null until the Payment Intent is confirmed.
|
|
1406
|
+
*/
|
|
1407
|
+
card_last_four_digits: string | null;
|
|
1408
|
+
/**
|
|
1409
|
+
* The card network in which the Payment Intent was processed on.
|
|
1410
|
+
* It will be null until the Payment Intent is confirmed.
|
|
1411
|
+
*/
|
|
1412
|
+
card_network: 'amex' | 'cartes_bancaires' | 'diners' | 'discover' | 'interac' | 'jcb' | 'mastercard' | 'unionpay' | 'visa' | 'unknown' | null;
|
|
1413
|
+
/**
|
|
1414
|
+
* This value is used when displaying the payment collection form to securely identify and transmit the values to Duffel.
|
|
1415
|
+
*/
|
|
1416
|
+
client_token: string;
|
|
1417
|
+
/**
|
|
1418
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the Payment Intent was confirmed
|
|
1419
|
+
*/
|
|
1420
|
+
confirmed_at: string;
|
|
1421
|
+
/**
|
|
1422
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the Payment Intent was created
|
|
1423
|
+
*/
|
|
1424
|
+
created_at: string;
|
|
1425
|
+
/**
|
|
1426
|
+
* The currency of the `amount`, as an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code.
|
|
1427
|
+
* The card payment will be charged in this currency.
|
|
1428
|
+
* If it's different to your Balance currency, it will be converted to your Balance currency before the Balance is topped up.
|
|
1429
|
+
*/
|
|
1430
|
+
currency: string;
|
|
1431
|
+
/**
|
|
1432
|
+
* The amount of the fees to process the Payment Intent.
|
|
1433
|
+
* It will be `null` until the Payment Intent is confirmed.
|
|
1434
|
+
*/
|
|
1435
|
+
fees_amount: string | null;
|
|
1436
|
+
/**
|
|
1437
|
+
* The currency of the fees_amount, as an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code.
|
|
1438
|
+
* This currency will match your Balance currency.
|
|
1439
|
+
* It will be null until the Payment Intent is confirmed.
|
|
1440
|
+
*/
|
|
1441
|
+
fees_currency: string | null;
|
|
1442
|
+
/**
|
|
1443
|
+
* Duffel's unique identifier for the `Payment Intent`
|
|
1444
|
+
*/
|
|
1445
|
+
id: string;
|
|
1446
|
+
/**
|
|
1447
|
+
* Whether the Payment Intent was created in live mode. This field will be set to `true` if the Payment Intent was created in live mode, or `false` if it was created in test mode.
|
|
1448
|
+
*/
|
|
1449
|
+
live_mode: boolean;
|
|
1450
|
+
/**
|
|
1451
|
+
* The amount of the Payment Intent that was added to the Balance.
|
|
1452
|
+
* It'll be `amount` (in the Balance currency) less the `fees_amount`.
|
|
1453
|
+
* It will be `null` until the Payment Intent is confirmed.
|
|
1454
|
+
*/
|
|
1455
|
+
net_amount: string | null;
|
|
1456
|
+
/**
|
|
1457
|
+
* The currency of the net_amount, as an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code.
|
|
1458
|
+
* This currency will match your Balance currency.
|
|
1459
|
+
* It will be null until the Payment Intent is confirmed.
|
|
1460
|
+
*/
|
|
1461
|
+
net_currency: string | null;
|
|
1462
|
+
/**
|
|
1463
|
+
* The Refunds for this Payment Intent
|
|
1464
|
+
* @link https://duffel.com/docs/api/payment-intents/schema#payment-intents-schema-refunds
|
|
1465
|
+
*/
|
|
1466
|
+
refunds: {
|
|
1467
|
+
amount: string;
|
|
1468
|
+
arrival: string;
|
|
1469
|
+
created_at: string;
|
|
1470
|
+
currency: string;
|
|
1471
|
+
destination: string;
|
|
1472
|
+
id: string;
|
|
1473
|
+
live_mode: boolean;
|
|
1474
|
+
net_amount: string;
|
|
1475
|
+
net_currency: string;
|
|
1476
|
+
payment_intent_id: string;
|
|
1477
|
+
status: 'succeeded' | 'pending' | 'failed';
|
|
1478
|
+
updated_at: string;
|
|
1479
|
+
}[];
|
|
1480
|
+
/**
|
|
1481
|
+
* The status of this Payment Intent
|
|
1482
|
+
*/
|
|
1483
|
+
status: null | 'requires_payment_method' | 'requires_confirmation' | 'requires_action' | 'processing' | 'requires_capture' | 'cancelled' | 'succeeded';
|
|
1484
|
+
/**
|
|
1485
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the Payment Intent was updated
|
|
1486
|
+
*/
|
|
1487
|
+
updated_at: string;
|
|
1488
|
+
}
|
|
1489
|
+
export interface CreatePaymentIntent {
|
|
1490
|
+
/**
|
|
1491
|
+
* This is the amount that the card payment being taken will be charged.
|
|
1492
|
+
* It should be enough to cover the service(s) you want to sell (enough to book an Offer for example) and the processing fees.
|
|
1493
|
+
* If the currency is different from your Balance currency you should also account for foreign exchange.
|
|
1494
|
+
* It can be higher than that, in which case the remainder will be considered your markup.
|
|
1495
|
+
* If it's higher than the maximum allowed for you organisation you will get a validation error. By default the maximum is 5,000.00 GBP (or equivalent in the same currency). If you need a maximum higher than the default please get in touch with us via help@duffel.com.
|
|
1496
|
+
*/
|
|
1497
|
+
amount: string;
|
|
1498
|
+
/**
|
|
1499
|
+
* The currency of the amount, as an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code.
|
|
1500
|
+
* This is going to be the currency that the card payment being taken in will be charged in.
|
|
1501
|
+
*/
|
|
1502
|
+
currency: string;
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
declare module '@duffel/api/Places/Suggestions/SuggestionsType' {
|
|
1507
|
+
import { Airport, City } from '@duffel/api/types';
|
|
1508
|
+
export interface Places {
|
|
1509
|
+
/**
|
|
1510
|
+
* The type of the place
|
|
1511
|
+
*/
|
|
1512
|
+
type: string;
|
|
1513
|
+
/**
|
|
1514
|
+
* The time zone of the airport, specified by name from the tz database
|
|
1515
|
+
*/
|
|
1516
|
+
time_zone: string | null;
|
|
1517
|
+
/**
|
|
1518
|
+
* The name of the place
|
|
1519
|
+
*/
|
|
1520
|
+
name: string;
|
|
1521
|
+
/**
|
|
1522
|
+
* The longitude position of the airport represented in Decimal degrees with 6 decimal points with a range between -180° and 180°
|
|
1523
|
+
*/
|
|
1524
|
+
longitude: number | null;
|
|
1525
|
+
/**
|
|
1526
|
+
* The latitude position of the airport represented in Decimal degrees with 6 decimal points with a range between -90° and 90°
|
|
1527
|
+
*/
|
|
1528
|
+
latitude: number | null;
|
|
1529
|
+
/**
|
|
1530
|
+
* Duffel's unique identifier for the place
|
|
1531
|
+
*/
|
|
1532
|
+
id: string;
|
|
1533
|
+
/**
|
|
1534
|
+
* The four-character ICAO code for the airport
|
|
1535
|
+
*/
|
|
1536
|
+
icao_code: string | null;
|
|
1537
|
+
/**
|
|
1538
|
+
* The ISO 3166-1 alpha-2 code for the country where the city is located
|
|
1539
|
+
*/
|
|
1540
|
+
iata_country_code: string;
|
|
1541
|
+
/**
|
|
1542
|
+
* The 3-letter IATA code for the place
|
|
1543
|
+
*/
|
|
1544
|
+
iata_code: string;
|
|
1545
|
+
/**
|
|
1546
|
+
* 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.
|
|
1547
|
+
*/
|
|
1548
|
+
iata_city_code: string | null;
|
|
1549
|
+
/**
|
|
1550
|
+
* The name of the country where the city or airport is located
|
|
1551
|
+
*/
|
|
1552
|
+
country_name: string | null;
|
|
1553
|
+
/**
|
|
1554
|
+
* The name of the city (or cities separated by a /) where the airport is located
|
|
1555
|
+
*/
|
|
1556
|
+
city_name: string | null;
|
|
1557
|
+
/**
|
|
1558
|
+
* The metropolitan area where the airport is located. Only present for airports which are registered with IATA as belonging to a metropolitan area.
|
|
1559
|
+
*/
|
|
1560
|
+
city: City | null;
|
|
1561
|
+
/**
|
|
1562
|
+
* The airports associated to a city. This will only be provided where the type is city.
|
|
1563
|
+
*/
|
|
1564
|
+
airports: Airport[] | null;
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1383
1568
|
declare module '@duffel/api/booking/AirlineInitiatedChanges/AirlineInitiatedChangesTypes' {
|
|
1384
1569
|
import { OrderSlice } from '@duffel/api/types';
|
|
1385
1570
|
export type AirlineInitiatedChangeActionTaken = 'accepted' | 'cancelled' | 'changed';
|
|
@@ -1493,7 +1678,7 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
|
|
|
1493
1678
|
*/
|
|
1494
1679
|
loyalty_programme_accounts?: LoyaltyProgrammeAccount[];
|
|
1495
1680
|
}
|
|
1496
|
-
interface CreateOfferRequestAdultPassenger extends CreateOfferRequestPassengerCommon {
|
|
1681
|
+
export interface CreateOfferRequestAdultPassenger extends CreateOfferRequestPassengerCommon {
|
|
1497
1682
|
age?: never;
|
|
1498
1683
|
fare_type?: never;
|
|
1499
1684
|
/**
|
|
@@ -1504,7 +1689,7 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
|
|
|
1504
1689
|
*/
|
|
1505
1690
|
type: Extract<DuffelPassengerType, 'adult'>;
|
|
1506
1691
|
}
|
|
1507
|
-
interface CreateOfferRequestNonAdultPassenger extends CreateOfferRequestPassengerCommon {
|
|
1692
|
+
export interface CreateOfferRequestNonAdultPassenger extends CreateOfferRequestPassengerCommon {
|
|
1508
1693
|
/**
|
|
1509
1694
|
* The age of the passenger on the `departure_date` of the final slice. e.g.
|
|
1510
1695
|
* if you a searching for a round trip and the passenger is 15 years old at
|
|
@@ -3352,279 +3537,415 @@ declare module '@duffel/api/booking/SeatMaps/SeatMapTypes' {
|
|
|
3352
3537
|
export type SeatMapCabinRowSectionElementAmenity = Exclude<SeatMapCabinRowSectionElementType, 'empty' | 'seat'>;
|
|
3353
3538
|
}
|
|
3354
3539
|
|
|
3355
|
-
declare module '@duffel/api/
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
* @link https://duffel.com/docs/api/aircraft/schema
|
|
3359
|
-
*/
|
|
3360
|
-
export interface Aircraft {
|
|
3361
|
-
/**
|
|
3362
|
-
* The name of the aircraft
|
|
3363
|
-
*/
|
|
3364
|
-
name: string;
|
|
3540
|
+
declare module '@duffel/api/notifications/Webhooks/WebhooksType' {
|
|
3541
|
+
import { PaginationMeta } from '@duffel/api/types';
|
|
3542
|
+
export interface Webhooks {
|
|
3365
3543
|
/**
|
|
3366
|
-
*
|
|
3544
|
+
* Whether the webhook receiver is actively being notified or not
|
|
3367
3545
|
*/
|
|
3368
|
-
|
|
3546
|
+
active: boolean;
|
|
3369
3547
|
/**
|
|
3370
|
-
* The
|
|
3548
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the webhook was created
|
|
3371
3549
|
*/
|
|
3372
|
-
|
|
3373
|
-
}
|
|
3374
|
-
}
|
|
3375
|
-
|
|
3376
|
-
declare module '@duffel/api/supportingResources/Airlines/AirlinesTypes' {
|
|
3377
|
-
/**
|
|
3378
|
-
* Airlines are used to identify the air travel companies selling and operating flights
|
|
3379
|
-
* @link https://duffel.com/docs/api/airlines/schema
|
|
3380
|
-
*/
|
|
3381
|
-
export interface Airline {
|
|
3550
|
+
created_at: string;
|
|
3382
3551
|
/**
|
|
3383
|
-
* The
|
|
3552
|
+
* The events that this webhook will be subscribed to
|
|
3384
3553
|
*/
|
|
3385
|
-
|
|
3554
|
+
events: string[];
|
|
3386
3555
|
/**
|
|
3387
|
-
* Duffel's unique identifier for the
|
|
3556
|
+
* Duffel's unique identifier for the webhook receiver
|
|
3388
3557
|
*/
|
|
3389
3558
|
id: string;
|
|
3390
|
-
iata_code: string;
|
|
3391
|
-
logo_lockup_url?: string;
|
|
3392
|
-
logo_symbol_url?: string;
|
|
3393
|
-
}
|
|
3394
|
-
}
|
|
3395
|
-
|
|
3396
|
-
declare module '@duffel/api/supportingResources/Airports/AirportsTypes' {
|
|
3397
|
-
import { City } from '@duffel/api/types';
|
|
3398
|
-
/**
|
|
3399
|
-
* Airports are used to identify origins and destinations in journey slices
|
|
3400
|
-
* @link https://duffel.com/docs/api/airports/schema
|
|
3401
|
-
*/
|
|
3402
|
-
export interface Airport {
|
|
3403
3559
|
/**
|
|
3404
|
-
* The
|
|
3405
|
-
* Only present for airports which are registered with IATA as belonging to a metropolitan area.
|
|
3560
|
+
* The live mode that the webhook was created in. It will only receive events for that same live mode. For example, you won't receive order.created events for orders that you created in the sandbox, if your webhook is for live_mode: true.
|
|
3406
3561
|
*/
|
|
3407
|
-
|
|
3562
|
+
live_mode: boolean;
|
|
3408
3563
|
/**
|
|
3409
|
-
* The
|
|
3564
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the order change was updated
|
|
3410
3565
|
*/
|
|
3411
|
-
|
|
3566
|
+
updated_at: string;
|
|
3412
3567
|
/**
|
|
3413
|
-
* The
|
|
3568
|
+
* The URL where your webhook will be received
|
|
3414
3569
|
*/
|
|
3415
|
-
|
|
3570
|
+
url: string;
|
|
3571
|
+
}
|
|
3572
|
+
export interface WebhooksListDeliveriesParams extends PaginationMeta {
|
|
3573
|
+
delivery_success: boolean;
|
|
3416
3574
|
/**
|
|
3417
|
-
*
|
|
3418
|
-
* @link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
3419
|
-
* @example "GB"
|
|
3575
|
+
* Filters the returned webhook deliveries by creation datetime.
|
|
3420
3576
|
*/
|
|
3421
|
-
|
|
3577
|
+
created_at?: PaginationMeta;
|
|
3422
3578
|
/**
|
|
3423
|
-
*
|
|
3424
|
-
* Only present for airports which are registered with IATA as belonging to a [metropolitan area](https://portal.iata.org/faq/articles/en_US/FAQ/How-do-I-create-a-new-Metropolitan-Area).
|
|
3579
|
+
* Filters webhook deliveries by the type of their related webhook event.
|
|
3425
3580
|
*/
|
|
3426
|
-
|
|
3581
|
+
type?: string;
|
|
3427
3582
|
/**
|
|
3428
|
-
*
|
|
3583
|
+
* Filters webhook deliveries by the ID of the related webhook endpoint.
|
|
3429
3584
|
*/
|
|
3430
|
-
|
|
3585
|
+
endpoint_id: string;
|
|
3586
|
+
}
|
|
3587
|
+
export interface WebhooksUpdateParams {
|
|
3431
3588
|
/**
|
|
3432
|
-
*
|
|
3589
|
+
* The desired active status of the webhook
|
|
3433
3590
|
*/
|
|
3434
|
-
|
|
3591
|
+
active: boolean;
|
|
3435
3592
|
/**
|
|
3436
|
-
* The
|
|
3593
|
+
* The desired events that the webhook should subscribe to
|
|
3437
3594
|
*/
|
|
3438
|
-
|
|
3595
|
+
events: string[];
|
|
3439
3596
|
/**
|
|
3440
|
-
* The
|
|
3597
|
+
* The desired url of the webhook
|
|
3441
3598
|
*/
|
|
3442
|
-
|
|
3599
|
+
url: string;
|
|
3600
|
+
}
|
|
3601
|
+
export interface WebhooksCreateParams {
|
|
3443
3602
|
/**
|
|
3444
|
-
* The
|
|
3603
|
+
* The desired events that the webhook should subscribe to
|
|
3445
3604
|
*/
|
|
3446
|
-
|
|
3605
|
+
events: string[];
|
|
3447
3606
|
/**
|
|
3448
|
-
* The
|
|
3607
|
+
* The desired url of the webhook
|
|
3449
3608
|
*/
|
|
3450
|
-
|
|
3609
|
+
url: string;
|
|
3451
3610
|
}
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
declare module '@duffel/api/DuffelPayments/PaymentIntents/PaymentIntentsType' {
|
|
3455
|
-
export interface PaymentIntent {
|
|
3611
|
+
export interface WebhooksListDeliveriesResponse {
|
|
3456
3612
|
/**
|
|
3457
|
-
* The
|
|
3458
|
-
* The card payment will be charged this amount.
|
|
3613
|
+
* The URL where your webhook will be received
|
|
3459
3614
|
*/
|
|
3460
|
-
|
|
3615
|
+
url: string;
|
|
3616
|
+
endpoint_id: string;
|
|
3461
3617
|
/**
|
|
3462
|
-
*
|
|
3463
|
-
* It will be null until the Payment Intent is confirmed.
|
|
3618
|
+
* Webhook deliveries will be included if they were successful.
|
|
3464
3619
|
*/
|
|
3465
|
-
|
|
3620
|
+
delivery_success?: boolean;
|
|
3621
|
+
type: string;
|
|
3622
|
+
response_status_code: 200;
|
|
3623
|
+
response_body: string;
|
|
3624
|
+
event_id: string;
|
|
3466
3625
|
/**
|
|
3467
|
-
* The
|
|
3468
|
-
* It will be null until the Payment Intent is confirmed.
|
|
3626
|
+
* The live mode that the webhook was created in. It will only receive events for that same live mode. For example, you won't receive order.created events for orders that you created in the sandbox, if your webhook is for live_mode: true.
|
|
3469
3627
|
*/
|
|
3470
|
-
|
|
3628
|
+
live_mode: boolean;
|
|
3471
3629
|
/**
|
|
3472
|
-
*
|
|
3473
|
-
* It will be null until the Payment Intent is confirmed.
|
|
3630
|
+
* Duffel's unique identifier for the webhook receiver
|
|
3474
3631
|
*/
|
|
3475
|
-
|
|
3632
|
+
id: string;
|
|
3476
3633
|
/**
|
|
3477
|
-
*
|
|
3634
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the webhook was created
|
|
3478
3635
|
*/
|
|
3479
|
-
|
|
3636
|
+
created_at: string;
|
|
3637
|
+
}
|
|
3638
|
+
export interface WebhooksListResponse extends Webhooks {
|
|
3480
3639
|
/**
|
|
3481
|
-
*
|
|
3640
|
+
* Webhook deliveries will be included if they were successful.
|
|
3482
3641
|
*/
|
|
3483
|
-
|
|
3642
|
+
delivery_success?: boolean;
|
|
3643
|
+
}
|
|
3644
|
+
export interface WebhooksCreateResponse {
|
|
3645
|
+
secret: string;
|
|
3646
|
+
url: string;
|
|
3647
|
+
updated_at: string;
|
|
3648
|
+
live_mode: boolean;
|
|
3649
|
+
id: string;
|
|
3650
|
+
events: string[];
|
|
3651
|
+
created_at: string;
|
|
3652
|
+
active: boolean;
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
|
|
3656
|
+
declare module '@duffel/api/supportingResources/Aircraft/AircraftTypes' {
|
|
3657
|
+
/**
|
|
3658
|
+
* Aircraft are used to describe what passengers will fly in for a given trip
|
|
3659
|
+
* @link https://duffel.com/docs/api/aircraft/schema
|
|
3660
|
+
*/
|
|
3661
|
+
export interface Aircraft {
|
|
3484
3662
|
/**
|
|
3485
|
-
* The
|
|
3663
|
+
* The name of the aircraft
|
|
3486
3664
|
*/
|
|
3487
|
-
|
|
3665
|
+
name: string;
|
|
3488
3666
|
/**
|
|
3489
|
-
*
|
|
3490
|
-
* The card payment will be charged in this currency.
|
|
3491
|
-
* If it's different to your Balance currency, it will be converted to your Balance currency before the Balance is topped up.
|
|
3667
|
+
* Duffel's unique identifier for the aircraft
|
|
3492
3668
|
*/
|
|
3493
|
-
|
|
3669
|
+
id: string;
|
|
3494
3670
|
/**
|
|
3495
|
-
* The
|
|
3496
|
-
* It will be `null` until the Payment Intent is confirmed.
|
|
3671
|
+
* The three-character IATA code for the aircraft
|
|
3497
3672
|
*/
|
|
3498
|
-
|
|
3673
|
+
iata_code: string;
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3677
|
+
declare module '@duffel/api/supportingResources/Airlines/AirlinesTypes' {
|
|
3678
|
+
/**
|
|
3679
|
+
* Airlines are used to identify the air travel companies selling and operating flights
|
|
3680
|
+
* @link https://duffel.com/docs/api/airlines/schema
|
|
3681
|
+
*/
|
|
3682
|
+
export interface Airline {
|
|
3499
3683
|
/**
|
|
3500
|
-
* The
|
|
3501
|
-
* This currency will match your Balance currency.
|
|
3502
|
-
* It will be null until the Payment Intent is confirmed.
|
|
3684
|
+
* The three-character IATA code for the airline
|
|
3503
3685
|
*/
|
|
3504
|
-
|
|
3686
|
+
name: string;
|
|
3505
3687
|
/**
|
|
3506
|
-
* Duffel's unique identifier for the
|
|
3688
|
+
* Duffel's unique identifier for the airline
|
|
3507
3689
|
*/
|
|
3508
3690
|
id: string;
|
|
3691
|
+
iata_code: string;
|
|
3692
|
+
logo_lockup_url?: string;
|
|
3693
|
+
logo_symbol_url?: string;
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
|
|
3697
|
+
declare module '@duffel/api/supportingResources/Airports/AirportsTypes' {
|
|
3698
|
+
import { City } from '@duffel/api/types';
|
|
3699
|
+
/**
|
|
3700
|
+
* Airports are used to identify origins and destinations in journey slices
|
|
3701
|
+
* @link https://duffel.com/docs/api/airports/schema
|
|
3702
|
+
*/
|
|
3703
|
+
export interface Airport {
|
|
3509
3704
|
/**
|
|
3510
|
-
*
|
|
3705
|
+
* The metropolitan area where the airport is located.
|
|
3706
|
+
* Only present for airports which are registered with IATA as belonging to a metropolitan area.
|
|
3511
3707
|
*/
|
|
3512
|
-
|
|
3708
|
+
city?: City | null;
|
|
3513
3709
|
/**
|
|
3514
|
-
* The
|
|
3515
|
-
* It'll be `amount` (in the Balance currency) less the `fees_amount`.
|
|
3516
|
-
* It will be `null` until the Payment Intent is confirmed.
|
|
3710
|
+
* The name of the city (or cities separated by a `/`) where the airport is located
|
|
3517
3711
|
*/
|
|
3518
|
-
|
|
3712
|
+
city_name: string;
|
|
3519
3713
|
/**
|
|
3520
|
-
* The
|
|
3521
|
-
* This currency will match your Balance currency.
|
|
3522
|
-
* It will be null until the Payment Intent is confirmed.
|
|
3714
|
+
* The three-character IATA code for the airport
|
|
3523
3715
|
*/
|
|
3524
|
-
|
|
3716
|
+
iata_code?: string;
|
|
3525
3717
|
/**
|
|
3526
|
-
* The
|
|
3527
|
-
* @link https://
|
|
3718
|
+
* The ISO 3166-1 alpha-2 code for the country where the city is located
|
|
3719
|
+
* @link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
3720
|
+
* @example "GB"
|
|
3528
3721
|
*/
|
|
3529
|
-
|
|
3530
|
-
amount: string;
|
|
3531
|
-
arrival: string;
|
|
3532
|
-
created_at: string;
|
|
3533
|
-
currency: string;
|
|
3534
|
-
destination: string;
|
|
3535
|
-
id: string;
|
|
3536
|
-
live_mode: boolean;
|
|
3537
|
-
net_amount: string;
|
|
3538
|
-
net_currency: string;
|
|
3539
|
-
payment_intent_id: string;
|
|
3540
|
-
status: 'succeeded' | 'pending' | 'failed';
|
|
3541
|
-
updated_at: string;
|
|
3542
|
-
}[];
|
|
3722
|
+
iata_country_code: string;
|
|
3543
3723
|
/**
|
|
3544
|
-
* The
|
|
3724
|
+
* The 3-letter IATA code for the city where the place is located.
|
|
3725
|
+
* Only present for airports which are registered with IATA as belonging to a [metropolitan area](https://portal.iata.org/faq/articles/en_US/FAQ/How-do-I-create-a-new-Metropolitan-Area).
|
|
3545
3726
|
*/
|
|
3546
|
-
|
|
3727
|
+
iata_city_code?: string | null;
|
|
3547
3728
|
/**
|
|
3548
|
-
* The
|
|
3729
|
+
* The four-character ICAO code for the airport
|
|
3549
3730
|
*/
|
|
3550
|
-
|
|
3551
|
-
}
|
|
3552
|
-
export interface CreatePaymentIntent {
|
|
3731
|
+
icao_code?: string;
|
|
3553
3732
|
/**
|
|
3554
|
-
*
|
|
3555
|
-
* It should be enough to cover the service(s) you want to sell (enough to book an Offer for example) and the processing fees.
|
|
3556
|
-
* If the currency is different from your Balance currency you should also account for foreign exchange.
|
|
3557
|
-
* It can be higher than that, in which case the remainder will be considered your markup.
|
|
3558
|
-
* If it's higher than the maximum allowed for you organisation you will get a validation error. By default the maximum is 5,000.00 GBP (or equivalent in the same currency). If you need a maximum higher than the default please get in touch with us via help@duffel.com.
|
|
3733
|
+
* Duffel's unique identifier for the airport
|
|
3559
3734
|
*/
|
|
3560
|
-
|
|
3735
|
+
id: string;
|
|
3561
3736
|
/**
|
|
3562
|
-
* The
|
|
3563
|
-
* This is going to be the currency that the card payment being taken in will be charged in.
|
|
3737
|
+
* The latitude position of the airport represented in Decimal degrees with 6 decimal points with a range between -90° and 90°
|
|
3564
3738
|
*/
|
|
3565
|
-
|
|
3739
|
+
latitude: number;
|
|
3740
|
+
/**
|
|
3741
|
+
* The longitude position of the airport represented in Decimal degrees with 6 decimal points with a range between -180° and 180°
|
|
3742
|
+
*/
|
|
3743
|
+
longitude: number;
|
|
3744
|
+
/**
|
|
3745
|
+
* The name of the airport
|
|
3746
|
+
*/
|
|
3747
|
+
name: string;
|
|
3748
|
+
/**
|
|
3749
|
+
* The time zone of the airport, specified by name from the [tz database](https://en.wikipedia.org/wiki/Tz_database)
|
|
3750
|
+
*/
|
|
3751
|
+
time_zone: string;
|
|
3566
3752
|
}
|
|
3567
3753
|
}
|
|
3568
3754
|
|
|
3569
|
-
declare module '@duffel/api/
|
|
3570
|
-
import {
|
|
3571
|
-
|
|
3755
|
+
declare module '@duffel/api/types/ClientType' {
|
|
3756
|
+
import { Headers } from 'node-fetch';
|
|
3757
|
+
/**
|
|
3758
|
+
* Our list APIs will only return a limited number of results at a time.
|
|
3759
|
+
* By default, we'll return 50 results per page, but you can set this to any number between 1 and 200.
|
|
3760
|
+
* @link https://duffel.com/docs/api/overview/pagination
|
|
3761
|
+
*/
|
|
3762
|
+
export interface PaginationMeta {
|
|
3572
3763
|
/**
|
|
3573
|
-
* The
|
|
3764
|
+
* The number of results to be returned in a page, between 1 and 200 (optional, default is 50)
|
|
3574
3765
|
*/
|
|
3575
|
-
|
|
3766
|
+
limit?: number;
|
|
3576
3767
|
/**
|
|
3577
|
-
*
|
|
3768
|
+
* "Before" cursor for pagination
|
|
3578
3769
|
*/
|
|
3579
|
-
|
|
3770
|
+
before?: string;
|
|
3580
3771
|
/**
|
|
3581
|
-
*
|
|
3772
|
+
* "After" cursor for pagination
|
|
3582
3773
|
*/
|
|
3583
|
-
|
|
3774
|
+
after?: string | null;
|
|
3775
|
+
}
|
|
3776
|
+
export interface ApiResponseMeta {
|
|
3584
3777
|
/**
|
|
3585
|
-
* The
|
|
3778
|
+
* The identifier of the request
|
|
3586
3779
|
*/
|
|
3587
|
-
|
|
3780
|
+
request_id: string;
|
|
3588
3781
|
/**
|
|
3589
|
-
* The
|
|
3782
|
+
* The [HTTP status](https://httpstatuses.com/) of the request
|
|
3590
3783
|
*/
|
|
3591
|
-
|
|
3784
|
+
status: number;
|
|
3785
|
+
}
|
|
3786
|
+
/**
|
|
3787
|
+
* Duffel uses standard [HTTP response codes](https://httpstatuses.com/) to indicate the success or failure of API requests.
|
|
3788
|
+
* @link https://duffel.com/docs/api/overview/errors
|
|
3789
|
+
*/
|
|
3790
|
+
export interface ApiResponseError {
|
|
3592
3791
|
/**
|
|
3593
|
-
*
|
|
3792
|
+
* A machine-readable identifier for this specific error
|
|
3594
3793
|
*/
|
|
3595
|
-
|
|
3794
|
+
code: string;
|
|
3596
3795
|
/**
|
|
3597
|
-
*
|
|
3796
|
+
* A URL pointing to a place in our documentation where you can read about the error
|
|
3598
3797
|
*/
|
|
3599
|
-
|
|
3798
|
+
documentation_url: string;
|
|
3600
3799
|
/**
|
|
3601
|
-
*
|
|
3800
|
+
* A more detailed human-readable description of what went wrong
|
|
3602
3801
|
*/
|
|
3603
|
-
|
|
3802
|
+
message: string;
|
|
3604
3803
|
/**
|
|
3605
|
-
*
|
|
3804
|
+
* A quick and simple description of what went wrong
|
|
3606
3805
|
*/
|
|
3607
|
-
|
|
3806
|
+
title: string;
|
|
3608
3807
|
/**
|
|
3609
|
-
*
|
|
3808
|
+
* A machine-readable identifier for the general category of error
|
|
3610
3809
|
*/
|
|
3611
|
-
|
|
3810
|
+
type: string;
|
|
3811
|
+
}
|
|
3812
|
+
export interface DuffelResponse<T_Data> {
|
|
3612
3813
|
/**
|
|
3613
|
-
* The
|
|
3814
|
+
* The body of the response
|
|
3614
3815
|
*/
|
|
3615
|
-
|
|
3816
|
+
data: T_Data;
|
|
3616
3817
|
/**
|
|
3617
|
-
*
|
|
3818
|
+
* Optional metadata for the request
|
|
3618
3819
|
*/
|
|
3619
|
-
|
|
3820
|
+
meta?: PaginationMeta;
|
|
3620
3821
|
/**
|
|
3621
|
-
* The
|
|
3822
|
+
* The headers from the http response
|
|
3622
3823
|
*/
|
|
3623
|
-
|
|
3824
|
+
headers?: Headers;
|
|
3825
|
+
}
|
|
3826
|
+
export interface SDKOptions {
|
|
3624
3827
|
/**
|
|
3625
|
-
*
|
|
3828
|
+
* If `true` it will output the path and the method called
|
|
3626
3829
|
*/
|
|
3627
|
-
|
|
3830
|
+
verbose?: boolean;
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3833
|
+
|
|
3834
|
+
declare module '@duffel/api/types/Identity' {
|
|
3835
|
+
export type AcceptedCurrencies = 'AUD' | 'CAD' | 'EUR' | 'GBP' | 'USD';
|
|
3836
|
+
export type LegalEntityType = 'corporation' | 'non_profit' | 'other' | 'partnership' | 'sole_proprietorship';
|
|
3837
|
+
export type PersonalAccessTokenRole = 'roles/user/personal';
|
|
3838
|
+
export type SourceOfFunds = 'capital_invested' | 'debt' | 'other' | 'revenue';
|
|
3839
|
+
export type TokenRole = 'roles/api/read_write' | 'roles/api/read_only';
|
|
3840
|
+
export type UserRole = 'roles/duffel/travel_ops' | 'roles/user/admin' | 'roles/user/agent' | 'roles/user/developer' | 'roles/user/owner' | 'roles/user/viewer' | PersonalAccessTokenRole;
|
|
3841
|
+
export type VerificationFlow = 'duffel_2020' | 'stripe_connect';
|
|
3842
|
+
export interface AccessToken {
|
|
3843
|
+
created_at: string;
|
|
3844
|
+
expires_at: string;
|
|
3845
|
+
id: string;
|
|
3846
|
+
last_used_at: string | null;
|
|
3847
|
+
last_version_used: string | null;
|
|
3848
|
+
live_mode: boolean | null;
|
|
3849
|
+
name: string | null;
|
|
3850
|
+
scope: TokenRole | UserRole;
|
|
3851
|
+
token: string;
|
|
3852
|
+
}
|
|
3853
|
+
export interface Invitation {
|
|
3854
|
+
accepted_at: string | null;
|
|
3855
|
+
created_at: string;
|
|
3856
|
+
expires_at: string | null;
|
|
3857
|
+
id: string;
|
|
3858
|
+
organisation: Organisation;
|
|
3859
|
+
organisation_id: string;
|
|
3860
|
+
recipient: User | null;
|
|
3861
|
+
recipient_email: string;
|
|
3862
|
+
recipient_id: string | null;
|
|
3863
|
+
revoked_at: string | null;
|
|
3864
|
+
scope: UserRole;
|
|
3865
|
+
sender: User;
|
|
3866
|
+
sender_id: string;
|
|
3867
|
+
sent_at: string;
|
|
3868
|
+
token: string;
|
|
3869
|
+
}
|
|
3870
|
+
export interface Organisation {
|
|
3871
|
+
access_tokens: AccessToken[] | null;
|
|
3872
|
+
avatar_url: string | null;
|
|
3873
|
+
created_at: string;
|
|
3874
|
+
id: string;
|
|
3875
|
+
name: string;
|
|
3876
|
+
settlement_currency: AcceptedCurrencies;
|
|
3877
|
+
slug: string;
|
|
3878
|
+
verified: boolean | null;
|
|
3879
|
+
legal_entity: LegalEntity | null;
|
|
3880
|
+
stripe_customer_id: string | null;
|
|
3881
|
+
stripe_payment_method_id: string | null;
|
|
3882
|
+
verification_flow: VerificationFlow;
|
|
3883
|
+
contact_emails: string[] | null;
|
|
3884
|
+
schedule_change_emails: string[] | null;
|
|
3885
|
+
is_duffel_links_enabled: boolean;
|
|
3886
|
+
stays_access_status: 'disabled' | 'live' | 'test';
|
|
3887
|
+
password_expiry_timeout_days: number | null;
|
|
3888
|
+
session_expiry_timeout: number;
|
|
3889
|
+
}
|
|
3890
|
+
export interface OrganisationMembership {
|
|
3891
|
+
avatar_url: string | null;
|
|
3892
|
+
id: string;
|
|
3893
|
+
created_at: string;
|
|
3894
|
+
disabled_at: string | null;
|
|
3895
|
+
organisation_id: string;
|
|
3896
|
+
owner: boolean | null;
|
|
3897
|
+
scope: UserRole;
|
|
3898
|
+
user_id: string;
|
|
3899
|
+
user: User;
|
|
3900
|
+
}
|
|
3901
|
+
export interface User {
|
|
3902
|
+
avatar_url: string | null;
|
|
3903
|
+
created_at: string;
|
|
3904
|
+
duffel_admin: boolean | null;
|
|
3905
|
+
email: string;
|
|
3906
|
+
email_confirmed_at: string | null;
|
|
3907
|
+
full_name: string;
|
|
3908
|
+
id: string;
|
|
3909
|
+
organisation_invitations: Invitation[] | null;
|
|
3910
|
+
organisation_memberships: UserOrganisationMembership[] | null;
|
|
3911
|
+
unconfirmed_email: string | null;
|
|
3912
|
+
temporary_personal_access_tokens: PersonalAccessToken[] | null;
|
|
3913
|
+
send_marketing_emails: boolean;
|
|
3914
|
+
}
|
|
3915
|
+
export interface PersonalAccessToken {
|
|
3916
|
+
created_at: string;
|
|
3917
|
+
expires_at: string;
|
|
3918
|
+
id: string;
|
|
3919
|
+
last_used_at: null | string;
|
|
3920
|
+
last_version_used: null | string;
|
|
3921
|
+
live_mode: true;
|
|
3922
|
+
name: null;
|
|
3923
|
+
scope: PersonalAccessTokenRole;
|
|
3924
|
+
token: string;
|
|
3925
|
+
}
|
|
3926
|
+
export interface UserOrganisationMembership extends OrganisationMembership {
|
|
3927
|
+
organisation: Organisation;
|
|
3928
|
+
}
|
|
3929
|
+
export interface LegalEntity {
|
|
3930
|
+
name: string;
|
|
3931
|
+
type: LegalEntityType;
|
|
3932
|
+
type_extra: string | null;
|
|
3933
|
+
trading_name: string | null;
|
|
3934
|
+
registered_business_address_line1: string;
|
|
3935
|
+
registered_business_address_line2: string | null;
|
|
3936
|
+
registered_business_address_city: string;
|
|
3937
|
+
registered_business_address_region: string | null;
|
|
3938
|
+
registered_business_address_postal_code: string;
|
|
3939
|
+
registered_business_address_country_code: string;
|
|
3940
|
+
registration_number: string;
|
|
3941
|
+
registration_country_code: string;
|
|
3942
|
+
tax_identification_number: string;
|
|
3943
|
+
key_contact_first_name: string;
|
|
3944
|
+
key_contact_last_name: string;
|
|
3945
|
+
key_contact_job_title: string;
|
|
3946
|
+
key_contact_email: string;
|
|
3947
|
+
initial_top_up_source_of_funds: SourceOfFunds;
|
|
3948
|
+
initial_top_up_source_of_funds_description: string | null;
|
|
3628
3949
|
}
|
|
3629
3950
|
}
|
|
3630
3951
|
|
|
@@ -3788,201 +4109,6 @@ declare module '@duffel/api/types/shared' {
|
|
|
3788
4109
|
export type PaymentType = 'arc_bsp_cash' | 'balance';
|
|
3789
4110
|
}
|
|
3790
4111
|
|
|
3791
|
-
declare module '@duffel/api/types/ClientType' {
|
|
3792
|
-
import { Headers } from 'node-fetch';
|
|
3793
|
-
/**
|
|
3794
|
-
* Our list APIs will only return a limited number of results at a time.
|
|
3795
|
-
* By default, we'll return 50 results per page, but you can set this to any number between 1 and 200.
|
|
3796
|
-
* @link https://duffel.com/docs/api/overview/pagination
|
|
3797
|
-
*/
|
|
3798
|
-
export interface PaginationMeta {
|
|
3799
|
-
/**
|
|
3800
|
-
* The number of results to be returned in a page, between 1 and 200 (optional, default is 50)
|
|
3801
|
-
*/
|
|
3802
|
-
limit?: number;
|
|
3803
|
-
/**
|
|
3804
|
-
* "Before" cursor for pagination
|
|
3805
|
-
*/
|
|
3806
|
-
before?: string;
|
|
3807
|
-
/**
|
|
3808
|
-
* "After" cursor for pagination
|
|
3809
|
-
*/
|
|
3810
|
-
after?: string | null;
|
|
3811
|
-
}
|
|
3812
|
-
export interface ApiResponseMeta {
|
|
3813
|
-
/**
|
|
3814
|
-
* The identifier of the request
|
|
3815
|
-
*/
|
|
3816
|
-
request_id: string;
|
|
3817
|
-
/**
|
|
3818
|
-
* The [HTTP status](https://httpstatuses.com/) of the request
|
|
3819
|
-
*/
|
|
3820
|
-
status: number;
|
|
3821
|
-
}
|
|
3822
|
-
/**
|
|
3823
|
-
* Duffel uses standard [HTTP response codes](https://httpstatuses.com/) to indicate the success or failure of API requests.
|
|
3824
|
-
* @link https://duffel.com/docs/api/overview/errors
|
|
3825
|
-
*/
|
|
3826
|
-
export interface ApiResponseError {
|
|
3827
|
-
/**
|
|
3828
|
-
* A machine-readable identifier for this specific error
|
|
3829
|
-
*/
|
|
3830
|
-
code: string;
|
|
3831
|
-
/**
|
|
3832
|
-
* A URL pointing to a place in our documentation where you can read about the error
|
|
3833
|
-
*/
|
|
3834
|
-
documentation_url: string;
|
|
3835
|
-
/**
|
|
3836
|
-
* A more detailed human-readable description of what went wrong
|
|
3837
|
-
*/
|
|
3838
|
-
message: string;
|
|
3839
|
-
/**
|
|
3840
|
-
* A quick and simple description of what went wrong
|
|
3841
|
-
*/
|
|
3842
|
-
title: string;
|
|
3843
|
-
/**
|
|
3844
|
-
* A machine-readable identifier for the general category of error
|
|
3845
|
-
*/
|
|
3846
|
-
type: string;
|
|
3847
|
-
}
|
|
3848
|
-
export interface DuffelResponse<T_Data> {
|
|
3849
|
-
/**
|
|
3850
|
-
* The body of the response
|
|
3851
|
-
*/
|
|
3852
|
-
data: T_Data;
|
|
3853
|
-
/**
|
|
3854
|
-
* Optional metadata for the request
|
|
3855
|
-
*/
|
|
3856
|
-
meta?: PaginationMeta;
|
|
3857
|
-
/**
|
|
3858
|
-
* The headers from the http response
|
|
3859
|
-
*/
|
|
3860
|
-
headers?: Headers;
|
|
3861
|
-
}
|
|
3862
|
-
export interface SDKOptions {
|
|
3863
|
-
/**
|
|
3864
|
-
* If `true` it will output the path and the method called
|
|
3865
|
-
*/
|
|
3866
|
-
verbose?: boolean;
|
|
3867
|
-
}
|
|
3868
|
-
}
|
|
3869
|
-
|
|
3870
|
-
declare module '@duffel/api/notifications/Webhooks/WebhooksType' {
|
|
3871
|
-
import { PaginationMeta } from '@duffel/api/types';
|
|
3872
|
-
export interface Webhooks {
|
|
3873
|
-
/**
|
|
3874
|
-
* Whether the webhook receiver is actively being notified or not
|
|
3875
|
-
*/
|
|
3876
|
-
active: boolean;
|
|
3877
|
-
/**
|
|
3878
|
-
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the webhook was created
|
|
3879
|
-
*/
|
|
3880
|
-
created_at: string;
|
|
3881
|
-
/**
|
|
3882
|
-
* The events that this webhook will be subscribed to
|
|
3883
|
-
*/
|
|
3884
|
-
events: string[];
|
|
3885
|
-
/**
|
|
3886
|
-
* Duffel's unique identifier for the webhook receiver
|
|
3887
|
-
*/
|
|
3888
|
-
id: string;
|
|
3889
|
-
/**
|
|
3890
|
-
* The live mode that the webhook was created in. It will only receive events for that same live mode. For example, you won't receive order.created events for orders that you created in the sandbox, if your webhook is for live_mode: true.
|
|
3891
|
-
*/
|
|
3892
|
-
live_mode: boolean;
|
|
3893
|
-
/**
|
|
3894
|
-
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the order change was updated
|
|
3895
|
-
*/
|
|
3896
|
-
updated_at: string;
|
|
3897
|
-
/**
|
|
3898
|
-
* The URL where your webhook will be received
|
|
3899
|
-
*/
|
|
3900
|
-
url: string;
|
|
3901
|
-
}
|
|
3902
|
-
export interface WebhooksListDeliveriesParams extends PaginationMeta {
|
|
3903
|
-
delivery_success: boolean;
|
|
3904
|
-
/**
|
|
3905
|
-
* Filters the returned webhook deliveries by creation datetime.
|
|
3906
|
-
*/
|
|
3907
|
-
created_at?: PaginationMeta;
|
|
3908
|
-
/**
|
|
3909
|
-
* Filters webhook deliveries by the type of their related webhook event.
|
|
3910
|
-
*/
|
|
3911
|
-
type?: string;
|
|
3912
|
-
/**
|
|
3913
|
-
* Filters webhook deliveries by the ID of the related webhook endpoint.
|
|
3914
|
-
*/
|
|
3915
|
-
endpoint_id: string;
|
|
3916
|
-
}
|
|
3917
|
-
export interface WebhooksUpdateParams {
|
|
3918
|
-
/**
|
|
3919
|
-
* The desired active status of the webhook
|
|
3920
|
-
*/
|
|
3921
|
-
active: boolean;
|
|
3922
|
-
/**
|
|
3923
|
-
* The desired events that the webhook should subscribe to
|
|
3924
|
-
*/
|
|
3925
|
-
events: string[];
|
|
3926
|
-
/**
|
|
3927
|
-
* The desired url of the webhook
|
|
3928
|
-
*/
|
|
3929
|
-
url: string;
|
|
3930
|
-
}
|
|
3931
|
-
export interface WebhooksCreateParams {
|
|
3932
|
-
/**
|
|
3933
|
-
* The desired events that the webhook should subscribe to
|
|
3934
|
-
*/
|
|
3935
|
-
events: string[];
|
|
3936
|
-
/**
|
|
3937
|
-
* The desired url of the webhook
|
|
3938
|
-
*/
|
|
3939
|
-
url: string;
|
|
3940
|
-
}
|
|
3941
|
-
export interface WebhooksListDeliveriesResponse {
|
|
3942
|
-
/**
|
|
3943
|
-
* The URL where your webhook will be received
|
|
3944
|
-
*/
|
|
3945
|
-
url: string;
|
|
3946
|
-
endpoint_id: string;
|
|
3947
|
-
/**
|
|
3948
|
-
* Webhook deliveries will be included if they were successful.
|
|
3949
|
-
*/
|
|
3950
|
-
delivery_success?: boolean;
|
|
3951
|
-
type: string;
|
|
3952
|
-
response_status_code: 200;
|
|
3953
|
-
response_body: string;
|
|
3954
|
-
event_id: string;
|
|
3955
|
-
/**
|
|
3956
|
-
* The live mode that the webhook was created in. It will only receive events for that same live mode. For example, you won't receive order.created events for orders that you created in the sandbox, if your webhook is for live_mode: true.
|
|
3957
|
-
*/
|
|
3958
|
-
live_mode: boolean;
|
|
3959
|
-
/**
|
|
3960
|
-
* Duffel's unique identifier for the webhook receiver
|
|
3961
|
-
*/
|
|
3962
|
-
id: string;
|
|
3963
|
-
/**
|
|
3964
|
-
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the webhook was created
|
|
3965
|
-
*/
|
|
3966
|
-
created_at: string;
|
|
3967
|
-
}
|
|
3968
|
-
export interface WebhooksListResponse extends Webhooks {
|
|
3969
|
-
/**
|
|
3970
|
-
* Webhook deliveries will be included if they were successful.
|
|
3971
|
-
*/
|
|
3972
|
-
delivery_success?: boolean;
|
|
3973
|
-
}
|
|
3974
|
-
export interface WebhooksCreateResponse {
|
|
3975
|
-
secret: string;
|
|
3976
|
-
url: string;
|
|
3977
|
-
updated_at: string;
|
|
3978
|
-
live_mode: boolean;
|
|
3979
|
-
id: string;
|
|
3980
|
-
events: string[];
|
|
3981
|
-
created_at: string;
|
|
3982
|
-
active: boolean;
|
|
3983
|
-
}
|
|
3984
|
-
}
|
|
3985
|
-
|
|
3986
4112
|
declare module '@duffel/api/supportingResources/Aircraft/Aircraft' {
|
|
3987
4113
|
import { Resource } from '@duffel/api/Resource';
|
|
3988
4114
|
import { Aircraft as AircraftType, DuffelResponse, PaginationMeta } from '@duffel/api/types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duffel/api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Javascript client library for the Duffel API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
89
89
|
"rollup-plugin-terser": "7.0.2",
|
|
90
90
|
"rollup-plugin-typescript2": "0.36.0",
|
|
91
|
+
"semantic-release": "22.0.12",
|
|
91
92
|
"ts-jest": "29.1.1",
|
|
92
93
|
"ts-node": "10.9.2",
|
|
93
94
|
"typescript": "5.2.2"
|