{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.QPXExpress.Types.Product where
import Network.Google.Prelude
import Network.Google.QPXExpress.Types.Sum
data TripOptionsResponse =
TripOptionsResponse'
{ _torRequestId :: !(Maybe Text)
, _torKind :: !Text
, _torData :: !(Maybe Data')
, _torTripOption :: !(Maybe [TripOption])
}
deriving (Eq, Show, Data, Typeable, Generic)
tripOptionsResponse
:: TripOptionsResponse
tripOptionsResponse =
TripOptionsResponse'
{ _torRequestId = Nothing
, _torKind = "qpxexpress#tripOptions"
, _torData = Nothing
, _torTripOption = Nothing
}
torRequestId :: Lens' TripOptionsResponse (Maybe Text)
torRequestId
= lens _torRequestId (\ s a -> s{_torRequestId = a})
torKind :: Lens' TripOptionsResponse Text
torKind = lens _torKind (\ s a -> s{_torKind = a})
torData :: Lens' TripOptionsResponse (Maybe Data')
torData = lens _torData (\ s a -> s{_torData = a})
torTripOption :: Lens' TripOptionsResponse [TripOption]
torTripOption
= lens _torTripOption
(\ s a -> s{_torTripOption = a})
. _Default
. _Coerce
instance FromJSON TripOptionsResponse where
parseJSON
= withObject "TripOptionsResponse"
(\ o ->
TripOptionsResponse' <$>
(o .:? "requestId") <*>
(o .:? "kind" .!= "qpxexpress#tripOptions")
<*> (o .:? "data")
<*> (o .:? "tripOption" .!= mempty))
instance ToJSON TripOptionsResponse where
toJSON TripOptionsResponse'{..}
= object
(catMaybes
[("requestId" .=) <$> _torRequestId,
Just ("kind" .= _torKind), ("data" .=) <$> _torData,
("tripOption" .=) <$> _torTripOption])
data CarrierData =
CarrierData'
{ _cdKind :: !Text
, _cdName :: !(Maybe Text)
, _cdCode :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
carrierData
:: CarrierData
carrierData =
CarrierData'
{_cdKind = "qpxexpress#carrierData", _cdName = Nothing, _cdCode = Nothing}
cdKind :: Lens' CarrierData Text
cdKind = lens _cdKind (\ s a -> s{_cdKind = a})
cdName :: Lens' CarrierData (Maybe Text)
cdName = lens _cdName (\ s a -> s{_cdName = a})
cdCode :: Lens' CarrierData (Maybe Text)
cdCode = lens _cdCode (\ s a -> s{_cdCode = a})
instance FromJSON CarrierData where
parseJSON
= withObject "CarrierData"
(\ o ->
CarrierData' <$>
(o .:? "kind" .!= "qpxexpress#carrierData") <*>
(o .:? "name")
<*> (o .:? "code"))
instance ToJSON CarrierData where
toJSON CarrierData'{..}
= object
(catMaybes
[Just ("kind" .= _cdKind), ("name" .=) <$> _cdName,
("code" .=) <$> _cdCode])
data FreeBaggageAllowance =
FreeBaggageAllowance'
{ _fbaKind :: !Text
, _fbaPounds :: !(Maybe (Textual Int32))
, _fbaBagDescriptor :: !(Maybe [BagDescriptor])
, _fbaKilosPerPiece :: !(Maybe (Textual Int32))
, _fbaKilos :: !(Maybe (Textual Int32))
, _fbaPieces :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
freeBaggageAllowance
:: FreeBaggageAllowance
freeBaggageAllowance =
FreeBaggageAllowance'
{ _fbaKind = "qpxexpress#freeBaggageAllowance"
, _fbaPounds = Nothing
, _fbaBagDescriptor = Nothing
, _fbaKilosPerPiece = Nothing
, _fbaKilos = Nothing
, _fbaPieces = Nothing
}
fbaKind :: Lens' FreeBaggageAllowance Text
fbaKind = lens _fbaKind (\ s a -> s{_fbaKind = a})
fbaPounds :: Lens' FreeBaggageAllowance (Maybe Int32)
fbaPounds
= lens _fbaPounds (\ s a -> s{_fbaPounds = a}) .
mapping _Coerce
fbaBagDescriptor :: Lens' FreeBaggageAllowance [BagDescriptor]
fbaBagDescriptor
= lens _fbaBagDescriptor
(\ s a -> s{_fbaBagDescriptor = a})
. _Default
. _Coerce
fbaKilosPerPiece :: Lens' FreeBaggageAllowance (Maybe Int32)
fbaKilosPerPiece
= lens _fbaKilosPerPiece
(\ s a -> s{_fbaKilosPerPiece = a})
. mapping _Coerce
fbaKilos :: Lens' FreeBaggageAllowance (Maybe Int32)
fbaKilos
= lens _fbaKilos (\ s a -> s{_fbaKilos = a}) .
mapping _Coerce
fbaPieces :: Lens' FreeBaggageAllowance (Maybe Int32)
fbaPieces
= lens _fbaPieces (\ s a -> s{_fbaPieces = a}) .
mapping _Coerce
instance FromJSON FreeBaggageAllowance where
parseJSON
= withObject "FreeBaggageAllowance"
(\ o ->
FreeBaggageAllowance' <$>
(o .:? "kind" .!= "qpxexpress#freeBaggageAllowance")
<*> (o .:? "pounds")
<*> (o .:? "bagDescriptor" .!= mempty)
<*> (o .:? "kilosPerPiece")
<*> (o .:? "kilos")
<*> (o .:? "pieces"))
instance ToJSON FreeBaggageAllowance where
toJSON FreeBaggageAllowance'{..}
= object
(catMaybes
[Just ("kind" .= _fbaKind),
("pounds" .=) <$> _fbaPounds,
("bagDescriptor" .=) <$> _fbaBagDescriptor,
("kilosPerPiece" .=) <$> _fbaKilosPerPiece,
("kilos" .=) <$> _fbaKilos,
("pieces" .=) <$> _fbaPieces])
data TimeOfDayRange =
TimeOfDayRange'
{ _todrKind :: !Text
, _todrLatestTime :: !(Maybe Text)
, _todrEarliestTime :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
timeOfDayRange
:: TimeOfDayRange
timeOfDayRange =
TimeOfDayRange'
{ _todrKind = "qpxexpress#timeOfDayRange"
, _todrLatestTime = Nothing
, _todrEarliestTime = Nothing
}
todrKind :: Lens' TimeOfDayRange Text
todrKind = lens _todrKind (\ s a -> s{_todrKind = a})
todrLatestTime :: Lens' TimeOfDayRange (Maybe Text)
todrLatestTime
= lens _todrLatestTime
(\ s a -> s{_todrLatestTime = a})
todrEarliestTime :: Lens' TimeOfDayRange (Maybe Text)
todrEarliestTime
= lens _todrEarliestTime
(\ s a -> s{_todrEarliestTime = a})
instance FromJSON TimeOfDayRange where
parseJSON
= withObject "TimeOfDayRange"
(\ o ->
TimeOfDayRange' <$>
(o .:? "kind" .!= "qpxexpress#timeOfDayRange") <*>
(o .:? "latestTime")
<*> (o .:? "earliestTime"))
instance ToJSON TimeOfDayRange where
toJSON TimeOfDayRange'{..}
= object
(catMaybes
[Just ("kind" .= _todrKind),
("latestTime" .=) <$> _todrLatestTime,
("earliestTime" .=) <$> _todrEarliestTime])
data Data' =
Data''
{ _dCarrier :: !(Maybe [CarrierData])
, _dKind :: !Text
, _dAircraft :: !(Maybe [AircraftData])
, _dAirport :: !(Maybe [AirportData])
, _dCity :: !(Maybe [CityData])
, _dTax :: !(Maybe [TaxData])
}
deriving (Eq, Show, Data, Typeable, Generic)
data'
:: Data'
data' =
Data''
{ _dCarrier = Nothing
, _dKind = "qpxexpress#data"
, _dAircraft = Nothing
, _dAirport = Nothing
, _dCity = Nothing
, _dTax = Nothing
}
dCarrier :: Lens' Data' [CarrierData]
dCarrier
= lens _dCarrier (\ s a -> s{_dCarrier = a}) .
_Default
. _Coerce
dKind :: Lens' Data' Text
dKind = lens _dKind (\ s a -> s{_dKind = a})
dAircraft :: Lens' Data' [AircraftData]
dAircraft
= lens _dAircraft (\ s a -> s{_dAircraft = a}) .
_Default
. _Coerce
dAirport :: Lens' Data' [AirportData]
dAirport
= lens _dAirport (\ s a -> s{_dAirport = a}) .
_Default
. _Coerce
dCity :: Lens' Data' [CityData]
dCity
= lens _dCity (\ s a -> s{_dCity = a}) . _Default .
_Coerce
dTax :: Lens' Data' [TaxData]
dTax
= lens _dTax (\ s a -> s{_dTax = a}) . _Default .
_Coerce
instance FromJSON Data' where
parseJSON
= withObject "Data"
(\ o ->
Data'' <$>
(o .:? "carrier" .!= mempty) <*>
(o .:? "kind" .!= "qpxexpress#data")
<*> (o .:? "aircraft" .!= mempty)
<*> (o .:? "airport" .!= mempty)
<*> (o .:? "city" .!= mempty)
<*> (o .:? "tax" .!= mempty))
instance ToJSON Data' where
toJSON Data''{..}
= object
(catMaybes
[("carrier" .=) <$> _dCarrier,
Just ("kind" .= _dKind),
("aircraft" .=) <$> _dAircraft,
("airport" .=) <$> _dAirport, ("city" .=) <$> _dCity,
("tax" .=) <$> _dTax])
data AircraftData =
AircraftData'
{ _adKind :: !Text
, _adName :: !(Maybe Text)
, _adCode :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
aircraftData
:: AircraftData
aircraftData =
AircraftData'
{_adKind = "qpxexpress#aircraftData", _adName = Nothing, _adCode = Nothing}
adKind :: Lens' AircraftData Text
adKind = lens _adKind (\ s a -> s{_adKind = a})
adName :: Lens' AircraftData (Maybe Text)
adName = lens _adName (\ s a -> s{_adName = a})
adCode :: Lens' AircraftData (Maybe Text)
adCode = lens _adCode (\ s a -> s{_adCode = a})
instance FromJSON AircraftData where
parseJSON
= withObject "AircraftData"
(\ o ->
AircraftData' <$>
(o .:? "kind" .!= "qpxexpress#aircraftData") <*>
(o .:? "name")
<*> (o .:? "code"))
instance ToJSON AircraftData where
toJSON AircraftData'{..}
= object
(catMaybes
[Just ("kind" .= _adKind), ("name" .=) <$> _adName,
("code" .=) <$> _adCode])
data LegInfo =
LegInfo'
{ _liDestination :: !(Maybe Text)
, _liOrigin :: !(Maybe Text)
, _liSecure :: !(Maybe Bool)
, _liKind :: !Text
, _liAircraft :: !(Maybe Text)
, _liArrivalTime :: !(Maybe Text)
, _liOnTimePerformance :: !(Maybe (Textual Int32))
, _liOperatingDisclosure :: !(Maybe Text)
, _liMeal :: !(Maybe Text)
, _liId :: !(Maybe Text)
, _liOriginTerminal :: !(Maybe Text)
, _liChangePlane :: !(Maybe Bool)
, _liDestinationTerminal :: !(Maybe Text)
, _liConnectionDuration :: !(Maybe (Textual Int32))
, _liDuration :: !(Maybe (Textual Int32))
, _liMileage :: !(Maybe (Textual Int32))
, _liDePartureTime :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
legInfo
:: LegInfo
legInfo =
LegInfo'
{ _liDestination = Nothing
, _liOrigin = Nothing
, _liSecure = Nothing
, _liKind = "qpxexpress#legInfo"
, _liAircraft = Nothing
, _liArrivalTime = Nothing
, _liOnTimePerformance = Nothing
, _liOperatingDisclosure = Nothing
, _liMeal = Nothing
, _liId = Nothing
, _liOriginTerminal = Nothing
, _liChangePlane = Nothing
, _liDestinationTerminal = Nothing
, _liConnectionDuration = Nothing
, _liDuration = Nothing
, _liMileage = Nothing
, _liDePartureTime = Nothing
}
liDestination :: Lens' LegInfo (Maybe Text)
liDestination
= lens _liDestination
(\ s a -> s{_liDestination = a})
liOrigin :: Lens' LegInfo (Maybe Text)
liOrigin = lens _liOrigin (\ s a -> s{_liOrigin = a})
liSecure :: Lens' LegInfo (Maybe Bool)
liSecure = lens _liSecure (\ s a -> s{_liSecure = a})
liKind :: Lens' LegInfo Text
liKind = lens _liKind (\ s a -> s{_liKind = a})
liAircraft :: Lens' LegInfo (Maybe Text)
liAircraft
= lens _liAircraft (\ s a -> s{_liAircraft = a})
liArrivalTime :: Lens' LegInfo (Maybe Text)
liArrivalTime
= lens _liArrivalTime
(\ s a -> s{_liArrivalTime = a})
liOnTimePerformance :: Lens' LegInfo (Maybe Int32)
liOnTimePerformance
= lens _liOnTimePerformance
(\ s a -> s{_liOnTimePerformance = a})
. mapping _Coerce
liOperatingDisclosure :: Lens' LegInfo (Maybe Text)
liOperatingDisclosure
= lens _liOperatingDisclosure
(\ s a -> s{_liOperatingDisclosure = a})
liMeal :: Lens' LegInfo (Maybe Text)
liMeal = lens _liMeal (\ s a -> s{_liMeal = a})
liId :: Lens' LegInfo (Maybe Text)
liId = lens _liId (\ s a -> s{_liId = a})
liOriginTerminal :: Lens' LegInfo (Maybe Text)
liOriginTerminal
= lens _liOriginTerminal
(\ s a -> s{_liOriginTerminal = a})
liChangePlane :: Lens' LegInfo (Maybe Bool)
liChangePlane
= lens _liChangePlane
(\ s a -> s{_liChangePlane = a})
liDestinationTerminal :: Lens' LegInfo (Maybe Text)
liDestinationTerminal
= lens _liDestinationTerminal
(\ s a -> s{_liDestinationTerminal = a})
liConnectionDuration :: Lens' LegInfo (Maybe Int32)
liConnectionDuration
= lens _liConnectionDuration
(\ s a -> s{_liConnectionDuration = a})
. mapping _Coerce
liDuration :: Lens' LegInfo (Maybe Int32)
liDuration
= lens _liDuration (\ s a -> s{_liDuration = a}) .
mapping _Coerce
liMileage :: Lens' LegInfo (Maybe Int32)
liMileage
= lens _liMileage (\ s a -> s{_liMileage = a}) .
mapping _Coerce
liDePartureTime :: Lens' LegInfo (Maybe Text)
liDePartureTime
= lens _liDePartureTime
(\ s a -> s{_liDePartureTime = a})
instance FromJSON LegInfo where
parseJSON
= withObject "LegInfo"
(\ o ->
LegInfo' <$>
(o .:? "destination") <*> (o .:? "origin") <*>
(o .:? "secure")
<*> (o .:? "kind" .!= "qpxexpress#legInfo")
<*> (o .:? "aircraft")
<*> (o .:? "arrivalTime")
<*> (o .:? "onTimePerformance")
<*> (o .:? "operatingDisclosure")
<*> (o .:? "meal")
<*> (o .:? "id")
<*> (o .:? "originTerminal")
<*> (o .:? "changePlane")
<*> (o .:? "destinationTerminal")
<*> (o .:? "connectionDuration")
<*> (o .:? "duration")
<*> (o .:? "mileage")
<*> (o .:? "departureTime"))
instance ToJSON LegInfo where
toJSON LegInfo'{..}
= object
(catMaybes
[("destination" .=) <$> _liDestination,
("origin" .=) <$> _liOrigin,
("secure" .=) <$> _liSecure,
Just ("kind" .= _liKind),
("aircraft" .=) <$> _liAircraft,
("arrivalTime" .=) <$> _liArrivalTime,
("onTimePerformance" .=) <$> _liOnTimePerformance,
("operatingDisclosure" .=) <$>
_liOperatingDisclosure,
("meal" .=) <$> _liMeal, ("id" .=) <$> _liId,
("originTerminal" .=) <$> _liOriginTerminal,
("changePlane" .=) <$> _liChangePlane,
("destinationTerminal" .=) <$>
_liDestinationTerminal,
("connectionDuration" .=) <$> _liConnectionDuration,
("duration" .=) <$> _liDuration,
("mileage" .=) <$> _liMileage,
("departureTime" .=) <$> _liDePartureTime])
data AirportData =
AirportData'
{ _aKind :: !Text
, _aName :: !(Maybe Text)
, _aCity :: !(Maybe Text)
, _aCode :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
airportData
:: AirportData
airportData =
AirportData'
{ _aKind = "qpxexpress#airportData"
, _aName = Nothing
, _aCity = Nothing
, _aCode = Nothing
}
aKind :: Lens' AirportData Text
aKind = lens _aKind (\ s a -> s{_aKind = a})
aName :: Lens' AirportData (Maybe Text)
aName = lens _aName (\ s a -> s{_aName = a})
aCity :: Lens' AirportData (Maybe Text)
aCity = lens _aCity (\ s a -> s{_aCity = a})
aCode :: Lens' AirportData (Maybe Text)
aCode = lens _aCode (\ s a -> s{_aCode = a})
instance FromJSON AirportData where
parseJSON
= withObject "AirportData"
(\ o ->
AirportData' <$>
(o .:? "kind" .!= "qpxexpress#airportData") <*>
(o .:? "name")
<*> (o .:? "city")
<*> (o .:? "code"))
instance ToJSON AirportData where
toJSON AirportData'{..}
= object
(catMaybes
[Just ("kind" .= _aKind), ("name" .=) <$> _aName,
("city" .=) <$> _aCity, ("code" .=) <$> _aCode])
data SegmentPricing =
SegmentPricing'
{ _spFreeBaggageOption :: !(Maybe [FreeBaggageAllowance])
, _spKind :: !Text
, _spFareId :: !(Maybe Text)
, _spSegmentId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
segmentPricing
:: SegmentPricing
segmentPricing =
SegmentPricing'
{ _spFreeBaggageOption = Nothing
, _spKind = "qpxexpress#segmentPricing"
, _spFareId = Nothing
, _spSegmentId = Nothing
}
spFreeBaggageOption :: Lens' SegmentPricing [FreeBaggageAllowance]
spFreeBaggageOption
= lens _spFreeBaggageOption
(\ s a -> s{_spFreeBaggageOption = a})
. _Default
. _Coerce
spKind :: Lens' SegmentPricing Text
spKind = lens _spKind (\ s a -> s{_spKind = a})
spFareId :: Lens' SegmentPricing (Maybe Text)
spFareId = lens _spFareId (\ s a -> s{_spFareId = a})
spSegmentId :: Lens' SegmentPricing (Maybe Text)
spSegmentId
= lens _spSegmentId (\ s a -> s{_spSegmentId = a})
instance FromJSON SegmentPricing where
parseJSON
= withObject "SegmentPricing"
(\ o ->
SegmentPricing' <$>
(o .:? "freeBaggageOption" .!= mempty) <*>
(o .:? "kind" .!= "qpxexpress#segmentPricing")
<*> (o .:? "fareId")
<*> (o .:? "segmentId"))
instance ToJSON SegmentPricing where
toJSON SegmentPricing'{..}
= object
(catMaybes
[("freeBaggageOption" .=) <$> _spFreeBaggageOption,
Just ("kind" .= _spKind),
("fareId" .=) <$> _spFareId,
("segmentId" .=) <$> _spSegmentId])
data SliceInfo =
SliceInfo'
{ _siKind :: !Text
, _siSegment :: !(Maybe [SegmentInfo])
, _siDuration :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
sliceInfo
:: SliceInfo
sliceInfo =
SliceInfo'
{ _siKind = "qpxexpress#sliceInfo"
, _siSegment = Nothing
, _siDuration = Nothing
}
siKind :: Lens' SliceInfo Text
siKind = lens _siKind (\ s a -> s{_siKind = a})
siSegment :: Lens' SliceInfo [SegmentInfo]
siSegment
= lens _siSegment (\ s a -> s{_siSegment = a}) .
_Default
. _Coerce
siDuration :: Lens' SliceInfo (Maybe Int32)
siDuration
= lens _siDuration (\ s a -> s{_siDuration = a}) .
mapping _Coerce
instance FromJSON SliceInfo where
parseJSON
= withObject "SliceInfo"
(\ o ->
SliceInfo' <$>
(o .:? "kind" .!= "qpxexpress#sliceInfo") <*>
(o .:? "segment" .!= mempty)
<*> (o .:? "duration"))
instance ToJSON SliceInfo where
toJSON SliceInfo'{..}
= object
(catMaybes
[Just ("kind" .= _siKind),
("segment" .=) <$> _siSegment,
("duration" .=) <$> _siDuration])
data TripsSearchResponse =
TripsSearchResponse'
{ _tsrTrips :: !(Maybe TripOptionsResponse)
, _tsrKind :: !Text
}
deriving (Eq, Show, Data, Typeable, Generic)
tripsSearchResponse
:: TripsSearchResponse
tripsSearchResponse =
TripsSearchResponse'
{_tsrTrips = Nothing, _tsrKind = "qpxExpress#tripsSearch"}
tsrTrips :: Lens' TripsSearchResponse (Maybe TripOptionsResponse)
tsrTrips = lens _tsrTrips (\ s a -> s{_tsrTrips = a})
tsrKind :: Lens' TripsSearchResponse Text
tsrKind = lens _tsrKind (\ s a -> s{_tsrKind = a})
instance FromJSON TripsSearchResponse where
parseJSON
= withObject "TripsSearchResponse"
(\ o ->
TripsSearchResponse' <$>
(o .:? "trips") <*>
(o .:? "kind" .!= "qpxExpress#tripsSearch"))
instance ToJSON TripsSearchResponse where
toJSON TripsSearchResponse'{..}
= object
(catMaybes
[("trips" .=) <$> _tsrTrips,
Just ("kind" .= _tsrKind)])
data TripOption =
TripOption'
{ _toPricing :: !(Maybe [PricingInfo])
, _toKind :: !Text
, _toId :: !(Maybe Text)
, _toSlice :: !(Maybe [SliceInfo])
, _toSaleTotal :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
tripOption
:: TripOption
tripOption =
TripOption'
{ _toPricing = Nothing
, _toKind = "qpxexpress#tripOption"
, _toId = Nothing
, _toSlice = Nothing
, _toSaleTotal = Nothing
}
toPricing :: Lens' TripOption [PricingInfo]
toPricing
= lens _toPricing (\ s a -> s{_toPricing = a}) .
_Default
. _Coerce
toKind :: Lens' TripOption Text
toKind = lens _toKind (\ s a -> s{_toKind = a})
toId :: Lens' TripOption (Maybe Text)
toId = lens _toId (\ s a -> s{_toId = a})
toSlice :: Lens' TripOption [SliceInfo]
toSlice
= lens _toSlice (\ s a -> s{_toSlice = a}) . _Default
. _Coerce
toSaleTotal :: Lens' TripOption (Maybe Text)
toSaleTotal
= lens _toSaleTotal (\ s a -> s{_toSaleTotal = a})
instance FromJSON TripOption where
parseJSON
= withObject "TripOption"
(\ o ->
TripOption' <$>
(o .:? "pricing" .!= mempty) <*>
(o .:? "kind" .!= "qpxexpress#tripOption")
<*> (o .:? "id")
<*> (o .:? "slice" .!= mempty)
<*> (o .:? "saleTotal"))
instance ToJSON TripOption where
toJSON TripOption'{..}
= object
(catMaybes
[("pricing" .=) <$> _toPricing,
Just ("kind" .= _toKind), ("id" .=) <$> _toId,
("slice" .=) <$> _toSlice,
("saleTotal" .=) <$> _toSaleTotal])
data BagDescriptor =
BagDescriptor'
{ _bdKind :: !Text
, _bdCommercialName :: !(Maybe Text)
, _bdCount :: !(Maybe (Textual Int32))
, _bdDescription :: !(Maybe [Text])
, _bdSubcode :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
bagDescriptor
:: BagDescriptor
bagDescriptor =
BagDescriptor'
{ _bdKind = "qpxexpress#bagDescriptor"
, _bdCommercialName = Nothing
, _bdCount = Nothing
, _bdDescription = Nothing
, _bdSubcode = Nothing
}
bdKind :: Lens' BagDescriptor Text
bdKind = lens _bdKind (\ s a -> s{_bdKind = a})
bdCommercialName :: Lens' BagDescriptor (Maybe Text)
bdCommercialName
= lens _bdCommercialName
(\ s a -> s{_bdCommercialName = a})
bdCount :: Lens' BagDescriptor (Maybe Int32)
bdCount
= lens _bdCount (\ s a -> s{_bdCount = a}) .
mapping _Coerce
bdDescription :: Lens' BagDescriptor [Text]
bdDescription
= lens _bdDescription
(\ s a -> s{_bdDescription = a})
. _Default
. _Coerce
bdSubcode :: Lens' BagDescriptor (Maybe Text)
bdSubcode
= lens _bdSubcode (\ s a -> s{_bdSubcode = a})
instance FromJSON BagDescriptor where
parseJSON
= withObject "BagDescriptor"
(\ o ->
BagDescriptor' <$>
(o .:? "kind" .!= "qpxexpress#bagDescriptor") <*>
(o .:? "commercialName")
<*> (o .:? "count")
<*> (o .:? "description" .!= mempty)
<*> (o .:? "subcode"))
instance ToJSON BagDescriptor where
toJSON BagDescriptor'{..}
= object
(catMaybes
[Just ("kind" .= _bdKind),
("commercialName" .=) <$> _bdCommercialName,
("count" .=) <$> _bdCount,
("description" .=) <$> _bdDescription,
("subcode" .=) <$> _bdSubcode])
data CityData =
CityData'
{ _cCountry :: !(Maybe Text)
, _cKind :: !Text
, _cName :: !(Maybe Text)
, _cCode :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
cityData
:: CityData
cityData =
CityData'
{ _cCountry = Nothing
, _cKind = "qpxexpress#cityData"
, _cName = Nothing
, _cCode = Nothing
}
cCountry :: Lens' CityData (Maybe Text)
cCountry = lens _cCountry (\ s a -> s{_cCountry = a})
cKind :: Lens' CityData Text
cKind = lens _cKind (\ s a -> s{_cKind = a})
cName :: Lens' CityData (Maybe Text)
cName = lens _cName (\ s a -> s{_cName = a})
cCode :: Lens' CityData (Maybe Text)
cCode = lens _cCode (\ s a -> s{_cCode = a})
instance FromJSON CityData where
parseJSON
= withObject "CityData"
(\ o ->
CityData' <$>
(o .:? "country") <*>
(o .:? "kind" .!= "qpxexpress#cityData")
<*> (o .:? "name")
<*> (o .:? "code"))
instance ToJSON CityData where
toJSON CityData'{..}
= object
(catMaybes
[("country" .=) <$> _cCountry,
Just ("kind" .= _cKind), ("name" .=) <$> _cName,
("code" .=) <$> _cCode])
data PassengerCounts =
PassengerCounts'
{ _pcSeniorCount :: !(Maybe (Textual Int32))
, _pcKind :: !Text
, _pcInfantInLapCount :: !(Maybe (Textual Int32))
, _pcChildCount :: !(Maybe (Textual Int32))
, _pcInfantInSeatCount :: !(Maybe (Textual Int32))
, _pcAdultCount :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
passengerCounts
:: PassengerCounts
passengerCounts =
PassengerCounts'
{ _pcSeniorCount = Nothing
, _pcKind = "qpxexpress#passengerCounts"
, _pcInfantInLapCount = Nothing
, _pcChildCount = Nothing
, _pcInfantInSeatCount = Nothing
, _pcAdultCount = Nothing
}
pcSeniorCount :: Lens' PassengerCounts (Maybe Int32)
pcSeniorCount
= lens _pcSeniorCount
(\ s a -> s{_pcSeniorCount = a})
. mapping _Coerce
pcKind :: Lens' PassengerCounts Text
pcKind = lens _pcKind (\ s a -> s{_pcKind = a})
pcInfantInLapCount :: Lens' PassengerCounts (Maybe Int32)
pcInfantInLapCount
= lens _pcInfantInLapCount
(\ s a -> s{_pcInfantInLapCount = a})
. mapping _Coerce
pcChildCount :: Lens' PassengerCounts (Maybe Int32)
pcChildCount
= lens _pcChildCount (\ s a -> s{_pcChildCount = a})
. mapping _Coerce
pcInfantInSeatCount :: Lens' PassengerCounts (Maybe Int32)
pcInfantInSeatCount
= lens _pcInfantInSeatCount
(\ s a -> s{_pcInfantInSeatCount = a})
. mapping _Coerce
pcAdultCount :: Lens' PassengerCounts (Maybe Int32)
pcAdultCount
= lens _pcAdultCount (\ s a -> s{_pcAdultCount = a})
. mapping _Coerce
instance FromJSON PassengerCounts where
parseJSON
= withObject "PassengerCounts"
(\ o ->
PassengerCounts' <$>
(o .:? "seniorCount") <*>
(o .:? "kind" .!= "qpxexpress#passengerCounts")
<*> (o .:? "infantInLapCount")
<*> (o .:? "childCount")
<*> (o .:? "infantInSeatCount")
<*> (o .:? "adultCount"))
instance ToJSON PassengerCounts where
toJSON PassengerCounts'{..}
= object
(catMaybes
[("seniorCount" .=) <$> _pcSeniorCount,
Just ("kind" .= _pcKind),
("infantInLapCount" .=) <$> _pcInfantInLapCount,
("childCount" .=) <$> _pcChildCount,
("infantInSeatCount" .=) <$> _pcInfantInSeatCount,
("adultCount" .=) <$> _pcAdultCount])
data SegmentInfo =
SegmentInfo'
{ _sBookingCode :: !(Maybe Text)
, _sCabin :: !(Maybe Text)
, _sBookingCodeCount :: !(Maybe (Textual Int32))
, _sSubjectToGovernmentApproval :: !(Maybe Bool)
, _sKind :: !Text
, _sFlight :: !(Maybe FlightInfo)
, _sId :: !(Maybe Text)
, _sMarriedSegmentGroup :: !(Maybe Text)
, _sConnectionDuration :: !(Maybe (Textual Int32))
, _sDuration :: !(Maybe (Textual Int32))
, _sLeg :: !(Maybe [LegInfo])
}
deriving (Eq, Show, Data, Typeable, Generic)
segmentInfo
:: SegmentInfo
segmentInfo =
SegmentInfo'
{ _sBookingCode = Nothing
, _sCabin = Nothing
, _sBookingCodeCount = Nothing
, _sSubjectToGovernmentApproval = Nothing
, _sKind = "qpxexpress#segmentInfo"
, _sFlight = Nothing
, _sId = Nothing
, _sMarriedSegmentGroup = Nothing
, _sConnectionDuration = Nothing
, _sDuration = Nothing
, _sLeg = Nothing
}
sBookingCode :: Lens' SegmentInfo (Maybe Text)
sBookingCode
= lens _sBookingCode (\ s a -> s{_sBookingCode = a})
sCabin :: Lens' SegmentInfo (Maybe Text)
sCabin = lens _sCabin (\ s a -> s{_sCabin = a})
sBookingCodeCount :: Lens' SegmentInfo (Maybe Int32)
sBookingCodeCount
= lens _sBookingCodeCount
(\ s a -> s{_sBookingCodeCount = a})
. mapping _Coerce
sSubjectToGovernmentApproval :: Lens' SegmentInfo (Maybe Bool)
sSubjectToGovernmentApproval
= lens _sSubjectToGovernmentApproval
(\ s a -> s{_sSubjectToGovernmentApproval = a})
sKind :: Lens' SegmentInfo Text
sKind = lens _sKind (\ s a -> s{_sKind = a})
sFlight :: Lens' SegmentInfo (Maybe FlightInfo)
sFlight = lens _sFlight (\ s a -> s{_sFlight = a})
sId :: Lens' SegmentInfo (Maybe Text)
sId = lens _sId (\ s a -> s{_sId = a})
sMarriedSegmentGroup :: Lens' SegmentInfo (Maybe Text)
sMarriedSegmentGroup
= lens _sMarriedSegmentGroup
(\ s a -> s{_sMarriedSegmentGroup = a})
sConnectionDuration :: Lens' SegmentInfo (Maybe Int32)
sConnectionDuration
= lens _sConnectionDuration
(\ s a -> s{_sConnectionDuration = a})
. mapping _Coerce
sDuration :: Lens' SegmentInfo (Maybe Int32)
sDuration
= lens _sDuration (\ s a -> s{_sDuration = a}) .
mapping _Coerce
sLeg :: Lens' SegmentInfo [LegInfo]
sLeg
= lens _sLeg (\ s a -> s{_sLeg = a}) . _Default .
_Coerce
instance FromJSON SegmentInfo where
parseJSON
= withObject "SegmentInfo"
(\ o ->
SegmentInfo' <$>
(o .:? "bookingCode") <*> (o .:? "cabin") <*>
(o .:? "bookingCodeCount")
<*> (o .:? "subjectToGovernmentApproval")
<*> (o .:? "kind" .!= "qpxexpress#segmentInfo")
<*> (o .:? "flight")
<*> (o .:? "id")
<*> (o .:? "marriedSegmentGroup")
<*> (o .:? "connectionDuration")
<*> (o .:? "duration")
<*> (o .:? "leg" .!= mempty))
instance ToJSON SegmentInfo where
toJSON SegmentInfo'{..}
= object
(catMaybes
[("bookingCode" .=) <$> _sBookingCode,
("cabin" .=) <$> _sCabin,
("bookingCodeCount" .=) <$> _sBookingCodeCount,
("subjectToGovernmentApproval" .=) <$>
_sSubjectToGovernmentApproval,
Just ("kind" .= _sKind), ("flight" .=) <$> _sFlight,
("id" .=) <$> _sId,
("marriedSegmentGroup" .=) <$> _sMarriedSegmentGroup,
("connectionDuration" .=) <$> _sConnectionDuration,
("duration" .=) <$> _sDuration,
("leg" .=) <$> _sLeg])
data TaxData =
TaxData'
{ _tdKind :: !Text
, _tdName :: !(Maybe Text)
, _tdId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
taxData
:: TaxData
taxData =
TaxData' {_tdKind = "qpxexpress#taxData", _tdName = Nothing, _tdId = Nothing}
tdKind :: Lens' TaxData Text
tdKind = lens _tdKind (\ s a -> s{_tdKind = a})
tdName :: Lens' TaxData (Maybe Text)
tdName = lens _tdName (\ s a -> s{_tdName = a})
tdId :: Lens' TaxData (Maybe Text)
tdId = lens _tdId (\ s a -> s{_tdId = a})
instance FromJSON TaxData where
parseJSON
= withObject "TaxData"
(\ o ->
TaxData' <$>
(o .:? "kind" .!= "qpxexpress#taxData") <*>
(o .:? "name")
<*> (o .:? "id"))
instance ToJSON TaxData where
toJSON TaxData'{..}
= object
(catMaybes
[Just ("kind" .= _tdKind), ("name" .=) <$> _tdName,
("id" .=) <$> _tdId])
newtype TripsSearchRequest =
TripsSearchRequest'
{ _tsrRequest :: Maybe TripOptionsRequest
}
deriving (Eq, Show, Data, Typeable, Generic)
tripsSearchRequest
:: TripsSearchRequest
tripsSearchRequest = TripsSearchRequest' {_tsrRequest = Nothing}
tsrRequest :: Lens' TripsSearchRequest (Maybe TripOptionsRequest)
tsrRequest
= lens _tsrRequest (\ s a -> s{_tsrRequest = a})
instance FromJSON TripsSearchRequest where
parseJSON
= withObject "TripsSearchRequest"
(\ o -> TripsSearchRequest' <$> (o .:? "request"))
instance ToJSON TripsSearchRequest where
toJSON TripsSearchRequest'{..}
= object (catMaybes [("request" .=) <$> _tsrRequest])
data TaxInfo =
TaxInfo'
{ _tiChargeType :: !(Maybe Text)
, _tiCountry :: !(Maybe Text)
, _tiKind :: !Text
, _tiSalePrice :: !(Maybe Text)
, _tiCode :: !(Maybe Text)
, _tiId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
taxInfo
:: TaxInfo
taxInfo =
TaxInfo'
{ _tiChargeType = Nothing
, _tiCountry = Nothing
, _tiKind = "qpxexpress#taxInfo"
, _tiSalePrice = Nothing
, _tiCode = Nothing
, _tiId = Nothing
}
tiChargeType :: Lens' TaxInfo (Maybe Text)
tiChargeType
= lens _tiChargeType (\ s a -> s{_tiChargeType = a})
tiCountry :: Lens' TaxInfo (Maybe Text)
tiCountry
= lens _tiCountry (\ s a -> s{_tiCountry = a})
tiKind :: Lens' TaxInfo Text
tiKind = lens _tiKind (\ s a -> s{_tiKind = a})
tiSalePrice :: Lens' TaxInfo (Maybe Text)
tiSalePrice
= lens _tiSalePrice (\ s a -> s{_tiSalePrice = a})
tiCode :: Lens' TaxInfo (Maybe Text)
tiCode = lens _tiCode (\ s a -> s{_tiCode = a})
tiId :: Lens' TaxInfo (Maybe Text)
tiId = lens _tiId (\ s a -> s{_tiId = a})
instance FromJSON TaxInfo where
parseJSON
= withObject "TaxInfo"
(\ o ->
TaxInfo' <$>
(o .:? "chargeType") <*> (o .:? "country") <*>
(o .:? "kind" .!= "qpxexpress#taxInfo")
<*> (o .:? "salePrice")
<*> (o .:? "code")
<*> (o .:? "id"))
instance ToJSON TaxInfo where
toJSON TaxInfo'{..}
= object
(catMaybes
[("chargeType" .=) <$> _tiChargeType,
("country" .=) <$> _tiCountry,
Just ("kind" .= _tiKind),
("salePrice" .=) <$> _tiSalePrice,
("code" .=) <$> _tiCode, ("id" .=) <$> _tiId])
data PricingInfo =
PricingInfo'
{ _piSaleTaxTotal :: !(Maybe Text)
, _piRefundable :: !(Maybe Bool)
, _piPtc :: !(Maybe Text)
, _piBaseFareTotal :: !(Maybe Text)
, _piFare :: !(Maybe [FareInfo])
, _piKind :: !Text
, _piSegmentPricing :: !(Maybe [SegmentPricing])
, _piPassengers :: !(Maybe PassengerCounts)
, _piFareCalculation :: !(Maybe Text)
, _piLatestTicketingTime :: !(Maybe Text)
, _piTax :: !(Maybe [TaxInfo])
, _piSaleTotal :: !(Maybe Text)
, _piSaleFareTotal :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
pricingInfo
:: PricingInfo
pricingInfo =
PricingInfo'
{ _piSaleTaxTotal = Nothing
, _piRefundable = Nothing
, _piPtc = Nothing
, _piBaseFareTotal = Nothing
, _piFare = Nothing
, _piKind = "qpxexpress#pricingInfo"
, _piSegmentPricing = Nothing
, _piPassengers = Nothing
, _piFareCalculation = Nothing
, _piLatestTicketingTime = Nothing
, _piTax = Nothing
, _piSaleTotal = Nothing
, _piSaleFareTotal = Nothing
}
piSaleTaxTotal :: Lens' PricingInfo (Maybe Text)
piSaleTaxTotal
= lens _piSaleTaxTotal
(\ s a -> s{_piSaleTaxTotal = a})
piRefundable :: Lens' PricingInfo (Maybe Bool)
piRefundable
= lens _piRefundable (\ s a -> s{_piRefundable = a})
piPtc :: Lens' PricingInfo (Maybe Text)
piPtc = lens _piPtc (\ s a -> s{_piPtc = a})
piBaseFareTotal :: Lens' PricingInfo (Maybe Text)
piBaseFareTotal
= lens _piBaseFareTotal
(\ s a -> s{_piBaseFareTotal = a})
piFare :: Lens' PricingInfo [FareInfo]
piFare
= lens _piFare (\ s a -> s{_piFare = a}) . _Default .
_Coerce
piKind :: Lens' PricingInfo Text
piKind = lens _piKind (\ s a -> s{_piKind = a})
piSegmentPricing :: Lens' PricingInfo [SegmentPricing]
piSegmentPricing
= lens _piSegmentPricing
(\ s a -> s{_piSegmentPricing = a})
. _Default
. _Coerce
piPassengers :: Lens' PricingInfo (Maybe PassengerCounts)
piPassengers
= lens _piPassengers (\ s a -> s{_piPassengers = a})
piFareCalculation :: Lens' PricingInfo (Maybe Text)
piFareCalculation
= lens _piFareCalculation
(\ s a -> s{_piFareCalculation = a})
piLatestTicketingTime :: Lens' PricingInfo (Maybe Text)
piLatestTicketingTime
= lens _piLatestTicketingTime
(\ s a -> s{_piLatestTicketingTime = a})
piTax :: Lens' PricingInfo [TaxInfo]
piTax
= lens _piTax (\ s a -> s{_piTax = a}) . _Default .
_Coerce
piSaleTotal :: Lens' PricingInfo (Maybe Text)
piSaleTotal
= lens _piSaleTotal (\ s a -> s{_piSaleTotal = a})
piSaleFareTotal :: Lens' PricingInfo (Maybe Text)
piSaleFareTotal
= lens _piSaleFareTotal
(\ s a -> s{_piSaleFareTotal = a})
instance FromJSON PricingInfo where
parseJSON
= withObject "PricingInfo"
(\ o ->
PricingInfo' <$>
(o .:? "saleTaxTotal") <*> (o .:? "refundable") <*>
(o .:? "ptc")
<*> (o .:? "baseFareTotal")
<*> (o .:? "fare" .!= mempty)
<*> (o .:? "kind" .!= "qpxexpress#pricingInfo")
<*> (o .:? "segmentPricing" .!= mempty)
<*> (o .:? "passengers")
<*> (o .:? "fareCalculation")
<*> (o .:? "latestTicketingTime")
<*> (o .:? "tax" .!= mempty)
<*> (o .:? "saleTotal")
<*> (o .:? "saleFareTotal"))
instance ToJSON PricingInfo where
toJSON PricingInfo'{..}
= object
(catMaybes
[("saleTaxTotal" .=) <$> _piSaleTaxTotal,
("refundable" .=) <$> _piRefundable,
("ptc" .=) <$> _piPtc,
("baseFareTotal" .=) <$> _piBaseFareTotal,
("fare" .=) <$> _piFare, Just ("kind" .= _piKind),
("segmentPricing" .=) <$> _piSegmentPricing,
("passengers" .=) <$> _piPassengers,
("fareCalculation" .=) <$> _piFareCalculation,
("latestTicketingTime" .=) <$>
_piLatestTicketingTime,
("tax" .=) <$> _piTax,
("saleTotal" .=) <$> _piSaleTotal,
("saleFareTotal" .=) <$> _piSaleFareTotal])
data FlightInfo =
FlightInfo'
{ _fiCarrier :: !(Maybe Text)
, _fiNumber :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
flightInfo
:: FlightInfo
flightInfo = FlightInfo' {_fiCarrier = Nothing, _fiNumber = Nothing}
fiCarrier :: Lens' FlightInfo (Maybe Text)
fiCarrier
= lens _fiCarrier (\ s a -> s{_fiCarrier = a})
fiNumber :: Lens' FlightInfo (Maybe Text)
fiNumber = lens _fiNumber (\ s a -> s{_fiNumber = a})
instance FromJSON FlightInfo where
parseJSON
= withObject "FlightInfo"
(\ o ->
FlightInfo' <$>
(o .:? "carrier") <*> (o .:? "number"))
instance ToJSON FlightInfo where
toJSON FlightInfo'{..}
= object
(catMaybes
[("carrier" .=) <$> _fiCarrier,
("number" .=) <$> _fiNumber])
data FareInfo =
FareInfo'
{ _fCarrier :: !(Maybe Text)
, _fDestination :: !(Maybe Text)
, _fOrigin :: !(Maybe Text)
, _fPrivate :: !(Maybe Bool)
, _fKind :: !Text
, _fBasisCode :: !(Maybe Text)
, _fId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
fareInfo
:: FareInfo
fareInfo =
FareInfo'
{ _fCarrier = Nothing
, _fDestination = Nothing
, _fOrigin = Nothing
, _fPrivate = Nothing
, _fKind = "qpxexpress#fareInfo"
, _fBasisCode = Nothing
, _fId = Nothing
}
fCarrier :: Lens' FareInfo (Maybe Text)
fCarrier = lens _fCarrier (\ s a -> s{_fCarrier = a})
fDestination :: Lens' FareInfo (Maybe Text)
fDestination
= lens _fDestination (\ s a -> s{_fDestination = a})
fOrigin :: Lens' FareInfo (Maybe Text)
fOrigin = lens _fOrigin (\ s a -> s{_fOrigin = a})
fPrivate :: Lens' FareInfo (Maybe Bool)
fPrivate = lens _fPrivate (\ s a -> s{_fPrivate = a})
fKind :: Lens' FareInfo Text
fKind = lens _fKind (\ s a -> s{_fKind = a})
fBasisCode :: Lens' FareInfo (Maybe Text)
fBasisCode
= lens _fBasisCode (\ s a -> s{_fBasisCode = a})
fId :: Lens' FareInfo (Maybe Text)
fId = lens _fId (\ s a -> s{_fId = a})
instance FromJSON FareInfo where
parseJSON
= withObject "FareInfo"
(\ o ->
FareInfo' <$>
(o .:? "carrier") <*> (o .:? "destination") <*>
(o .:? "origin")
<*> (o .:? "private")
<*> (o .:? "kind" .!= "qpxexpress#fareInfo")
<*> (o .:? "basisCode")
<*> (o .:? "id"))
instance ToJSON FareInfo where
toJSON FareInfo'{..}
= object
(catMaybes
[("carrier" .=) <$> _fCarrier,
("destination" .=) <$> _fDestination,
("origin" .=) <$> _fOrigin,
("private" .=) <$> _fPrivate,
Just ("kind" .= _fKind),
("basisCode" .=) <$> _fBasisCode,
("id" .=) <$> _fId])
data TripOptionsRequest =
TripOptionsRequest'
{ _torRefundable :: !(Maybe Bool)
, _torSaleCountry :: !(Maybe Text)
, _torPassengers :: !(Maybe PassengerCounts)
, _torTicketingCountry :: !(Maybe Text)
, _torSolutions :: !(Maybe (Textual Int32))
, _torSlice :: !(Maybe [SliceInput])
, _torMaxPrice :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
tripOptionsRequest
:: TripOptionsRequest
tripOptionsRequest =
TripOptionsRequest'
{ _torRefundable = Nothing
, _torSaleCountry = Nothing
, _torPassengers = Nothing
, _torTicketingCountry = Nothing
, _torSolutions = Nothing
, _torSlice = Nothing
, _torMaxPrice = Nothing
}
torRefundable :: Lens' TripOptionsRequest (Maybe Bool)
torRefundable
= lens _torRefundable
(\ s a -> s{_torRefundable = a})
torSaleCountry :: Lens' TripOptionsRequest (Maybe Text)
torSaleCountry
= lens _torSaleCountry
(\ s a -> s{_torSaleCountry = a})
torPassengers :: Lens' TripOptionsRequest (Maybe PassengerCounts)
torPassengers
= lens _torPassengers
(\ s a -> s{_torPassengers = a})
torTicketingCountry :: Lens' TripOptionsRequest (Maybe Text)
torTicketingCountry
= lens _torTicketingCountry
(\ s a -> s{_torTicketingCountry = a})
torSolutions :: Lens' TripOptionsRequest (Maybe Int32)
torSolutions
= lens _torSolutions (\ s a -> s{_torSolutions = a})
. mapping _Coerce
torSlice :: Lens' TripOptionsRequest [SliceInput]
torSlice
= lens _torSlice (\ s a -> s{_torSlice = a}) .
_Default
. _Coerce
torMaxPrice :: Lens' TripOptionsRequest (Maybe Text)
torMaxPrice
= lens _torMaxPrice (\ s a -> s{_torMaxPrice = a})
instance FromJSON TripOptionsRequest where
parseJSON
= withObject "TripOptionsRequest"
(\ o ->
TripOptionsRequest' <$>
(o .:? "refundable") <*> (o .:? "saleCountry") <*>
(o .:? "passengers")
<*> (o .:? "ticketingCountry")
<*> (o .:? "solutions")
<*> (o .:? "slice" .!= mempty)
<*> (o .:? "maxPrice"))
instance ToJSON TripOptionsRequest where
toJSON TripOptionsRequest'{..}
= object
(catMaybes
[("refundable" .=) <$> _torRefundable,
("saleCountry" .=) <$> _torSaleCountry,
("passengers" .=) <$> _torPassengers,
("ticketingCountry" .=) <$> _torTicketingCountry,
("solutions" .=) <$> _torSolutions,
("slice" .=) <$> _torSlice,
("maxPrice" .=) <$> _torMaxPrice])
data SliceInput =
SliceInput'
{ _sliDestination :: !(Maybe Text)
, _sliOrigin :: !(Maybe Text)
, _sliMaxStops :: !(Maybe (Textual Int32))
, _sliKind :: !Text
, _sliProhibitedCarrier :: !(Maybe [Text])
, _sliDate :: !(Maybe Text)
, _sliMaxConnectionDuration :: !(Maybe (Textual Int32))
, _sliPreferredCabin :: !(Maybe Text)
, _sliPermittedDePartureTime :: !(Maybe TimeOfDayRange)
, _sliPermittedCarrier :: !(Maybe [Text])
, _sliAlliance :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
sliceInput
:: SliceInput
sliceInput =
SliceInput'
{ _sliDestination = Nothing
, _sliOrigin = Nothing
, _sliMaxStops = Nothing
, _sliKind = "qpxexpress#sliceInput"
, _sliProhibitedCarrier = Nothing
, _sliDate = Nothing
, _sliMaxConnectionDuration = Nothing
, _sliPreferredCabin = Nothing
, _sliPermittedDePartureTime = Nothing
, _sliPermittedCarrier = Nothing
, _sliAlliance = Nothing
}
sliDestination :: Lens' SliceInput (Maybe Text)
sliDestination
= lens _sliDestination
(\ s a -> s{_sliDestination = a})
sliOrigin :: Lens' SliceInput (Maybe Text)
sliOrigin
= lens _sliOrigin (\ s a -> s{_sliOrigin = a})
sliMaxStops :: Lens' SliceInput (Maybe Int32)
sliMaxStops
= lens _sliMaxStops (\ s a -> s{_sliMaxStops = a}) .
mapping _Coerce
sliKind :: Lens' SliceInput Text
sliKind = lens _sliKind (\ s a -> s{_sliKind = a})
sliProhibitedCarrier :: Lens' SliceInput [Text]
sliProhibitedCarrier
= lens _sliProhibitedCarrier
(\ s a -> s{_sliProhibitedCarrier = a})
. _Default
. _Coerce
sliDate :: Lens' SliceInput (Maybe Text)
sliDate = lens _sliDate (\ s a -> s{_sliDate = a})
sliMaxConnectionDuration :: Lens' SliceInput (Maybe Int32)
sliMaxConnectionDuration
= lens _sliMaxConnectionDuration
(\ s a -> s{_sliMaxConnectionDuration = a})
. mapping _Coerce
sliPreferredCabin :: Lens' SliceInput (Maybe Text)
sliPreferredCabin
= lens _sliPreferredCabin
(\ s a -> s{_sliPreferredCabin = a})
sliPermittedDePartureTime :: Lens' SliceInput (Maybe TimeOfDayRange)
sliPermittedDePartureTime
= lens _sliPermittedDePartureTime
(\ s a -> s{_sliPermittedDePartureTime = a})
sliPermittedCarrier :: Lens' SliceInput [Text]
sliPermittedCarrier
= lens _sliPermittedCarrier
(\ s a -> s{_sliPermittedCarrier = a})
. _Default
. _Coerce
sliAlliance :: Lens' SliceInput (Maybe Text)
sliAlliance
= lens _sliAlliance (\ s a -> s{_sliAlliance = a})
instance FromJSON SliceInput where
parseJSON
= withObject "SliceInput"
(\ o ->
SliceInput' <$>
(o .:? "destination") <*> (o .:? "origin") <*>
(o .:? "maxStops")
<*> (o .:? "kind" .!= "qpxexpress#sliceInput")
<*> (o .:? "prohibitedCarrier" .!= mempty)
<*> (o .:? "date")
<*> (o .:? "maxConnectionDuration")
<*> (o .:? "preferredCabin")
<*> (o .:? "permittedDepartureTime")
<*> (o .:? "permittedCarrier" .!= mempty)
<*> (o .:? "alliance"))
instance ToJSON SliceInput where
toJSON SliceInput'{..}
= object
(catMaybes
[("destination" .=) <$> _sliDestination,
("origin" .=) <$> _sliOrigin,
("maxStops" .=) <$> _sliMaxStops,
Just ("kind" .= _sliKind),
("prohibitedCarrier" .=) <$> _sliProhibitedCarrier,
("date" .=) <$> _sliDate,
("maxConnectionDuration" .=) <$>
_sliMaxConnectionDuration,
("preferredCabin" .=) <$> _sliPreferredCabin,
("permittedDepartureTime" .=) <$>
_sliPermittedDePartureTime,
("permittedCarrier" .=) <$> _sliPermittedCarrier,
("alliance" .=) <$> _sliAlliance])