{-# OPTIONS_HADDOCK hide #-}
module Blockfrost.API.IPFS
where
import Blockfrost.Types
import Blockfrost.Util.Pagination
import Blockfrost.Util.Sorting
import Blockfrost.Util.Tag (Tag)
import Data.Text (Text)
import Servant.API
import Servant.API.Generic
import Servant.Docs (DocCapture (..), ToCapture (..))
import Servant.Multipart.API
data IPFSAPI route =
IPFSAPI
{
IPFSAPI route
-> route
:- (Summary "Add a file or directory to IPFS"
:> (Description
"You need to `/ipfs/pin/add` an object to avoid it being garbage collected. This usage is being counted in your user account quota."
:> (Tag "IPFS \187 Add"
:> ("add" :> (MultipartForm Tmp Form :> Post '[JSON] IPFSAdd)))))
_add
:: route
:- Summary "Add a file or directory to IPFS"
:> Description "You need to `/ipfs/pin/add` an object to avoid it being garbage collected. \
\This usage is being counted in your user account quota."
:> Tag "IPFS » Add"
:> "add"
:> MultipartForm Tmp Form
:> Post '[JSON] IPFSAdd
, IPFSAPI route
-> route
:- (Summary "Relay to an IPFS gateway"
:> (Description
"Retrieve an object from the IFPS gateway. (Useful if you do not want to rely on a public gateway, such as ``ipfs.blockfrost.dev`)."
:> (Tag "IPFS \187 Gateway"
:> ("gateway"
:> (Capture "IPFS_path" Text
:> Get '[PlainText, OctetStream] IPFSData)))))
_gateway
:: route
:- Summary "Relay to an IPFS gateway"
:> Description "Retrieve an object from the IFPS gateway. \
\(Useful if you do not want to rely on a public gateway, such as ``ipfs.blockfrost.dev`)."
:> Tag "IPFS » Gateway"
:> "gateway"
:> Capture "IPFS_path" Text
:> Get '[PlainText, OctetStream] IPFSData
, IPFSAPI route
-> route
:- (Summary "Pin an object"
:> (Description
"Pinned objects are counted in your user storage quota."
:> (Tag "IPFS \187 Pins"
:> ("pin"
:> ("add"
:> (Capture "IPFS_path" Text :> Post '[JSON] IPFSPinChange))))))
_pin
:: route
:- Summary "Pin an object"
:> Description "Pinned objects are counted in your user storage quota."
:> Tag "IPFS » Pins"
:> "pin"
:> "add"
:> Capture "IPFS_path" Text
:> Post '[JSON] IPFSPinChange
, IPFSAPI route
-> route
:- (Summary "List pinned objects"
:> (Description "List objects pinned to local storage."
:> (Tag "IPFS \187 Pins"
:> ("pin"
:> ("list"
:> (Pagination :> (Sorting :> Get '[JSON] [IPFSPin])))))))
_listPins
:: route
:- Summary "List pinned objects"
:> Description "List objects pinned to local storage."
:> Tag "IPFS » Pins"
:> "pin"
:> "list"
:> Pagination
:> Sorting
:> Get '[JSON] [IPFSPin]
, IPFSAPI route
-> route
:- (Summary "Get pinned object details"
:> (Description "Obtain inormation about specific pinned object."
:> (Tag "IPFS \187 Pins"
:> ("pin"
:> ("list"
:> (Capture "IPFS_path" Text :> Get '[JSON] IPFSPin))))))
_getPin
:: route
:- Summary "Get pinned object details"
:> Description "Obtain inormation about specific pinned object."
:> Tag "IPFS » Pins"
:> "pin"
:> "list"
:> Capture "IPFS_path" Text
:> Get '[JSON] IPFSPin
, IPFSAPI route
-> route
:- (Summary "Remove pinned object from local storage"
:> (Description "Remove pinned object from local storage"
:> (Tag "IPFS \187 Pins"
:> ("pin"
:> ("remove"
:> (Capture "IPFS_path" Text :> Post '[JSON] IPFSPinChange))))))
_removePin
:: route
:- Summary "Remove pinned object from local storage"
:> Description "Remove pinned object from local storage"
:> Tag "IPFS » Pins"
:> "pin"
:> "remove"
:> Capture "IPFS_path" Text
:> Post '[JSON] IPFSPinChange
} deriving ((forall x. IPFSAPI route -> Rep (IPFSAPI route) x)
-> (forall x. Rep (IPFSAPI route) x -> IPFSAPI route)
-> Generic (IPFSAPI route)
forall x. Rep (IPFSAPI route) x -> IPFSAPI route
forall x. IPFSAPI route -> Rep (IPFSAPI route) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall route x. Rep (IPFSAPI route) x -> IPFSAPI route
forall route x. IPFSAPI route -> Rep (IPFSAPI route) x
$cto :: forall route x. Rep (IPFSAPI route) x -> IPFSAPI route
$cfrom :: forall route x. IPFSAPI route -> Rep (IPFSAPI route) x
Generic)
instance ToCapture (Capture "IPFS_path" Text) where
toCapture :: Proxy (Capture "IPFS_path" Text) -> DocCapture
toCapture Proxy (Capture "IPFS_path" Text)
_ = String -> String -> DocCapture
DocCapture String
"IPFS_path" String
"Path to the IPFS object"
data Form = Form {
Form -> Text
formFileName :: Text
, Form -> String
formFilePath :: FilePath
}