content: {-
     Exchange Rates Historical REST API
  
     No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
  
     OpenAPI Version: 3.0.4
     Exchange Rates Historical REST API API version: v1
     Contact: support@apibricks.io
     Generated by OpenAPI Generator (https://openapi-generator.tech)
  -}
  
  {-|
  Module : ExchangeRatesHistoricalREST.API.ExchangeRates
  -}
  
  {-# LANGUAGE FlexibleContexts #-}
  {-# LANGUAGE FlexibleInstances #-}
  {-# LANGUAGE MonoLocalBinds #-}
  {-# LANGUAGE MultiParamTypeClasses #-}
  {-# LANGUAGE OverloadedStrings #-}
  {-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}
  
  module ExchangeRatesHistoricalREST.API.ExchangeRates where
  
  import ExchangeRatesHistoricalREST.Core
  import ExchangeRatesHistoricalREST.MimeTypes
  import ExchangeRatesHistoricalREST.Model as M
  
  import qualified Data.Aeson as A
  import qualified Data.ByteString as B
  import qualified Data.ByteString.Lazy as BL
  import qualified Data.Data as P (Typeable, TypeRep, typeOf, typeRep)
  import qualified Data.Foldable as P
  import qualified Data.Map as Map
  import qualified Data.Maybe as P
  import qualified Data.Proxy as P (Proxy(..))
  import qualified Data.Set as Set
  import qualified Data.String as P
  import qualified Data.Text as T
  import qualified Data.Text.Encoding as T
  import qualified Data.Text.Lazy as TL
  import qualified Data.Text.Lazy.Encoding as TL
  import qualified Data.Time as TI
  import qualified Network.HTTP.Client.MultipartFormData as NH
  import qualified Network.HTTP.Media as ME
  import qualified Network.HTTP.Types as NH
  import qualified Web.FormUrlEncoded as WH
  import qualified Web.HttpApiData as WH
  
  import Data.Text (Text)
  import GHC.Base ((<|>))
  
  import Prelude ((==),(/=),($), (.),(<$>),(<*>),(>>=),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor)
  import qualified Prelude as P
  
  -- * Operations
  
  
  -- ** ExchangeRates
  
  -- *** getSpecificRate
  
  -- | @GET \/v1\/exchangerate\/{asset_id_base}\/{asset_id_quote}@
  -- 
  -- Get specific rate
  -- 
  -- Retrieves the exchange rate for a specific base and quote asset at a given time or the current rate.              :::info If you are using an exchange rate for mission-critical operations, then for best reliability, you should measure the difference between current time and the time returned from the response to ensure that value of the difference between those meets your internal requirements. :::
  -- 
  -- AuthMethod: 'AuthApiKeyAPIKey'
  -- 
  getSpecificRate
    :: Accept accept -- ^ request accept ('MimeType')
    -> AssetIdBase -- ^ "assetIdBase" -  Requested exchange rate base asset identifier (from the Metadata -> Assets)
    -> AssetIdQuote -- ^ "assetIdQuote" -  Requested exchange rate quote asset identifier (from the Metadata -> Assets)
    -> ExchangeRatesHistoricalRESTRequest GetSpecificRate MimeNoContent V1ExchangeRate accept
  getSpecificRate  _ (AssetIdBase assetIdBase) (AssetIdQuote assetIdQuote) =
    _mkRequest "GET" ["/v1/exchangerate/",toPath assetIdBase,"/",toPath assetIdQuote]
      `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyAPIKey)
  
  data GetSpecificRate  
  
  -- | /Optional Param/ "time" - Time at which exchange rate is calculated (optional, if not supplied then current rate is returned)
  instance HasOptionalParam GetSpecificRate Time where
    applyOptionalParam req (Time xs) =
      req `addQuery` toQuery ("time", Just xs)
  -- | @application/json@
  instance Produces GetSpecificRate MimeJSON
  -- | @text/json@
  instance Produces GetSpecificRate MimeTextJson
  -- | @text/plain@
  instance Produces GetSpecificRate MimePlainText
  
  
  -- *** v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet
  
  -- | @GET \/v1\/exchangerate\/{asset_id_base}\/{asset_id_quote}\/history@
  -- 
  -- Timeseries data
  -- 
  -- Get the historical exchange rates between two assets in the form of the timeseries.
  -- 
  -- AuthMethod: 'AuthApiKeyAPIKey'
  -- 
  v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet
    :: Accept accept -- ^ request accept ('MimeType')
    -> AssetIdBase -- ^ "assetIdBase" -  Requested exchange rates base asset identifier (from the Metadata -> Assets)
    -> AssetIdQuote -- ^ "assetIdQuote" -  Requested exchange rates base asset identifier (from the Metadata -> Assets)
    -> ExchangeRatesHistoricalRESTRequest V1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet MimeNoContent [V1ExchangeRatesTimeseriesItem] accept
  v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet  _ (AssetIdBase assetIdBase) (AssetIdQuote assetIdQuote) =
    _mkRequest "GET" ["/v1/exchangerate/",toPath assetIdBase,"/",toPath assetIdQuote,"/history"]
      `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyAPIKey)
  
  data V1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet  
  
  -- | /Optional Param/ "period_id" - Identifier of requested timeseries period (required, e.g. `5SEC` or `1HRS`)
  instance HasOptionalParam V1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet PeriodId where
    applyOptionalParam req (PeriodId xs) =
      req `addQuery` toQuery ("period_id", Just xs)
  
  -- | /Optional Param/ "time_start" - Timeseries starting time in ISO 8601 (required)
  instance HasOptionalParam V1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet TimeStart where
    applyOptionalParam req (TimeStart xs) =
      req `addQuery` toQuery ("time_start", Just xs)
  
  -- | /Optional Param/ "time_end" - Timeseries ending time in ISO 8601 (required)
  instance HasOptionalParam V1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet TimeEnd where
    applyOptionalParam req (TimeEnd xs) =
      req `addQuery` toQuery ("time_end", Just xs)
  
  -- | /Optional Param/ "limit" - Amount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request)
  instance HasOptionalParam V1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet Limit where
    applyOptionalParam req (Limit xs) =
      req `addQuery` toQuery ("limit", Just xs)
  -- | @application/json@
  instance Produces V1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet MimeJSON
  -- | @text/json@
  instance Produces V1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet MimeTextJson
  -- | @text/plain@
  instance Produces V1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet MimePlainText
  
  
  -- *** v1ExchangerateAssetIdBaseGet
  
  -- | @GET \/v1\/exchangerate\/{asset_id_base}@
  -- 
  -- Get all current rates
  -- 
  -- Get the current exchange rate between requested asset and all other assets.              :::info If you are using an exchange rate for mission-critical operations, then for best reliability, you should measure the difference between current time and the time returned from the response to ensure that value of the difference between those meets your internal requirements. :::              :::info You can invert the rates by using Y = 1 / X equation, for example BTC/USD = 1 / (USD/BTC); :::
  -- 
  -- AuthMethod: 'AuthApiKeyAPIKey'
  -- 
  v1ExchangerateAssetIdBaseGet
    :: Accept accept -- ^ request accept ('MimeType')
    -> AssetIdBase -- ^ "assetIdBase" -  Requested exchange rates base asset identifier (from the Metadata -> Assets)
    -> ExchangeRatesHistoricalRESTRequest V1ExchangerateAssetIdBaseGet MimeNoContent V1ExchangeRates accept
  v1ExchangerateAssetIdBaseGet  _ (AssetIdBase assetIdBase) =
    _mkRequest "GET" ["/v1/exchangerate/",toPath assetIdBase]
      `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyAPIKey)
  
  data V1ExchangerateAssetIdBaseGet  
  
  -- | /Optional Param/ "filter_asset_id" - Comma or semicolon delimited asset identifiers used to filter response (optional)
  instance HasOptionalParam V1ExchangerateAssetIdBaseGet FilterAssetId where
    applyOptionalParam req (FilterAssetId xs) =
      req `addQuery` toQuery ("filter_asset_id", Just xs)
  
  -- | /Optional Param/ "invert" - True will invert all the rates (optional, if true then rates will be calculated as `rate = 1 / actual_rate` eg. `USD/BTC` as `BTC/USD`)
  instance HasOptionalParam V1ExchangerateAssetIdBaseGet Invert where
    applyOptionalParam req (Invert xs) =
      req `addQuery` toQuery ("invert", Just xs)
  
  -- | /Optional Param/ "time" - Time for historical rates (optional)
  instance HasOptionalParam V1ExchangerateAssetIdBaseGet Time where
    applyOptionalParam req (Time xs) =
      req `addQuery` toQuery ("time", Just xs)
  -- | @application/json@
  instance Produces V1ExchangerateAssetIdBaseGet MimeJSON
  -- | @text/json@
  instance Produces V1ExchangerateAssetIdBaseGet MimeTextJson
  -- | @text/plain@
  instance Produces V1ExchangerateAssetIdBaseGet MimePlainText
  
  
  -- *** v1ExchangerateHistoryPeriodsGet
  
  -- | @GET \/v1\/exchangerate\/history\/periods@
  -- 
  -- Timeseries periods
  -- 
  -- You can also obtain historical exchange rates of any asset pair, grouped into time periods. Get full list of supported time periods available for requesting exchange rates historical timeseries data.              ## Timeseries periods Time unit | Period identifiers --- | --- Second | 1SEC, 2SEC, 3SEC, 4SEC, 5SEC, 6SEC, 10SEC, 15SEC, 20SEC, 30SEC Minute | 1MIN, 2MIN, 3MIN, 4MIN, 5MIN, 6MIN, 10MIN, 15MIN, 20MIN, 30MIN Hour | 1HRS, 2HRS, 3HRS, 4HRS, 6HRS, 8HRS, 12HRS Day | 1DAY, 2DAY, 3DAY, 5DAY, 7DAY, 10DAY
  -- 
  -- AuthMethod: 'AuthApiKeyAPIKey'
  -- 
  v1ExchangerateHistoryPeriodsGet
    :: Accept accept -- ^ request accept ('MimeType')
    -> ExchangeRatesHistoricalRESTRequest V1ExchangerateHistoryPeriodsGet MimeNoContent [V1TimeseriesPeriod] accept
  v1ExchangerateHistoryPeriodsGet  _ =
    _mkRequest "GET" ["/v1/exchangerate/history/periods"]
      `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyAPIKey)
  
  data V1ExchangerateHistoryPeriodsGet  
  -- | @application/json@
  instance Produces V1ExchangerateHistoryPeriodsGet MimeJSON
  -- | @text/json@
  instance Produces V1ExchangerateHistoryPeriodsGet MimeTextJson
  -- | @text/plain@
  instance Produces V1ExchangerateHistoryPeriodsGet MimePlainText
  
  