{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- 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.AuthBasic
    ( 

-- * Exported types
    AuthBasic(..)                           ,
    IsAuthBasic                             ,
    toAuthBasic                             ,


 -- * 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)
    ResolveAuthBasicMethod                  ,
#endif



    ) 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.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.Text as T
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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Soup.Objects.Auth as Soup.Auth

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

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

foreign import ccall "soup_auth_basic_get_type"
    c_soup_auth_basic_get_type :: IO B.Types.GType

instance B.Types.TypedObject AuthBasic where
    glibType :: IO GType
glibType = IO GType
c_soup_auth_basic_get_type

instance B.Types.GObject AuthBasic

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

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

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

-- | Convert 'AuthBasic' 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 AuthBasic) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_soup_auth_basic_get_type
    gvalueSet_ :: Ptr GValue -> Maybe AuthBasic -> IO ()
gvalueSet_ Ptr GValue
gv Maybe AuthBasic
P.Nothing = Ptr GValue -> Ptr AuthBasic -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr AuthBasic
forall a. Ptr a
FP.nullPtr :: FP.Ptr AuthBasic)
    gvalueSet_ Ptr GValue
gv (P.Just AuthBasic
obj) = AuthBasic -> (Ptr AuthBasic -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr AuthBasic
obj (Ptr GValue -> Ptr AuthBasic -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe AuthBasic)
gvalueGet_ Ptr GValue
gv = do
        Ptr AuthBasic
ptr <- Ptr GValue -> IO (Ptr AuthBasic)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr AuthBasic)
        if Ptr AuthBasic
ptr Ptr AuthBasic -> Ptr AuthBasic -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr AuthBasic
forall a. Ptr a
FP.nullPtr
        then AuthBasic -> Maybe AuthBasic
forall a. a -> Maybe a
P.Just (AuthBasic -> Maybe AuthBasic)
-> IO AuthBasic -> IO (Maybe AuthBasic)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr AuthBasic -> AuthBasic)
-> Ptr AuthBasic -> IO AuthBasic
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr AuthBasic -> AuthBasic
AuthBasic Ptr AuthBasic
ptr
        else Maybe AuthBasic -> IO (Maybe AuthBasic)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe AuthBasic
forall a. Maybe a
P.Nothing
        
    

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

instance (info ~ ResolveAuthBasicMethod t AuthBasic, O.OverloadedMethod info AuthBasic p) => OL.IsLabel t (AuthBasic -> 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 ~ ResolveAuthBasicMethod t AuthBasic, O.OverloadedMethod info AuthBasic p, R.HasField t AuthBasic p) => R.HasField t AuthBasic p where
    getField = O.overloadedMethod @info

#endif

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

#endif

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

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList AuthBasic = AuthBasicSignalList
type AuthBasicSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif