-- |
-- Module      :  Network.Ipfs.Api.Pin
-- Copyright   :  Aleksandr Krupenkin 2016-2021
-- License     :  Apache-2.0
--
-- Maintainer  :  mail@akru.me
-- Stability   :  experimental
-- Portability :  unknown
--
-- Api calls with `pin` prefix.
--

module Network.Ipfs.Api.Pin where

import           Control.Monad.IO.Class         (MonadIO)
import           Data.Text                      (Text)

import           Network.Ipfs.Api.Internal      (_pinAdd, _pinRemove)
import           Network.Ipfs.Api.Internal.Call (call)
import           Network.Ipfs.Api.Types         (PinObj)
import           Network.Ipfs.Client            (IpfsT)

-- | Pin objects to local storage.
add :: MonadIO m => Text -> IpfsT m PinObj
add :: Text -> IpfsT m PinObj
add = ClientM PinObj -> IpfsT m PinObj
forall (m :: * -> *) a. MonadIO m => ClientM a -> IpfsT m a
call (ClientM PinObj -> IpfsT m PinObj)
-> (Text -> ClientM PinObj) -> Text -> IpfsT m PinObj
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ClientM PinObj
_pinAdd

-- | Remove pinned objects from local storage.
remove :: MonadIO m => Text -> IpfsT m PinObj
remove :: Text -> IpfsT m PinObj
remove = ClientM PinObj -> IpfsT m PinObj
forall (m :: * -> *) a. MonadIO m => ClientM a -> IpfsT m a
call (ClientM PinObj -> IpfsT m PinObj)
-> (Text -> ClientM PinObj) -> Text -> IpfsT m PinObj
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ClientM PinObj
_pinRemove