-- | Nut.link client functions

module Blockfrost.Client.NutLink
  ( nutlinkAddressTickers
  , nutlinkAddressTickers'
  , nutlinkListAddress
  , nutlinkListAddressTickers
  , nutlinkListAddressTickers'
  , nutlinkTickers
  , nutlinkTickers'
  ) where

import Blockfrost.API
import Blockfrost.Client.Types
import Blockfrost.Types
import Data.Text (Text)

nutlinkListAddress_ :: MonadBlockfrost m => Project -> Address-> m NutlinkAddress
nutlinkListAddress_ :: Project -> Address -> m NutlinkAddress
nutlinkListAddress_ = NutLinkAPI (AsClientT m) -> Address -> m NutlinkAddress
forall route.
NutLinkAPI route
-> route
   :- (Summary "List metadata about specific address"
       :> (Description "List metadata about specific address"
           :> (Capture "address" Address :> Get '[JSON] NutlinkAddress)))
_address (NutLinkAPI (AsClientT m) -> Address -> m NutlinkAddress)
-> (Project -> NutLinkAPI (AsClientT m))
-> Project
-> Address
-> m NutlinkAddress
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> NutLinkAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> NutLinkAPI (AsClientT m)
nutLinkClient

-- | List metadata about specific address
nutlinkListAddress :: MonadBlockfrost m => Address -> m NutlinkAddress
nutlinkListAddress :: Address -> m NutlinkAddress
nutlinkListAddress Address
a = (Project -> m NutlinkAddress) -> m NutlinkAddress
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (Project -> Address -> m NutlinkAddress
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> m NutlinkAddress
`nutlinkListAddress_` Address
a)

nutlinkListAddressTickers_ :: MonadBlockfrost m => Project -> Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]
nutlinkListAddressTickers_ :: Project
-> Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]
nutlinkListAddressTickers_ = NutLinkAPI (AsClientT m)
-> Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]
forall route.
NutLinkAPI route
-> route
   :- (Summary "List tickers for a specific metadata oracle"
       :> (Description "List tickers for a specific metadata oracle"
           :> (Capture "address" Address
               :> ("tickers"
                   :> (Pagination
                       :> (Sorting :> Get '[JSON] [NutlinkAddressTicker]))))))
_listAddressTickers (NutLinkAPI (AsClientT m)
 -> Address -> Paged -> SortOrder -> m [NutlinkAddressTicker])
-> (Project -> NutLinkAPI (AsClientT m))
-> Project
-> Address
-> Paged
-> SortOrder
-> m [NutlinkAddressTicker]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> NutLinkAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> NutLinkAPI (AsClientT m)
nutLinkClient

-- | List tickers for a specific metadata oracle
-- Allows custom paging and ordering using @Paged@ and @SortOrder@.
nutlinkListAddressTickers' :: MonadBlockfrost m => Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]
nutlinkListAddressTickers' :: Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]
nutlinkListAddressTickers' Address
a Paged
pg SortOrder
s = (Project -> m [NutlinkAddressTicker]) -> m [NutlinkAddressTicker]
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> Project
-> Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]
forall (m :: * -> *).
MonadBlockfrost m =>
Project
-> Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]
nutlinkListAddressTickers_ Project
p Address
a Paged
pg SortOrder
s)

-- | List tickers for a specific metadata oracle
nutlinkListAddressTickers :: MonadBlockfrost m => Address -> m [NutlinkAddressTicker]
nutlinkListAddressTickers :: Address -> m [NutlinkAddressTicker]
nutlinkListAddressTickers Address
a = Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]
forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]
nutlinkListAddressTickers' Address
a Paged
forall a. Default a => a
def SortOrder
forall a. Default a => a
def

nutlinkAddressTickers_ :: MonadBlockfrost m => Project -> Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker]
nutlinkAddressTickers_ :: Project
-> Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker]
nutlinkAddressTickers_ = NutLinkAPI (AsClientT m)
-> Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker]
forall route.
NutLinkAPI route
-> route
   :- (Summary "List of records of a specific ticker"
       :> (Description "List of records of a specific ticker"
           :> (Capture "address" Address
               :> ("tickers"
                   :> (Capture "ticker" Text
                       :> (Pagination :> (Sorting :> Get '[JSON] [NutlinkTicker])))))))
_addressTickers (NutLinkAPI (AsClientT m)
 -> Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker])
-> (Project -> NutLinkAPI (AsClientT m))
-> Project
-> Address
-> Text
-> Paged
-> SortOrder
-> m [NutlinkTicker]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> NutLinkAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> NutLinkAPI (AsClientT m)
nutLinkClient

-- | List of records of a specific ticker
-- Allows custom paging and ordering using @Paged@ and @SortOrder@.
nutlinkAddressTickers' :: MonadBlockfrost m => Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker]
nutlinkAddressTickers' :: Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker]
nutlinkAddressTickers' Address
a Text
t Paged
pg SortOrder
s = (Project -> m [NutlinkTicker]) -> m [NutlinkTicker]
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> Project
-> Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker]
forall (m :: * -> *).
MonadBlockfrost m =>
Project
-> Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker]
nutlinkAddressTickers_ Project
p Address
a Text
t Paged
pg SortOrder
s)

-- | List of records of a specific ticker
nutlinkAddressTickers :: MonadBlockfrost m => Address -> Text -> m [NutlinkTicker]
nutlinkAddressTickers :: Address -> Text -> m [NutlinkTicker]
nutlinkAddressTickers Address
a Text
t = Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker]
forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker]
nutlinkAddressTickers' Address
a Text
t Paged
forall a. Default a => a
def SortOrder
forall a. Default a => a
def

nutlinkTickers_ :: MonadBlockfrost m => Project -> Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)]
nutlinkTickers_ :: Project
-> Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)]
nutlinkTickers_ = NutLinkAPI (AsClientT m)
-> Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)]
forall route.
NutLinkAPI route
-> route
   :- (Summary "List of records of a specific ticker"
       :> (Description "List of records of a specific ticker"
           :> ("tickers"
               :> (Capture "ticker" Text
                   :> (Pagination
                       :> (Sorting :> Get '[JSON] [(Address, NutlinkTicker)]))))))
_tickers (NutLinkAPI (AsClientT m)
 -> Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)])
-> (Project -> NutLinkAPI (AsClientT m))
-> Project
-> Text
-> Paged
-> SortOrder
-> m [(Address, NutlinkTicker)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> NutLinkAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> NutLinkAPI (AsClientT m)
nutLinkClient

-- | List of records of a specific ticker
-- Allows custom paging and ordering using @Paged@ and @SortOrder@.
nutlinkTickers' :: MonadBlockfrost m => Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)]
nutlinkTickers' :: Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)]
nutlinkTickers' Text
a Paged
pg SortOrder
s = (Project -> m [(Address, NutlinkTicker)])
-> m [(Address, NutlinkTicker)]
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> Project
-> Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)]
forall (m :: * -> *).
MonadBlockfrost m =>
Project
-> Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)]
nutlinkTickers_ Project
p Text
a Paged
pg SortOrder
s)

-- | List of records of a specific ticker
nutlinkTickers :: MonadBlockfrost m => Text -> m [(Address, NutlinkTicker)]
nutlinkTickers :: Text -> m [(Address, NutlinkTicker)]
nutlinkTickers Text
a = Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)]
forall (m :: * -> *).
MonadBlockfrost m =>
Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)]
nutlinkTickers' Text
a Paged
forall a. Default a => a
def SortOrder
forall a. Default a => a
def