-- 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 #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE MultiWayIf #-}

-- | Contains the different functions to run the operation multiParamWithFixedEnum
module OpenAPI.Operations.MultiParamWithFixedEnum where

import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
import qualified Control.Monad.Fail
import qualified Control.Monad.Trans.Reader
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Decoding
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
import qualified Data.ByteString as Data.ByteString.Internal
import qualified Data.ByteString as Data.ByteString.Internal.Type
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 as 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 OpenAPI.Common
import OpenAPI.Types

-- | > GET /pet/multiparamwithfixedenum
-- 
-- Operation with multiple parameters
multiParamWithFixedEnum :: forall m . OpenAPI.Common.MonadHTTP m => MultiParamWithFixedEnumParameters -- ^ Contains all available parameters of this operation (query and path parameters)
  -> OpenAPI.Common.ClientT m (Network.HTTP.Client.Types.Response MultiParamWithFixedEnumResponse) -- ^ Monadic computation which returns the result of the operation
multiParamWithFixedEnum parameters = GHC.Base.fmap (\response_0 -> GHC.Base.fmap (Data.Either.either MultiParamWithFixedEnumResponseError 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) -> MultiParamWithFixedEnumResponse200 Data.Functor.<$> (Data.Aeson.Decoding.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String
                                                                                                                                                                                                                                                                                                                                                                                                                                                       Dog)
                                                                                                                                                                                       | GHC.Base.otherwise -> Data.Either.Left "Missing default response type") response_0) response_0) (OpenAPI.Common.doCallWithConfigurationM (Data.Text.toUpper GHC.Base.$ Data.Text.Internal.pack "GET") "/pet/multiparamwithfixedenum" [OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "fixedenumvalue") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON (multiParamWithFixedEnumParametersQueryFixedenumvalue parameters)) (Data.Text.Internal.pack "form") GHC.Types.False,
                                                                                                                                                                                                                                                                                                                                                                                                                               OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "other") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> multiParamWithFixedEnumParametersQueryOther parameters) (Data.Text.Internal.pack "form") GHC.Types.False])
-- | Defines the object schema located at @paths.\/pet\/multiparamwithfixedenum.GET.parameters@ in the specification.
-- 
-- 
data MultiParamWithFixedEnumParameters = MultiParamWithFixedEnumParameters {
  -- | queryFixedenumvalue: Represents the parameter named \'fixedenumvalue\'
  -- 
  -- A fixed value
  multiParamWithFixedEnumParametersQueryFixedenumvalue :: MultiParamWithFixedEnumParametersQueryFixedenumvalue
  -- | queryOther: Represents the parameter named \'other\'
  -- 
  -- Some other value
  , multiParamWithFixedEnumParametersQueryOther :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  } deriving (GHC.Show.Show
  , GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON MultiParamWithFixedEnumParameters
    where {toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (["queryFixedenumvalue" Data.Aeson.Types.ToJSON..= multiParamWithFixedEnumParametersQueryFixedenumvalue obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryOther" Data.Aeson.Types.ToJSON..=)) (multiParamWithFixedEnumParametersQueryOther obj) : GHC.Base.mempty));
           toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (["queryFixedenumvalue" Data.Aeson.Types.ToJSON..= multiParamWithFixedEnumParametersQueryFixedenumvalue obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryOther" Data.Aeson.Types.ToJSON..=)) (multiParamWithFixedEnumParametersQueryOther obj) : GHC.Base.mempty)))}
instance Data.Aeson.Types.FromJSON.FromJSON MultiParamWithFixedEnumParameters
    where {parseJSON = Data.Aeson.Types.FromJSON.withObject "MultiParamWithFixedEnumParameters" (\obj -> (GHC.Base.pure MultiParamWithFixedEnumParameters GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "queryFixedenumvalue")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "queryOther"))}
-- | Create a new 'MultiParamWithFixedEnumParameters' with all required fields.
mkMultiParamWithFixedEnumParameters :: MultiParamWithFixedEnumParametersQueryFixedenumvalue -- ^ 'multiParamWithFixedEnumParametersQueryFixedenumvalue'
  -> MultiParamWithFixedEnumParameters
mkMultiParamWithFixedEnumParameters multiParamWithFixedEnumParametersQueryFixedenumvalue = MultiParamWithFixedEnumParameters{multiParamWithFixedEnumParametersQueryFixedenumvalue = multiParamWithFixedEnumParametersQueryFixedenumvalue,
                                                                                                                             multiParamWithFixedEnumParametersQueryOther = GHC.Maybe.Nothing}
-- | Defines the enum schema located at @paths.\/pet\/multiparamwithfixedenum.GET.parameters.properties.queryFixedenumvalue@ in the specification.
-- 
-- Represents the parameter named \'fixedenumvalue\'
-- 
-- A fixed value
data MultiParamWithFixedEnumParametersQueryFixedenumvalue =
   MultiParamWithFixedEnumParametersQueryFixedenumvalueOther Data.Aeson.Types.Internal.Value -- ^ This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
  | MultiParamWithFixedEnumParametersQueryFixedenumvalueTyped Data.Text.Internal.Text -- ^ This constructor can be used to send values to the server which are not present in the specification yet.
  | MultiParamWithFixedEnumParametersQueryFixedenumvalueEnumThefixedvalue -- ^ Represents the JSON value @"thefixedvalue"@
  deriving (GHC.Show.Show, GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON MultiParamWithFixedEnumParametersQueryFixedenumvalue
    where {toJSON (MultiParamWithFixedEnumParametersQueryFixedenumvalueOther val) = val;
           toJSON (MultiParamWithFixedEnumParametersQueryFixedenumvalueTyped val) = Data.Aeson.Types.ToJSON.toJSON val;
           toJSON (MultiParamWithFixedEnumParametersQueryFixedenumvalueEnumThefixedvalue) = "thefixedvalue"}
instance Data.Aeson.Types.FromJSON.FromJSON MultiParamWithFixedEnumParametersQueryFixedenumvalue
    where {parseJSON val = GHC.Base.pure (if | val GHC.Classes.== "thefixedvalue" -> MultiParamWithFixedEnumParametersQueryFixedenumvalueEnumThefixedvalue
                                             | GHC.Base.otherwise -> MultiParamWithFixedEnumParametersQueryFixedenumvalueOther val)}
-- | Represents a response of the operation 'multiParamWithFixedEnum'.
-- 
-- 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), 'MultiParamWithFixedEnumResponseError' is used.
data MultiParamWithFixedEnumResponse =
   MultiParamWithFixedEnumResponseError GHC.Base.String -- ^ Means either no matching case available or a parse error
  | MultiParamWithFixedEnumResponse200 Dog -- ^ successful operation
  deriving (GHC.Show.Show, GHC.Classes.Eq)
-- | > GET /pet/multiparamwithfixedenum
-- 
-- The same as 'multiParamWithFixedEnum' but accepts an explicit configuration.
multiParamWithFixedEnumWithConfiguration :: forall m . OpenAPI.Common.MonadHTTP m => OpenAPI.Common.Configuration -- ^ The configuration to use in the request
  -> MultiParamWithFixedEnumParameters -- ^ Contains all available parameters of this operation (query and path parameters)
  -> m (Network.HTTP.Client.Types.Response MultiParamWithFixedEnumResponse) -- ^ Monadic computation which returns the result of the operation
multiParamWithFixedEnumWithConfiguration config
                                         parameters = GHC.Base.fmap (\response_2 -> GHC.Base.fmap (Data.Either.either MultiParamWithFixedEnumResponseError GHC.Base.id GHC.Base.. (\response body -> if | (\status_3 -> Network.HTTP.Types.Status.statusCode status_3 GHC.Classes.== 200) (Network.HTTP.Client.Types.responseStatus response) -> MultiParamWithFixedEnumResponse200 Data.Functor.<$> (Data.Aeson.Decoding.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Dog)
                                                                                                                                                                                                        | GHC.Base.otherwise -> Data.Either.Left "Missing default response type") response_2) response_2) (OpenAPI.Common.doCallWithConfiguration config (Data.Text.toUpper GHC.Base.$ Data.Text.Internal.pack "GET") "/pet/multiparamwithfixedenum" [OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "fixedenumvalue") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON (multiParamWithFixedEnumParametersQueryFixedenumvalue parameters)) (Data.Text.Internal.pack "form") GHC.Types.False,
                                                                                                                                                                                                                                                                                                                                                                                                                                                      OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "other") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> multiParamWithFixedEnumParametersQueryOther parameters) (Data.Text.Internal.pack "form") GHC.Types.False])
-- | > GET /pet/multiparamwithfixedenum
-- 
-- The same as 'multiParamWithFixedEnum' but returns the raw 'Data.ByteString.ByteString'.
multiParamWithFixedEnumRaw :: forall m . OpenAPI.Common.MonadHTTP m => MultiParamWithFixedEnumParameters -- ^ Contains all available parameters of this operation (query and path parameters)
  -> OpenAPI.Common.ClientT m (Network.HTTP.Client.Types.Response Data.ByteString.Internal.Type.ByteString) -- ^ Monadic computation which returns the result of the operation
multiParamWithFixedEnumRaw parameters = GHC.Base.id (OpenAPI.Common.doCallWithConfigurationM (Data.Text.toUpper GHC.Base.$ Data.Text.Internal.pack "GET") "/pet/multiparamwithfixedenum" [OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "fixedenumvalue") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON (multiParamWithFixedEnumParametersQueryFixedenumvalue parameters)) (Data.Text.Internal.pack "form") GHC.Types.False,
                                                                                                                                                                                          OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "other") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> multiParamWithFixedEnumParametersQueryOther parameters) (Data.Text.Internal.pack "form") GHC.Types.False])
-- | > GET /pet/multiparamwithfixedenum
-- 
-- The same as 'multiParamWithFixedEnum' but accepts an explicit configuration and returns the raw 'Data.ByteString.ByteString'.
multiParamWithFixedEnumWithConfigurationRaw :: forall m . OpenAPI.Common.MonadHTTP m => OpenAPI.Common.Configuration -- ^ The configuration to use in the request
  -> MultiParamWithFixedEnumParameters -- ^ Contains all available parameters of this operation (query and path parameters)
  -> m (Network.HTTP.Client.Types.Response Data.ByteString.Internal.Type.ByteString) -- ^ Monadic computation which returns the result of the operation
multiParamWithFixedEnumWithConfigurationRaw config
                                            parameters = GHC.Base.id (OpenAPI.Common.doCallWithConfiguration config (Data.Text.toUpper GHC.Base.$ Data.Text.Internal.pack "GET") "/pet/multiparamwithfixedenum" [OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "fixedenumvalue") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON (multiParamWithFixedEnumParametersQueryFixedenumvalue parameters)) (Data.Text.Internal.pack "form") GHC.Types.False,
                                                                                                                                                                                                                 OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "other") (Data.Aeson.Types.ToJSON.toJSON Data.Functor.<$> multiParamWithFixedEnumParametersQueryOther parameters) (Data.Text.Internal.pack "form") GHC.Types.False])
