{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Soup.Objects.AuthNegotiate
    ( 

-- * Exported types
    AuthNegotiate(..)                       ,
    IsAuthNegotiate                         ,
    toAuthNegotiate                         ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [authenticate]("GI.Soup.Objects.Auth#g:method:authenticate"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [canAuthenticate]("GI.Soup.Objects.Auth#g:method:canAuthenticate"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [hasSavedPassword]("GI.Soup.Objects.Auth#g:method:hasSavedPassword"), [isAuthenticated]("GI.Soup.Objects.Auth#g:method:isAuthenticated"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [isForProxy]("GI.Soup.Objects.Auth#g:method:isForProxy"), [isReady]("GI.Soup.Objects.Auth#g:method:isReady"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [savePassword]("GI.Soup.Objects.Auth#g:method:savePassword"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [update]("GI.Soup.Objects.Auth#g:method:update"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getAuthorization]("GI.Soup.Objects.Auth#g:method:getAuthorization"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getHost]("GI.Soup.Objects.Auth#g:method:getHost"), [getInfo]("GI.Soup.Objects.Auth#g:method:getInfo"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getProtectionSpace]("GI.Soup.Objects.Auth#g:method:getProtectionSpace"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getRealm]("GI.Soup.Objects.Auth#g:method:getRealm"), [getSavedPassword]("GI.Soup.Objects.Auth#g:method:getSavedPassword"), [getSavedUsers]("GI.Soup.Objects.Auth#g:method:getSavedUsers"), [getSchemeName]("GI.Soup.Objects.Auth#g:method:getSchemeName").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveAuthNegotiateMethod              ,
#endif

-- ** supported #method:supported#

    authNegotiateSupported                  ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GLib.Structs.MainContext as GLib.MainContext
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Enums as Gio.Enums
import qualified GI.Gio.Flags as Gio.Flags
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Interfaces.Initable as Gio.Initable
import qualified GI.Gio.Interfaces.ProxyResolver as Gio.ProxyResolver
import qualified GI.Gio.Interfaces.SocketConnectable as Gio.SocketConnectable
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.IOStream as Gio.IOStream
import qualified GI.Gio.Objects.InputStream as Gio.InputStream
import qualified GI.Gio.Objects.Socket as Gio.Socket
import qualified GI.Gio.Objects.SocketAddress as Gio.SocketAddress
import qualified GI.Gio.Objects.TlsCertificate as Gio.TlsCertificate
import qualified GI.Gio.Objects.TlsDatabase as Gio.TlsDatabase
import qualified GI.Gio.Objects.TlsInteraction as Gio.TlsInteraction
import qualified GI.Soup.Callbacks as Soup.Callbacks
import {-# SOURCE #-} qualified GI.Soup.Enums as Soup.Enums
import {-# SOURCE #-} qualified GI.Soup.Flags as Soup.Flags
import {-# SOURCE #-} qualified GI.Soup.Interfaces.SessionFeature as Soup.SessionFeature
import {-# SOURCE #-} qualified GI.Soup.Objects.Address as Soup.Address
import {-# SOURCE #-} qualified GI.Soup.Objects.Auth as Soup.Auth
import {-# SOURCE #-} qualified GI.Soup.Objects.Message as Soup.Message
import {-# SOURCE #-} qualified GI.Soup.Objects.Request as Soup.Request
import {-# SOURCE #-} qualified GI.Soup.Objects.RequestHTTP as Soup.RequestHTTP
import {-# SOURCE #-} qualified GI.Soup.Objects.Session as Soup.Session
import {-# SOURCE #-} qualified GI.Soup.Objects.Socket as Soup.Socket
import {-# SOURCE #-} qualified GI.Soup.Objects.WebsocketConnection as Soup.WebsocketConnection
import {-# SOURCE #-} qualified GI.Soup.Objects.WebsocketExtension as Soup.WebsocketExtension
import {-# SOURCE #-} qualified GI.Soup.Structs.Buffer as Soup.Buffer
import {-# SOURCE #-} qualified GI.Soup.Structs.MessageBody as Soup.MessageBody
import {-# SOURCE #-} qualified GI.Soup.Structs.MessageHeaders as Soup.MessageHeaders
import {-# SOURCE #-} qualified GI.Soup.Structs.Range as Soup.Range
import {-# SOURCE #-} qualified GI.Soup.Structs.URI as Soup.URI

#else
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Soup.Objects.Auth as Soup.Auth

#endif

-- | Memory-managed wrapper type.
newtype AuthNegotiate = AuthNegotiate (SP.ManagedPtr AuthNegotiate)
    deriving (AuthNegotiate -> AuthNegotiate -> Bool
(AuthNegotiate -> AuthNegotiate -> Bool)
-> (AuthNegotiate -> AuthNegotiate -> Bool) -> Eq AuthNegotiate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AuthNegotiate -> AuthNegotiate -> Bool
== :: AuthNegotiate -> AuthNegotiate -> Bool
$c/= :: AuthNegotiate -> AuthNegotiate -> Bool
/= :: AuthNegotiate -> AuthNegotiate -> Bool
Eq)

instance SP.ManagedPtrNewtype AuthNegotiate where
    toManagedPtr :: AuthNegotiate -> ManagedPtr AuthNegotiate
toManagedPtr (AuthNegotiate ManagedPtr AuthNegotiate
p) = ManagedPtr AuthNegotiate
p

foreign import ccall "soup_auth_negotiate_get_type"
    c_soup_auth_negotiate_get_type :: IO B.Types.GType

instance B.Types.TypedObject AuthNegotiate where
    glibType :: IO GType
glibType = IO GType
c_soup_auth_negotiate_get_type

instance B.Types.GObject AuthNegotiate

-- | Type class for types which can be safely cast to `AuthNegotiate`, for instance with `toAuthNegotiate`.
class (SP.GObject o, O.IsDescendantOf AuthNegotiate o) => IsAuthNegotiate o
instance (SP.GObject o, O.IsDescendantOf AuthNegotiate o) => IsAuthNegotiate o

instance O.HasParentTypes AuthNegotiate
type instance O.ParentTypes AuthNegotiate = '[Soup.Auth.Auth, GObject.Object.Object]

-- | Cast to `AuthNegotiate`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toAuthNegotiate :: (MIO.MonadIO m, IsAuthNegotiate o) => o -> m AuthNegotiate
toAuthNegotiate :: forall (m :: * -> *) o.
(MonadIO m, IsAuthNegotiate o) =>
o -> m AuthNegotiate
toAuthNegotiate = IO AuthNegotiate -> m AuthNegotiate
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO AuthNegotiate -> m AuthNegotiate)
-> (o -> IO AuthNegotiate) -> o -> m AuthNegotiate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr AuthNegotiate -> AuthNegotiate)
-> o -> IO AuthNegotiate
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr AuthNegotiate -> AuthNegotiate
AuthNegotiate

-- | Convert 'AuthNegotiate' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe AuthNegotiate) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_soup_auth_negotiate_get_type
    gvalueSet_ :: Ptr GValue -> Maybe AuthNegotiate -> IO ()
gvalueSet_ Ptr GValue
gv Maybe AuthNegotiate
P.Nothing = Ptr GValue -> Ptr AuthNegotiate -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr AuthNegotiate
forall a. Ptr a
FP.nullPtr :: FP.Ptr AuthNegotiate)
    gvalueSet_ Ptr GValue
gv (P.Just AuthNegotiate
obj) = AuthNegotiate -> (Ptr AuthNegotiate -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr AuthNegotiate
obj (Ptr GValue -> Ptr AuthNegotiate -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe AuthNegotiate)
gvalueGet_ Ptr GValue
gv = do
        Ptr AuthNegotiate
ptr <- Ptr GValue -> IO (Ptr AuthNegotiate)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr AuthNegotiate)
        if Ptr AuthNegotiate
ptr Ptr AuthNegotiate -> Ptr AuthNegotiate -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr AuthNegotiate
forall a. Ptr a
FP.nullPtr
        then AuthNegotiate -> Maybe AuthNegotiate
forall a. a -> Maybe a
P.Just (AuthNegotiate -> Maybe AuthNegotiate)
-> IO AuthNegotiate -> IO (Maybe AuthNegotiate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr AuthNegotiate -> AuthNegotiate)
-> Ptr AuthNegotiate -> IO AuthNegotiate
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr AuthNegotiate -> AuthNegotiate
AuthNegotiate Ptr AuthNegotiate
ptr
        else Maybe AuthNegotiate -> IO (Maybe AuthNegotiate)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe AuthNegotiate
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveAuthNegotiateMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveAuthNegotiateMethod "authenticate" o = Soup.Auth.AuthAuthenticateMethodInfo
    ResolveAuthNegotiateMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveAuthNegotiateMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveAuthNegotiateMethod "canAuthenticate" o = Soup.Auth.AuthCanAuthenticateMethodInfo
    ResolveAuthNegotiateMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveAuthNegotiateMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveAuthNegotiateMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveAuthNegotiateMethod "hasSavedPassword" o = Soup.Auth.AuthHasSavedPasswordMethodInfo
    ResolveAuthNegotiateMethod "isAuthenticated" o = Soup.Auth.AuthIsAuthenticatedMethodInfo
    ResolveAuthNegotiateMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveAuthNegotiateMethod "isForProxy" o = Soup.Auth.AuthIsForProxyMethodInfo
    ResolveAuthNegotiateMethod "isReady" o = Soup.Auth.AuthIsReadyMethodInfo
    ResolveAuthNegotiateMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveAuthNegotiateMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveAuthNegotiateMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveAuthNegotiateMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveAuthNegotiateMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveAuthNegotiateMethod "savePassword" o = Soup.Auth.AuthSavePasswordMethodInfo
    ResolveAuthNegotiateMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveAuthNegotiateMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveAuthNegotiateMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveAuthNegotiateMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveAuthNegotiateMethod "update" o = Soup.Auth.AuthUpdateMethodInfo
    ResolveAuthNegotiateMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveAuthNegotiateMethod "getAuthorization" o = Soup.Auth.AuthGetAuthorizationMethodInfo
    ResolveAuthNegotiateMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveAuthNegotiateMethod "getHost" o = Soup.Auth.AuthGetHostMethodInfo
    ResolveAuthNegotiateMethod "getInfo" o = Soup.Auth.AuthGetInfoMethodInfo
    ResolveAuthNegotiateMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveAuthNegotiateMethod "getProtectionSpace" o = Soup.Auth.AuthGetProtectionSpaceMethodInfo
    ResolveAuthNegotiateMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveAuthNegotiateMethod "getRealm" o = Soup.Auth.AuthGetRealmMethodInfo
    ResolveAuthNegotiateMethod "getSavedPassword" o = Soup.Auth.AuthGetSavedPasswordMethodInfo
    ResolveAuthNegotiateMethod "getSavedUsers" o = Soup.Auth.AuthGetSavedUsersMethodInfo
    ResolveAuthNegotiateMethod "getSchemeName" o = Soup.Auth.AuthGetSchemeNameMethodInfo
    ResolveAuthNegotiateMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveAuthNegotiateMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveAuthNegotiateMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveAuthNegotiateMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveAuthNegotiateMethod t AuthNegotiate, O.OverloadedMethod info AuthNegotiate p) => OL.IsLabel t (AuthNegotiate -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveAuthNegotiateMethod t AuthNegotiate, O.OverloadedMethod info AuthNegotiate p, R.HasField t AuthNegotiate p) => R.HasField t AuthNegotiate p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveAuthNegotiateMethod t AuthNegotiate, O.OverloadedMethodInfo info AuthNegotiate) => OL.IsLabel t (O.MethodProxy info AuthNegotiate) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList AuthNegotiate
type instance O.AttributeList AuthNegotiate = AuthNegotiateAttributeList
type AuthNegotiateAttributeList = ('[ '("host", Soup.Auth.AuthHostPropertyInfo), '("isAuthenticated", Soup.Auth.AuthIsAuthenticatedPropertyInfo), '("isForProxy", Soup.Auth.AuthIsForProxyPropertyInfo), '("realm", Soup.Auth.AuthRealmPropertyInfo), '("schemeName", Soup.Auth.AuthSchemeNamePropertyInfo)] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList AuthNegotiate = AuthNegotiateSignalList
type AuthNegotiateSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method AuthNegotiate::supported
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "soup_auth_negotiate_supported" soup_auth_negotiate_supported :: 
    IO CInt

-- | Indicates whether libsoup was built with GSSAPI support. If this is
-- 'P.False', @/SOUP_TYPE_AUTH_NEGOTIATE/@ will still be defined and can
-- still be added to a t'GI.Soup.Objects.Session.Session', but libsoup will never attempt to
-- actually use this auth type.
-- 
-- /Since: 2.54/
authNegotiateSupported ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
authNegotiateSupported :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Bool
authNegotiateSupported  = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CInt
result <- IO CInt
soup_auth_negotiate_supported
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
#endif