{-# 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.SessionSync
    ( 

-- * Exported types
    SessionSync(..)                         ,
    IsSessionSync                           ,
    toSessionSync                           ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveSessionSyncMethod                ,
#endif


-- ** new #method:new#

    sessionSyncNew                          ,




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

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

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

foreign import ccall "soup_session_sync_get_type"
    c_soup_session_sync_get_type :: IO B.Types.GType

instance B.Types.TypedObject SessionSync where
    glibType :: IO GType
glibType = IO GType
c_soup_session_sync_get_type

instance B.Types.GObject SessionSync

-- | Convert 'SessionSync' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue SessionSync where
    toGValue :: SessionSync -> IO GValue
toGValue SessionSync
o = do
        GType
gtype <- IO GType
c_soup_session_sync_get_type
        SessionSync -> (Ptr SessionSync -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SessionSync
o (GType
-> (GValue -> Ptr SessionSync -> IO ())
-> Ptr SessionSync
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr SessionSync -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO SessionSync
fromGValue GValue
gv = do
        Ptr SessionSync
ptr <- GValue -> IO (Ptr SessionSync)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr SessionSync)
        (ManagedPtr SessionSync -> SessionSync)
-> Ptr SessionSync -> IO SessionSync
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr SessionSync -> SessionSync
SessionSync Ptr SessionSync
ptr
        
    

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

instance O.HasParentTypes SessionSync
type instance O.ParentTypes SessionSync = '[Soup.Session.Session, GObject.Object.Object]

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

#if defined(ENABLE_OVERLOADING)
type family ResolveSessionSyncMethod (t :: Symbol) (o :: *) :: * where
    ResolveSessionSyncMethod "abort" o = Soup.Session.SessionAbortMethodInfo
    ResolveSessionSyncMethod "addFeature" o = Soup.Session.SessionAddFeatureMethodInfo
    ResolveSessionSyncMethod "addFeatureByType" o = Soup.Session.SessionAddFeatureByTypeMethodInfo
    ResolveSessionSyncMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSessionSyncMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSessionSyncMethod "cancelMessage" o = Soup.Session.SessionCancelMessageMethodInfo
    ResolveSessionSyncMethod "connectAsync" o = Soup.Session.SessionConnectAsyncMethodInfo
    ResolveSessionSyncMethod "connectFinish" o = Soup.Session.SessionConnectFinishMethodInfo
    ResolveSessionSyncMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSessionSyncMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSessionSyncMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveSessionSyncMethod "hasFeature" o = Soup.Session.SessionHasFeatureMethodInfo
    ResolveSessionSyncMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSessionSyncMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSessionSyncMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSessionSyncMethod "pauseMessage" o = Soup.Session.SessionPauseMessageMethodInfo
    ResolveSessionSyncMethod "prefetchDns" o = Soup.Session.SessionPrefetchDnsMethodInfo
    ResolveSessionSyncMethod "prepareForUri" o = Soup.Session.SessionPrepareForUriMethodInfo
    ResolveSessionSyncMethod "queueMessage" o = Soup.Session.SessionQueueMessageMethodInfo
    ResolveSessionSyncMethod "redirectMessage" o = Soup.Session.SessionRedirectMessageMethodInfo
    ResolveSessionSyncMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSessionSyncMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSessionSyncMethod "removeFeature" o = Soup.Session.SessionRemoveFeatureMethodInfo
    ResolveSessionSyncMethod "removeFeatureByType" o = Soup.Session.SessionRemoveFeatureByTypeMethodInfo
    ResolveSessionSyncMethod "request" o = Soup.Session.SessionRequestMethodInfo
    ResolveSessionSyncMethod "requestHttp" o = Soup.Session.SessionRequestHttpMethodInfo
    ResolveSessionSyncMethod "requestHttpUri" o = Soup.Session.SessionRequestHttpUriMethodInfo
    ResolveSessionSyncMethod "requestUri" o = Soup.Session.SessionRequestUriMethodInfo
    ResolveSessionSyncMethod "requeueMessage" o = Soup.Session.SessionRequeueMessageMethodInfo
    ResolveSessionSyncMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSessionSyncMethod "send" o = Soup.Session.SessionSendMethodInfo
    ResolveSessionSyncMethod "sendAsync" o = Soup.Session.SessionSendAsyncMethodInfo
    ResolveSessionSyncMethod "sendFinish" o = Soup.Session.SessionSendFinishMethodInfo
    ResolveSessionSyncMethod "sendMessage" o = Soup.Session.SessionSendMessageMethodInfo
    ResolveSessionSyncMethod "stealConnection" o = Soup.Session.SessionStealConnectionMethodInfo
    ResolveSessionSyncMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSessionSyncMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSessionSyncMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSessionSyncMethod "unpauseMessage" o = Soup.Session.SessionUnpauseMessageMethodInfo
    ResolveSessionSyncMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSessionSyncMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSessionSyncMethod "websocketConnectAsync" o = Soup.Session.SessionWebsocketConnectAsyncMethodInfo
    ResolveSessionSyncMethod "websocketConnectFinish" o = Soup.Session.SessionWebsocketConnectFinishMethodInfo
    ResolveSessionSyncMethod "wouldRedirect" o = Soup.Session.SessionWouldRedirectMethodInfo
    ResolveSessionSyncMethod "getAsyncContext" o = Soup.Session.SessionGetAsyncContextMethodInfo
    ResolveSessionSyncMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSessionSyncMethod "getFeature" o = Soup.Session.SessionGetFeatureMethodInfo
    ResolveSessionSyncMethod "getFeatureForMessage" o = Soup.Session.SessionGetFeatureForMessageMethodInfo
    ResolveSessionSyncMethod "getFeatures" o = Soup.Session.SessionGetFeaturesMethodInfo
    ResolveSessionSyncMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSessionSyncMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSessionSyncMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSessionSyncMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveSessionSyncMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSessionSyncMethod l o = O.MethodResolutionFailed l o

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

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SessionSync
type instance O.AttributeList SessionSync = SessionSyncAttributeList
type SessionSyncAttributeList = ('[ '("acceptLanguage", Soup.Session.SessionAcceptLanguagePropertyInfo), '("acceptLanguageAuto", Soup.Session.SessionAcceptLanguageAutoPropertyInfo), '("asyncContext", Soup.Session.SessionAsyncContextPropertyInfo), '("httpAliases", Soup.Session.SessionHttpAliasesPropertyInfo), '("httpsAliases", Soup.Session.SessionHttpsAliasesPropertyInfo), '("idleTimeout", Soup.Session.SessionIdleTimeoutPropertyInfo), '("localAddress", Soup.Session.SessionLocalAddressPropertyInfo), '("maxConns", Soup.Session.SessionMaxConnsPropertyInfo), '("maxConnsPerHost", Soup.Session.SessionMaxConnsPerHostPropertyInfo), '("proxyResolver", Soup.Session.SessionProxyResolverPropertyInfo), '("proxyUri", Soup.Session.SessionProxyUriPropertyInfo), '("sslCaFile", Soup.Session.SessionSslCaFilePropertyInfo), '("sslStrict", Soup.Session.SessionSslStrictPropertyInfo), '("sslUseSystemCaFile", Soup.Session.SessionSslUseSystemCaFilePropertyInfo), '("timeout", Soup.Session.SessionTimeoutPropertyInfo), '("tlsDatabase", Soup.Session.SessionTlsDatabasePropertyInfo), '("tlsInteraction", Soup.Session.SessionTlsInteractionPropertyInfo), '("useNtlm", Soup.Session.SessionUseNtlmPropertyInfo), '("useThreadContext", Soup.Session.SessionUseThreadContextPropertyInfo), '("userAgent", Soup.Session.SessionUserAgentPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList SessionSync = SessionSyncSignalList
type SessionSyncSignalList = ('[ '("authenticate", Soup.Session.SessionAuthenticateSignalInfo), '("connectionCreated", Soup.Session.SessionConnectionCreatedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("requestQueued", Soup.Session.SessionRequestQueuedSignalInfo), '("requestStarted", Soup.Session.SessionRequestStartedSignalInfo), '("requestUnqueued", Soup.Session.SessionRequestUnqueuedSignalInfo), '("tunneling", Soup.Session.SessionTunnelingSignalInfo)] :: [(Symbol, *)])

#endif

-- method SessionSync::new
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Soup" , name = "SessionSync" })
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_sync_new" soup_session_sync_new :: 
    IO (Ptr SessionSync)

{-# DEPRECATED sessionSyncNew ["t'GI.Soup.Objects.SessionSync.SessionSync' is deprecated; use a plain","t'GI.Soup.Objects.Session.Session', created with 'GI.Soup.Objects.Session.sessionNew'. See the \\<link","linkend=\\\"libsoup-session-porting\\\">porting guide\\<\\/link>."] #-}
-- | Creates an synchronous t'GI.Soup.Objects.Session.Session' with the default options.
sessionSyncNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m SessionSync
    -- ^ __Returns:__ the new session.
sessionSyncNew :: m SessionSync
sessionSyncNew  = IO SessionSync -> m SessionSync
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SessionSync -> m SessionSync)
-> IO SessionSync -> m SessionSync
forall a b. (a -> b) -> a -> b
$ do
    Ptr SessionSync
result <- IO (Ptr SessionSync)
soup_session_sync_new
    Text -> Ptr SessionSync -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sessionSyncNew" Ptr SessionSync
result
    SessionSync
result' <- ((ManagedPtr SessionSync -> SessionSync)
-> Ptr SessionSync -> IO SessionSync
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SessionSync -> SessionSync
SessionSync) Ptr SessionSync
result
    SessionSync -> IO SessionSync
forall (m :: * -> *) a. Monad m => a -> m a
return SessionSync
result'

#if defined(ENABLE_OVERLOADING)
#endif