@duffel/api 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Links/{Links.d.ts → Sessions/Sessions.d.ts} +7 -7
- package/dist/Links/{Links.spec.d.ts → Sessions/Sessions.spec.d.ts} +0 -0
- package/dist/Links/Sessions/index.d.ts +1 -0
- package/dist/Links/index.d.ts +1 -1
- package/dist/booking/Offers/OfferTypes.d.ts +80 -40
- package/dist/booking/Orders/OrdersTypes.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/index.d.ts +88 -48
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Client } from 'Client';
|
|
2
|
-
import { Resource } from '
|
|
3
|
-
import { DuffelResponse } from '
|
|
4
|
-
interface
|
|
2
|
+
import { Resource } from '../../Resource';
|
|
3
|
+
import { DuffelResponse } from '../../types';
|
|
4
|
+
interface SessionParameters {
|
|
5
5
|
/**
|
|
6
6
|
* A tracking reference for the booking that may be created within this Duffel Links session
|
|
7
7
|
*/
|
|
@@ -43,21 +43,21 @@ interface GenerateLinkParameters {
|
|
|
43
43
|
*/
|
|
44
44
|
checkout_display_text?: string;
|
|
45
45
|
}
|
|
46
|
-
interface
|
|
46
|
+
interface Session {
|
|
47
47
|
/**
|
|
48
48
|
* The Duffel Links url that contains the specified configuration
|
|
49
49
|
*/
|
|
50
50
|
url: string;
|
|
51
51
|
}
|
|
52
|
-
export declare class
|
|
52
|
+
export declare class Sessions extends Resource {
|
|
53
53
|
/**
|
|
54
54
|
* Endpoint path
|
|
55
55
|
*/
|
|
56
56
|
path: string;
|
|
57
57
|
constructor(client: Client);
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* Create a Duffel Links Session per the configuration
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
create: (data: SessionParameters) => Promise<DuffelResponse<Session>>;
|
|
62
62
|
}
|
|
63
63
|
export {};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Sessions';
|
package/dist/Links/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './Sessions';
|
|
@@ -105,19 +105,19 @@ export interface Offer {
|
|
|
105
105
|
}
|
|
106
106
|
export interface OfferAvailableServiceBaggageMetadata {
|
|
107
107
|
/**
|
|
108
|
-
* The maximum weight that the baggage can have in kilograms
|
|
108
|
+
* The maximum weight that the baggage can have in kilograms.
|
|
109
109
|
*/
|
|
110
110
|
maximum_weight_kg: number | null;
|
|
111
111
|
/**
|
|
112
|
-
* The maximum height that the baggage can have in centimetres
|
|
112
|
+
* The maximum height that the baggage can have in centimetres.
|
|
113
113
|
*/
|
|
114
114
|
maximum_height_cm: number | null;
|
|
115
115
|
/**
|
|
116
|
-
* The maximum length that the baggage can have in centimetres
|
|
116
|
+
* The maximum length that the baggage can have in centimetres.
|
|
117
117
|
*/
|
|
118
118
|
maximum_length_cm: number | null;
|
|
119
119
|
/**
|
|
120
|
-
* The maximum depth that the baggage can have in centimetres
|
|
120
|
+
* The maximum depth that the baggage can have in centimetres.
|
|
121
121
|
*/
|
|
122
122
|
maximum_depth_cm: number | null;
|
|
123
123
|
/**
|
|
@@ -125,70 +125,110 @@ export interface OfferAvailableServiceBaggageMetadata {
|
|
|
125
125
|
*/
|
|
126
126
|
type: BaggageType;
|
|
127
127
|
}
|
|
128
|
-
export interface
|
|
128
|
+
export interface OfferAvailableServiceCFARMetadata {
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* will be released and you will have to create a new order.
|
|
133
|
-
* This will be null only for orders where `awaiting_payment` is `false`.
|
|
130
|
+
* The amount the customer will receive back if the service is used, in
|
|
131
|
+
* `offer.total_currency`.
|
|
134
132
|
*/
|
|
135
|
-
|
|
133
|
+
refund_amount: string;
|
|
136
134
|
/**
|
|
137
|
-
*
|
|
138
|
-
* with the order will no longer be guaranteed by the airline
|
|
139
|
-
* and the order will need to be repriced before payment.
|
|
140
|
-
* This can be null when there is no price guarantee.
|
|
135
|
+
* Information to display to customers.
|
|
141
136
|
*/
|
|
142
|
-
|
|
137
|
+
merchant_copy: string;
|
|
143
138
|
/**
|
|
144
|
-
*
|
|
139
|
+
* URL with the T&Cs for customers.
|
|
145
140
|
*/
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
export interface OfferAvailableServiceMetadataMap {
|
|
149
|
-
baggage: OfferAvailableServiceBaggageMetadata;
|
|
141
|
+
terms_and_conditions_url: string;
|
|
142
|
+
type: 'cancel_for_any_reason';
|
|
150
143
|
}
|
|
151
|
-
export
|
|
152
|
-
export interface OfferAvailableService<T_ServiceType extends OfferAvailableServiceType = 'baggage'> {
|
|
144
|
+
export interface OfferAvailableServiceCommon {
|
|
153
145
|
/**
|
|
154
|
-
* Duffel's unique identifier for the service
|
|
146
|
+
* Duffel's unique identifier for the service.
|
|
155
147
|
*/
|
|
156
148
|
id: string;
|
|
157
149
|
/**
|
|
158
|
-
* The maximum quantity of this service that can be booked with an order
|
|
150
|
+
* The maximum quantity of this service that can be booked with an order.
|
|
159
151
|
*/
|
|
160
152
|
maximum_quantity: number;
|
|
161
153
|
/**
|
|
162
|
-
*
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
* The list of passenger `id`s the service applies to.
|
|
167
|
-
* If you add this service to an order it will apply to all the passengers in this list.
|
|
168
|
-
* For services where the type is `baggage`, this list will include only a single passenger.
|
|
154
|
+
* The list of passenger `id`s the service applies to. If you add this
|
|
155
|
+
* service to an order it will apply to all the passengers in this list.
|
|
156
|
+
* For services where the type is `baggage`, this list will include only a
|
|
157
|
+
* single passenger.
|
|
169
158
|
*/
|
|
170
159
|
passenger_ids: string[];
|
|
171
160
|
/**
|
|
172
|
-
* The list of segment
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
161
|
+
* The list of segment `id`s the service applies to. If you add this
|
|
162
|
+
* service to an order it will apply to all the segments in this list. For
|
|
163
|
+
* services where the type is `baggage`, depending on the airline, this
|
|
164
|
+
* list includes all the segments of all slices or all the segments of a
|
|
165
|
+
* single slice.
|
|
176
166
|
*/
|
|
177
167
|
segment_ids: string[];
|
|
178
168
|
/**
|
|
179
|
-
* The total price of the service for all passengers and segments it
|
|
169
|
+
* The total price of the service for all passengers and segments it
|
|
170
|
+
* applies to, including taxes. This price is for a single unit of the
|
|
171
|
+
* service.
|
|
180
172
|
*/
|
|
181
173
|
total_amount: string;
|
|
182
174
|
/**
|
|
183
|
-
* The currency of the `total_amount`, as an ISO 4217
|
|
175
|
+
* The currency of the `total_amount`, as an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)
|
|
176
|
+
* currency code. It will match your organisation's billing currency unless
|
|
177
|
+
* you’re using Duffel as an accredited IATA agent, in which case it will be
|
|
178
|
+
* in the currency provided by the airline (which will usually be based on the
|
|
179
|
+
* country where your IATA agency is registered).
|
|
184
180
|
*/
|
|
185
181
|
total_currency: string;
|
|
182
|
+
}
|
|
183
|
+
export interface OfferAvailableServiceBaggage extends OfferAvailableServiceCommon {
|
|
184
|
+
/**
|
|
185
|
+
* The metadata varies by the type of service. It includes further data
|
|
186
|
+
* about the service. For example, for baggages, it may have data about
|
|
187
|
+
* size and weight restrictions.
|
|
188
|
+
*/
|
|
189
|
+
metadata: OfferAvailableServiceBaggageMetadata;
|
|
186
190
|
/**
|
|
187
191
|
* The type of the service.
|
|
188
|
-
* For now we only return services of type baggage but we will return other types in the future.
|
|
189
|
-
* We won't consider adding new service types a break change.
|
|
190
192
|
*/
|
|
191
|
-
type:
|
|
193
|
+
type: 'baggage';
|
|
194
|
+
}
|
|
195
|
+
export interface OfferAvailableServiceCFAR extends OfferAvailableServiceCommon {
|
|
196
|
+
/**
|
|
197
|
+
* The metadata varies by the type of service. It includes further data
|
|
198
|
+
* about the service. For example, for baggages, it may have data about
|
|
199
|
+
* size and weight restrictions.
|
|
200
|
+
*/
|
|
201
|
+
metadata: OfferAvailableServiceCFARMetadata;
|
|
202
|
+
/**
|
|
203
|
+
* The type of the service.
|
|
204
|
+
*/
|
|
205
|
+
type: 'cancel_for_any_reason';
|
|
206
|
+
}
|
|
207
|
+
export declare type OfferAvailableService = OfferAvailableServiceBaggage | OfferAvailableServiceCFAR;
|
|
208
|
+
export interface PaymentRequirements {
|
|
209
|
+
/**
|
|
210
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime by which
|
|
211
|
+
* you must pay for this order. At this time, if still unpaid, the reserved
|
|
212
|
+
* space on the flight(s) will be released and you will have to create a new
|
|
213
|
+
* order. This will be null only for orders where `awaiting_payment` is
|
|
214
|
+
* `false`.
|
|
215
|
+
*/
|
|
216
|
+
payment_required_by: string | null;
|
|
217
|
+
/**
|
|
218
|
+
* The ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the
|
|
219
|
+
* price associated with the order will no longer be guaranteed by the airline
|
|
220
|
+
* and may change before payment. This will be null when
|
|
221
|
+
* `requires_instant_payment` is `true`.
|
|
222
|
+
*/
|
|
223
|
+
price_guarantee_expires_at: string | null;
|
|
224
|
+
/**
|
|
225
|
+
* When payment is required at the time of booking this will be true and
|
|
226
|
+
* `payment_required_by` and `price_guarantee_expires_at` will be `null`. When
|
|
227
|
+
* payment can be made at a time after booking, this will be `false` and the
|
|
228
|
+
* time limits on the payment will be provided in `payment_required_by` and
|
|
229
|
+
* `price_guarantee_expires_at`.
|
|
230
|
+
*/
|
|
231
|
+
requires_instant_payment: boolean;
|
|
192
232
|
}
|
|
193
233
|
export interface OfferPassenger {
|
|
194
234
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Aircraft, Airline, CabinClass, DuffelPassengerGender, DuffelPassengerTitle, DuffelPassengerType, FlightsConditions, LoyaltyProgrammeAccount,
|
|
1
|
+
import { Aircraft, Airline, CabinClass, DuffelPassengerGender, DuffelPassengerTitle, DuffelPassengerType, FlightsConditions, LoyaltyProgrammeAccount, OfferAvailableServiceBaggage, OfferAvailableServiceBaggageMetadata, PassengerIdentityDocumentType, PaymentType, Place, PlaceType } from '../../types';
|
|
2
2
|
export declare type AvailableActionType = 'accept' | 'cancel' | 'change' | 'update';
|
|
3
3
|
export declare type ActionTakenType = 'accepted' | 'cancelled' | 'changed' | null;
|
|
4
4
|
export interface AirlineInitiatedChange {
|
|
@@ -539,4 +539,4 @@ export interface AddServices {
|
|
|
539
539
|
payment: OrderPayment;
|
|
540
540
|
add_services: Pick<OrderService, 'id' | 'quantity'>[];
|
|
541
541
|
}
|
|
542
|
-
export declare type OrderAvailableService =
|
|
542
|
+
export declare type OrderAvailableService = OfferAvailableServiceBaggage;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Config, DuffelError as _DuffelError } from './Client';
|
|
|
4
4
|
import { Aircraft, Airlines, Airports } from './supportingResources';
|
|
5
5
|
import { Suggestions } from './Places/Suggestions';
|
|
6
6
|
import { Refunds } from './DuffelPayments/Refunds';
|
|
7
|
-
import {
|
|
7
|
+
import { Sessions } from './Links';
|
|
8
8
|
export interface DuffelAPIClient {
|
|
9
9
|
aircraft: Aircraft;
|
|
10
10
|
airlines: Airlines;
|
|
@@ -24,7 +24,7 @@ export declare class Duffel {
|
|
|
24
24
|
aircraft: Aircraft;
|
|
25
25
|
airlines: Airlines;
|
|
26
26
|
airports: Airports;
|
|
27
|
-
links:
|
|
27
|
+
links: Sessions;
|
|
28
28
|
offerRequests: OfferRequests;
|
|
29
29
|
offers: Offers;
|
|
30
30
|
orders: Orders;
|
package/dist/index.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"node-fetch";import{URL as e,URLSearchParams as s}from"url";function i(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(i=Object.getOwnPropertySymbols(t);h<i.length;h++)e.indexOf(i[h])<0&&Object.prototype.propertyIsEnumerable.call(t,i[h])&&(s[i[h]]=t[i[h]])}return s}function h(t,e,s,i){return new(s||(s=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 e;t.done?h(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}o((i=i.apply(t,e||[])).next())}))}function r(t){return this instanceof r?(this.v=t,this):new r(t)}function a(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,h=s.apply(t,e||[]),a=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){h[t]&&(i[t]=function(e){return new Promise((function(s,i){a.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=h[t](e)).value instanceof r?Promise.resolve(s.value.v).then(c,p):u(a[0][2],s)}catch(t){u(a[0][3],t)}var s}function c(t){o("next",t)}function p(t){o("throw",t)}function u(t,e){t(e),a.shift(),a.length&&o(a[0][0],a[0][1])}}!function(){const t={npm_package_version:"1.20.0"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class n{constructor(t){this.request=({method:t,path:e,data:s,params:i})=>h(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:i})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class 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 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:e}=t,s=i(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:s,params:Object.assign({},null!=e&&{return_offers:e})})})),this.path="air/offer_requests"}}class p extends n{constructor(t){super(t),this.get=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,s=i(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.listWithGenerator=t=>{var{offer_request_id:e}=t,s=i(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.update=(t,e,s)=>h(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class u 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 d 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,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.getAvailableServices=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:e})})),this.path="air/orders"}}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.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 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.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,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class v 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,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/fares`,params:e})})),this.path="air/partial_offer_requests"}}class q 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"}}class $ extends Error{constructor({meta:t,errors:e,headers:s}){super(),this.meta=t,this.errors=e,this.headers=s}}class y{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;let c,p;const u=new e(r,this.basePath),d={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(n){const t=new s;Object.entries(n).sort().filter((t=>null!==t[0])).forEach((([e,s])=>{Array.isArray(s)?s.forEach((s=>t.append(e,s.toString()))):t.append(e,s.toString())})),u.search=t.toString()}a&&(c=JSON.stringify({data:Object.assign({},a)})),(null===(h=this.debug)||void 0===h?void 0:h.verbose)&&(console.info("Endpoint: ",u.href),console.info("Method: ",i),a&&console.info("Body Parameters: ",a),n&&console.info("Query Parameters: ",n));const f=yield t(u.href,{method:i,headers:d,body:c,compress:o}),l=f.headers.get("content-type");if(p=l&&l.includes("json")?yield f.json():yield f.text(),!f.ok||"errors"in p&&p.errors)throw new $(Object.assign(Object.assign({},p),{headers:f.headers}));return Object.assign(Object.assign({},p),{headers:f.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:e}){return a(this,arguments,(function*(){let s=yield r(this.request({method:"GET",path:t,params:e}));for(const t of s.data)yield yield r({data:t});for(;s.meta&&"after"in s.meta&&s.meta.after;){s=yield r(this.request({method:"GET",path:t,params:{limit:s.meta.limit,after:s.meta.after}}));for(const t of s.data)yield yield r({data:t})}}))}}class T 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 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.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 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 G 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 w 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 E extends n{constructor(t){super(t),this.generateLink=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/generate_link`,data:t})})),this.path="links"}}class _{constructor(t){this.client=new y(t),this.aircraft=new T(this.client),this.airlines=new O(this.client),this.airports=new b(this.client),this.links=new E(this.client),this.offerRequests=new c(this.client),this.offers=new p(this.client),this.orders=new d(this.client),this.orderChangeRequests=new f(this.client),this.orderChangeOffers=new l(this.client),this.orderChanges=new m(this.client),this.orderCancellations=new u(this.client),this.payments=new v(this.client),this.seatMaps=new q(this.client),this.paymentIntents=new o(this.client),this.partialOfferRequests=new g(this.client),this.suggestions=new G(this.client),this.refunds=new w(this.client)}}const P=$;export{_ as Duffel,P 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(c,p):u(a[0][2],e)}catch(t){u(a[0][3],t)}var e}function c(t){o("next",t)}function p(t){o("throw",t)}function u(t,s){t(s),a.shift(),a.length&&o(a[0][0],a[0][1])}}!function(){const t={npm_package_version:"1.21.0"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class n{constructor(t){this.request=({method:t,path: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 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 p 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 u 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 d 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 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.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 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.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 v 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 q 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"}}class $ extends Error{constructor({meta:t,errors:s,headers:e}){super(),this.meta=t,this.errors=s,this.headers=e}}class y{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;let c,p;const u=new s(r,this.basePath),d={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(n){const t=new 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())})),u.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: ",u.href),console.info("Method: ",i),a&&console.info("Body Parameters: ",a),n&&console.info("Query Parameters: ",n));const f=yield t(u.href,{method:i,headers:d,body:c,compress:o}),l=f.headers.get("content-type");if(p=l&&l.includes("json")?yield f.json():yield f.text(),!f.ok||"errors"in p&&p.errors)throw new $(Object.assign(Object.assign({},p),{headers:f.headers}));return Object.assign(Object.assign({},p),{headers:f.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 T 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 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.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 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 G 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 w 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 E 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 _{constructor(t){this.client=new y(t),this.aircraft=new T(this.client),this.airlines=new O(this.client),this.airports=new b(this.client),this.links=new E(this.client),this.offerRequests=new c(this.client),this.offers=new p(this.client),this.orders=new d(this.client),this.orderChangeRequests=new f(this.client),this.orderChangeOffers=new l(this.client),this.orderChanges=new m(this.client),this.orderCancellations=new u(this.client),this.payments=new v(this.client),this.seatMaps=new q(this.client),this.paymentIntents=new o(this.client),this.partialOfferRequests=new g(this.client),this.suggestions=new G(this.client),this.refunds=new w(this.client)}}const P=$;export{_ as Duffel,P as DuffelError};
|
|
2
2
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("node-fetch"),e=require("url");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=s(t);function r(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s}function h(t,e,s,i){return new(s||(s=Promise))((function(r,h){function a(t){try{o(i.next(t))}catch(t){h(t)}}function n(t){try{o(i.throw(t))}catch(t){h(t)}}function o(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}o((i=i.apply(t,e||[])).next())}))}function a(t){return this instanceof a?(this.v=t,this):new a(t)}function n(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=s.apply(t,e||[]),h=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){r[t]&&(i[t]=function(e){return new Promise((function(s,i){h.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=r[t](e)).value instanceof a?Promise.resolve(s.value.v).then(u,c):p(h[0][2],s)}catch(t){p(h[0][3],t)}var s}function u(t){o("next",t)}function c(t){o("throw",t)}function p(t,e){t(e),h.shift(),h.length&&o(h[0][0],h[0][1])}}!function(){const t={npm_package_version:"1.20.0"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class o{constructor(t){this.request=({method:t,path:e,data:s,params:i})=>h(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:i})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class u extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class c extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.create=t=>h(this,void 0,void 0,(function*(){const{return_offers:e}=t,s=r(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:s,params:Object.assign({},null!=e&&{return_offers:e})})})),this.path="air/offer_requests"}}class p extends o{constructor(t){super(t),this.get=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,s=r(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.listWithGenerator=t=>{var{offer_request_id:e}=t,s=r(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.update=(t,e,s)=>h(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class d extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=t=>this.paginatedRequest({path:this.path,params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class f extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:t})})),this.listWithGenerator=t=>this.paginatedRequest({path:"air/orders",params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.getAvailableServices=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:e})})),this.path="air/orders"}}class l extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/order_change_requests"}}class m extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/order_change_offers"}}class v extends o{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class g extends o{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class q extends o{constructor(t){super(t),this.get=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/fares`,params:e})})),this.path="air/partial_offer_requests"}}class $ extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}class y extends Error{constructor({meta:t,errors:e,headers:s}){super(),this.meta=t,this.errors=e,this.headers=s}}class T{constructor({token:t,basePath:s,apiVersion:r,debug:a,source:n}){this.request=({method:t,path:s,data:r,params:a,compress:n=!0})=>h(this,void 0,void 0,(function*(){var h;let o,u;const c=new e.URL(s,this.basePath),p={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(a){const t=new e.URLSearchParams;Object.entries(a).sort().filter((t=>null!==t[0])).forEach((([e,s])=>{Array.isArray(s)?s.forEach((s=>t.append(e,s.toString()))):t.append(e,s.toString())})),c.search=t.toString()}r&&(o=JSON.stringify({data:Object.assign({},r)})),(null===(h=this.debug)||void 0===h?void 0:h.verbose)&&(console.info("Endpoint: ",c.href),console.info("Method: ",t),r&&console.info("Body Parameters: ",r),a&&console.info("Query Parameters: ",a));const d=yield i.default(c.href,{method:t,headers:p,body:o,compress:n}),f=d.headers.get("content-type");if(u=f&&f.includes("json")?yield d.json():yield d.text(),!d.ok||"errors"in u&&u.errors)throw new y(Object.assign(Object.assign({},u),{headers:d.headers}));return Object.assign(Object.assign({},u),{headers:d.headers})})),this.token=t,this.basePath=s||"https://api.duffel.com",this.apiVersion=r||"v1",this.debug=a,this.source=n}paginatedRequest({path:t,params:e}){return n(this,arguments,(function*(){let s=yield a(this.request({method:"GET",path:t,params:e}));for(const t of s.data)yield yield a({data:t});for(;s.meta&&"after"in s.meta&&s.meta.after;){s=yield a(this.request({method:"GET",path:t,params:{limit:s.meta.limit,after:s.meta.after}}));for(const t of s.data)yield yield a({data:t})}}))}}class O extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/aircraft"}}class b extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airlines"}}class _ extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}class E extends o{constructor(t){super(t),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="places/suggestions"}}class G extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${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 w extends o{constructor(t){super(t),this.generateLink=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/generate_link`,data:t})})),this.path="links"}}const P=y;exports.Duffel=class{constructor(t){this.client=new T(t),this.aircraft=new O(this.client),this.airlines=new b(this.client),this.airports=new _(this.client),this.links=new w(this.client),this.offerRequests=new c(this.client),this.offers=new p(this.client),this.orders=new f(this.client),this.orderChangeRequests=new l(this.client),this.orderChangeOffers=new m(this.client),this.orderChanges=new v(this.client),this.orderCancellations=new d(this.client),this.payments=new g(this.client),this.seatMaps=new $(this.client),this.paymentIntents=new u(this.client),this.partialOfferRequests=new q(this.client),this.suggestions=new E(this.client),this.refunds=new G(this.client)}},exports.DuffelError=P;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("node-fetch"),e=require("url");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=s(t);function r(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s}function h(t,e,s,i){return new(s||(s=Promise))((function(r,h){function a(t){try{o(i.next(t))}catch(t){h(t)}}function n(t){try{o(i.throw(t))}catch(t){h(t)}}function o(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}o((i=i.apply(t,e||[])).next())}))}function a(t){return this instanceof a?(this.v=t,this):new a(t)}function n(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=s.apply(t,e||[]),h=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){r[t]&&(i[t]=function(e){return new Promise((function(s,i){h.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=r[t](e)).value instanceof a?Promise.resolve(s.value.v).then(u,c):p(h[0][2],s)}catch(t){p(h[0][3],t)}var s}function u(t){o("next",t)}function c(t){o("throw",t)}function p(t,e){t(e),h.shift(),h.length&&o(h[0][0],h[0][1])}}!function(){const t={npm_package_version:"1.21.0"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class o{constructor(t){this.request=({method:t,path:e,data:s,params:i})=>h(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:i})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class u extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class c extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.create=t=>h(this,void 0,void 0,(function*(){const{return_offers:e}=t,s=r(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:s,params:Object.assign({},null!=e&&{return_offers:e})})})),this.path="air/offer_requests"}}class p extends o{constructor(t){super(t),this.get=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,s=r(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.listWithGenerator=t=>{var{offer_request_id:e}=t,s=r(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.update=(t,e,s)=>h(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class d extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=t=>this.paginatedRequest({path:this.path,params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class f extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:t})})),this.listWithGenerator=t=>this.paginatedRequest({path:"air/orders",params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.getAvailableServices=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:e})})),this.path="air/orders"}}class l extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/order_change_requests"}}class m extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/order_change_offers"}}class v extends o{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class q extends o{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class g extends o{constructor(t){super(t),this.get=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/fares`,params:e})})),this.path="air/partial_offer_requests"}}class $ extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}class y extends Error{constructor({meta:t,errors:e,headers:s}){super(),this.meta=t,this.errors=e,this.headers=s}}class T{constructor({token:t,basePath:s,apiVersion:r,debug:a,source:n}){this.request=({method:t,path:s,data:r,params:a,compress:n=!0})=>h(this,void 0,void 0,(function*(){var h;let o,u;const c=new e.URL(s,this.basePath),p={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(a){const t=new e.URLSearchParams;Object.entries(a).sort().filter((t=>null!==t[0])).forEach((([e,s])=>{Array.isArray(s)?s.forEach((s=>t.append(e,s.toString()))):t.append(e,s.toString())})),c.search=t.toString()}r&&(o=JSON.stringify({data:Object.assign({},r)})),(null===(h=this.debug)||void 0===h?void 0:h.verbose)&&(console.info("Endpoint: ",c.href),console.info("Method: ",t),r&&console.info("Body Parameters: ",r),a&&console.info("Query Parameters: ",a));const d=yield i.default(c.href,{method:t,headers:p,body:o,compress:n}),f=d.headers.get("content-type");if(u=f&&f.includes("json")?yield d.json():yield d.text(),!d.ok||"errors"in u&&u.errors)throw new y(Object.assign(Object.assign({},u),{headers:d.headers}));return Object.assign(Object.assign({},u),{headers:d.headers})})),this.token=t,this.basePath=s||"https://api.duffel.com",this.apiVersion=r||"v1",this.debug=a,this.source=n}paginatedRequest({path:t,params:e}){return n(this,arguments,(function*(){let s=yield a(this.request({method:"GET",path:t,params:e}));for(const t of s.data)yield yield a({data:t});for(;s.meta&&"after"in s.meta&&s.meta.after;){s=yield a(this.request({method:"GET",path:t,params:{limit:s.meta.limit,after:s.meta.after}}));for(const t of s.data)yield yield a({data:t})}}))}}class O extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/aircraft"}}class b extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airlines"}}class E extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}class G extends o{constructor(t){super(t),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="places/suggestions"}}class _ extends o{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/refunds"}}class w extends o{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="links/sessions"}}const P=y;exports.Duffel=class{constructor(t){this.client=new T(t),this.aircraft=new O(this.client),this.airlines=new b(this.client),this.airports=new E(this.client),this.links=new w(this.client),this.offerRequests=new c(this.client),this.offers=new p(this.client),this.orders=new f(this.client),this.orderChangeRequests=new l(this.client),this.orderChangeOffers=new m(this.client),this.orderChanges=new v(this.client),this.orderCancellations=new d(this.client),this.payments=new q(this.client),this.seatMaps=new $(this.client),this.paymentIntents=new u(this.client),this.partialOfferRequests=new g(this.client),this.suggestions=new G(this.client),this.refunds=new _(this.client)}},exports.DuffelError=P;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.d.ts
CHANGED
|
@@ -106,19 +106,19 @@ interface Offer {
|
|
|
106
106
|
}
|
|
107
107
|
interface OfferAvailableServiceBaggageMetadata {
|
|
108
108
|
/**
|
|
109
|
-
* The maximum weight that the baggage can have in kilograms
|
|
109
|
+
* The maximum weight that the baggage can have in kilograms.
|
|
110
110
|
*/
|
|
111
111
|
maximum_weight_kg: number | null;
|
|
112
112
|
/**
|
|
113
|
-
* The maximum height that the baggage can have in centimetres
|
|
113
|
+
* The maximum height that the baggage can have in centimetres.
|
|
114
114
|
*/
|
|
115
115
|
maximum_height_cm: number | null;
|
|
116
116
|
/**
|
|
117
|
-
* The maximum length that the baggage can have in centimetres
|
|
117
|
+
* The maximum length that the baggage can have in centimetres.
|
|
118
118
|
*/
|
|
119
119
|
maximum_length_cm: number | null;
|
|
120
120
|
/**
|
|
121
|
-
* The maximum depth that the baggage can have in centimetres
|
|
121
|
+
* The maximum depth that the baggage can have in centimetres.
|
|
122
122
|
*/
|
|
123
123
|
maximum_depth_cm: number | null;
|
|
124
124
|
/**
|
|
@@ -126,70 +126,110 @@ interface OfferAvailableServiceBaggageMetadata {
|
|
|
126
126
|
*/
|
|
127
127
|
type: BaggageType;
|
|
128
128
|
}
|
|
129
|
-
interface
|
|
129
|
+
interface OfferAvailableServiceCFARMetadata {
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* will be released and you will have to create a new order.
|
|
134
|
-
* This will be null only for orders where `awaiting_payment` is `false`.
|
|
131
|
+
* The amount the customer will receive back if the service is used, in
|
|
132
|
+
* `offer.total_currency`.
|
|
135
133
|
*/
|
|
136
|
-
|
|
134
|
+
refund_amount: string;
|
|
137
135
|
/**
|
|
138
|
-
*
|
|
139
|
-
* with the order will no longer be guaranteed by the airline
|
|
140
|
-
* and the order will need to be repriced before payment.
|
|
141
|
-
* This can be null when there is no price guarantee.
|
|
136
|
+
* Information to display to customers.
|
|
142
137
|
*/
|
|
143
|
-
|
|
138
|
+
merchant_copy: string;
|
|
144
139
|
/**
|
|
145
|
-
*
|
|
140
|
+
* URL with the T&Cs for customers.
|
|
146
141
|
*/
|
|
147
|
-
|
|
142
|
+
terms_and_conditions_url: string;
|
|
143
|
+
type: 'cancel_for_any_reason';
|
|
148
144
|
}
|
|
149
|
-
interface
|
|
150
|
-
baggage: OfferAvailableServiceBaggageMetadata;
|
|
151
|
-
}
|
|
152
|
-
declare type OfferAvailableServiceType = keyof OfferAvailableServiceMetadataMap;
|
|
153
|
-
interface OfferAvailableService<T_ServiceType extends OfferAvailableServiceType = 'baggage'> {
|
|
145
|
+
interface OfferAvailableServiceCommon {
|
|
154
146
|
/**
|
|
155
|
-
* Duffel's unique identifier for the service
|
|
147
|
+
* Duffel's unique identifier for the service.
|
|
156
148
|
*/
|
|
157
149
|
id: string;
|
|
158
150
|
/**
|
|
159
|
-
* The maximum quantity of this service that can be booked with an order
|
|
151
|
+
* The maximum quantity of this service that can be booked with an order.
|
|
160
152
|
*/
|
|
161
153
|
maximum_quantity: number;
|
|
162
154
|
/**
|
|
163
|
-
*
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
* The list of passenger `id`s the service applies to.
|
|
168
|
-
* If you add this service to an order it will apply to all the passengers in this list.
|
|
169
|
-
* For services where the type is `baggage`, this list will include only a single passenger.
|
|
155
|
+
* The list of passenger `id`s the service applies to. If you add this
|
|
156
|
+
* service to an order it will apply to all the passengers in this list.
|
|
157
|
+
* For services where the type is `baggage`, this list will include only a
|
|
158
|
+
* single passenger.
|
|
170
159
|
*/
|
|
171
160
|
passenger_ids: string[];
|
|
172
161
|
/**
|
|
173
|
-
* The list of segment
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
162
|
+
* The list of segment `id`s the service applies to. If you add this
|
|
163
|
+
* service to an order it will apply to all the segments in this list. For
|
|
164
|
+
* services where the type is `baggage`, depending on the airline, this
|
|
165
|
+
* list includes all the segments of all slices or all the segments of a
|
|
166
|
+
* single slice.
|
|
177
167
|
*/
|
|
178
168
|
segment_ids: string[];
|
|
179
169
|
/**
|
|
180
|
-
* The total price of the service for all passengers and segments it
|
|
170
|
+
* The total price of the service for all passengers and segments it
|
|
171
|
+
* applies to, including taxes. This price is for a single unit of the
|
|
172
|
+
* service.
|
|
181
173
|
*/
|
|
182
174
|
total_amount: string;
|
|
183
175
|
/**
|
|
184
|
-
* The currency of the `total_amount`, as an ISO 4217
|
|
176
|
+
* The currency of the `total_amount`, as an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)
|
|
177
|
+
* currency code. It will match your organisation's billing currency unless
|
|
178
|
+
* you’re using Duffel as an accredited IATA agent, in which case it will be
|
|
179
|
+
* in the currency provided by the airline (which will usually be based on the
|
|
180
|
+
* country where your IATA agency is registered).
|
|
185
181
|
*/
|
|
186
182
|
total_currency: string;
|
|
183
|
+
}
|
|
184
|
+
interface OfferAvailableServiceBaggage extends OfferAvailableServiceCommon {
|
|
185
|
+
/**
|
|
186
|
+
* The metadata varies by the type of service. It includes further data
|
|
187
|
+
* about the service. For example, for baggages, it may have data about
|
|
188
|
+
* size and weight restrictions.
|
|
189
|
+
*/
|
|
190
|
+
metadata: OfferAvailableServiceBaggageMetadata;
|
|
187
191
|
/**
|
|
188
192
|
* The type of the service.
|
|
189
|
-
* For now we only return services of type baggage but we will return other types in the future.
|
|
190
|
-
* We won't consider adding new service types a break change.
|
|
191
193
|
*/
|
|
192
|
-
type:
|
|
194
|
+
type: 'baggage';
|
|
195
|
+
}
|
|
196
|
+
interface OfferAvailableServiceCFAR extends OfferAvailableServiceCommon {
|
|
197
|
+
/**
|
|
198
|
+
* The metadata varies by the type of service. It includes further data
|
|
199
|
+
* about the service. For example, for baggages, it may have data about
|
|
200
|
+
* size and weight restrictions.
|
|
201
|
+
*/
|
|
202
|
+
metadata: OfferAvailableServiceCFARMetadata;
|
|
203
|
+
/**
|
|
204
|
+
* The type of the service.
|
|
205
|
+
*/
|
|
206
|
+
type: 'cancel_for_any_reason';
|
|
207
|
+
}
|
|
208
|
+
declare type OfferAvailableService = OfferAvailableServiceBaggage | OfferAvailableServiceCFAR;
|
|
209
|
+
interface PaymentRequirements {
|
|
210
|
+
/**
|
|
211
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime by which
|
|
212
|
+
* you must pay for this order. At this time, if still unpaid, the reserved
|
|
213
|
+
* space on the flight(s) will be released and you will have to create a new
|
|
214
|
+
* order. This will be null only for orders where `awaiting_payment` is
|
|
215
|
+
* `false`.
|
|
216
|
+
*/
|
|
217
|
+
payment_required_by: string | null;
|
|
218
|
+
/**
|
|
219
|
+
* The ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the
|
|
220
|
+
* price associated with the order will no longer be guaranteed by the airline
|
|
221
|
+
* and may change before payment. This will be null when
|
|
222
|
+
* `requires_instant_payment` is `true`.
|
|
223
|
+
*/
|
|
224
|
+
price_guarantee_expires_at: string | null;
|
|
225
|
+
/**
|
|
226
|
+
* When payment is required at the time of booking this will be true and
|
|
227
|
+
* `payment_required_by` and `price_guarantee_expires_at` will be `null`. When
|
|
228
|
+
* payment can be made at a time after booking, this will be `false` and the
|
|
229
|
+
* time limits on the payment will be provided in `payment_required_by` and
|
|
230
|
+
* `price_guarantee_expires_at`.
|
|
231
|
+
*/
|
|
232
|
+
requires_instant_payment: boolean;
|
|
193
233
|
}
|
|
194
234
|
interface OfferPassenger {
|
|
195
235
|
/**
|
|
@@ -1508,7 +1548,7 @@ interface AddServices {
|
|
|
1508
1548
|
payment: OrderPayment;
|
|
1509
1549
|
add_services: Pick<OrderService, 'id' | 'quantity'>[];
|
|
1510
1550
|
}
|
|
1511
|
-
declare type OrderAvailableService =
|
|
1551
|
+
declare type OrderAvailableService = OfferAvailableServiceBaggage;
|
|
1512
1552
|
|
|
1513
1553
|
/**
|
|
1514
1554
|
* To pay for an unpaid order you've previously created, you'll need to create a payment for it.
|
|
@@ -2865,7 +2905,7 @@ declare class Refunds extends Resource {
|
|
|
2865
2905
|
create: (params: CreateRefund) => Promise<DuffelResponse<Refund>>;
|
|
2866
2906
|
}
|
|
2867
2907
|
|
|
2868
|
-
interface
|
|
2908
|
+
interface SessionParameters {
|
|
2869
2909
|
/**
|
|
2870
2910
|
* A tracking reference for the booking that may be created within this Duffel Links session
|
|
2871
2911
|
*/
|
|
@@ -2907,22 +2947,22 @@ interface GenerateLinkParameters {
|
|
|
2907
2947
|
*/
|
|
2908
2948
|
checkout_display_text?: string;
|
|
2909
2949
|
}
|
|
2910
|
-
interface
|
|
2950
|
+
interface Session {
|
|
2911
2951
|
/**
|
|
2912
2952
|
* The Duffel Links url that contains the specified configuration
|
|
2913
2953
|
*/
|
|
2914
2954
|
url: string;
|
|
2915
2955
|
}
|
|
2916
|
-
declare class
|
|
2956
|
+
declare class Sessions extends Resource {
|
|
2917
2957
|
/**
|
|
2918
2958
|
* Endpoint path
|
|
2919
2959
|
*/
|
|
2920
2960
|
path: string;
|
|
2921
2961
|
constructor(client: Client);
|
|
2922
2962
|
/**
|
|
2923
|
-
*
|
|
2963
|
+
* Create a Duffel Links Session per the configuration
|
|
2924
2964
|
*/
|
|
2925
|
-
|
|
2965
|
+
create: (data: SessionParameters) => Promise<DuffelResponse<Session>>;
|
|
2926
2966
|
}
|
|
2927
2967
|
|
|
2928
2968
|
interface DuffelAPIClient {
|
|
@@ -2944,7 +2984,7 @@ declare class Duffel {
|
|
|
2944
2984
|
aircraft: Aircraft;
|
|
2945
2985
|
airlines: Airlines;
|
|
2946
2986
|
airports: Airports;
|
|
2947
|
-
links:
|
|
2987
|
+
links: Sessions;
|
|
2948
2988
|
offerRequests: OfferRequests;
|
|
2949
2989
|
offers: Offers;
|
|
2950
2990
|
orders: Orders;
|
|
@@ -2962,4 +3002,4 @@ declare class Duffel {
|
|
|
2962
3002
|
}
|
|
2963
3003
|
declare const DuffelError: typeof DuffelError$1;
|
|
2964
3004
|
|
|
2965
|
-
export { ActionTakenType, AddServices, Aircraft$1 as Aircraft, Airline, AirlineInitiatedChange, AirlineInitiatedChanges, Airport, ApiResponseError, ApiResponseMeta, AvailableActionType, BaggageType, CabinClass, City, ConfirmOrderChangePayment, CreateOfferRequest, CreateOfferRequestQueryParameters, CreateOrder, CreateOrderCancellation, CreateOrderChangeParameters, CreateOrderChangeRequest, CreateOrderPassenger, CreatePayment, CreatePaymentIntent, Duffel, DuffelAPIClient, DuffelError, DuffelPassengerGender, DuffelPassengerTitle, DuffelPassengerType, DuffelResponse, FlightsConditions, ListOffersParams, ListOrderCancellationsParams, ListParamsOrders, LoyaltyProgrammeAccount, LoyaltyProgrammeAccounts, Offer, OfferAvailableService, OfferAvailableServiceBaggageMetadata,
|
|
3005
|
+
export { ActionTakenType, AddServices, Aircraft$1 as Aircraft, Airline, AirlineInitiatedChange, AirlineInitiatedChanges, Airport, ApiResponseError, ApiResponseMeta, AvailableActionType, BaggageType, CabinClass, City, ConfirmOrderChangePayment, CreateOfferRequest, CreateOfferRequestQueryParameters, CreateOrder, CreateOrderCancellation, CreateOrderChangeParameters, CreateOrderChangeRequest, CreateOrderPassenger, CreatePayment, CreatePaymentIntent, Duffel, DuffelAPIClient, DuffelError, DuffelPassengerGender, DuffelPassengerTitle, DuffelPassengerType, DuffelResponse, FlightsConditions, ListOffersParams, ListOrderCancellationsParams, ListParamsOrders, LoyaltyProgrammeAccount, LoyaltyProgrammeAccounts, Offer, OfferAvailableService, OfferAvailableServiceBaggage, OfferAvailableServiceBaggageMetadata, OfferAvailableServiceCFAR, OfferAvailableServiceCFARMetadata, OfferAvailableServiceCommon, OfferPassenger, OfferRequest, OfferRequestPassenger, OfferRequestSlice, OfferSlice, OfferSliceSegment, OfferSliceSegmentPassenger, OfferSliceSegmentPassengerBaggage, Order, OrderAvailableService, OrderCancellation, OrderChange, OrderChangeOffer, OrderChangeOfferSlice, OrderChangeOfferSlices, OrderChangeOffers$1 as OrderChangeOffers, OrderChangeRequestResponse, OrderChangeSliceResponse, OrderDocument, OrderDocumentsType, OrderPassenger, OrderPassengerIdentityDocument, OrderPayment, OrderPaymentStatus, OrderSegmentPassenger, OrderSegmentPassengerBaggage, OrderService, OrderServiceBaggageMetadata, OrderSlice, OrderSliceSegment, PaginationMeta, PassengerIdentityDocumentType, Payment, PaymentIntent, PaymentRequirements, PaymentType, Place, PlaceType, Places, SDKOptions, Seat, SeatMap, SeatMapCabin, SeatMapCabinRow, SeatMapCabinRowSection, SeatMapCabinRowSectionAvailableService, SeatMapCabinRowSectionElement, SeatMapCabinRowSectionElementAmenity, SeatMapCabinRowSectionElementBassinet, SeatMapCabinRowSectionElementCloset, SeatMapCabinRowSectionElementEmpty, SeatMapCabinRowSectionElementExitRow, SeatMapCabinRowSectionElementGalley, SeatMapCabinRowSectionElementLavatory, SeatMapCabinRowSectionElementSeat, SeatMapCabinRowSectionElementStairs, SeatMapCabinRowSectionElementType, UpdateOffer, UpdateSingleOrder };
|