-- | Addresses API endpoints

{-# OPTIONS_HADDOCK hide #-}

module Blockfrost.API.Cardano.Addresses
  where

import Servant.API
import Servant.API.Generic

import Blockfrost.Types.Cardano.Addresses
import Blockfrost.Types.Shared
import Blockfrost.Util.Pagination
import Blockfrost.Util.Sorting

data AddressesAPI route =
  AddressesAPI
    {
      AddressesAPI route
-> route
   :- (Summary "Specific address"
       :> (Description "Obtain information about a specific address."
           :> (Capture "address" Address :> Get '[JSON] AddressInfo)))
_addressInfo
        :: route
        :- Summary "Specific address"
        :> Description "Obtain information about a specific address."
        :> Capture "address" Address
        :> Get '[JSON] AddressInfo
    , AddressesAPI route
-> route
   :- (Summary "Address details"
       :> (Description "Obtain details about an address."
           :> (Capture "address" Address
               :> ("total" :> Get '[JSON] AddressDetails))))
_addressDetails
        :: route
        :- Summary "Address details"
        :> Description "Obtain details about an address."
        :> Capture "address" Address
        :> "total"
        :> Get '[JSON] AddressDetails
    , AddressesAPI route
-> route
   :- (Summary "Address UTXOs"
       :> (Description "UTXOs of the address."
           :> (Capture "address" Address
               :> ("utxos"
                   :> (Pagination :> (Sorting :> Get '[JSON] [AddressUtxo]))))))
_addressUtxos
        :: route
        :- Summary "Address UTXOs"
        :> Description "UTXOs of the address."
        :> Capture "address" Address
        :> "utxos"
        :> Pagination
        :> Sorting
        :> Get '[JSON] [AddressUtxo]
    , AddressesAPI route
-> route
   :- (Summary "Address UTXOs of a given asset"
       :> (Description "UTXOs of the address."
           :> (Capture "address" Address
               :> ("utxos"
                   :> (Capture "asset" AssetId
                       :> (Pagination :> (Sorting :> Get '[JSON] [AddressUtxo])))))))
_addressUtxosAsset
        :: route
        :- Summary "Address UTXOs of a given asset"
        :> Description "UTXOs of the address."
        :> Capture "address" Address
        :> "utxos"
        :> Capture "asset" AssetId
        :> Pagination
        :> Sorting
        :> Get '[JSON] [AddressUtxo]
    , AddressesAPI route
-> route
   :- (Summary "Address transactions"
       :> (Description "Transactions on the address."
           :> (Capture "address" Address
               :> ("transactions"
                   :> (Pagination
                       :> (Sorting
                           :> (QueryParam "from" BlockIndex
                               :> (QueryParam "to" BlockIndex
                                   :> Get '[JSON] [AddressTransaction]))))))))
_addressTransactions
        :: route
        :- Summary "Address transactions"
        :> Description "Transactions on the address."
        :> Capture "address" Address
        :> "transactions"
        :> Pagination
        :> Sorting
        :> QueryParam "from" BlockIndex
        :> QueryParam "to" BlockIndex
        :> Get '[JSON] [AddressTransaction]
    } deriving ((forall x. AddressesAPI route -> Rep (AddressesAPI route) x)
-> (forall x. Rep (AddressesAPI route) x -> AddressesAPI route)
-> Generic (AddressesAPI route)
forall x. Rep (AddressesAPI route) x -> AddressesAPI route
forall x. AddressesAPI route -> Rep (AddressesAPI route) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall route x. Rep (AddressesAPI route) x -> AddressesAPI route
forall route x. AddressesAPI route -> Rep (AddressesAPI route) x
$cto :: forall route x. Rep (AddressesAPI route) x -> AddressesAPI route
$cfrom :: forall route x. AddressesAPI route -> Rep (AddressesAPI route) x
Generic)