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

-- | Contains the different functions to run the operation getChargesSearch
module StripeAPI.Operations.GetChargesSearch 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.Foldable
import qualified Data.Functor
import qualified Data.Maybe
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/charges/search
--
  \<p > Search for charges you ’ve previously created using Stripe ’s \<a href=\"\/docs\/search\#search - query - language\">Search Query Language\<\/a > .
-- Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating
  conditions , data is searchable in less than a minute . Occasionally , propagation of new or updated data can be up
  to an hour behind during outages . Search functionality is not available to merchants in India.\<\/p >
getChargesSearch ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | Contains all available parameters of this operation (query and path parameters)
  GetChargesSearchParameters ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response GetChargesSearchResponse)
getChargesSearch parameters =
  GHC.Base.fmap
    ( \response_0 ->
        GHC.Base.fmap
          ( Data.Either.either GetChargesSearchResponseError 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) ->
                                   GetChargesSearchResponse200
                                     Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetChargesSearchResponseBody200
                                                      )
                                 | GHC.Base.const GHC.Types.True (Network.HTTP.Client.Types.responseStatus response) ->
                                   GetChargesSearchResponseDefault
                                     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/charges/search")
        [ StripeAPI.Common.QueryParameter (Data.Text.pack "expand") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getChargesSearchParametersQueryExpand parameters) (Data.Text.pack "deepObject") GHC.Types.True,
          StripeAPI.Common.QueryParameter (Data.Text.pack "limit") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getChargesSearchParametersQueryLimit parameters) (Data.Text.pack "form") GHC.Types.True,
          StripeAPI.Common.QueryParameter (Data.Text.pack "page") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getChargesSearchParametersQueryPage parameters) (Data.Text.pack "form") GHC.Types.True,
          StripeAPI.Common.QueryParameter (Data.Text.pack "query") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON (getChargesSearchParametersQueryQuery parameters)) (Data.Text.pack "form") GHC.Types.True
        ]
    )

  | Defines the object schema located at @paths.\/v1\/charges\/search .  in the specification .
data GetChargesSearchParameters = GetChargesSearchParameters
  { -- | queryExpand: Represents the parameter named \'expand\'
    --
    -- Specifies which fields in the response should be expanded.
    getChargesSearchParametersQueryExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
  |  : 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 .
    getChargesSearchParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | queryPage: Represents the parameter named \'page\'
    --
  A cursor for pagination across multiple pages of results . Don\'t include this parameter on the first call . Use the next_page value returned in a previous response to request subsequent results .
    --
    -- Constraints:
    --
  * Maximum length of 5000
    getChargesSearchParametersQueryPage :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | queryQuery: Represents the parameter named \'query\'
    --
    -- The search query string. See [search query language](https:\/\/stripe.com\/docs\/search\#search-query-language) and the list of supported [query fields for charges](https:\/\/stripe.com\/docs\/search\#query-fields-for-charges).
    --
    -- Constraints:
    --
  * Maximum length of 5000
    getChargesSearchParametersQueryQuery :: Data.Text.Internal.Text
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetChargesSearchParameters where
  toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryExpand" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryExpand obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryLimit" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryLimit obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryPage" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryPage obj) : ["queryQuery" Data.Aeson.Types.ToJSON..= getChargesSearchParametersQueryQuery obj] : GHC.Base.mempty))
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryExpand" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryExpand obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryLimit" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryLimit obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryPage" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryPage obj) : ["queryQuery" Data.Aeson.Types.ToJSON..= getChargesSearchParametersQueryQuery obj] : GHC.Base.mempty)))

instance Data.Aeson.Types.FromJSON.FromJSON GetChargesSearchParameters where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "GetChargesSearchParameters" (\obj -> (((GHC.Base.pure GetChargesSearchParameters GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "queryExpand")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "queryLimit")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "queryPage")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "queryQuery"))

-- | Create a new 'GetChargesSearchParameters' with all required fields.
mkGetChargesSearchParameters ::
  -- | 'getChargesSearchParametersQueryQuery'
  Data.Text.Internal.Text ->
  GetChargesSearchParameters
mkGetChargesSearchParameters getChargesSearchParametersQueryQuery =
  GetChargesSearchParameters
    { getChargesSearchParametersQueryExpand = GHC.Maybe.Nothing,
      getChargesSearchParametersQueryLimit = GHC.Maybe.Nothing,
      getChargesSearchParametersQueryPage = GHC.Maybe.Nothing,
      getChargesSearchParametersQueryQuery = getChargesSearchParametersQueryQuery
    }

-- | Represents a response of the operation 'getChargesSearch'.
--
  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 ) , '  ' is used .
data GetChargesSearchResponse
  = -- | Means either no matching case available or a parse error
    GetChargesSearchResponseError GHC.Base.String
  | -- | Successful response.
    GetChargesSearchResponse200 GetChargesSearchResponseBody200
  | -- | Error response.
    GetChargesSearchResponseDefault Error
  deriving (GHC.Show.Show, GHC.Classes.Eq)

  | Defines the object schema located at @paths.\/v1\/charges\/search . GET.responses.200.content.application\/json.schema@ in the specification .
data GetChargesSearchResponseBody200 = GetChargesSearchResponseBody200
  { -- | data
    getChargesSearchResponseBody200Data :: ([Charge]),
    -- | has_more
    getChargesSearchResponseBody200HasMore :: GHC.Types.Bool,
    -- | next_page
    --
    -- Constraints:
    --
  * Maximum length of 5000
    getChargesSearchResponseBody200NextPage :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable Data.Text.Internal.Text)),
  | total_count : The total number of objects that match the query , only accurate up to 10,000 .
    getChargesSearchResponseBody200TotalCount :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | url
    --
    -- Constraints:
    --
  * Maximum length of 5000
    getChargesSearchResponseBody200Url :: Data.Text.Internal.Text
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetChargesSearchResponseBody200 where
  toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (["data" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200Data obj] : ["has_more" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200HasMore obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("next_page" Data.Aeson.Types.ToJSON..=)) (getChargesSearchResponseBody200NextPage obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("total_count" Data.Aeson.Types.ToJSON..=)) (getChargesSearchResponseBody200TotalCount obj) : ["url" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200Url obj] : ["object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "search_result"] : GHC.Base.mempty))
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (["data" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200Data obj] : ["has_more" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200HasMore obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("next_page" Data.Aeson.Types.ToJSON..=)) (getChargesSearchResponseBody200NextPage obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("total_count" Data.Aeson.Types.ToJSON..=)) (getChargesSearchResponseBody200TotalCount obj) : ["url" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200Url obj] : ["object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "search_result"] : GHC.Base.mempty)))

instance Data.Aeson.Types.FromJSON.FromJSON GetChargesSearchResponseBody200 where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "GetChargesSearchResponseBody200" (\obj -> ((((GHC.Base.pure GetChargesSearchResponseBody200 GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "data")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "has_more")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "next_page")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "total_count")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "url"))

  | Create a new '  ' with all required fields .
mkGetChargesSearchResponseBody200 ::
  -- | 'getChargesSearchResponseBody200Data'
  [Charge] ->
  -- | 'getChargesSearchResponseBody200HasMore'
  GHC.Types.Bool ->
  -- | 'getChargesSearchResponseBody200Url'
  Data.Text.Internal.Text ->
  GetChargesSearchResponseBody200
mkGetChargesSearchResponseBody200 getChargesSearchResponseBody200Data getChargesSearchResponseBody200HasMore getChargesSearchResponseBody200Url =
  GetChargesSearchResponseBody200
    { getChargesSearchResponseBody200Data = getChargesSearchResponseBody200Data,
      getChargesSearchResponseBody200HasMore = getChargesSearchResponseBody200HasMore,
      getChargesSearchResponseBody200NextPage = GHC.Maybe.Nothing,
      getChargesSearchResponseBody200TotalCount = GHC.Maybe.Nothing,
      getChargesSearchResponseBody200Url = getChargesSearchResponseBody200Url
    }

# LANGUAGE ExplicitForAll #
# LANGUAGE MultiWayIf #
# LANGUAGE OverloadedStrings #
 | Contains the different functions to run the operation getChargesSearch
 | > GET /v1/charges/search

 Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating
 | Contains all available parameters of this operation (query and path parameters)
 | Monadic computation which returns the result of the operation
 | queryExpand: Represents the parameter named \'expand\'

 Specifies which fields in the response should be expanded.

 | queryPage: Represents the parameter named \'page\'


 Constraints:

 | queryQuery: Represents the parameter named \'query\'

 The search query string. See [search query language](https:\/\/stripe.com\/docs\/search\#search-query-language) and the list of supported [query fields for charges](https:\/\/stripe.com\/docs\/search\#query-fields-for-charges).

 Constraints:

 | Create a new 'GetChargesSearchParameters' with all required fields.
 | 'getChargesSearchParametersQueryQuery'
 | Represents a response of the operation 'getChargesSearch'.

 | Means either no matching case available or a parse error
 | Successful response.
 | Error response.
 | data
 | has_more
 | next_page

 Constraints:

 | url

 Constraints:

 | 'getChargesSearchResponseBody200Data'
 | 'getChargesSearchResponseBody200HasMore'
 | 'getChargesSearchResponseBody200Url'
  CHANGE WITH CAUTION : This is a generated code file generated by -OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator .

module StripeAPI.Operations.GetChargesSearch 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.Foldable
import qualified Data.Functor
import qualified Data.Maybe
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

  \<p > Search for charges you ’ve previously created using Stripe ’s \<a href=\"\/docs\/search\#search - query - language\">Search Query Language\<\/a > .
  conditions , data is searchable in less than a minute . Occasionally , propagation of new or updated data can be up
  to an hour behind during outages . Search functionality is not available to merchants in India.\<\/p >
getChargesSearch ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  GetChargesSearchParameters ->
  StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response GetChargesSearchResponse)
getChargesSearch parameters =
  GHC.Base.fmap
    ( \response_0 ->
        GHC.Base.fmap
          ( Data.Either.either GetChargesSearchResponseError 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) ->
                                   GetChargesSearchResponse200
                                     Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            GetChargesSearchResponseBody200
                                                      )
                                 | GHC.Base.const GHC.Types.True (Network.HTTP.Client.Types.responseStatus response) ->
                                   GetChargesSearchResponseDefault
                                     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/charges/search")
        [ StripeAPI.Common.QueryParameter (Data.Text.pack "expand") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getChargesSearchParametersQueryExpand parameters) (Data.Text.pack "deepObject") GHC.Types.True,
          StripeAPI.Common.QueryParameter (Data.Text.pack "limit") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getChargesSearchParametersQueryLimit parameters) (Data.Text.pack "form") GHC.Types.True,
          StripeAPI.Common.QueryParameter (Data.Text.pack "page") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> getChargesSearchParametersQueryPage parameters) (Data.Text.pack "form") GHC.Types.True,
          StripeAPI.Common.QueryParameter (Data.Text.pack "query") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON (getChargesSearchParametersQueryQuery parameters)) (Data.Text.pack "form") GHC.Types.True
        ]
    )

  | Defines the object schema located at @paths.\/v1\/charges\/search .  in the specification .
data GetChargesSearchParameters = GetChargesSearchParameters
    getChargesSearchParametersQueryExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
  |  : 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 .
    getChargesSearchParametersQueryLimit :: (GHC.Maybe.Maybe GHC.Types.Int),
  A cursor for pagination across multiple pages of results . Don\'t include this parameter on the first call . Use the next_page value returned in a previous response to request subsequent results .
  * Maximum length of 5000
    getChargesSearchParametersQueryPage :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
  * Maximum length of 5000
    getChargesSearchParametersQueryQuery :: Data.Text.Internal.Text
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetChargesSearchParameters where
  toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryExpand" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryExpand obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryLimit" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryLimit obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryPage" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryPage obj) : ["queryQuery" Data.Aeson.Types.ToJSON..= getChargesSearchParametersQueryQuery obj] : GHC.Base.mempty))
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryExpand" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryExpand obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryLimit" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryLimit obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryPage" Data.Aeson.Types.ToJSON..=)) (getChargesSearchParametersQueryPage obj) : ["queryQuery" Data.Aeson.Types.ToJSON..= getChargesSearchParametersQueryQuery obj] : GHC.Base.mempty)))

instance Data.Aeson.Types.FromJSON.FromJSON GetChargesSearchParameters where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "GetChargesSearchParameters" (\obj -> (((GHC.Base.pure GetChargesSearchParameters GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "queryExpand")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "queryLimit")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "queryPage")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "queryQuery"))

mkGetChargesSearchParameters ::
  Data.Text.Internal.Text ->
  GetChargesSearchParameters
mkGetChargesSearchParameters getChargesSearchParametersQueryQuery =
  GetChargesSearchParameters
    { getChargesSearchParametersQueryExpand = GHC.Maybe.Nothing,
      getChargesSearchParametersQueryLimit = GHC.Maybe.Nothing,
      getChargesSearchParametersQueryPage = GHC.Maybe.Nothing,
      getChargesSearchParametersQueryQuery = getChargesSearchParametersQueryQuery
    }

  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 ) , '  ' is used .
data GetChargesSearchResponse
    GetChargesSearchResponseError GHC.Base.String
    GetChargesSearchResponse200 GetChargesSearchResponseBody200
    GetChargesSearchResponseDefault Error
  deriving (GHC.Show.Show, GHC.Classes.Eq)

  | Defines the object schema located at @paths.\/v1\/charges\/search . GET.responses.200.content.application\/json.schema@ in the specification .
data GetChargesSearchResponseBody200 = GetChargesSearchResponseBody200
    getChargesSearchResponseBody200Data :: ([Charge]),
    getChargesSearchResponseBody200HasMore :: GHC.Types.Bool,
  * Maximum length of 5000
    getChargesSearchResponseBody200NextPage :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable Data.Text.Internal.Text)),
  | total_count : The total number of objects that match the query , only accurate up to 10,000 .
    getChargesSearchResponseBody200TotalCount :: (GHC.Maybe.Maybe GHC.Types.Int),
  * Maximum length of 5000
    getChargesSearchResponseBody200Url :: Data.Text.Internal.Text
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GetChargesSearchResponseBody200 where
  toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (["data" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200Data obj] : ["has_more" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200HasMore obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("next_page" Data.Aeson.Types.ToJSON..=)) (getChargesSearchResponseBody200NextPage obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("total_count" Data.Aeson.Types.ToJSON..=)) (getChargesSearchResponseBody200TotalCount obj) : ["url" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200Url obj] : ["object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "search_result"] : GHC.Base.mempty))
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (["data" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200Data obj] : ["has_more" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200HasMore obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("next_page" Data.Aeson.Types.ToJSON..=)) (getChargesSearchResponseBody200NextPage obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("total_count" Data.Aeson.Types.ToJSON..=)) (getChargesSearchResponseBody200TotalCount obj) : ["url" Data.Aeson.Types.ToJSON..= getChargesSearchResponseBody200Url obj] : ["object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "search_result"] : GHC.Base.mempty)))

instance Data.Aeson.Types.FromJSON.FromJSON GetChargesSearchResponseBody200 where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "GetChargesSearchResponseBody200" (\obj -> ((((GHC.Base.pure GetChargesSearchResponseBody200 GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "data")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "has_more")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "next_page")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "total_count")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "url"))

  | Create a new '  ' with all required fields .
mkGetChargesSearchResponseBody200 ::
  [Charge] ->
  GHC.Types.Bool ->
  Data.Text.Internal.Text ->
  GetChargesSearchResponseBody200
mkGetChargesSearchResponseBody200 getChargesSearchResponseBody200Data getChargesSearchResponseBody200HasMore getChargesSearchResponseBody200Url =
  GetChargesSearchResponseBody200
    { getChargesSearchResponseBody200Data = getChargesSearchResponseBody200Data,
      getChargesSearchResponseBody200HasMore = getChargesSearchResponseBody200HasMore,
      getChargesSearchResponseBody200NextPage = GHC.Maybe.Nothing,
      getChargesSearchResponseBody200TotalCount = GHC.Maybe.Nothing,
      getChargesSearchResponseBody200Url = getChargesSearchResponseBody200Url
    }
