|
| 1 | +import { CabinClass, Offer } from '../../types' |
| 2 | + |
| 3 | +import { |
| 4 | + CreateOfferRequestPassenger, |
| 5 | + CreateOfferRequestSlice, |
| 6 | + CreateOfferRequestPrivateFare, |
| 7 | +} from '../OfferRequests/OfferRequestsTypes' |
| 8 | + |
| 9 | +export interface BatchOfferRequest { |
| 10 | + /** |
| 11 | + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which the offer request was created |
| 12 | + */ |
| 13 | + created_at: string |
| 14 | + |
| 15 | + /** |
| 16 | + * Duffel's unique identifier for the offer request |
| 17 | + */ |
| 18 | + id: string |
| 19 | + |
| 20 | + /** |
| 21 | + * Whether the offer request was created in live mode. This field will be set to true if the offer request was created in live mode, or false if it was created in test mode. |
| 22 | + */ |
| 23 | + live_mode: boolean |
| 24 | + |
| 25 | + /** |
| 26 | + * A client key to allow the Duffel Ancillaries component to talk to the Duffel API to retrieve information about an offer and its ancillaries. Learn more about how to use this on https://duffel.com/docs/guides/ancillaries-component. |
| 27 | + */ |
| 28 | + client_key: string |
| 29 | + |
| 30 | + /** |
| 31 | + * The total number of batches of offers. |
| 32 | + */ |
| 33 | + total_batches: number |
| 34 | + |
| 35 | + /** |
| 36 | + * The number of batches of offers that are remaining. This can be used with the total_batches to estimate the amount of work remaining. Once this reaches zero, there are no more batches of offers to process. |
| 37 | + */ |
| 38 | + remaining_batches: number |
| 39 | + |
| 40 | + /** |
| 41 | + * The offers related to this batch offer request. |
| 42 | + */ |
| 43 | + offers: Omit<Offer, 'available_services'>[] |
| 44 | +} |
| 45 | + |
| 46 | +export type CreateBatchOfferRequestResponse = Omit<BatchOfferRequest, 'offers'> |
| 47 | + |
| 48 | +export interface CreateBatchOfferRequest { |
| 49 | + /** |
| 50 | + * The cabin that the passengers want to travel in. |
| 51 | + */ |
| 52 | + cabin_class?: CabinClass |
| 53 | + |
| 54 | + /** |
| 55 | + * The maximum number of connections within any slice of the offer. For |
| 56 | + * example 0 means a direct flight which will have a single segment within |
| 57 | + * each slice and 1 means a maximum of two segments within each slice of the |
| 58 | + * offer. |
| 59 | + */ |
| 60 | + max_connections?: 0 | 1 | 2 |
| 61 | + |
| 62 | + /** |
| 63 | + * The passengers who want to travel. If you specify an `age` for a passenger, |
| 64 | + * the `type` may differ for the same passenger in different offers due to |
| 65 | + * airline's different rules. E.g. one airline may treat a 14 year old as an |
| 66 | + * adult, and another as a young adult. You may only specify an `age` or a |
| 67 | + * `type` – not both. |
| 68 | + */ |
| 69 | + passengers: CreateOfferRequestPassenger[] |
| 70 | + |
| 71 | + /** |
| 72 | + * The private fare codes for this Offer Request. You can pass in multiple |
| 73 | + * airlines with their specific private fare codes. The key is the airline's |
| 74 | + * IATA code that provided the private fare code. The `corporate_code` is |
| 75 | + * provided to you by the airline and the `tracking_reference` is to identify |
| 76 | + * your business by the airlines. |
| 77 | + */ |
| 78 | + private_fares?: { |
| 79 | + [iataCode: string]: CreateOfferRequestPrivateFare[] |
| 80 | + } |
| 81 | + |
| 82 | + /** |
| 83 | + * The [slices](https://duffel.com/docs/api/overview/key-principles) that make |
| 84 | + * up this offer request. One-way journeys can be expressed using one slice, |
| 85 | + * whereas return trips will need two. |
| 86 | + */ |
| 87 | + slices: CreateOfferRequestSlice[] |
| 88 | +} |
| 89 | + |
| 90 | +export interface CreateBatchOfferRequestQueryParameters { |
| 91 | + /** |
| 92 | + * The maximum amount of time in milliseconds to wait for each airline search to complete. |
| 93 | + * This timeout applies to the response time of the call to the airline and includes |
| 94 | + * some additional overhead added by Duffel. Value should be between `2` seconds and `60` seconds. |
| 95 | + * Any values outside the range will be ignored and the default supplier_timeout will be used. |
| 96 | + * If a value is set, the response will only include offers from airline searches that completed |
| 97 | + * within the given time. If a value is not set, the response will only include offers from |
| 98 | + * airline searches that completed within the default supplier_timeout value of 20 seconds. |
| 99 | + * We recommend setting supplier_timeout lower than the timeout on the HTTP request you send to |
| 100 | + * Duffel API as that will allow us to respond with the offers we received before your request |
| 101 | + * times out with an empty response. |
| 102 | + */ |
| 103 | + supplier_timeout?: number |
| 104 | +} |
0 commit comments