module Network.IPFS.Gateway.Types (Gateway (..)) where
import Network.IPFS.Prelude
import Data.Swagger (ToSchema (..))
newtype Gateway = Gateway { Gateway -> Text
getGateway :: Text }
deriving ( Gateway -> Gateway -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Gateway -> Gateway -> Bool
$c/= :: Gateway -> Gateway -> Bool
== :: Gateway -> Gateway -> Bool
$c== :: Gateway -> Gateway -> Bool
Eq
, forall x. Rep Gateway x -> Gateway
forall x. Gateway -> Rep Gateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Gateway x -> Gateway
$cfrom :: forall x. Gateway -> Rep Gateway x
Generic
, Int -> Gateway -> ShowS
[Gateway] -> ShowS
Gateway -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Gateway] -> ShowS
$cshowList :: [Gateway] -> ShowS
show :: Gateway -> String
$cshow :: Gateway -> String
showsPrec :: Int -> Gateway -> ShowS
$cshowsPrec :: Int -> Gateway -> ShowS
Show
)
deriving anyclass ( Proxy Gateway -> Declare (Definitions Schema) NamedSchema
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
declareNamedSchema :: Proxy Gateway -> Declare (Definitions Schema) NamedSchema
$cdeclareNamedSchema :: Proxy Gateway -> Declare (Definitions Schema) NamedSchema
ToSchema )
deriving newtype ( String -> Gateway
forall a. (String -> a) -> IsString a
fromString :: String -> Gateway
$cfromString :: String -> Gateway
IsString )
instance FromJSON Gateway where
parseJSON :: Value -> Parser Gateway
parseJSON = forall a. String -> (Text -> Parser a) -> Value -> Parser a
withText String
"AWS.Gateway" \Text
txt ->
Text -> Gateway
Gateway forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Text -> Value
String Text
txt)