{- |
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.Session
    ( 

-- * Exported types
    Session(..)                             ,
    IsSession                               ,
    toSession                               ,
    noSession                               ,


 -- * Methods
-- ** abort #method:abort#
    SessionAbortMethodInfo                  ,
    sessionAbort                            ,


-- ** addFeature #method:addFeature#
    SessionAddFeatureMethodInfo             ,
    sessionAddFeature                       ,


-- ** addFeatureByType #method:addFeatureByType#
    SessionAddFeatureByTypeMethodInfo       ,
    sessionAddFeatureByType                 ,


-- ** cancelMessage #method:cancelMessage#
    SessionCancelMessageMethodInfo          ,
    sessionCancelMessage                    ,


-- ** getAsyncContext #method:getAsyncContext#
    SessionGetAsyncContextMethodInfo        ,
    sessionGetAsyncContext                  ,


-- ** getFeature #method:getFeature#
    SessionGetFeatureMethodInfo             ,
    sessionGetFeature                       ,


-- ** getFeatureForMessage #method:getFeatureForMessage#
    SessionGetFeatureForMessageMethodInfo   ,
    sessionGetFeatureForMessage             ,


-- ** getFeatures #method:getFeatures#
    SessionGetFeaturesMethodInfo            ,
    sessionGetFeatures                      ,


-- ** hasFeature #method:hasFeature#
    SessionHasFeatureMethodInfo             ,
    sessionHasFeature                       ,


-- ** new #method:new#
    sessionNew                              ,


-- ** pauseMessage #method:pauseMessage#
    SessionPauseMessageMethodInfo           ,
    sessionPauseMessage                     ,


-- ** prefetchDns #method:prefetchDns#
    SessionPrefetchDnsMethodInfo            ,
    sessionPrefetchDns                      ,


-- ** prepareForUri #method:prepareForUri#
    SessionPrepareForUriMethodInfo          ,
    sessionPrepareForUri                    ,


-- ** queueMessage #method:queueMessage#
    SessionQueueMessageMethodInfo           ,
    sessionQueueMessage                     ,


-- ** redirectMessage #method:redirectMessage#
    SessionRedirectMessageMethodInfo        ,
    sessionRedirectMessage                  ,


-- ** removeFeature #method:removeFeature#
    SessionRemoveFeatureMethodInfo          ,
    sessionRemoveFeature                    ,


-- ** removeFeatureByType #method:removeFeatureByType#
    SessionRemoveFeatureByTypeMethodInfo    ,
    sessionRemoveFeatureByType              ,


-- ** request #method:request#
    SessionRequestMethodInfo                ,
    sessionRequest                          ,


-- ** requestHttp #method:requestHttp#
    SessionRequestHttpMethodInfo            ,
    sessionRequestHttp                      ,


-- ** requestHttpUri #method:requestHttpUri#
    SessionRequestHttpUriMethodInfo         ,
    sessionRequestHttpUri                   ,


-- ** requestUri #method:requestUri#
    SessionRequestUriMethodInfo             ,
    sessionRequestUri                       ,


-- ** requeueMessage #method:requeueMessage#
    SessionRequeueMessageMethodInfo         ,
    sessionRequeueMessage                   ,


-- ** send #method:send#
    SessionSendMethodInfo                   ,
    sessionSend                             ,


-- ** sendAsync #method:sendAsync#
    SessionSendAsyncMethodInfo              ,
    sessionSendAsync                        ,


-- ** sendFinish #method:sendFinish#
    SessionSendFinishMethodInfo             ,
    sessionSendFinish                       ,


-- ** sendMessage #method:sendMessage#
    SessionSendMessageMethodInfo            ,
    sessionSendMessage                      ,


-- ** stealConnection #method:stealConnection#
    SessionStealConnectionMethodInfo        ,
    sessionStealConnection                  ,


-- ** unpauseMessage #method:unpauseMessage#
    SessionUnpauseMessageMethodInfo         ,
    sessionUnpauseMessage                   ,


-- ** websocketConnectAsync #method:websocketConnectAsync#
    SessionWebsocketConnectAsyncMethodInfo  ,
    sessionWebsocketConnectAsync            ,


-- ** websocketConnectFinish #method:websocketConnectFinish#
    SessionWebsocketConnectFinishMethodInfo ,
    sessionWebsocketConnectFinish           ,


-- ** wouldRedirect #method:wouldRedirect#
    SessionWouldRedirectMethodInfo          ,
    sessionWouldRedirect                    ,




 -- * Properties
-- ** acceptLanguage #attr:acceptLanguage#
    SessionAcceptLanguagePropertyInfo       ,
    clearSessionAcceptLanguage              ,
    constructSessionAcceptLanguage          ,
    getSessionAcceptLanguage                ,
    sessionAcceptLanguage                   ,
    setSessionAcceptLanguage                ,


-- ** acceptLanguageAuto #attr:acceptLanguageAuto#
    SessionAcceptLanguageAutoPropertyInfo   ,
    constructSessionAcceptLanguageAuto      ,
    getSessionAcceptLanguageAuto            ,
    sessionAcceptLanguageAuto               ,
    setSessionAcceptLanguageAuto            ,


-- ** asyncContext #attr:asyncContext#
    SessionAsyncContextPropertyInfo         ,
    constructSessionAsyncContext            ,
    getSessionAsyncContext                  ,
    sessionAsyncContext                     ,


-- ** httpAliases #attr:httpAliases#
    SessionHttpAliasesPropertyInfo          ,
    clearSessionHttpAliases                 ,
    constructSessionHttpAliases             ,
    getSessionHttpAliases                   ,
    sessionHttpAliases                      ,
    setSessionHttpAliases                   ,


-- ** httpsAliases #attr:httpsAliases#
    SessionHttpsAliasesPropertyInfo         ,
    clearSessionHttpsAliases                ,
    constructSessionHttpsAliases            ,
    getSessionHttpsAliases                  ,
    sessionHttpsAliases                     ,
    setSessionHttpsAliases                  ,


-- ** idleTimeout #attr:idleTimeout#
    SessionIdleTimeoutPropertyInfo          ,
    constructSessionIdleTimeout             ,
    getSessionIdleTimeout                   ,
    sessionIdleTimeout                      ,
    setSessionIdleTimeout                   ,


-- ** localAddress #attr:localAddress#
    SessionLocalAddressPropertyInfo         ,
    constructSessionLocalAddress            ,
    getSessionLocalAddress                  ,
    sessionLocalAddress                     ,


-- ** maxConns #attr:maxConns#
    SessionMaxConnsPropertyInfo             ,
    constructSessionMaxConns                ,
    getSessionMaxConns                      ,
    sessionMaxConns                         ,
    setSessionMaxConns                      ,


-- ** maxConnsPerHost #attr:maxConnsPerHost#
    SessionMaxConnsPerHostPropertyInfo      ,
    constructSessionMaxConnsPerHost         ,
    getSessionMaxConnsPerHost               ,
    sessionMaxConnsPerHost                  ,
    setSessionMaxConnsPerHost               ,


-- ** proxyResolver #attr:proxyResolver#
    SessionProxyResolverPropertyInfo        ,
    clearSessionProxyResolver               ,
    constructSessionProxyResolver           ,
    getSessionProxyResolver                 ,
    sessionProxyResolver                    ,
    setSessionProxyResolver                 ,


-- ** proxyUri #attr:proxyUri#
    SessionProxyUriPropertyInfo             ,
    clearSessionProxyUri                    ,
    constructSessionProxyUri                ,
    getSessionProxyUri                      ,
    sessionProxyUri                         ,
    setSessionProxyUri                      ,


-- ** sslCaFile #attr:sslCaFile#
    SessionSslCaFilePropertyInfo            ,
    clearSessionSslCaFile                   ,
    constructSessionSslCaFile               ,
    getSessionSslCaFile                     ,
    sessionSslCaFile                        ,
    setSessionSslCaFile                     ,


-- ** sslStrict #attr:sslStrict#
    SessionSslStrictPropertyInfo            ,
    constructSessionSslStrict               ,
    getSessionSslStrict                     ,
    sessionSslStrict                        ,
    setSessionSslStrict                     ,


-- ** sslUseSystemCaFile #attr:sslUseSystemCaFile#
    SessionSslUseSystemCaFilePropertyInfo   ,
    constructSessionSslUseSystemCaFile      ,
    getSessionSslUseSystemCaFile            ,
    sessionSslUseSystemCaFile               ,
    setSessionSslUseSystemCaFile            ,


-- ** timeout #attr:timeout#
    SessionTimeoutPropertyInfo              ,
    constructSessionTimeout                 ,
    getSessionTimeout                       ,
    sessionTimeout                          ,
    setSessionTimeout                       ,


-- ** tlsDatabase #attr:tlsDatabase#
    SessionTlsDatabasePropertyInfo          ,
    clearSessionTlsDatabase                 ,
    constructSessionTlsDatabase             ,
    getSessionTlsDatabase                   ,
    sessionTlsDatabase                      ,
    setSessionTlsDatabase                   ,


-- ** tlsInteraction #attr:tlsInteraction#
    SessionTlsInteractionPropertyInfo       ,
    clearSessionTlsInteraction              ,
    constructSessionTlsInteraction          ,
    getSessionTlsInteraction                ,
    sessionTlsInteraction                   ,
    setSessionTlsInteraction                ,


-- ** useNtlm #attr:useNtlm#
    SessionUseNtlmPropertyInfo              ,
    constructSessionUseNtlm                 ,
    getSessionUseNtlm                       ,
    sessionUseNtlm                          ,
    setSessionUseNtlm                       ,


-- ** useThreadContext #attr:useThreadContext#
    SessionUseThreadContextPropertyInfo     ,
    constructSessionUseThreadContext        ,
    getSessionUseThreadContext              ,
    sessionUseThreadContext                 ,
    setSessionUseThreadContext              ,


-- ** userAgent #attr:userAgent#
    SessionUserAgentPropertyInfo            ,
    clearSessionUserAgent                   ,
    constructSessionUserAgent               ,
    getSessionUserAgent                     ,
    sessionUserAgent                        ,
    setSessionUserAgent                     ,




 -- * Signals
-- ** authenticate #signal:authenticate#
    C_SessionAuthenticateCallback           ,
    SessionAuthenticateCallback             ,
    SessionAuthenticateSignalInfo           ,
    afterSessionAuthenticate                ,
    genClosure_SessionAuthenticate          ,
    mk_SessionAuthenticateCallback          ,
    noSessionAuthenticateCallback           ,
    onSessionAuthenticate                   ,
    wrap_SessionAuthenticateCallback        ,


-- ** connectionCreated #signal:connectionCreated#
    C_SessionConnectionCreatedCallback      ,
    SessionConnectionCreatedCallback        ,
    SessionConnectionCreatedSignalInfo      ,
    afterSessionConnectionCreated           ,
    genClosure_SessionConnectionCreated     ,
    mk_SessionConnectionCreatedCallback     ,
    noSessionConnectionCreatedCallback      ,
    onSessionConnectionCreated              ,
    wrap_SessionConnectionCreatedCallback   ,


-- ** requestQueued #signal:requestQueued#
    C_SessionRequestQueuedCallback          ,
    SessionRequestQueuedCallback            ,
    SessionRequestQueuedSignalInfo          ,
    afterSessionRequestQueued               ,
    genClosure_SessionRequestQueued         ,
    mk_SessionRequestQueuedCallback         ,
    noSessionRequestQueuedCallback          ,
    onSessionRequestQueued                  ,
    wrap_SessionRequestQueuedCallback       ,


-- ** requestStarted #signal:requestStarted#
    C_SessionRequestStartedCallback         ,
    SessionRequestStartedCallback           ,
    SessionRequestStartedSignalInfo         ,
    afterSessionRequestStarted              ,
    genClosure_SessionRequestStarted        ,
    mk_SessionRequestStartedCallback        ,
    noSessionRequestStartedCallback         ,
    onSessionRequestStarted                 ,
    wrap_SessionRequestStartedCallback      ,


-- ** requestUnqueued #signal:requestUnqueued#
    C_SessionRequestUnqueuedCallback        ,
    SessionRequestUnqueuedCallback          ,
    SessionRequestUnqueuedSignalInfo        ,
    afterSessionRequestUnqueued             ,
    genClosure_SessionRequestUnqueued       ,
    mk_SessionRequestUnqueuedCallback       ,
    noSessionRequestUnqueuedCallback        ,
    onSessionRequestUnqueued                ,
    wrap_SessionRequestUnqueuedCallback     ,


-- ** tunneling #signal:tunneling#
    C_SessionTunnelingCallback              ,
    SessionTunnelingCallback                ,
    SessionTunnelingSignalInfo              ,
    afterSessionTunneling                   ,
    genClosure_SessionTunneling             ,
    mk_SessionTunnelingCallback             ,
    noSessionTunnelingCallback              ,
    onSessionTunneling                      ,
    wrap_SessionTunnelingCallback           ,




    ) 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.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.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Interfaces.ProxyResolver as Gio.ProxyResolver
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.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.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.Socket as Soup.Socket
import {-# SOURCE #-} qualified GI.Soup.Objects.WebsocketConnection as Soup.WebsocketConnection
import {-# SOURCE #-} qualified GI.Soup.Structs.URI as Soup.URI

newtype Session = Session (ManagedPtr Session)
foreign import ccall "soup_session_get_type"
    c_soup_session_get_type :: IO GType

instance GObject Session where
    gobjectType _ = c_soup_session_get_type
    

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

toSession :: IsSession o => o -> IO Session
toSession = unsafeCastTo Session

noSession :: Maybe Session
noSession = Nothing

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

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

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

-- signal Session::authenticate
type SessionAuthenticateCallback =
    Soup.Message.Message ->
    Soup.Auth.Auth ->
    Bool ->
    IO ()

noSessionAuthenticateCallback :: Maybe SessionAuthenticateCallback
noSessionAuthenticateCallback = Nothing

type C_SessionAuthenticateCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr Soup.Auth.Auth ->
    CInt ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_SessionAuthenticateCallback :: C_SessionAuthenticateCallback -> IO (FunPtr C_SessionAuthenticateCallback)

genClosure_SessionAuthenticate :: SessionAuthenticateCallback -> IO Closure
genClosure_SessionAuthenticate cb = do
    let cb' = wrap_SessionAuthenticateCallback cb
    mk_SessionAuthenticateCallback cb' >>= newCClosure


wrap_SessionAuthenticateCallback ::
    SessionAuthenticateCallback ->
    Ptr () ->
    Ptr Soup.Message.Message ->
    Ptr Soup.Auth.Auth ->
    CInt ->
    Ptr () ->
    IO ()
wrap_SessionAuthenticateCallback _cb _ msg auth retrying _ = do
    msg' <- (newObject Soup.Message.Message) msg
    auth' <- (newObject Soup.Auth.Auth) auth
    let retrying' = (/= 0) retrying
    _cb  msg' auth' retrying'


onSessionAuthenticate :: (GObject a, MonadIO m) => a -> SessionAuthenticateCallback -> m SignalHandlerId
onSessionAuthenticate obj cb = liftIO $ connectSessionAuthenticate obj cb SignalConnectBefore
afterSessionAuthenticate :: (GObject a, MonadIO m) => a -> SessionAuthenticateCallback -> m SignalHandlerId
afterSessionAuthenticate obj cb = connectSessionAuthenticate obj cb SignalConnectAfter

connectSessionAuthenticate :: (GObject a, MonadIO m) =>
                              a -> SessionAuthenticateCallback -> SignalConnectMode -> m SignalHandlerId
connectSessionAuthenticate obj cb after = liftIO $ do
    let cb' = wrap_SessionAuthenticateCallback cb
    cb'' <- mk_SessionAuthenticateCallback cb'
    connectSignalFunPtr obj "authenticate" cb'' after

-- signal Session::connection-created
type SessionConnectionCreatedCallback =
    GObject.Object.Object ->
    IO ()

noSessionConnectionCreatedCallback :: Maybe SessionConnectionCreatedCallback
noSessionConnectionCreatedCallback = Nothing

type C_SessionConnectionCreatedCallback =
    Ptr () ->                               -- object
    Ptr GObject.Object.Object ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_SessionConnectionCreatedCallback :: C_SessionConnectionCreatedCallback -> IO (FunPtr C_SessionConnectionCreatedCallback)

genClosure_SessionConnectionCreated :: SessionConnectionCreatedCallback -> IO Closure
genClosure_SessionConnectionCreated cb = do
    let cb' = wrap_SessionConnectionCreatedCallback cb
    mk_SessionConnectionCreatedCallback cb' >>= newCClosure


wrap_SessionConnectionCreatedCallback ::
    SessionConnectionCreatedCallback ->
    Ptr () ->
    Ptr GObject.Object.Object ->
    Ptr () ->
    IO ()
wrap_SessionConnectionCreatedCallback _cb _ connection _ = do
    connection' <- (newObject GObject.Object.Object) connection
    _cb  connection'


onSessionConnectionCreated :: (GObject a, MonadIO m) => a -> SessionConnectionCreatedCallback -> m SignalHandlerId
onSessionConnectionCreated obj cb = liftIO $ connectSessionConnectionCreated obj cb SignalConnectBefore
afterSessionConnectionCreated :: (GObject a, MonadIO m) => a -> SessionConnectionCreatedCallback -> m SignalHandlerId
afterSessionConnectionCreated obj cb = connectSessionConnectionCreated obj cb SignalConnectAfter

connectSessionConnectionCreated :: (GObject a, MonadIO m) =>
                                   a -> SessionConnectionCreatedCallback -> SignalConnectMode -> m SignalHandlerId
connectSessionConnectionCreated obj cb after = liftIO $ do
    let cb' = wrap_SessionConnectionCreatedCallback cb
    cb'' <- mk_SessionConnectionCreatedCallback cb'
    connectSignalFunPtr obj "connection-created" cb'' after

-- signal Session::request-queued
type SessionRequestQueuedCallback =
    Soup.Message.Message ->
    IO ()

noSessionRequestQueuedCallback :: Maybe SessionRequestQueuedCallback
noSessionRequestQueuedCallback = Nothing

type C_SessionRequestQueuedCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_SessionRequestQueuedCallback :: C_SessionRequestQueuedCallback -> IO (FunPtr C_SessionRequestQueuedCallback)

genClosure_SessionRequestQueued :: SessionRequestQueuedCallback -> IO Closure
genClosure_SessionRequestQueued cb = do
    let cb' = wrap_SessionRequestQueuedCallback cb
    mk_SessionRequestQueuedCallback cb' >>= newCClosure


wrap_SessionRequestQueuedCallback ::
    SessionRequestQueuedCallback ->
    Ptr () ->
    Ptr Soup.Message.Message ->
    Ptr () ->
    IO ()
wrap_SessionRequestQueuedCallback _cb _ msg _ = do
    msg' <- (newObject Soup.Message.Message) msg
    _cb  msg'


onSessionRequestQueued :: (GObject a, MonadIO m) => a -> SessionRequestQueuedCallback -> m SignalHandlerId
onSessionRequestQueued obj cb = liftIO $ connectSessionRequestQueued obj cb SignalConnectBefore
afterSessionRequestQueued :: (GObject a, MonadIO m) => a -> SessionRequestQueuedCallback -> m SignalHandlerId
afterSessionRequestQueued obj cb = connectSessionRequestQueued obj cb SignalConnectAfter

connectSessionRequestQueued :: (GObject a, MonadIO m) =>
                               a -> SessionRequestQueuedCallback -> SignalConnectMode -> m SignalHandlerId
connectSessionRequestQueued obj cb after = liftIO $ do
    let cb' = wrap_SessionRequestQueuedCallback cb
    cb'' <- mk_SessionRequestQueuedCallback cb'
    connectSignalFunPtr obj "request-queued" cb'' after

-- signal Session::request-started
{-# DEPRECATED SessionRequestStartedCallback ["(Since version 2.50.)","Use 'GI.Soup.Objects.Message.Message'::@/starting/@ instead."] #-}
type SessionRequestStartedCallback =
    Soup.Message.Message ->
    Soup.Socket.Socket ->
    IO ()

noSessionRequestStartedCallback :: Maybe SessionRequestStartedCallback
noSessionRequestStartedCallback = Nothing

type C_SessionRequestStartedCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr Soup.Socket.Socket ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_SessionRequestStartedCallback :: C_SessionRequestStartedCallback -> IO (FunPtr C_SessionRequestStartedCallback)

genClosure_SessionRequestStarted :: SessionRequestStartedCallback -> IO Closure
genClosure_SessionRequestStarted cb = do
    let cb' = wrap_SessionRequestStartedCallback cb
    mk_SessionRequestStartedCallback cb' >>= newCClosure


wrap_SessionRequestStartedCallback ::
    SessionRequestStartedCallback ->
    Ptr () ->
    Ptr Soup.Message.Message ->
    Ptr Soup.Socket.Socket ->
    Ptr () ->
    IO ()
wrap_SessionRequestStartedCallback _cb _ msg socket _ = do
    msg' <- (newObject Soup.Message.Message) msg
    socket' <- (newObject Soup.Socket.Socket) socket
    _cb  msg' socket'


onSessionRequestStarted :: (GObject a, MonadIO m) => a -> SessionRequestStartedCallback -> m SignalHandlerId
onSessionRequestStarted obj cb = liftIO $ connectSessionRequestStarted obj cb SignalConnectBefore
afterSessionRequestStarted :: (GObject a, MonadIO m) => a -> SessionRequestStartedCallback -> m SignalHandlerId
afterSessionRequestStarted obj cb = connectSessionRequestStarted obj cb SignalConnectAfter

connectSessionRequestStarted :: (GObject a, MonadIO m) =>
                                a -> SessionRequestStartedCallback -> SignalConnectMode -> m SignalHandlerId
connectSessionRequestStarted obj cb after = liftIO $ do
    let cb' = wrap_SessionRequestStartedCallback cb
    cb'' <- mk_SessionRequestStartedCallback cb'
    connectSignalFunPtr obj "request-started" cb'' after

-- signal Session::request-unqueued
type SessionRequestUnqueuedCallback =
    Soup.Message.Message ->
    IO ()

noSessionRequestUnqueuedCallback :: Maybe SessionRequestUnqueuedCallback
noSessionRequestUnqueuedCallback = Nothing

type C_SessionRequestUnqueuedCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_SessionRequestUnqueuedCallback :: C_SessionRequestUnqueuedCallback -> IO (FunPtr C_SessionRequestUnqueuedCallback)

genClosure_SessionRequestUnqueued :: SessionRequestUnqueuedCallback -> IO Closure
genClosure_SessionRequestUnqueued cb = do
    let cb' = wrap_SessionRequestUnqueuedCallback cb
    mk_SessionRequestUnqueuedCallback cb' >>= newCClosure


wrap_SessionRequestUnqueuedCallback ::
    SessionRequestUnqueuedCallback ->
    Ptr () ->
    Ptr Soup.Message.Message ->
    Ptr () ->
    IO ()
wrap_SessionRequestUnqueuedCallback _cb _ msg _ = do
    msg' <- (newObject Soup.Message.Message) msg
    _cb  msg'


onSessionRequestUnqueued :: (GObject a, MonadIO m) => a -> SessionRequestUnqueuedCallback -> m SignalHandlerId
onSessionRequestUnqueued obj cb = liftIO $ connectSessionRequestUnqueued obj cb SignalConnectBefore
afterSessionRequestUnqueued :: (GObject a, MonadIO m) => a -> SessionRequestUnqueuedCallback -> m SignalHandlerId
afterSessionRequestUnqueued obj cb = connectSessionRequestUnqueued obj cb SignalConnectAfter

connectSessionRequestUnqueued :: (GObject a, MonadIO m) =>
                                 a -> SessionRequestUnqueuedCallback -> SignalConnectMode -> m SignalHandlerId
connectSessionRequestUnqueued obj cb after = liftIO $ do
    let cb' = wrap_SessionRequestUnqueuedCallback cb
    cb'' <- mk_SessionRequestUnqueuedCallback cb'
    connectSignalFunPtr obj "request-unqueued" cb'' after

-- signal Session::tunneling
type SessionTunnelingCallback =
    GObject.Object.Object ->
    IO ()

noSessionTunnelingCallback :: Maybe SessionTunnelingCallback
noSessionTunnelingCallback = Nothing

type C_SessionTunnelingCallback =
    Ptr () ->                               -- object
    Ptr GObject.Object.Object ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_SessionTunnelingCallback :: C_SessionTunnelingCallback -> IO (FunPtr C_SessionTunnelingCallback)

genClosure_SessionTunneling :: SessionTunnelingCallback -> IO Closure
genClosure_SessionTunneling cb = do
    let cb' = wrap_SessionTunnelingCallback cb
    mk_SessionTunnelingCallback cb' >>= newCClosure


wrap_SessionTunnelingCallback ::
    SessionTunnelingCallback ->
    Ptr () ->
    Ptr GObject.Object.Object ->
    Ptr () ->
    IO ()
wrap_SessionTunnelingCallback _cb _ connection _ = do
    connection' <- (newObject GObject.Object.Object) connection
    _cb  connection'


onSessionTunneling :: (GObject a, MonadIO m) => a -> SessionTunnelingCallback -> m SignalHandlerId
onSessionTunneling obj cb = liftIO $ connectSessionTunneling obj cb SignalConnectBefore
afterSessionTunneling :: (GObject a, MonadIO m) => a -> SessionTunnelingCallback -> m SignalHandlerId
afterSessionTunneling obj cb = connectSessionTunneling obj cb SignalConnectAfter

connectSessionTunneling :: (GObject a, MonadIO m) =>
                           a -> SessionTunnelingCallback -> SignalConnectMode -> m SignalHandlerId
connectSessionTunneling obj cb after = liftIO $ do
    let cb' = wrap_SessionTunnelingCallback cb
    cb'' <- mk_SessionTunnelingCallback cb'
    connectSignalFunPtr obj "tunneling" cb'' after

-- VVV Prop "accept-language"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionAcceptLanguage :: (MonadIO m, IsSession o) => o -> m (Maybe T.Text)
getSessionAcceptLanguage obj = liftIO $ getObjectPropertyString obj "accept-language"

setSessionAcceptLanguage :: (MonadIO m, IsSession o) => o -> T.Text -> m ()
setSessionAcceptLanguage obj val = liftIO $ setObjectPropertyString obj "accept-language" (Just val)

constructSessionAcceptLanguage :: (IsSession o) => T.Text -> IO (GValueConstruct o)
constructSessionAcceptLanguage val = constructObjectPropertyString "accept-language" (Just val)

clearSessionAcceptLanguage :: (MonadIO m, IsSession o) => o -> m ()
clearSessionAcceptLanguage obj = liftIO $ setObjectPropertyString obj "accept-language" (Nothing :: Maybe T.Text)

data SessionAcceptLanguagePropertyInfo
instance AttrInfo SessionAcceptLanguagePropertyInfo where
    type AttrAllowedOps SessionAcceptLanguagePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SessionAcceptLanguagePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint SessionAcceptLanguagePropertyInfo = IsSession
    type AttrGetType SessionAcceptLanguagePropertyInfo = (Maybe T.Text)
    type AttrLabel SessionAcceptLanguagePropertyInfo = "accept-language"
    type AttrOrigin SessionAcceptLanguagePropertyInfo = Session
    attrGet _ = getSessionAcceptLanguage
    attrSet _ = setSessionAcceptLanguage
    attrConstruct _ = constructSessionAcceptLanguage
    attrClear _ = clearSessionAcceptLanguage

-- VVV Prop "accept-language-auto"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionAcceptLanguageAuto :: (MonadIO m, IsSession o) => o -> m Bool
getSessionAcceptLanguageAuto obj = liftIO $ getObjectPropertyBool obj "accept-language-auto"

setSessionAcceptLanguageAuto :: (MonadIO m, IsSession o) => o -> Bool -> m ()
setSessionAcceptLanguageAuto obj val = liftIO $ setObjectPropertyBool obj "accept-language-auto" val

constructSessionAcceptLanguageAuto :: (IsSession o) => Bool -> IO (GValueConstruct o)
constructSessionAcceptLanguageAuto val = constructObjectPropertyBool "accept-language-auto" val

data SessionAcceptLanguageAutoPropertyInfo
instance AttrInfo SessionAcceptLanguageAutoPropertyInfo where
    type AttrAllowedOps SessionAcceptLanguageAutoPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SessionAcceptLanguageAutoPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint SessionAcceptLanguageAutoPropertyInfo = IsSession
    type AttrGetType SessionAcceptLanguageAutoPropertyInfo = Bool
    type AttrLabel SessionAcceptLanguageAutoPropertyInfo = "accept-language-auto"
    type AttrOrigin SessionAcceptLanguageAutoPropertyInfo = Session
    attrGet _ = getSessionAcceptLanguageAuto
    attrSet _ = setSessionAcceptLanguageAuto
    attrConstruct _ = constructSessionAcceptLanguageAuto
    attrClear _ = undefined

-- VVV Prop "async-context"
   -- Type: TBasicType TPtr
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

getSessionAsyncContext :: (MonadIO m, IsSession o) => o -> m (Ptr ())
getSessionAsyncContext obj = liftIO $ getObjectPropertyPtr obj "async-context"

constructSessionAsyncContext :: (IsSession o) => Ptr () -> IO (GValueConstruct o)
constructSessionAsyncContext val = constructObjectPropertyPtr "async-context" val

data SessionAsyncContextPropertyInfo
instance AttrInfo SessionAsyncContextPropertyInfo where
    type AttrAllowedOps SessionAsyncContextPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SessionAsyncContextPropertyInfo = (~) (Ptr ())
    type AttrBaseTypeConstraint SessionAsyncContextPropertyInfo = IsSession
    type AttrGetType SessionAsyncContextPropertyInfo = (Ptr ())
    type AttrLabel SessionAsyncContextPropertyInfo = "async-context"
    type AttrOrigin SessionAsyncContextPropertyInfo = Session
    attrGet _ = getSessionAsyncContext
    attrSet _ = undefined
    attrConstruct _ = constructSessionAsyncContext
    attrClear _ = undefined

-- VVV Prop "http-aliases"
   -- Type: TCArray True (-1) (-1) (TBasicType TUTF8)
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionHttpAliases :: (MonadIO m, IsSession o) => o -> m (Maybe [T.Text])
getSessionHttpAliases obj = liftIO $ getObjectPropertyStringArray obj "http-aliases"

setSessionHttpAliases :: (MonadIO m, IsSession o) => o -> [T.Text] -> m ()
setSessionHttpAliases obj val = liftIO $ setObjectPropertyStringArray obj "http-aliases" (Just val)

constructSessionHttpAliases :: (IsSession o) => [T.Text] -> IO (GValueConstruct o)
constructSessionHttpAliases val = constructObjectPropertyStringArray "http-aliases" (Just val)

clearSessionHttpAliases :: (MonadIO m, IsSession o) => o -> m ()
clearSessionHttpAliases obj = liftIO $ setObjectPropertyStringArray obj "http-aliases" (Nothing :: Maybe [T.Text])

data SessionHttpAliasesPropertyInfo
instance AttrInfo SessionHttpAliasesPropertyInfo where
    type AttrAllowedOps SessionHttpAliasesPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SessionHttpAliasesPropertyInfo = (~) [T.Text]
    type AttrBaseTypeConstraint SessionHttpAliasesPropertyInfo = IsSession
    type AttrGetType SessionHttpAliasesPropertyInfo = (Maybe [T.Text])
    type AttrLabel SessionHttpAliasesPropertyInfo = "http-aliases"
    type AttrOrigin SessionHttpAliasesPropertyInfo = Session
    attrGet _ = getSessionHttpAliases
    attrSet _ = setSessionHttpAliases
    attrConstruct _ = constructSessionHttpAliases
    attrClear _ = clearSessionHttpAliases

-- VVV Prop "https-aliases"
   -- Type: TCArray True (-1) (-1) (TBasicType TUTF8)
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionHttpsAliases :: (MonadIO m, IsSession o) => o -> m (Maybe [T.Text])
getSessionHttpsAliases obj = liftIO $ getObjectPropertyStringArray obj "https-aliases"

setSessionHttpsAliases :: (MonadIO m, IsSession o) => o -> [T.Text] -> m ()
setSessionHttpsAliases obj val = liftIO $ setObjectPropertyStringArray obj "https-aliases" (Just val)

constructSessionHttpsAliases :: (IsSession o) => [T.Text] -> IO (GValueConstruct o)
constructSessionHttpsAliases val = constructObjectPropertyStringArray "https-aliases" (Just val)

clearSessionHttpsAliases :: (MonadIO m, IsSession o) => o -> m ()
clearSessionHttpsAliases obj = liftIO $ setObjectPropertyStringArray obj "https-aliases" (Nothing :: Maybe [T.Text])

data SessionHttpsAliasesPropertyInfo
instance AttrInfo SessionHttpsAliasesPropertyInfo where
    type AttrAllowedOps SessionHttpsAliasesPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SessionHttpsAliasesPropertyInfo = (~) [T.Text]
    type AttrBaseTypeConstraint SessionHttpsAliasesPropertyInfo = IsSession
    type AttrGetType SessionHttpsAliasesPropertyInfo = (Maybe [T.Text])
    type AttrLabel SessionHttpsAliasesPropertyInfo = "https-aliases"
    type AttrOrigin SessionHttpsAliasesPropertyInfo = Session
    attrGet _ = getSessionHttpsAliases
    attrSet _ = setSessionHttpsAliases
    attrConstruct _ = constructSessionHttpsAliases
    attrClear _ = clearSessionHttpsAliases

-- VVV Prop "idle-timeout"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionIdleTimeout :: (MonadIO m, IsSession o) => o -> m Word32
getSessionIdleTimeout obj = liftIO $ getObjectPropertyUInt32 obj "idle-timeout"

setSessionIdleTimeout :: (MonadIO m, IsSession o) => o -> Word32 -> m ()
setSessionIdleTimeout obj val = liftIO $ setObjectPropertyUInt32 obj "idle-timeout" val

constructSessionIdleTimeout :: (IsSession o) => Word32 -> IO (GValueConstruct o)
constructSessionIdleTimeout val = constructObjectPropertyUInt32 "idle-timeout" val

data SessionIdleTimeoutPropertyInfo
instance AttrInfo SessionIdleTimeoutPropertyInfo where
    type AttrAllowedOps SessionIdleTimeoutPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SessionIdleTimeoutPropertyInfo = (~) Word32
    type AttrBaseTypeConstraint SessionIdleTimeoutPropertyInfo = IsSession
    type AttrGetType SessionIdleTimeoutPropertyInfo = Word32
    type AttrLabel SessionIdleTimeoutPropertyInfo = "idle-timeout"
    type AttrOrigin SessionIdleTimeoutPropertyInfo = Session
    attrGet _ = getSessionIdleTimeout
    attrSet _ = setSessionIdleTimeout
    attrConstruct _ = constructSessionIdleTimeout
    attrClear _ = undefined

-- VVV Prop "local-address"
   -- Type: TInterface (Name {namespace = "Soup", name = "Address"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

getSessionLocalAddress :: (MonadIO m, IsSession o) => o -> m (Maybe Soup.Address.Address)
getSessionLocalAddress obj = liftIO $ getObjectPropertyObject obj "local-address" Soup.Address.Address

constructSessionLocalAddress :: (IsSession o, Soup.Address.IsAddress a) => a -> IO (GValueConstruct o)
constructSessionLocalAddress val = constructObjectPropertyObject "local-address" (Just val)

data SessionLocalAddressPropertyInfo
instance AttrInfo SessionLocalAddressPropertyInfo where
    type AttrAllowedOps SessionLocalAddressPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SessionLocalAddressPropertyInfo = Soup.Address.IsAddress
    type AttrBaseTypeConstraint SessionLocalAddressPropertyInfo = IsSession
    type AttrGetType SessionLocalAddressPropertyInfo = (Maybe Soup.Address.Address)
    type AttrLabel SessionLocalAddressPropertyInfo = "local-address"
    type AttrOrigin SessionLocalAddressPropertyInfo = Session
    attrGet _ = getSessionLocalAddress
    attrSet _ = undefined
    attrConstruct _ = constructSessionLocalAddress
    attrClear _ = undefined

-- VVV Prop "max-conns"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionMaxConns :: (MonadIO m, IsSession o) => o -> m Int32
getSessionMaxConns obj = liftIO $ getObjectPropertyInt32 obj "max-conns"

setSessionMaxConns :: (MonadIO m, IsSession o) => o -> Int32 -> m ()
setSessionMaxConns obj val = liftIO $ setObjectPropertyInt32 obj "max-conns" val

constructSessionMaxConns :: (IsSession o) => Int32 -> IO (GValueConstruct o)
constructSessionMaxConns val = constructObjectPropertyInt32 "max-conns" val

data SessionMaxConnsPropertyInfo
instance AttrInfo SessionMaxConnsPropertyInfo where
    type AttrAllowedOps SessionMaxConnsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SessionMaxConnsPropertyInfo = (~) Int32
    type AttrBaseTypeConstraint SessionMaxConnsPropertyInfo = IsSession
    type AttrGetType SessionMaxConnsPropertyInfo = Int32
    type AttrLabel SessionMaxConnsPropertyInfo = "max-conns"
    type AttrOrigin SessionMaxConnsPropertyInfo = Session
    attrGet _ = getSessionMaxConns
    attrSet _ = setSessionMaxConns
    attrConstruct _ = constructSessionMaxConns
    attrClear _ = undefined

-- VVV Prop "max-conns-per-host"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionMaxConnsPerHost :: (MonadIO m, IsSession o) => o -> m Int32
getSessionMaxConnsPerHost obj = liftIO $ getObjectPropertyInt32 obj "max-conns-per-host"

setSessionMaxConnsPerHost :: (MonadIO m, IsSession o) => o -> Int32 -> m ()
setSessionMaxConnsPerHost obj val = liftIO $ setObjectPropertyInt32 obj "max-conns-per-host" val

constructSessionMaxConnsPerHost :: (IsSession o) => Int32 -> IO (GValueConstruct o)
constructSessionMaxConnsPerHost val = constructObjectPropertyInt32 "max-conns-per-host" val

data SessionMaxConnsPerHostPropertyInfo
instance AttrInfo SessionMaxConnsPerHostPropertyInfo where
    type AttrAllowedOps SessionMaxConnsPerHostPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SessionMaxConnsPerHostPropertyInfo = (~) Int32
    type AttrBaseTypeConstraint SessionMaxConnsPerHostPropertyInfo = IsSession
    type AttrGetType SessionMaxConnsPerHostPropertyInfo = Int32
    type AttrLabel SessionMaxConnsPerHostPropertyInfo = "max-conns-per-host"
    type AttrOrigin SessionMaxConnsPerHostPropertyInfo = Session
    attrGet _ = getSessionMaxConnsPerHost
    attrSet _ = setSessionMaxConnsPerHost
    attrConstruct _ = constructSessionMaxConnsPerHost
    attrClear _ = undefined

-- VVV Prop "proxy-resolver"
   -- Type: TInterface (Name {namespace = "Gio", name = "ProxyResolver"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionProxyResolver :: (MonadIO m, IsSession o) => o -> m (Maybe Gio.ProxyResolver.ProxyResolver)
getSessionProxyResolver obj = liftIO $ getObjectPropertyObject obj "proxy-resolver" Gio.ProxyResolver.ProxyResolver

setSessionProxyResolver :: (MonadIO m, IsSession o, Gio.ProxyResolver.IsProxyResolver a) => o -> a -> m ()
setSessionProxyResolver obj val = liftIO $ setObjectPropertyObject obj "proxy-resolver" (Just val)

constructSessionProxyResolver :: (IsSession o, Gio.ProxyResolver.IsProxyResolver a) => a -> IO (GValueConstruct o)
constructSessionProxyResolver val = constructObjectPropertyObject "proxy-resolver" (Just val)

clearSessionProxyResolver :: (MonadIO m, IsSession o) => o -> m ()
clearSessionProxyResolver obj = liftIO $ setObjectPropertyObject obj "proxy-resolver" (Nothing :: Maybe Gio.ProxyResolver.ProxyResolver)

data SessionProxyResolverPropertyInfo
instance AttrInfo SessionProxyResolverPropertyInfo where
    type AttrAllowedOps SessionProxyResolverPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SessionProxyResolverPropertyInfo = Gio.ProxyResolver.IsProxyResolver
    type AttrBaseTypeConstraint SessionProxyResolverPropertyInfo = IsSession
    type AttrGetType SessionProxyResolverPropertyInfo = (Maybe Gio.ProxyResolver.ProxyResolver)
    type AttrLabel SessionProxyResolverPropertyInfo = "proxy-resolver"
    type AttrOrigin SessionProxyResolverPropertyInfo = Session
    attrGet _ = getSessionProxyResolver
    attrSet _ = setSessionProxyResolver
    attrConstruct _ = constructSessionProxyResolver
    attrClear _ = clearSessionProxyResolver

-- VVV Prop "proxy-uri"
   -- Type: TInterface (Name {namespace = "Soup", name = "URI"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionProxyUri :: (MonadIO m, IsSession o) => o -> m (Maybe Soup.URI.URI)
getSessionProxyUri obj = liftIO $ getObjectPropertyBoxed obj "proxy-uri" Soup.URI.URI

setSessionProxyUri :: (MonadIO m, IsSession o) => o -> Soup.URI.URI -> m ()
setSessionProxyUri obj val = liftIO $ setObjectPropertyBoxed obj "proxy-uri" (Just val)

constructSessionProxyUri :: (IsSession o) => Soup.URI.URI -> IO (GValueConstruct o)
constructSessionProxyUri val = constructObjectPropertyBoxed "proxy-uri" (Just val)

clearSessionProxyUri :: (MonadIO m, IsSession o) => o -> m ()
clearSessionProxyUri obj = liftIO $ setObjectPropertyBoxed obj "proxy-uri" (Nothing :: Maybe Soup.URI.URI)

data SessionProxyUriPropertyInfo
instance AttrInfo SessionProxyUriPropertyInfo where
    type AttrAllowedOps SessionProxyUriPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SessionProxyUriPropertyInfo = (~) Soup.URI.URI
    type AttrBaseTypeConstraint SessionProxyUriPropertyInfo = IsSession
    type AttrGetType SessionProxyUriPropertyInfo = (Maybe Soup.URI.URI)
    type AttrLabel SessionProxyUriPropertyInfo = "proxy-uri"
    type AttrOrigin SessionProxyUriPropertyInfo = Session
    attrGet _ = getSessionProxyUri
    attrSet _ = setSessionProxyUri
    attrConstruct _ = constructSessionProxyUri
    attrClear _ = clearSessionProxyUri

-- VVV Prop "ssl-ca-file"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionSslCaFile :: (MonadIO m, IsSession o) => o -> m (Maybe T.Text)
getSessionSslCaFile obj = liftIO $ getObjectPropertyString obj "ssl-ca-file"

setSessionSslCaFile :: (MonadIO m, IsSession o) => o -> T.Text -> m ()
setSessionSslCaFile obj val = liftIO $ setObjectPropertyString obj "ssl-ca-file" (Just val)

constructSessionSslCaFile :: (IsSession o) => T.Text -> IO (GValueConstruct o)
constructSessionSslCaFile val = constructObjectPropertyString "ssl-ca-file" (Just val)

clearSessionSslCaFile :: (MonadIO m, IsSession o) => o -> m ()
clearSessionSslCaFile obj = liftIO $ setObjectPropertyString obj "ssl-ca-file" (Nothing :: Maybe T.Text)

data SessionSslCaFilePropertyInfo
instance AttrInfo SessionSslCaFilePropertyInfo where
    type AttrAllowedOps SessionSslCaFilePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SessionSslCaFilePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint SessionSslCaFilePropertyInfo = IsSession
    type AttrGetType SessionSslCaFilePropertyInfo = (Maybe T.Text)
    type AttrLabel SessionSslCaFilePropertyInfo = "ssl-ca-file"
    type AttrOrigin SessionSslCaFilePropertyInfo = Session
    attrGet _ = getSessionSslCaFile
    attrSet _ = setSessionSslCaFile
    attrConstruct _ = constructSessionSslCaFile
    attrClear _ = clearSessionSslCaFile

-- VVV Prop "ssl-strict"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionSslStrict :: (MonadIO m, IsSession o) => o -> m Bool
getSessionSslStrict obj = liftIO $ getObjectPropertyBool obj "ssl-strict"

setSessionSslStrict :: (MonadIO m, IsSession o) => o -> Bool -> m ()
setSessionSslStrict obj val = liftIO $ setObjectPropertyBool obj "ssl-strict" val

constructSessionSslStrict :: (IsSession o) => Bool -> IO (GValueConstruct o)
constructSessionSslStrict val = constructObjectPropertyBool "ssl-strict" val

data SessionSslStrictPropertyInfo
instance AttrInfo SessionSslStrictPropertyInfo where
    type AttrAllowedOps SessionSslStrictPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SessionSslStrictPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint SessionSslStrictPropertyInfo = IsSession
    type AttrGetType SessionSslStrictPropertyInfo = Bool
    type AttrLabel SessionSslStrictPropertyInfo = "ssl-strict"
    type AttrOrigin SessionSslStrictPropertyInfo = Session
    attrGet _ = getSessionSslStrict
    attrSet _ = setSessionSslStrict
    attrConstruct _ = constructSessionSslStrict
    attrClear _ = undefined

-- VVV Prop "ssl-use-system-ca-file"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionSslUseSystemCaFile :: (MonadIO m, IsSession o) => o -> m Bool
getSessionSslUseSystemCaFile obj = liftIO $ getObjectPropertyBool obj "ssl-use-system-ca-file"

setSessionSslUseSystemCaFile :: (MonadIO m, IsSession o) => o -> Bool -> m ()
setSessionSslUseSystemCaFile obj val = liftIO $ setObjectPropertyBool obj "ssl-use-system-ca-file" val

constructSessionSslUseSystemCaFile :: (IsSession o) => Bool -> IO (GValueConstruct o)
constructSessionSslUseSystemCaFile val = constructObjectPropertyBool "ssl-use-system-ca-file" val

data SessionSslUseSystemCaFilePropertyInfo
instance AttrInfo SessionSslUseSystemCaFilePropertyInfo where
    type AttrAllowedOps SessionSslUseSystemCaFilePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SessionSslUseSystemCaFilePropertyInfo = (~) Bool
    type AttrBaseTypeConstraint SessionSslUseSystemCaFilePropertyInfo = IsSession
    type AttrGetType SessionSslUseSystemCaFilePropertyInfo = Bool
    type AttrLabel SessionSslUseSystemCaFilePropertyInfo = "ssl-use-system-ca-file"
    type AttrOrigin SessionSslUseSystemCaFilePropertyInfo = Session
    attrGet _ = getSessionSslUseSystemCaFile
    attrSet _ = setSessionSslUseSystemCaFile
    attrConstruct _ = constructSessionSslUseSystemCaFile
    attrClear _ = undefined

-- VVV Prop "timeout"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionTimeout :: (MonadIO m, IsSession o) => o -> m Word32
getSessionTimeout obj = liftIO $ getObjectPropertyUInt32 obj "timeout"

setSessionTimeout :: (MonadIO m, IsSession o) => o -> Word32 -> m ()
setSessionTimeout obj val = liftIO $ setObjectPropertyUInt32 obj "timeout" val

constructSessionTimeout :: (IsSession o) => Word32 -> IO (GValueConstruct o)
constructSessionTimeout val = constructObjectPropertyUInt32 "timeout" val

data SessionTimeoutPropertyInfo
instance AttrInfo SessionTimeoutPropertyInfo where
    type AttrAllowedOps SessionTimeoutPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SessionTimeoutPropertyInfo = (~) Word32
    type AttrBaseTypeConstraint SessionTimeoutPropertyInfo = IsSession
    type AttrGetType SessionTimeoutPropertyInfo = Word32
    type AttrLabel SessionTimeoutPropertyInfo = "timeout"
    type AttrOrigin SessionTimeoutPropertyInfo = Session
    attrGet _ = getSessionTimeout
    attrSet _ = setSessionTimeout
    attrConstruct _ = constructSessionTimeout
    attrClear _ = undefined

-- VVV Prop "tls-database"
   -- Type: TInterface (Name {namespace = "Gio", name = "TlsDatabase"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionTlsDatabase :: (MonadIO m, IsSession o) => o -> m (Maybe Gio.TlsDatabase.TlsDatabase)
getSessionTlsDatabase obj = liftIO $ getObjectPropertyObject obj "tls-database" Gio.TlsDatabase.TlsDatabase

setSessionTlsDatabase :: (MonadIO m, IsSession o, Gio.TlsDatabase.IsTlsDatabase a) => o -> a -> m ()
setSessionTlsDatabase obj val = liftIO $ setObjectPropertyObject obj "tls-database" (Just val)

constructSessionTlsDatabase :: (IsSession o, Gio.TlsDatabase.IsTlsDatabase a) => a -> IO (GValueConstruct o)
constructSessionTlsDatabase val = constructObjectPropertyObject "tls-database" (Just val)

clearSessionTlsDatabase :: (MonadIO m, IsSession o) => o -> m ()
clearSessionTlsDatabase obj = liftIO $ setObjectPropertyObject obj "tls-database" (Nothing :: Maybe Gio.TlsDatabase.TlsDatabase)

data SessionTlsDatabasePropertyInfo
instance AttrInfo SessionTlsDatabasePropertyInfo where
    type AttrAllowedOps SessionTlsDatabasePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SessionTlsDatabasePropertyInfo = Gio.TlsDatabase.IsTlsDatabase
    type AttrBaseTypeConstraint SessionTlsDatabasePropertyInfo = IsSession
    type AttrGetType SessionTlsDatabasePropertyInfo = (Maybe Gio.TlsDatabase.TlsDatabase)
    type AttrLabel SessionTlsDatabasePropertyInfo = "tls-database"
    type AttrOrigin SessionTlsDatabasePropertyInfo = Session
    attrGet _ = getSessionTlsDatabase
    attrSet _ = setSessionTlsDatabase
    attrConstruct _ = constructSessionTlsDatabase
    attrClear _ = clearSessionTlsDatabase

-- VVV Prop "tls-interaction"
   -- Type: TInterface (Name {namespace = "Gio", name = "TlsInteraction"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionTlsInteraction :: (MonadIO m, IsSession o) => o -> m (Maybe Gio.TlsInteraction.TlsInteraction)
getSessionTlsInteraction obj = liftIO $ getObjectPropertyObject obj "tls-interaction" Gio.TlsInteraction.TlsInteraction

setSessionTlsInteraction :: (MonadIO m, IsSession o, Gio.TlsInteraction.IsTlsInteraction a) => o -> a -> m ()
setSessionTlsInteraction obj val = liftIO $ setObjectPropertyObject obj "tls-interaction" (Just val)

constructSessionTlsInteraction :: (IsSession o, Gio.TlsInteraction.IsTlsInteraction a) => a -> IO (GValueConstruct o)
constructSessionTlsInteraction val = constructObjectPropertyObject "tls-interaction" (Just val)

clearSessionTlsInteraction :: (MonadIO m, IsSession o) => o -> m ()
clearSessionTlsInteraction obj = liftIO $ setObjectPropertyObject obj "tls-interaction" (Nothing :: Maybe Gio.TlsInteraction.TlsInteraction)

data SessionTlsInteractionPropertyInfo
instance AttrInfo SessionTlsInteractionPropertyInfo where
    type AttrAllowedOps SessionTlsInteractionPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SessionTlsInteractionPropertyInfo = Gio.TlsInteraction.IsTlsInteraction
    type AttrBaseTypeConstraint SessionTlsInteractionPropertyInfo = IsSession
    type AttrGetType SessionTlsInteractionPropertyInfo = (Maybe Gio.TlsInteraction.TlsInteraction)
    type AttrLabel SessionTlsInteractionPropertyInfo = "tls-interaction"
    type AttrOrigin SessionTlsInteractionPropertyInfo = Session
    attrGet _ = getSessionTlsInteraction
    attrSet _ = setSessionTlsInteraction
    attrConstruct _ = constructSessionTlsInteraction
    attrClear _ = clearSessionTlsInteraction

-- VVV Prop "use-ntlm"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionUseNtlm :: (MonadIO m, IsSession o) => o -> m Bool
getSessionUseNtlm obj = liftIO $ getObjectPropertyBool obj "use-ntlm"

setSessionUseNtlm :: (MonadIO m, IsSession o) => o -> Bool -> m ()
setSessionUseNtlm obj val = liftIO $ setObjectPropertyBool obj "use-ntlm" val

constructSessionUseNtlm :: (IsSession o) => Bool -> IO (GValueConstruct o)
constructSessionUseNtlm val = constructObjectPropertyBool "use-ntlm" val

data SessionUseNtlmPropertyInfo
instance AttrInfo SessionUseNtlmPropertyInfo where
    type AttrAllowedOps SessionUseNtlmPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SessionUseNtlmPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint SessionUseNtlmPropertyInfo = IsSession
    type AttrGetType SessionUseNtlmPropertyInfo = Bool
    type AttrLabel SessionUseNtlmPropertyInfo = "use-ntlm"
    type AttrOrigin SessionUseNtlmPropertyInfo = Session
    attrGet _ = getSessionUseNtlm
    attrSet _ = setSessionUseNtlm
    attrConstruct _ = constructSessionUseNtlm
    attrClear _ = undefined

-- VVV Prop "use-thread-context"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionUseThreadContext :: (MonadIO m, IsSession o) => o -> m Bool
getSessionUseThreadContext obj = liftIO $ getObjectPropertyBool obj "use-thread-context"

setSessionUseThreadContext :: (MonadIO m, IsSession o) => o -> Bool -> m ()
setSessionUseThreadContext obj val = liftIO $ setObjectPropertyBool obj "use-thread-context" val

constructSessionUseThreadContext :: (IsSession o) => Bool -> IO (GValueConstruct o)
constructSessionUseThreadContext val = constructObjectPropertyBool "use-thread-context" val

data SessionUseThreadContextPropertyInfo
instance AttrInfo SessionUseThreadContextPropertyInfo where
    type AttrAllowedOps SessionUseThreadContextPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SessionUseThreadContextPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint SessionUseThreadContextPropertyInfo = IsSession
    type AttrGetType SessionUseThreadContextPropertyInfo = Bool
    type AttrLabel SessionUseThreadContextPropertyInfo = "use-thread-context"
    type AttrOrigin SessionUseThreadContextPropertyInfo = Session
    attrGet _ = getSessionUseThreadContext
    attrSet _ = setSessionUseThreadContext
    attrConstruct _ = constructSessionUseThreadContext
    attrClear _ = undefined

-- VVV Prop "user-agent"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getSessionUserAgent :: (MonadIO m, IsSession o) => o -> m (Maybe T.Text)
getSessionUserAgent obj = liftIO $ getObjectPropertyString obj "user-agent"

setSessionUserAgent :: (MonadIO m, IsSession o) => o -> T.Text -> m ()
setSessionUserAgent obj val = liftIO $ setObjectPropertyString obj "user-agent" (Just val)

constructSessionUserAgent :: (IsSession o) => T.Text -> IO (GValueConstruct o)
constructSessionUserAgent val = constructObjectPropertyString "user-agent" (Just val)

clearSessionUserAgent :: (MonadIO m, IsSession o) => o -> m ()
clearSessionUserAgent obj = liftIO $ setObjectPropertyString obj "user-agent" (Nothing :: Maybe T.Text)

data SessionUserAgentPropertyInfo
instance AttrInfo SessionUserAgentPropertyInfo where
    type AttrAllowedOps SessionUserAgentPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SessionUserAgentPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint SessionUserAgentPropertyInfo = IsSession
    type AttrGetType SessionUserAgentPropertyInfo = (Maybe T.Text)
    type AttrLabel SessionUserAgentPropertyInfo = "user-agent"
    type AttrOrigin SessionUserAgentPropertyInfo = Session
    attrGet _ = getSessionUserAgent
    attrSet _ = setSessionUserAgent
    attrConstruct _ = constructSessionUserAgent
    attrClear _ = clearSessionUserAgent

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

sessionAcceptLanguage :: AttrLabelProxy "acceptLanguage"
sessionAcceptLanguage = AttrLabelProxy

sessionAcceptLanguageAuto :: AttrLabelProxy "acceptLanguageAuto"
sessionAcceptLanguageAuto = AttrLabelProxy

sessionAsyncContext :: AttrLabelProxy "asyncContext"
sessionAsyncContext = AttrLabelProxy

sessionHttpAliases :: AttrLabelProxy "httpAliases"
sessionHttpAliases = AttrLabelProxy

sessionHttpsAliases :: AttrLabelProxy "httpsAliases"
sessionHttpsAliases = AttrLabelProxy

sessionIdleTimeout :: AttrLabelProxy "idleTimeout"
sessionIdleTimeout = AttrLabelProxy

sessionLocalAddress :: AttrLabelProxy "localAddress"
sessionLocalAddress = AttrLabelProxy

sessionMaxConns :: AttrLabelProxy "maxConns"
sessionMaxConns = AttrLabelProxy

sessionMaxConnsPerHost :: AttrLabelProxy "maxConnsPerHost"
sessionMaxConnsPerHost = AttrLabelProxy

sessionProxyResolver :: AttrLabelProxy "proxyResolver"
sessionProxyResolver = AttrLabelProxy

sessionProxyUri :: AttrLabelProxy "proxyUri"
sessionProxyUri = AttrLabelProxy

sessionSslCaFile :: AttrLabelProxy "sslCaFile"
sessionSslCaFile = AttrLabelProxy

sessionSslStrict :: AttrLabelProxy "sslStrict"
sessionSslStrict = AttrLabelProxy

sessionSslUseSystemCaFile :: AttrLabelProxy "sslUseSystemCaFile"
sessionSslUseSystemCaFile = AttrLabelProxy

sessionTimeout :: AttrLabelProxy "timeout"
sessionTimeout = AttrLabelProxy

sessionTlsDatabase :: AttrLabelProxy "tlsDatabase"
sessionTlsDatabase = AttrLabelProxy

sessionTlsInteraction :: AttrLabelProxy "tlsInteraction"
sessionTlsInteraction = AttrLabelProxy

sessionUseNtlm :: AttrLabelProxy "useNtlm"
sessionUseNtlm = AttrLabelProxy

sessionUseThreadContext :: AttrLabelProxy "useThreadContext"
sessionUseThreadContext = AttrLabelProxy

sessionUserAgent :: AttrLabelProxy "userAgent"
sessionUserAgent = AttrLabelProxy

data SessionAuthenticateSignalInfo
instance SignalInfo SessionAuthenticateSignalInfo where
    type HaskellCallbackType SessionAuthenticateSignalInfo = SessionAuthenticateCallback
    connectSignal _ = connectSessionAuthenticate

data SessionConnectionCreatedSignalInfo
instance SignalInfo SessionConnectionCreatedSignalInfo where
    type HaskellCallbackType SessionConnectionCreatedSignalInfo = SessionConnectionCreatedCallback
    connectSignal _ = connectSessionConnectionCreated

data SessionRequestQueuedSignalInfo
instance SignalInfo SessionRequestQueuedSignalInfo where
    type HaskellCallbackType SessionRequestQueuedSignalInfo = SessionRequestQueuedCallback
    connectSignal _ = connectSessionRequestQueued

data SessionRequestStartedSignalInfo
instance SignalInfo SessionRequestStartedSignalInfo where
    type HaskellCallbackType SessionRequestStartedSignalInfo = SessionRequestStartedCallback
    connectSignal _ = connectSessionRequestStarted

data SessionRequestUnqueuedSignalInfo
instance SignalInfo SessionRequestUnqueuedSignalInfo where
    type HaskellCallbackType SessionRequestUnqueuedSignalInfo = SessionRequestUnqueuedCallback
    connectSignal _ = connectSessionRequestUnqueued

data SessionTunnelingSignalInfo
instance SignalInfo SessionTunnelingSignalInfo where
    type HaskellCallbackType SessionTunnelingSignalInfo = SessionTunnelingCallback
    connectSignal _ = connectSessionTunneling

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

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

foreign import ccall "soup_session_new" soup_session_new :: 
    IO (Ptr Session)

{- |
Creates a 'GI.Soup.Objects.Session.Session' with the default options.

@since 2.42
-}
sessionNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Session
    {- ^ __Returns:__ the new session. -}
sessionNew  = liftIO $ do
    result <- soup_session_new
    checkUnexpectedReturnNULL "sessionNew" result
    result' <- (wrapObject Session) result
    return result'

-- method Session::abort
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the session", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_abort" soup_session_abort :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    IO ()

{- |
Cancels all pending requests in /@session@/ and closes all idle
persistent connections.

The message cancellation has the same semantics as with
'GI.Soup.Objects.Session.sessionCancelMessage'; asynchronous requests on a
'GI.Soup.Objects.SessionAsync.SessionAsync' will have their callback called before
'GI.Soup.Objects.Session.sessionAbort' returns. Requests on a plain 'GI.Soup.Objects.Session.Session' will
not.
-}
sessionAbort ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: the session -}
    -> m ()
sessionAbort session = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    soup_session_abort session'
    touchManagedPtr session
    return ()

data SessionAbortMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSession a) => O.MethodInfo SessionAbortMethodInfo a signature where
    overloadedMethod _ = sessionAbort

-- method Session::add_feature
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature", argType = TInterface (Name {namespace = "Soup", name = "SessionFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an object that implements #SoupSessionFeature", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_add_feature" soup_session_add_feature :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.SessionFeature.SessionFeature -> -- feature : TInterface (Name {namespace = "Soup", name = "SessionFeature"})
    IO ()

{- |
Adds /@feature@/\'s functionality to /@session@/. You can also add a
feature to the session at construct time by using the
@/SOUP_SESSION_ADD_FEATURE/@ property.

See the main 'GI.Soup.Objects.Session.Session' documentation for information on what
features are present in sessions by default.

@since 2.24
-}
sessionAddFeature ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.SessionFeature.IsSessionFeature b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@feature@/: an object that implements 'GI.Soup.Interfaces.SessionFeature.SessionFeature' -}
    -> m ()
sessionAddFeature session feature = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    feature' <- unsafeManagedPtrCastPtr feature
    soup_session_add_feature session' feature'
    touchManagedPtr session
    touchManagedPtr feature
    return ()

data SessionAddFeatureMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsSession a, Soup.SessionFeature.IsSessionFeature b) => O.MethodInfo SessionAddFeatureMethodInfo a signature where
    overloadedMethod _ = sessionAddFeature

-- method Session::add_feature_by_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GType", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_add_feature_by_type" soup_session_add_feature_by_type :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    CGType ->                               -- feature_type : TBasicType TGType
    IO ()

{- |
If /@featureType@/ is the type of a class that implements
'GI.Soup.Interfaces.SessionFeature.SessionFeature', this creates a new feature of that type and
adds it to /@session@/ as with 'GI.Soup.Objects.Session.sessionAddFeature'. You can use
this when you don\'t need to customize the new feature in any way.

If /@featureType@/ is not a 'GI.Soup.Interfaces.SessionFeature.SessionFeature' type, this gives each
existing feature on /@session@/ the chance to accept /@featureType@/ as
a \"subfeature\". This can be used to add new 'GI.Soup.Objects.Auth.Auth' or
'GI.Soup.Objects.Request.Request' types, for instance.

You can also add a feature to the session at construct time by
using the @/SOUP_SESSION_ADD_FEATURE_BY_TYPE/@ property.

See the main 'GI.Soup.Objects.Session.Session' documentation for information on what
features are present in sessions by default.

@since 2.24
-}
sessionAddFeatureByType ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> GType
    {- ^ /@featureType@/: a 'GType' -}
    -> m ()
sessionAddFeatureByType session featureType = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    let featureType' = gtypeToCGType featureType
    soup_session_add_feature_by_type session' featureType'
    touchManagedPtr session
    return ()

data SessionAddFeatureByTypeMethodInfo
instance (signature ~ (GType -> m ()), MonadIO m, IsSession a) => O.MethodInfo SessionAddFeatureByTypeMethodInfo a signature where
    overloadedMethod _ = sessionAddFeatureByType

-- method Session::cancel_message
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message to cancel", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "status_code", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "status code to set on @msg (generally\n%SOUP_STATUS_CANCELLED)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_cancel_message" soup_session_cancel_message :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Word32 ->                               -- status_code : TBasicType TUInt
    IO ()

{- |
Causes /@session@/ to immediately finish processing /@msg@/ (regardless
of its current state) with a final status_code of /@statusCode@/. You
may call this at any time after handing /@msg@/ off to /@session@/; if
/@session@/ has started sending the request but has not yet received
the complete response, then it will close the request\'s connection.
Note that with requests that have side effects (eg,
\<literal>POST\<\/literal>, \<literal>PUT\<\/literal>,
\<literal>DELETE\<\/literal>) it is possible that you might cancel the
request after the server acts on it, but before it returns a
response, leaving the remote resource in an unknown state.

If the message is cancelled while its response body is being read,
then the response body in /@msg@/ will be left partially-filled-in.
The response headers, on the other hand, will always be either
empty or complete.

Beware that with the deprecated 'GI.Soup.Objects.SessionAsync.SessionAsync', messages queued
with 'GI.Soup.Objects.Session.sessionQueueMessage' will have their callbacks invoked
before 'GI.Soup.Objects.Session.sessionCancelMessage' returns. The plain
'GI.Soup.Objects.Session.Session' does not have this behavior; cancelling an
asynchronous message will merely queue its callback to be run after
returning to the main loop.
-}
sessionCancelMessage ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@msg@/: the message to cancel -}
    -> Word32
    {- ^ /@statusCode@/: status code to set on /@msg@/ (generally
'GI.Soup.Enums.StatusCancelled') -}
    -> m ()
sessionCancelMessage session msg statusCode = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- unsafeManagedPtrCastPtr msg
    soup_session_cancel_message session' msg' statusCode
    touchManagedPtr session
    touchManagedPtr msg
    return ()

data SessionCancelMessageMethodInfo
instance (signature ~ (b -> Word32 -> m ()), MonadIO m, IsSession a, Soup.Message.IsMessage b) => O.MethodInfo SessionCancelMessageMethodInfo a signature where
    overloadedMethod _ = sessionCancelMessage

-- method Session::get_async_context
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "MainContext"}))
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_get_async_context" soup_session_get_async_context :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    IO (Ptr GLib.MainContext.MainContext)

{- |
Gets /@session@/\'s 'GI.Soup.Objects.Session.Session':@/async-context/@. This does not add a ref
to the context, so you will need to ref it yourself if you want it
to outlive its session.

For a modern 'GI.Soup.Objects.Session.Session', this will always just return the
thread-default 'GI.GLib.Structs.MainContext.MainContext', and so is not especially useful.
-}
sessionGetAsyncContext ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> m (Maybe GLib.MainContext.MainContext)
    {- ^ __Returns:__ /@session@/\'s 'GI.GLib.Structs.MainContext.MainContext',
which may be 'Nothing' -}
sessionGetAsyncContext session = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    result <- soup_session_get_async_context session'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed GLib.MainContext.MainContext) result'
        return result''
    touchManagedPtr session
    return maybeResult

data SessionGetAsyncContextMethodInfo
instance (signature ~ (m (Maybe GLib.MainContext.MainContext)), MonadIO m, IsSession a) => O.MethodInfo SessionGetAsyncContextMethodInfo a signature where
    overloadedMethod _ = sessionGetAsyncContext

-- method Session::get_feature
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType of the feature to get", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "SessionFeature"}))
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_get_feature" soup_session_get_feature :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    CGType ->                               -- feature_type : TBasicType TGType
    IO (Ptr Soup.SessionFeature.SessionFeature)

{- |
Gets the first feature in /@session@/ of type /@featureType@/. For
features where there may be more than one feature of a given type,
use 'GI.Soup.Objects.Session.sessionGetFeatures'.

@since 2.26
-}
sessionGetFeature ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> GType
    {- ^ /@featureType@/: the 'GType' of the feature to get -}
    -> m (Maybe Soup.SessionFeature.SessionFeature)
    {- ^ __Returns:__ a 'GI.Soup.Interfaces.SessionFeature.SessionFeature', or
'Nothing'. The feature is owned by /@session@/. -}
sessionGetFeature session featureType = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    let featureType' = gtypeToCGType featureType
    result <- soup_session_get_feature session' featureType'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Soup.SessionFeature.SessionFeature) result'
        return result''
    touchManagedPtr session
    return maybeResult

data SessionGetFeatureMethodInfo
instance (signature ~ (GType -> m (Maybe Soup.SessionFeature.SessionFeature)), MonadIO m, IsSession a) => O.MethodInfo SessionGetFeatureMethodInfo a signature where
    overloadedMethod _ = sessionGetFeature

-- method Session::get_feature_for_message
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType of the feature to get", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "SessionFeature"}))
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_get_feature_for_message" soup_session_get_feature_for_message :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    CGType ->                               -- feature_type : TBasicType TGType
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO (Ptr Soup.SessionFeature.SessionFeature)

{- |
Gets the first feature in /@session@/ of type /@featureType@/, provided
that it is not disabled for /@msg@/. As with
'GI.Soup.Objects.Session.sessionGetFeature', this should only be used for features
where /@featureType@/ is only expected to match a single feature. In
particular, if there are two matching features, and the first is
disabled on /@msg@/, and the second is not, then this will return
'Nothing', not the second feature.

@since 2.28
-}
sessionGetFeatureForMessage ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> GType
    {- ^ /@featureType@/: the 'GType' of the feature to get -}
    -> b
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> m (Maybe Soup.SessionFeature.SessionFeature)
    {- ^ __Returns:__ a 'GI.Soup.Interfaces.SessionFeature.SessionFeature', or 'Nothing'. The
feature is owned by /@session@/. -}
sessionGetFeatureForMessage session featureType msg = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    let featureType' = gtypeToCGType featureType
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_session_get_feature_for_message session' featureType' msg'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Soup.SessionFeature.SessionFeature) result'
        return result''
    touchManagedPtr session
    touchManagedPtr msg
    return maybeResult

data SessionGetFeatureForMessageMethodInfo
instance (signature ~ (GType -> b -> m (Maybe Soup.SessionFeature.SessionFeature)), MonadIO m, IsSession a, Soup.Message.IsMessage b) => O.MethodInfo SessionGetFeatureForMessageMethodInfo a signature where
    overloadedMethod _ = sessionGetFeatureForMessage

-- method Session::get_features
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType of the class of features to get", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGSList (TInterface (Name {namespace = "Soup", name = "SessionFeature"})))
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_get_features" soup_session_get_features :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    CGType ->                               -- feature_type : TBasicType TGType
    IO (Ptr (GSList (Ptr Soup.SessionFeature.SessionFeature)))

{- |
Generates a list of /@session@/\'s features of type /@featureType@/. (If
you want to see all features, you can pass @/SOUP_TYPE_SESSION_FEATURE/@
for /@featureType@/.)

@since 2.26
-}
sessionGetFeatures ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> GType
    {- ^ /@featureType@/: the 'GType' of the class of features to get -}
    -> m [Soup.SessionFeature.SessionFeature]
    {- ^ __Returns:__ 
a list of features. You must free the list, but not its contents -}
sessionGetFeatures session featureType = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    let featureType' = gtypeToCGType featureType
    result <- soup_session_get_features session' featureType'
    result' <- unpackGSList result
    result'' <- mapM (newObject Soup.SessionFeature.SessionFeature) result'
    g_slist_free result
    touchManagedPtr session
    return result''

data SessionGetFeaturesMethodInfo
instance (signature ~ (GType -> m [Soup.SessionFeature.SessionFeature]), MonadIO m, IsSession a) => O.MethodInfo SessionGetFeaturesMethodInfo a signature where
    overloadedMethod _ = sessionGetFeatures

-- method Session::has_feature
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType of the class of features to check for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_has_feature" soup_session_has_feature :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    CGType ->                               -- feature_type : TBasicType TGType
    IO CInt

{- |
Tests if /@session@/ has at a feature of type /@featureType@/ (which can
be the type of either a 'GI.Soup.Interfaces.SessionFeature.SessionFeature', or else a subtype of
some class managed by another feature, such as 'GI.Soup.Objects.Auth.Auth' or
'GI.Soup.Objects.Request.Request').

@since 2.42
-}
sessionHasFeature ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> GType
    {- ^ /@featureType@/: the 'GType' of the class of features to check for -}
    -> m Bool
    {- ^ __Returns:__ 'True' or 'False' -}
sessionHasFeature session featureType = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    let featureType' = gtypeToCGType featureType
    result <- soup_session_has_feature session' featureType'
    let result' = (/= 0) result
    touchManagedPtr session
    return result'

data SessionHasFeatureMethodInfo
instance (signature ~ (GType -> m Bool), MonadIO m, IsSession a) => O.MethodInfo SessionHasFeatureMethodInfo a signature where
    overloadedMethod _ = sessionHasFeature

-- method Session::pause_message
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage currently running on @session", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_pause_message" soup_session_pause_message :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO ()

{- |
Pauses HTTP I\/O on /@msg@/. Call 'GI.Soup.Objects.Session.sessionUnpauseMessage' to
resume I\/O.

This may only be called for asynchronous messages (those sent on a
'GI.Soup.Objects.SessionAsync.SessionAsync' or using 'GI.Soup.Objects.Session.sessionQueueMessage').
-}
sessionPauseMessage ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' currently running on /@session@/ -}
    -> m ()
sessionPauseMessage session msg = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- unsafeManagedPtrCastPtr msg
    soup_session_pause_message session' msg'
    touchManagedPtr session
    touchManagedPtr msg
    return ()

data SessionPauseMessageMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsSession a, Soup.Message.IsMessage b) => O.MethodInfo SessionPauseMessageMethodInfo a signature where
    overloadedMethod _ = sessionPauseMessage

-- method Session::prefetch_dns
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "hostname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a hostname to be resolved", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GCancellable object, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Soup", name = "AddressCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "callback to call with the\n    result, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data for @callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_prefetch_dns" soup_session_prefetch_dns :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    CString ->                              -- hostname : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Soup.Callbacks.C_AddressCallback -> -- callback : TInterface (Name {namespace = "Soup", name = "AddressCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Tells /@session@/ that an URI from the given /@hostname@/ may be requested
shortly, and so the session can try to prepare by resolving the
domain name in advance, in order to work more quickly once the URI
is actually requested.

If /@cancellable@/ is non-'Nothing', it can be used to cancel the
resolution. /@callback@/ will still be invoked in this case, with a
status of 'GI.Soup.Enums.StatusCancelled'.

@since 2.38
-}
sessionPrefetchDns ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> T.Text
    {- ^ /@hostname@/: a hostname to be resolved -}
    -> Maybe (b)
    {- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable' object, or 'Nothing' -}
    -> Maybe (Soup.Callbacks.AddressCallback)
    {- ^ /@callback@/: callback to call with the
    result, or 'Nothing' -}
    -> m ()
sessionPrefetchDns session hostname cancellable callback = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    hostname' <- textToCString hostname
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Soup.Callbacks.C_AddressCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- Soup.Callbacks.mk_AddressCallback (Soup.Callbacks.wrap_AddressCallback (Just ptrcallback) (Soup.Callbacks.drop_closures_AddressCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    soup_session_prefetch_dns session' hostname' maybeCancellable maybeCallback userData
    touchManagedPtr session
    whenJust cancellable touchManagedPtr
    freeMem hostname'
    return ()

data SessionPrefetchDnsMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> Maybe (Soup.Callbacks.AddressCallback) -> m ()), MonadIO m, IsSession a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SessionPrefetchDnsMethodInfo a signature where
    overloadedMethod _ = sessionPrefetchDns

-- method Session::prepare_for_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupURI which may be required", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_prepare_for_uri" soup_session_prepare_for_uri :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.URI.URI ->                     -- uri : TInterface (Name {namespace = "Soup", name = "URI"})
    IO ()

{-# DEPRECATED sessionPrepareForUri ["(Since version 2.38)","use 'GI.Soup.Objects.Session.sessionPrefetchDns' instead"] #-}
{- |
Tells /@session@/ that /@uri@/ may be requested shortly, and so the
session can try to prepare (resolving the domain name, obtaining
proxy address, etc.) in order to work more quickly once the URI is
actually requested.

@since 2.30
-}
sessionPrepareForUri ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> Soup.URI.URI
    {- ^ /@uri@/: a 'GI.Soup.Structs.URI.URI' which may be required -}
    -> m ()
sessionPrepareForUri session uri = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    uri' <- unsafeManagedPtrGetPtr uri
    soup_session_prepare_for_uri session' uri'
    touchManagedPtr session
    touchManagedPtr uri
    return ()

data SessionPrepareForUriMethodInfo
instance (signature ~ (Soup.URI.URI -> m ()), MonadIO m, IsSession a) => O.MethodInfo SessionPrepareForUriMethodInfo a signature where
    overloadedMethod _ = sessionPrepareForUri

-- method Session::queue_message
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message to queue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Soup", name = "SessionCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #SoupSessionCallback which will\nbe called after the message completes or when an unrecoverable error occurs.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a pointer passed to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_queue_message" soup_session_queue_message :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    FunPtr Soup.Callbacks.C_SessionCallback -> -- callback : TInterface (Name {namespace = "Soup", name = "SessionCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Queues the message /@msg@/ for asynchronously sending the request and
receiving a response in the current thread-default 'GI.GLib.Structs.MainContext.MainContext'.
If /@msg@/ has been processed before, any resources related to the
time it was last sent are freed.

Upon message completion, the callback specified in /@callback@/ will
be invoked. If after returning from this callback the message has not
been requeued, /@msg@/ will be unreffed.

(The behavior above applies to a plain 'GI.Soup.Objects.Session.Session'; if you are
using 'GI.Soup.Objects.SessionAsync.SessionAsync' or 'GI.Soup.Objects.SessionSync.SessionSync', then the 'GI.GLib.Structs.MainContext.MainContext'
that is used depends on the settings of 'GI.Soup.Objects.Session.Session':@/async-context/@
and 'GI.Soup.Objects.Session.Session':@/use-thread-context/@, and for 'GI.Soup.Objects.SessionSync.SessionSync', the
message will actually be sent and processed in another thread, with
only the final callback occurring in the indicated 'GI.GLib.Structs.MainContext.MainContext'.)

Contrast this method with 'GI.Soup.Objects.Session.sessionSendAsync', which also
asynchronously sends a message, but returns before reading the
response body, and allows you to read the response via a
'GI.Gio.Objects.InputStream.InputStream'.
-}
sessionQueueMessage ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@msg@/: the message to queue -}
    -> Maybe (Soup.Callbacks.SessionCallback)
    {- ^ /@callback@/: a 'GI.Soup.Callbacks.SessionCallback' which will
be called after the message completes or when an unrecoverable error occurs. -}
    -> m ()
sessionQueueMessage session msg callback = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- B.ManagedPtr.disownObject msg
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Soup.Callbacks.C_SessionCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- Soup.Callbacks.mk_SessionCallback (Soup.Callbacks.wrap_SessionCallback (Just ptrcallback) (Soup.Callbacks.drop_closures_SessionCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    soup_session_queue_message session' msg' maybeCallback userData
    touchManagedPtr session
    touchManagedPtr msg
    return ()

data SessionQueueMessageMethodInfo
instance (signature ~ (b -> Maybe (Soup.Callbacks.SessionCallback) -> m ()), MonadIO m, IsSession a, Soup.Message.IsMessage b) => O.MethodInfo SessionQueueMessageMethodInfo a signature where
    overloadedMethod _ = sessionQueueMessage

-- method Session::redirect_message
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the session", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage that has received a 3xx response", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_redirect_message" soup_session_redirect_message :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO CInt

{- |
Updates /@msg@/\'s URI according to its status code and \"Location\"
header, and requeues it on /@session@/. Use this when you have set
'GI.Soup.Flags.MessageFlagsNoRedirect' on a message, but have decided to allow a
particular redirection to occur, or if you want to allow a
redirection that 'GI.Soup.Objects.Session.Session' will not perform automatically (eg,
redirecting a non-safe method such as DELETE).

If /@msg@/\'s status code indicates that it should be retried as a GET
request, then /@msg@/ will be modified accordingly.

If /@msg@/ has already been redirected too many times, this will
cause it to fail with 'GI.Soup.Enums.StatusTooManyRedirects'.

@since 2.38
-}
sessionRedirectMessage ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b) =>
    a
    {- ^ /@session@/: the session -}
    -> b
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' that has received a 3xx response -}
    -> m Bool
    {- ^ __Returns:__ 'True' if a redirection was applied, 'False' if not
(eg, because there was no Location header, or it could not be
parsed). -}
sessionRedirectMessage session msg = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_session_redirect_message session' msg'
    let result' = (/= 0) result
    touchManagedPtr session
    touchManagedPtr msg
    return result'

data SessionRedirectMessageMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsSession a, Soup.Message.IsMessage b) => O.MethodInfo SessionRedirectMessageMethodInfo a signature where
    overloadedMethod _ = sessionRedirectMessage

-- method Session::remove_feature
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature", argType = TInterface (Name {namespace = "Soup", name = "SessionFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a feature that has previously been added to @session", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_remove_feature" soup_session_remove_feature :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.SessionFeature.SessionFeature -> -- feature : TInterface (Name {namespace = "Soup", name = "SessionFeature"})
    IO ()

{- |
Removes /@feature@/\'s functionality from /@session@/.

@since 2.24
-}
sessionRemoveFeature ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.SessionFeature.IsSessionFeature b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@feature@/: a feature that has previously been added to /@session@/ -}
    -> m ()
sessionRemoveFeature session feature = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    feature' <- unsafeManagedPtrCastPtr feature
    soup_session_remove_feature session' feature'
    touchManagedPtr session
    touchManagedPtr feature
    return ()

data SessionRemoveFeatureMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsSession a, Soup.SessionFeature.IsSessionFeature b) => O.MethodInfo SessionRemoveFeatureMethodInfo a signature where
    overloadedMethod _ = sessionRemoveFeature

-- method Session::remove_feature_by_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GType", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_remove_feature_by_type" soup_session_remove_feature_by_type :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    CGType ->                               -- feature_type : TBasicType TGType
    IO ()

{- |
Removes all features of type /@featureType@/ (or any subclass of
/@featureType@/) from /@session@/. You can also remove standard features
from the session at construct time by using the
@/SOUP_SESSION_REMOVE_FEATURE_BY_TYPE/@ property.

@since 2.24
-}
sessionRemoveFeatureByType ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> GType
    {- ^ /@featureType@/: a 'GType' -}
    -> m ()
sessionRemoveFeatureByType session featureType = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    let featureType' = gtypeToCGType featureType
    soup_session_remove_feature_by_type session' featureType'
    touchManagedPtr session
    return ()

data SessionRemoveFeatureByTypeMethodInfo
instance (signature ~ (GType -> m ()), MonadIO m, IsSession a) => O.MethodInfo SessionRemoveFeatureByTypeMethodInfo a signature where
    overloadedMethod _ = sessionRemoveFeatureByType

-- method Session::request
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri_string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a URI, in string form", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "Request"}))
-- throws : True
-- Skip return : False

foreign import ccall "soup_session_request" soup_session_request :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    CString ->                              -- uri_string : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Soup.Request.Request)

{- |
Creates a 'GI.Soup.Objects.Request.Request' for retrieving /@uriString@/.

@since 2.42
-}
sessionRequest ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> T.Text
    {- ^ /@uriString@/: a URI, in string form -}
    -> m Soup.Request.Request
    {- ^ __Returns:__ a new 'GI.Soup.Objects.Request.Request', or
  'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -}
sessionRequest session uriString = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    uriString' <- textToCString uriString
    onException (do
        result <- propagateGError $ soup_session_request session' uriString'
        checkUnexpectedReturnNULL "sessionRequest" result
        result' <- (wrapObject Soup.Request.Request) result
        touchManagedPtr session
        freeMem uriString'
        return result'
     ) (do
        freeMem uriString'
     )

data SessionRequestMethodInfo
instance (signature ~ (T.Text -> m Soup.Request.Request), MonadIO m, IsSession a) => O.MethodInfo SessionRequestMethodInfo a signature where
    overloadedMethod _ = sessionRequest

-- method Session::request_http
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "method", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an HTTP method", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri_string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a URI, in string form", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "RequestHTTP"}))
-- throws : True
-- Skip return : False

foreign import ccall "soup_session_request_http" soup_session_request_http :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    CString ->                              -- method : TBasicType TUTF8
    CString ->                              -- uri_string : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Soup.RequestHTTP.RequestHTTP)

{- |
Creates a 'GI.Soup.Objects.Request.Request' for retrieving /@uriString@/, which must be an
\"http\" or \"https\" URI (or another protocol listed in /@session@/\'s
'GI.Soup.Objects.Session.Session':@/http-aliases/@ or 'GI.Soup.Objects.Session.Session':@/https-aliases/@).

@since 2.42
-}
sessionRequestHttp ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> T.Text
    {- ^ /@method@/: an HTTP method -}
    -> T.Text
    {- ^ /@uriString@/: a URI, in string form -}
    -> m Soup.RequestHTTP.RequestHTTP
    {- ^ __Returns:__ a new 'GI.Soup.Objects.RequestHTTP.RequestHTTP', or
  'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -}
sessionRequestHttp session method uriString = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    method' <- textToCString method
    uriString' <- textToCString uriString
    onException (do
        result <- propagateGError $ soup_session_request_http session' method' uriString'
        checkUnexpectedReturnNULL "sessionRequestHttp" result
        result' <- (wrapObject Soup.RequestHTTP.RequestHTTP) result
        touchManagedPtr session
        freeMem method'
        freeMem uriString'
        return result'
     ) (do
        freeMem method'
        freeMem uriString'
     )

data SessionRequestHttpMethodInfo
instance (signature ~ (T.Text -> T.Text -> m Soup.RequestHTTP.RequestHTTP), MonadIO m, IsSession a) => O.MethodInfo SessionRequestHttpMethodInfo a signature where
    overloadedMethod _ = sessionRequestHttp

-- method Session::request_http_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "method", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an HTTP method", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupURI representing the URI to retrieve", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "RequestHTTP"}))
-- throws : True
-- Skip return : False

foreign import ccall "soup_session_request_http_uri" soup_session_request_http_uri :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    CString ->                              -- method : TBasicType TUTF8
    Ptr Soup.URI.URI ->                     -- uri : TInterface (Name {namespace = "Soup", name = "URI"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Soup.RequestHTTP.RequestHTTP)

{- |
Creates a 'GI.Soup.Objects.Request.Request' for retrieving /@uri@/, which must be an
\"http\" or \"https\" URI (or another protocol listed in /@session@/\'s
'GI.Soup.Objects.Session.Session':@/http-aliases/@ or 'GI.Soup.Objects.Session.Session':@/https-aliases/@).

@since 2.42
-}
sessionRequestHttpUri ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> T.Text
    {- ^ /@method@/: an HTTP method -}
    -> Soup.URI.URI
    {- ^ /@uri@/: a 'GI.Soup.Structs.URI.URI' representing the URI to retrieve -}
    -> m Soup.RequestHTTP.RequestHTTP
    {- ^ __Returns:__ a new 'GI.Soup.Objects.RequestHTTP.RequestHTTP', or
  'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -}
sessionRequestHttpUri session method uri = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    method' <- textToCString method
    uri' <- unsafeManagedPtrGetPtr uri
    onException (do
        result <- propagateGError $ soup_session_request_http_uri session' method' uri'
        checkUnexpectedReturnNULL "sessionRequestHttpUri" result
        result' <- (wrapObject Soup.RequestHTTP.RequestHTTP) result
        touchManagedPtr session
        touchManagedPtr uri
        freeMem method'
        return result'
     ) (do
        freeMem method'
     )

data SessionRequestHttpUriMethodInfo
instance (signature ~ (T.Text -> Soup.URI.URI -> m Soup.RequestHTTP.RequestHTTP), MonadIO m, IsSession a) => O.MethodInfo SessionRequestHttpUriMethodInfo a signature where
    overloadedMethod _ = sessionRequestHttpUri

-- method Session::request_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupURI representing the URI to retrieve", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "Request"}))
-- throws : True
-- Skip return : False

foreign import ccall "soup_session_request_uri" soup_session_request_uri :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.URI.URI ->                     -- uri : TInterface (Name {namespace = "Soup", name = "URI"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Soup.Request.Request)

{- |
Creates a 'GI.Soup.Objects.Request.Request' for retrieving /@uri@/.

@since 2.42
-}
sessionRequestUri ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> Soup.URI.URI
    {- ^ /@uri@/: a 'GI.Soup.Structs.URI.URI' representing the URI to retrieve -}
    -> m Soup.Request.Request
    {- ^ __Returns:__ a new 'GI.Soup.Objects.Request.Request', or
  'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -}
sessionRequestUri session uri = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    uri' <- unsafeManagedPtrGetPtr uri
    onException (do
        result <- propagateGError $ soup_session_request_uri session' uri'
        checkUnexpectedReturnNULL "sessionRequestUri" result
        result' <- (wrapObject Soup.Request.Request) result
        touchManagedPtr session
        touchManagedPtr uri
        return result'
     ) (do
        return ()
     )

data SessionRequestUriMethodInfo
instance (signature ~ (Soup.URI.URI -> m Soup.Request.Request), MonadIO m, IsSession a) => O.MethodInfo SessionRequestUriMethodInfo a signature where
    overloadedMethod _ = sessionRequestUri

-- method Session::requeue_message
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message to requeue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_requeue_message" soup_session_requeue_message :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO ()

{- |
This causes /@msg@/ to be placed back on the queue to be attempted
again.
-}
sessionRequeueMessage ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@msg@/: the message to requeue -}
    -> m ()
sessionRequeueMessage session msg = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- unsafeManagedPtrCastPtr msg
    soup_session_requeue_message session' msg'
    touchManagedPtr session
    touchManagedPtr msg
    return ()

data SessionRequeueMessageMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsSession a, Soup.Message.IsMessage b) => O.MethodInfo SessionRequeueMessageMethodInfo a signature where
    overloadedMethod _ = sessionRequeueMessage

-- method Session::send
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GCancellable", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "InputStream"}))
-- throws : True
-- Skip return : False

foreign import ccall "soup_session_send" soup_session_send :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gio.InputStream.InputStream)

{- |
Synchronously sends /@msg@/ and waits for the beginning of a response.
On success, a 'GI.Gio.Objects.InputStream.InputStream' will be returned which you can use to
read the response body. (\"Success\" here means only that an HTTP
response was received and understood; it does not necessarily mean
that a 2xx class status code was received.)

If non-'Nothing', /@cancellable@/ can be used to cancel the request;
'GI.Soup.Objects.Session.sessionSend' will return a 'GI.Gio.Enums.IOErrorEnumCancelled' error. Note
that with requests that have side effects (eg,
\<literal>POST\<\/literal>, \<literal>PUT\<\/literal>,
\<literal>DELETE\<\/literal>) it is possible that you might cancel the
request after the server acts on it, but before it returns a
response, leaving the remote resource in an unknown state.

If /@msg@/ is requeued due to a redirect or authentication, the
initial (3xx\/401\/407) response body will be suppressed, and
'GI.Soup.Objects.Session.sessionSend' will only return once a final response has been
received.

Contrast this method with 'GI.Soup.Objects.Session.sessionSendMessage', which also
synchronously sends a 'GI.Soup.Objects.Message.Message', but doesn\'t return until the
response has been completely read.

(Note that this method cannot be called on the deprecated
'GI.Soup.Objects.SessionAsync.SessionAsync' subclass.)

@since 2.42
-}
sessionSend ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> Maybe (c)
    {- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable' -}
    -> m Gio.InputStream.InputStream
    {- ^ __Returns:__ a 'GI.Gio.Objects.InputStream.InputStream' for reading the
  response body, or 'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -}
sessionSend session msg cancellable = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- unsafeManagedPtrCastPtr msg
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ soup_session_send session' msg' maybeCancellable
        checkUnexpectedReturnNULL "sessionSend" result
        result' <- (wrapObject Gio.InputStream.InputStream) result
        touchManagedPtr session
        touchManagedPtr msg
        whenJust cancellable touchManagedPtr
        return result'
     ) (do
        return ()
     )

data SessionSendMethodInfo
instance (signature ~ (b -> Maybe (c) -> m Gio.InputStream.InputStream), MonadIO m, IsSession a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) => O.MethodInfo SessionSendMethodInfo a signature where
    overloadedMethod _ = sessionSend

-- method Session::send_async
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GCancellable", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the callback to invoke", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data for @callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_send_async" soup_session_send_async :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Asynchronously sends /@msg@/ and waits for the beginning of a
response. When /@callback@/ is called, then either /@msg@/ has been sent,
and its response headers received, or else an error has occurred.
Call 'GI.Soup.Objects.Session.sessionSendFinish' to get a 'GI.Gio.Objects.InputStream.InputStream' for reading
the response body.

See 'GI.Soup.Objects.Session.sessionSend' for more details on the general semantics.

Contrast this method with 'GI.Soup.Objects.Session.sessionQueueMessage', which also
asynchronously sends a 'GI.Soup.Objects.Message.Message', but doesn\'t invoke its
callback until the response has been completely read.

(Note that this method cannot be called on the deprecated
'GI.Soup.Objects.SessionSync.SessionSync' subclass, and can only be called on
'GI.Soup.Objects.SessionAsync.SessionAsync' if you have set the
'GI.Soup.Objects.Session.Session':@/use-thread-context/@ property.)

@since 2.42
-}
sessionSendAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> Maybe (c)
    {- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable' -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: the callback to invoke -}
    -> m ()
sessionSendAsync session msg cancellable callback = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- unsafeManagedPtrCastPtr msg
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    soup_session_send_async session' msg' maybeCancellable maybeCallback userData
    touchManagedPtr session
    touchManagedPtr msg
    whenJust cancellable touchManagedPtr
    return ()

data SessionSendAsyncMethodInfo
instance (signature ~ (b -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSession a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) => O.MethodInfo SessionSendAsyncMethodInfo a signature where
    overloadedMethod _ = sessionSendAsync

-- method Session::send_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GAsyncResult passed to your callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "InputStream"}))
-- throws : True
-- Skip return : False

foreign import ccall "soup_session_send_finish" soup_session_send_finish :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gio.InputStream.InputStream)

{- |
Gets the response to a 'GI.Soup.Objects.Session.sessionSendAsync' call and (if
successful), returns a 'GI.Gio.Objects.InputStream.InputStream' that can be used to read the
response body.

@since 2.42
-}
sessionSendFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@result@/: the 'GI.Gio.Interfaces.AsyncResult.AsyncResult' passed to your callback -}
    -> m Gio.InputStream.InputStream
    {- ^ __Returns:__ a 'GI.Gio.Objects.InputStream.InputStream' for reading the
  response body, or 'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -}
sessionSendFinish session result_ = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        result <- propagateGError $ soup_session_send_finish session' result_'
        checkUnexpectedReturnNULL "sessionSendFinish" result
        result' <- (wrapObject Gio.InputStream.InputStream) result
        touchManagedPtr session
        touchManagedPtr result_
        return result'
     ) (do
        return ()
     )

data SessionSendFinishMethodInfo
instance (signature ~ (b -> m Gio.InputStream.InputStream), MonadIO m, IsSession a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo SessionSendFinishMethodInfo a signature where
    overloadedMethod _ = sessionSendFinish

-- method Session::send_message
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message to send", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_send_message" soup_session_send_message :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO Word32

{- |
Synchronously send /@msg@/. This call will not return until the
transfer is finished successfully or there is an unrecoverable
error.

Unlike with 'GI.Soup.Objects.Session.sessionQueueMessage', /@msg@/ is not freed upon
return.

(Note that if you call this method on a 'GI.Soup.Objects.SessionAsync.SessionAsync', it will
still use asynchronous I\/O internally, running the glib main loop
to process the message, which may also cause other events to be
processed.)

Contrast this method with 'GI.Soup.Objects.Session.sessionSend', which also
synchronously sends a message, but returns before reading the
response body, and allows you to read the response via a
'GI.Gio.Objects.InputStream.InputStream'.
-}
sessionSendMessage ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@msg@/: the message to send -}
    -> m Word32
    {- ^ __Returns:__ the HTTP status code of the response -}
sessionSendMessage session msg = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_session_send_message session' msg'
    touchManagedPtr session
    touchManagedPtr msg
    return result

data SessionSendMessageMethodInfo
instance (signature ~ (b -> m Word32), MonadIO m, IsSession a, Soup.Message.IsMessage b) => O.MethodInfo SessionSendMessageMethodInfo a signature where
    overloadedMethod _ = sessionSendMessage

-- method Session::steal_connection
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message whose connection is to be stolen", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "IOStream"}))
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_steal_connection" soup_session_steal_connection :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO (Ptr Gio.IOStream.IOStream)

{- |
\"Steals\" the HTTP connection associated with /@msg@/ from /@session@/.
This happens immediately, regardless of the current state of the
connection, and /@msg@/\'s callback will not be called. You can steal
the connection from a 'GI.Soup.Objects.Message.Message' signal handler if you need to
wait for part or all of the response to be received first.

Calling this function may cause /@msg@/ to be freed if you are not
holding any other reference to it.

@since 2.50
-}
sessionStealConnection ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@msg@/: the message whose connection is to be stolen -}
    -> m Gio.IOStream.IOStream
    {- ^ __Returns:__ the 'GI.Gio.Objects.IOStream.IOStream' formerly associated
  with /@msg@/ (or 'Nothing' if /@msg@/ was no longer associated with a
  connection). No guarantees are made about what kind of 'GI.Gio.Objects.IOStream.IOStream'
  is returned. -}
sessionStealConnection session msg = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_session_steal_connection session' msg'
    checkUnexpectedReturnNULL "sessionStealConnection" result
    result' <- (wrapObject Gio.IOStream.IOStream) result
    touchManagedPtr session
    touchManagedPtr msg
    return result'

data SessionStealConnectionMethodInfo
instance (signature ~ (b -> m Gio.IOStream.IOStream), MonadIO m, IsSession a, Soup.Message.IsMessage b) => O.MethodInfo SessionStealConnectionMethodInfo a signature where
    overloadedMethod _ = sessionStealConnection

-- method Session::unpause_message
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage currently running on @session", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_unpause_message" soup_session_unpause_message :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO ()

{- |
Resumes HTTP I\/O on /@msg@/. Use this to resume after calling
'GI.Soup.Objects.Session.sessionPauseMessage'.

If /@msg@/ is being sent via blocking I\/O, this will resume reading or
writing immediately. If /@msg@/ is using non-blocking I\/O, then
reading or writing won\'t resume until you return to the main loop.

This may only be called for asynchronous messages (those sent on a
'GI.Soup.Objects.SessionAsync.SessionAsync' or using 'GI.Soup.Objects.Session.sessionQueueMessage').
-}
sessionUnpauseMessage ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' currently running on /@session@/ -}
    -> m ()
sessionUnpauseMessage session msg = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- unsafeManagedPtrCastPtr msg
    soup_session_unpause_message session' msg'
    touchManagedPtr session
    touchManagedPtr msg
    return ()

data SessionUnpauseMessageMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsSession a, Soup.Message.IsMessage b) => O.MethodInfo SessionUnpauseMessageMethodInfo a signature where
    overloadedMethod _ = sessionUnpauseMessage

-- method Session::websocket_connect_async
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#SoupMessage indicating the WebSocket server to connect to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "origin", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "origin of the connection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "protocols", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a\n  %NULL-terminated array of protocols supported", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GCancellable", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the callback to invoke", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 6, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data for @callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_websocket_connect_async" soup_session_websocket_connect_async :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    CString ->                              -- origin : TBasicType TUTF8
    Ptr CString ->                          -- protocols : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Asynchronously creates a 'GI.Soup.Objects.WebsocketConnection.WebsocketConnection' to communicate
with a remote server.

All necessary WebSocket-related headers will be added to /@msg@/, and
it will then be sent and asynchronously processed normally
(including handling of redirection and HTTP authentication).

If the server returns \"101 Switching Protocols\", then /@msg@/\'s status
code and response headers will be updated, and then the WebSocket
handshake will be completed. On success,
@/soup_websocket_connect_finish()/@ will return a new
'GI.Soup.Objects.WebsocketConnection.WebsocketConnection'. On failure it will return a 'GError'.

If the server returns a status other than \"101 Switching
Protocols\", then /@msg@/ will contain the complete response headers
and body from the server\'s response, and
@/soup_websocket_connect_finish()/@ will return
'GI.Soup.Enums.WebsocketErrorNotWebsocket'.

@since 2.50
-}
sessionWebsocketConnectAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@msg@/: 'GI.Soup.Objects.Message.Message' indicating the WebSocket server to connect to -}
    -> Maybe (T.Text)
    {- ^ /@origin@/: origin of the connection -}
    -> Maybe ([T.Text])
    {- ^ /@protocols@/: a
  'Nothing'-terminated array of protocols supported -}
    -> Maybe (c)
    {- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable' -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: the callback to invoke -}
    -> m ()
sessionWebsocketConnectAsync session msg origin protocols cancellable callback = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- unsafeManagedPtrCastPtr msg
    maybeOrigin <- case origin of
        Nothing -> return nullPtr
        Just jOrigin -> do
            jOrigin' <- textToCString jOrigin
            return jOrigin'
    maybeProtocols <- case protocols of
        Nothing -> return nullPtr
        Just jProtocols -> do
            jProtocols' <- packZeroTerminatedUTF8CArray jProtocols
            return jProtocols'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    soup_session_websocket_connect_async session' msg' maybeOrigin maybeProtocols maybeCancellable maybeCallback userData
    touchManagedPtr session
    touchManagedPtr msg
    whenJust cancellable touchManagedPtr
    freeMem maybeOrigin
    mapZeroTerminatedCArray freeMem maybeProtocols
    freeMem maybeProtocols
    return ()

data SessionWebsocketConnectAsyncMethodInfo
instance (signature ~ (b -> Maybe (T.Text) -> Maybe ([T.Text]) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSession a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) => O.MethodInfo SessionWebsocketConnectAsyncMethodInfo a signature where
    overloadedMethod _ = sessionWebsocketConnectAsync

-- method Session::websocket_connect_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GAsyncResult passed to your callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}))
-- throws : True
-- Skip return : False

foreign import ccall "soup_session_websocket_connect_finish" soup_session_websocket_connect_finish :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Soup.WebsocketConnection.WebsocketConnection)

{- |
Gets the 'GI.Soup.Objects.WebsocketConnection.WebsocketConnection' response to a
'GI.Soup.Objects.Session.sessionWebsocketConnectAsync' call and (if successful),
returns a @/SoupWebsockConnection/@ that can be used to communicate
with the server.

@since 2.50
-}
sessionWebsocketConnectFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@result@/: the 'GI.Gio.Interfaces.AsyncResult.AsyncResult' passed to your callback -}
    -> m Soup.WebsocketConnection.WebsocketConnection
    {- ^ __Returns:__ a new 'GI.Soup.Objects.WebsocketConnection.WebsocketConnection', or
  'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -}
sessionWebsocketConnectFinish session result_ = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        result <- propagateGError $ soup_session_websocket_connect_finish session' result_'
        checkUnexpectedReturnNULL "sessionWebsocketConnectFinish" result
        result' <- (wrapObject Soup.WebsocketConnection.WebsocketConnection) result
        touchManagedPtr session
        touchManagedPtr result_
        return result'
     ) (do
        return ()
     )

data SessionWebsocketConnectFinishMethodInfo
instance (signature ~ (b -> m Soup.WebsocketConnection.WebsocketConnection), MonadIO m, IsSession a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo SessionWebsocketConnectFinishMethodInfo a signature where
    overloadedMethod _ = sessionWebsocketConnectFinish

-- method Session::would_redirect
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage that has response headers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_would_redirect" soup_session_would_redirect :: 
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO CInt

{- |
Checks if /@msg@/ contains a response that would cause /@session@/ to
redirect it to a new URL (ignoring /@msg@/\'s 'GI.Soup.Flags.MessageFlagsNoRedirect'
flag, and the number of times it has already been redirected).

@since 2.38
-}
sessionWouldRedirect ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Soup.Message.IsMessage b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> b
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' that has response headers -}
    -> m Bool
    {- ^ __Returns:__ whether /@msg@/ would be redirected -}
sessionWouldRedirect session msg = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_session_would_redirect session' msg'
    let result' = (/= 0) result
    touchManagedPtr session
    touchManagedPtr msg
    return result'

data SessionWouldRedirectMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsSession a, Soup.Message.IsMessage b) => O.MethodInfo SessionWouldRedirectMethodInfo a signature where
    overloadedMethod _ = sessionWouldRedirect