{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

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

module GI.Soup.Objects.Session
    (

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


 -- * Methods
-- ** abort #method:abort#

#if ENABLE_OVERLOADING
    SessionAbortMethodInfo                  ,
#endif
    sessionAbort                            ,


-- ** addFeature #method:addFeature#

#if ENABLE_OVERLOADING
    SessionAddFeatureMethodInfo             ,
#endif
    sessionAddFeature                       ,


-- ** addFeatureByType #method:addFeatureByType#

#if ENABLE_OVERLOADING
    SessionAddFeatureByTypeMethodInfo       ,
#endif
    sessionAddFeatureByType                 ,


-- ** cancelMessage #method:cancelMessage#

#if ENABLE_OVERLOADING
    SessionCancelMessageMethodInfo          ,
#endif
    sessionCancelMessage                    ,


-- ** connectAsync #method:connectAsync#

#if ENABLE_OVERLOADING
    SessionConnectAsyncMethodInfo           ,
#endif
    sessionConnectAsync                     ,


-- ** connectFinish #method:connectFinish#

#if ENABLE_OVERLOADING
    SessionConnectFinishMethodInfo          ,
#endif
    sessionConnectFinish                    ,


-- ** getAsyncContext #method:getAsyncContext#

#if ENABLE_OVERLOADING
    SessionGetAsyncContextMethodInfo        ,
#endif
    sessionGetAsyncContext                  ,


-- ** getFeature #method:getFeature#

#if ENABLE_OVERLOADING
    SessionGetFeatureMethodInfo             ,
#endif
    sessionGetFeature                       ,


-- ** getFeatureForMessage #method:getFeatureForMessage#

#if ENABLE_OVERLOADING
    SessionGetFeatureForMessageMethodInfo   ,
#endif
    sessionGetFeatureForMessage             ,


-- ** getFeatures #method:getFeatures#

#if ENABLE_OVERLOADING
    SessionGetFeaturesMethodInfo            ,
#endif
    sessionGetFeatures                      ,


-- ** hasFeature #method:hasFeature#

#if ENABLE_OVERLOADING
    SessionHasFeatureMethodInfo             ,
#endif
    sessionHasFeature                       ,


-- ** new #method:new#

    sessionNew                              ,


-- ** pauseMessage #method:pauseMessage#

#if ENABLE_OVERLOADING
    SessionPauseMessageMethodInfo           ,
#endif
    sessionPauseMessage                     ,


-- ** prefetchDns #method:prefetchDns#

#if ENABLE_OVERLOADING
    SessionPrefetchDnsMethodInfo            ,
#endif
    sessionPrefetchDns                      ,


-- ** prepareForUri #method:prepareForUri#

#if ENABLE_OVERLOADING
    SessionPrepareForUriMethodInfo          ,
#endif
    sessionPrepareForUri                    ,


-- ** queueMessage #method:queueMessage#

#if ENABLE_OVERLOADING
    SessionQueueMessageMethodInfo           ,
#endif
    sessionQueueMessage                     ,


-- ** redirectMessage #method:redirectMessage#

#if ENABLE_OVERLOADING
    SessionRedirectMessageMethodInfo        ,
#endif
    sessionRedirectMessage                  ,


-- ** removeFeature #method:removeFeature#

#if ENABLE_OVERLOADING
    SessionRemoveFeatureMethodInfo          ,
#endif
    sessionRemoveFeature                    ,


-- ** removeFeatureByType #method:removeFeatureByType#

#if ENABLE_OVERLOADING
    SessionRemoveFeatureByTypeMethodInfo    ,
#endif
    sessionRemoveFeatureByType              ,


-- ** request #method:request#

#if ENABLE_OVERLOADING
    SessionRequestMethodInfo                ,
#endif
    sessionRequest                          ,


-- ** requestHttp #method:requestHttp#

#if ENABLE_OVERLOADING
    SessionRequestHttpMethodInfo            ,
#endif
    sessionRequestHttp                      ,


-- ** requestHttpUri #method:requestHttpUri#

#if ENABLE_OVERLOADING
    SessionRequestHttpUriMethodInfo         ,
#endif
    sessionRequestHttpUri                   ,


-- ** requestUri #method:requestUri#

#if ENABLE_OVERLOADING
    SessionRequestUriMethodInfo             ,
#endif
    sessionRequestUri                       ,


-- ** requeueMessage #method:requeueMessage#

#if ENABLE_OVERLOADING
    SessionRequeueMessageMethodInfo         ,
#endif
    sessionRequeueMessage                   ,


-- ** send #method:send#

#if ENABLE_OVERLOADING
    SessionSendMethodInfo                   ,
#endif
    sessionSend                             ,


-- ** sendAsync #method:sendAsync#

#if ENABLE_OVERLOADING
    SessionSendAsyncMethodInfo              ,
#endif
    sessionSendAsync                        ,


-- ** sendFinish #method:sendFinish#

#if ENABLE_OVERLOADING
    SessionSendFinishMethodInfo             ,
#endif
    sessionSendFinish                       ,


-- ** sendMessage #method:sendMessage#

#if ENABLE_OVERLOADING
    SessionSendMessageMethodInfo            ,
#endif
    sessionSendMessage                      ,


-- ** stealConnection #method:stealConnection#

#if ENABLE_OVERLOADING
    SessionStealConnectionMethodInfo        ,
#endif
    sessionStealConnection                  ,


-- ** unpauseMessage #method:unpauseMessage#

#if ENABLE_OVERLOADING
    SessionUnpauseMessageMethodInfo         ,
#endif
    sessionUnpauseMessage                   ,


-- ** websocketConnectAsync #method:websocketConnectAsync#

#if ENABLE_OVERLOADING
    SessionWebsocketConnectAsyncMethodInfo  ,
#endif
    sessionWebsocketConnectAsync            ,


-- ** websocketConnectFinish #method:websocketConnectFinish#

#if ENABLE_OVERLOADING
    SessionWebsocketConnectFinishMethodInfo ,
#endif
    sessionWebsocketConnectFinish           ,


-- ** wouldRedirect #method:wouldRedirect#

#if ENABLE_OVERLOADING
    SessionWouldRedirectMethodInfo          ,
#endif
    sessionWouldRedirect                    ,




 -- * Properties
-- ** acceptLanguage #attr:acceptLanguage#
{- | If non-'Nothing', the value to use for the \"Accept-Language\" header
on 'GI.Soup.Objects.Message.Message'\<!-- -->s sent from this session.

Setting this will disable
'GI.Soup.Objects.Session.Session':@/accept-language-auto/@.

/Since: 2.30/
-}
#if ENABLE_OVERLOADING
    SessionAcceptLanguagePropertyInfo       ,
#endif
    clearSessionAcceptLanguage              ,
    constructSessionAcceptLanguage          ,
    getSessionAcceptLanguage                ,
#if ENABLE_OVERLOADING
    sessionAcceptLanguage                   ,
#endif
    setSessionAcceptLanguage                ,


-- ** acceptLanguageAuto #attr:acceptLanguageAuto#
{- | If 'True', 'GI.Soup.Objects.Session.Session' will automatically set the string
for the \"Accept-Language\" header on every 'GI.Soup.Objects.Message.Message'
sent, based on the return value of 'GI.GLib.Functions.getLanguageNames'.

Setting this will override any previous value of
'GI.Soup.Objects.Session.Session':@/accept-language/@.

/Since: 2.30/
-}
#if ENABLE_OVERLOADING
    SessionAcceptLanguageAutoPropertyInfo   ,
#endif
    constructSessionAcceptLanguageAuto      ,
    getSessionAcceptLanguageAuto            ,
#if ENABLE_OVERLOADING
    sessionAcceptLanguageAuto               ,
#endif
    setSessionAcceptLanguageAuto            ,


-- ** asyncContext #attr:asyncContext#
{- | The 'GI.GLib.Structs.MainContext.MainContext' that miscellaneous session-related
asynchronous callbacks are invoked on. (Eg, setting
'GI.Soup.Objects.Session.Session':@/idle-timeout/@ will add a timeout source on this
context.)

For a plain 'GI.Soup.Objects.Session.Session', this property is always set to
the 'GI.GLib.Structs.MainContext.MainContext' that is the thread-default at the time
the session was created, and cannot be overridden. For the
deprecated 'GI.Soup.Objects.Session.Session' subclasses, the default value is
'Nothing', meaning to use the global default 'GI.GLib.Structs.MainContext.MainContext'.

If 'GI.Soup.Objects.Session.Session':@/use-thread-context/@ is 'False', this context
will also be used for asynchronous HTTP I\/O.
-}
#if ENABLE_OVERLOADING
    SessionAsyncContextPropertyInfo         ,
#endif
    constructSessionAsyncContext            ,
    getSessionAsyncContext                  ,
#if ENABLE_OVERLOADING
    sessionAsyncContext                     ,
#endif


-- ** httpAliases #attr:httpAliases#
{- | A 'Nothing'-terminated array of URI schemes that should be
considered to be aliases for \"http\". Eg, if this included
\<literal>\"dav\"\<\/literal>, than a URI of
\<literal>dav:\/\/example.com\/path\<\/literal> would be treated
identically to \<literal>http:\/\/example.com\/path\<\/literal>.

In a plain 'GI.Soup.Objects.Session.Session', the default value is 'Nothing',
meaning that only \"http\" is recognized as meaning \"http\".
In 'GI.Soup.Objects.SessionAsync.SessionAsync' and 'GI.Soup.Objects.SessionSync.SessionSync', for backward
compatibility, the default value is an array containing the
single element \<literal>\"*\"\<\/literal>, a special value
which means that any scheme except \"https\" is considered to
be an alias for \"http\".

See also 'GI.Soup.Objects.Session.Session':@/https-aliases/@.

/Since: 2.38/
-}
#if ENABLE_OVERLOADING
    SessionHttpAliasesPropertyInfo          ,
#endif
    clearSessionHttpAliases                 ,
    constructSessionHttpAliases             ,
    getSessionHttpAliases                   ,
#if ENABLE_OVERLOADING
    sessionHttpAliases                      ,
#endif
    setSessionHttpAliases                   ,


-- ** httpsAliases #attr:httpsAliases#
{- | A comma-delimited list of URI schemes that should be
considered to be aliases for \"https\". See
'GI.Soup.Objects.Session.Session':@/http-aliases/@ for more information.

The default value is 'Nothing', meaning that no URI schemes
are considered aliases for \"https\".

/Since: 2.38/
-}
#if ENABLE_OVERLOADING
    SessionHttpsAliasesPropertyInfo         ,
#endif
    clearSessionHttpsAliases                ,
    constructSessionHttpsAliases            ,
    getSessionHttpsAliases                  ,
#if ENABLE_OVERLOADING
    sessionHttpsAliases                     ,
#endif
    setSessionHttpsAliases                  ,


-- ** idleTimeout #attr:idleTimeout#
{- | Connection lifetime (in seconds) when idle. Any connection
left idle longer than this will be closed.

Although you can change this property at any time, it will
only affect newly-created connections, not currently-open
ones. You can call 'GI.Soup.Objects.Session.sessionAbort' after setting this
if you want to ensure that all future connections will have
this timeout value.

Note that the default value of 60 seconds only applies to
plain @/SoupSessions/@. If you are using 'GI.Soup.Objects.SessionAsync.SessionAsync' or
'GI.Soup.Objects.SessionSync.SessionSync', the default value is 0 (meaning idle
connections will never time out).

/Since: 2.24/
-}
#if ENABLE_OVERLOADING
    SessionIdleTimeoutPropertyInfo          ,
#endif
    constructSessionIdleTimeout             ,
    getSessionIdleTimeout                   ,
#if ENABLE_OVERLOADING
    sessionIdleTimeout                      ,
#endif
    setSessionIdleTimeout                   ,


-- ** localAddress #attr:localAddress#
{- | Sets the 'GI.Soup.Objects.Address.Address' to use for the client side of
the connection.

Use this property if you want for instance to bind the
local socket to a specific IP address.

/Since: 2.42/
-}
#if ENABLE_OVERLOADING
    SessionLocalAddressPropertyInfo         ,
#endif
    constructSessionLocalAddress            ,
    getSessionLocalAddress                  ,
#if ENABLE_OVERLOADING
    sessionLocalAddress                     ,
#endif


-- ** maxConns #attr:maxConns#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    SessionMaxConnsPropertyInfo             ,
#endif
    constructSessionMaxConns                ,
    getSessionMaxConns                      ,
#if ENABLE_OVERLOADING
    sessionMaxConns                         ,
#endif
    setSessionMaxConns                      ,


-- ** maxConnsPerHost #attr:maxConnsPerHost#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    SessionMaxConnsPerHostPropertyInfo      ,
#endif
    constructSessionMaxConnsPerHost         ,
    getSessionMaxConnsPerHost               ,
#if ENABLE_OVERLOADING
    sessionMaxConnsPerHost                  ,
#endif
    setSessionMaxConnsPerHost               ,


-- ** proxyResolver #attr:proxyResolver#
{- | A 'GI.Gio.Interfaces.ProxyResolver.ProxyResolver' to use with this session. Setting this
will clear the 'GI.Soup.Objects.Session.Session':@/proxy-uri/@ property, and remove
any \<type>SoupProxyURIResolver\<\/type> features that have
been added to the session.

By default, in a plain 'GI.Soup.Objects.Session.Session', this is set to the
default 'GI.Gio.Interfaces.ProxyResolver.ProxyResolver', but you can set it to 'Nothing' if you
don\'t want to use proxies, or set it to your own
'GI.Gio.Interfaces.ProxyResolver.ProxyResolver' if you want to control what proxies get
used.

/Since: 2.42/
-}
#if ENABLE_OVERLOADING
    SessionProxyResolverPropertyInfo        ,
#endif
    clearSessionProxyResolver               ,
    constructSessionProxyResolver           ,
    getSessionProxyResolver                 ,
#if ENABLE_OVERLOADING
    sessionProxyResolver                    ,
#endif
    setSessionProxyResolver                 ,


-- ** proxyUri #attr:proxyUri#
{- | A proxy to use for all http and https requests in this
session. Setting this will clear the
'GI.Soup.Objects.Session.Session':@/proxy-resolver/@ property, and remove any
\<type>SoupProxyURIResolver\<\/type> features that have been
added to the session. Setting this property will also
cancel all currently pending messages.

Note that 'GI.Soup.Objects.Session.Session' will normally handle looking up the
user\'s proxy settings for you; you should only use
'GI.Soup.Objects.Session.Session':@/proxy-uri/@ if you need to override the user\'s
normal proxy settings.

Also note that this proxy will be used for
\<emphasis>all\<\/emphasis> requests; even requests to
\<literal>localhost\<\/literal>. If you need more control over
proxies, you can create a 'GI.Gio.Objects.SimpleProxyResolver.SimpleProxyResolver' and set the
'GI.Soup.Objects.Session.Session':@/proxy-resolver/@ property.
-}
#if ENABLE_OVERLOADING
    SessionProxyUriPropertyInfo             ,
#endif
    clearSessionProxyUri                    ,
    constructSessionProxyUri                ,
    getSessionProxyUri                      ,
#if ENABLE_OVERLOADING
    sessionProxyUri                         ,
#endif
    setSessionProxyUri                      ,


-- ** sslCaFile #attr:sslCaFile#
{- | File containing SSL CA certificates.

If the specified file does not exist or cannot be read,
then libsoup will print a warning, and then behave as
though it had read in a empty CA file, meaning that all SSL
certificates will be considered invalid.
-}
#if ENABLE_OVERLOADING
    SessionSslCaFilePropertyInfo            ,
#endif
    clearSessionSslCaFile                   ,
    constructSessionSslCaFile               ,
    getSessionSslCaFile                     ,
#if ENABLE_OVERLOADING
    sessionSslCaFile                        ,
#endif
    setSessionSslCaFile                     ,


-- ** sslStrict #attr:sslStrict#
{- | Normally, if 'GI.Soup.Objects.Session.Session':@/tls-database/@ is set (including if
it was set via 'GI.Soup.Objects.Session.Session':@/ssl-use-system-ca-file/@ or
'GI.Soup.Objects.Session.Session':@/ssl-ca-file/@), then libsoup will reject any
certificate that is invalid (ie, expired) or that is not
signed by one of the given CA certificates, and the
'GI.Soup.Objects.Message.Message' will fail with the status
'GI.Soup.Enums.StatusSslFailed'.

If you set 'GI.Soup.Objects.Session.Session':@/ssl-strict/@ to 'False', then all
certificates will be accepted, and you will need to call
'GI.Soup.Objects.Message.messageGetHttpsStatus' to distinguish valid from
invalid certificates. (This can be used, eg, if you want to
accept invalid certificates after giving some sort of
warning.)

For a plain 'GI.Soup.Objects.Session.Session', if the session has no CA file or
TLS database, and this property is 'True', then all
certificates will be rejected. However, beware that the
deprecated 'GI.Soup.Objects.Session.Session' subclasses ('GI.Soup.Objects.SessionAsync.SessionAsync' and
'GI.Soup.Objects.SessionSync.SessionSync') have the opposite behavior: if there is
no CA file or TLS database, then all certificates are always
accepted, and this property has no effect.

/Since: 2.30/
-}
#if ENABLE_OVERLOADING
    SessionSslStrictPropertyInfo            ,
#endif
    constructSessionSslStrict               ,
    getSessionSslStrict                     ,
#if ENABLE_OVERLOADING
    sessionSslStrict                        ,
#endif
    setSessionSslStrict                     ,


-- ** sslUseSystemCaFile #attr:sslUseSystemCaFile#
{- | Setting this to 'True' is equivalent to setting
'GI.Soup.Objects.Session.Session':@/tls-database/@ to the default system CA database.
(and likewise, setting 'GI.Soup.Objects.Session.Session':@/tls-database/@ to the
default database by hand will cause this property to
become 'True').

Setting this to 'False' (when it was previously 'True') will
clear the 'GI.Soup.Objects.Session.Session':@/tls-database/@ field.

See 'GI.Soup.Objects.Session.Session':@/ssl-strict/@ for more information on how
https certificate validation is handled.

Note that the default value of 'True' only applies to plain
@/SoupSessions/@. If you are using 'GI.Soup.Objects.SessionAsync.SessionAsync' or
'GI.Soup.Objects.SessionSync.SessionSync', the default value is 'False', for backward
compatibility.

/Since: 2.38/
-}
#if ENABLE_OVERLOADING
    SessionSslUseSystemCaFilePropertyInfo   ,
#endif
    constructSessionSslUseSystemCaFile      ,
    getSessionSslUseSystemCaFile            ,
#if ENABLE_OVERLOADING
    sessionSslUseSystemCaFile               ,
#endif
    setSessionSslUseSystemCaFile            ,


-- ** timeout #attr:timeout#
{- | The timeout (in seconds) for socket I\/O operations
(including connecting to a server, and waiting for a reply
to an HTTP request).

Although you can change this property at any time, it will
only affect newly-created connections, not currently-open
ones. You can call 'GI.Soup.Objects.Session.sessionAbort' after setting this
if you want to ensure that all future connections will have
this timeout value.

Note that the default value of 60 seconds only applies to
plain @/SoupSessions/@. If you are using 'GI.Soup.Objects.SessionAsync.SessionAsync' or
'GI.Soup.Objects.SessionSync.SessionSync', the default value is 0 (meaning socket I\/O
will not time out).

Not to be confused with 'GI.Soup.Objects.Session.Session':@/idle-timeout/@ (which is
the length of time that idle persistent connections will be
kept open).
-}
#if ENABLE_OVERLOADING
    SessionTimeoutPropertyInfo              ,
#endif
    constructSessionTimeout                 ,
    getSessionTimeout                       ,
#if ENABLE_OVERLOADING
    sessionTimeout                          ,
#endif
    setSessionTimeout                       ,


-- ** tlsDatabase #attr:tlsDatabase#
{- | Sets the 'GI.Gio.Objects.TlsDatabase.TlsDatabase' to use for validating SSL\/TLS
certificates.

Note that setting the 'GI.Soup.Objects.Session.Session':@/ssl-ca-file/@ or
'GI.Soup.Objects.Session.Session':@/ssl-use-system-ca-file/@ property will cause
this property to be set to a 'GI.Gio.Objects.TlsDatabase.TlsDatabase' corresponding to
the indicated file or system default.

See 'GI.Soup.Objects.Session.Session':@/ssl-strict/@ for more information on how
https certificate validation is handled.

If you are using a plain 'GI.Soup.Objects.Session.Session' then
'GI.Soup.Objects.Session.Session':@/ssl-use-system-ca-file/@ will be 'True' by
default, and so this property will be a copy of the system
CA database. If you are using 'GI.Soup.Objects.SessionAsync.SessionAsync' or
'GI.Soup.Objects.SessionSync.SessionSync', this property will be 'Nothing' by default.

/Since: 2.38/
-}
#if ENABLE_OVERLOADING
    SessionTlsDatabasePropertyInfo          ,
#endif
    clearSessionTlsDatabase                 ,
    constructSessionTlsDatabase             ,
    getSessionTlsDatabase                   ,
#if ENABLE_OVERLOADING
    sessionTlsDatabase                      ,
#endif
    setSessionTlsDatabase                   ,


-- ** tlsInteraction #attr:tlsInteraction#
{- | A 'GI.Gio.Objects.TlsInteraction.TlsInteraction' object that will be passed on to any
@/GTlsConnections/@ created by the session. (This can be used to
provide client-side certificates, for example.)

/Since: 2.48/
-}
#if ENABLE_OVERLOADING
    SessionTlsInteractionPropertyInfo       ,
#endif
    clearSessionTlsInteraction              ,
    constructSessionTlsInteraction          ,
    getSessionTlsInteraction                ,
#if ENABLE_OVERLOADING
    sessionTlsInteraction                   ,
#endif
    setSessionTlsInteraction                ,


-- ** useNtlm #attr:useNtlm#
{- | Whether or not to use NTLM authentication.
-}
#if ENABLE_OVERLOADING
    SessionUseNtlmPropertyInfo              ,
#endif
    constructSessionUseNtlm                 ,
    getSessionUseNtlm                       ,
#if ENABLE_OVERLOADING
    sessionUseNtlm                          ,
#endif
    setSessionUseNtlm                       ,


-- ** useThreadContext #attr:useThreadContext#
{- | If 'True' (which it always is on a plain 'GI.Soup.Objects.Session.Session'),
asynchronous HTTP requests in this session will run in
whatever the thread-default 'GI.GLib.Structs.MainContext.MainContext' is at the time
they are started, rather than always occurring in
'GI.Soup.Objects.Session.Session':@/async-context/@.

/Since: 2.38/
-}
#if ENABLE_OVERLOADING
    SessionUseThreadContextPropertyInfo     ,
#endif
    constructSessionUseThreadContext        ,
    getSessionUseThreadContext              ,
#if ENABLE_OVERLOADING
    sessionUseThreadContext                 ,
#endif
    setSessionUseThreadContext              ,


-- ** userAgent #attr:userAgent#
{- | If non-'Nothing', the value to use for the \"User-Agent\" header
on 'GI.Soup.Objects.Message.Message'\<!-- -->s sent from this session.

RFC 2616 says: \"The User-Agent request-header field
contains information about the user agent originating the
request. This is for statistical purposes, the tracing of
protocol violations, and automated recognition of user
agents for the sake of tailoring responses to avoid
particular user agent limitations. User agents SHOULD
include this field with requests.\"

The User-Agent header contains a list of one or more
product tokens, separated by whitespace, with the most
significant product token coming first. The tokens must be
brief, ASCII, and mostly alphanumeric (although \"-\", \"_\",
and \".\" are also allowed), and may optionally include a \"\/\"
followed by a version string. You may also put comments,
enclosed in parentheses, between or after the tokens.

If you set a 'GI.Soup.Objects.Session.Session':@/user_agent/@ property that has trailing
whitespace, 'GI.Soup.Objects.Session.Session' will append its own product token
(eg, \"\<literal>libsoup\/2.3.2\<\/literal>\") to the end of the
header for you.
-}
#if ENABLE_OVERLOADING
    SessionUserAgentPropertyInfo            ,
#endif
    clearSessionUserAgent                   ,
    constructSessionUserAgent               ,
    getSessionUserAgent                     ,
#if ENABLE_OVERLOADING
    sessionUserAgent                        ,
#endif
    setSessionUserAgent                     ,




 -- * Signals
-- ** authenticate #signal:authenticate#

    C_SessionAuthenticateCallback           ,
    SessionAuthenticateCallback             ,
#if ENABLE_OVERLOADING
    SessionAuthenticateSignalInfo           ,
#endif
    afterSessionAuthenticate                ,
    genClosure_SessionAuthenticate          ,
    mk_SessionAuthenticateCallback          ,
    noSessionAuthenticateCallback           ,
    onSessionAuthenticate                   ,
    wrap_SessionAuthenticateCallback        ,


-- ** connectionCreated #signal:connectionCreated#

    C_SessionConnectionCreatedCallback      ,
    SessionConnectionCreatedCallback        ,
#if ENABLE_OVERLOADING
    SessionConnectionCreatedSignalInfo      ,
#endif
    afterSessionConnectionCreated           ,
    genClosure_SessionConnectionCreated     ,
    mk_SessionConnectionCreatedCallback     ,
    noSessionConnectionCreatedCallback      ,
    onSessionConnectionCreated              ,
    wrap_SessionConnectionCreatedCallback   ,


-- ** requestQueued #signal:requestQueued#

    C_SessionRequestQueuedCallback          ,
    SessionRequestQueuedCallback            ,
#if ENABLE_OVERLOADING
    SessionRequestQueuedSignalInfo          ,
#endif
    afterSessionRequestQueued               ,
    genClosure_SessionRequestQueued         ,
    mk_SessionRequestQueuedCallback         ,
    noSessionRequestQueuedCallback          ,
    onSessionRequestQueued                  ,
    wrap_SessionRequestQueuedCallback       ,


-- ** requestStarted #signal:requestStarted#

    C_SessionRequestStartedCallback         ,
    SessionRequestStartedCallback           ,
#if ENABLE_OVERLOADING
    SessionRequestStartedSignalInfo         ,
#endif
    afterSessionRequestStarted              ,
    genClosure_SessionRequestStarted        ,
    mk_SessionRequestStartedCallback        ,
    noSessionRequestStartedCallback         ,
    onSessionRequestStarted                 ,
    wrap_SessionRequestStartedCallback      ,


-- ** requestUnqueued #signal:requestUnqueued#

    C_SessionRequestUnqueuedCallback        ,
    SessionRequestUnqueuedCallback          ,
#if ENABLE_OVERLOADING
    SessionRequestUnqueuedSignalInfo        ,
#endif
    afterSessionRequestUnqueued             ,
    genClosure_SessionRequestUnqueued       ,
    mk_SessionRequestUnqueuedCallback       ,
    noSessionRequestUnqueuedCallback        ,
    onSessionRequestUnqueued                ,
    wrap_SessionRequestUnqueuedCallback     ,


-- ** tunneling #signal:tunneling#

    C_SessionTunnelingCallback              ,
    SessionTunnelingCallback                ,
#if ENABLE_OVERLOADING
    SessionTunnelingSignalInfo              ,
#endif
    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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.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

-- | Memory-managed wrapper type.
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


-- | Type class for types which can be safely cast to `Session`, for instance with `toSession`.
class (GObject o, O.IsDescendantOf Session o) => IsSession o
instance (GObject o, O.IsDescendantOf Session o) => IsSession o

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

-- | Cast to `Session`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toSession :: (MonadIO m, IsSession o) => o -> m Session
toSession = liftIO . unsafeCastTo Session

-- | A convenience alias for `Nothing` :: `Maybe` `Session`.
noSession :: Maybe Session
noSession = Nothing

#if ENABLE_OVERLOADING
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 "connectAsync" o = SessionConnectAsyncMethodInfo
    ResolveSessionMethod "connectFinish" o = SessionConnectFinishMethodInfo
    ResolveSessionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSessionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSessionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    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 "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) => OL.IsLabel t (Session -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- signal Session::authenticate
{- |
Emitted when the session requires authentication. If
credentials are available call 'GI.Soup.Objects.Auth.authAuthenticate' on
/@auth@/. If these credentials fail, the signal will be
emitted again, with /@retrying@/ set to 'True', which will
continue until you return without calling
'GI.Soup.Objects.Auth.authAuthenticate' on /@auth@/.

Note that this may be emitted before /@msg@/\'s body has been
fully read.

If you call 'GI.Soup.Objects.Session.sessionPauseMessage' on /@msg@/ before
returning, then you can authenticate /@auth@/ asynchronously
(as long as you 'GI.GObject.Objects.Object.objectRef' it to make sure it doesn\'t
get destroyed), and then unpause /@msg@/ when you are ready
for it to continue.
-}
type SessionAuthenticateCallback =
    Soup.Message.Message
    {- ^ /@msg@/: the 'GI.Soup.Objects.Message.Message' being sent -}
    -> Soup.Auth.Auth
    {- ^ /@auth@/: the 'GI.Soup.Objects.Auth.Auth' to authenticate -}
    -> Bool
    {- ^ /@retrying@/: 'True' if this is the second (or later) attempt -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SessionAuthenticateCallback`@.
noSessionAuthenticateCallback :: Maybe SessionAuthenticateCallback
noSessionAuthenticateCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_SessionAuthenticateCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr Soup.Auth.Auth ->
    CInt ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_SessionAuthenticateCallback`.
foreign import ccall "wrapper"
    mk_SessionAuthenticateCallback :: C_SessionAuthenticateCallback -> IO (FunPtr C_SessionAuthenticateCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_SessionAuthenticate :: MonadIO m => SessionAuthenticateCallback -> m (GClosure C_SessionAuthenticateCallback)
genClosure_SessionAuthenticate cb = liftIO $ do
    let cb' = wrap_SessionAuthenticateCallback cb
    mk_SessionAuthenticateCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `SessionAuthenticateCallback` into a `C_SessionAuthenticateCallback`.
wrap_SessionAuthenticateCallback ::
    SessionAuthenticateCallback ->
    C_SessionAuthenticateCallback
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'


{- |
Connect a signal handler for the “@authenticate@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' session #authenticate callback
@
-}
onSessionAuthenticate :: (IsSession a, MonadIO m) => a -> SessionAuthenticateCallback -> m SignalHandlerId
onSessionAuthenticate obj cb = liftIO $ do
    let cb' = wrap_SessionAuthenticateCallback cb
    cb'' <- mk_SessionAuthenticateCallback cb'
    connectSignalFunPtr obj "authenticate" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@authenticate@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' session #authenticate callback
@
-}
afterSessionAuthenticate :: (IsSession a, MonadIO m) => a -> SessionAuthenticateCallback -> m SignalHandlerId
afterSessionAuthenticate obj cb = liftIO $ do
    let cb' = wrap_SessionAuthenticateCallback cb
    cb'' <- mk_SessionAuthenticateCallback cb'
    connectSignalFunPtr obj "authenticate" cb'' SignalConnectAfter


-- signal Session::connection-created
{- |
Emitted when a new connection is created. This is an
internal signal intended only to be used for debugging
purposes, and may go away in the future.

/Since: 2.30/
-}
type SessionConnectionCreatedCallback =
    GObject.Object.Object
    {- ^ /@connection@/: the connection -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SessionConnectionCreatedCallback`@.
noSessionConnectionCreatedCallback :: Maybe SessionConnectionCreatedCallback
noSessionConnectionCreatedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_SessionConnectionCreatedCallback =
    Ptr () ->                               -- object
    Ptr GObject.Object.Object ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_SessionConnectionCreatedCallback`.
foreign import ccall "wrapper"
    mk_SessionConnectionCreatedCallback :: C_SessionConnectionCreatedCallback -> IO (FunPtr C_SessionConnectionCreatedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_SessionConnectionCreated :: MonadIO m => SessionConnectionCreatedCallback -> m (GClosure C_SessionConnectionCreatedCallback)
genClosure_SessionConnectionCreated cb = liftIO $ do
    let cb' = wrap_SessionConnectionCreatedCallback cb
    mk_SessionConnectionCreatedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `SessionConnectionCreatedCallback` into a `C_SessionConnectionCreatedCallback`.
wrap_SessionConnectionCreatedCallback ::
    SessionConnectionCreatedCallback ->
    C_SessionConnectionCreatedCallback
wrap_SessionConnectionCreatedCallback _cb _ connection _ = do
    connection' <- (newObject GObject.Object.Object) connection
    _cb  connection'


{- |
Connect a signal handler for the “@connection-created@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' session #connectionCreated callback
@
-}
onSessionConnectionCreated :: (IsSession a, MonadIO m) => a -> SessionConnectionCreatedCallback -> m SignalHandlerId
onSessionConnectionCreated obj cb = liftIO $ do
    let cb' = wrap_SessionConnectionCreatedCallback cb
    cb'' <- mk_SessionConnectionCreatedCallback cb'
    connectSignalFunPtr obj "connection-created" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@connection-created@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' session #connectionCreated callback
@
-}
afterSessionConnectionCreated :: (IsSession a, MonadIO m) => a -> SessionConnectionCreatedCallback -> m SignalHandlerId
afterSessionConnectionCreated obj cb = liftIO $ do
    let cb' = wrap_SessionConnectionCreatedCallback cb
    cb'' <- mk_SessionConnectionCreatedCallback cb'
    connectSignalFunPtr obj "connection-created" cb'' SignalConnectAfter


-- signal Session::request-queued
{- |
Emitted when a request is queued on /@session@/. (Note that
\"queued\" doesn\'t just mean 'GI.Soup.Objects.Session.sessionQueueMessage';
'GI.Soup.Objects.Session.sessionSendMessage' implicitly queues the message
as well.)

When sending a request, first 'GI.Soup.Objects.Session.Session'::@/request_queued/@
is emitted, indicating that the session has become aware of
the request.

Once a connection is available to send the request on, the
session emits 'GI.Soup.Objects.Session.Session'::@/request_started/@. Then, various
'GI.Soup.Objects.Message.Message' signals are emitted as the message is
processed. If the message is requeued, it will emit
'GI.Soup.Objects.Message.Message'::@/restarted/@, which will then be followed by
another 'GI.Soup.Objects.Session.Session'::@/request_started/@ and another set of
'GI.Soup.Objects.Message.Message' signals when the message is re-sent.

Eventually, the message will emit 'GI.Soup.Objects.Message.Message'::@/finished/@.
Normally, this signals the completion of message
processing. However, it is possible that the application
will requeue the message from the \"finished\" handler (or
equivalently, from the 'GI.Soup.Objects.Session.sessionQueueMessage'
callback). In that case, the process will loop back to
'GI.Soup.Objects.Session.Session'::@/request_started/@.

Eventually, a message will reach \"finished\" and not be
requeued. At that point, the session will emit
'GI.Soup.Objects.Session.Session'::@/request_unqueued/@ to indicate that it is done
with the message.

To sum up: 'GI.Soup.Objects.Session.Session'::@/request_queued/@ and
'GI.Soup.Objects.Session.Session'::@/request_unqueued/@ are guaranteed to be emitted
exactly once, but 'GI.Soup.Objects.Session.Session'::@/request_started/@ and
'GI.Soup.Objects.Message.Message'::@/finished/@ (and all of the other 'GI.Soup.Objects.Message.Message'
signals) may be invoked multiple times for a given message.

/Since: 2.24/
-}
type SessionRequestQueuedCallback =
    Soup.Message.Message
    {- ^ /@msg@/: the request that was queued -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SessionRequestQueuedCallback`@.
noSessionRequestQueuedCallback :: Maybe SessionRequestQueuedCallback
noSessionRequestQueuedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_SessionRequestQueuedCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_SessionRequestQueuedCallback`.
foreign import ccall "wrapper"
    mk_SessionRequestQueuedCallback :: C_SessionRequestQueuedCallback -> IO (FunPtr C_SessionRequestQueuedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_SessionRequestQueued :: MonadIO m => SessionRequestQueuedCallback -> m (GClosure C_SessionRequestQueuedCallback)
genClosure_SessionRequestQueued cb = liftIO $ do
    let cb' = wrap_SessionRequestQueuedCallback cb
    mk_SessionRequestQueuedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `SessionRequestQueuedCallback` into a `C_SessionRequestQueuedCallback`.
wrap_SessionRequestQueuedCallback ::
    SessionRequestQueuedCallback ->
    C_SessionRequestQueuedCallback
wrap_SessionRequestQueuedCallback _cb _ msg _ = do
    msg' <- (newObject Soup.Message.Message) msg
    _cb  msg'


{- |
Connect a signal handler for the “@request-queued@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' session #requestQueued callback
@
-}
onSessionRequestQueued :: (IsSession a, MonadIO m) => a -> SessionRequestQueuedCallback -> m SignalHandlerId
onSessionRequestQueued obj cb = liftIO $ do
    let cb' = wrap_SessionRequestQueuedCallback cb
    cb'' <- mk_SessionRequestQueuedCallback cb'
    connectSignalFunPtr obj "request-queued" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@request-queued@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' session #requestQueued callback
@
-}
afterSessionRequestQueued :: (IsSession a, MonadIO m) => a -> SessionRequestQueuedCallback -> m SignalHandlerId
afterSessionRequestQueued obj cb = liftIO $ do
    let cb' = wrap_SessionRequestQueuedCallback cb
    cb'' <- mk_SessionRequestQueuedCallback cb'
    connectSignalFunPtr obj "request-queued" cb'' SignalConnectAfter


-- signal Session::request-started
{-# DEPRECATED SessionRequestStartedCallback ["(Since version 2.50.)","Use 'GI.Soup.Objects.Message.Message'::@/starting/@ instead."] #-}
{- |
Emitted just before a request is sent. See
'GI.Soup.Objects.Session.Session'::@/request_queued/@ for a detailed description of
the message lifecycle within a session.
-}
type SessionRequestStartedCallback =
    Soup.Message.Message
    {- ^ /@msg@/: the request being sent -}
    -> Soup.Socket.Socket
    {- ^ /@socket@/: the socket the request is being sent on -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SessionRequestStartedCallback`@.
noSessionRequestStartedCallback :: Maybe SessionRequestStartedCallback
noSessionRequestStartedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_SessionRequestStartedCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr Soup.Socket.Socket ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_SessionRequestStartedCallback`.
foreign import ccall "wrapper"
    mk_SessionRequestStartedCallback :: C_SessionRequestStartedCallback -> IO (FunPtr C_SessionRequestStartedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_SessionRequestStarted :: MonadIO m => SessionRequestStartedCallback -> m (GClosure C_SessionRequestStartedCallback)
genClosure_SessionRequestStarted cb = liftIO $ do
    let cb' = wrap_SessionRequestStartedCallback cb
    mk_SessionRequestStartedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `SessionRequestStartedCallback` into a `C_SessionRequestStartedCallback`.
wrap_SessionRequestStartedCallback ::
    SessionRequestStartedCallback ->
    C_SessionRequestStartedCallback
wrap_SessionRequestStartedCallback _cb _ msg socket _ = do
    msg' <- (newObject Soup.Message.Message) msg
    socket' <- (newObject Soup.Socket.Socket) socket
    _cb  msg' socket'


{- |
Connect a signal handler for the “@request-started@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' session #requestStarted callback
@
-}
onSessionRequestStarted :: (IsSession a, MonadIO m) => a -> SessionRequestStartedCallback -> m SignalHandlerId
onSessionRequestStarted obj cb = liftIO $ do
    let cb' = wrap_SessionRequestStartedCallback cb
    cb'' <- mk_SessionRequestStartedCallback cb'
    connectSignalFunPtr obj "request-started" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@request-started@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' session #requestStarted callback
@
-}
afterSessionRequestStarted :: (IsSession a, MonadIO m) => a -> SessionRequestStartedCallback -> m SignalHandlerId
afterSessionRequestStarted obj cb = liftIO $ do
    let cb' = wrap_SessionRequestStartedCallback cb
    cb'' <- mk_SessionRequestStartedCallback cb'
    connectSignalFunPtr obj "request-started" cb'' SignalConnectAfter


-- signal Session::request-unqueued
{- |
Emitted when a request is removed from /@session@/\'s queue,
indicating that /@session@/ is done with it. See
'GI.Soup.Objects.Session.Session'::@/request_queued/@ for a detailed description of the
message lifecycle within a session.

/Since: 2.24/
-}
type SessionRequestUnqueuedCallback =
    Soup.Message.Message
    {- ^ /@msg@/: the request that was unqueued -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SessionRequestUnqueuedCallback`@.
noSessionRequestUnqueuedCallback :: Maybe SessionRequestUnqueuedCallback
noSessionRequestUnqueuedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_SessionRequestUnqueuedCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_SessionRequestUnqueuedCallback`.
foreign import ccall "wrapper"
    mk_SessionRequestUnqueuedCallback :: C_SessionRequestUnqueuedCallback -> IO (FunPtr C_SessionRequestUnqueuedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_SessionRequestUnqueued :: MonadIO m => SessionRequestUnqueuedCallback -> m (GClosure C_SessionRequestUnqueuedCallback)
genClosure_SessionRequestUnqueued cb = liftIO $ do
    let cb' = wrap_SessionRequestUnqueuedCallback cb
    mk_SessionRequestUnqueuedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `SessionRequestUnqueuedCallback` into a `C_SessionRequestUnqueuedCallback`.
wrap_SessionRequestUnqueuedCallback ::
    SessionRequestUnqueuedCallback ->
    C_SessionRequestUnqueuedCallback
wrap_SessionRequestUnqueuedCallback _cb _ msg _ = do
    msg' <- (newObject Soup.Message.Message) msg
    _cb  msg'


{- |
Connect a signal handler for the “@request-unqueued@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' session #requestUnqueued callback
@
-}
onSessionRequestUnqueued :: (IsSession a, MonadIO m) => a -> SessionRequestUnqueuedCallback -> m SignalHandlerId
onSessionRequestUnqueued obj cb = liftIO $ do
    let cb' = wrap_SessionRequestUnqueuedCallback cb
    cb'' <- mk_SessionRequestUnqueuedCallback cb'
    connectSignalFunPtr obj "request-unqueued" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@request-unqueued@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' session #requestUnqueued callback
@
-}
afterSessionRequestUnqueued :: (IsSession a, MonadIO m) => a -> SessionRequestUnqueuedCallback -> m SignalHandlerId
afterSessionRequestUnqueued obj cb = liftIO $ do
    let cb' = wrap_SessionRequestUnqueuedCallback cb
    cb'' <- mk_SessionRequestUnqueuedCallback cb'
    connectSignalFunPtr obj "request-unqueued" cb'' SignalConnectAfter


-- signal Session::tunneling
{- |
Emitted when an SSL tunnel is being created on a proxy
connection. This is an internal signal intended only to be
used for debugging purposes, and may go away in the future.

/Since: 2.30/
-}
type SessionTunnelingCallback =
    GObject.Object.Object
    {- ^ /@connection@/: the connection -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SessionTunnelingCallback`@.
noSessionTunnelingCallback :: Maybe SessionTunnelingCallback
noSessionTunnelingCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_SessionTunnelingCallback =
    Ptr () ->                               -- object
    Ptr GObject.Object.Object ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_SessionTunnelingCallback`.
foreign import ccall "wrapper"
    mk_SessionTunnelingCallback :: C_SessionTunnelingCallback -> IO (FunPtr C_SessionTunnelingCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_SessionTunneling :: MonadIO m => SessionTunnelingCallback -> m (GClosure C_SessionTunnelingCallback)
genClosure_SessionTunneling cb = liftIO $ do
    let cb' = wrap_SessionTunnelingCallback cb
    mk_SessionTunnelingCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `SessionTunnelingCallback` into a `C_SessionTunnelingCallback`.
wrap_SessionTunnelingCallback ::
    SessionTunnelingCallback ->
    C_SessionTunnelingCallback
wrap_SessionTunnelingCallback _cb _ connection _ = do
    connection' <- (newObject GObject.Object.Object) connection
    _cb  connection'


{- |
Connect a signal handler for the “@tunneling@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' session #tunneling callback
@
-}
onSessionTunneling :: (IsSession a, MonadIO m) => a -> SessionTunnelingCallback -> m SignalHandlerId
onSessionTunneling obj cb = liftIO $ do
    let cb' = wrap_SessionTunnelingCallback cb
    cb'' <- mk_SessionTunnelingCallback cb'
    connectSignalFunPtr obj "tunneling" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@tunneling@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' session #tunneling callback
@
-}
afterSessionTunneling :: (IsSession a, MonadIO m) => a -> SessionTunnelingCallback -> m SignalHandlerId
afterSessionTunneling obj cb = liftIO $ do
    let cb' = wrap_SessionTunnelingCallback cb
    cb'' <- mk_SessionTunnelingCallback cb'
    connectSignalFunPtr obj "tunneling" cb'' SignalConnectAfter


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

{- |
Get the value of the “@accept-language@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #acceptLanguage
@
-}
getSessionAcceptLanguage :: (MonadIO m, IsSession o) => o -> m (Maybe T.Text)
getSessionAcceptLanguage obj = liftIO $ B.Properties.getObjectPropertyString obj "accept-language"

{- |
Set the value of the “@accept-language@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #acceptLanguage 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionAcceptLanguage :: (MonadIO m, IsSession o) => o -> T.Text -> m ()
setSessionAcceptLanguage obj val = liftIO $ B.Properties.setObjectPropertyString obj "accept-language" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@accept-language@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionAcceptLanguage :: (IsSession o) => T.Text -> IO (GValueConstruct o)
constructSessionAcceptLanguage val = B.Properties.constructObjectPropertyString "accept-language" (Just val)

{- |
Set the value of the “@accept-language@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #acceptLanguage
@
-}
clearSessionAcceptLanguage :: (MonadIO m, IsSession o) => o -> m ()
clearSessionAcceptLanguage obj = liftIO $ B.Properties.setObjectPropertyString obj "accept-language" (Nothing :: Maybe T.Text)

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@accept-language-auto@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #acceptLanguageAuto
@
-}
getSessionAcceptLanguageAuto :: (MonadIO m, IsSession o) => o -> m Bool
getSessionAcceptLanguageAuto obj = liftIO $ B.Properties.getObjectPropertyBool obj "accept-language-auto"

{- |
Set the value of the “@accept-language-auto@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #acceptLanguageAuto 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionAcceptLanguageAuto :: (MonadIO m, IsSession o) => o -> Bool -> m ()
setSessionAcceptLanguageAuto obj val = liftIO $ B.Properties.setObjectPropertyBool obj "accept-language-auto" val

{- |
Construct a `GValueConstruct` with valid value for the “@accept-language-auto@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionAcceptLanguageAuto :: (IsSession o) => Bool -> IO (GValueConstruct o)
constructSessionAcceptLanguageAuto val = B.Properties.constructObjectPropertyBool "accept-language-auto" val

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@async-context@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #asyncContext
@
-}
getSessionAsyncContext :: (MonadIO m, IsSession o) => o -> m (Ptr ())
getSessionAsyncContext obj = liftIO $ B.Properties.getObjectPropertyPtr obj "async-context"

{- |
Construct a `GValueConstruct` with valid value for the “@async-context@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionAsyncContext :: (IsSession o) => Ptr () -> IO (GValueConstruct o)
constructSessionAsyncContext val = B.Properties.constructObjectPropertyPtr "async-context" val

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@http-aliases@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #httpAliases
@
-}
getSessionHttpAliases :: (MonadIO m, IsSession o) => o -> m (Maybe [T.Text])
getSessionHttpAliases obj = liftIO $ B.Properties.getObjectPropertyStringArray obj "http-aliases"

{- |
Set the value of the “@http-aliases@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #httpAliases 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionHttpAliases :: (MonadIO m, IsSession o) => o -> [T.Text] -> m ()
setSessionHttpAliases obj val = liftIO $ B.Properties.setObjectPropertyStringArray obj "http-aliases" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@http-aliases@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionHttpAliases :: (IsSession o) => [T.Text] -> IO (GValueConstruct o)
constructSessionHttpAliases val = B.Properties.constructObjectPropertyStringArray "http-aliases" (Just val)

{- |
Set the value of the “@http-aliases@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #httpAliases
@
-}
clearSessionHttpAliases :: (MonadIO m, IsSession o) => o -> m ()
clearSessionHttpAliases obj = liftIO $ B.Properties.setObjectPropertyStringArray obj "http-aliases" (Nothing :: Maybe [T.Text])

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@https-aliases@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #httpsAliases
@
-}
getSessionHttpsAliases :: (MonadIO m, IsSession o) => o -> m (Maybe [T.Text])
getSessionHttpsAliases obj = liftIO $ B.Properties.getObjectPropertyStringArray obj "https-aliases"

{- |
Set the value of the “@https-aliases@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #httpsAliases 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionHttpsAliases :: (MonadIO m, IsSession o) => o -> [T.Text] -> m ()
setSessionHttpsAliases obj val = liftIO $ B.Properties.setObjectPropertyStringArray obj "https-aliases" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@https-aliases@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionHttpsAliases :: (IsSession o) => [T.Text] -> IO (GValueConstruct o)
constructSessionHttpsAliases val = B.Properties.constructObjectPropertyStringArray "https-aliases" (Just val)

{- |
Set the value of the “@https-aliases@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #httpsAliases
@
-}
clearSessionHttpsAliases :: (MonadIO m, IsSession o) => o -> m ()
clearSessionHttpsAliases obj = liftIO $ B.Properties.setObjectPropertyStringArray obj "https-aliases" (Nothing :: Maybe [T.Text])

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@idle-timeout@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #idleTimeout
@
-}
getSessionIdleTimeout :: (MonadIO m, IsSession o) => o -> m Word32
getSessionIdleTimeout obj = liftIO $ B.Properties.getObjectPropertyUInt32 obj "idle-timeout"

{- |
Set the value of the “@idle-timeout@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #idleTimeout 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionIdleTimeout :: (MonadIO m, IsSession o) => o -> Word32 -> m ()
setSessionIdleTimeout obj val = liftIO $ B.Properties.setObjectPropertyUInt32 obj "idle-timeout" val

{- |
Construct a `GValueConstruct` with valid value for the “@idle-timeout@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionIdleTimeout :: (IsSession o) => Word32 -> IO (GValueConstruct o)
constructSessionIdleTimeout val = B.Properties.constructObjectPropertyUInt32 "idle-timeout" val

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@local-address@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #localAddress
@
-}
getSessionLocalAddress :: (MonadIO m, IsSession o) => o -> m (Maybe Soup.Address.Address)
getSessionLocalAddress obj = liftIO $ B.Properties.getObjectPropertyObject obj "local-address" Soup.Address.Address

{- |
Construct a `GValueConstruct` with valid value for the “@local-address@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionLocalAddress :: (IsSession o, Soup.Address.IsAddress a) => a -> IO (GValueConstruct o)
constructSessionLocalAddress val = B.Properties.constructObjectPropertyObject "local-address" (Just val)

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@max-conns@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #maxConns
@
-}
getSessionMaxConns :: (MonadIO m, IsSession o) => o -> m Int32
getSessionMaxConns obj = liftIO $ B.Properties.getObjectPropertyInt32 obj "max-conns"

{- |
Set the value of the “@max-conns@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #maxConns 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionMaxConns :: (MonadIO m, IsSession o) => o -> Int32 -> m ()
setSessionMaxConns obj val = liftIO $ B.Properties.setObjectPropertyInt32 obj "max-conns" val

{- |
Construct a `GValueConstruct` with valid value for the “@max-conns@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionMaxConns :: (IsSession o) => Int32 -> IO (GValueConstruct o)
constructSessionMaxConns val = B.Properties.constructObjectPropertyInt32 "max-conns" val

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@max-conns-per-host@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #maxConnsPerHost
@
-}
getSessionMaxConnsPerHost :: (MonadIO m, IsSession o) => o -> m Int32
getSessionMaxConnsPerHost obj = liftIO $ B.Properties.getObjectPropertyInt32 obj "max-conns-per-host"

{- |
Set the value of the “@max-conns-per-host@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #maxConnsPerHost 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionMaxConnsPerHost :: (MonadIO m, IsSession o) => o -> Int32 -> m ()
setSessionMaxConnsPerHost obj val = liftIO $ B.Properties.setObjectPropertyInt32 obj "max-conns-per-host" val

{- |
Construct a `GValueConstruct` with valid value for the “@max-conns-per-host@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionMaxConnsPerHost :: (IsSession o) => Int32 -> IO (GValueConstruct o)
constructSessionMaxConnsPerHost val = B.Properties.constructObjectPropertyInt32 "max-conns-per-host" val

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@proxy-resolver@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #proxyResolver
@
-}
getSessionProxyResolver :: (MonadIO m, IsSession o) => o -> m (Maybe Gio.ProxyResolver.ProxyResolver)
getSessionProxyResolver obj = liftIO $ B.Properties.getObjectPropertyObject obj "proxy-resolver" Gio.ProxyResolver.ProxyResolver

{- |
Set the value of the “@proxy-resolver@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #proxyResolver 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionProxyResolver :: (MonadIO m, IsSession o, Gio.ProxyResolver.IsProxyResolver a) => o -> a -> m ()
setSessionProxyResolver obj val = liftIO $ B.Properties.setObjectPropertyObject obj "proxy-resolver" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@proxy-resolver@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionProxyResolver :: (IsSession o, Gio.ProxyResolver.IsProxyResolver a) => a -> IO (GValueConstruct o)
constructSessionProxyResolver val = B.Properties.constructObjectPropertyObject "proxy-resolver" (Just val)

{- |
Set the value of the “@proxy-resolver@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #proxyResolver
@
-}
clearSessionProxyResolver :: (MonadIO m, IsSession o) => o -> m ()
clearSessionProxyResolver obj = liftIO $ B.Properties.setObjectPropertyObject obj "proxy-resolver" (Nothing :: Maybe Gio.ProxyResolver.ProxyResolver)

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@proxy-uri@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #proxyUri
@
-}
getSessionProxyUri :: (MonadIO m, IsSession o) => o -> m (Maybe Soup.URI.URI)
getSessionProxyUri obj = liftIO $ B.Properties.getObjectPropertyBoxed obj "proxy-uri" Soup.URI.URI

{- |
Set the value of the “@proxy-uri@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #proxyUri 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionProxyUri :: (MonadIO m, IsSession o) => o -> Soup.URI.URI -> m ()
setSessionProxyUri obj val = liftIO $ B.Properties.setObjectPropertyBoxed obj "proxy-uri" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@proxy-uri@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionProxyUri :: (IsSession o) => Soup.URI.URI -> IO (GValueConstruct o)
constructSessionProxyUri val = B.Properties.constructObjectPropertyBoxed "proxy-uri" (Just val)

{- |
Set the value of the “@proxy-uri@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #proxyUri
@
-}
clearSessionProxyUri :: (MonadIO m, IsSession o) => o -> m ()
clearSessionProxyUri obj = liftIO $ B.Properties.setObjectPropertyBoxed obj "proxy-uri" (Nothing :: Maybe Soup.URI.URI)

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@ssl-ca-file@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #sslCaFile
@
-}
getSessionSslCaFile :: (MonadIO m, IsSession o) => o -> m (Maybe T.Text)
getSessionSslCaFile obj = liftIO $ B.Properties.getObjectPropertyString obj "ssl-ca-file"

{- |
Set the value of the “@ssl-ca-file@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #sslCaFile 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionSslCaFile :: (MonadIO m, IsSession o) => o -> T.Text -> m ()
setSessionSslCaFile obj val = liftIO $ B.Properties.setObjectPropertyString obj "ssl-ca-file" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@ssl-ca-file@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionSslCaFile :: (IsSession o) => T.Text -> IO (GValueConstruct o)
constructSessionSslCaFile val = B.Properties.constructObjectPropertyString "ssl-ca-file" (Just val)

{- |
Set the value of the “@ssl-ca-file@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #sslCaFile
@
-}
clearSessionSslCaFile :: (MonadIO m, IsSession o) => o -> m ()
clearSessionSslCaFile obj = liftIO $ B.Properties.setObjectPropertyString obj "ssl-ca-file" (Nothing :: Maybe T.Text)

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@ssl-strict@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #sslStrict
@
-}
getSessionSslStrict :: (MonadIO m, IsSession o) => o -> m Bool
getSessionSslStrict obj = liftIO $ B.Properties.getObjectPropertyBool obj "ssl-strict"

{- |
Set the value of the “@ssl-strict@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #sslStrict 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionSslStrict :: (MonadIO m, IsSession o) => o -> Bool -> m ()
setSessionSslStrict obj val = liftIO $ B.Properties.setObjectPropertyBool obj "ssl-strict" val

{- |
Construct a `GValueConstruct` with valid value for the “@ssl-strict@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionSslStrict :: (IsSession o) => Bool -> IO (GValueConstruct o)
constructSessionSslStrict val = B.Properties.constructObjectPropertyBool "ssl-strict" val

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@ssl-use-system-ca-file@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #sslUseSystemCaFile
@
-}
getSessionSslUseSystemCaFile :: (MonadIO m, IsSession o) => o -> m Bool
getSessionSslUseSystemCaFile obj = liftIO $ B.Properties.getObjectPropertyBool obj "ssl-use-system-ca-file"

{- |
Set the value of the “@ssl-use-system-ca-file@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #sslUseSystemCaFile 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionSslUseSystemCaFile :: (MonadIO m, IsSession o) => o -> Bool -> m ()
setSessionSslUseSystemCaFile obj val = liftIO $ B.Properties.setObjectPropertyBool obj "ssl-use-system-ca-file" val

{- |
Construct a `GValueConstruct` with valid value for the “@ssl-use-system-ca-file@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionSslUseSystemCaFile :: (IsSession o) => Bool -> IO (GValueConstruct o)
constructSessionSslUseSystemCaFile val = B.Properties.constructObjectPropertyBool "ssl-use-system-ca-file" val

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@timeout@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #timeout
@
-}
getSessionTimeout :: (MonadIO m, IsSession o) => o -> m Word32
getSessionTimeout obj = liftIO $ B.Properties.getObjectPropertyUInt32 obj "timeout"

{- |
Set the value of the “@timeout@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #timeout 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionTimeout :: (MonadIO m, IsSession o) => o -> Word32 -> m ()
setSessionTimeout obj val = liftIO $ B.Properties.setObjectPropertyUInt32 obj "timeout" val

{- |
Construct a `GValueConstruct` with valid value for the “@timeout@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionTimeout :: (IsSession o) => Word32 -> IO (GValueConstruct o)
constructSessionTimeout val = B.Properties.constructObjectPropertyUInt32 "timeout" val

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@tls-database@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #tlsDatabase
@
-}
getSessionTlsDatabase :: (MonadIO m, IsSession o) => o -> m (Maybe Gio.TlsDatabase.TlsDatabase)
getSessionTlsDatabase obj = liftIO $ B.Properties.getObjectPropertyObject obj "tls-database" Gio.TlsDatabase.TlsDatabase

{- |
Set the value of the “@tls-database@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #tlsDatabase 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionTlsDatabase :: (MonadIO m, IsSession o, Gio.TlsDatabase.IsTlsDatabase a) => o -> a -> m ()
setSessionTlsDatabase obj val = liftIO $ B.Properties.setObjectPropertyObject obj "tls-database" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@tls-database@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionTlsDatabase :: (IsSession o, Gio.TlsDatabase.IsTlsDatabase a) => a -> IO (GValueConstruct o)
constructSessionTlsDatabase val = B.Properties.constructObjectPropertyObject "tls-database" (Just val)

{- |
Set the value of the “@tls-database@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #tlsDatabase
@
-}
clearSessionTlsDatabase :: (MonadIO m, IsSession o) => o -> m ()
clearSessionTlsDatabase obj = liftIO $ B.Properties.setObjectPropertyObject obj "tls-database" (Nothing :: Maybe Gio.TlsDatabase.TlsDatabase)

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@tls-interaction@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #tlsInteraction
@
-}
getSessionTlsInteraction :: (MonadIO m, IsSession o) => o -> m (Maybe Gio.TlsInteraction.TlsInteraction)
getSessionTlsInteraction obj = liftIO $ B.Properties.getObjectPropertyObject obj "tls-interaction" Gio.TlsInteraction.TlsInteraction

{- |
Set the value of the “@tls-interaction@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #tlsInteraction 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionTlsInteraction :: (MonadIO m, IsSession o, Gio.TlsInteraction.IsTlsInteraction a) => o -> a -> m ()
setSessionTlsInteraction obj val = liftIO $ B.Properties.setObjectPropertyObject obj "tls-interaction" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@tls-interaction@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionTlsInteraction :: (IsSession o, Gio.TlsInteraction.IsTlsInteraction a) => a -> IO (GValueConstruct o)
constructSessionTlsInteraction val = B.Properties.constructObjectPropertyObject "tls-interaction" (Just val)

{- |
Set the value of the “@tls-interaction@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #tlsInteraction
@
-}
clearSessionTlsInteraction :: (MonadIO m, IsSession o) => o -> m ()
clearSessionTlsInteraction obj = liftIO $ B.Properties.setObjectPropertyObject obj "tls-interaction" (Nothing :: Maybe Gio.TlsInteraction.TlsInteraction)

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@use-ntlm@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #useNtlm
@
-}
getSessionUseNtlm :: (MonadIO m, IsSession o) => o -> m Bool
getSessionUseNtlm obj = liftIO $ B.Properties.getObjectPropertyBool obj "use-ntlm"

{- |
Set the value of the “@use-ntlm@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #useNtlm 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionUseNtlm :: (MonadIO m, IsSession o) => o -> Bool -> m ()
setSessionUseNtlm obj val = liftIO $ B.Properties.setObjectPropertyBool obj "use-ntlm" val

{- |
Construct a `GValueConstruct` with valid value for the “@use-ntlm@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionUseNtlm :: (IsSession o) => Bool -> IO (GValueConstruct o)
constructSessionUseNtlm val = B.Properties.constructObjectPropertyBool "use-ntlm" val

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@use-thread-context@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #useThreadContext
@
-}
getSessionUseThreadContext :: (MonadIO m, IsSession o) => o -> m Bool
getSessionUseThreadContext obj = liftIO $ B.Properties.getObjectPropertyBool obj "use-thread-context"

{- |
Set the value of the “@use-thread-context@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #useThreadContext 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionUseThreadContext :: (MonadIO m, IsSession o) => o -> Bool -> m ()
setSessionUseThreadContext obj val = liftIO $ B.Properties.setObjectPropertyBool obj "use-thread-context" val

{- |
Construct a `GValueConstruct` with valid value for the “@use-thread-context@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionUseThreadContext :: (IsSession o) => Bool -> IO (GValueConstruct o)
constructSessionUseThreadContext val = B.Properties.constructObjectPropertyBool "use-thread-context" val

#if ENABLE_OVERLOADING
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
#endif

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

{- |
Get the value of the “@user-agent@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' session #userAgent
@
-}
getSessionUserAgent :: (MonadIO m, IsSession o) => o -> m (Maybe T.Text)
getSessionUserAgent obj = liftIO $ B.Properties.getObjectPropertyString obj "user-agent"

{- |
Set the value of the “@user-agent@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' session [ #userAgent 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSessionUserAgent :: (MonadIO m, IsSession o) => o -> T.Text -> m ()
setSessionUserAgent obj val = liftIO $ B.Properties.setObjectPropertyString obj "user-agent" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@user-agent@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSessionUserAgent :: (IsSession o) => T.Text -> IO (GValueConstruct o)
constructSessionUserAgent val = B.Properties.constructObjectPropertyString "user-agent" (Just val)

{- |
Set the value of the “@user-agent@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #userAgent
@
-}
clearSessionUserAgent :: (MonadIO m, IsSession o) => o -> m ()
clearSessionUserAgent obj = liftIO $ B.Properties.setObjectPropertyString obj "user-agent" (Nothing :: Maybe T.Text)

#if ENABLE_OVERLOADING
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
#endif

#if ENABLE_OVERLOADING
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, *)])
#endif

#if ENABLE_OVERLOADING
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

#endif

#if ENABLE_OVERLOADING
data SessionAuthenticateSignalInfo
instance SignalInfo SessionAuthenticateSignalInfo where
    type HaskellCallbackType SessionAuthenticateSignalInfo = SessionAuthenticateCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_SessionAuthenticateCallback cb
        cb'' <- mk_SessionAuthenticateCallback cb'
        connectSignalFunPtr obj "authenticate" cb'' connectMode

data SessionConnectionCreatedSignalInfo
instance SignalInfo SessionConnectionCreatedSignalInfo where
    type HaskellCallbackType SessionConnectionCreatedSignalInfo = SessionConnectionCreatedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_SessionConnectionCreatedCallback cb
        cb'' <- mk_SessionConnectionCreatedCallback cb'
        connectSignalFunPtr obj "connection-created" cb'' connectMode

data SessionRequestQueuedSignalInfo
instance SignalInfo SessionRequestQueuedSignalInfo where
    type HaskellCallbackType SessionRequestQueuedSignalInfo = SessionRequestQueuedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_SessionRequestQueuedCallback cb
        cb'' <- mk_SessionRequestQueuedCallback cb'
        connectSignalFunPtr obj "request-queued" cb'' connectMode

data SessionRequestStartedSignalInfo
instance SignalInfo SessionRequestStartedSignalInfo where
    type HaskellCallbackType SessionRequestStartedSignalInfo = SessionRequestStartedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_SessionRequestStartedCallback cb
        cb'' <- mk_SessionRequestStartedCallback cb'
        connectSignalFunPtr obj "request-started" cb'' connectMode

data SessionRequestUnqueuedSignalInfo
instance SignalInfo SessionRequestUnqueuedSignalInfo where
    type HaskellCallbackType SessionRequestUnqueuedSignalInfo = SessionRequestUnqueuedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_SessionRequestUnqueuedCallback cb
        cb'' <- mk_SessionRequestUnqueuedCallback cb'
        connectSignalFunPtr obj "request-unqueued" cb'' connectMode

data SessionTunnelingSignalInfo
instance SignalInfo SessionTunnelingSignalInfo where
    type HaskellCallbackType SessionTunnelingSignalInfo = SessionTunnelingCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_SessionTunnelingCallback cb
        cb'' <- mk_SessionTunnelingCallback cb'
        connectSignalFunPtr obj "tunneling" cb'' connectMode

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

#endif

-- 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'

#if ENABLE_OVERLOADING
#endif

-- 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 ()

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

#endif

-- 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 ()

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

#endif

-- 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 ()

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

#endif

-- 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 ()

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

#endif

-- method Session::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 = "uri", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupURI to connect to", 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 = "progress_callback", argType = TInterface (Name {namespace = "Soup", name = "SessionConnectProgressCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #SoupSessionConnectProgressCallback which\nwill be called for every network event that occurs during the connection.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, 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 when the operation finishes", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data for @progress_callback and @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_connect_async" soup_session_connect_async ::
    Ptr Session ->                          -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    Ptr Soup.URI.URI ->                     -- uri : TInterface (Name {namespace = "Soup", name = "URI"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Soup.Callbacks.C_SessionConnectProgressCallback -> -- progress_callback : TInterface (Name {namespace = "Soup", name = "SessionConnectProgressCallback"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Start a connection to /@uri@/. The operation can be monitored by providing a /@progressCallback@/
and finishes when the connection is done or an error ocurred.

Call 'GI.Soup.Objects.Session.sessionConnectFinish' to get the 'GI.Gio.Objects.IOStream.IOStream' to communicate with the server.

/Since: 2.62/
-}
sessionConnectAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsSession a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> Soup.URI.URI
    {- ^ /@uri@/: a 'GI.Soup.Structs.URI.URI' to connect to -}
    -> Maybe (b)
    {- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable' -}
    -> Maybe (Soup.Callbacks.SessionConnectProgressCallback)
    {- ^ /@progressCallback@/: a 'GI.Soup.Callbacks.SessionConnectProgressCallback' which
will be called for every network event that occurs during the connection. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: the callback to invoke when the operation finishes -}
    -> m ()
sessionConnectAsync session uri cancellable progressCallback callback = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    uri' <- unsafeManagedPtrGetPtr uri
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeProgressCallback <- case progressCallback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jProgressCallback -> do
            ptrprogressCallback <- callocMem :: IO (Ptr (FunPtr Soup.Callbacks.C_SessionConnectProgressCallback))
            jProgressCallback' <- Soup.Callbacks.mk_SessionConnectProgressCallback (Soup.Callbacks.wrap_SessionConnectProgressCallback (Just ptrprogressCallback) (Soup.Callbacks.drop_closures_SessionConnectProgressCallback jProgressCallback))
            poke ptrprogressCallback jProgressCallback'
            return jProgressCallback'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            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_connect_async session' uri' maybeCancellable maybeProgressCallback maybeCallback userData
    touchManagedPtr session
    touchManagedPtr uri
    whenJust cancellable touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data SessionConnectAsyncMethodInfo
instance (signature ~ (Soup.URI.URI -> Maybe (b) -> Maybe (Soup.Callbacks.SessionConnectProgressCallback) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSession a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SessionConnectAsyncMethodInfo a signature where
    overloadedMethod _ = sessionConnectAsync

#endif

-- method Session::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 = "Gio", name = "IOStream"}))
-- throws : True
-- Skip return : False

foreign import ccall "soup_session_connect_finish" soup_session_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 Gio.IOStream.IOStream)

{- |
Gets the 'GI.Gio.Objects.IOStream.IOStream' created for the connection to communicate with the server.

/Since: 2.62/
-}
sessionConnectFinish ::
    (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.IOStream.IOStream
    {- ^ __Returns:__ a new 'GI.Gio.Objects.IOStream.IOStream', or 'Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ -}
sessionConnectFinish session result_ = liftIO $ do
    session' <- unsafeManagedPtrCastPtr session
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        result <- propagateGError $ soup_session_connect_finish session' result_'
        checkUnexpectedReturnNULL "sessionConnectFinish" result
        result' <- (wrapObject Gio.IOStream.IOStream) result
        touchManagedPtr session
        touchManagedPtr result_
        return result'
     ) (do
        return ()
     )

#if ENABLE_OVERLOADING
data SessionConnectFinishMethodInfo
instance (signature ~ (b -> m Gio.IOStream.IOStream), MonadIO m, IsSession a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo SessionConnectFinishMethodInfo a signature where
    overloadedMethod _ = sessionConnectFinish

#endif

-- 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

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

#endif

-- 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

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

#endif

-- 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

#if ENABLE_OVERLOADING
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

#endif

-- 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''

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

#endif

-- 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'

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

#endif

-- 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 ()

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

#endif

-- 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'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Soup.Callbacks.C_AddressCallback))
            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 ()

#if ENABLE_OVERLOADING
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

#endif

-- 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 ()

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

#endif

-- 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
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Soup.Callbacks.C_SessionCallback))
            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 ()

#if ENABLE_OVERLOADING
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

#endif

-- 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'

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

#endif

-- 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 ()

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

#endif

-- 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 ()

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

#endif

-- 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'
     )

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

#endif

-- 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'
     )

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

#endif

-- 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'
     )

#if ENABLE_OVERLOADING
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

#endif

-- 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 ()
     )

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

#endif

-- 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 ()

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

#endif

-- 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 ()
     )

#if ENABLE_OVERLOADING
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

#endif

-- 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'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            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 ()

#if ENABLE_OVERLOADING
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

#endif

-- 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 ()
     )

#if ENABLE_OVERLOADING
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

#endif

-- 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

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

#endif

-- 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'

#if ENABLE_OVERLOADING
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

#endif

-- 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 ()

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

#endif

-- 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,
'GI.Soup.Objects.Session.sessionWebsocketConnectFinish' 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
'GI.Soup.Objects.Session.sessionWebsocketConnectFinish' 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'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            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 ()

#if ENABLE_OVERLOADING
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

#endif

-- 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 'GI.Soup.Objects.WebsocketConnection.WebsocketConnection' 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 ()
     )

#if ENABLE_OVERLOADING
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

#endif

-- 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'

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

#endif