{-# 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 getRecipients module StripeAPI.Operations.GetRecipients 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/recipients -- -- \

Returns a list of your recipients. The recipients are returned sorted by creation date, with the most recently created recipients appearing first.\<\/p> getRecipients :: forall m. StripeAPI.Common.MonadHTTP m => -- | Contains all available parameters of this operation (query and path parameters) GetRecipientsParameters -> -- | Monadic computation which returns the result of the operation StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response GetRecipientsResponse) getRecipients parameters = GHC.Base.fmap ( \response_0 -> GHC.Base.fmap ( Data.Either.either GetRecipientsResponseError GHC.Base.id GHC.Base.. ( \response body -> if | (\status_1 -> Network.HTTP.Types.Status.statusCode status_1 GHC.Classes.== 200) (Network.HTTP.Client.Types.responseStatus response) -> GetRecipientsResponse200 Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String GetRecipientsResponseBody200 ) | GHC.Base.const GHC.Types.True (Network.HTTP.Client.Types.responseStatus response) -> GetRecipientsResponseDefault Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String Error ) | GHC.Base.otherwise -> Data.Either.Left "Missing default response type" ) response_0 ) response_0 ) ( StripeAPI.Common.doCallWithConfigurationM (Data.Text.toUpper GHC.Base.$ Data.Text.pack "GET") (Data.Text.pack "/v1/recipients") [ StripeAPI.Common.QueryParameter (Data.Text.pack "created") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getRecipientsParametersQueryCreated parameters) (Data.Text.pack "deepObject") GHC.Types.True, StripeAPI.Common.QueryParameter (Data.Text.pack "ending_before") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getRecipientsParametersQueryEndingBefore parameters) (Data.Text.pack "form") GHC.Types.True, StripeAPI.Common.QueryParameter (Data.Text.pack "expand") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getRecipientsParametersQueryExpand parameters) (Data.Text.pack "deepObject") GHC.Types.True, StripeAPI.Common.QueryParameter (Data.Text.pack "limit") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getRecipientsParametersQueryLimit parameters) (Data.Text.pack "form") GHC.Types.True, StripeAPI.Common.QueryParameter (Data.Text.pack "starting_after") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getRecipientsParametersQueryStartingAfter parameters) (Data.Text.pack "form") GHC.Types.True, StripeAPI.Common.QueryParameter (Data.Text.pack "type") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getRecipientsParametersQueryType parameters) (Data.Text.pack "form") GHC.Types.True, StripeAPI.Common.QueryParameter (Data.Text.pack "verified") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getRecipientsParametersQueryVerified parameters) (Data.Text.pack "form") GHC.Types.True ] ) -- | Defines the object schema located at @paths.\/v1\/recipients.GET.parameters@ in the specification. data GetRecipientsParameters = GetRecipientsParameters { -- | queryCreated: Represents the parameter named \'created\' getRecipientsParametersQueryCreated :: (GHC.Maybe.Maybe GetRecipientsParametersQueryCreated'Variants), -- | 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 getRecipientsParametersQueryEndingBefore :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | queryExpand: Represents the parameter named \'expand\' -- -- Specifies which fields in the response should be expanded. getRecipientsParametersQueryExpand :: (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. getRecipientsParametersQueryLimit :: (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 getRecipientsParametersQueryStartingAfter :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | queryType: Represents the parameter named \'type\' -- -- Constraints: -- -- * Maximum length of 5000 getRecipientsParametersQueryType :: (GHC.Maybe.Maybe GetRecipientsParametersQueryType'), -- | queryVerified: Represents the parameter named \'verified\' -- -- Only return recipients that are verified or unverified. getRecipientsParametersQueryVerified :: (GHC.Maybe.Maybe GHC.Types.Bool) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON GetRecipientsParameters where toJSON obj = Data.Aeson.Types.Internal.object ("queryCreated" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryCreated obj : "queryEnding_before" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryEndingBefore obj : "queryExpand" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryExpand obj : "queryLimit" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryLimit obj : "queryStarting_after" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryStartingAfter obj : "queryType" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryType obj : "queryVerified" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryVerified obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("queryCreated" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryCreated obj) GHC.Base.<> (("queryEnding_before" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryEndingBefore obj) GHC.Base.<> (("queryExpand" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryExpand obj) GHC.Base.<> (("queryLimit" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryLimit obj) GHC.Base.<> (("queryStarting_after" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryStartingAfter obj) GHC.Base.<> (("queryType" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryType obj) GHC.Base.<> ("queryVerified" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryVerified obj))))))) instance Data.Aeson.Types.FromJSON.FromJSON GetRecipientsParameters where parseJSON = Data.Aeson.Types.FromJSON.withObject "GetRecipientsParameters" (\obj -> ((((((GHC.Base.pure GetRecipientsParameters GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "queryCreated")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "queryEnding_before")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "queryExpand")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "queryLimit")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "queryStarting_after")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "queryType")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "queryVerified")) -- | Create a new 'GetRecipientsParameters' with all required fields. mkGetRecipientsParameters :: GetRecipientsParameters mkGetRecipientsParameters = GetRecipientsParameters { getRecipientsParametersQueryCreated = GHC.Maybe.Nothing, getRecipientsParametersQueryEndingBefore = GHC.Maybe.Nothing, getRecipientsParametersQueryExpand = GHC.Maybe.Nothing, getRecipientsParametersQueryLimit = GHC.Maybe.Nothing, getRecipientsParametersQueryStartingAfter = GHC.Maybe.Nothing, getRecipientsParametersQueryType = GHC.Maybe.Nothing, getRecipientsParametersQueryVerified = GHC.Maybe.Nothing } -- | Defines the object schema located at @paths.\/v1\/recipients.GET.parameters.properties.queryCreated.anyOf@ in the specification. data GetRecipientsParametersQueryCreated'OneOf1 = GetRecipientsParametersQueryCreated'OneOf1 { -- | gt getRecipientsParametersQueryCreated'OneOf1Gt :: (GHC.Maybe.Maybe GHC.Types.Int), -- | gte getRecipientsParametersQueryCreated'OneOf1Gte :: (GHC.Maybe.Maybe GHC.Types.Int), -- | lt getRecipientsParametersQueryCreated'OneOf1Lt :: (GHC.Maybe.Maybe GHC.Types.Int), -- | lte getRecipientsParametersQueryCreated'OneOf1Lte :: (GHC.Maybe.Maybe GHC.Types.Int) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON GetRecipientsParametersQueryCreated'OneOf1 where toJSON obj = Data.Aeson.Types.Internal.object ("gt" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryCreated'OneOf1Gt obj : "gte" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryCreated'OneOf1Gte obj : "lt" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryCreated'OneOf1Lt obj : "lte" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryCreated'OneOf1Lte obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("gt" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryCreated'OneOf1Gt obj) GHC.Base.<> (("gte" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryCreated'OneOf1Gte obj) GHC.Base.<> (("lt" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryCreated'OneOf1Lt obj) GHC.Base.<> ("lte" Data.Aeson.Types.ToJSON..= getRecipientsParametersQueryCreated'OneOf1Lte obj)))) instance Data.Aeson.Types.FromJSON.FromJSON GetRecipientsParametersQueryCreated'OneOf1 where parseJSON = Data.Aeson.Types.FromJSON.withObject "GetRecipientsParametersQueryCreated'OneOf1" (\obj -> (((GHC.Base.pure GetRecipientsParametersQueryCreated'OneOf1 GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "gt")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "gte")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "lt")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "lte")) -- | Create a new 'GetRecipientsParametersQueryCreated'OneOf1' with all required fields. mkGetRecipientsParametersQueryCreated'OneOf1 :: GetRecipientsParametersQueryCreated'OneOf1 mkGetRecipientsParametersQueryCreated'OneOf1 = GetRecipientsParametersQueryCreated'OneOf1 { getRecipientsParametersQueryCreated'OneOf1Gt = GHC.Maybe.Nothing, getRecipientsParametersQueryCreated'OneOf1Gte = GHC.Maybe.Nothing, getRecipientsParametersQueryCreated'OneOf1Lt = GHC.Maybe.Nothing, getRecipientsParametersQueryCreated'OneOf1Lte = GHC.Maybe.Nothing } -- | Defines the oneOf schema located at @paths.\/v1\/recipients.GET.parameters.properties.queryCreated.anyOf@ in the specification. -- -- Represents the parameter named \'created\' data GetRecipientsParametersQueryCreated'Variants = GetRecipientsParametersQueryCreated'GetRecipientsParametersQueryCreated'OneOf1 GetRecipientsParametersQueryCreated'OneOf1 | GetRecipientsParametersQueryCreated'Int GHC.Types.Int deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON GetRecipientsParametersQueryCreated'Variants where toJSON (GetRecipientsParametersQueryCreated'GetRecipientsParametersQueryCreated'OneOf1 a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (GetRecipientsParametersQueryCreated'Int a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON GetRecipientsParametersQueryCreated'Variants where parseJSON val = case (GetRecipientsParametersQueryCreated'GetRecipientsParametersQueryCreated'OneOf1 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((GetRecipientsParametersQueryCreated'Int Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched") of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | Defines the enum schema located at @paths.\/v1\/recipients.GET.parameters.properties.queryType@ in the specification. -- -- Represents the parameter named \'type\' data GetRecipientsParametersQueryType' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. GetRecipientsParametersQueryType'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. GetRecipientsParametersQueryType'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"corporation"@ GetRecipientsParametersQueryType'EnumCorporation | -- | Represents the JSON value @"individual"@ GetRecipientsParametersQueryType'EnumIndividual deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON GetRecipientsParametersQueryType' where toJSON (GetRecipientsParametersQueryType'Other val) = val toJSON (GetRecipientsParametersQueryType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (GetRecipientsParametersQueryType'EnumCorporation) = "corporation" toJSON (GetRecipientsParametersQueryType'EnumIndividual) = "individual" instance Data.Aeson.Types.FromJSON.FromJSON GetRecipientsParametersQueryType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "corporation" -> GetRecipientsParametersQueryType'EnumCorporation | val GHC.Classes.== "individual" -> GetRecipientsParametersQueryType'EnumIndividual | GHC.Base.otherwise -> GetRecipientsParametersQueryType'Other val ) -- | Represents a response of the operation 'getRecipients'. -- -- 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), 'GetRecipientsResponseError' is used. data GetRecipientsResponse = -- | Means either no matching case available or a parse error GetRecipientsResponseError GHC.Base.String | -- | Successful response. GetRecipientsResponse200 GetRecipientsResponseBody200 | -- | Error response. GetRecipientsResponseDefault Error deriving (GHC.Show.Show, GHC.Classes.Eq) -- | Defines the object schema located at @paths.\/v1\/recipients.GET.responses.200.content.application\/json.schema@ in the specification. data GetRecipientsResponseBody200 = GetRecipientsResponseBody200 { -- | data getRecipientsResponseBody200Data :: ([Recipient]), -- | has_more: True if this list has another page of items after this one that can be fetched. getRecipientsResponseBody200HasMore :: GHC.Types.Bool, -- | url: The URL where this list can be accessed. -- -- Constraints: -- -- * Maximum length of 5000 -- * Must match pattern \'^\/v1\/recipients\' getRecipientsResponseBody200Url :: Data.Text.Internal.Text } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON GetRecipientsResponseBody200 where toJSON obj = Data.Aeson.Types.Internal.object ("data" Data.Aeson.Types.ToJSON..= getRecipientsResponseBody200Data obj : "has_more" Data.Aeson.Types.ToJSON..= getRecipientsResponseBody200HasMore obj : "url" Data.Aeson.Types.ToJSON..= getRecipientsResponseBody200Url obj : "object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "list" : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("data" Data.Aeson.Types.ToJSON..= getRecipientsResponseBody200Data obj) GHC.Base.<> (("has_more" Data.Aeson.Types.ToJSON..= getRecipientsResponseBody200HasMore obj) GHC.Base.<> (("url" Data.Aeson.Types.ToJSON..= getRecipientsResponseBody200Url obj) GHC.Base.<> ("object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "list")))) instance Data.Aeson.Types.FromJSON.FromJSON GetRecipientsResponseBody200 where parseJSON = Data.Aeson.Types.FromJSON.withObject "GetRecipientsResponseBody200" (\obj -> ((GHC.Base.pure GetRecipientsResponseBody200 GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "data")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "has_more")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "url")) -- | Create a new 'GetRecipientsResponseBody200' with all required fields. mkGetRecipientsResponseBody200 :: -- | 'getRecipientsResponseBody200Data' [Recipient] -> -- | 'getRecipientsResponseBody200HasMore' GHC.Types.Bool -> -- | 'getRecipientsResponseBody200Url' Data.Text.Internal.Text -> GetRecipientsResponseBody200 mkGetRecipientsResponseBody200 getRecipientsResponseBody200Data getRecipientsResponseBody200HasMore getRecipientsResponseBody200Url = GetRecipientsResponseBody200 { getRecipientsResponseBody200Data = getRecipientsResponseBody200Data, getRecipientsResponseBody200HasMore = getRecipientsResponseBody200HasMore, getRecipientsResponseBody200Url = getRecipientsResponseBody200Url }