Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing types #968

Merged
merged 13 commits into from
Oct 10, 2024
12 changes: 7 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ module.exports = {
' ',
'^[-\\w]+/[-\\w\\.]+$',
'^[a-z]{3,4}_[a-zA-Z0-9]{21,23}$',
'pas_00009hj8USM7Ncg31cBCLL',
'ord_00009hthhsUZ8W4LxQgkjo',
'ser_00009UhD4ongolulWd9123',
'seg_00009hj8USM7Ncg31cB456',
'pit_00009htYpSCXrwaB9DnUm2',
'pas_[a-zA-Z0-9]{22}',
'ord_[a-zA-Z0-9]{22}',
'ser_[a-zA-Z0-9]{22}',
'seg_[a-zA-Z0-9]{22}',
'sto_[a-zA-Z0-9]{22}',
'pit_[a-zA-Z0-9]{22}',
'quo_[a-zA-Z0-9]{22}',
'g2wAAAACbQAAABBBZXJvbWlzdC1LaGFya2l2bQAAAB=',
'Earhart',
'Embraer',
Expand Down
4 changes: 4 additions & 0 deletions src/Places/Suggestions/mockSuggestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const mockPlacesSuggestionsResponse: Places = {
id: 'cit_lon_gb',
iata_country_code: 'GB',
iata_code: 'LON',
type: 'city',
},
airports: [
{
Expand All @@ -30,11 +31,14 @@ export const mockPlacesSuggestionsResponse: Places = {
iata_country_code: 'GB',
iata_code: 'LHR',
city_name: 'London',
type: 'airport',
iata_city_code: 'LON',
city: {
name: 'London',
id: 'cit_lon_gb',
iata_country_code: 'GB',
iata_code: 'LON',
type: 'city',
},
},
],
Expand Down
1 change: 1 addition & 0 deletions src/Stays/StaysTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface StaysBed {
}

export interface StaysRating {
// eslint-disable-next-line spellcheck/spell-checker
/**
* The source of this rating. Possible values: `"aaa"` (American Automobile Association Diamond Rating), `"northstar"` (Northstar Crown Rating), `"priceline"` (Priceline star rating)
*/
Expand Down
5 changes: 3 additions & 2 deletions src/Stays/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export const MOCK_BOOKING: StaysBooking = {
email: '[email protected]',
phone_number: '+4407242242424',
status: 'confirmed',
// eslint-disable-next-line spellcheck/spell-checker
reference: 'dhg-4692ARxBI85qTkbDDEZMO8',
id: 'bok_0000ARxBI85qTkbDDEZMO3',
confirmed_at: '2022-12-20T15:45:03.000000Z',
Expand All @@ -173,7 +174,7 @@ export const MOCK_BOOKING: StaysBooking = {
cancelled_at: null,
guests: [
{
given_name: 'Raiden',
given_name: 'John',
family_name: 'Ei',
},
],
Expand All @@ -194,7 +195,7 @@ export const MOCK_CREATE_BOOKING_PAYLOAD: StaysBookingPayload = {
guests: [
{
given_name: 'Jean',
family_name: 'Gunnhildr',
family_name: 'Gun',
},
],
email: '[email protected]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ export type AirlineInitiatedChangeAvailableAction =
| 'change'
| 'update'

/**
* The associated Travel Agent Ticket, if any, for this Airline-Initiated Change.
* This value will be present for Airline-Initiated changes that take some time to be processed.
*/
export interface TravelAgentTicket {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

andrejak marked this conversation as resolved.
Show resolved Hide resolved
id: string
external_ticket_id: string
}

type EmptyObject = Record<string, unknown>

export interface AirlineInitiatedChange {
/**
* The action taken in response to this airline-initiated change. Accepted,
Expand Down Expand Up @@ -66,7 +77,7 @@ export interface AirlineInitiatedChange {
* Change. This value will be present for Airline-Initiated changes that take
* some time to be processed.
*/
travel_agent_ticket: any | null
travel_agent_ticket: TravelAgentTicket | EmptyObject | null
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "EmptyObject" is copied from dashboard...


/**
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime at which
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
penalty_amount: '100.00',
allowed: true,
},
refund_before_departure: null,
},
destination_type: 'airport',
origin_type: 'airport',
Expand All @@ -23,6 +24,9 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
baggages: [],
},
],
origin_terminal: 'A',
destination_terminal: '1',
stops: [],
origin: {
time_zone: 'Europe/London',
name: 'Heathrow Airport',
Expand All @@ -34,11 +38,13 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
iata_code: 'LHR',
iata_city_code: 'LON',
city_name: 'London',
type: 'airport',
city: {
name: 'London',
id: 'cit_lon_gb',
iata_country_code: 'GB',
iata_code: 'LON',
type: 'city',
},
},
operating_carrier_flight_number: '0472',
Expand Down Expand Up @@ -67,7 +73,7 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
},
id: 'seg_00009htYpSCXrwaB9Dn456',
duration: 'PT2H10M',
distance: null,
distance: '123.1',
destination: {
time_zone: 'Europe/Madrid',
name: 'Barcelona–El Prat Josep Tarradellas Airport',
Expand All @@ -80,6 +86,7 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
iata_city_code: 'BCN',
city_name: 'Barcelona',
city: null,
type: 'airport',
},
departing_at: '2023-03-26T06:15:00',
arriving_at: '2023-03-26T09:25:00',
Expand All @@ -101,11 +108,13 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
iata_code: 'LHR',
iata_city_code: 'LON',
city_name: 'London',
type: 'airport',
city: {
name: 'London',
id: 'cit_lon_gb',
iata_country_code: 'GB',
iata_code: 'LON',
type: 'city',
},
},
id: 'sli_00009htYpSCXrwaB9Dn123',
Expand All @@ -122,6 +131,7 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
iata_city_code: 'BCN',
city_name: 'Barcelona',
city: null,
type: 'airport',
},
},
],
Expand All @@ -137,6 +147,7 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
penalty_amount: '100.00',
allowed: true,
},
refund_before_departure: null,
},
destination_type: 'airport',
origin_type: 'airport',
Expand All @@ -149,6 +160,9 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
baggages: [],
},
],
destination_terminal: '1',
origin_terminal: 'B',
stops: [],
origin: {
time_zone: 'Europe/London',
name: 'Heathrow Airport',
Expand All @@ -160,11 +174,13 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
iata_code: 'LHR',
iata_city_code: 'LON',
city_name: 'London',
type: 'airport',
city: {
name: 'London',
id: 'cit_lon_gb',
iata_country_code: 'GB',
iata_code: 'LON',
type: 'city',
},
},
operating_carrier_flight_number: '0474',
Expand Down Expand Up @@ -193,7 +209,7 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
},
id: 'seg_00009htYpSCXrwaB9Dn457',
duration: 'PT2H15M',
distance: null,
distance: '42.1',
destination: {
time_zone: 'Europe/Madrid',
name: 'Barcelona–El Prat Josep Tarradellas Airport',
Expand All @@ -206,10 +222,12 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
iata_city_code: 'BCN',
city_name: 'Barcelona',
city: null,
type: 'airport',
},
departing_at: '2023-03-28T11:00:00',
arriving_at: '2023-03-28T14:15:00',
aircraft: {
// eslint-disable-next-line spellcheck/spell-checker
name: 'Airbus A320neo',
id: 'arc_00009lcSPZuSbgKG1u4Pkn',
iata_code: '32N',
Expand All @@ -227,11 +245,13 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
iata_code: 'LHR',
iata_city_code: 'LON',
city_name: 'London',
type: 'airport',
city: {
name: 'London',
id: 'cit_lon_gb',
iata_country_code: 'GB',
iata_code: 'LON',
type: 'city',
},
},
id: 'sli_00009htYpSCXrwaB9Dn124',
Expand All @@ -247,6 +267,7 @@ export const mockAirlineInitiatedChange: AirlineInitiatedChange = {
iata_code: 'BCN',
iata_city_code: 'BCN',
city_name: 'Barcelona',
type: 'airport',
city: null,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('component client keys', () => {
).create()

const regex_to_match_jwt = new RegExp(
// eslint-disable-next-line spellcheck/spell-checker
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.[a-zA-Z0-9_-]*.[a-zA-Z0-9_-]*',
)
expect(response.data.component_client_key).toMatch(regex_to_match_jwt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import { type ComponentClientKey } from './types'

export const mockComponentClientKey: ComponentClientKey = {
component_client_key:
// eslint-disable-next-line spellcheck/spell-checker
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiaWN1XzAwMDBBZ1ppdHBPblF0ZDNOUXhqd08iLCJvcmRlcl9pZCI6Im9yZF8wMDAwQUJkWm5nZ1NjdDdCb3JhVTFvIiwiaWF0IjoxNTE2MjM5MDIyfQ.GtJDKrfum7aLlNaXmUj-RtQIbx0-Opwjdid0fiJk6DE',
}
6 changes: 3 additions & 3 deletions src/booking/OfferRequests/OfferRequestsTypes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
Airline,
CabinClass,
DuffelPassengerType,
PassengerType,
Place,
PlaceType,
} from '../../types'
Expand Down Expand Up @@ -75,7 +75,7 @@ export interface CreateOfferRequestAdultPassenger
* specify their `age` instead of a `type`. A passenger can have only a type
* or an age, but not both.
*/
type: Extract<DuffelPassengerType, 'adult'>
type: Extract<PassengerType, 'adult'>
}

export interface CreateOfferRequestNonAdultPassenger
Expand Down Expand Up @@ -157,7 +157,7 @@ export interface OfferRequestPassenger {
/**
* The type of the passenger.
*/
type?: DuffelPassengerType
type?: PassengerType

/**
* The passenger's family name. Only `space`, `-`, `'`, and letters from the `ASCII`, `Latin-1 Supplement` and `Latin
Expand Down
40 changes: 2 additions & 38 deletions src/booking/OfferRequests/mockOfferRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,8 @@ export const mockOfferRequest: OfferRequest = {
id: 'cit_lon_gb',
iata_country_code: 'GB',
iata_code: 'LON',
type: 'city',
},
airports: [
{
time_zone: 'Europe/London',
name: 'Heathrow',
longitude: -141.951519,
latitude: 64.068865,
id: 'arp_lhr_gb',
icao_code: 'EGLL',
iata_country_code: 'GB',
iata_code: 'LHR',
city_name: 'London',
city: {
name: 'London',
id: 'cit_lon_gb',
iata_country_code: 'GB',
iata_code: 'LON',
},
},
],
},
destination_type: 'airport',
destination: {
Expand All @@ -81,26 +63,8 @@ export const mockOfferRequest: OfferRequest = {
id: 'cit_lon_gb',
iata_country_code: 'GB',
iata_code: 'LON',
type: 'city',
},
airports: [
{
time_zone: 'Europe/London',
name: 'Heathrow',
longitude: -141.951519,
latitude: 64.068865,
id: 'arp_lhr_gb',
icao_code: 'EGLL',
iata_country_code: 'GB',
iata_code: 'LHR',
city_name: 'London',
city: {
name: 'London',
id: 'cit_lon_gb',
iata_country_code: 'GB',
iata_code: 'LON',
},
},
],
},
departure_date: '2020-04-24',
},
Expand Down
Loading