{-# 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 getTerminalLocations
module StripeAPI.Operations.GetTerminalLocations 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/terminal/locations
--
-- \<p>Returns a list of \<code>Location\<\/code> objects.\<\/p>
getTerminalLocations ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetTerminalLocationsParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response GetTerminalLocationsResponse)
getTerminalLocations :: GetTerminalLocationsParameters
-> StripeT m (Response GetTerminalLocationsResponse)
getTerminalLocations GetTerminalLocationsParameters
parameters =
  (Response ByteString -> Response GetTerminalLocationsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response GetTerminalLocationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetTerminalLocationsResponse)
-> Response ByteString -> Response GetTerminalLocationsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetTerminalLocationsResponse)
-> (GetTerminalLocationsResponse -> GetTerminalLocationsResponse)
-> Either String GetTerminalLocationsResponse
-> GetTerminalLocationsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetTerminalLocationsResponse
GetTerminalLocationsResponseError GetTerminalLocationsResponse -> GetTerminalLocationsResponse
forall a. a -> a
GHC.Base.id
              (Either String GetTerminalLocationsResponse
 -> GetTerminalLocationsResponse)
-> (ByteString -> Either String GetTerminalLocationsResponse)
-> ByteString
-> GetTerminalLocationsResponse
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) ->
                                   GetTerminalLocationsResponseBody200 -> GetTerminalLocationsResponse
GetTerminalLocationsResponse200
                                     (GetTerminalLocationsResponseBody200
 -> GetTerminalLocationsResponse)
-> Either String GetTerminalLocationsResponseBody200
-> Either String GetTerminalLocationsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String GetTerminalLocationsResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetTerminalLocationsResponseBody200
                                                      )
                                 | 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 -> GetTerminalLocationsResponse
GetTerminalLocationsResponseDefault
                                     (Error -> GetTerminalLocationsResponse)
-> Either String Error
-> Either String GetTerminalLocationsResponse
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 GetTerminalLocationsResponse
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/terminal/locations")
        [ 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.<$> GetTerminalLocationsParameters -> Maybe Text
getTerminalLocationsParametersQueryEndingBefore GetTerminalLocationsParameters
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.<$> GetTerminalLocationsParameters -> Maybe [Text]
getTerminalLocationsParametersQueryExpand GetTerminalLocationsParameters
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.<$> GetTerminalLocationsParameters -> Maybe Int
getTerminalLocationsParametersQueryLimit GetTerminalLocationsParameters
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.<$> GetTerminalLocationsParameters -> Maybe Text
getTerminalLocationsParametersQueryStartingAfter GetTerminalLocationsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/terminal\/locations.GET.parameters@ in the specification.
data GetTerminalLocationsParameters = GetTerminalLocationsParameters
  { -- | 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
    GetTerminalLocationsParameters -> Maybe Text
getTerminalLocationsParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetTerminalLocationsParameters -> Maybe [Text]
getTerminalLocationsParametersQueryExpand :: (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.
    GetTerminalLocationsParameters -> Maybe Int
getTerminalLocationsParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | 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
    GetTerminalLocationsParameters -> Maybe Text
getTerminalLocationsParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> GetTerminalLocationsParameters -> ShowS
[GetTerminalLocationsParameters] -> ShowS
GetTerminalLocationsParameters -> String
(Int -> GetTerminalLocationsParameters -> ShowS)
-> (GetTerminalLocationsParameters -> String)
-> ([GetTerminalLocationsParameters] -> ShowS)
-> Show GetTerminalLocationsParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTerminalLocationsParameters] -> ShowS
$cshowList :: [GetTerminalLocationsParameters] -> ShowS
show :: GetTerminalLocationsParameters -> String
$cshow :: GetTerminalLocationsParameters -> String
showsPrec :: Int -> GetTerminalLocationsParameters -> ShowS
$cshowsPrec :: Int -> GetTerminalLocationsParameters -> ShowS
GHC.Show.Show,
      GetTerminalLocationsParameters
-> GetTerminalLocationsParameters -> Bool
(GetTerminalLocationsParameters
 -> GetTerminalLocationsParameters -> Bool)
-> (GetTerminalLocationsParameters
    -> GetTerminalLocationsParameters -> Bool)
-> Eq GetTerminalLocationsParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTerminalLocationsParameters
-> GetTerminalLocationsParameters -> Bool
$c/= :: GetTerminalLocationsParameters
-> GetTerminalLocationsParameters -> Bool
== :: GetTerminalLocationsParameters
-> GetTerminalLocationsParameters -> Bool
$c== :: GetTerminalLocationsParameters
-> GetTerminalLocationsParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetTerminalLocationsParameters where
  toJSON :: GetTerminalLocationsParameters -> Value
toJSON GetTerminalLocationsParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"queryEnding_before" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetTerminalLocationsParameters -> Maybe Text
getTerminalLocationsParametersQueryEndingBefore GetTerminalLocationsParameters
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..= GetTerminalLocationsParameters -> Maybe [Text]
getTerminalLocationsParametersQueryExpand GetTerminalLocationsParameters
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..= GetTerminalLocationsParameters -> Maybe Int
getTerminalLocationsParametersQueryLimit GetTerminalLocationsParameters
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..= GetTerminalLocationsParameters -> Maybe Text
getTerminalLocationsParametersQueryStartingAfter GetTerminalLocationsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetTerminalLocationsParameters -> Encoding
toEncoding GetTerminalLocationsParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"queryEnding_before" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetTerminalLocationsParameters -> Maybe Text
getTerminalLocationsParametersQueryEndingBefore GetTerminalLocationsParameters
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..= GetTerminalLocationsParameters -> Maybe [Text]
getTerminalLocationsParametersQueryExpand GetTerminalLocationsParameters
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..= GetTerminalLocationsParameters -> Maybe Int
getTerminalLocationsParametersQueryLimit GetTerminalLocationsParameters
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..= GetTerminalLocationsParameters -> Maybe Text
getTerminalLocationsParametersQueryStartingAfter GetTerminalLocationsParameters
obj))))

instance Data.Aeson.Types.FromJSON.FromJSON GetTerminalLocationsParameters where
  parseJSON :: Value -> Parser GetTerminalLocationsParameters
parseJSON = String
-> (Object -> Parser GetTerminalLocationsParameters)
-> Value
-> Parser GetTerminalLocationsParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetTerminalLocationsParameters" (\Object
obj -> ((((Maybe Text
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe Text
 -> GetTerminalLocationsParameters)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> GetTerminalLocationsParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetTerminalLocationsParameters
GetTerminalLocationsParameters Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> GetTerminalLocationsParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Int -> Maybe Text -> GetTerminalLocationsParameters)
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 -> GetTerminalLocationsParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Int -> Maybe Text -> GetTerminalLocationsParameters)
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 -> GetTerminalLocationsParameters)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> GetTerminalLocationsParameters)
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 -> GetTerminalLocationsParameters)
-> Parser (Maybe Text) -> Parser GetTerminalLocationsParameters
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 'GetTerminalLocationsParameters' with all required fields.
mkGetTerminalLocationsParameters :: GetTerminalLocationsParameters
mkGetTerminalLocationsParameters :: GetTerminalLocationsParameters
mkGetTerminalLocationsParameters =
  GetTerminalLocationsParameters :: Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> GetTerminalLocationsParameters
GetTerminalLocationsParameters
    { getTerminalLocationsParametersQueryEndingBefore :: Maybe Text
getTerminalLocationsParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getTerminalLocationsParametersQueryExpand :: Maybe [Text]
getTerminalLocationsParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getTerminalLocationsParametersQueryLimit :: Maybe Int
getTerminalLocationsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getTerminalLocationsParametersQueryStartingAfter :: Maybe Text
getTerminalLocationsParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Represents a response of the operation 'getTerminalLocations'.
--
-- 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), 'GetTerminalLocationsResponseError' is used.
data GetTerminalLocationsResponse
  = -- | Means either no matching case available or a parse error
    GetTerminalLocationsResponseError GHC.Base.String
  | -- | Successful response.
    GetTerminalLocationsResponse200 GetTerminalLocationsResponseBody200
  | -- | Error response.
    GetTerminalLocationsResponseDefault Error
  deriving (Int -> GetTerminalLocationsResponse -> ShowS
[GetTerminalLocationsResponse] -> ShowS
GetTerminalLocationsResponse -> String
(Int -> GetTerminalLocationsResponse -> ShowS)
-> (GetTerminalLocationsResponse -> String)
-> ([GetTerminalLocationsResponse] -> ShowS)
-> Show GetTerminalLocationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTerminalLocationsResponse] -> ShowS
$cshowList :: [GetTerminalLocationsResponse] -> ShowS
show :: GetTerminalLocationsResponse -> String
$cshow :: GetTerminalLocationsResponse -> String
showsPrec :: Int -> GetTerminalLocationsResponse -> ShowS
$cshowsPrec :: Int -> GetTerminalLocationsResponse -> ShowS
GHC.Show.Show, GetTerminalLocationsResponse
-> GetTerminalLocationsResponse -> Bool
(GetTerminalLocationsResponse
 -> GetTerminalLocationsResponse -> Bool)
-> (GetTerminalLocationsResponse
    -> GetTerminalLocationsResponse -> Bool)
-> Eq GetTerminalLocationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTerminalLocationsResponse
-> GetTerminalLocationsResponse -> Bool
$c/= :: GetTerminalLocationsResponse
-> GetTerminalLocationsResponse -> Bool
== :: GetTerminalLocationsResponse
-> GetTerminalLocationsResponse -> Bool
$c== :: GetTerminalLocationsResponse
-> GetTerminalLocationsResponse -> Bool
GHC.Classes.Eq)

-- | Defines the object schema located at @paths.\/v1\/terminal\/locations.GET.responses.200.content.application\/json.schema@ in the specification.
data GetTerminalLocationsResponseBody200 = GetTerminalLocationsResponseBody200
  { -- | data
    GetTerminalLocationsResponseBody200 -> [Terminal'location]
getTerminalLocationsResponseBody200Data :: ([Terminal'location]),
    -- | has_more: True if this list has another page of items after this one that can be fetched.
    GetTerminalLocationsResponseBody200 -> Bool
getTerminalLocationsResponseBody200HasMore :: GHC.Types.Bool,
    -- | url: The URL where this list can be accessed.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    -- * Must match pattern \'^\/v1\/terminal\/locations\'
    GetTerminalLocationsResponseBody200 -> Text
getTerminalLocationsResponseBody200Url :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> GetTerminalLocationsResponseBody200 -> ShowS
[GetTerminalLocationsResponseBody200] -> ShowS
GetTerminalLocationsResponseBody200 -> String
(Int -> GetTerminalLocationsResponseBody200 -> ShowS)
-> (GetTerminalLocationsResponseBody200 -> String)
-> ([GetTerminalLocationsResponseBody200] -> ShowS)
-> Show GetTerminalLocationsResponseBody200
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTerminalLocationsResponseBody200] -> ShowS
$cshowList :: [GetTerminalLocationsResponseBody200] -> ShowS
show :: GetTerminalLocationsResponseBody200 -> String
$cshow :: GetTerminalLocationsResponseBody200 -> String
showsPrec :: Int -> GetTerminalLocationsResponseBody200 -> ShowS
$cshowsPrec :: Int -> GetTerminalLocationsResponseBody200 -> ShowS
GHC.Show.Show,
      GetTerminalLocationsResponseBody200
-> GetTerminalLocationsResponseBody200 -> Bool
(GetTerminalLocationsResponseBody200
 -> GetTerminalLocationsResponseBody200 -> Bool)
-> (GetTerminalLocationsResponseBody200
    -> GetTerminalLocationsResponseBody200 -> Bool)
-> Eq GetTerminalLocationsResponseBody200
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTerminalLocationsResponseBody200
-> GetTerminalLocationsResponseBody200 -> Bool
$c/= :: GetTerminalLocationsResponseBody200
-> GetTerminalLocationsResponseBody200 -> Bool
== :: GetTerminalLocationsResponseBody200
-> GetTerminalLocationsResponseBody200 -> Bool
$c== :: GetTerminalLocationsResponseBody200
-> GetTerminalLocationsResponseBody200 -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetTerminalLocationsResponseBody200 where
  toJSON :: GetTerminalLocationsResponseBody200 -> Value
toJSON GetTerminalLocationsResponseBody200
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"data" Text -> [Terminal'location] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetTerminalLocationsResponseBody200 -> [Terminal'location]
getTerminalLocationsResponseBody200Data GetTerminalLocationsResponseBody200
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..= GetTerminalLocationsResponseBody200 -> Bool
getTerminalLocationsResponseBody200HasMore GetTerminalLocationsResponseBody200
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..= GetTerminalLocationsResponseBody200 -> Text
getTerminalLocationsResponseBody200Url GetTerminalLocationsResponseBody200
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 :: GetTerminalLocationsResponseBody200 -> Encoding
toEncoding GetTerminalLocationsResponseBody200
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"data" Text -> [Terminal'location] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetTerminalLocationsResponseBody200 -> [Terminal'location]
getTerminalLocationsResponseBody200Data GetTerminalLocationsResponseBody200
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..= GetTerminalLocationsResponseBody200 -> Bool
getTerminalLocationsResponseBody200HasMore GetTerminalLocationsResponseBody200
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..= GetTerminalLocationsResponseBody200 -> Text
getTerminalLocationsResponseBody200Url GetTerminalLocationsResponseBody200
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 GetTerminalLocationsResponseBody200 where
  parseJSON :: Value -> Parser GetTerminalLocationsResponseBody200
parseJSON = String
-> (Object -> Parser GetTerminalLocationsResponseBody200)
-> Value
-> Parser GetTerminalLocationsResponseBody200
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetTerminalLocationsResponseBody200" (\Object
obj -> ((([Terminal'location]
 -> Bool -> Text -> GetTerminalLocationsResponseBody200)
-> Parser
     ([Terminal'location]
      -> Bool -> Text -> GetTerminalLocationsResponseBody200)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure [Terminal'location]
-> Bool -> Text -> GetTerminalLocationsResponseBody200
GetTerminalLocationsResponseBody200 Parser
  ([Terminal'location]
   -> Bool -> Text -> GetTerminalLocationsResponseBody200)
-> Parser [Terminal'location]
-> Parser (Bool -> Text -> GetTerminalLocationsResponseBody200)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser [Terminal'location]
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"data")) Parser (Bool -> Text -> GetTerminalLocationsResponseBody200)
-> Parser Bool
-> Parser (Text -> GetTerminalLocationsResponseBody200)
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 -> GetTerminalLocationsResponseBody200)
-> Parser Text -> Parser GetTerminalLocationsResponseBody200
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 'GetTerminalLocationsResponseBody200' with all required fields.
mkGetTerminalLocationsResponseBody200 ::
  -- | 'getTerminalLocationsResponseBody200Data'
  [Terminal'location] ->
  -- | 'getTerminalLocationsResponseBody200HasMore'
  GHC.Types.Bool ->
  -- | 'getTerminalLocationsResponseBody200Url'
  Data.Text.Internal.Text ->
  GetTerminalLocationsResponseBody200
mkGetTerminalLocationsResponseBody200 :: [Terminal'location]
-> Bool -> Text -> GetTerminalLocationsResponseBody200
mkGetTerminalLocationsResponseBody200 [Terminal'location]
getTerminalLocationsResponseBody200Data Bool
getTerminalLocationsResponseBody200HasMore Text
getTerminalLocationsResponseBody200Url =
  GetTerminalLocationsResponseBody200 :: [Terminal'location]
-> Bool -> Text -> GetTerminalLocationsResponseBody200
GetTerminalLocationsResponseBody200
    { getTerminalLocationsResponseBody200Data :: [Terminal'location]
getTerminalLocationsResponseBody200Data = [Terminal'location]
getTerminalLocationsResponseBody200Data,
      getTerminalLocationsResponseBody200HasMore :: Bool
getTerminalLocationsResponseBody200HasMore = Bool
getTerminalLocationsResponseBody200HasMore,
      getTerminalLocationsResponseBody200Url :: Text
getTerminalLocationsResponseBody200Url = Text
getTerminalLocationsResponseBody200Url
    }