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

Represents an HTTP message being sent or received.

/@statusCode@/ will normally be a 'GI.Soup.Enums.Status' value, eg,
'GI.Soup.Enums.StatusOk', though of course it might actually be an unknown
status code. /@reasonPhrase@/ is the actual text returned from the
server, which may or may not correspond to the \"standard\"
description of /@statusCode@/. At any rate, it is almost certainly
not localized, and not very descriptive even if it is in the user\'s
language; you should not use /@reasonPhrase@/ in user-visible
messages. Rather, you should look at /@statusCode@/, and determine an
end-user-appropriate message based on that and on what you were
trying to do.

As described in the 'GI.Soup.Structs.MessageBody.MessageBody' documentation, the
/@requestBody@/ and /@responseBody@/ \<literal>data\<\/literal> fields
will not necessarily be filled in at all times. When the body
fields are filled in, they will be terminated with a \'\\0\' byte
(which is not included in the \<literal>length\<\/literal>), so you
can use them as ordinary C strings (assuming that you know that the
body doesn\'t have any other \'\\0\' bytes).

For a client-side 'GI.Soup.Objects.Message.Message', /@requestBody@/\'s
\<literal>data\<\/literal> is usually filled in right before libsoup
writes the request to the network, but you should not count on
this; use 'GI.Soup.Structs.MessageBody.messageBodyFlatten' if you want to ensure that
\<literal>data\<\/literal> is filled in. If you are not using
'GI.Soup.Objects.Request.Request' to read the response, then /@responseBody@/\'s
\<literal>data\<\/literal> will be filled in before
'GI.Soup.Objects.Message.Message'::@/finished/@ is emitted. (If you are using 'GI.Soup.Objects.Request.Request',
then the message body is not accumulated by default, so
/@responseBody@/\'s \<literal>data\<\/literal> will always be 'Nothing'.)

For a server-side 'GI.Soup.Objects.Message.Message', /@requestBody@/\'s @/data/@ will be
filled in before 'GI.Soup.Objects.Message.Message'::@/got_body/@ is emitted.

To prevent the @/data/@ field from being filled in at all (eg, if you
are handling the data from a 'GI.Soup.Objects.Message.Message'::@/got_chunk/@, and so don\'t
need to see it all at the end), call
'GI.Soup.Structs.MessageBody.messageBodySetAccumulate' on /@responseBody@/ or
/@requestBody@/ as appropriate, passing 'False'.
-}

module GI.Soup.Objects.Message
    ( 

-- * Exported types
    Message(..)                             ,
    IsMessage                               ,
    toMessage                               ,
    noMessage                               ,


 -- * Methods
-- ** contentSniffed #method:contentSniffed#
    MessageContentSniffedMethodInfo         ,
    messageContentSniffed                   ,


-- ** disableFeature #method:disableFeature#
    MessageDisableFeatureMethodInfo         ,
    messageDisableFeature                   ,


-- ** finished #method:finished#
    MessageFinishedMethodInfo               ,
    messageFinished                         ,


-- ** getAddress #method:getAddress#
    MessageGetAddressMethodInfo             ,
    messageGetAddress                       ,


-- ** getFirstParty #method:getFirstParty#
    MessageGetFirstPartyMethodInfo          ,
    messageGetFirstParty                    ,


-- ** getFlags #method:getFlags#
    MessageGetFlagsMethodInfo               ,
    messageGetFlags                         ,


-- ** getHttpVersion #method:getHttpVersion#
    MessageGetHttpVersionMethodInfo         ,
    messageGetHttpVersion                   ,


-- ** getHttpsStatus #method:getHttpsStatus#
    MessageGetHttpsStatusMethodInfo         ,
    messageGetHttpsStatus                   ,


-- ** getPriority #method:getPriority#
    MessageGetPriorityMethodInfo            ,
    messageGetPriority                      ,


-- ** getSoupRequest #method:getSoupRequest#
    MessageGetSoupRequestMethodInfo         ,
    messageGetSoupRequest                   ,


-- ** getUri #method:getUri#
    MessageGetUriMethodInfo                 ,
    messageGetUri                           ,


-- ** gotBody #method:gotBody#
    MessageGotBodyMethodInfo                ,
    messageGotBody                          ,


-- ** gotChunk #method:gotChunk#
    MessageGotChunkMethodInfo               ,
    messageGotChunk                         ,


-- ** gotHeaders #method:gotHeaders#
    MessageGotHeadersMethodInfo             ,
    messageGotHeaders                       ,


-- ** gotInformational #method:gotInformational#
    MessageGotInformationalMethodInfo       ,
    messageGotInformational                 ,


-- ** isKeepalive #method:isKeepalive#
    MessageIsKeepaliveMethodInfo            ,
    messageIsKeepalive                      ,


-- ** new #method:new#
    messageNew                              ,


-- ** newFromUri #method:newFromUri#
    messageNewFromUri                       ,


-- ** restarted #method:restarted#
    MessageRestartedMethodInfo              ,
    messageRestarted                        ,


-- ** setChunkAllocator #method:setChunkAllocator#
    MessageSetChunkAllocatorMethodInfo      ,
    messageSetChunkAllocator                ,


-- ** setFirstParty #method:setFirstParty#
    MessageSetFirstPartyMethodInfo          ,
    messageSetFirstParty                    ,


-- ** setFlags #method:setFlags#
    MessageSetFlagsMethodInfo               ,
    messageSetFlags                         ,


-- ** setHttpVersion #method:setHttpVersion#
    MessageSetHttpVersionMethodInfo         ,
    messageSetHttpVersion                   ,


-- ** setPriority #method:setPriority#
    MessageSetPriorityMethodInfo            ,
    messageSetPriority                      ,


-- ** setRedirect #method:setRedirect#
    MessageSetRedirectMethodInfo            ,
    messageSetRedirect                      ,


-- ** setRequest #method:setRequest#
    MessageSetRequestMethodInfo             ,
    messageSetRequest                       ,


-- ** setResponse #method:setResponse#
    MessageSetResponseMethodInfo            ,
    messageSetResponse                      ,


-- ** setStatus #method:setStatus#
    MessageSetStatusMethodInfo              ,
    messageSetStatus                        ,


-- ** setStatusFull #method:setStatusFull#
    MessageSetStatusFullMethodInfo          ,
    messageSetStatusFull                    ,


-- ** setUri #method:setUri#
    MessageSetUriMethodInfo                 ,
    messageSetUri                           ,


-- ** starting #method:starting#
    MessageStartingMethodInfo               ,
    messageStarting                         ,


-- ** wroteBody #method:wroteBody#
    MessageWroteBodyMethodInfo              ,
    messageWroteBody                        ,


-- ** wroteBodyData #method:wroteBodyData#
    MessageWroteBodyDataMethodInfo          ,
    messageWroteBodyData                    ,


-- ** wroteChunk #method:wroteChunk#
    MessageWroteChunkMethodInfo             ,
    messageWroteChunk                       ,


-- ** wroteHeaders #method:wroteHeaders#
    MessageWroteHeadersMethodInfo           ,
    messageWroteHeaders                     ,


-- ** wroteInformational #method:wroteInformational#
    MessageWroteInformationalMethodInfo     ,
    messageWroteInformational               ,




 -- * Properties
-- ** firstParty #attr:firstParty#
    MessageFirstPartyPropertyInfo           ,
    constructMessageFirstParty              ,
    getMessageFirstParty                    ,
    messageFirstParty                       ,
    setMessageFirstParty                    ,


-- ** flags #attr:flags#
    MessageFlagsPropertyInfo                ,
    constructMessageFlags                   ,
    getMessageFlags                         ,
    messageFlags                            ,
    setMessageFlags                         ,


-- ** httpVersion #attr:httpVersion#
    MessageHttpVersionPropertyInfo          ,
    constructMessageHttpVersion             ,
    getMessageHttpVersion                   ,
    messageHttpVersion                      ,
    setMessageHttpVersion                   ,


-- ** method #attr:method#
    MessageMethodPropertyInfo               ,
    clearMessageMethod                      ,
    constructMessageMethod                  ,
    getMessageMethod                        ,
    messageMethod                           ,
    setMessageMethod                        ,


-- ** priority #attr:priority#
    MessagePriorityPropertyInfo             ,
    constructMessagePriority                ,
    getMessagePriority                      ,
    messagePriority                         ,
    setMessagePriority                      ,


-- ** reasonPhrase #attr:reasonPhrase#
    MessageReasonPhrasePropertyInfo         ,
    clearMessageReasonPhrase                ,
    constructMessageReasonPhrase            ,
    getMessageReasonPhrase                  ,
    messageReasonPhrase                     ,
    setMessageReasonPhrase                  ,


-- ** requestBody #attr:requestBody#
    MessageRequestBodyPropertyInfo          ,
    getMessageRequestBody                   ,
    messageRequestBody                      ,


-- ** requestBodyData #attr:requestBodyData#
    MessageRequestBodyDataPropertyInfo      ,
    getMessageRequestBodyData               ,
    messageRequestBodyData                  ,


-- ** requestHeaders #attr:requestHeaders#
    MessageRequestHeadersPropertyInfo       ,
    getMessageRequestHeaders                ,
    messageRequestHeaders                   ,


-- ** responseBody #attr:responseBody#
    MessageResponseBodyPropertyInfo         ,
    getMessageResponseBody                  ,
    messageResponseBody                     ,


-- ** responseBodyData #attr:responseBodyData#
    MessageResponseBodyDataPropertyInfo     ,
    getMessageResponseBodyData              ,
    messageResponseBodyData                 ,


-- ** responseHeaders #attr:responseHeaders#
    MessageResponseHeadersPropertyInfo      ,
    getMessageResponseHeaders               ,
    messageResponseHeaders                  ,


-- ** serverSide #attr:serverSide#
    MessageServerSidePropertyInfo           ,
    constructMessageServerSide              ,
    getMessageServerSide                    ,
    messageServerSide                       ,


-- ** statusCode #attr:statusCode#
    MessageStatusCodePropertyInfo           ,
    constructMessageStatusCode              ,
    getMessageStatusCode                    ,
    messageStatusCode                       ,
    setMessageStatusCode                    ,


-- ** tlsCertificate #attr:tlsCertificate#
    MessageTlsCertificatePropertyInfo       ,
    clearMessageTlsCertificate              ,
    constructMessageTlsCertificate          ,
    getMessageTlsCertificate                ,
    messageTlsCertificate                   ,
    setMessageTlsCertificate                ,


-- ** tlsErrors #attr:tlsErrors#
    MessageTlsErrorsPropertyInfo            ,
    constructMessageTlsErrors               ,
    getMessageTlsErrors                     ,
    messageTlsErrors                        ,
    setMessageTlsErrors                     ,


-- ** uri #attr:uri#
    MessageUriPropertyInfo                  ,
    constructMessageUri                     ,
    getMessageUri                           ,
    messageUri                              ,
    setMessageUri                           ,




 -- * Signals
-- ** contentSniffed #signal:contentSniffed#
    C_MessageContentSniffedCallback         ,
    MessageContentSniffedCallback           ,
    MessageContentSniffedSignalInfo         ,
    afterMessageContentSniffed              ,
    genClosure_MessageContentSniffed        ,
    mk_MessageContentSniffedCallback        ,
    noMessageContentSniffedCallback         ,
    onMessageContentSniffed                 ,
    wrap_MessageContentSniffedCallback      ,


-- ** finished #signal:finished#
    C_MessageFinishedCallback               ,
    MessageFinishedCallback                 ,
    MessageFinishedSignalInfo               ,
    afterMessageFinished                    ,
    genClosure_MessageFinished              ,
    mk_MessageFinishedCallback              ,
    noMessageFinishedCallback               ,
    onMessageFinished                       ,
    wrap_MessageFinishedCallback            ,


-- ** gotBody #signal:gotBody#
    C_MessageGotBodyCallback                ,
    MessageGotBodyCallback                  ,
    MessageGotBodySignalInfo                ,
    afterMessageGotBody                     ,
    genClosure_MessageGotBody               ,
    mk_MessageGotBodyCallback               ,
    noMessageGotBodyCallback                ,
    onMessageGotBody                        ,
    wrap_MessageGotBodyCallback             ,


-- ** gotChunk #signal:gotChunk#
    C_MessageGotChunkCallback               ,
    MessageGotChunkCallback                 ,
    MessageGotChunkSignalInfo               ,
    afterMessageGotChunk                    ,
    genClosure_MessageGotChunk              ,
    mk_MessageGotChunkCallback              ,
    noMessageGotChunkCallback               ,
    onMessageGotChunk                       ,
    wrap_MessageGotChunkCallback            ,


-- ** gotHeaders #signal:gotHeaders#
    C_MessageGotHeadersCallback             ,
    MessageGotHeadersCallback               ,
    MessageGotHeadersSignalInfo             ,
    afterMessageGotHeaders                  ,
    genClosure_MessageGotHeaders            ,
    mk_MessageGotHeadersCallback            ,
    noMessageGotHeadersCallback             ,
    onMessageGotHeaders                     ,
    wrap_MessageGotHeadersCallback          ,


-- ** gotInformational #signal:gotInformational#
    C_MessageGotInformationalCallback       ,
    MessageGotInformationalCallback         ,
    MessageGotInformationalSignalInfo       ,
    afterMessageGotInformational            ,
    genClosure_MessageGotInformational      ,
    mk_MessageGotInformationalCallback      ,
    noMessageGotInformationalCallback       ,
    onMessageGotInformational               ,
    wrap_MessageGotInformationalCallback    ,


-- ** networkEvent #signal:networkEvent#
    C_MessageNetworkEventCallback           ,
    MessageNetworkEventCallback             ,
    MessageNetworkEventSignalInfo           ,
    afterMessageNetworkEvent                ,
    genClosure_MessageNetworkEvent          ,
    mk_MessageNetworkEventCallback          ,
    noMessageNetworkEventCallback           ,
    onMessageNetworkEvent                   ,
    wrap_MessageNetworkEventCallback        ,


-- ** restarted #signal:restarted#
    C_MessageRestartedCallback              ,
    MessageRestartedCallback                ,
    MessageRestartedSignalInfo              ,
    afterMessageRestarted                   ,
    genClosure_MessageRestarted             ,
    mk_MessageRestartedCallback             ,
    noMessageRestartedCallback              ,
    onMessageRestarted                      ,
    wrap_MessageRestartedCallback           ,


-- ** starting #signal:starting#
    C_MessageStartingCallback               ,
    MessageStartingCallback                 ,
    MessageStartingSignalInfo               ,
    afterMessageStarting                    ,
    genClosure_MessageStarting              ,
    mk_MessageStartingCallback              ,
    noMessageStartingCallback               ,
    onMessageStarting                       ,
    wrap_MessageStartingCallback            ,


-- ** wroteBody #signal:wroteBody#
    C_MessageWroteBodyCallback              ,
    MessageWroteBodyCallback                ,
    MessageWroteBodySignalInfo              ,
    afterMessageWroteBody                   ,
    genClosure_MessageWroteBody             ,
    mk_MessageWroteBodyCallback             ,
    noMessageWroteBodyCallback              ,
    onMessageWroteBody                      ,
    wrap_MessageWroteBodyCallback           ,


-- ** wroteBodyData #signal:wroteBodyData#
    C_MessageWroteBodyDataCallback          ,
    MessageWroteBodyDataCallback            ,
    MessageWroteBodyDataSignalInfo          ,
    afterMessageWroteBodyData               ,
    genClosure_MessageWroteBodyData         ,
    mk_MessageWroteBodyDataCallback         ,
    noMessageWroteBodyDataCallback          ,
    onMessageWroteBodyData                  ,
    wrap_MessageWroteBodyDataCallback       ,


-- ** wroteChunk #signal:wroteChunk#
    C_MessageWroteChunkCallback             ,
    MessageWroteChunkCallback               ,
    MessageWroteChunkSignalInfo             ,
    afterMessageWroteChunk                  ,
    genClosure_MessageWroteChunk            ,
    mk_MessageWroteChunkCallback            ,
    noMessageWroteChunkCallback             ,
    onMessageWroteChunk                     ,
    wrap_MessageWroteChunkCallback          ,


-- ** wroteHeaders #signal:wroteHeaders#
    C_MessageWroteHeadersCallback           ,
    MessageWroteHeadersCallback             ,
    MessageWroteHeadersSignalInfo           ,
    afterMessageWroteHeaders                ,
    genClosure_MessageWroteHeaders          ,
    mk_MessageWroteHeadersCallback          ,
    noMessageWroteHeadersCallback           ,
    onMessageWroteHeaders                   ,
    wrap_MessageWroteHeadersCallback        ,


-- ** wroteInformational #signal:wroteInformational#
    C_MessageWroteInformationalCallback     ,
    MessageWroteInformationalCallback       ,
    MessageWroteInformationalSignalInfo     ,
    afterMessageWroteInformational          ,
    genClosure_MessageWroteInformational    ,
    mk_MessageWroteInformationalCallback    ,
    noMessageWroteInformationalCallback     ,
    onMessageWroteInformational             ,
    wrap_MessageWroteInformationalCallback  ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Enums as Gio.Enums
import qualified GI.Gio.Flags as Gio.Flags
import qualified GI.Gio.Objects.IOStream as Gio.IOStream
import qualified GI.Gio.Objects.TlsCertificate as Gio.TlsCertificate
import qualified GI.Soup.Callbacks as Soup.Callbacks
import {-# SOURCE #-} qualified GI.Soup.Enums as Soup.Enums
import {-# SOURCE #-} qualified GI.Soup.Flags as Soup.Flags
import {-# SOURCE #-} qualified GI.Soup.Objects.Address as Soup.Address
import {-# SOURCE #-} qualified GI.Soup.Objects.Request as Soup.Request
import {-# SOURCE #-} qualified GI.Soup.Structs.Buffer as Soup.Buffer
import {-# SOURCE #-} qualified GI.Soup.Structs.MessageBody as Soup.MessageBody
import {-# SOURCE #-} qualified GI.Soup.Structs.MessageHeaders as Soup.MessageHeaders
import {-# SOURCE #-} qualified GI.Soup.Structs.URI as Soup.URI

newtype Message = Message (ManagedPtr Message)
foreign import ccall "soup_message_get_type"
    c_soup_message_get_type :: IO GType

instance GObject Message where
    gobjectType _ = c_soup_message_get_type
    

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

toMessage :: IsMessage o => o -> IO Message
toMessage = unsafeCastTo Message

noMessage :: Maybe Message
noMessage = Nothing

type family ResolveMessageMethod (t :: Symbol) (o :: *) :: * where
    ResolveMessageMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveMessageMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveMessageMethod "contentSniffed" o = MessageContentSniffedMethodInfo
    ResolveMessageMethod "disableFeature" o = MessageDisableFeatureMethodInfo
    ResolveMessageMethod "finished" o = MessageFinishedMethodInfo
    ResolveMessageMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveMessageMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveMessageMethod "gotBody" o = MessageGotBodyMethodInfo
    ResolveMessageMethod "gotChunk" o = MessageGotChunkMethodInfo
    ResolveMessageMethod "gotHeaders" o = MessageGotHeadersMethodInfo
    ResolveMessageMethod "gotInformational" o = MessageGotInformationalMethodInfo
    ResolveMessageMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveMessageMethod "isKeepalive" o = MessageIsKeepaliveMethodInfo
    ResolveMessageMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveMessageMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveMessageMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveMessageMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveMessageMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveMessageMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveMessageMethod "restarted" o = MessageRestartedMethodInfo
    ResolveMessageMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveMessageMethod "starting" o = MessageStartingMethodInfo
    ResolveMessageMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveMessageMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveMessageMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveMessageMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveMessageMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveMessageMethod "wroteBody" o = MessageWroteBodyMethodInfo
    ResolveMessageMethod "wroteBodyData" o = MessageWroteBodyDataMethodInfo
    ResolveMessageMethod "wroteChunk" o = MessageWroteChunkMethodInfo
    ResolveMessageMethod "wroteHeaders" o = MessageWroteHeadersMethodInfo
    ResolveMessageMethod "wroteInformational" o = MessageWroteInformationalMethodInfo
    ResolveMessageMethod "getAddress" o = MessageGetAddressMethodInfo
    ResolveMessageMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveMessageMethod "getFirstParty" o = MessageGetFirstPartyMethodInfo
    ResolveMessageMethod "getFlags" o = MessageGetFlagsMethodInfo
    ResolveMessageMethod "getHttpVersion" o = MessageGetHttpVersionMethodInfo
    ResolveMessageMethod "getHttpsStatus" o = MessageGetHttpsStatusMethodInfo
    ResolveMessageMethod "getPriority" o = MessageGetPriorityMethodInfo
    ResolveMessageMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveMessageMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveMessageMethod "getSoupRequest" o = MessageGetSoupRequestMethodInfo
    ResolveMessageMethod "getUri" o = MessageGetUriMethodInfo
    ResolveMessageMethod "setChunkAllocator" o = MessageSetChunkAllocatorMethodInfo
    ResolveMessageMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveMessageMethod "setFirstParty" o = MessageSetFirstPartyMethodInfo
    ResolveMessageMethod "setFlags" o = MessageSetFlagsMethodInfo
    ResolveMessageMethod "setHttpVersion" o = MessageSetHttpVersionMethodInfo
    ResolveMessageMethod "setPriority" o = MessageSetPriorityMethodInfo
    ResolveMessageMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveMessageMethod "setRedirect" o = MessageSetRedirectMethodInfo
    ResolveMessageMethod "setRequest" o = MessageSetRequestMethodInfo
    ResolveMessageMethod "setResponse" o = MessageSetResponseMethodInfo
    ResolveMessageMethod "setStatus" o = MessageSetStatusMethodInfo
    ResolveMessageMethod "setStatusFull" o = MessageSetStatusFullMethodInfo
    ResolveMessageMethod "setUri" o = MessageSetUriMethodInfo
    ResolveMessageMethod l o = O.MethodResolutionFailed l o

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

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

-- signal Message::content-sniffed
type MessageContentSniffedCallback =
    T.Text ->
    Map.Map T.Text T.Text ->
    IO ()

noMessageContentSniffedCallback :: Maybe MessageContentSniffedCallback
noMessageContentSniffedCallback = Nothing

type C_MessageContentSniffedCallback =
    Ptr () ->                               -- object
    CString ->
    Ptr (GHashTable CString CString) ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageContentSniffedCallback :: C_MessageContentSniffedCallback -> IO (FunPtr C_MessageContentSniffedCallback)

genClosure_MessageContentSniffed :: MessageContentSniffedCallback -> IO Closure
genClosure_MessageContentSniffed cb = do
    let cb' = wrap_MessageContentSniffedCallback cb
    mk_MessageContentSniffedCallback cb' >>= newCClosure


wrap_MessageContentSniffedCallback ::
    MessageContentSniffedCallback ->
    Ptr () ->
    CString ->
    Ptr (GHashTable CString CString) ->
    Ptr () ->
    IO ()
wrap_MessageContentSniffedCallback _cb _ type_ params _ = do
    type_' <- cstringToText type_
    params' <- unpackGHashTable params
    let params'' = mapFirst cstringUnpackPtr params'
    params''' <- mapFirstA cstringToText params''
    let params'''' = mapSecond cstringUnpackPtr params'''
    params''''' <- mapSecondA cstringToText params''''
    let params'''''' = Map.fromList params'''''
    _cb  type_' params''''''


onMessageContentSniffed :: (GObject a, MonadIO m) => a -> MessageContentSniffedCallback -> m SignalHandlerId
onMessageContentSniffed obj cb = liftIO $ connectMessageContentSniffed obj cb SignalConnectBefore
afterMessageContentSniffed :: (GObject a, MonadIO m) => a -> MessageContentSniffedCallback -> m SignalHandlerId
afterMessageContentSniffed obj cb = connectMessageContentSniffed obj cb SignalConnectAfter

connectMessageContentSniffed :: (GObject a, MonadIO m) =>
                                a -> MessageContentSniffedCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageContentSniffed obj cb after = liftIO $ do
    let cb' = wrap_MessageContentSniffedCallback cb
    cb'' <- mk_MessageContentSniffedCallback cb'
    connectSignalFunPtr obj "content-sniffed" cb'' after

-- signal Message::finished
type MessageFinishedCallback =
    IO ()

noMessageFinishedCallback :: Maybe MessageFinishedCallback
noMessageFinishedCallback = Nothing

type C_MessageFinishedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageFinishedCallback :: C_MessageFinishedCallback -> IO (FunPtr C_MessageFinishedCallback)

genClosure_MessageFinished :: MessageFinishedCallback -> IO Closure
genClosure_MessageFinished cb = do
    let cb' = wrap_MessageFinishedCallback cb
    mk_MessageFinishedCallback cb' >>= newCClosure


wrap_MessageFinishedCallback ::
    MessageFinishedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_MessageFinishedCallback _cb _ _ = do
    _cb 


onMessageFinished :: (GObject a, MonadIO m) => a -> MessageFinishedCallback -> m SignalHandlerId
onMessageFinished obj cb = liftIO $ connectMessageFinished obj cb SignalConnectBefore
afterMessageFinished :: (GObject a, MonadIO m) => a -> MessageFinishedCallback -> m SignalHandlerId
afterMessageFinished obj cb = connectMessageFinished obj cb SignalConnectAfter

connectMessageFinished :: (GObject a, MonadIO m) =>
                          a -> MessageFinishedCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageFinished obj cb after = liftIO $ do
    let cb' = wrap_MessageFinishedCallback cb
    cb'' <- mk_MessageFinishedCallback cb'
    connectSignalFunPtr obj "finished" cb'' after

-- signal Message::got-body
type MessageGotBodyCallback =
    IO ()

noMessageGotBodyCallback :: Maybe MessageGotBodyCallback
noMessageGotBodyCallback = Nothing

type C_MessageGotBodyCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageGotBodyCallback :: C_MessageGotBodyCallback -> IO (FunPtr C_MessageGotBodyCallback)

genClosure_MessageGotBody :: MessageGotBodyCallback -> IO Closure
genClosure_MessageGotBody cb = do
    let cb' = wrap_MessageGotBodyCallback cb
    mk_MessageGotBodyCallback cb' >>= newCClosure


wrap_MessageGotBodyCallback ::
    MessageGotBodyCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_MessageGotBodyCallback _cb _ _ = do
    _cb 


onMessageGotBody :: (GObject a, MonadIO m) => a -> MessageGotBodyCallback -> m SignalHandlerId
onMessageGotBody obj cb = liftIO $ connectMessageGotBody obj cb SignalConnectBefore
afterMessageGotBody :: (GObject a, MonadIO m) => a -> MessageGotBodyCallback -> m SignalHandlerId
afterMessageGotBody obj cb = connectMessageGotBody obj cb SignalConnectAfter

connectMessageGotBody :: (GObject a, MonadIO m) =>
                         a -> MessageGotBodyCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageGotBody obj cb after = liftIO $ do
    let cb' = wrap_MessageGotBodyCallback cb
    cb'' <- mk_MessageGotBodyCallback cb'
    connectSignalFunPtr obj "got-body" cb'' after

-- signal Message::got-chunk
type MessageGotChunkCallback =
    Soup.Buffer.Buffer ->
    IO ()

noMessageGotChunkCallback :: Maybe MessageGotChunkCallback
noMessageGotChunkCallback = Nothing

type C_MessageGotChunkCallback =
    Ptr () ->                               -- object
    Ptr Soup.Buffer.Buffer ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageGotChunkCallback :: C_MessageGotChunkCallback -> IO (FunPtr C_MessageGotChunkCallback)

genClosure_MessageGotChunk :: MessageGotChunkCallback -> IO Closure
genClosure_MessageGotChunk cb = do
    let cb' = wrap_MessageGotChunkCallback cb
    mk_MessageGotChunkCallback cb' >>= newCClosure


wrap_MessageGotChunkCallback ::
    MessageGotChunkCallback ->
    Ptr () ->
    Ptr Soup.Buffer.Buffer ->
    Ptr () ->
    IO ()
wrap_MessageGotChunkCallback _cb _ chunk _ = do
    chunk' <- (newBoxed Soup.Buffer.Buffer) chunk
    _cb  chunk'


onMessageGotChunk :: (GObject a, MonadIO m) => a -> MessageGotChunkCallback -> m SignalHandlerId
onMessageGotChunk obj cb = liftIO $ connectMessageGotChunk obj cb SignalConnectBefore
afterMessageGotChunk :: (GObject a, MonadIO m) => a -> MessageGotChunkCallback -> m SignalHandlerId
afterMessageGotChunk obj cb = connectMessageGotChunk obj cb SignalConnectAfter

connectMessageGotChunk :: (GObject a, MonadIO m) =>
                          a -> MessageGotChunkCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageGotChunk obj cb after = liftIO $ do
    let cb' = wrap_MessageGotChunkCallback cb
    cb'' <- mk_MessageGotChunkCallback cb'
    connectSignalFunPtr obj "got-chunk" cb'' after

-- signal Message::got-headers
type MessageGotHeadersCallback =
    IO ()

noMessageGotHeadersCallback :: Maybe MessageGotHeadersCallback
noMessageGotHeadersCallback = Nothing

type C_MessageGotHeadersCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageGotHeadersCallback :: C_MessageGotHeadersCallback -> IO (FunPtr C_MessageGotHeadersCallback)

genClosure_MessageGotHeaders :: MessageGotHeadersCallback -> IO Closure
genClosure_MessageGotHeaders cb = do
    let cb' = wrap_MessageGotHeadersCallback cb
    mk_MessageGotHeadersCallback cb' >>= newCClosure


wrap_MessageGotHeadersCallback ::
    MessageGotHeadersCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_MessageGotHeadersCallback _cb _ _ = do
    _cb 


onMessageGotHeaders :: (GObject a, MonadIO m) => a -> MessageGotHeadersCallback -> m SignalHandlerId
onMessageGotHeaders obj cb = liftIO $ connectMessageGotHeaders obj cb SignalConnectBefore
afterMessageGotHeaders :: (GObject a, MonadIO m) => a -> MessageGotHeadersCallback -> m SignalHandlerId
afterMessageGotHeaders obj cb = connectMessageGotHeaders obj cb SignalConnectAfter

connectMessageGotHeaders :: (GObject a, MonadIO m) =>
                            a -> MessageGotHeadersCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageGotHeaders obj cb after = liftIO $ do
    let cb' = wrap_MessageGotHeadersCallback cb
    cb'' <- mk_MessageGotHeadersCallback cb'
    connectSignalFunPtr obj "got-headers" cb'' after

-- signal Message::got-informational
type MessageGotInformationalCallback =
    IO ()

noMessageGotInformationalCallback :: Maybe MessageGotInformationalCallback
noMessageGotInformationalCallback = Nothing

type C_MessageGotInformationalCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageGotInformationalCallback :: C_MessageGotInformationalCallback -> IO (FunPtr C_MessageGotInformationalCallback)

genClosure_MessageGotInformational :: MessageGotInformationalCallback -> IO Closure
genClosure_MessageGotInformational cb = do
    let cb' = wrap_MessageGotInformationalCallback cb
    mk_MessageGotInformationalCallback cb' >>= newCClosure


wrap_MessageGotInformationalCallback ::
    MessageGotInformationalCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_MessageGotInformationalCallback _cb _ _ = do
    _cb 


onMessageGotInformational :: (GObject a, MonadIO m) => a -> MessageGotInformationalCallback -> m SignalHandlerId
onMessageGotInformational obj cb = liftIO $ connectMessageGotInformational obj cb SignalConnectBefore
afterMessageGotInformational :: (GObject a, MonadIO m) => a -> MessageGotInformationalCallback -> m SignalHandlerId
afterMessageGotInformational obj cb = connectMessageGotInformational obj cb SignalConnectAfter

connectMessageGotInformational :: (GObject a, MonadIO m) =>
                                  a -> MessageGotInformationalCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageGotInformational obj cb after = liftIO $ do
    let cb' = wrap_MessageGotInformationalCallback cb
    cb'' <- mk_MessageGotInformationalCallback cb'
    connectSignalFunPtr obj "got-informational" cb'' after

-- signal Message::network-event
type MessageNetworkEventCallback =
    Gio.Enums.SocketClientEvent ->
    Gio.IOStream.IOStream ->
    IO ()

noMessageNetworkEventCallback :: Maybe MessageNetworkEventCallback
noMessageNetworkEventCallback = Nothing

type C_MessageNetworkEventCallback =
    Ptr () ->                               -- object
    CUInt ->
    Ptr Gio.IOStream.IOStream ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageNetworkEventCallback :: C_MessageNetworkEventCallback -> IO (FunPtr C_MessageNetworkEventCallback)

genClosure_MessageNetworkEvent :: MessageNetworkEventCallback -> IO Closure
genClosure_MessageNetworkEvent cb = do
    let cb' = wrap_MessageNetworkEventCallback cb
    mk_MessageNetworkEventCallback cb' >>= newCClosure


wrap_MessageNetworkEventCallback ::
    MessageNetworkEventCallback ->
    Ptr () ->
    CUInt ->
    Ptr Gio.IOStream.IOStream ->
    Ptr () ->
    IO ()
wrap_MessageNetworkEventCallback _cb _ event connection _ = do
    let event' = (toEnum . fromIntegral) event
    connection' <- (newObject Gio.IOStream.IOStream) connection
    _cb  event' connection'


onMessageNetworkEvent :: (GObject a, MonadIO m) => a -> MessageNetworkEventCallback -> m SignalHandlerId
onMessageNetworkEvent obj cb = liftIO $ connectMessageNetworkEvent obj cb SignalConnectBefore
afterMessageNetworkEvent :: (GObject a, MonadIO m) => a -> MessageNetworkEventCallback -> m SignalHandlerId
afterMessageNetworkEvent obj cb = connectMessageNetworkEvent obj cb SignalConnectAfter

connectMessageNetworkEvent :: (GObject a, MonadIO m) =>
                              a -> MessageNetworkEventCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageNetworkEvent obj cb after = liftIO $ do
    let cb' = wrap_MessageNetworkEventCallback cb
    cb'' <- mk_MessageNetworkEventCallback cb'
    connectSignalFunPtr obj "network-event" cb'' after

-- signal Message::restarted
type MessageRestartedCallback =
    IO ()

noMessageRestartedCallback :: Maybe MessageRestartedCallback
noMessageRestartedCallback = Nothing

type C_MessageRestartedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageRestartedCallback :: C_MessageRestartedCallback -> IO (FunPtr C_MessageRestartedCallback)

genClosure_MessageRestarted :: MessageRestartedCallback -> IO Closure
genClosure_MessageRestarted cb = do
    let cb' = wrap_MessageRestartedCallback cb
    mk_MessageRestartedCallback cb' >>= newCClosure


wrap_MessageRestartedCallback ::
    MessageRestartedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_MessageRestartedCallback _cb _ _ = do
    _cb 


onMessageRestarted :: (GObject a, MonadIO m) => a -> MessageRestartedCallback -> m SignalHandlerId
onMessageRestarted obj cb = liftIO $ connectMessageRestarted obj cb SignalConnectBefore
afterMessageRestarted :: (GObject a, MonadIO m) => a -> MessageRestartedCallback -> m SignalHandlerId
afterMessageRestarted obj cb = connectMessageRestarted obj cb SignalConnectAfter

connectMessageRestarted :: (GObject a, MonadIO m) =>
                           a -> MessageRestartedCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageRestarted obj cb after = liftIO $ do
    let cb' = wrap_MessageRestartedCallback cb
    cb'' <- mk_MessageRestartedCallback cb'
    connectSignalFunPtr obj "restarted" cb'' after

-- signal Message::starting
type MessageStartingCallback =
    IO ()

noMessageStartingCallback :: Maybe MessageStartingCallback
noMessageStartingCallback = Nothing

type C_MessageStartingCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageStartingCallback :: C_MessageStartingCallback -> IO (FunPtr C_MessageStartingCallback)

genClosure_MessageStarting :: MessageStartingCallback -> IO Closure
genClosure_MessageStarting cb = do
    let cb' = wrap_MessageStartingCallback cb
    mk_MessageStartingCallback cb' >>= newCClosure


wrap_MessageStartingCallback ::
    MessageStartingCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_MessageStartingCallback _cb _ _ = do
    _cb 


onMessageStarting :: (GObject a, MonadIO m) => a -> MessageStartingCallback -> m SignalHandlerId
onMessageStarting obj cb = liftIO $ connectMessageStarting obj cb SignalConnectBefore
afterMessageStarting :: (GObject a, MonadIO m) => a -> MessageStartingCallback -> m SignalHandlerId
afterMessageStarting obj cb = connectMessageStarting obj cb SignalConnectAfter

connectMessageStarting :: (GObject a, MonadIO m) =>
                          a -> MessageStartingCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageStarting obj cb after = liftIO $ do
    let cb' = wrap_MessageStartingCallback cb
    cb'' <- mk_MessageStartingCallback cb'
    connectSignalFunPtr obj "starting" cb'' after

-- signal Message::wrote-body
type MessageWroteBodyCallback =
    IO ()

noMessageWroteBodyCallback :: Maybe MessageWroteBodyCallback
noMessageWroteBodyCallback = Nothing

type C_MessageWroteBodyCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageWroteBodyCallback :: C_MessageWroteBodyCallback -> IO (FunPtr C_MessageWroteBodyCallback)

genClosure_MessageWroteBody :: MessageWroteBodyCallback -> IO Closure
genClosure_MessageWroteBody cb = do
    let cb' = wrap_MessageWroteBodyCallback cb
    mk_MessageWroteBodyCallback cb' >>= newCClosure


wrap_MessageWroteBodyCallback ::
    MessageWroteBodyCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_MessageWroteBodyCallback _cb _ _ = do
    _cb 


onMessageWroteBody :: (GObject a, MonadIO m) => a -> MessageWroteBodyCallback -> m SignalHandlerId
onMessageWroteBody obj cb = liftIO $ connectMessageWroteBody obj cb SignalConnectBefore
afterMessageWroteBody :: (GObject a, MonadIO m) => a -> MessageWroteBodyCallback -> m SignalHandlerId
afterMessageWroteBody obj cb = connectMessageWroteBody obj cb SignalConnectAfter

connectMessageWroteBody :: (GObject a, MonadIO m) =>
                           a -> MessageWroteBodyCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageWroteBody obj cb after = liftIO $ do
    let cb' = wrap_MessageWroteBodyCallback cb
    cb'' <- mk_MessageWroteBodyCallback cb'
    connectSignalFunPtr obj "wrote-body" cb'' after

-- signal Message::wrote-body-data
type MessageWroteBodyDataCallback =
    Soup.Buffer.Buffer ->
    IO ()

noMessageWroteBodyDataCallback :: Maybe MessageWroteBodyDataCallback
noMessageWroteBodyDataCallback = Nothing

type C_MessageWroteBodyDataCallback =
    Ptr () ->                               -- object
    Ptr Soup.Buffer.Buffer ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageWroteBodyDataCallback :: C_MessageWroteBodyDataCallback -> IO (FunPtr C_MessageWroteBodyDataCallback)

genClosure_MessageWroteBodyData :: MessageWroteBodyDataCallback -> IO Closure
genClosure_MessageWroteBodyData cb = do
    let cb' = wrap_MessageWroteBodyDataCallback cb
    mk_MessageWroteBodyDataCallback cb' >>= newCClosure


wrap_MessageWroteBodyDataCallback ::
    MessageWroteBodyDataCallback ->
    Ptr () ->
    Ptr Soup.Buffer.Buffer ->
    Ptr () ->
    IO ()
wrap_MessageWroteBodyDataCallback _cb _ chunk _ = do
    chunk' <- (newBoxed Soup.Buffer.Buffer) chunk
    _cb  chunk'


onMessageWroteBodyData :: (GObject a, MonadIO m) => a -> MessageWroteBodyDataCallback -> m SignalHandlerId
onMessageWroteBodyData obj cb = liftIO $ connectMessageWroteBodyData obj cb SignalConnectBefore
afterMessageWroteBodyData :: (GObject a, MonadIO m) => a -> MessageWroteBodyDataCallback -> m SignalHandlerId
afterMessageWroteBodyData obj cb = connectMessageWroteBodyData obj cb SignalConnectAfter

connectMessageWroteBodyData :: (GObject a, MonadIO m) =>
                               a -> MessageWroteBodyDataCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageWroteBodyData obj cb after = liftIO $ do
    let cb' = wrap_MessageWroteBodyDataCallback cb
    cb'' <- mk_MessageWroteBodyDataCallback cb'
    connectSignalFunPtr obj "wrote-body-data" cb'' after

-- signal Message::wrote-chunk
type MessageWroteChunkCallback =
    IO ()

noMessageWroteChunkCallback :: Maybe MessageWroteChunkCallback
noMessageWroteChunkCallback = Nothing

type C_MessageWroteChunkCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageWroteChunkCallback :: C_MessageWroteChunkCallback -> IO (FunPtr C_MessageWroteChunkCallback)

genClosure_MessageWroteChunk :: MessageWroteChunkCallback -> IO Closure
genClosure_MessageWroteChunk cb = do
    let cb' = wrap_MessageWroteChunkCallback cb
    mk_MessageWroteChunkCallback cb' >>= newCClosure


wrap_MessageWroteChunkCallback ::
    MessageWroteChunkCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_MessageWroteChunkCallback _cb _ _ = do
    _cb 


onMessageWroteChunk :: (GObject a, MonadIO m) => a -> MessageWroteChunkCallback -> m SignalHandlerId
onMessageWroteChunk obj cb = liftIO $ connectMessageWroteChunk obj cb SignalConnectBefore
afterMessageWroteChunk :: (GObject a, MonadIO m) => a -> MessageWroteChunkCallback -> m SignalHandlerId
afterMessageWroteChunk obj cb = connectMessageWroteChunk obj cb SignalConnectAfter

connectMessageWroteChunk :: (GObject a, MonadIO m) =>
                            a -> MessageWroteChunkCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageWroteChunk obj cb after = liftIO $ do
    let cb' = wrap_MessageWroteChunkCallback cb
    cb'' <- mk_MessageWroteChunkCallback cb'
    connectSignalFunPtr obj "wrote-chunk" cb'' after

-- signal Message::wrote-headers
type MessageWroteHeadersCallback =
    IO ()

noMessageWroteHeadersCallback :: Maybe MessageWroteHeadersCallback
noMessageWroteHeadersCallback = Nothing

type C_MessageWroteHeadersCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageWroteHeadersCallback :: C_MessageWroteHeadersCallback -> IO (FunPtr C_MessageWroteHeadersCallback)

genClosure_MessageWroteHeaders :: MessageWroteHeadersCallback -> IO Closure
genClosure_MessageWroteHeaders cb = do
    let cb' = wrap_MessageWroteHeadersCallback cb
    mk_MessageWroteHeadersCallback cb' >>= newCClosure


wrap_MessageWroteHeadersCallback ::
    MessageWroteHeadersCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_MessageWroteHeadersCallback _cb _ _ = do
    _cb 


onMessageWroteHeaders :: (GObject a, MonadIO m) => a -> MessageWroteHeadersCallback -> m SignalHandlerId
onMessageWroteHeaders obj cb = liftIO $ connectMessageWroteHeaders obj cb SignalConnectBefore
afterMessageWroteHeaders :: (GObject a, MonadIO m) => a -> MessageWroteHeadersCallback -> m SignalHandlerId
afterMessageWroteHeaders obj cb = connectMessageWroteHeaders obj cb SignalConnectAfter

connectMessageWroteHeaders :: (GObject a, MonadIO m) =>
                              a -> MessageWroteHeadersCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageWroteHeaders obj cb after = liftIO $ do
    let cb' = wrap_MessageWroteHeadersCallback cb
    cb'' <- mk_MessageWroteHeadersCallback cb'
    connectSignalFunPtr obj "wrote-headers" cb'' after

-- signal Message::wrote-informational
type MessageWroteInformationalCallback =
    IO ()

noMessageWroteInformationalCallback :: Maybe MessageWroteInformationalCallback
noMessageWroteInformationalCallback = Nothing

type C_MessageWroteInformationalCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MessageWroteInformationalCallback :: C_MessageWroteInformationalCallback -> IO (FunPtr C_MessageWroteInformationalCallback)

genClosure_MessageWroteInformational :: MessageWroteInformationalCallback -> IO Closure
genClosure_MessageWroteInformational cb = do
    let cb' = wrap_MessageWroteInformationalCallback cb
    mk_MessageWroteInformationalCallback cb' >>= newCClosure


wrap_MessageWroteInformationalCallback ::
    MessageWroteInformationalCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_MessageWroteInformationalCallback _cb _ _ = do
    _cb 


onMessageWroteInformational :: (GObject a, MonadIO m) => a -> MessageWroteInformationalCallback -> m SignalHandlerId
onMessageWroteInformational obj cb = liftIO $ connectMessageWroteInformational obj cb SignalConnectBefore
afterMessageWroteInformational :: (GObject a, MonadIO m) => a -> MessageWroteInformationalCallback -> m SignalHandlerId
afterMessageWroteInformational obj cb = connectMessageWroteInformational obj cb SignalConnectAfter

connectMessageWroteInformational :: (GObject a, MonadIO m) =>
                                    a -> MessageWroteInformationalCallback -> SignalConnectMode -> m SignalHandlerId
connectMessageWroteInformational obj cb after = liftIO $ do
    let cb' = wrap_MessageWroteInformationalCallback cb
    cb'' <- mk_MessageWroteInformationalCallback cb'
    connectSignalFunPtr obj "wrote-informational" cb'' after

-- VVV Prop "first-party"
   -- Type: TInterface (Name {namespace = "Soup", name = "URI"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getMessageFirstParty :: (MonadIO m, IsMessage o) => o -> m Soup.URI.URI
getMessageFirstParty obj = liftIO $ checkUnexpectedNothing "getMessageFirstParty" $ getObjectPropertyBoxed obj "first-party" Soup.URI.URI

setMessageFirstParty :: (MonadIO m, IsMessage o) => o -> Soup.URI.URI -> m ()
setMessageFirstParty obj val = liftIO $ setObjectPropertyBoxed obj "first-party" (Just val)

constructMessageFirstParty :: (IsMessage o) => Soup.URI.URI -> IO (GValueConstruct o)
constructMessageFirstParty val = constructObjectPropertyBoxed "first-party" (Just val)

data MessageFirstPartyPropertyInfo
instance AttrInfo MessageFirstPartyPropertyInfo where
    type AttrAllowedOps MessageFirstPartyPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MessageFirstPartyPropertyInfo = (~) Soup.URI.URI
    type AttrBaseTypeConstraint MessageFirstPartyPropertyInfo = IsMessage
    type AttrGetType MessageFirstPartyPropertyInfo = Soup.URI.URI
    type AttrLabel MessageFirstPartyPropertyInfo = "first-party"
    type AttrOrigin MessageFirstPartyPropertyInfo = Message
    attrGet _ = getMessageFirstParty
    attrSet _ = setMessageFirstParty
    attrConstruct _ = constructMessageFirstParty
    attrClear _ = undefined

-- VVV Prop "flags"
   -- Type: TInterface (Name {namespace = "Soup", name = "MessageFlags"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getMessageFlags :: (MonadIO m, IsMessage o) => o -> m [Soup.Flags.MessageFlags]
getMessageFlags obj = liftIO $ getObjectPropertyFlags obj "flags"

setMessageFlags :: (MonadIO m, IsMessage o) => o -> [Soup.Flags.MessageFlags] -> m ()
setMessageFlags obj val = liftIO $ setObjectPropertyFlags obj "flags" val

constructMessageFlags :: (IsMessage o) => [Soup.Flags.MessageFlags] -> IO (GValueConstruct o)
constructMessageFlags val = constructObjectPropertyFlags "flags" val

data MessageFlagsPropertyInfo
instance AttrInfo MessageFlagsPropertyInfo where
    type AttrAllowedOps MessageFlagsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MessageFlagsPropertyInfo = (~) [Soup.Flags.MessageFlags]
    type AttrBaseTypeConstraint MessageFlagsPropertyInfo = IsMessage
    type AttrGetType MessageFlagsPropertyInfo = [Soup.Flags.MessageFlags]
    type AttrLabel MessageFlagsPropertyInfo = "flags"
    type AttrOrigin MessageFlagsPropertyInfo = Message
    attrGet _ = getMessageFlags
    attrSet _ = setMessageFlags
    attrConstruct _ = constructMessageFlags
    attrClear _ = undefined

-- VVV Prop "http-version"
   -- Type: TInterface (Name {namespace = "Soup", name = "HTTPVersion"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getMessageHttpVersion :: (MonadIO m, IsMessage o) => o -> m Soup.Enums.HTTPVersion
getMessageHttpVersion obj = liftIO $ getObjectPropertyEnum obj "http-version"

setMessageHttpVersion :: (MonadIO m, IsMessage o) => o -> Soup.Enums.HTTPVersion -> m ()
setMessageHttpVersion obj val = liftIO $ setObjectPropertyEnum obj "http-version" val

constructMessageHttpVersion :: (IsMessage o) => Soup.Enums.HTTPVersion -> IO (GValueConstruct o)
constructMessageHttpVersion val = constructObjectPropertyEnum "http-version" val

data MessageHttpVersionPropertyInfo
instance AttrInfo MessageHttpVersionPropertyInfo where
    type AttrAllowedOps MessageHttpVersionPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MessageHttpVersionPropertyInfo = (~) Soup.Enums.HTTPVersion
    type AttrBaseTypeConstraint MessageHttpVersionPropertyInfo = IsMessage
    type AttrGetType MessageHttpVersionPropertyInfo = Soup.Enums.HTTPVersion
    type AttrLabel MessageHttpVersionPropertyInfo = "http-version"
    type AttrOrigin MessageHttpVersionPropertyInfo = Message
    attrGet _ = getMessageHttpVersion
    attrSet _ = setMessageHttpVersion
    attrConstruct _ = constructMessageHttpVersion
    attrClear _ = undefined

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

getMessageMethod :: (MonadIO m, IsMessage o) => o -> m (Maybe T.Text)
getMessageMethod obj = liftIO $ getObjectPropertyString obj "method"

setMessageMethod :: (MonadIO m, IsMessage o) => o -> T.Text -> m ()
setMessageMethod obj val = liftIO $ setObjectPropertyString obj "method" (Just val)

constructMessageMethod :: (IsMessage o) => T.Text -> IO (GValueConstruct o)
constructMessageMethod val = constructObjectPropertyString "method" (Just val)

clearMessageMethod :: (MonadIO m, IsMessage o) => o -> m ()
clearMessageMethod obj = liftIO $ setObjectPropertyString obj "method" (Nothing :: Maybe T.Text)

data MessageMethodPropertyInfo
instance AttrInfo MessageMethodPropertyInfo where
    type AttrAllowedOps MessageMethodPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MessageMethodPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint MessageMethodPropertyInfo = IsMessage
    type AttrGetType MessageMethodPropertyInfo = (Maybe T.Text)
    type AttrLabel MessageMethodPropertyInfo = "method"
    type AttrOrigin MessageMethodPropertyInfo = Message
    attrGet _ = getMessageMethod
    attrSet _ = setMessageMethod
    attrConstruct _ = constructMessageMethod
    attrClear _ = clearMessageMethod

-- VVV Prop "priority"
   -- Type: TInterface (Name {namespace = "Soup", name = "MessagePriority"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getMessagePriority :: (MonadIO m, IsMessage o) => o -> m Soup.Enums.MessagePriority
getMessagePriority obj = liftIO $ getObjectPropertyEnum obj "priority"

setMessagePriority :: (MonadIO m, IsMessage o) => o -> Soup.Enums.MessagePriority -> m ()
setMessagePriority obj val = liftIO $ setObjectPropertyEnum obj "priority" val

constructMessagePriority :: (IsMessage o) => Soup.Enums.MessagePriority -> IO (GValueConstruct o)
constructMessagePriority val = constructObjectPropertyEnum "priority" val

data MessagePriorityPropertyInfo
instance AttrInfo MessagePriorityPropertyInfo where
    type AttrAllowedOps MessagePriorityPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MessagePriorityPropertyInfo = (~) Soup.Enums.MessagePriority
    type AttrBaseTypeConstraint MessagePriorityPropertyInfo = IsMessage
    type AttrGetType MessagePriorityPropertyInfo = Soup.Enums.MessagePriority
    type AttrLabel MessagePriorityPropertyInfo = "priority"
    type AttrOrigin MessagePriorityPropertyInfo = Message
    attrGet _ = getMessagePriority
    attrSet _ = setMessagePriority
    attrConstruct _ = constructMessagePriority
    attrClear _ = undefined

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

getMessageReasonPhrase :: (MonadIO m, IsMessage o) => o -> m (Maybe T.Text)
getMessageReasonPhrase obj = liftIO $ getObjectPropertyString obj "reason-phrase"

setMessageReasonPhrase :: (MonadIO m, IsMessage o) => o -> T.Text -> m ()
setMessageReasonPhrase obj val = liftIO $ setObjectPropertyString obj "reason-phrase" (Just val)

constructMessageReasonPhrase :: (IsMessage o) => T.Text -> IO (GValueConstruct o)
constructMessageReasonPhrase val = constructObjectPropertyString "reason-phrase" (Just val)

clearMessageReasonPhrase :: (MonadIO m, IsMessage o) => o -> m ()
clearMessageReasonPhrase obj = liftIO $ setObjectPropertyString obj "reason-phrase" (Nothing :: Maybe T.Text)

data MessageReasonPhrasePropertyInfo
instance AttrInfo MessageReasonPhrasePropertyInfo where
    type AttrAllowedOps MessageReasonPhrasePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MessageReasonPhrasePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint MessageReasonPhrasePropertyInfo = IsMessage
    type AttrGetType MessageReasonPhrasePropertyInfo = (Maybe T.Text)
    type AttrLabel MessageReasonPhrasePropertyInfo = "reason-phrase"
    type AttrOrigin MessageReasonPhrasePropertyInfo = Message
    attrGet _ = getMessageReasonPhrase
    attrSet _ = setMessageReasonPhrase
    attrConstruct _ = constructMessageReasonPhrase
    attrClear _ = clearMessageReasonPhrase

-- VVV Prop "request-body"
   -- Type: TInterface (Name {namespace = "Soup", name = "MessageBody"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getMessageRequestBody :: (MonadIO m, IsMessage o) => o -> m (Maybe Soup.MessageBody.MessageBody)
getMessageRequestBody obj = liftIO $ getObjectPropertyBoxed obj "request-body" Soup.MessageBody.MessageBody

data MessageRequestBodyPropertyInfo
instance AttrInfo MessageRequestBodyPropertyInfo where
    type AttrAllowedOps MessageRequestBodyPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MessageRequestBodyPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MessageRequestBodyPropertyInfo = IsMessage
    type AttrGetType MessageRequestBodyPropertyInfo = (Maybe Soup.MessageBody.MessageBody)
    type AttrLabel MessageRequestBodyPropertyInfo = "request-body"
    type AttrOrigin MessageRequestBodyPropertyInfo = Message
    attrGet _ = getMessageRequestBody
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "request-body-data"
   -- Type: TInterface (Name {namespace = "GLib", name = "Bytes"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getMessageRequestBodyData :: (MonadIO m, IsMessage o) => o -> m (Maybe GLib.Bytes.Bytes)
getMessageRequestBodyData obj = liftIO $ getObjectPropertyBoxed obj "request-body-data" GLib.Bytes.Bytes

data MessageRequestBodyDataPropertyInfo
instance AttrInfo MessageRequestBodyDataPropertyInfo where
    type AttrAllowedOps MessageRequestBodyDataPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MessageRequestBodyDataPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MessageRequestBodyDataPropertyInfo = IsMessage
    type AttrGetType MessageRequestBodyDataPropertyInfo = (Maybe GLib.Bytes.Bytes)
    type AttrLabel MessageRequestBodyDataPropertyInfo = "request-body-data"
    type AttrOrigin MessageRequestBodyDataPropertyInfo = Message
    attrGet _ = getMessageRequestBodyData
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "request-headers"
   -- Type: TInterface (Name {namespace = "Soup", name = "MessageHeaders"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getMessageRequestHeaders :: (MonadIO m, IsMessage o) => o -> m (Maybe Soup.MessageHeaders.MessageHeaders)
getMessageRequestHeaders obj = liftIO $ getObjectPropertyBoxed obj "request-headers" Soup.MessageHeaders.MessageHeaders

data MessageRequestHeadersPropertyInfo
instance AttrInfo MessageRequestHeadersPropertyInfo where
    type AttrAllowedOps MessageRequestHeadersPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MessageRequestHeadersPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MessageRequestHeadersPropertyInfo = IsMessage
    type AttrGetType MessageRequestHeadersPropertyInfo = (Maybe Soup.MessageHeaders.MessageHeaders)
    type AttrLabel MessageRequestHeadersPropertyInfo = "request-headers"
    type AttrOrigin MessageRequestHeadersPropertyInfo = Message
    attrGet _ = getMessageRequestHeaders
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "response-body"
   -- Type: TInterface (Name {namespace = "Soup", name = "MessageBody"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getMessageResponseBody :: (MonadIO m, IsMessage o) => o -> m (Maybe Soup.MessageBody.MessageBody)
getMessageResponseBody obj = liftIO $ getObjectPropertyBoxed obj "response-body" Soup.MessageBody.MessageBody

data MessageResponseBodyPropertyInfo
instance AttrInfo MessageResponseBodyPropertyInfo where
    type AttrAllowedOps MessageResponseBodyPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MessageResponseBodyPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MessageResponseBodyPropertyInfo = IsMessage
    type AttrGetType MessageResponseBodyPropertyInfo = (Maybe Soup.MessageBody.MessageBody)
    type AttrLabel MessageResponseBodyPropertyInfo = "response-body"
    type AttrOrigin MessageResponseBodyPropertyInfo = Message
    attrGet _ = getMessageResponseBody
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "response-body-data"
   -- Type: TInterface (Name {namespace = "GLib", name = "Bytes"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getMessageResponseBodyData :: (MonadIO m, IsMessage o) => o -> m (Maybe GLib.Bytes.Bytes)
getMessageResponseBodyData obj = liftIO $ getObjectPropertyBoxed obj "response-body-data" GLib.Bytes.Bytes

data MessageResponseBodyDataPropertyInfo
instance AttrInfo MessageResponseBodyDataPropertyInfo where
    type AttrAllowedOps MessageResponseBodyDataPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MessageResponseBodyDataPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MessageResponseBodyDataPropertyInfo = IsMessage
    type AttrGetType MessageResponseBodyDataPropertyInfo = (Maybe GLib.Bytes.Bytes)
    type AttrLabel MessageResponseBodyDataPropertyInfo = "response-body-data"
    type AttrOrigin MessageResponseBodyDataPropertyInfo = Message
    attrGet _ = getMessageResponseBodyData
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "response-headers"
   -- Type: TInterface (Name {namespace = "Soup", name = "MessageHeaders"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getMessageResponseHeaders :: (MonadIO m, IsMessage o) => o -> m (Maybe Soup.MessageHeaders.MessageHeaders)
getMessageResponseHeaders obj = liftIO $ getObjectPropertyBoxed obj "response-headers" Soup.MessageHeaders.MessageHeaders

data MessageResponseHeadersPropertyInfo
instance AttrInfo MessageResponseHeadersPropertyInfo where
    type AttrAllowedOps MessageResponseHeadersPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MessageResponseHeadersPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MessageResponseHeadersPropertyInfo = IsMessage
    type AttrGetType MessageResponseHeadersPropertyInfo = (Maybe Soup.MessageHeaders.MessageHeaders)
    type AttrLabel MessageResponseHeadersPropertyInfo = "response-headers"
    type AttrOrigin MessageResponseHeadersPropertyInfo = Message
    attrGet _ = getMessageResponseHeaders
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "server-side"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

getMessageServerSide :: (MonadIO m, IsMessage o) => o -> m Bool
getMessageServerSide obj = liftIO $ getObjectPropertyBool obj "server-side"

constructMessageServerSide :: (IsMessage o) => Bool -> IO (GValueConstruct o)
constructMessageServerSide val = constructObjectPropertyBool "server-side" val

data MessageServerSidePropertyInfo
instance AttrInfo MessageServerSidePropertyInfo where
    type AttrAllowedOps MessageServerSidePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MessageServerSidePropertyInfo = (~) Bool
    type AttrBaseTypeConstraint MessageServerSidePropertyInfo = IsMessage
    type AttrGetType MessageServerSidePropertyInfo = Bool
    type AttrLabel MessageServerSidePropertyInfo = "server-side"
    type AttrOrigin MessageServerSidePropertyInfo = Message
    attrGet _ = getMessageServerSide
    attrSet _ = undefined
    attrConstruct _ = constructMessageServerSide
    attrClear _ = undefined

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

getMessageStatusCode :: (MonadIO m, IsMessage o) => o -> m Word32
getMessageStatusCode obj = liftIO $ getObjectPropertyUInt32 obj "status-code"

setMessageStatusCode :: (MonadIO m, IsMessage o) => o -> Word32 -> m ()
setMessageStatusCode obj val = liftIO $ setObjectPropertyUInt32 obj "status-code" val

constructMessageStatusCode :: (IsMessage o) => Word32 -> IO (GValueConstruct o)
constructMessageStatusCode val = constructObjectPropertyUInt32 "status-code" val

data MessageStatusCodePropertyInfo
instance AttrInfo MessageStatusCodePropertyInfo where
    type AttrAllowedOps MessageStatusCodePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MessageStatusCodePropertyInfo = (~) Word32
    type AttrBaseTypeConstraint MessageStatusCodePropertyInfo = IsMessage
    type AttrGetType MessageStatusCodePropertyInfo = Word32
    type AttrLabel MessageStatusCodePropertyInfo = "status-code"
    type AttrOrigin MessageStatusCodePropertyInfo = Message
    attrGet _ = getMessageStatusCode
    attrSet _ = setMessageStatusCode
    attrConstruct _ = constructMessageStatusCode
    attrClear _ = undefined

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

getMessageTlsCertificate :: (MonadIO m, IsMessage o) => o -> m (Maybe Gio.TlsCertificate.TlsCertificate)
getMessageTlsCertificate obj = liftIO $ getObjectPropertyObject obj "tls-certificate" Gio.TlsCertificate.TlsCertificate

setMessageTlsCertificate :: (MonadIO m, IsMessage o, Gio.TlsCertificate.IsTlsCertificate a) => o -> a -> m ()
setMessageTlsCertificate obj val = liftIO $ setObjectPropertyObject obj "tls-certificate" (Just val)

constructMessageTlsCertificate :: (IsMessage o, Gio.TlsCertificate.IsTlsCertificate a) => a -> IO (GValueConstruct o)
constructMessageTlsCertificate val = constructObjectPropertyObject "tls-certificate" (Just val)

clearMessageTlsCertificate :: (MonadIO m, IsMessage o) => o -> m ()
clearMessageTlsCertificate obj = liftIO $ setObjectPropertyObject obj "tls-certificate" (Nothing :: Maybe Gio.TlsCertificate.TlsCertificate)

data MessageTlsCertificatePropertyInfo
instance AttrInfo MessageTlsCertificatePropertyInfo where
    type AttrAllowedOps MessageTlsCertificatePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MessageTlsCertificatePropertyInfo = Gio.TlsCertificate.IsTlsCertificate
    type AttrBaseTypeConstraint MessageTlsCertificatePropertyInfo = IsMessage
    type AttrGetType MessageTlsCertificatePropertyInfo = (Maybe Gio.TlsCertificate.TlsCertificate)
    type AttrLabel MessageTlsCertificatePropertyInfo = "tls-certificate"
    type AttrOrigin MessageTlsCertificatePropertyInfo = Message
    attrGet _ = getMessageTlsCertificate
    attrSet _ = setMessageTlsCertificate
    attrConstruct _ = constructMessageTlsCertificate
    attrClear _ = clearMessageTlsCertificate

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

getMessageTlsErrors :: (MonadIO m, IsMessage o) => o -> m [Gio.Flags.TlsCertificateFlags]
getMessageTlsErrors obj = liftIO $ getObjectPropertyFlags obj "tls-errors"

setMessageTlsErrors :: (MonadIO m, IsMessage o) => o -> [Gio.Flags.TlsCertificateFlags] -> m ()
setMessageTlsErrors obj val = liftIO $ setObjectPropertyFlags obj "tls-errors" val

constructMessageTlsErrors :: (IsMessage o) => [Gio.Flags.TlsCertificateFlags] -> IO (GValueConstruct o)
constructMessageTlsErrors val = constructObjectPropertyFlags "tls-errors" val

data MessageTlsErrorsPropertyInfo
instance AttrInfo MessageTlsErrorsPropertyInfo where
    type AttrAllowedOps MessageTlsErrorsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MessageTlsErrorsPropertyInfo = (~) [Gio.Flags.TlsCertificateFlags]
    type AttrBaseTypeConstraint MessageTlsErrorsPropertyInfo = IsMessage
    type AttrGetType MessageTlsErrorsPropertyInfo = [Gio.Flags.TlsCertificateFlags]
    type AttrLabel MessageTlsErrorsPropertyInfo = "tls-errors"
    type AttrOrigin MessageTlsErrorsPropertyInfo = Message
    attrGet _ = getMessageTlsErrors
    attrSet _ = setMessageTlsErrors
    attrConstruct _ = constructMessageTlsErrors
    attrClear _ = undefined

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

getMessageUri :: (MonadIO m, IsMessage o) => o -> m Soup.URI.URI
getMessageUri obj = liftIO $ checkUnexpectedNothing "getMessageUri" $ getObjectPropertyBoxed obj "uri" Soup.URI.URI

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

constructMessageUri :: (IsMessage o) => Soup.URI.URI -> IO (GValueConstruct o)
constructMessageUri val = constructObjectPropertyBoxed "uri" (Just val)

data MessageUriPropertyInfo
instance AttrInfo MessageUriPropertyInfo where
    type AttrAllowedOps MessageUriPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MessageUriPropertyInfo = (~) Soup.URI.URI
    type AttrBaseTypeConstraint MessageUriPropertyInfo = IsMessage
    type AttrGetType MessageUriPropertyInfo = Soup.URI.URI
    type AttrLabel MessageUriPropertyInfo = "uri"
    type AttrOrigin MessageUriPropertyInfo = Message
    attrGet _ = getMessageUri
    attrSet _ = setMessageUri
    attrConstruct _ = constructMessageUri
    attrClear _ = undefined

instance O.HasAttributeList Message
type instance O.AttributeList Message = MessageAttributeList
type MessageAttributeList = ('[ '("firstParty", MessageFirstPartyPropertyInfo), '("flags", MessageFlagsPropertyInfo), '("httpVersion", MessageHttpVersionPropertyInfo), '("method", MessageMethodPropertyInfo), '("priority", MessagePriorityPropertyInfo), '("reasonPhrase", MessageReasonPhrasePropertyInfo), '("requestBody", MessageRequestBodyPropertyInfo), '("requestBodyData", MessageRequestBodyDataPropertyInfo), '("requestHeaders", MessageRequestHeadersPropertyInfo), '("responseBody", MessageResponseBodyPropertyInfo), '("responseBodyData", MessageResponseBodyDataPropertyInfo), '("responseHeaders", MessageResponseHeadersPropertyInfo), '("serverSide", MessageServerSidePropertyInfo), '("statusCode", MessageStatusCodePropertyInfo), '("tlsCertificate", MessageTlsCertificatePropertyInfo), '("tlsErrors", MessageTlsErrorsPropertyInfo), '("uri", MessageUriPropertyInfo)] :: [(Symbol, *)])

messageFirstParty :: AttrLabelProxy "firstParty"
messageFirstParty = AttrLabelProxy

messageFlags :: AttrLabelProxy "flags"
messageFlags = AttrLabelProxy

messageHttpVersion :: AttrLabelProxy "httpVersion"
messageHttpVersion = AttrLabelProxy

messageMethod :: AttrLabelProxy "method"
messageMethod = AttrLabelProxy

messagePriority :: AttrLabelProxy "priority"
messagePriority = AttrLabelProxy

messageReasonPhrase :: AttrLabelProxy "reasonPhrase"
messageReasonPhrase = AttrLabelProxy

messageRequestBody :: AttrLabelProxy "requestBody"
messageRequestBody = AttrLabelProxy

messageRequestBodyData :: AttrLabelProxy "requestBodyData"
messageRequestBodyData = AttrLabelProxy

messageRequestHeaders :: AttrLabelProxy "requestHeaders"
messageRequestHeaders = AttrLabelProxy

messageResponseBody :: AttrLabelProxy "responseBody"
messageResponseBody = AttrLabelProxy

messageResponseBodyData :: AttrLabelProxy "responseBodyData"
messageResponseBodyData = AttrLabelProxy

messageResponseHeaders :: AttrLabelProxy "responseHeaders"
messageResponseHeaders = AttrLabelProxy

messageServerSide :: AttrLabelProxy "serverSide"
messageServerSide = AttrLabelProxy

messageStatusCode :: AttrLabelProxy "statusCode"
messageStatusCode = AttrLabelProxy

messageTlsCertificate :: AttrLabelProxy "tlsCertificate"
messageTlsCertificate = AttrLabelProxy

messageTlsErrors :: AttrLabelProxy "tlsErrors"
messageTlsErrors = AttrLabelProxy

messageUri :: AttrLabelProxy "uri"
messageUri = AttrLabelProxy

data MessageContentSniffedSignalInfo
instance SignalInfo MessageContentSniffedSignalInfo where
    type HaskellCallbackType MessageContentSniffedSignalInfo = MessageContentSniffedCallback
    connectSignal _ = connectMessageContentSniffed

data MessageFinishedSignalInfo
instance SignalInfo MessageFinishedSignalInfo where
    type HaskellCallbackType MessageFinishedSignalInfo = MessageFinishedCallback
    connectSignal _ = connectMessageFinished

data MessageGotBodySignalInfo
instance SignalInfo MessageGotBodySignalInfo where
    type HaskellCallbackType MessageGotBodySignalInfo = MessageGotBodyCallback
    connectSignal _ = connectMessageGotBody

data MessageGotChunkSignalInfo
instance SignalInfo MessageGotChunkSignalInfo where
    type HaskellCallbackType MessageGotChunkSignalInfo = MessageGotChunkCallback
    connectSignal _ = connectMessageGotChunk

data MessageGotHeadersSignalInfo
instance SignalInfo MessageGotHeadersSignalInfo where
    type HaskellCallbackType MessageGotHeadersSignalInfo = MessageGotHeadersCallback
    connectSignal _ = connectMessageGotHeaders

data MessageGotInformationalSignalInfo
instance SignalInfo MessageGotInformationalSignalInfo where
    type HaskellCallbackType MessageGotInformationalSignalInfo = MessageGotInformationalCallback
    connectSignal _ = connectMessageGotInformational

data MessageNetworkEventSignalInfo
instance SignalInfo MessageNetworkEventSignalInfo where
    type HaskellCallbackType MessageNetworkEventSignalInfo = MessageNetworkEventCallback
    connectSignal _ = connectMessageNetworkEvent

data MessageRestartedSignalInfo
instance SignalInfo MessageRestartedSignalInfo where
    type HaskellCallbackType MessageRestartedSignalInfo = MessageRestartedCallback
    connectSignal _ = connectMessageRestarted

data MessageStartingSignalInfo
instance SignalInfo MessageStartingSignalInfo where
    type HaskellCallbackType MessageStartingSignalInfo = MessageStartingCallback
    connectSignal _ = connectMessageStarting

data MessageWroteBodySignalInfo
instance SignalInfo MessageWroteBodySignalInfo where
    type HaskellCallbackType MessageWroteBodySignalInfo = MessageWroteBodyCallback
    connectSignal _ = connectMessageWroteBody

data MessageWroteBodyDataSignalInfo
instance SignalInfo MessageWroteBodyDataSignalInfo where
    type HaskellCallbackType MessageWroteBodyDataSignalInfo = MessageWroteBodyDataCallback
    connectSignal _ = connectMessageWroteBodyData

data MessageWroteChunkSignalInfo
instance SignalInfo MessageWroteChunkSignalInfo where
    type HaskellCallbackType MessageWroteChunkSignalInfo = MessageWroteChunkCallback
    connectSignal _ = connectMessageWroteChunk

data MessageWroteHeadersSignalInfo
instance SignalInfo MessageWroteHeadersSignalInfo where
    type HaskellCallbackType MessageWroteHeadersSignalInfo = MessageWroteHeadersCallback
    connectSignal _ = connectMessageWroteHeaders

data MessageWroteInformationalSignalInfo
instance SignalInfo MessageWroteInformationalSignalInfo where
    type HaskellCallbackType MessageWroteInformationalSignalInfo = MessageWroteInformationalCallback
    connectSignal _ = connectMessageWroteInformational

type instance O.SignalList Message = MessageSignalList
type MessageSignalList = ('[ '("contentSniffed", MessageContentSniffedSignalInfo), '("finished", MessageFinishedSignalInfo), '("gotBody", MessageGotBodySignalInfo), '("gotChunk", MessageGotChunkSignalInfo), '("gotHeaders", MessageGotHeadersSignalInfo), '("gotInformational", MessageGotInformationalSignalInfo), '("networkEvent", MessageNetworkEventSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("restarted", MessageRestartedSignalInfo), '("starting", MessageStartingSignalInfo), '("wroteBody", MessageWroteBodySignalInfo), '("wroteBodyData", MessageWroteBodyDataSignalInfo), '("wroteChunk", MessageWroteChunkSignalInfo), '("wroteHeaders", MessageWroteHeadersSignalInfo), '("wroteInformational", MessageWroteInformationalSignalInfo)] :: [(Symbol, *)])

-- method Message::new
-- method type : Constructor
-- Args : [Arg {argCName = "method", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the HTTP method for the created request", 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 "the destination endpoint (as a string)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_new" soup_message_new :: 
    CString ->                              -- method : TBasicType TUTF8
    CString ->                              -- uri_string : TBasicType TUTF8
    IO (Ptr Message)

{- |
Creates a new empty 'GI.Soup.Objects.Message.Message', which will connect to /@uri@/
-}
messageNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@method@/: the HTTP method for the created request -}
    -> T.Text
    {- ^ /@uriString@/: the destination endpoint (as a string) -}
    -> m (Maybe Message)
    {- ^ __Returns:__ the new 'GI.Soup.Objects.Message.Message' (or 'Nothing' if /@uri@/
could not be parsed). -}
messageNew method uriString = liftIO $ do
    method' <- textToCString method
    uriString' <- textToCString uriString
    result <- soup_message_new method' uriString'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Message) result'
        return result''
    freeMem method'
    freeMem uriString'
    return maybeResult

-- method Message::new_from_uri
-- method type : Constructor
-- Args : [Arg {argCName = "method", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the HTTP method for the created request", 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 "the destination endpoint (as a #SoupURI)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_new_from_uri" soup_message_new_from_uri :: 
    CString ->                              -- method : TBasicType TUTF8
    Ptr Soup.URI.URI ->                     -- uri : TInterface (Name {namespace = "Soup", name = "URI"})
    IO (Ptr Message)

{- |
Creates a new empty 'GI.Soup.Objects.Message.Message', which will connect to /@uri@/
-}
messageNewFromUri ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@method@/: the HTTP method for the created request -}
    -> Soup.URI.URI
    {- ^ /@uri@/: the destination endpoint (as a 'GI.Soup.Structs.URI.URI') -}
    -> m Message
    {- ^ __Returns:__ the new 'GI.Soup.Objects.Message.Message' -}
messageNewFromUri method uri = liftIO $ do
    method' <- textToCString method
    uri' <- unsafeManagedPtrGetPtr uri
    result <- soup_message_new_from_uri method' uri'
    checkUnexpectedReturnNULL "messageNewFromUri" result
    result' <- (wrapObject Message) result
    touchManagedPtr uri
    freeMem method'
    return result'

-- method Message::content_sniffed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "content_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TGHash (TBasicType TPtr) (TBasicType TPtr), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_content_sniffed" soup_message_content_sniffed :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    CString ->                              -- content_type : TBasicType TUTF8
    Ptr (GHashTable (Ptr ()) (Ptr ())) ->   -- params : TGHash (TBasicType TPtr) (TBasicType TPtr)
    IO ()

{- |
/No description available in the introspection data./
-}
messageContentSniffed ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> T.Text
    -> Map.Map (Ptr ()) (Ptr ())
    -> m ()
messageContentSniffed msg contentType params = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    contentType' <- textToCString contentType
    let params' = Map.toList params
    let params'' = mapFirst ptrPackPtr params'
    let params''' = mapSecond ptrPackPtr params''
    params'''' <- packGHashTable gDirectHash gDirectEqual Nothing Nothing params'''
    soup_message_content_sniffed msg' contentType' params''''
    touchManagedPtr msg
    freeMem contentType'
    unrefGHashTable params''''
    return ()

data MessageContentSniffedMethodInfo
instance (signature ~ (T.Text -> Map.Map (Ptr ()) (Ptr ()) -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageContentSniffedMethodInfo a signature where
    overloadedMethod _ = messageContentSniffed

-- method Message::disable_feature
-- method type : OrdinaryMethod
-- Args : [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 = "feature_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType of a #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_message_disable_feature" soup_message_disable_feature :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    CGType ->                               -- feature_type : TBasicType TGType
    IO ()

{- |
This disables the actions of 'GI.Soup.Interfaces.SessionFeature.SessionFeature'\<!-- -->s with the
given /@featureType@/ (or a subclass of that type) on /@msg@/, so that
/@msg@/ is processed as though the feature(s) hadn\'t been added to the
session. Eg, passing @/SOUP_TYPE_CONTENT_SNIFFER/@ for /@featureType@/
will disable Content-Type sniffing on the message.

You must call this before queueing /@msg@/ on a session; calling it on
a message that has already been queued is undefined. In particular,
you cannot call this on a message that is being requeued after a
redirect or authentication.

@since 2.28
-}
messageDisableFeature ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> GType
    {- ^ /@featureType@/: the 'GType' of a 'GI.Soup.Interfaces.SessionFeature.SessionFeature' -}
    -> m ()
messageDisableFeature msg featureType = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    let featureType' = gtypeToCGType featureType
    soup_message_disable_feature msg' featureType'
    touchManagedPtr msg
    return ()

data MessageDisableFeatureMethodInfo
instance (signature ~ (GType -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageDisableFeatureMethodInfo a signature where
    overloadedMethod _ = messageDisableFeature

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

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

{- |
/No description available in the introspection data./
-}
messageFinished ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> m ()
messageFinished msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    soup_message_finished msg'
    touchManagedPtr msg
    return ()

data MessageFinishedMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageFinishedMethodInfo a signature where
    overloadedMethod _ = messageFinished

-- method Message::get_address
-- method type : OrdinaryMethod
-- Args : [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 = "Address"}))
-- throws : False
-- Skip return : False

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

{- |
Gets the address /@msg@/\'s URI points to. After first setting the
URI on a message, this will be unresolved, although the message\'s
session will resolve it before sending the message.

@since 2.26
-}
messageGetAddress ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> m Soup.Address.Address
    {- ^ __Returns:__ the address /@msg@/\'s URI points to -}
messageGetAddress msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_message_get_address msg'
    checkUnexpectedReturnNULL "messageGetAddress" result
    result' <- (newObject Soup.Address.Address) result
    touchManagedPtr msg
    return result'

data MessageGetAddressMethodInfo
instance (signature ~ (m Soup.Address.Address), MonadIO m, IsMessage a) => O.MethodInfo MessageGetAddressMethodInfo a signature where
    overloadedMethod _ = messageGetAddress

-- method Message::get_first_party
-- method type : OrdinaryMethod
-- Args : [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 = "URI"}))
-- throws : False
-- Skip return : False

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

{- |
Gets /@msg@/\'s first-party 'GI.Soup.Structs.URI.URI'

@since 2.30
-}
messageGetFirstParty ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> m Soup.URI.URI
    {- ^ __Returns:__ the /@msg@/\'s first party 'GI.Soup.Structs.URI.URI' -}
messageGetFirstParty msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_message_get_first_party msg'
    checkUnexpectedReturnNULL "messageGetFirstParty" result
    result' <- (newBoxed Soup.URI.URI) result
    touchManagedPtr msg
    return result'

data MessageGetFirstPartyMethodInfo
instance (signature ~ (m Soup.URI.URI), MonadIO m, IsMessage a) => O.MethodInfo MessageGetFirstPartyMethodInfo a signature where
    overloadedMethod _ = messageGetFirstParty

-- method Message::get_flags
-- method type : OrdinaryMethod
-- Args : [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 = "MessageFlags"}))
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_get_flags" soup_message_get_flags :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO CUInt

{- |
Gets the flags on /@msg@/
-}
messageGetFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> m [Soup.Flags.MessageFlags]
    {- ^ __Returns:__ the flags -}
messageGetFlags msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_message_get_flags msg'
    let result' = wordToGFlags result
    touchManagedPtr msg
    return result'

data MessageGetFlagsMethodInfo
instance (signature ~ (m [Soup.Flags.MessageFlags]), MonadIO m, IsMessage a) => O.MethodInfo MessageGetFlagsMethodInfo a signature where
    overloadedMethod _ = messageGetFlags

-- method Message::get_http_version
-- method type : OrdinaryMethod
-- Args : [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 = "HTTPVersion"}))
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_get_http_version" soup_message_get_http_version :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO CUInt

{- |
Gets the HTTP version of /@msg@/. This is the minimum of the
version from the request and the version from the response.
-}
messageGetHttpVersion ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> m Soup.Enums.HTTPVersion
    {- ^ __Returns:__ the HTTP version -}
messageGetHttpVersion msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_message_get_http_version msg'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr msg
    return result'

data MessageGetHttpVersionMethodInfo
instance (signature ~ (m Soup.Enums.HTTPVersion), MonadIO m, IsMessage a) => O.MethodInfo MessageGetHttpVersionMethodInfo a signature where
    overloadedMethod _ = messageGetHttpVersion

-- method Message::get_https_status
-- method type : OrdinaryMethod
-- Args : [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 = "certificate", argType = TInterface (Name {namespace = "Gio", name = "TlsCertificate"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "@msg's TLS certificate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "errors", argType = TInterface (Name {namespace = "Gio", name = "TlsCertificateFlags"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the verification status of @certificate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_get_https_status" soup_message_get_https_status :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Ptr (Ptr Gio.TlsCertificate.TlsCertificate) -> -- certificate : TInterface (Name {namespace = "Gio", name = "TlsCertificate"})
    Ptr CUInt ->                            -- errors : TInterface (Name {namespace = "Gio", name = "TlsCertificateFlags"})
    IO CInt

{- |
If /@msg@/ is using https (or attempted to use https but got
'GI.Soup.Enums.StatusSslFailed'), this retrieves the 'GI.Gio.Objects.TlsCertificate.TlsCertificate'
associated with its connection, and the 'GI.Gio.Flags.TlsCertificateFlags'
showing what problems, if any, have been found with that
certificate.

\<note>\<para>This is only meaningful with messages processed by a 'GI.Soup.Objects.Session.Session' and is
not useful for messages received by a 'GI.Soup.Objects.Server.Server'\<\/para>\<\/note>

@since 2.34
-}
messageGetHttpsStatus ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> m (Bool,Gio.TlsCertificate.TlsCertificate,[Gio.Flags.TlsCertificateFlags])
    {- ^ __Returns:__ 'True' if /@msg@/ used\/attempted https, 'False' if not -}
messageGetHttpsStatus msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    certificate <- allocMem :: IO (Ptr (Ptr Gio.TlsCertificate.TlsCertificate))
    errors <- allocMem :: IO (Ptr CUInt)
    result <- soup_message_get_https_status msg' certificate errors
    let result' = (/= 0) result
    certificate' <- peek certificate
    certificate'' <- (newObject Gio.TlsCertificate.TlsCertificate) certificate'
    errors' <- peek errors
    let errors'' = wordToGFlags errors'
    touchManagedPtr msg
    freeMem certificate
    freeMem errors
    return (result', certificate'', errors'')

data MessageGetHttpsStatusMethodInfo
instance (signature ~ (m (Bool,Gio.TlsCertificate.TlsCertificate,[Gio.Flags.TlsCertificateFlags])), MonadIO m, IsMessage a) => O.MethodInfo MessageGetHttpsStatusMethodInfo a signature where
    overloadedMethod _ = messageGetHttpsStatus

-- method Message::get_priority
-- method type : OrdinaryMethod
-- Args : [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 = "MessagePriority"}))
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_get_priority" soup_message_get_priority :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO CUInt

{- |
Retrieves the 'GI.Soup.Enums.MessagePriority'. If not set this value defaults
to @/SOUP_MESSAGE_PRIORITY_NORMAL/@.

@since 2.44
-}
messageGetPriority ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> m Soup.Enums.MessagePriority
    {- ^ __Returns:__ the priority of the message. -}
messageGetPriority msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_message_get_priority msg'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr msg
    return result'

data MessageGetPriorityMethodInfo
instance (signature ~ (m Soup.Enums.MessagePriority), MonadIO m, IsMessage a) => O.MethodInfo MessageGetPriorityMethodInfo a signature where
    overloadedMethod _ = messageGetPriority

-- method Message::get_soup_request
-- method type : OrdinaryMethod
-- Args : [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 = "Request"}))
-- throws : False
-- Skip return : False

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

{- |
If /@msg@/ is associated with a 'GI.Soup.Objects.Request.Request', this returns that
request. Otherwise it returns 'Nothing'.

@since 2.42
-}
messageGetSoupRequest ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> m Soup.Request.Request
    {- ^ __Returns:__ /@msg@/\'s associated 'GI.Soup.Objects.Request.Request' -}
messageGetSoupRequest msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_message_get_soup_request msg'
    checkUnexpectedReturnNULL "messageGetSoupRequest" result
    result' <- (newObject Soup.Request.Request) result
    touchManagedPtr msg
    return result'

data MessageGetSoupRequestMethodInfo
instance (signature ~ (m Soup.Request.Request), MonadIO m, IsMessage a) => O.MethodInfo MessageGetSoupRequestMethodInfo a signature where
    overloadedMethod _ = messageGetSoupRequest

-- method Message::get_uri
-- method type : OrdinaryMethod
-- Args : [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 = "URI"}))
-- throws : False
-- Skip return : False

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

{- |
Gets /@msg@/\'s URI
-}
messageGetUri ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> m Soup.URI.URI
    {- ^ __Returns:__ the URI /@msg@/ is targeted for. -}
messageGetUri msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_message_get_uri msg'
    checkUnexpectedReturnNULL "messageGetUri" result
    result' <- (newBoxed Soup.URI.URI) result
    touchManagedPtr msg
    return result'

data MessageGetUriMethodInfo
instance (signature ~ (m Soup.URI.URI), MonadIO m, IsMessage a) => O.MethodInfo MessageGetUriMethodInfo a signature where
    overloadedMethod _ = messageGetUri

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

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

{- |
/No description available in the introspection data./
-}
messageGotBody ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> m ()
messageGotBody msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    soup_message_got_body msg'
    touchManagedPtr msg
    return ()

data MessageGotBodyMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageGotBodyMethodInfo a signature where
    overloadedMethod _ = messageGotBody

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

foreign import ccall "soup_message_got_chunk" soup_message_got_chunk :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Ptr Soup.Buffer.Buffer ->               -- chunk : TInterface (Name {namespace = "Soup", name = "Buffer"})
    IO ()

{- |
/No description available in the introspection data./
-}
messageGotChunk ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> Soup.Buffer.Buffer
    -> m ()
messageGotChunk msg chunk = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    chunk' <- unsafeManagedPtrGetPtr chunk
    soup_message_got_chunk msg' chunk'
    touchManagedPtr msg
    touchManagedPtr chunk
    return ()

data MessageGotChunkMethodInfo
instance (signature ~ (Soup.Buffer.Buffer -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageGotChunkMethodInfo a signature where
    overloadedMethod _ = messageGotChunk

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

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

{- |
/No description available in the introspection data./
-}
messageGotHeaders ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> m ()
messageGotHeaders msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    soup_message_got_headers msg'
    touchManagedPtr msg
    return ()

data MessageGotHeadersMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageGotHeadersMethodInfo a signature where
    overloadedMethod _ = messageGotHeaders

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

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

{- |
/No description available in the introspection data./
-}
messageGotInformational ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> m ()
messageGotInformational msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    soup_message_got_informational msg'
    touchManagedPtr msg
    return ()

data MessageGotInformationalMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageGotInformationalMethodInfo a signature where
    overloadedMethod _ = messageGotInformational

-- method Message::is_keepalive
-- method type : OrdinaryMethod
-- Args : [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 (TBasicType TBoolean)
-- throws : False
-- Skip return : False

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

{- |
Determines whether or not /@msg@/\'s connection can be kept alive for
further requests after processing /@msg@/, based on the HTTP version,
Connection header, etc.
-}
messageIsKeepalive ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> m Bool
    {- ^ __Returns:__ 'True' or 'False'. -}
messageIsKeepalive msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    result <- soup_message_is_keepalive msg'
    let result' = (/= 0) result
    touchManagedPtr msg
    return result'

data MessageIsKeepaliveMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsMessage a) => O.MethodInfo MessageIsKeepaliveMethodInfo a signature where
    overloadedMethod _ = messageIsKeepalive

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

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

{- |
/No description available in the introspection data./
-}
messageRestarted ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> m ()
messageRestarted msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    soup_message_restarted msg'
    touchManagedPtr msg
    return ()

data MessageRestartedMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageRestartedMethodInfo a signature where
    overloadedMethod _ = messageRestarted

-- method Message::set_chunk_allocator
-- method type : OrdinaryMethod
-- Args : [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 = "allocator", argType = TInterface (Name {namespace = "Soup", name = "ChunkAllocator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the chunk allocator callback", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to pass to @allocator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "destroy_notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "destroy notifier to free @user_data when @msg is\ndestroyed", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_set_chunk_allocator" soup_message_set_chunk_allocator :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    FunPtr Soup.Callbacks.C_ChunkAllocator -> -- allocator : TInterface (Name {namespace = "Soup", name = "ChunkAllocator"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy_notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{-# DEPRECATED messageSetChunkAllocator ["'GI.Soup.Objects.Request.Request' provides a much simpler API that lets you","read the response directly into your own buffers without needing to","mess with callbacks, pausing\\/unpausing, etc."] #-}
{- |
Sets an alternate chunk-allocation function to use when reading
/@msg@/\'s body when using the traditional (ie,
non-'GI.Soup.Objects.Request.Request'\<!-- -->-based) API. Every time data is available
to read, libsoup will call /@allocator@/, which should return a
'GI.Soup.Structs.Buffer.Buffer'. (See 'GI.Soup.Callbacks.ChunkAllocator' for additional details.)
Libsoup will then read data from the network into that buffer, and
update the buffer\'s \<literal>length\<\/literal> to indicate how much
data it read.

Generally, a custom chunk allocator would be used in conjunction
with 'GI.Soup.Structs.MessageBody.messageBodySetAccumulate' 'False' and
'GI.Soup.Objects.Message.Message'::@/got_chunk/@, as part of a strategy to avoid unnecessary
copying of data. However, you cannot assume that every call to the
allocator will be followed by a call to your
'GI.Soup.Objects.Message.Message'::@/got_chunk/@ handler; if an I\/O error occurs, then the
buffer will be unreffed without ever having been used. If your
buffer-allocation strategy requires special cleanup, use
'GI.Soup.Structs.Buffer.bufferNewWithOwner' rather than doing the cleanup from the
'GI.Soup.Objects.Message.Message'::@/got_chunk/@ handler.

The other thing to remember when using non-accumulating message
bodies is that the buffer passed to the 'GI.Soup.Objects.Message.Message'::@/got_chunk/@
handler will be unreffed after the handler returns, just as it
would be in the non-custom-allocated case. If you want to hand the
chunk data off to some other part of your program to use later,
you\'ll need to ref the 'GI.Soup.Structs.Buffer.Buffer' (or its owner, in the
'GI.Soup.Structs.Buffer.bufferNewWithOwner' case) to ensure that the data remains
valid.
-}
messageSetChunkAllocator ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> Soup.Callbacks.ChunkAllocator
    {- ^ /@allocator@/: the chunk allocator callback -}
    -> m ()
messageSetChunkAllocator msg allocator = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    allocator' <- Soup.Callbacks.mk_ChunkAllocator (Soup.Callbacks.wrap_ChunkAllocator Nothing (Soup.Callbacks.drop_closures_ChunkAllocator allocator))
    let userData = castFunPtrToPtr allocator'
    let destroyNotify = safeFreeFunPtrPtr
    soup_message_set_chunk_allocator msg' allocator' userData destroyNotify
    touchManagedPtr msg
    return ()

data MessageSetChunkAllocatorMethodInfo
instance (signature ~ (Soup.Callbacks.ChunkAllocator -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageSetChunkAllocatorMethodInfo a signature where
    overloadedMethod _ = messageSetChunkAllocator

-- method Message::set_first_party
-- method type : OrdinaryMethod
-- Args : [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 = "first_party", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #SoupURI for the @msg's first party", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_set_first_party" soup_message_set_first_party :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Ptr Soup.URI.URI ->                     -- first_party : TInterface (Name {namespace = "Soup", name = "URI"})
    IO ()

{- |
Sets /@firstParty@/ as the main document 'GI.Soup.Structs.URI.URI' for /@msg@/. For
details of when and how this is used refer to the documentation for
'GI.Soup.Enums.CookieJarAcceptPolicy'.

@since 2.30
-}
messageSetFirstParty ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> Soup.URI.URI
    {- ^ /@firstParty@/: the 'GI.Soup.Structs.URI.URI' for the /@msg@/\'s first party -}
    -> m ()
messageSetFirstParty msg firstParty = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    firstParty' <- unsafeManagedPtrGetPtr firstParty
    soup_message_set_first_party msg' firstParty'
    touchManagedPtr msg
    touchManagedPtr firstParty
    return ()

data MessageSetFirstPartyMethodInfo
instance (signature ~ (Soup.URI.URI -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageSetFirstPartyMethodInfo a signature where
    overloadedMethod _ = messageSetFirstParty

-- method Message::set_flags
-- method type : OrdinaryMethod
-- Args : [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 = "flags", argType = TInterface (Name {namespace = "Soup", name = "MessageFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a set of #SoupMessageFlags values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_set_flags" soup_message_set_flags :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Soup", name = "MessageFlags"})
    IO ()

{- |
Sets the specified flags on /@msg@/.
-}
messageSetFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> [Soup.Flags.MessageFlags]
    {- ^ /@flags@/: a set of 'GI.Soup.Flags.MessageFlags' values -}
    -> m ()
messageSetFlags msg flags = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    let flags' = gflagsToWord flags
    soup_message_set_flags msg' flags'
    touchManagedPtr msg
    return ()

data MessageSetFlagsMethodInfo
instance (signature ~ ([Soup.Flags.MessageFlags] -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageSetFlagsMethodInfo a signature where
    overloadedMethod _ = messageSetFlags

-- method Message::set_http_version
-- method type : OrdinaryMethod
-- Args : [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 = "version", argType = TInterface (Name {namespace = "Soup", name = "HTTPVersion"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the HTTP version", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_set_http_version" soup_message_set_http_version :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    CUInt ->                                -- version : TInterface (Name {namespace = "Soup", name = "HTTPVersion"})
    IO ()

{- |
Sets the HTTP version on /@msg@/. The default version is
'GI.Soup.Enums.HTTPVersionHttp11'. Setting it to 'GI.Soup.Enums.HTTPVersionHttp10' will prevent certain
functionality from being used.
-}
messageSetHttpVersion ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> Soup.Enums.HTTPVersion
    {- ^ /@version@/: the HTTP version -}
    -> m ()
messageSetHttpVersion msg version = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    let version' = (fromIntegral . fromEnum) version
    soup_message_set_http_version msg' version'
    touchManagedPtr msg
    return ()

data MessageSetHttpVersionMethodInfo
instance (signature ~ (Soup.Enums.HTTPVersion -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageSetHttpVersionMethodInfo a signature where
    overloadedMethod _ = messageSetHttpVersion

-- method Message::set_priority
-- method type : OrdinaryMethod
-- Args : [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 = "priority", argType = TInterface (Name {namespace = "Soup", name = "MessagePriority"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #SoupMessagePriority", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_set_priority" soup_message_set_priority :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    CUInt ->                                -- priority : TInterface (Name {namespace = "Soup", name = "MessagePriority"})
    IO ()

{- |
Sets the priority of a message. Note that this won\'t have any
effect unless used before the message is added to the session\'s
message processing queue.

The message will be placed just before any other previously added
message with lower priority (messages with the same priority are
processed on a FIFO basis).

Setting priorities does not currently work with 'GI.Soup.Objects.SessionSync.SessionSync'
(or with synchronous messages on a plain 'GI.Soup.Objects.Session.Session') because in
the synchronous\/blocking case, priority ends up being determined
semi-randomly by thread scheduling.

@since 2.44
-}
messageSetPriority ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> Soup.Enums.MessagePriority
    {- ^ /@priority@/: the 'GI.Soup.Enums.MessagePriority' -}
    -> m ()
messageSetPriority msg priority = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    let priority' = (fromIntegral . fromEnum) priority
    soup_message_set_priority msg' priority'
    touchManagedPtr msg
    return ()

data MessageSetPriorityMethodInfo
instance (signature ~ (Soup.Enums.MessagePriority -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageSetPriorityMethodInfo a signature where
    overloadedMethod _ = messageSetPriority

-- method Message::set_redirect
-- method type : OrdinaryMethod
-- Args : [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 = "status_code", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a 3xx status code", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "redirect_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI to redirect @msg to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_set_redirect" soup_message_set_redirect :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Word32 ->                               -- status_code : TBasicType TUInt
    CString ->                              -- redirect_uri : TBasicType TUTF8
    IO ()

{- |
Sets /@msg@/\'s status_code to /@statusCode@/ and adds a Location header
pointing to /@redirectUri@/. Use this from a 'GI.Soup.Objects.Server.Server' when you
want to redirect the client to another URI.

/@redirectUri@/ can be a relative URI, in which case it is
interpreted relative to /@msg@/\'s current URI. In particular, if
/@redirectUri@/ is just a path, it will replace the path
\<emphasis>and query\<\/emphasis> of /@msg@/\'s URI.

@since 2.38
-}
messageSetRedirect ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> Word32
    {- ^ /@statusCode@/: a 3xx status code -}
    -> T.Text
    {- ^ /@redirectUri@/: the URI to redirect /@msg@/ to -}
    -> m ()
messageSetRedirect msg statusCode redirectUri = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    redirectUri' <- textToCString redirectUri
    soup_message_set_redirect msg' statusCode redirectUri'
    touchManagedPtr msg
    freeMem redirectUri'
    return ()

data MessageSetRedirectMethodInfo
instance (signature ~ (Word32 -> T.Text -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageSetRedirectMethodInfo a signature where
    overloadedMethod _ = messageSetRedirect

-- method Message::set_request
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "content_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "MIME Content-Type of the body", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "req_use", argType = TInterface (Name {namespace = "Soup", name = "MemoryUse"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMemoryUse describing how to handle @req_body", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "req_body", argType = TCArray False (-1) 4 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "\n  a data buffer containing the body of the message request.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "req_length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the byte length of @req_body.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "req_length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the byte length of @req_body.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_set_request" soup_message_set_request :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    CString ->                              -- content_type : TBasicType TUTF8
    CUInt ->                                -- req_use : TInterface (Name {namespace = "Soup", name = "MemoryUse"})
    Ptr Word8 ->                            -- req_body : TCArray False (-1) 4 (TBasicType TUInt8)
    Word64 ->                               -- req_length : TBasicType TUInt64
    IO ()

{- |
Convenience function to set the request body of a 'GI.Soup.Objects.Message.Message'. If
/@contentType@/ is 'Nothing', the request body must be empty as well.
-}
messageSetRequest ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: the message -}
    -> Maybe (T.Text)
    {- ^ /@contentType@/: MIME Content-Type of the body -}
    -> Soup.Enums.MemoryUse
    {- ^ /@reqUse@/: a 'GI.Soup.Enums.MemoryUse' describing how to handle /@reqBody@/ -}
    -> Maybe (ByteString)
    {- ^ /@reqBody@/: 
  a data buffer containing the body of the message request. -}
    -> m ()
messageSetRequest msg contentType reqUse reqBody = liftIO $ do
    let reqLength = case reqBody of
            Nothing -> 0
            Just jReqBody -> fromIntegral $ B.length jReqBody
    msg' <- unsafeManagedPtrCastPtr msg
    maybeContentType <- case contentType of
        Nothing -> return nullPtr
        Just jContentType -> do
            jContentType' <- textToCString jContentType
            return jContentType'
    let reqUse' = (fromIntegral . fromEnum) reqUse
    maybeReqBody <- case reqBody of
        Nothing -> return nullPtr
        Just jReqBody -> do
            jReqBody' <- packByteString jReqBody
            return jReqBody'
    soup_message_set_request msg' maybeContentType reqUse' maybeReqBody reqLength
    touchManagedPtr msg
    freeMem maybeContentType
    freeMem maybeReqBody
    return ()

data MessageSetRequestMethodInfo
instance (signature ~ (Maybe (T.Text) -> Soup.Enums.MemoryUse -> Maybe (ByteString) -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageSetRequestMethodInfo a signature where
    overloadedMethod _ = messageSetRequest

-- method Message::set_response
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "content_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "MIME Content-Type of the body", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "resp_use", argType = TInterface (Name {namespace = "Soup", name = "MemoryUse"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMemoryUse describing how to handle @resp_body", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "resp_body", argType = TCArray False (-1) 4 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "\n  a data buffer containing the body of the message response.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "resp_length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the byte length of @resp_body.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "resp_length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the byte length of @resp_body.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_set_response" soup_message_set_response :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    CString ->                              -- content_type : TBasicType TUTF8
    CUInt ->                                -- resp_use : TInterface (Name {namespace = "Soup", name = "MemoryUse"})
    Ptr Word8 ->                            -- resp_body : TCArray False (-1) 4 (TBasicType TUInt8)
    Word64 ->                               -- resp_length : TBasicType TUInt64
    IO ()

{- |
Convenience function to set the response body of a 'GI.Soup.Objects.Message.Message'. If
/@contentType@/ is 'Nothing', the response body must be empty as well.
-}
messageSetResponse ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: the message -}
    -> Maybe (T.Text)
    {- ^ /@contentType@/: MIME Content-Type of the body -}
    -> Soup.Enums.MemoryUse
    {- ^ /@respUse@/: a 'GI.Soup.Enums.MemoryUse' describing how to handle /@respBody@/ -}
    -> Maybe (ByteString)
    {- ^ /@respBody@/: 
  a data buffer containing the body of the message response. -}
    -> m ()
messageSetResponse msg contentType respUse respBody = liftIO $ do
    let respLength = case respBody of
            Nothing -> 0
            Just jRespBody -> fromIntegral $ B.length jRespBody
    msg' <- unsafeManagedPtrCastPtr msg
    maybeContentType <- case contentType of
        Nothing -> return nullPtr
        Just jContentType -> do
            jContentType' <- textToCString jContentType
            return jContentType'
    let respUse' = (fromIntegral . fromEnum) respUse
    maybeRespBody <- case respBody of
        Nothing -> return nullPtr
        Just jRespBody -> do
            jRespBody' <- packByteString jRespBody
            return jRespBody'
    soup_message_set_response msg' maybeContentType respUse' maybeRespBody respLength
    touchManagedPtr msg
    freeMem maybeContentType
    freeMem maybeRespBody
    return ()

data MessageSetResponseMethodInfo
instance (signature ~ (Maybe (T.Text) -> Soup.Enums.MemoryUse -> Maybe (ByteString) -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageSetResponseMethodInfo a signature where
    overloadedMethod _ = messageSetResponse

-- method Message::set_status
-- method type : OrdinaryMethod
-- Args : [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 = "status_code", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an HTTP status code", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

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

{- |
Sets /@msg@/\'s status code to /@statusCode@/. If /@statusCode@/ is a
known value, it will also set /@msg@/\'s reason_phrase.
-}
messageSetStatus ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> Word32
    {- ^ /@statusCode@/: an HTTP status code -}
    -> m ()
messageSetStatus msg statusCode = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    soup_message_set_status msg' statusCode
    touchManagedPtr msg
    return ()

data MessageSetStatusMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageSetStatusMethodInfo a signature where
    overloadedMethod _ = messageSetStatus

-- method Message::set_status_full
-- method type : OrdinaryMethod
-- Args : [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 = "status_code", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an HTTP status code", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "reason_phrase", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a description of the status", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_set_status_full" soup_message_set_status_full :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Word32 ->                               -- status_code : TBasicType TUInt
    CString ->                              -- reason_phrase : TBasicType TUTF8
    IO ()

{- |
Sets /@msg@/\'s status code and reason phrase.
-}
messageSetStatusFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> Word32
    {- ^ /@statusCode@/: an HTTP status code -}
    -> T.Text
    {- ^ /@reasonPhrase@/: a description of the status -}
    -> m ()
messageSetStatusFull msg statusCode reasonPhrase = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    reasonPhrase' <- textToCString reasonPhrase
    soup_message_set_status_full msg' statusCode reasonPhrase'
    touchManagedPtr msg
    freeMem reasonPhrase'
    return ()

data MessageSetStatusFullMethodInfo
instance (signature ~ (Word32 -> T.Text -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageSetStatusFullMethodInfo a signature where
    overloadedMethod _ = messageSetStatusFull

-- method Message::set_uri
-- method type : OrdinaryMethod
-- Args : [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 = "uri", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new #SoupURI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_message_set_uri" soup_message_set_uri :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Ptr Soup.URI.URI ->                     -- uri : TInterface (Name {namespace = "Soup", name = "URI"})
    IO ()

{- |
Sets /@msg@/\'s URI to /@uri@/. If /@msg@/ has already been sent and you want
to re-send it with the new URI, you need to call
'GI.Soup.Objects.Session.sessionRequeueMessage'.
-}
messageSetUri ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    {- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
    -> Soup.URI.URI
    {- ^ /@uri@/: the new 'GI.Soup.Structs.URI.URI' -}
    -> m ()
messageSetUri msg uri = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    uri' <- unsafeManagedPtrGetPtr uri
    soup_message_set_uri msg' uri'
    touchManagedPtr msg
    touchManagedPtr uri
    return ()

data MessageSetUriMethodInfo
instance (signature ~ (Soup.URI.URI -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageSetUriMethodInfo a signature where
    overloadedMethod _ = messageSetUri

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

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

{- |
/No description available in the introspection data./
-}
messageStarting ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> m ()
messageStarting msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    soup_message_starting msg'
    touchManagedPtr msg
    return ()

data MessageStartingMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageStartingMethodInfo a signature where
    overloadedMethod _ = messageStarting

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

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

{- |
/No description available in the introspection data./
-}
messageWroteBody ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> m ()
messageWroteBody msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    soup_message_wrote_body msg'
    touchManagedPtr msg
    return ()

data MessageWroteBodyMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageWroteBodyMethodInfo a signature where
    overloadedMethod _ = messageWroteBody

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

foreign import ccall "soup_message_wrote_body_data" soup_message_wrote_body_data :: 
    Ptr Message ->                          -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Ptr Soup.Buffer.Buffer ->               -- chunk : TInterface (Name {namespace = "Soup", name = "Buffer"})
    IO ()

{- |
/No description available in the introspection data./
-}
messageWroteBodyData ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> Soup.Buffer.Buffer
    -> m ()
messageWroteBodyData msg chunk = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    chunk' <- unsafeManagedPtrGetPtr chunk
    soup_message_wrote_body_data msg' chunk'
    touchManagedPtr msg
    touchManagedPtr chunk
    return ()

data MessageWroteBodyDataMethodInfo
instance (signature ~ (Soup.Buffer.Buffer -> m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageWroteBodyDataMethodInfo a signature where
    overloadedMethod _ = messageWroteBodyData

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

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

{- |
/No description available in the introspection data./
-}
messageWroteChunk ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> m ()
messageWroteChunk msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    soup_message_wrote_chunk msg'
    touchManagedPtr msg
    return ()

data MessageWroteChunkMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageWroteChunkMethodInfo a signature where
    overloadedMethod _ = messageWroteChunk

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

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

{- |
/No description available in the introspection data./
-}
messageWroteHeaders ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> m ()
messageWroteHeaders msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    soup_message_wrote_headers msg'
    touchManagedPtr msg
    return ()

data MessageWroteHeadersMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageWroteHeadersMethodInfo a signature where
    overloadedMethod _ = messageWroteHeaders

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

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

{- |
/No description available in the introspection data./
-}
messageWroteInformational ::
    (B.CallStack.HasCallStack, MonadIO m, IsMessage a) =>
    a
    -> m ()
messageWroteInformational msg = liftIO $ do
    msg' <- unsafeManagedPtrCastPtr msg
    soup_message_wrote_informational msg'
    touchManagedPtr msg
    return ()

data MessageWroteInformationalMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMessage a) => O.MethodInfo MessageWroteInformationalMethodInfo a signature where
    overloadedMethod _ = messageWroteInformational