-- | Account queries

module Blockfrost.Client.Cardano.Accounts
  ( getAccount
  , getAccountRewards
  , getAccountRewards'
  , getAccountHistory
  , getAccountHistory'
  , getAccountDelegations
  , getAccountDelegations'
  , getAccountRegistrations
  , getAccountRegistrations'
  , getAccountWithdrawals
  , getAccountWithdrawals'
  , getAccountMirs
  , getAccountMirs'
  , getAccountAssociatedAddresses
  , getAccountAssociatedAddresses'
  , getAccountAssociatedAssets
  , getAccountAssociatedAssets'
  ) where

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

accountsClient :: MonadBlockfrost m => Project -> AccountsAPI (AsClientT m)
accountsClient :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> AccountsAPI (AsClientT m)
accountsClient = forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall route.
CardanoAPI route
-> route
   :- ("accounts"
       :> (Tag "Cardano \187 Accounts" :> ToServantApi AccountsAPI))
_accounts forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> CardanoAPI (AsClientT m)
cardanoClient

getAccount_ :: MonadBlockfrost m => Project -> Address -> m AccountInfo
getAccount_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> m AccountInfo
getAccount_ = forall route.
AccountsAPI route
-> route
   :- (Summary "Specific account address"
       :> (Description
             "Obtain information about a specific stake account."
           :> (Capture "stake_address" Address :> Get '[JSON] AccountInfo)))
_account forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> AccountsAPI (AsClientT m)
accountsClient

-- | Obtain information about a specific stake account.
getAccount :: MonadBlockfrost m => Address -> m AccountInfo
getAccount :: forall (m :: * -> *). MonadBlockfrost m => Address -> m AccountInfo
getAccount Address
a = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> m AccountInfo
`getAccount_` Address
a)

getAccountRewards_ :: MonadBlockfrost m => Project -> Address -> Paged -> SortOrder -> m [AccountReward]
getAccountRewards_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountReward]
getAccountRewards_ = forall route.
AccountsAPI route
-> route
   :- (Summary "Specific reward history"
       :> (Description
             "Obtain information about the reward history of a specific account."
           :> (Capture "stake_address" Address
               :> ("rewards"
                   :> (Pagination :> (Sorting :> Get '[JSON] [AccountReward]))))))
_accountRewards forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> AccountsAPI (AsClientT m)
accountsClient

-- | Obtain information about the history of a specific account.
-- Allows custom paging and ordering using 'Paged' and 'SortOrder'.
getAccountRewards' :: MonadBlockfrost m => Address -> Paged -> SortOrder -> m [AccountReward]
getAccountRewards' :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountReward]
getAccountRewards' Address
a Paged
pg SortOrder
s = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountReward]
getAccountRewards_ Project
p Address
a Paged
pg SortOrder
s)

-- | Obtain information about the history of a specific account.
--
-- Queries 100 entries. To query all entries use 'Blockfrost.Client.Core.allPages'
-- with principled variant of this function (suffixed with @'@)
-- that accepts 'Paged' argument.
getAccountRewards :: MonadBlockfrost m => Address -> m [AccountReward]
getAccountRewards :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> m [AccountReward]
getAccountRewards Address
a = forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountReward]
getAccountRewards' Address
a forall a. Default a => a
def forall a. Default a => a
def

getAccountHistory_ :: MonadBlockfrost m => Project -> Address -> Paged -> SortOrder -> m [AccountHistory]
getAccountHistory_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountHistory]
getAccountHistory_ = forall route.
AccountsAPI route
-> route
   :- (Summary "Account history"
       :> (Description
             "Obtain information about the history of a specific account."
           :> (Capture "stake_address" Address
               :> ("history"
                   :> (Pagination :> (Sorting :> Get '[JSON] [AccountHistory]))))))
_accountHistory forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> AccountsAPI (AsClientT m)
accountsClient

-- | Obtain information about the history of a specific account.
-- Allows custom paging and ordering using 'Paged' and 'SortOrder'.
getAccountHistory' :: MonadBlockfrost m => Address -> Paged -> SortOrder -> m [AccountHistory]
getAccountHistory' :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountHistory]
getAccountHistory' Address
a Paged
pg SortOrder
s = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountHistory]
getAccountHistory_ Project
p Address
a Paged
pg SortOrder
s)

-- | Obtain information about the history of a specific account.
--
-- Queries 100 entries. To query all entries use 'Blockfrost.Client.Core.allPages'
-- with principled variant of this function (suffixed with @'@)
-- that accepts 'Paged' argument.
getAccountHistory :: MonadBlockfrost m => Address -> m [AccountHistory]
getAccountHistory :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> m [AccountHistory]
getAccountHistory Address
a = forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountHistory]
getAccountHistory' Address
a forall a. Default a => a
def forall a. Default a => a
def

getAccountDelegations_ :: MonadBlockfrost m => Project -> Address -> Paged -> SortOrder -> m [AccountDelegation]
getAccountDelegations_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountDelegation]
getAccountDelegations_ = forall route.
AccountsAPI route
-> route
   :- (Summary "Account delegation history"
       :> (Description
             "Obtain information about the delegation of a specific account."
           :> (Capture "stake_address" Address
               :> ("delegations"
                   :> (Pagination :> (Sorting :> Get '[JSON] [AccountDelegation]))))))
_accountDelegations forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> AccountsAPI (AsClientT m)
accountsClient

-- | Obtain information about the delegation of a specific account.
-- Allows custom paging and ordering using 'Paged' and 'SortOrder'.
getAccountDelegations' :: MonadBlockfrost m => Address -> Paged -> SortOrder -> m [AccountDelegation]
getAccountDelegations' :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountDelegation]
getAccountDelegations' Address
a Paged
pg SortOrder
s = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountDelegation]
getAccountDelegations_ Project
p Address
a Paged
pg SortOrder
s)

-- | Obtain information about the delegation of a specific account.
--
-- Queries 100 entries. To query all entries use 'Blockfrost.Client.Core.allPages'
-- with principled variant of this function (suffixed with @'@)
-- that accepts 'Paged' argument.
getAccountDelegations :: MonadBlockfrost m => Address -> m [AccountDelegation]
getAccountDelegations :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> m [AccountDelegation]
getAccountDelegations Address
a = forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountDelegation]
getAccountDelegations' Address
a forall a. Default a => a
def forall a. Default a => a
def

getAccountRegistrations_ :: MonadBlockfrost m => Project -> Address -> Paged -> SortOrder -> m [AccountRegistration]
getAccountRegistrations_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountRegistration]
getAccountRegistrations_ = forall route.
AccountsAPI route
-> route
   :- (Summary "Account registration history"
       :> (Description
             "Obtain information about the registrations and deregistrations of a specific account."
           :> (Capture "stake_address" Address
               :> ("registrations"
                   :> (Pagination
                       :> (Sorting :> Get '[JSON] [AccountRegistration]))))))
_accountRegistrations forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> AccountsAPI (AsClientT m)
accountsClient

-- | Obtain information about the registrations and deregistrations of a specific account.
-- Allows custom paging and ordering using 'Paged' and 'SortOrder'.
getAccountRegistrations' :: MonadBlockfrost m => Address -> Paged -> SortOrder -> m [AccountRegistration]
getAccountRegistrations' :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountRegistration]
getAccountRegistrations' Address
a Paged
pg SortOrder
s = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountRegistration]
getAccountRegistrations_ Project
p Address
a Paged
pg SortOrder
s)

-- | Obtain information about the registrations and deregistrations of a specific account.
--
-- Queries 100 entries. To query all entries use 'Blockfrost.Client.Core.allPages'
-- with principled variant of this function (suffixed with @'@)
-- that accepts 'Paged' argument.
getAccountRegistrations :: MonadBlockfrost m => Address -> m [AccountRegistration]
getAccountRegistrations :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> m [AccountRegistration]
getAccountRegistrations Address
a = forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountRegistration]
getAccountRegistrations' Address
a forall a. Default a => a
def forall a. Default a => a
def

getAccountWithdrawals_ :: MonadBlockfrost m => Project -> Address -> Paged -> SortOrder ->  m [AccountWithdrawal]
getAccountWithdrawals_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountWithdrawal]
getAccountWithdrawals_ = forall route.
AccountsAPI route
-> route
   :- (Summary "Account withdrawal history"
       :> (Description
             "Obtain information about the withdrawals of a specific account."
           :> (Capture "stake_address" Address
               :> ("withdrawals"
                   :> (Pagination :> (Sorting :> Get '[JSON] [AccountWithdrawal]))))))
_accountWithdrawals forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> AccountsAPI (AsClientT m)
accountsClient

-- | Obtain information about the withdrawals of a specific account.
-- Allows custom paging and ordering using 'Paged' and 'SortOrder'.
getAccountWithdrawals' :: MonadBlockfrost m => Address -> Paged -> SortOrder -> m [AccountWithdrawal]
getAccountWithdrawals' :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountWithdrawal]
getAccountWithdrawals' Address
a Paged
pg SortOrder
s = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountWithdrawal]
getAccountWithdrawals_ Project
p Address
a Paged
pg SortOrder
s)

-- | Obtain information about the withdrawals of a specific account.
--
-- Queries 100 entries. To query all entries use 'Blockfrost.Client.Core.allPages'
-- with principled variant of this function (suffixed with @'@)
-- that accepts 'Paged' argument.
getAccountWithdrawals :: MonadBlockfrost m => Address -> m [AccountWithdrawal]
getAccountWithdrawals :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> m [AccountWithdrawal]
getAccountWithdrawals Address
a = forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountWithdrawal]
getAccountWithdrawals' Address
a forall a. Default a => a
def forall a. Default a => a
def

getAccountMirs_ :: MonadBlockfrost m => Project -> Address -> Paged -> SortOrder -> m [AccountMir]
getAccountMirs_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountMir]
getAccountMirs_ = forall route.
AccountsAPI route
-> route
   :- (Summary "Account MIR history"
       :> (Description
             "Obtain information about the MIRs of a specific account."
           :> (Capture "stake_address" Address
               :> ("mirs"
                   :> (Pagination :> (Sorting :> Get '[JSON] [AccountMir]))))))
_accountMirs forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> AccountsAPI (AsClientT m)
accountsClient

-- | Obtain information about the MIRs of a specific account.
-- Allows custom paging and ordering using 'Paged' and 'SortOrder'.
getAccountMirs' :: MonadBlockfrost m => Address -> Paged -> SortOrder -> m [AccountMir]
getAccountMirs' :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountMir]
getAccountMirs' Address
a Paged
pg SortOrder
s = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AccountMir]
getAccountMirs_ Project
p Address
a Paged
pg SortOrder
s)

-- | Obtain information about the MIRs of a specific account.
--
-- Queries 100 entries. To query all entries use 'Blockfrost.Client.Core.allPages'
-- with principled variant of this function (suffixed with @'@)
-- that accepts 'Paged' argument.
getAccountMirs :: MonadBlockfrost m => Address -> m [AccountMir]
getAccountMirs :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> m [AccountMir]
getAccountMirs Address
a = forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AccountMir]
getAccountMirs' Address
a forall a. Default a => a
def forall a. Default a => a
def

getAccountAssociatedAddresses_ :: MonadBlockfrost m => Project -> Address -> Paged -> SortOrder -> m [AddressAssociated]
getAccountAssociatedAddresses_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AddressAssociated]
getAccountAssociatedAddresses_ = forall route.
AccountsAPI route
-> route
   :- (Summary "Account associated addresses"
       :> (Description
             "Obtain information about the addresses of a specific account."
           :> (Capture "stake_address" Address
               :> ("addresses"
                   :> (Pagination :> (Sorting :> Get '[JSON] [AddressAssociated]))))))
_accountAssociatedAddresses forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> AccountsAPI (AsClientT m)
accountsClient

-- | Obtain information about the addresses of a specific account.
-- Allows custom paging and ordering using 'Paged' and 'SortOrder'.
getAccountAssociatedAddresses' :: MonadBlockfrost m => Address -> Paged -> SortOrder -> m [AddressAssociated]
getAccountAssociatedAddresses' :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AddressAssociated]
getAccountAssociatedAddresses' Address
a Paged
pg SortOrder
s = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [AddressAssociated]
getAccountAssociatedAddresses_ Project
p Address
a Paged
pg SortOrder
s)

-- | Obtain information about the addresses of a specific account.
--
-- Queries 100 entries. To query all entries use 'Blockfrost.Client.Core.allPages'
-- with principled variant of this function (suffixed with @'@)
-- that accepts 'Paged' argument.
getAccountAssociatedAddresses :: MonadBlockfrost m => Address -> m [AddressAssociated]
getAccountAssociatedAddresses :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> m [AddressAssociated]
getAccountAssociatedAddresses Address
a = forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [AddressAssociated]
getAccountAssociatedAddresses' Address
a forall a. Default a => a
def forall a. Default a => a
def

getAccountAssociatedAssets_ :: MonadBlockfrost m => Project -> Address -> Paged -> SortOrder -> m [Amount]
getAccountAssociatedAssets_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [Amount]
getAccountAssociatedAssets_ = forall route.
AccountsAPI route
-> route
   :- (Summary "Assets associated with the account addresses"
       :> (Description
             "Obtain information about assets associated with addresses of a specific account."
           :> (Capture "stake_address" Address
               :> ("addresses"
                   :> ("assets"
                       :> (Pagination :> (Sorting :> Get '[JSON] [Amount])))))))
_accountAssociatedAssets forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> AccountsAPI (AsClientT m)
accountsClient

-- | Obtain information about assets associated with addresses of a specific account.
-- Allows custom paging and ordering using 'Paged' and 'SortOrder'.
getAccountAssociatedAssets' :: MonadBlockfrost m => Address -> Paged -> SortOrder -> m [Amount]
getAccountAssociatedAssets' :: forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [Amount]
getAccountAssociatedAssets' Address
a Paged
pg SortOrder
s = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Address -> Paged -> SortOrder -> m [Amount]
getAccountAssociatedAssets_ Project
p Address
a Paged
pg SortOrder
s)

-- | Obtain information about assets associated with addresses of a specific account.
--
-- Queries 100 entries. To query all entries use 'Blockfrost.Client.Core.allPages'
-- with principled variant of this function (suffixed with @'@)
-- that accepts 'Paged' argument.
getAccountAssociatedAssets :: MonadBlockfrost m => Address -> m [Amount]
getAccountAssociatedAssets :: forall (m :: * -> *). MonadBlockfrost m => Address -> m [Amount]
getAccountAssociatedAssets Address
a = forall (m :: * -> *).
MonadBlockfrost m =>
Address -> Paged -> SortOrder -> m [Amount]
getAccountAssociatedAssets' Address
a forall a. Default a => a
def forall a. Default a => a
def