{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- SoupWebsocketExtensionManager is the t'GI.Soup.Interfaces.SessionFeature.SessionFeature' that handles WebSockets
-- extensions for a t'GI.Soup.Objects.Session.Session'.
-- 
-- A SoupWebsocketExtensionManager is added to the session by default, and normally
-- you don\'t need to worry about it at all. However, if you want to
-- disable WebSocket extensions, you can remove the feature from the
-- session with 'GI.Soup.Objects.Session.sessionRemoveFeatureByType', or disable it on
-- individual requests with 'GI.Soup.Objects.Message.messageDisableFeature'.
-- 
-- /Since: 2.68/

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

module GI.Soup.Objects.WebsocketExtensionManager
    ( 

-- * Exported types
    WebsocketExtensionManager(..)           ,
    IsWebsocketExtensionManager             ,
    toWebsocketExtensionManager             ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [addFeature]("GI.Soup.Interfaces.SessionFeature#g:method:addFeature"), [attach]("GI.Soup.Interfaces.SessionFeature#g:method:attach"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [detach]("GI.Soup.Interfaces.SessionFeature#g:method:detach"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [hasFeature]("GI.Soup.Interfaces.SessionFeature#g:method:hasFeature"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [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"), [removeFeature]("GI.Soup.Interfaces.SessionFeature#g:method:removeFeature"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [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"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== 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)
    ResolveWebsocketExtensionManagerMethod  ,
#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.Interfaces.SessionFeature as Soup.SessionFeature

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

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

foreign import ccall "soup_websocket_extension_manager_get_type"
    c_soup_websocket_extension_manager_get_type :: IO B.Types.GType

instance B.Types.TypedObject WebsocketExtensionManager where
    glibType :: IO GType
glibType = IO GType
c_soup_websocket_extension_manager_get_type

instance B.Types.GObject WebsocketExtensionManager

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

instance O.HasParentTypes WebsocketExtensionManager
type instance O.ParentTypes WebsocketExtensionManager = '[GObject.Object.Object, Soup.SessionFeature.SessionFeature]

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

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

#if defined(ENABLE_OVERLOADING)
type family ResolveWebsocketExtensionManagerMethod (t :: Symbol) (o :: *) :: * where
    ResolveWebsocketExtensionManagerMethod "addFeature" o = Soup.SessionFeature.SessionFeatureAddFeatureMethodInfo
    ResolveWebsocketExtensionManagerMethod "attach" o = Soup.SessionFeature.SessionFeatureAttachMethodInfo
    ResolveWebsocketExtensionManagerMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveWebsocketExtensionManagerMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveWebsocketExtensionManagerMethod "detach" o = Soup.SessionFeature.SessionFeatureDetachMethodInfo
    ResolveWebsocketExtensionManagerMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveWebsocketExtensionManagerMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveWebsocketExtensionManagerMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveWebsocketExtensionManagerMethod "hasFeature" o = Soup.SessionFeature.SessionFeatureHasFeatureMethodInfo
    ResolveWebsocketExtensionManagerMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveWebsocketExtensionManagerMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveWebsocketExtensionManagerMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveWebsocketExtensionManagerMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveWebsocketExtensionManagerMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveWebsocketExtensionManagerMethod "removeFeature" o = Soup.SessionFeature.SessionFeatureRemoveFeatureMethodInfo
    ResolveWebsocketExtensionManagerMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveWebsocketExtensionManagerMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveWebsocketExtensionManagerMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveWebsocketExtensionManagerMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveWebsocketExtensionManagerMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveWebsocketExtensionManagerMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveWebsocketExtensionManagerMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveWebsocketExtensionManagerMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveWebsocketExtensionManagerMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveWebsocketExtensionManagerMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveWebsocketExtensionManagerMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveWebsocketExtensionManagerMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveWebsocketExtensionManagerMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList WebsocketExtensionManager
type instance O.AttributeList WebsocketExtensionManager = WebsocketExtensionManagerAttributeList
type WebsocketExtensionManagerAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

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

#endif