@duffel/api 1.22.0 → 1.24.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/booking/AirlineInitiatedChanges/AirlineInitiatedChanges.d.ts +63 -0
- package/dist/booking/AirlineInitiatedChanges/AirlineInitiatedChanges.spec.d.ts +1 -0
- package/dist/booking/AirlineInitiatedChanges/AirlineInitiatedChangesTypes.d.ts +57 -0
- package/dist/booking/AirlineInitiatedChanges/index.d.ts +1 -0
- package/dist/booking/Orders/OrdersTypes.d.ts +2 -44
- package/dist/booking/index.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/index.d.ts +120 -44
- package/package.json +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Client } from '../../Client';
|
|
2
|
+
import { Resource } from '../../Resource';
|
|
3
|
+
import { AirlineInitiatedChangeAvailableAction, DuffelResponse, Order } from '../../types';
|
|
4
|
+
import { AirlineInitiatedChange } from './AirlineInitiatedChangesTypes';
|
|
5
|
+
/**
|
|
6
|
+
* Sometimes there can be changes to your order initiated by the airline, for
|
|
7
|
+
* example a flight being delayed. We record every one of these changes so that
|
|
8
|
+
* you can view them all or for an order. You can filter changes for a specific
|
|
9
|
+
* order using the `order_id` parameter.
|
|
10
|
+
*
|
|
11
|
+
* Each airline-initiated change contains an `added` and `removed` field. `added`
|
|
12
|
+
* contains the updated slices following the change. These slices and their
|
|
13
|
+
* segments may have a new ID based on the change. `removed` contains a list of
|
|
14
|
+
* slices and their segments as they were before the change.
|
|
15
|
+
*/
|
|
16
|
+
export declare class AirlineInitiatedChanges extends Resource {
|
|
17
|
+
/**
|
|
18
|
+
* Endpoint path
|
|
19
|
+
*/
|
|
20
|
+
path: string;
|
|
21
|
+
constructor(client: Client);
|
|
22
|
+
/**
|
|
23
|
+
* This endpoint is only available to those airline-initiated changes that
|
|
24
|
+
* Duffel cannot accept on behalf of the customer. Duffel is unable to accept
|
|
25
|
+
* an airline-initiated change when these two conditions are true: the order
|
|
26
|
+
* was booked with the merchant's IATA number and Duffel is unable to accept
|
|
27
|
+
* the airline-initiated change programatically. In this case you, the
|
|
28
|
+
* customer, are responsible to resolve airline-initiated changes concerning
|
|
29
|
+
* this order (e.g. by contacting the airline directly). Once these have been
|
|
30
|
+
* resolved, you need to inform us of the action taken so we can mark it
|
|
31
|
+
* accordingly in our system.
|
|
32
|
+
*
|
|
33
|
+
* @param {AirlineInitiatedChange['id']} id - Duffel's unique identifier for
|
|
34
|
+
* the airline-initiated change
|
|
35
|
+
*
|
|
36
|
+
* @param action_taken - The action taken in response to this
|
|
37
|
+
* airline-initiated change. Accepted, cancelled and changed reflect your
|
|
38
|
+
* action in accepting the change, cancelling the order or changing the order
|
|
39
|
+
* respectively.
|
|
40
|
+
*
|
|
41
|
+
* @link https://duffel.com/docs/api/v1/airline-initiated-changes/update-airline-initiated-changes
|
|
42
|
+
*/
|
|
43
|
+
update: (id: AirlineInitiatedChange['id'], action_taken: AirlineInitiatedChangeAvailableAction) => Promise<DuffelResponse<AirlineInitiatedChange>>;
|
|
44
|
+
/**
|
|
45
|
+
* Once there is an airline-initiated change you can choose to accept it.
|
|
46
|
+
*
|
|
47
|
+
* @param {AirlineInitiatedChange['id']} id - Duffel's unique identifier for
|
|
48
|
+
* the airline-initiated change
|
|
49
|
+
*
|
|
50
|
+
* @link https://duffel.com/docs/api/v1/airline-initiated-changes/accept-airline-initiated-changes
|
|
51
|
+
*/
|
|
52
|
+
accept: (id: AirlineInitiatedChange['id']) => Promise<DuffelResponse<AirlineInitiatedChange>>;
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves a list of all airline-initiated changes.
|
|
55
|
+
*
|
|
56
|
+
* @param order_id - Filters airline-initiated changes by their order ID.
|
|
57
|
+
* Value must be a valid order ID. Check the [Order schema](https://duffel.com/docs/api/orders/schema#orders-schema-id)
|
|
58
|
+
* for details.
|
|
59
|
+
*
|
|
60
|
+
* @link https://duffel.com/docs/api/v1/airline-initiated-changes/get-airline-initiated-changes
|
|
61
|
+
*/
|
|
62
|
+
list: (order_id: Order['id']) => Promise<DuffelResponse<Order['airline_initiated_changes']>>;
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { OrderSlice } from 'types';
|
|
2
|
+
export declare type AirlineInitiatedChangeActionTaken = 'accepted' | 'cancelled' | 'changed';
|
|
3
|
+
export declare type AirlineInitiatedChangeAvailableAction = 'accept' | 'cancel' | 'change' | 'update';
|
|
4
|
+
export interface AirlineInitiatedChange {
|
|
5
|
+
/**
|
|
6
|
+
* The action taken in response to this airline-initiated change. Accepted,
|
|
7
|
+
* cancelled and changed reflect your action in accepting the change,
|
|
8
|
+
* cancelling the order or changing the order respectively.
|
|
9
|
+
*/
|
|
10
|
+
action_taken: AirlineInitiatedChangeActionTaken | null;
|
|
11
|
+
/**
|
|
12
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which an
|
|
13
|
+
* action was taken.
|
|
14
|
+
*/
|
|
15
|
+
action_taken_at: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* List of updated (slices and segments)[https://duffel.com/docs/api/orders/schema#orders-schema-slices]
|
|
18
|
+
* following the change. These slices and segments may each have a new ID as a
|
|
19
|
+
* result of the changes.
|
|
20
|
+
*/
|
|
21
|
+
added: OrderSlice[];
|
|
22
|
+
/**
|
|
23
|
+
* The available actions you can take on this Airline-Initiated Change through
|
|
24
|
+
* our API.`"update"` means that you can use the update endpoint for an
|
|
25
|
+
* Airline-Initiated Change.
|
|
26
|
+
*/
|
|
27
|
+
available_actions: AirlineInitiatedChangeAvailableAction[];
|
|
28
|
+
/**
|
|
29
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which we
|
|
30
|
+
* detected the airline-initiated change.
|
|
31
|
+
*/
|
|
32
|
+
created_at: string;
|
|
33
|
+
/**
|
|
34
|
+
* Duffel's unique identifier for the airline-initiated change.
|
|
35
|
+
*/
|
|
36
|
+
id: string;
|
|
37
|
+
/**
|
|
38
|
+
* Duffel's unique identifier for the order.
|
|
39
|
+
*/
|
|
40
|
+
order_id: string;
|
|
41
|
+
/**
|
|
42
|
+
* List of (slices and segments)[https://duffel.com/docs/api/orders/schema#orders-schema-slices]
|
|
43
|
+
* as they were before the change.
|
|
44
|
+
*/
|
|
45
|
+
removed: OrderSlice[];
|
|
46
|
+
/**
|
|
47
|
+
* The associated Travel Agent Ticket, if any, for this Airline-Initiated
|
|
48
|
+
* Change. This value will be present for Airline-Initiated changes that take
|
|
49
|
+
* some time to be processed.
|
|
50
|
+
*/
|
|
51
|
+
travel_agent_ticket: any | null;
|
|
52
|
+
/**
|
|
53
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which
|
|
54
|
+
* the airline-initiated change was last updated.
|
|
55
|
+
*/
|
|
56
|
+
updated_at: string;
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AirlineInitiatedChanges';
|
|
@@ -1,46 +1,4 @@
|
|
|
1
|
-
import { Aircraft, Airline, CabinClass, DuffelPassengerGender, DuffelPassengerTitle, DuffelPassengerType, FlightsConditions, LoyaltyProgrammeAccount, OfferAvailableServiceBaggage, OfferAvailableServiceBaggageMetadata, PassengerIdentityDocumentType, PaymentType, Place, PlaceType } from '../../types';
|
|
2
|
-
export declare type AvailableActionType = 'accept' | 'cancel' | 'change' | 'update';
|
|
3
|
-
export declare type ActionTakenType = 'accepted' | 'cancelled' | 'changed' | null;
|
|
4
|
-
export interface AirlineInitiatedChange {
|
|
5
|
-
/**
|
|
6
|
-
* Duffel's unique identifier for the airline-initiated change
|
|
7
|
-
*/
|
|
8
|
-
id: string;
|
|
9
|
-
/**
|
|
10
|
-
* Duffel's unique identifier for the order
|
|
11
|
-
*/
|
|
12
|
-
order_id: string;
|
|
13
|
-
/**
|
|
14
|
-
* List of updated slices and segments following the change
|
|
15
|
-
*/
|
|
16
|
-
added: OrderSlice[];
|
|
17
|
-
/**
|
|
18
|
-
* List of slices and segments as they were before the change
|
|
19
|
-
*/
|
|
20
|
-
removed: OrderSlice[];
|
|
21
|
-
/**
|
|
22
|
-
* The action taken in response to this airline-initiated change
|
|
23
|
-
*/
|
|
24
|
-
action_taken: ActionTakenType;
|
|
25
|
-
/**
|
|
26
|
-
* The ISO 8601 datetime at which an action was taken
|
|
27
|
-
*/
|
|
28
|
-
action_taken_at: string | null;
|
|
29
|
-
/**
|
|
30
|
-
* The available actions you can take on this Airline-Initiated Change through our API.
|
|
31
|
-
* 'update' means that you can use the update endpoint for an Airline-Initiated Change.
|
|
32
|
-
*/
|
|
33
|
-
available_actions: AvailableActionType[];
|
|
34
|
-
/**
|
|
35
|
-
* The ISO 8601 datetime at which the Payment Intent was created
|
|
36
|
-
*/
|
|
37
|
-
created_at: string;
|
|
38
|
-
/**
|
|
39
|
-
* The ISO 8601 datetime at which the airline-initiated change was last updated
|
|
40
|
-
*/
|
|
41
|
-
updated_at: string;
|
|
42
|
-
}
|
|
43
|
-
export declare type AirlineInitiatedChanges = AirlineInitiatedChange[];
|
|
1
|
+
import { Aircraft, Airline, AirlineInitiatedChange, CabinClass, DuffelPassengerGender, DuffelPassengerTitle, DuffelPassengerType, FlightsConditions, LoyaltyProgrammeAccount, OfferAvailableServiceBaggage, OfferAvailableServiceBaggageMetadata, PassengerIdentityDocumentType, PaymentType, Place, PlaceType } from '../../types';
|
|
44
2
|
/**
|
|
45
3
|
* An object containing metadata about the service, like the designator of the seat.
|
|
46
4
|
*/
|
|
@@ -494,7 +452,7 @@ export interface Order {
|
|
|
494
452
|
/**
|
|
495
453
|
* The airline-initiated changes for this order.
|
|
496
454
|
*/
|
|
497
|
-
airline_initiated_changes?:
|
|
455
|
+
airline_initiated_changes?: AirlineInitiatedChange[];
|
|
498
456
|
}
|
|
499
457
|
export interface CreateOrder {
|
|
500
458
|
/**
|
package/dist/booking/index.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PaymentIntents } from './DuffelPayments';
|
|
2
|
-
import { OfferRequests, Offers, OrderCancellations, Orders, OrderChangeRequests, OrderChangeOffers, OrderChanges, Payments, PartialOfferRequests, SeatMaps } from './booking';
|
|
2
|
+
import { OfferRequests, Offers, OrderCancellations, Orders, OrderChangeRequests, OrderChangeOffers, OrderChanges, Payments, PartialOfferRequests, SeatMaps, AirlineInitiatedChanges } from './booking';
|
|
3
3
|
import { Config, DuffelError as _DuffelError } from './Client';
|
|
4
4
|
import { Aircraft, Airlines, Airports } from './supportingResources';
|
|
5
5
|
import { Suggestions } from './Places/Suggestions';
|
|
@@ -22,6 +22,7 @@ export interface DuffelAPIClient {
|
|
|
22
22
|
export declare class Duffel {
|
|
23
23
|
private client;
|
|
24
24
|
aircraft: Aircraft;
|
|
25
|
+
airlineInitiatedChanges: AirlineInitiatedChanges;
|
|
25
26
|
airlines: Airlines;
|
|
26
27
|
airports: Airports;
|
|
27
28
|
links: Sessions;
|
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(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};
|
|
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.23.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.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 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=()=>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 u 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 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=>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 m 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 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.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"}}class T 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 T(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 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/aircraft"}}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}/${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 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.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}class b 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 P{constructor(t){this.client=new y(t),this.aircraft=new O(this.client),this.airlines=new _(this.client),this.airports=new G(this.client),this.airlineInitiatedChanges=new c(this.client),this.links=new E(this.client),this.offerRequests=new p(this.client),this.offers=new u(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 o(this.client),this.partialOfferRequests=new g(this.client),this.suggestions=new b(this.client),this.refunds=new w(this.client)}}const x=T;export{P as Duffel,x 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.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;
|
|
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 h(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 r(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 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,h=s.apply(t,e||[]),r=[];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){r.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=h[t](e)).value instanceof a?Promise.resolve(s.value.v).then(u,c):p(r[0][2],s)}catch(t){p(r[0][3],t)}var s}function u(t){o("next",t)}function c(t){o("throw",t)}function p(t,e){t(e),r.shift(),r.length&&o(r[0][0],r[0][1])}}!function(){const t={npm_package_version:"1.23.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})=>r(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:i})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class u extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class c extends o{constructor(t){super(t),this.update=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{action_taken:e}})})),this.accept=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/accept`})})),this.list=t=>r(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 p extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.create=t=>r(this,void 0,void 0,(function*(){const{return_offers:e}=t,s=h(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 d extends o{constructor(t){super(t),this.get=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,s=h(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=h(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.update=(t,e,s)=>r(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class f extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=t=>this.paginatedRequest({path:this.path,params:t}),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class l extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:t})})),this.listWithGenerator=t=>this.paginatedRequest({path:"air/orders",params:t}),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.getAvailableServices=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:e})})),this.path="air/orders"}}class m extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/order_change_requests"}}class v extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/order_change_offers"}}class q extends o{constructor(t){super(t),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class g extends o{constructor(t){super(t),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class $ extends o{constructor(t){super(t),this.get=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,e)=>r(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 T extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}class y extends Error{constructor({meta:t,errors:e,headers:s}){super(),this.meta=t,this.errors=e,this.headers=s}}class O{constructor({token:t,basePath:s,apiVersion:h,debug:a,source:n}){this.request=({method:t,path:s,data:h,params:a,compress:n=!0})=>r(this,void 0,void 0,(function*(){var r;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()}h&&(o=JSON.stringify({data:Object.assign({},h)})),(null===(r=this.debug)||void 0===r?void 0:r.verbose)&&(console.info("Endpoint: ",c.href),console.info("Method: ",t),h&&console.info("Body Parameters: ",h),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=h||"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 _ extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/aircraft"}}class b extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airlines"}}class E extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}class G extends o{constructor(t){super(t),this.list=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="places/suggestions"}}class w extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/refunds"}}class P extends o{constructor(t){super(t),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="links/sessions"}}const x=y;exports.Duffel=class{constructor(t){this.client=new O(t),this.aircraft=new _(this.client),this.airlines=new b(this.client),this.airports=new E(this.client),this.airlineInitiatedChanges=new c(this.client),this.links=new P(this.client),this.offerRequests=new p(this.client),this.offers=new d(this.client),this.orders=new l(this.client),this.orderChangeRequests=new m(this.client),this.orderChangeOffers=new v(this.client),this.orderChanges=new q(this.client),this.orderCancellations=new f(this.client),this.payments=new g(this.client),this.seatMaps=new T(this.client),this.paymentIntents=new u(this.client),this.partialOfferRequests=new $(this.client),this.suggestions=new G(this.client),this.refunds=new w(this.client)}},exports.DuffelError=x;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
import { Headers } from 'node-fetch';
|
|
2
2
|
|
|
3
|
+
declare type AirlineInitiatedChangeActionTaken = 'accepted' | 'cancelled' | 'changed';
|
|
4
|
+
declare type AirlineInitiatedChangeAvailableAction = 'accept' | 'cancel' | 'change' | 'update';
|
|
5
|
+
interface AirlineInitiatedChange {
|
|
6
|
+
/**
|
|
7
|
+
* The action taken in response to this airline-initiated change. Accepted,
|
|
8
|
+
* cancelled and changed reflect your action in accepting the change,
|
|
9
|
+
* cancelling the order or changing the order respectively.
|
|
10
|
+
*/
|
|
11
|
+
action_taken: AirlineInitiatedChangeActionTaken | null;
|
|
12
|
+
/**
|
|
13
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which an
|
|
14
|
+
* action was taken.
|
|
15
|
+
*/
|
|
16
|
+
action_taken_at: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* List of updated (slices and segments)[https://duffel.com/docs/api/orders/schema#orders-schema-slices]
|
|
19
|
+
* following the change. These slices and segments may each have a new ID as a
|
|
20
|
+
* result of the changes.
|
|
21
|
+
*/
|
|
22
|
+
added: OrderSlice[];
|
|
23
|
+
/**
|
|
24
|
+
* The available actions you can take on this Airline-Initiated Change through
|
|
25
|
+
* our API.`"update"` means that you can use the update endpoint for an
|
|
26
|
+
* Airline-Initiated Change.
|
|
27
|
+
*/
|
|
28
|
+
available_actions: AirlineInitiatedChangeAvailableAction[];
|
|
29
|
+
/**
|
|
30
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which we
|
|
31
|
+
* detected the airline-initiated change.
|
|
32
|
+
*/
|
|
33
|
+
created_at: string;
|
|
34
|
+
/**
|
|
35
|
+
* Duffel's unique identifier for the airline-initiated change.
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Duffel's unique identifier for the order.
|
|
40
|
+
*/
|
|
41
|
+
order_id: string;
|
|
42
|
+
/**
|
|
43
|
+
* List of (slices and segments)[https://duffel.com/docs/api/orders/schema#orders-schema-slices]
|
|
44
|
+
* as they were before the change.
|
|
45
|
+
*/
|
|
46
|
+
removed: OrderSlice[];
|
|
47
|
+
/**
|
|
48
|
+
* The associated Travel Agent Ticket, if any, for this Airline-Initiated
|
|
49
|
+
* Change. This value will be present for Airline-Initiated changes that take
|
|
50
|
+
* some time to be processed.
|
|
51
|
+
*/
|
|
52
|
+
travel_agent_ticket: any | null;
|
|
53
|
+
/**
|
|
54
|
+
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which
|
|
55
|
+
* the airline-initiated change was last updated.
|
|
56
|
+
*/
|
|
57
|
+
updated_at: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
3
60
|
/**
|
|
4
61
|
* Each offer represents flights you can buy from an airline at a particular price that meet your search criteria.
|
|
5
62
|
* @link https://duffel.com/docs/api/offers/schema
|
|
@@ -1008,48 +1065,6 @@ interface ConfirmOrderChangePayment {
|
|
|
1008
1065
|
type: PaymentType;
|
|
1009
1066
|
}
|
|
1010
1067
|
|
|
1011
|
-
declare type AvailableActionType = 'accept' | 'cancel' | 'change' | 'update';
|
|
1012
|
-
declare type ActionTakenType = 'accepted' | 'cancelled' | 'changed' | null;
|
|
1013
|
-
interface AirlineInitiatedChange {
|
|
1014
|
-
/**
|
|
1015
|
-
* Duffel's unique identifier for the airline-initiated change
|
|
1016
|
-
*/
|
|
1017
|
-
id: string;
|
|
1018
|
-
/**
|
|
1019
|
-
* Duffel's unique identifier for the order
|
|
1020
|
-
*/
|
|
1021
|
-
order_id: string;
|
|
1022
|
-
/**
|
|
1023
|
-
* List of updated slices and segments following the change
|
|
1024
|
-
*/
|
|
1025
|
-
added: OrderSlice[];
|
|
1026
|
-
/**
|
|
1027
|
-
* List of slices and segments as they were before the change
|
|
1028
|
-
*/
|
|
1029
|
-
removed: OrderSlice[];
|
|
1030
|
-
/**
|
|
1031
|
-
* The action taken in response to this airline-initiated change
|
|
1032
|
-
*/
|
|
1033
|
-
action_taken: ActionTakenType;
|
|
1034
|
-
/**
|
|
1035
|
-
* The ISO 8601 datetime at which an action was taken
|
|
1036
|
-
*/
|
|
1037
|
-
action_taken_at: string | null;
|
|
1038
|
-
/**
|
|
1039
|
-
* The available actions you can take on this Airline-Initiated Change through our API.
|
|
1040
|
-
* 'update' means that you can use the update endpoint for an Airline-Initiated Change.
|
|
1041
|
-
*/
|
|
1042
|
-
available_actions: AvailableActionType[];
|
|
1043
|
-
/**
|
|
1044
|
-
* The ISO 8601 datetime at which the Payment Intent was created
|
|
1045
|
-
*/
|
|
1046
|
-
created_at: string;
|
|
1047
|
-
/**
|
|
1048
|
-
* The ISO 8601 datetime at which the airline-initiated change was last updated
|
|
1049
|
-
*/
|
|
1050
|
-
updated_at: string;
|
|
1051
|
-
}
|
|
1052
|
-
declare type AirlineInitiatedChanges = AirlineInitiatedChange[];
|
|
1053
1068
|
/**
|
|
1054
1069
|
* An object containing metadata about the service, like the designator of the seat.
|
|
1055
1070
|
*/
|
|
@@ -1503,7 +1518,7 @@ interface Order {
|
|
|
1503
1518
|
/**
|
|
1504
1519
|
* The airline-initiated changes for this order.
|
|
1505
1520
|
*/
|
|
1506
|
-
airline_initiated_changes?:
|
|
1521
|
+
airline_initiated_changes?: AirlineInitiatedChange[];
|
|
1507
1522
|
}
|
|
1508
1523
|
interface CreateOrder {
|
|
1509
1524
|
/**
|
|
@@ -2359,6 +2374,66 @@ declare class PaymentIntents extends Resource {
|
|
|
2359
2374
|
create: (params: CreatePaymentIntent) => Promise<DuffelResponse<PaymentIntent>>;
|
|
2360
2375
|
}
|
|
2361
2376
|
|
|
2377
|
+
/**
|
|
2378
|
+
* Sometimes there can be changes to your order initiated by the airline, for
|
|
2379
|
+
* example a flight being delayed. We record every one of these changes so that
|
|
2380
|
+
* you can view them all or for an order. You can filter changes for a specific
|
|
2381
|
+
* order using the `order_id` parameter.
|
|
2382
|
+
*
|
|
2383
|
+
* Each airline-initiated change contains an `added` and `removed` field. `added`
|
|
2384
|
+
* contains the updated slices following the change. These slices and their
|
|
2385
|
+
* segments may have a new ID based on the change. `removed` contains a list of
|
|
2386
|
+
* slices and their segments as they were before the change.
|
|
2387
|
+
*/
|
|
2388
|
+
declare class AirlineInitiatedChanges extends Resource {
|
|
2389
|
+
/**
|
|
2390
|
+
* Endpoint path
|
|
2391
|
+
*/
|
|
2392
|
+
path: string;
|
|
2393
|
+
constructor(client: Client);
|
|
2394
|
+
/**
|
|
2395
|
+
* This endpoint is only available to those airline-initiated changes that
|
|
2396
|
+
* Duffel cannot accept on behalf of the customer. Duffel is unable to accept
|
|
2397
|
+
* an airline-initiated change when these two conditions are true: the order
|
|
2398
|
+
* was booked with the merchant's IATA number and Duffel is unable to accept
|
|
2399
|
+
* the airline-initiated change programatically. In this case you, the
|
|
2400
|
+
* customer, are responsible to resolve airline-initiated changes concerning
|
|
2401
|
+
* this order (e.g. by contacting the airline directly). Once these have been
|
|
2402
|
+
* resolved, you need to inform us of the action taken so we can mark it
|
|
2403
|
+
* accordingly in our system.
|
|
2404
|
+
*
|
|
2405
|
+
* @param {AirlineInitiatedChange['id']} id - Duffel's unique identifier for
|
|
2406
|
+
* the airline-initiated change
|
|
2407
|
+
*
|
|
2408
|
+
* @param action_taken - The action taken in response to this
|
|
2409
|
+
* airline-initiated change. Accepted, cancelled and changed reflect your
|
|
2410
|
+
* action in accepting the change, cancelling the order or changing the order
|
|
2411
|
+
* respectively.
|
|
2412
|
+
*
|
|
2413
|
+
* @link https://duffel.com/docs/api/v1/airline-initiated-changes/update-airline-initiated-changes
|
|
2414
|
+
*/
|
|
2415
|
+
update: (id: AirlineInitiatedChange['id'], action_taken: AirlineInitiatedChangeAvailableAction) => Promise<DuffelResponse<AirlineInitiatedChange>>;
|
|
2416
|
+
/**
|
|
2417
|
+
* Once there is an airline-initiated change you can choose to accept it.
|
|
2418
|
+
*
|
|
2419
|
+
* @param {AirlineInitiatedChange['id']} id - Duffel's unique identifier for
|
|
2420
|
+
* the airline-initiated change
|
|
2421
|
+
*
|
|
2422
|
+
* @link https://duffel.com/docs/api/v1/airline-initiated-changes/accept-airline-initiated-changes
|
|
2423
|
+
*/
|
|
2424
|
+
accept: (id: AirlineInitiatedChange['id']) => Promise<DuffelResponse<AirlineInitiatedChange>>;
|
|
2425
|
+
/**
|
|
2426
|
+
* Retrieves a list of all airline-initiated changes.
|
|
2427
|
+
*
|
|
2428
|
+
* @param order_id - Filters airline-initiated changes by their order ID.
|
|
2429
|
+
* Value must be a valid order ID. Check the [Order schema](https://duffel.com/docs/api/orders/schema#orders-schema-id)
|
|
2430
|
+
* for details.
|
|
2431
|
+
*
|
|
2432
|
+
* @link https://duffel.com/docs/api/v1/airline-initiated-changes/get-airline-initiated-changes
|
|
2433
|
+
*/
|
|
2434
|
+
list: (order_id: Order['id']) => Promise<DuffelResponse<Order['airline_initiated_changes']>>;
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2362
2437
|
/**
|
|
2363
2438
|
* To search for flights, you'll need to create an `offer request`.
|
|
2364
2439
|
* An offer request describes the passengers and where and when they want to travel (in the form of a list of `slices`).
|
|
@@ -2982,6 +3057,7 @@ interface DuffelAPIClient {
|
|
|
2982
3057
|
declare class Duffel {
|
|
2983
3058
|
private client;
|
|
2984
3059
|
aircraft: Aircraft;
|
|
3060
|
+
airlineInitiatedChanges: AirlineInitiatedChanges;
|
|
2985
3061
|
airlines: Airlines;
|
|
2986
3062
|
airports: Airports;
|
|
2987
3063
|
links: Sessions;
|
|
@@ -3002,4 +3078,4 @@ declare class Duffel {
|
|
|
3002
3078
|
}
|
|
3003
3079
|
declare const DuffelError: typeof DuffelError$1;
|
|
3004
3080
|
|
|
3005
|
-
export {
|
|
3081
|
+
export { AddServices, Aircraft$1 as Aircraft, Airline, AirlineInitiatedChange, AirlineInitiatedChangeActionTaken, AirlineInitiatedChangeAvailableAction, Airport, ApiResponseError, ApiResponseMeta, BaggageType, CabinClass, City, ConfirmOrderChangePayment, CreateOfferRequest, CreateOfferRequestQueryParameters, CreateOrder, CreateOrderCancellation, CreateOrderChangeParameters, CreateOrderChangeRequest, CreateOrderPassenger, CreatePayment, CreatePaymentIntent, Duffel, DuffelAPIClient, DuffelError, DuffelPassengerGender, DuffelPassengerTitle, DuffelPassengerType, DuffelResponse, FlightsConditions, ListOffersParams, ListOrderCancellationsParams, ListParamsOrders, LoyaltyProgrammeAccount, LoyaltyProgrammeAccounts, Offer, OfferAvailableService, 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 };
|