{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE MultiWayIf #-}
-- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator.
{-# LANGUAGE OverloadedStrings #-}

-- | Contains the different functions to run the operation getBitcoinTransactions
module StripeAPI.Operations.GetBitcoinTransactions where

import qualified Control.Monad.Fail
import qualified Control.Monad.Trans.Reader
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Encoding.Internal
import qualified Data.Aeson as Data.Aeson.Types
import qualified Data.Aeson as Data.Aeson.Types.FromJSON
import qualified Data.Aeson as Data.Aeson.Types.Internal
import qualified Data.Aeson as Data.Aeson.Types.ToJSON
import qualified Data.ByteString.Char8
import qualified Data.ByteString.Char8 as Data.ByteString.Internal
import qualified Data.Either
import qualified Data.Functor
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text.Internal
import qualified Data.Time.Calendar as Data.Time.Calendar.Days
import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
import qualified Data.Vector
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified Network.HTTP.Client
import qualified Network.HTTP.Client as Network.HTTP.Client.Request
import qualified Network.HTTP.Client as Network.HTTP.Client.Types
import qualified Network.HTTP.Simple
import qualified Network.HTTP.Types
import qualified Network.HTTP.Types as Network.HTTP.Types.Status
import qualified Network.HTTP.Types as Network.HTTP.Types.URI
import qualified StripeAPI.Common
import StripeAPI.Types
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | > GET /v1/bitcoin/transactions
--
-- \<p>List bitcoin transacitons for a given receiver.\<\/p>
getBitcoinTransactions ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetBitcoinTransactionsParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response GetBitcoinTransactionsResponse)
getBitcoinTransactions :: GetBitcoinTransactionsParameters
-> StripeT m (Response GetBitcoinTransactionsResponse)
getBitcoinTransactions GetBitcoinTransactionsParameters
parameters =
  (Response ByteString -> Response GetBitcoinTransactionsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response GetBitcoinTransactionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetBitcoinTransactionsResponse)
-> Response ByteString -> Response GetBitcoinTransactionsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetBitcoinTransactionsResponse)
-> (GetBitcoinTransactionsResponse
    -> GetBitcoinTransactionsResponse)
-> Either String GetBitcoinTransactionsResponse
-> GetBitcoinTransactionsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetBitcoinTransactionsResponse
GetBitcoinTransactionsResponseError GetBitcoinTransactionsResponse -> GetBitcoinTransactionsResponse
forall a. a -> a
GHC.Base.id
              (Either String GetBitcoinTransactionsResponse
 -> GetBitcoinTransactionsResponse)
-> (ByteString -> Either String GetBitcoinTransactionsResponse)
-> ByteString
-> GetBitcoinTransactionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. ( \Response ByteString
response ByteString
body ->
                             if
                                 | (\Status
status_1 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_1 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Int
200) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                   GetBitcoinTransactionsResponseBody200
-> GetBitcoinTransactionsResponse
GetBitcoinTransactionsResponse200
                                     (GetBitcoinTransactionsResponseBody200
 -> GetBitcoinTransactionsResponse)
-> Either String GetBitcoinTransactionsResponseBody200
-> Either String GetBitcoinTransactionsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String GetBitcoinTransactionsResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetBitcoinTransactionsResponseBody200
                                                      )
                                 | Bool -> Status -> Bool
forall a b. a -> b -> a
GHC.Base.const Bool
GHC.Types.True (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                   Error -> GetBitcoinTransactionsResponse
GetBitcoinTransactionsResponseDefault
                                     (Error -> GetBitcoinTransactionsResponse)
-> Either String Error
-> Either String GetBitcoinTransactionsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String Error
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            Error
                                                      )
                                 | Bool
GHC.Base.otherwise -> String -> Either String GetBitcoinTransactionsResponse
forall a b. a -> Either a b
Data.Either.Left String
"Missing default response type"
                         )
                Response ByteString
response_0
          )
          Response ByteString
response_0
    )
    ( Text -> Text -> [QueryParameter] -> StripeT m (Response ByteString)
forall (m :: * -> *).
MonadHTTP m =>
Text -> Text -> [QueryParameter] -> StripeT m (Response ByteString)
StripeAPI.Common.doCallWithConfigurationM
        (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.pack String
"GET")
        (String -> Text
Data.Text.pack String
"/v1/bitcoin/transactions")
        [ Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"customer") (Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Text -> Value) -> Maybe Text -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryCustomer GetBitcoinTransactionsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"ending_before") (Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Text -> Value) -> Maybe Text -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryEndingBefore GetBitcoinTransactionsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"expand") ([Text] -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON ([Text] -> Value) -> Maybe [Text] -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetBitcoinTransactionsParameters -> Maybe [Text]
getBitcoinTransactionsParametersQueryExpand GetBitcoinTransactionsParameters
parameters) (String -> Text
Data.Text.pack String
"deepObject") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"limit") (Int -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Int -> Value) -> Maybe Int -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetBitcoinTransactionsParameters -> Maybe Int
getBitcoinTransactionsParametersQueryLimit GetBitcoinTransactionsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"receiver") (Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Text -> Value) -> Maybe Text -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryReceiver GetBitcoinTransactionsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True,
          Text -> Maybe Value -> Text -> Bool -> QueryParameter
StripeAPI.Common.QueryParameter (String -> Text
Data.Text.pack String
"starting_after") (Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (Text -> Value) -> Maybe Text -> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryStartingAfter GetBitcoinTransactionsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/bitcoin\/transactions.GET.parameters@ in the specification.
data GetBitcoinTransactionsParameters = GetBitcoinTransactionsParameters
  { -- | queryCustomer: Represents the parameter named \'customer\'
    --
    -- Only return transactions for the customer specified by this customer ID.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryCustomer :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryEnding_before: Represents the parameter named \'ending_before\'
    --
    -- A cursor for use in pagination. \`ending_before\` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with \`obj_bar\`, your subsequent call can include \`ending_before=obj_bar\` in order to fetch the previous page of the list.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetBitcoinTransactionsParameters -> Maybe [Text]
getBitcoinTransactionsParametersQueryExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | queryLimit: Represents the parameter named \'limit\'
    --
    -- A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
    GetBitcoinTransactionsParameters -> Maybe Int
getBitcoinTransactionsParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | queryReceiver: Represents the parameter named \'receiver\'
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryReceiver :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryStarting_after: Represents the parameter named \'starting_after\'
    --
    -- A cursor for use in pagination. \`starting_after\` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with \`obj_foo\`, your subsequent call can include \`starting_after=obj_foo\` in order to fetch the next page of the list.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> GetBitcoinTransactionsParameters -> ShowS
[GetBitcoinTransactionsParameters] -> ShowS
GetBitcoinTransactionsParameters -> String
(Int -> GetBitcoinTransactionsParameters -> ShowS)
-> (GetBitcoinTransactionsParameters -> String)
-> ([GetBitcoinTransactionsParameters] -> ShowS)
-> Show GetBitcoinTransactionsParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBitcoinTransactionsParameters] -> ShowS
$cshowList :: [GetBitcoinTransactionsParameters] -> ShowS
show :: GetBitcoinTransactionsParameters -> String
$cshow :: GetBitcoinTransactionsParameters -> String
showsPrec :: Int -> GetBitcoinTransactionsParameters -> ShowS
$cshowsPrec :: Int -> GetBitcoinTransactionsParameters -> ShowS
GHC.Show.Show,
      GetBitcoinTransactionsParameters
-> GetBitcoinTransactionsParameters -> Bool
(GetBitcoinTransactionsParameters
 -> GetBitcoinTransactionsParameters -> Bool)
-> (GetBitcoinTransactionsParameters
    -> GetBitcoinTransactionsParameters -> Bool)
-> Eq GetBitcoinTransactionsParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBitcoinTransactionsParameters
-> GetBitcoinTransactionsParameters -> Bool
$c/= :: GetBitcoinTransactionsParameters
-> GetBitcoinTransactionsParameters -> Bool
== :: GetBitcoinTransactionsParameters
-> GetBitcoinTransactionsParameters -> Bool
$c== :: GetBitcoinTransactionsParameters
-> GetBitcoinTransactionsParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetBitcoinTransactionsParameters where
  toJSON :: GetBitcoinTransactionsParameters -> Value
toJSON GetBitcoinTransactionsParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"queryCustomer" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryCustomer GetBitcoinTransactionsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryEnding_before" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryEndingBefore GetBitcoinTransactionsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryExpand" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe [Text]
getBitcoinTransactionsParametersQueryExpand GetBitcoinTransactionsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryLimit" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe Int
getBitcoinTransactionsParametersQueryLimit GetBitcoinTransactionsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryReceiver" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryReceiver GetBitcoinTransactionsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryStarting_after" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryStartingAfter GetBitcoinTransactionsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetBitcoinTransactionsParameters -> Encoding
toEncoding GetBitcoinTransactionsParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"queryCustomer" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryCustomer GetBitcoinTransactionsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryEnding_before" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryEndingBefore GetBitcoinTransactionsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryExpand" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe [Text]
getBitcoinTransactionsParametersQueryExpand GetBitcoinTransactionsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryLimit" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe Int
getBitcoinTransactionsParametersQueryLimit GetBitcoinTransactionsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryReceiver" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryReceiver GetBitcoinTransactionsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"queryStarting_after" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsParameters -> Maybe Text
getBitcoinTransactionsParametersQueryStartingAfter GetBitcoinTransactionsParameters
obj))))))

instance Data.Aeson.Types.FromJSON.FromJSON GetBitcoinTransactionsParameters where
  parseJSON :: Value -> Parser GetBitcoinTransactionsParameters
parseJSON = String
-> (Object -> Parser GetBitcoinTransactionsParameters)
-> Value
-> Parser GetBitcoinTransactionsParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetBitcoinTransactionsParameters" (\Object
obj -> ((((((Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> GetBitcoinTransactionsParameters)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> GetBitcoinTransactionsParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> GetBitcoinTransactionsParameters
GetBitcoinTransactionsParameters Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> GetBitcoinTransactionsParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> GetBitcoinTransactionsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryCustomer")) Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> GetBitcoinTransactionsParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> GetBitcoinTransactionsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryEnding_before")) Parser
  (Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> GetBitcoinTransactionsParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Int
      -> Maybe Text -> Maybe Text -> GetBitcoinTransactionsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryExpand")) Parser
  (Maybe Int
   -> Maybe Text -> Maybe Text -> GetBitcoinTransactionsParameters)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text -> Maybe Text -> GetBitcoinTransactionsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryLimit")) Parser
  (Maybe Text -> Maybe Text -> GetBitcoinTransactionsParameters)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> GetBitcoinTransactionsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryReceiver")) Parser (Maybe Text -> GetBitcoinTransactionsParameters)
-> Parser (Maybe Text) -> Parser GetBitcoinTransactionsParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryStarting_after"))

-- | Create a new 'GetBitcoinTransactionsParameters' with all required fields.
mkGetBitcoinTransactionsParameters :: GetBitcoinTransactionsParameters
mkGetBitcoinTransactionsParameters :: GetBitcoinTransactionsParameters
mkGetBitcoinTransactionsParameters =
  GetBitcoinTransactionsParameters :: Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> GetBitcoinTransactionsParameters
GetBitcoinTransactionsParameters
    { getBitcoinTransactionsParametersQueryCustomer :: Maybe Text
getBitcoinTransactionsParametersQueryCustomer = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getBitcoinTransactionsParametersQueryEndingBefore :: Maybe Text
getBitcoinTransactionsParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getBitcoinTransactionsParametersQueryExpand :: Maybe [Text]
getBitcoinTransactionsParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getBitcoinTransactionsParametersQueryLimit :: Maybe Int
getBitcoinTransactionsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getBitcoinTransactionsParametersQueryReceiver :: Maybe Text
getBitcoinTransactionsParametersQueryReceiver = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getBitcoinTransactionsParametersQueryStartingAfter :: Maybe Text
getBitcoinTransactionsParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Represents a response of the operation 'getBitcoinTransactions'.
--
-- The response constructor is chosen by the status code of the response. If no case matches (no specific case for the response code, no range case, no default case), 'GetBitcoinTransactionsResponseError' is used.
data GetBitcoinTransactionsResponse
  = -- | Means either no matching case available or a parse error
    GetBitcoinTransactionsResponseError GHC.Base.String
  | -- | Successful response.
    GetBitcoinTransactionsResponse200 GetBitcoinTransactionsResponseBody200
  | -- | Error response.
    GetBitcoinTransactionsResponseDefault Error
  deriving (Int -> GetBitcoinTransactionsResponse -> ShowS
[GetBitcoinTransactionsResponse] -> ShowS
GetBitcoinTransactionsResponse -> String
(Int -> GetBitcoinTransactionsResponse -> ShowS)
-> (GetBitcoinTransactionsResponse -> String)
-> ([GetBitcoinTransactionsResponse] -> ShowS)
-> Show GetBitcoinTransactionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBitcoinTransactionsResponse] -> ShowS
$cshowList :: [GetBitcoinTransactionsResponse] -> ShowS
show :: GetBitcoinTransactionsResponse -> String
$cshow :: GetBitcoinTransactionsResponse -> String
showsPrec :: Int -> GetBitcoinTransactionsResponse -> ShowS
$cshowsPrec :: Int -> GetBitcoinTransactionsResponse -> ShowS
GHC.Show.Show, GetBitcoinTransactionsResponse
-> GetBitcoinTransactionsResponse -> Bool
(GetBitcoinTransactionsResponse
 -> GetBitcoinTransactionsResponse -> Bool)
-> (GetBitcoinTransactionsResponse
    -> GetBitcoinTransactionsResponse -> Bool)
-> Eq GetBitcoinTransactionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBitcoinTransactionsResponse
-> GetBitcoinTransactionsResponse -> Bool
$c/= :: GetBitcoinTransactionsResponse
-> GetBitcoinTransactionsResponse -> Bool
== :: GetBitcoinTransactionsResponse
-> GetBitcoinTransactionsResponse -> Bool
$c== :: GetBitcoinTransactionsResponse
-> GetBitcoinTransactionsResponse -> Bool
GHC.Classes.Eq)

-- | Defines the object schema located at @paths.\/v1\/bitcoin\/transactions.GET.responses.200.content.application\/json.schema@ in the specification.
data GetBitcoinTransactionsResponseBody200 = GetBitcoinTransactionsResponseBody200
  { -- | data: Details about each object.
    GetBitcoinTransactionsResponseBody200 -> [BitcoinTransaction]
getBitcoinTransactionsResponseBody200Data :: ([BitcoinTransaction]),
    -- | has_more: True if this list has another page of items after this one that can be fetched.
    GetBitcoinTransactionsResponseBody200 -> Bool
getBitcoinTransactionsResponseBody200HasMore :: GHC.Types.Bool,
    -- | url: The URL where this list can be accessed.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetBitcoinTransactionsResponseBody200 -> Text
getBitcoinTransactionsResponseBody200Url :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> GetBitcoinTransactionsResponseBody200 -> ShowS
[GetBitcoinTransactionsResponseBody200] -> ShowS
GetBitcoinTransactionsResponseBody200 -> String
(Int -> GetBitcoinTransactionsResponseBody200 -> ShowS)
-> (GetBitcoinTransactionsResponseBody200 -> String)
-> ([GetBitcoinTransactionsResponseBody200] -> ShowS)
-> Show GetBitcoinTransactionsResponseBody200
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBitcoinTransactionsResponseBody200] -> ShowS
$cshowList :: [GetBitcoinTransactionsResponseBody200] -> ShowS
show :: GetBitcoinTransactionsResponseBody200 -> String
$cshow :: GetBitcoinTransactionsResponseBody200 -> String
showsPrec :: Int -> GetBitcoinTransactionsResponseBody200 -> ShowS
$cshowsPrec :: Int -> GetBitcoinTransactionsResponseBody200 -> ShowS
GHC.Show.Show,
      GetBitcoinTransactionsResponseBody200
-> GetBitcoinTransactionsResponseBody200 -> Bool
(GetBitcoinTransactionsResponseBody200
 -> GetBitcoinTransactionsResponseBody200 -> Bool)
-> (GetBitcoinTransactionsResponseBody200
    -> GetBitcoinTransactionsResponseBody200 -> Bool)
-> Eq GetBitcoinTransactionsResponseBody200
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBitcoinTransactionsResponseBody200
-> GetBitcoinTransactionsResponseBody200 -> Bool
$c/= :: GetBitcoinTransactionsResponseBody200
-> GetBitcoinTransactionsResponseBody200 -> Bool
== :: GetBitcoinTransactionsResponseBody200
-> GetBitcoinTransactionsResponseBody200 -> Bool
$c== :: GetBitcoinTransactionsResponseBody200
-> GetBitcoinTransactionsResponseBody200 -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetBitcoinTransactionsResponseBody200 where
  toJSON :: GetBitcoinTransactionsResponseBody200 -> Value
toJSON GetBitcoinTransactionsResponseBody200
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"data" Text -> [BitcoinTransaction] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsResponseBody200 -> [BitcoinTransaction]
getBitcoinTransactionsResponseBody200Data GetBitcoinTransactionsResponseBody200
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"has_more" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsResponseBody200 -> Bool
getBitcoinTransactionsResponseBody200HasMore GetBitcoinTransactionsResponseBody200
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsResponseBody200 -> Text
getBitcoinTransactionsResponseBody200Url GetBitcoinTransactionsResponseBody200
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"list" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetBitcoinTransactionsResponseBody200 -> Encoding
toEncoding GetBitcoinTransactionsResponseBody200
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"data" Text -> [BitcoinTransaction] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsResponseBody200 -> [BitcoinTransaction]
getBitcoinTransactionsResponseBody200Data GetBitcoinTransactionsResponseBody200
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"has_more" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsResponseBody200 -> Bool
getBitcoinTransactionsResponseBody200HasMore GetBitcoinTransactionsResponseBody200
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"url" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetBitcoinTransactionsResponseBody200 -> Text
getBitcoinTransactionsResponseBody200Url GetBitcoinTransactionsResponseBody200
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"list"))))

instance Data.Aeson.Types.FromJSON.FromJSON GetBitcoinTransactionsResponseBody200 where
  parseJSON :: Value -> Parser GetBitcoinTransactionsResponseBody200
parseJSON = String
-> (Object -> Parser GetBitcoinTransactionsResponseBody200)
-> Value
-> Parser GetBitcoinTransactionsResponseBody200
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetBitcoinTransactionsResponseBody200" (\Object
obj -> ((([BitcoinTransaction]
 -> Bool -> Text -> GetBitcoinTransactionsResponseBody200)
-> Parser
     ([BitcoinTransaction]
      -> Bool -> Text -> GetBitcoinTransactionsResponseBody200)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure [BitcoinTransaction]
-> Bool -> Text -> GetBitcoinTransactionsResponseBody200
GetBitcoinTransactionsResponseBody200 Parser
  ([BitcoinTransaction]
   -> Bool -> Text -> GetBitcoinTransactionsResponseBody200)
-> Parser [BitcoinTransaction]
-> Parser (Bool -> Text -> GetBitcoinTransactionsResponseBody200)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser [BitcoinTransaction]
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"data")) Parser (Bool -> Text -> GetBitcoinTransactionsResponseBody200)
-> Parser Bool
-> Parser (Text -> GetBitcoinTransactionsResponseBody200)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"has_more")) Parser (Text -> GetBitcoinTransactionsResponseBody200)
-> Parser Text -> Parser GetBitcoinTransactionsResponseBody200
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"url"))

-- | Create a new 'GetBitcoinTransactionsResponseBody200' with all required fields.
mkGetBitcoinTransactionsResponseBody200 ::
  -- | 'getBitcoinTransactionsResponseBody200Data'
  [BitcoinTransaction] ->
  -- | 'getBitcoinTransactionsResponseBody200HasMore'
  GHC.Types.Bool ->
  -- | 'getBitcoinTransactionsResponseBody200Url'
  Data.Text.Internal.Text ->
  GetBitcoinTransactionsResponseBody200
mkGetBitcoinTransactionsResponseBody200 :: [BitcoinTransaction]
-> Bool -> Text -> GetBitcoinTransactionsResponseBody200
mkGetBitcoinTransactionsResponseBody200 [BitcoinTransaction]
getBitcoinTransactionsResponseBody200Data Bool
getBitcoinTransactionsResponseBody200HasMore Text
getBitcoinTransactionsResponseBody200Url =
  GetBitcoinTransactionsResponseBody200 :: [BitcoinTransaction]
-> Bool -> Text -> GetBitcoinTransactionsResponseBody200
GetBitcoinTransactionsResponseBody200
    { getBitcoinTransactionsResponseBody200Data :: [BitcoinTransaction]
getBitcoinTransactionsResponseBody200Data = [BitcoinTransaction]
getBitcoinTransactionsResponseBody200Data,
      getBitcoinTransactionsResponseBody200HasMore :: Bool
getBitcoinTransactionsResponseBody200HasMore = Bool
getBitcoinTransactionsResponseBody200HasMore,
      getBitcoinTransactionsResponseBody200Url :: Text
getBitcoinTransactionsResponseBody200Url = Text
getBitcoinTransactionsResponseBody200Url
    }