{-# 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 getAccountsAccountPersons
module StripeAPI.Operations.GetAccountsAccountPersons 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/accounts/{account}/persons
--
-- \<p>Returns a list of people associated with the account’s legal entity. The people are returned sorted by creation date, with the most recent people appearing first.\<\/p>
getAccountsAccountPersons ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetAccountsAccountPersonsParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response GetAccountsAccountPersonsResponse)
getAccountsAccountPersons :: GetAccountsAccountPersonsParameters
-> StripeT m (Response GetAccountsAccountPersonsResponse)
getAccountsAccountPersons GetAccountsAccountPersonsParameters
parameters =
  (Response ByteString -> Response GetAccountsAccountPersonsResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response GetAccountsAccountPersonsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> GetAccountsAccountPersonsResponse)
-> Response ByteString
-> Response GetAccountsAccountPersonsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> GetAccountsAccountPersonsResponse)
-> (GetAccountsAccountPersonsResponse
    -> GetAccountsAccountPersonsResponse)
-> Either String GetAccountsAccountPersonsResponse
-> GetAccountsAccountPersonsResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> GetAccountsAccountPersonsResponse
GetAccountsAccountPersonsResponseError GetAccountsAccountPersonsResponse
-> GetAccountsAccountPersonsResponse
forall a. a -> a
GHC.Base.id
              (Either String GetAccountsAccountPersonsResponse
 -> GetAccountsAccountPersonsResponse)
-> (ByteString -> Either String GetAccountsAccountPersonsResponse)
-> ByteString
-> GetAccountsAccountPersonsResponse
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) ->
                                   GetAccountsAccountPersonsResponseBody200
-> GetAccountsAccountPersonsResponse
GetAccountsAccountPersonsResponse200
                                     (GetAccountsAccountPersonsResponseBody200
 -> GetAccountsAccountPersonsResponse)
-> Either String GetAccountsAccountPersonsResponseBody200
-> Either String GetAccountsAccountPersonsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString
-> Either String GetAccountsAccountPersonsResponseBody200
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetAccountsAccountPersonsResponseBody200
                                                      )
                                 | 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 -> GetAccountsAccountPersonsResponse
GetAccountsAccountPersonsResponseDefault
                                     (Error -> GetAccountsAccountPersonsResponse)
-> Either String Error
-> Either String GetAccountsAccountPersonsResponse
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 GetAccountsAccountPersonsResponse
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/accounts/" String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ (ByteString -> String
Data.ByteString.Char8.unpack (Bool -> ByteString -> ByteString
Network.HTTP.Types.URI.urlEncode Bool
GHC.Types.True (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ (String -> ByteString
Data.ByteString.Char8.pack (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> String
forall a. StringifyModel a => a -> String
StripeAPI.Common.stringifyModel (GetAccountsAccountPersonsParameters -> Text
getAccountsAccountPersonsParametersPathAccount GetAccountsAccountPersonsParameters
parameters))) String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ String
"/persons")))
        [ 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.<$> GetAccountsAccountPersonsParameters -> Maybe Text
getAccountsAccountPersonsParametersQueryEndingBefore GetAccountsAccountPersonsParameters
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.<$> GetAccountsAccountPersonsParameters -> Maybe [Text]
getAccountsAccountPersonsParametersQueryExpand GetAccountsAccountPersonsParameters
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.<$> GetAccountsAccountPersonsParameters -> Maybe Int
getAccountsAccountPersonsParametersQueryLimit GetAccountsAccountPersonsParameters
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
"relationship") (GetAccountsAccountPersonsParametersQueryRelationship' -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON (GetAccountsAccountPersonsParametersQueryRelationship' -> Value)
-> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
-> Maybe Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> GetAccountsAccountPersonsParameters
-> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
getAccountsAccountPersonsParametersQueryRelationship GetAccountsAccountPersonsParameters
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
"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.<$> GetAccountsAccountPersonsParameters -> Maybe Text
getAccountsAccountPersonsParametersQueryStartingAfter GetAccountsAccountPersonsParameters
parameters) (String -> Text
Data.Text.pack String
"form") Bool
GHC.Types.True
        ]
    )

-- | Defines the object schema located at @paths.\/v1\/accounts\/{account}\/persons.GET.parameters@ in the specification.
data GetAccountsAccountPersonsParameters = GetAccountsAccountPersonsParameters
  { -- | pathAccount: Represents the parameter named \'account\'
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    GetAccountsAccountPersonsParameters -> Text
getAccountsAccountPersonsParametersPathAccount :: 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
    GetAccountsAccountPersonsParameters -> Maybe Text
getAccountsAccountPersonsParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    GetAccountsAccountPersonsParameters -> Maybe [Text]
getAccountsAccountPersonsParametersQueryExpand :: (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.
    GetAccountsAccountPersonsParameters -> Maybe Int
getAccountsAccountPersonsParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | queryRelationship: Represents the parameter named \'relationship\'
    --
    -- Filters on the list of people returned based on the person\'s relationship to the account\'s company.
    GetAccountsAccountPersonsParameters
-> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
getAccountsAccountPersonsParametersQueryRelationship :: (GHC.Maybe.Maybe GetAccountsAccountPersonsParametersQueryRelationship'),
    -- | 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
    GetAccountsAccountPersonsParameters -> Maybe Text
getAccountsAccountPersonsParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> GetAccountsAccountPersonsParameters -> String -> String
[GetAccountsAccountPersonsParameters] -> String -> String
GetAccountsAccountPersonsParameters -> String
(Int -> GetAccountsAccountPersonsParameters -> String -> String)
-> (GetAccountsAccountPersonsParameters -> String)
-> ([GetAccountsAccountPersonsParameters] -> String -> String)
-> Show GetAccountsAccountPersonsParameters
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [GetAccountsAccountPersonsParameters] -> String -> String
$cshowList :: [GetAccountsAccountPersonsParameters] -> String -> String
show :: GetAccountsAccountPersonsParameters -> String
$cshow :: GetAccountsAccountPersonsParameters -> String
showsPrec :: Int -> GetAccountsAccountPersonsParameters -> String -> String
$cshowsPrec :: Int -> GetAccountsAccountPersonsParameters -> String -> String
GHC.Show.Show,
      GetAccountsAccountPersonsParameters
-> GetAccountsAccountPersonsParameters -> Bool
(GetAccountsAccountPersonsParameters
 -> GetAccountsAccountPersonsParameters -> Bool)
-> (GetAccountsAccountPersonsParameters
    -> GetAccountsAccountPersonsParameters -> Bool)
-> Eq GetAccountsAccountPersonsParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccountsAccountPersonsParameters
-> GetAccountsAccountPersonsParameters -> Bool
$c/= :: GetAccountsAccountPersonsParameters
-> GetAccountsAccountPersonsParameters -> Bool
== :: GetAccountsAccountPersonsParameters
-> GetAccountsAccountPersonsParameters -> Bool
$c== :: GetAccountsAccountPersonsParameters
-> GetAccountsAccountPersonsParameters -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetAccountsAccountPersonsParameters where
  toJSON :: GetAccountsAccountPersonsParameters -> Value
toJSON GetAccountsAccountPersonsParameters
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"pathAccount" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParameters -> Text
getAccountsAccountPersonsParametersPathAccount GetAccountsAccountPersonsParameters
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..= GetAccountsAccountPersonsParameters -> Maybe Text
getAccountsAccountPersonsParametersQueryEndingBefore GetAccountsAccountPersonsParameters
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..= GetAccountsAccountPersonsParameters -> Maybe [Text]
getAccountsAccountPersonsParametersQueryExpand GetAccountsAccountPersonsParameters
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..= GetAccountsAccountPersonsParameters -> Maybe Int
getAccountsAccountPersonsParametersQueryLimit GetAccountsAccountPersonsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"queryRelationship" Text
-> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParameters
-> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
getAccountsAccountPersonsParametersQueryRelationship GetAccountsAccountPersonsParameters
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..= GetAccountsAccountPersonsParameters -> Maybe Text
getAccountsAccountPersonsParametersQueryStartingAfter GetAccountsAccountPersonsParameters
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetAccountsAccountPersonsParameters -> Encoding
toEncoding GetAccountsAccountPersonsParameters
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"pathAccount" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParameters -> Text
getAccountsAccountPersonsParametersPathAccount GetAccountsAccountPersonsParameters
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..= GetAccountsAccountPersonsParameters -> Maybe Text
getAccountsAccountPersonsParametersQueryEndingBefore GetAccountsAccountPersonsParameters
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..= GetAccountsAccountPersonsParameters -> Maybe [Text]
getAccountsAccountPersonsParametersQueryExpand GetAccountsAccountPersonsParameters
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..= GetAccountsAccountPersonsParameters -> Maybe Int
getAccountsAccountPersonsParametersQueryLimit GetAccountsAccountPersonsParameters
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"queryRelationship" Text
-> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParameters
-> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
getAccountsAccountPersonsParametersQueryRelationship GetAccountsAccountPersonsParameters
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..= GetAccountsAccountPersonsParameters -> Maybe Text
getAccountsAccountPersonsParametersQueryStartingAfter GetAccountsAccountPersonsParameters
obj))))))

instance Data.Aeson.Types.FromJSON.FromJSON GetAccountsAccountPersonsParameters where
  parseJSON :: Value -> Parser GetAccountsAccountPersonsParameters
parseJSON = String
-> (Object -> Parser GetAccountsAccountPersonsParameters)
-> Value
-> Parser GetAccountsAccountPersonsParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetAccountsAccountPersonsParameters" (\Object
obj -> ((((((Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
 -> Maybe Text
 -> GetAccountsAccountPersonsParameters)
-> Parser
     (Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
      -> Maybe Text
      -> GetAccountsAccountPersonsParameters)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
-> Maybe Text
-> GetAccountsAccountPersonsParameters
GetAccountsAccountPersonsParameters Parser
  (Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
   -> Maybe Text
   -> GetAccountsAccountPersonsParameters)
-> Parser Text
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Int
      -> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
      -> Maybe Text
      -> GetAccountsAccountPersonsParameters)
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
"pathAccount")) Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Int
   -> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
   -> Maybe Text
   -> GetAccountsAccountPersonsParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Int
      -> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
      -> Maybe Text
      -> GetAccountsAccountPersonsParameters)
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 GetAccountsAccountPersonsParametersQueryRelationship'
   -> Maybe Text
   -> GetAccountsAccountPersonsParameters)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Int
      -> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
      -> Maybe Text
      -> GetAccountsAccountPersonsParameters)
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 GetAccountsAccountPersonsParametersQueryRelationship'
   -> Maybe Text
   -> GetAccountsAccountPersonsParameters)
-> Parser (Maybe Int)
-> Parser
     (Maybe GetAccountsAccountPersonsParametersQueryRelationship'
      -> Maybe Text -> GetAccountsAccountPersonsParameters)
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 GetAccountsAccountPersonsParametersQueryRelationship'
   -> Maybe Text -> GetAccountsAccountPersonsParameters)
-> Parser
     (Maybe GetAccountsAccountPersonsParametersQueryRelationship')
-> Parser (Maybe Text -> GetAccountsAccountPersonsParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe GetAccountsAccountPersonsParametersQueryRelationship')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"queryRelationship")) Parser (Maybe Text -> GetAccountsAccountPersonsParameters)
-> Parser (Maybe Text)
-> Parser GetAccountsAccountPersonsParameters
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 'GetAccountsAccountPersonsParameters' with all required fields.
mkGetAccountsAccountPersonsParameters ::
  -- | 'getAccountsAccountPersonsParametersPathAccount'
  Data.Text.Internal.Text ->
  GetAccountsAccountPersonsParameters
mkGetAccountsAccountPersonsParameters :: Text -> GetAccountsAccountPersonsParameters
mkGetAccountsAccountPersonsParameters Text
getAccountsAccountPersonsParametersPathAccount =
  GetAccountsAccountPersonsParameters :: Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe GetAccountsAccountPersonsParametersQueryRelationship'
-> Maybe Text
-> GetAccountsAccountPersonsParameters
GetAccountsAccountPersonsParameters
    { getAccountsAccountPersonsParametersPathAccount :: Text
getAccountsAccountPersonsParametersPathAccount = Text
getAccountsAccountPersonsParametersPathAccount,
      getAccountsAccountPersonsParametersQueryEndingBefore :: Maybe Text
getAccountsAccountPersonsParametersQueryEndingBefore = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      getAccountsAccountPersonsParametersQueryExpand :: Maybe [Text]
getAccountsAccountPersonsParametersQueryExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      getAccountsAccountPersonsParametersQueryLimit :: Maybe Int
getAccountsAccountPersonsParametersQueryLimit = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      getAccountsAccountPersonsParametersQueryRelationship :: Maybe GetAccountsAccountPersonsParametersQueryRelationship'
getAccountsAccountPersonsParametersQueryRelationship = Maybe GetAccountsAccountPersonsParametersQueryRelationship'
forall a. Maybe a
GHC.Maybe.Nothing,
      getAccountsAccountPersonsParametersQueryStartingAfter :: Maybe Text
getAccountsAccountPersonsParametersQueryStartingAfter = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @paths.\/v1\/accounts\/{account}\/persons.GET.parameters.properties.queryRelationship@ in the specification.
--
-- Represents the parameter named \'relationship\'
--
-- Filters on the list of people returned based on the person\'s relationship to the account\'s company.
data GetAccountsAccountPersonsParametersQueryRelationship' = GetAccountsAccountPersonsParametersQueryRelationship'
  { -- | director
    GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Director :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | executive
    GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Executive :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | owner
    GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Owner :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | representative
    GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Representative :: (GHC.Maybe.Maybe GHC.Types.Bool)
  }
  deriving
    ( Int
-> GetAccountsAccountPersonsParametersQueryRelationship'
-> String
-> String
[GetAccountsAccountPersonsParametersQueryRelationship']
-> String -> String
GetAccountsAccountPersonsParametersQueryRelationship' -> String
(Int
 -> GetAccountsAccountPersonsParametersQueryRelationship'
 -> String
 -> String)
-> (GetAccountsAccountPersonsParametersQueryRelationship'
    -> String)
-> ([GetAccountsAccountPersonsParametersQueryRelationship']
    -> String -> String)
-> Show GetAccountsAccountPersonsParametersQueryRelationship'
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [GetAccountsAccountPersonsParametersQueryRelationship']
-> String -> String
$cshowList :: [GetAccountsAccountPersonsParametersQueryRelationship']
-> String -> String
show :: GetAccountsAccountPersonsParametersQueryRelationship' -> String
$cshow :: GetAccountsAccountPersonsParametersQueryRelationship' -> String
showsPrec :: Int
-> GetAccountsAccountPersonsParametersQueryRelationship'
-> String
-> String
$cshowsPrec :: Int
-> GetAccountsAccountPersonsParametersQueryRelationship'
-> String
-> String
GHC.Show.Show,
      GetAccountsAccountPersonsParametersQueryRelationship'
-> GetAccountsAccountPersonsParametersQueryRelationship' -> Bool
(GetAccountsAccountPersonsParametersQueryRelationship'
 -> GetAccountsAccountPersonsParametersQueryRelationship' -> Bool)
-> (GetAccountsAccountPersonsParametersQueryRelationship'
    -> GetAccountsAccountPersonsParametersQueryRelationship' -> Bool)
-> Eq GetAccountsAccountPersonsParametersQueryRelationship'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccountsAccountPersonsParametersQueryRelationship'
-> GetAccountsAccountPersonsParametersQueryRelationship' -> Bool
$c/= :: GetAccountsAccountPersonsParametersQueryRelationship'
-> GetAccountsAccountPersonsParametersQueryRelationship' -> Bool
== :: GetAccountsAccountPersonsParametersQueryRelationship'
-> GetAccountsAccountPersonsParametersQueryRelationship' -> Bool
$c== :: GetAccountsAccountPersonsParametersQueryRelationship'
-> GetAccountsAccountPersonsParametersQueryRelationship' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetAccountsAccountPersonsParametersQueryRelationship' where
  toJSON :: GetAccountsAccountPersonsParametersQueryRelationship' -> Value
toJSON GetAccountsAccountPersonsParametersQueryRelationship'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"director" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Director GetAccountsAccountPersonsParametersQueryRelationship'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"executive" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Executive GetAccountsAccountPersonsParametersQueryRelationship'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"owner" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Owner GetAccountsAccountPersonsParametersQueryRelationship'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"representative" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Representative GetAccountsAccountPersonsParametersQueryRelationship'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GetAccountsAccountPersonsParametersQueryRelationship' -> Encoding
toEncoding GetAccountsAccountPersonsParametersQueryRelationship'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"director" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Director GetAccountsAccountPersonsParametersQueryRelationship'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"executive" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Executive GetAccountsAccountPersonsParametersQueryRelationship'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"owner" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Owner GetAccountsAccountPersonsParametersQueryRelationship'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"representative" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GetAccountsAccountPersonsParametersQueryRelationship' -> Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Representative GetAccountsAccountPersonsParametersQueryRelationship'
obj))))

instance Data.Aeson.Types.FromJSON.FromJSON GetAccountsAccountPersonsParametersQueryRelationship' where
  parseJSON :: Value
-> Parser GetAccountsAccountPersonsParametersQueryRelationship'
parseJSON = String
-> (Object
    -> Parser GetAccountsAccountPersonsParametersQueryRelationship')
-> Value
-> Parser GetAccountsAccountPersonsParametersQueryRelationship'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GetAccountsAccountPersonsParametersQueryRelationship'" (\Object
obj -> ((((Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> GetAccountsAccountPersonsParametersQueryRelationship')
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> GetAccountsAccountPersonsParametersQueryRelationship')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> GetAccountsAccountPersonsParametersQueryRelationship'
GetAccountsAccountPersonsParametersQueryRelationship' Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> GetAccountsAccountPersonsParametersQueryRelationship')
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> GetAccountsAccountPersonsParametersQueryRelationship')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"director")) Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> GetAccountsAccountPersonsParametersQueryRelationship')
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> GetAccountsAccountPersonsParametersQueryRelationship')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"executive")) Parser
  (Maybe Bool
   -> Maybe Bool
   -> GetAccountsAccountPersonsParametersQueryRelationship')
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> GetAccountsAccountPersonsParametersQueryRelationship')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"owner")) Parser
  (Maybe Bool
   -> GetAccountsAccountPersonsParametersQueryRelationship')
-> Parser (Maybe Bool)
-> Parser GetAccountsAccountPersonsParametersQueryRelationship'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"representative"))

-- | Create a new 'GetAccountsAccountPersonsParametersQueryRelationship'' with all required fields.
mkGetAccountsAccountPersonsParametersQueryRelationship' :: GetAccountsAccountPersonsParametersQueryRelationship'
mkGetAccountsAccountPersonsParametersQueryRelationship' :: GetAccountsAccountPersonsParametersQueryRelationship'
mkGetAccountsAccountPersonsParametersQueryRelationship' =
  GetAccountsAccountPersonsParametersQueryRelationship' :: Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> GetAccountsAccountPersonsParametersQueryRelationship'
GetAccountsAccountPersonsParametersQueryRelationship'
    { getAccountsAccountPersonsParametersQueryRelationship'Director :: Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Director = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      getAccountsAccountPersonsParametersQueryRelationship'Executive :: Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Executive = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      getAccountsAccountPersonsParametersQueryRelationship'Owner :: Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Owner = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      getAccountsAccountPersonsParametersQueryRelationship'Representative :: Maybe Bool
getAccountsAccountPersonsParametersQueryRelationship'Representative = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
    }

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

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

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