-- | Network queries

module Blockfrost.Client.Cardano.Network
  ( getNetworkInfo
  ) where

import Blockfrost.API
import Blockfrost.Client.Types
import Blockfrost.Types


networkClient :: Project -> NetworkAPI (AsClientT BlockfrostClient)
networkClient :: Project -> NetworkAPI (AsClientT BlockfrostClient)
networkClient = ExceptT BlockfrostError (ReaderT ClientConfig IO) Network
-> NetworkAPI (AsClientT BlockfrostClient)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant (ExceptT BlockfrostError (ReaderT ClientConfig IO) Network
 -> NetworkAPI (AsClientT BlockfrostClient))
-> (Project
    -> ExceptT BlockfrostError (ReaderT ClientConfig IO) Network)
-> Project
-> NetworkAPI (AsClientT BlockfrostClient)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CardanoAPI (AsClientT BlockfrostClient)
-> ExceptT BlockfrostError (ReaderT ClientConfig IO) Network
forall route.
CardanoAPI route
-> route
   :- ("network"
       :> (Tag "Cardano \187 Network" :> ToServantApi NetworkAPI))
_network (CardanoAPI (AsClientT BlockfrostClient)
 -> ExceptT BlockfrostError (ReaderT ClientConfig IO) Network)
-> (Project -> CardanoAPI (AsClientT BlockfrostClient))
-> Project
-> ExceptT BlockfrostError (ReaderT ClientConfig IO) Network
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> CardanoAPI (AsClientT BlockfrostClient)
cardanoClient

getNetworkInfo_ :: Project -> BlockfrostClient Network
getNetworkInfo_ :: Project
-> ExceptT BlockfrostError (ReaderT ClientConfig IO) Network
getNetworkInfo_ = NetworkAPI (AsClientT BlockfrostClient)
-> ExceptT BlockfrostError (ReaderT ClientConfig IO) Network
forall route.
NetworkAPI route
-> route
   :- (Summary "Network information"
       :> (Description "Return detailed network information."
           :> Get '[JSON] Network))
_networkInfo (NetworkAPI (AsClientT BlockfrostClient)
 -> ExceptT BlockfrostError (ReaderT ClientConfig IO) Network)
-> (Project -> NetworkAPI (AsClientT BlockfrostClient))
-> Project
-> ExceptT BlockfrostError (ReaderT ClientConfig IO) Network
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> NetworkAPI (AsClientT BlockfrostClient)
networkClient

-- | Get detailed network information.
getNetworkInfo:: BlockfrostClient Network
getNetworkInfo :: ExceptT BlockfrostError (ReaderT ClientConfig IO) Network
getNetworkInfo = (Project
 -> ExceptT BlockfrostError (ReaderT ClientConfig IO) Network)
-> ExceptT BlockfrostError (ReaderT ClientConfig IO) Network
forall a. (Project -> BlockfrostClient a) -> BlockfrostClient a
go Project
-> ExceptT BlockfrostError (ReaderT ClientConfig IO) Network
getNetworkInfo_