module TD.Query.GetCurrentWeather
(GetCurrentWeather(..)
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.Location as Location
data GetCurrentWeather
= GetCurrentWeather
{ GetCurrentWeather -> Maybe Location
location :: Maybe Location.Location
}
deriving (GetCurrentWeather -> GetCurrentWeather -> Bool
(GetCurrentWeather -> GetCurrentWeather -> Bool)
-> (GetCurrentWeather -> GetCurrentWeather -> Bool)
-> Eq GetCurrentWeather
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetCurrentWeather -> GetCurrentWeather -> Bool
== :: GetCurrentWeather -> GetCurrentWeather -> Bool
$c/= :: GetCurrentWeather -> GetCurrentWeather -> Bool
/= :: GetCurrentWeather -> GetCurrentWeather -> Bool
Eq, Int -> GetCurrentWeather -> ShowS
[GetCurrentWeather] -> ShowS
GetCurrentWeather -> String
(Int -> GetCurrentWeather -> ShowS)
-> (GetCurrentWeather -> String)
-> ([GetCurrentWeather] -> ShowS)
-> Show GetCurrentWeather
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetCurrentWeather -> ShowS
showsPrec :: Int -> GetCurrentWeather -> ShowS
$cshow :: GetCurrentWeather -> String
show :: GetCurrentWeather -> String
$cshowList :: [GetCurrentWeather] -> ShowS
showList :: [GetCurrentWeather] -> ShowS
Show)
instance I.ShortShow GetCurrentWeather where
shortShow :: GetCurrentWeather -> String
shortShow
GetCurrentWeather
{ location :: GetCurrentWeather -> Maybe Location
location = Maybe Location
location_
}
= String
"GetCurrentWeather"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"location" String -> Maybe Location -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Location
location_
]
instance AT.ToJSON GetCurrentWeather where
toJSON :: GetCurrentWeather -> Value
toJSON
GetCurrentWeather
{ location :: GetCurrentWeather -> Maybe Location
location = Maybe Location
location_
}
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"getCurrentWeather"
, Key
"location" Key -> Maybe Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Location
location_
]