module Blockfrost.Types.IPFS
( IPFSAdd (..)
, IPFSPinChange (..)
, IPFSPin (..)
, PinState (..)
, IPFSData (..)
) where
import Blockfrost.Types.Shared
import Data.Aeson
import Data.ByteString.Lazy (ByteString)
import Data.Text (Text)
import Deriving.Aeson
import Servant.API
import Servant.Docs (ToSample (..), singleSample)
data IPFSAdd = IPFSAdd
{ IPFSAdd -> Text
_ipfsAddName :: Text
, IPFSAdd -> Text
_ipfsAddIpfsHash :: Text
, IPFSAdd -> Quantity
_ipfsAddSize :: Quantity
}
deriving stock (Int -> IPFSAdd -> ShowS
[IPFSAdd] -> ShowS
IPFSAdd -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IPFSAdd] -> ShowS
$cshowList :: [IPFSAdd] -> ShowS
show :: IPFSAdd -> String
$cshow :: IPFSAdd -> String
showsPrec :: Int -> IPFSAdd -> ShowS
$cshowsPrec :: Int -> IPFSAdd -> ShowS
Show, IPFSAdd -> IPFSAdd -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IPFSAdd -> IPFSAdd -> Bool
$c/= :: IPFSAdd -> IPFSAdd -> Bool
== :: IPFSAdd -> IPFSAdd -> Bool
$c== :: IPFSAdd -> IPFSAdd -> Bool
Eq, forall x. Rep IPFSAdd x -> IPFSAdd
forall x. IPFSAdd -> Rep IPFSAdd x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IPFSAdd x -> IPFSAdd
$cfrom :: forall x. IPFSAdd -> Rep IPFSAdd x
Generic)
deriving (Maybe IPFSAdd
Value -> Parser [IPFSAdd]
Value -> Parser IPFSAdd
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
omittedField :: Maybe IPFSAdd
$comittedField :: Maybe IPFSAdd
parseJSONList :: Value -> Parser [IPFSAdd]
$cparseJSONList :: Value -> Parser [IPFSAdd]
parseJSON :: Value -> Parser IPFSAdd
$cparseJSON :: Value -> Parser IPFSAdd
FromJSON, [IPFSAdd] -> Encoding
[IPFSAdd] -> Value
IPFSAdd -> Bool
IPFSAdd -> Encoding
IPFSAdd -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
omitField :: IPFSAdd -> Bool
$comitField :: IPFSAdd -> Bool
toEncodingList :: [IPFSAdd] -> Encoding
$ctoEncodingList :: [IPFSAdd] -> Encoding
toJSONList :: [IPFSAdd] -> Value
$ctoJSONList :: [IPFSAdd] -> Value
toEncoding :: IPFSAdd -> Encoding
$ctoEncoding :: IPFSAdd -> Encoding
toJSON :: IPFSAdd -> Value
$ctoJSON :: IPFSAdd -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_ipfsAdd", CamelToSnake]] IPFSAdd
instance ToSample IPFSAdd where
toSamples :: Proxy IPFSAdd -> [(Text, IPFSAdd)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample forall a b. (a -> b) -> a -> b
$
Text -> Text -> Quantity -> IPFSAdd
IPFSAdd
Text
"README.md"
Text
"QmZbHqiCxKEVX7QfijzJTkZiSi3WEVTcvANgNAWzDYgZDr"
Quantity
125297
data PinState = Queued | Pinned | Unpinned | Failed | Gc
deriving (PinState -> PinState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PinState -> PinState -> Bool
$c/= :: PinState -> PinState -> Bool
== :: PinState -> PinState -> Bool
$c== :: PinState -> PinState -> Bool
Eq, Int -> PinState -> ShowS
[PinState] -> ShowS
PinState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PinState] -> ShowS
$cshowList :: [PinState] -> ShowS
show :: PinState -> String
$cshow :: PinState -> String
showsPrec :: Int -> PinState -> ShowS
$cshowsPrec :: Int -> PinState -> ShowS
Show, Eq PinState
PinState -> PinState -> Bool
PinState -> PinState -> Ordering
PinState -> PinState -> PinState
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: PinState -> PinState -> PinState
$cmin :: PinState -> PinState -> PinState
max :: PinState -> PinState -> PinState
$cmax :: PinState -> PinState -> PinState
>= :: PinState -> PinState -> Bool
$c>= :: PinState -> PinState -> Bool
> :: PinState -> PinState -> Bool
$c> :: PinState -> PinState -> Bool
<= :: PinState -> PinState -> Bool
$c<= :: PinState -> PinState -> Bool
< :: PinState -> PinState -> Bool
$c< :: PinState -> PinState -> Bool
compare :: PinState -> PinState -> Ordering
$ccompare :: PinState -> PinState -> Ordering
Ord, forall x. Rep PinState x -> PinState
forall x. PinState -> Rep PinState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PinState x -> PinState
$cfrom :: forall x. PinState -> Rep PinState x
Generic)
deriving (Maybe PinState
Value -> Parser [PinState]
Value -> Parser PinState
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
omittedField :: Maybe PinState
$comittedField :: Maybe PinState
parseJSONList :: Value -> Parser [PinState]
$cparseJSONList :: Value -> Parser [PinState]
parseJSON :: Value -> Parser PinState
$cparseJSON :: Value -> Parser PinState
FromJSON, [PinState] -> Encoding
[PinState] -> Value
PinState -> Bool
PinState -> Encoding
PinState -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
omitField :: PinState -> Bool
$comitField :: PinState -> Bool
toEncodingList :: [PinState] -> Encoding
$ctoEncodingList :: [PinState] -> Encoding
toJSONList :: [PinState] -> Value
$ctoJSONList :: [PinState] -> Value
toEncoding :: PinState -> Encoding
$ctoEncoding :: PinState -> Encoding
toJSON :: PinState -> Value
$ctoJSON :: PinState -> Value
ToJSON)
via CustomJSON '[ConstructorTagModifier '[ToLower]] PinState
data IPFSPinChange = IPFSPinChange
{ IPFSPinChange -> Text
_ipfsPinChangeIpfsHash :: Text
, IPFSPinChange -> PinState
_ipfsPinChangeState :: PinState
}
deriving stock (Int -> IPFSPinChange -> ShowS
[IPFSPinChange] -> ShowS
IPFSPinChange -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IPFSPinChange] -> ShowS
$cshowList :: [IPFSPinChange] -> ShowS
show :: IPFSPinChange -> String
$cshow :: IPFSPinChange -> String
showsPrec :: Int -> IPFSPinChange -> ShowS
$cshowsPrec :: Int -> IPFSPinChange -> ShowS
Show, IPFSPinChange -> IPFSPinChange -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IPFSPinChange -> IPFSPinChange -> Bool
$c/= :: IPFSPinChange -> IPFSPinChange -> Bool
== :: IPFSPinChange -> IPFSPinChange -> Bool
$c== :: IPFSPinChange -> IPFSPinChange -> Bool
Eq, forall x. Rep IPFSPinChange x -> IPFSPinChange
forall x. IPFSPinChange -> Rep IPFSPinChange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IPFSPinChange x -> IPFSPinChange
$cfrom :: forall x. IPFSPinChange -> Rep IPFSPinChange x
Generic)
deriving (Maybe IPFSPinChange
Value -> Parser [IPFSPinChange]
Value -> Parser IPFSPinChange
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
omittedField :: Maybe IPFSPinChange
$comittedField :: Maybe IPFSPinChange
parseJSONList :: Value -> Parser [IPFSPinChange]
$cparseJSONList :: Value -> Parser [IPFSPinChange]
parseJSON :: Value -> Parser IPFSPinChange
$cparseJSON :: Value -> Parser IPFSPinChange
FromJSON, [IPFSPinChange] -> Encoding
[IPFSPinChange] -> Value
IPFSPinChange -> Bool
IPFSPinChange -> Encoding
IPFSPinChange -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
omitField :: IPFSPinChange -> Bool
$comitField :: IPFSPinChange -> Bool
toEncodingList :: [IPFSPinChange] -> Encoding
$ctoEncodingList :: [IPFSPinChange] -> Encoding
toJSONList :: [IPFSPinChange] -> Value
$ctoJSONList :: [IPFSPinChange] -> Value
toEncoding :: IPFSPinChange -> Encoding
$ctoEncoding :: IPFSPinChange -> Encoding
toJSON :: IPFSPinChange -> Value
$ctoJSON :: IPFSPinChange -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_ipfsPinChange", CamelToSnake]] IPFSPinChange
instance ToSample IPFSPinChange where
toSamples :: Proxy IPFSPinChange -> [(Text, IPFSPinChange)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample forall a b. (a -> b) -> a -> b
$
Text -> PinState -> IPFSPinChange
IPFSPinChange
Text
"QmPojRfAXYAXV92Dof7gtSgaVuxEk64xx9CKvprqu9VwA8"
PinState
Queued
data IPFSPin = IPFSPin
{ IPFSPin -> POSIXTime
_ipfsPinTimeCreated :: POSIXTime
, IPFSPin -> POSIXTime
_ipfsPinTimePinned :: POSIXTime
, IPFSPin -> Text
_ipfsPinIpfsHash :: Text
, IPFSPin -> Quantity
_ipfsPinSize :: Quantity
, IPFSPin -> PinState
_ipfsPinState :: PinState
}
deriving stock (Int -> IPFSPin -> ShowS
[IPFSPin] -> ShowS
IPFSPin -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IPFSPin] -> ShowS
$cshowList :: [IPFSPin] -> ShowS
show :: IPFSPin -> String
$cshow :: IPFSPin -> String
showsPrec :: Int -> IPFSPin -> ShowS
$cshowsPrec :: Int -> IPFSPin -> ShowS
Show, IPFSPin -> IPFSPin -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IPFSPin -> IPFSPin -> Bool
$c/= :: IPFSPin -> IPFSPin -> Bool
== :: IPFSPin -> IPFSPin -> Bool
$c== :: IPFSPin -> IPFSPin -> Bool
Eq, forall x. Rep IPFSPin x -> IPFSPin
forall x. IPFSPin -> Rep IPFSPin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IPFSPin x -> IPFSPin
$cfrom :: forall x. IPFSPin -> Rep IPFSPin x
Generic)
deriving (Maybe IPFSPin
Value -> Parser [IPFSPin]
Value -> Parser IPFSPin
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
omittedField :: Maybe IPFSPin
$comittedField :: Maybe IPFSPin
parseJSONList :: Value -> Parser [IPFSPin]
$cparseJSONList :: Value -> Parser [IPFSPin]
parseJSON :: Value -> Parser IPFSPin
$cparseJSON :: Value -> Parser IPFSPin
FromJSON, [IPFSPin] -> Encoding
[IPFSPin] -> Value
IPFSPin -> Bool
IPFSPin -> Encoding
IPFSPin -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
omitField :: IPFSPin -> Bool
$comitField :: IPFSPin -> Bool
toEncodingList :: [IPFSPin] -> Encoding
$ctoEncodingList :: [IPFSPin] -> Encoding
toJSONList :: [IPFSPin] -> Value
$ctoJSONList :: [IPFSPin] -> Value
toEncoding :: IPFSPin -> Encoding
$ctoEncoding :: IPFSPin -> Encoding
toJSON :: IPFSPin -> Value
$ctoJSON :: IPFSPin -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_ipfsPin", CamelToSnake]] IPFSPin
instance ToSample IPFSPin where
toSamples :: Proxy IPFSPin -> [(Text, IPFSPin)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample forall a b. (a -> b) -> a -> b
$
IPFSPin
{ _ipfsPinTimeCreated :: POSIXTime
_ipfsPinTimeCreated = POSIXTime
1615551024
, _ipfsPinTimePinned :: POSIXTime
_ipfsPinTimePinned = POSIXTime
1615551024
, _ipfsPinIpfsHash :: Text
_ipfsPinIpfsHash = Text
"QmdVMnULrY95mth2XkwjxDtMHvzuzmvUPTotKE1tgqKbCx"
, _ipfsPinSize :: Quantity
_ipfsPinSize = Quantity
1615551024
, _ipfsPinState :: PinState
_ipfsPinState = PinState
Pinned
}
newtype IPFSData = IPFSData ByteString
deriving (Int -> IPFSData -> ShowS
[IPFSData] -> ShowS
IPFSData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IPFSData] -> ShowS
$cshowList :: [IPFSData] -> ShowS
show :: IPFSData -> String
$cshow :: IPFSData -> String
showsPrec :: Int -> IPFSData -> ShowS
$cshowsPrec :: Int -> IPFSData -> ShowS
Show, IPFSData -> IPFSData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IPFSData -> IPFSData -> Bool
$c/= :: IPFSData -> IPFSData -> Bool
== :: IPFSData -> IPFSData -> Bool
$c== :: IPFSData -> IPFSData -> Bool
Eq, forall x. Rep IPFSData x -> IPFSData
forall x. IPFSData -> Rep IPFSData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IPFSData x -> IPFSData
$cfrom :: forall x. IPFSData -> Rep IPFSData x
Generic)
instance ToSample IPFSData where
toSamples :: Proxy IPFSData -> [(Text, IPFSData)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample forall a b. (a -> b) -> a -> b
$ ByteString -> IPFSData
IPFSData ByteString
"sample ipfs bytestring"
instance MimeRender OctetStream IPFSData where
mimeRender :: Proxy OctetStream -> IPFSData -> ByteString
mimeRender Proxy OctetStream
_ (IPFSData ByteString
cs) = ByteString
cs
instance MimeUnrender OctetStream IPFSData where
mimeUnrender :: Proxy OctetStream -> ByteString -> Either String IPFSData
mimeUnrender Proxy OctetStream
_ ByteString
lbs = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ByteString -> IPFSData
IPFSData ByteString
lbs
instance MimeRender PlainText IPFSData where
mimeRender :: Proxy PlainText -> IPFSData -> ByteString
mimeRender Proxy PlainText
_ (IPFSData ByteString
cs) = ByteString
cs
instance MimeUnrender PlainText IPFSData where
mimeUnrender :: Proxy PlainText -> ByteString -> Either String IPFSData
mimeUnrender Proxy PlainText
_ ByteString
lbs = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ByteString -> IPFSData
IPFSData ByteString
lbs