{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Soup.Objects.SessionSync
    ( 

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


 -- * Methods
-- ** 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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Soup.Objects.Session as Soup.Session

newtype SessionSync = SessionSync (ManagedPtr SessionSync)
foreign import ccall "soup_session_sync_get_type"
    c_soup_session_sync_get_type :: IO GType

instance GObject SessionSync where
    gobjectType _ = c_soup_session_sync_get_type
    

class GObject o => IsSessionSync o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError SessionSync a) =>
    IsSessionSync a
#endif
instance IsSessionSync SessionSync
instance Soup.Session.IsSession SessionSync
instance GObject.Object.IsObject SessionSync

toSessionSync :: IsSessionSync o => o -> IO SessionSync
toSessionSync = unsafeCastTo SessionSync

noSessionSync :: Maybe SessionSync
noSessionSync = Nothing

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 "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSessionSyncMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    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 "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveSessionSyncMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    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 "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSessionSyncMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSessionSyncMethod t SessionSync, O.MethodInfo info SessionSync p) => O.IsLabelProxy t (SessionSync -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveSessionSyncMethod t SessionSync, O.MethodInfo info SessionSync p) => O.IsLabel t (SessionSync -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

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, *)])

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, *)])

-- 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 ["'GI.Soup.Objects.SessionSync.SessionSync' is deprecated; use a plain","'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 'GI.Soup.Objects.Session.Session' with the default options.
-}
sessionSyncNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m SessionSync
    {- ^ __Returns:__ the new session. -}
sessionSyncNew  = liftIO $ do
    result <- soup_session_sync_new
    checkUnexpectedReturnNULL "sessionSyncNew" result
    result' <- (wrapObject SessionSync) result
    return result'