{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.WebKit2.Objects.WebResource
    ( 

-- * Exported types
    WebResource(..)                         ,
    IsWebResource                           ,
    toWebResource                           ,
    noWebResource                           ,


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

#if defined(ENABLE_OVERLOADING)
    ResolveWebResourceMethod                ,
#endif


-- ** getData #method:getData#

#if defined(ENABLE_OVERLOADING)
    WebResourceGetDataMethodInfo            ,
#endif
    webResourceGetData                      ,


-- ** getDataFinish #method:getDataFinish#

#if defined(ENABLE_OVERLOADING)
    WebResourceGetDataFinishMethodInfo      ,
#endif
    webResourceGetDataFinish                ,


-- ** getResponse #method:getResponse#

#if defined(ENABLE_OVERLOADING)
    WebResourceGetResponseMethodInfo        ,
#endif
    webResourceGetResponse                  ,


-- ** getUri #method:getUri#

#if defined(ENABLE_OVERLOADING)
    WebResourceGetUriMethodInfo             ,
#endif
    webResourceGetUri                       ,




 -- * Properties
-- ** response #attr:response#
-- | The t'GI.WebKit2.Objects.URIResponse.URIResponse' associated with this resource.

#if defined(ENABLE_OVERLOADING)
    WebResourceResponsePropertyInfo         ,
#endif
    getWebResourceResponse                  ,
#if defined(ENABLE_OVERLOADING)
    webResourceResponse                     ,
#endif


-- ** uri #attr:uri#
-- | The current active URI of the t'GI.WebKit2.Objects.WebResource.WebResource'.
-- See 'GI.WebKit2.Objects.WebResource.webResourceGetUri' for more details.

#if defined(ENABLE_OVERLOADING)
    WebResourceUriPropertyInfo              ,
#endif
    getWebResourceUri                       ,
#if defined(ENABLE_OVERLOADING)
    webResourceUri                          ,
#endif




 -- * Signals
-- ** failed #signal:failed#

    C_WebResourceFailedCallback             ,
    WebResourceFailedCallback               ,
#if defined(ENABLE_OVERLOADING)
    WebResourceFailedSignalInfo             ,
#endif
    afterWebResourceFailed                  ,
    genClosure_WebResourceFailed            ,
    mk_WebResourceFailedCallback            ,
    noWebResourceFailedCallback             ,
    onWebResourceFailed                     ,
    wrap_WebResourceFailedCallback          ,


-- ** failedWithTlsErrors #signal:failedWithTlsErrors#

    C_WebResourceFailedWithTlsErrorsCallback,
    WebResourceFailedWithTlsErrorsCallback  ,
#if defined(ENABLE_OVERLOADING)
    WebResourceFailedWithTlsErrorsSignalInfo,
#endif
    afterWebResourceFailedWithTlsErrors     ,
    genClosure_WebResourceFailedWithTlsErrors,
    mk_WebResourceFailedWithTlsErrorsCallback,
    noWebResourceFailedWithTlsErrorsCallback,
    onWebResourceFailedWithTlsErrors        ,
    wrap_WebResourceFailedWithTlsErrorsCallback,


-- ** finished #signal:finished#

    C_WebResourceFinishedCallback           ,
    WebResourceFinishedCallback             ,
#if defined(ENABLE_OVERLOADING)
    WebResourceFinishedSignalInfo           ,
#endif
    afterWebResourceFinished                ,
    genClosure_WebResourceFinished          ,
    mk_WebResourceFinishedCallback          ,
    noWebResourceFinishedCallback           ,
    onWebResourceFinished                   ,
    wrap_WebResourceFinishedCallback        ,


-- ** receivedData #signal:receivedData#

    C_WebResourceReceivedDataCallback       ,
    WebResourceReceivedDataCallback         ,
#if defined(ENABLE_OVERLOADING)
    WebResourceReceivedDataSignalInfo       ,
#endif
    afterWebResourceReceivedData            ,
    genClosure_WebResourceReceivedData      ,
    mk_WebResourceReceivedDataCallback      ,
    noWebResourceReceivedDataCallback       ,
    onWebResourceReceivedData               ,
    wrap_WebResourceReceivedDataCallback    ,


-- ** sentRequest #signal:sentRequest#

    C_WebResourceSentRequestCallback        ,
    WebResourceSentRequestCallback          ,
#if defined(ENABLE_OVERLOADING)
    WebResourceSentRequestSignalInfo        ,
#endif
    afterWebResourceSentRequest             ,
    genClosure_WebResourceSentRequest       ,
    mk_WebResourceSentRequestCallback       ,
    noWebResourceSentRequestCallback        ,
    onWebResourceSentRequest                ,
    wrap_WebResourceSentRequestCallback     ,




    ) where

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

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Flags as Gio.Flags
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.TlsCertificate as Gio.TlsCertificate
import {-# SOURCE #-} qualified GI.WebKit2.Objects.URIRequest as WebKit2.URIRequest
import {-# SOURCE #-} qualified GI.WebKit2.Objects.URIResponse as WebKit2.URIResponse

-- | Memory-managed wrapper type.
newtype WebResource = WebResource (ManagedPtr WebResource)
    deriving (WebResource -> WebResource -> Bool
(WebResource -> WebResource -> Bool)
-> (WebResource -> WebResource -> Bool) -> Eq WebResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WebResource -> WebResource -> Bool
$c/= :: WebResource -> WebResource -> Bool
== :: WebResource -> WebResource -> Bool
$c== :: WebResource -> WebResource -> Bool
Eq)
foreign import ccall "webkit_web_resource_get_type"
    c_webkit_web_resource_get_type :: IO GType

instance GObject WebResource where
    gobjectType :: IO GType
gobjectType = IO GType
c_webkit_web_resource_get_type
    

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

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

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

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

-- | A convenience alias for `Nothing` :: `Maybe` `WebResource`.
noWebResource :: Maybe WebResource
noWebResource :: Maybe WebResource
noWebResource = Maybe WebResource
forall a. Maybe a
Nothing

#if defined(ENABLE_OVERLOADING)
type family ResolveWebResourceMethod (t :: Symbol) (o :: *) :: * where
    ResolveWebResourceMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveWebResourceMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveWebResourceMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveWebResourceMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveWebResourceMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveWebResourceMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveWebResourceMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveWebResourceMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveWebResourceMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveWebResourceMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveWebResourceMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveWebResourceMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveWebResourceMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveWebResourceMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveWebResourceMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveWebResourceMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveWebResourceMethod "getData" o = WebResourceGetDataMethodInfo
    ResolveWebResourceMethod "getDataFinish" o = WebResourceGetDataFinishMethodInfo
    ResolveWebResourceMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveWebResourceMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveWebResourceMethod "getResponse" o = WebResourceGetResponseMethodInfo
    ResolveWebResourceMethod "getUri" o = WebResourceGetUriMethodInfo
    ResolveWebResourceMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveWebResourceMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveWebResourceMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveWebResourceMethod l o = O.MethodResolutionFailed l o

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

#endif

-- signal WebResource::failed
-- | This signal is emitted when an error occurs during the resource
-- load operation.
type WebResourceFailedCallback =
    GError
    -- ^ /@error@/: the t'GError' that was triggered
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `WebResourceFailedCallback`@.
noWebResourceFailedCallback :: Maybe WebResourceFailedCallback
noWebResourceFailedCallback :: Maybe WebResourceFailedCallback
noWebResourceFailedCallback = Maybe WebResourceFailedCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_WebResourceFailed :: MonadIO m => WebResourceFailedCallback -> m (GClosure C_WebResourceFailedCallback)
genClosure_WebResourceFailed :: WebResourceFailedCallback
-> m (GClosure C_WebResourceFailedCallback)
genClosure_WebResourceFailed cb :: WebResourceFailedCallback
cb = IO (GClosure C_WebResourceFailedCallback)
-> m (GClosure C_WebResourceFailedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_WebResourceFailedCallback)
 -> m (GClosure C_WebResourceFailedCallback))
-> IO (GClosure C_WebResourceFailedCallback)
-> m (GClosure C_WebResourceFailedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceFailedCallback
cb' = WebResourceFailedCallback -> C_WebResourceFailedCallback
wrap_WebResourceFailedCallback WebResourceFailedCallback
cb
    C_WebResourceFailedCallback
-> IO (FunPtr C_WebResourceFailedCallback)
mk_WebResourceFailedCallback C_WebResourceFailedCallback
cb' IO (FunPtr C_WebResourceFailedCallback)
-> (FunPtr C_WebResourceFailedCallback
    -> IO (GClosure C_WebResourceFailedCallback))
-> IO (GClosure C_WebResourceFailedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_WebResourceFailedCallback
-> IO (GClosure C_WebResourceFailedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `WebResourceFailedCallback` into a `C_WebResourceFailedCallback`.
wrap_WebResourceFailedCallback ::
    WebResourceFailedCallback ->
    C_WebResourceFailedCallback
wrap_WebResourceFailedCallback :: WebResourceFailedCallback -> C_WebResourceFailedCallback
wrap_WebResourceFailedCallback _cb :: WebResourceFailedCallback
_cb _ error_ :: Ptr GError
error_ _ = do
    GError
error_' <- ((ManagedPtr GError -> GError) -> Ptr GError -> IO GError
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr GError -> GError
GError) Ptr GError
error_
    WebResourceFailedCallback
_cb  GError
error_'


-- | Connect a signal handler for the [failed](#signal:failed) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' webResource #failed callback
-- @
-- 
-- 
onWebResourceFailed :: (IsWebResource a, MonadIO m) => a -> WebResourceFailedCallback -> m SignalHandlerId
onWebResourceFailed :: a -> WebResourceFailedCallback -> m SignalHandlerId
onWebResourceFailed obj :: a
obj cb :: WebResourceFailedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceFailedCallback
cb' = WebResourceFailedCallback -> C_WebResourceFailedCallback
wrap_WebResourceFailedCallback WebResourceFailedCallback
cb
    FunPtr C_WebResourceFailedCallback
cb'' <- C_WebResourceFailedCallback
-> IO (FunPtr C_WebResourceFailedCallback)
mk_WebResourceFailedCallback C_WebResourceFailedCallback
cb'
    a
-> Text
-> FunPtr C_WebResourceFailedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "failed" FunPtr C_WebResourceFailedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [failed](#signal:failed) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' webResource #failed callback
-- @
-- 
-- 
afterWebResourceFailed :: (IsWebResource a, MonadIO m) => a -> WebResourceFailedCallback -> m SignalHandlerId
afterWebResourceFailed :: a -> WebResourceFailedCallback -> m SignalHandlerId
afterWebResourceFailed obj :: a
obj cb :: WebResourceFailedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceFailedCallback
cb' = WebResourceFailedCallback -> C_WebResourceFailedCallback
wrap_WebResourceFailedCallback WebResourceFailedCallback
cb
    FunPtr C_WebResourceFailedCallback
cb'' <- C_WebResourceFailedCallback
-> IO (FunPtr C_WebResourceFailedCallback)
mk_WebResourceFailedCallback C_WebResourceFailedCallback
cb'
    a
-> Text
-> FunPtr C_WebResourceFailedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "failed" FunPtr C_WebResourceFailedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data WebResourceFailedSignalInfo
instance SignalInfo WebResourceFailedSignalInfo where
    type HaskellCallbackType WebResourceFailedSignalInfo = WebResourceFailedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_WebResourceFailedCallback cb
        cb'' <- mk_WebResourceFailedCallback cb'
        connectSignalFunPtr obj "failed" cb'' connectMode detail

#endif

-- signal WebResource::failed-with-tls-errors
-- | This signal is emitted when a TLS error occurs during the resource load operation.
-- 
-- /Since: 2.8/
type WebResourceFailedWithTlsErrorsCallback =
    Gio.TlsCertificate.TlsCertificate
    -- ^ /@certificate@/: a t'GI.Gio.Objects.TlsCertificate.TlsCertificate'
    -> [Gio.Flags.TlsCertificateFlags]
    -- ^ /@errors@/: a t'GI.Gio.Flags.TlsCertificateFlags' with the verification status of /@certificate@/
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `WebResourceFailedWithTlsErrorsCallback`@.
noWebResourceFailedWithTlsErrorsCallback :: Maybe WebResourceFailedWithTlsErrorsCallback
noWebResourceFailedWithTlsErrorsCallback :: Maybe WebResourceFailedWithTlsErrorsCallback
noWebResourceFailedWithTlsErrorsCallback = Maybe WebResourceFailedWithTlsErrorsCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_WebResourceFailedWithTlsErrorsCallback =
    Ptr () ->                               -- object
    Ptr Gio.TlsCertificate.TlsCertificate ->
    CUInt ->
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_WebResourceFailedWithTlsErrors :: MonadIO m => WebResourceFailedWithTlsErrorsCallback -> m (GClosure C_WebResourceFailedWithTlsErrorsCallback)
genClosure_WebResourceFailedWithTlsErrors :: WebResourceFailedWithTlsErrorsCallback
-> m (GClosure C_WebResourceFailedWithTlsErrorsCallback)
genClosure_WebResourceFailedWithTlsErrors cb :: WebResourceFailedWithTlsErrorsCallback
cb = IO (GClosure C_WebResourceFailedWithTlsErrorsCallback)
-> m (GClosure C_WebResourceFailedWithTlsErrorsCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_WebResourceFailedWithTlsErrorsCallback)
 -> m (GClosure C_WebResourceFailedWithTlsErrorsCallback))
-> IO (GClosure C_WebResourceFailedWithTlsErrorsCallback)
-> m (GClosure C_WebResourceFailedWithTlsErrorsCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceFailedWithTlsErrorsCallback
cb' = WebResourceFailedWithTlsErrorsCallback
-> C_WebResourceFailedWithTlsErrorsCallback
wrap_WebResourceFailedWithTlsErrorsCallback WebResourceFailedWithTlsErrorsCallback
cb
    C_WebResourceFailedWithTlsErrorsCallback
-> IO (FunPtr C_WebResourceFailedWithTlsErrorsCallback)
mk_WebResourceFailedWithTlsErrorsCallback C_WebResourceFailedWithTlsErrorsCallback
cb' IO (FunPtr C_WebResourceFailedWithTlsErrorsCallback)
-> (FunPtr C_WebResourceFailedWithTlsErrorsCallback
    -> IO (GClosure C_WebResourceFailedWithTlsErrorsCallback))
-> IO (GClosure C_WebResourceFailedWithTlsErrorsCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_WebResourceFailedWithTlsErrorsCallback
-> IO (GClosure C_WebResourceFailedWithTlsErrorsCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `WebResourceFailedWithTlsErrorsCallback` into a `C_WebResourceFailedWithTlsErrorsCallback`.
wrap_WebResourceFailedWithTlsErrorsCallback ::
    WebResourceFailedWithTlsErrorsCallback ->
    C_WebResourceFailedWithTlsErrorsCallback
wrap_WebResourceFailedWithTlsErrorsCallback :: WebResourceFailedWithTlsErrorsCallback
-> C_WebResourceFailedWithTlsErrorsCallback
wrap_WebResourceFailedWithTlsErrorsCallback _cb :: WebResourceFailedWithTlsErrorsCallback
_cb _ certificate :: Ptr TlsCertificate
certificate errors :: CUInt
errors _ = do
    TlsCertificate
certificate' <- ((ManagedPtr TlsCertificate -> TlsCertificate)
-> Ptr TlsCertificate -> IO TlsCertificate
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr TlsCertificate -> TlsCertificate
Gio.TlsCertificate.TlsCertificate) Ptr TlsCertificate
certificate
    let errors' :: [TlsCertificateFlags]
errors' = CUInt -> [TlsCertificateFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
errors
    WebResourceFailedWithTlsErrorsCallback
_cb  TlsCertificate
certificate' [TlsCertificateFlags]
errors'


-- | Connect a signal handler for the [failedWithTlsErrors](#signal:failedWithTlsErrors) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' webResource #failedWithTlsErrors callback
-- @
-- 
-- 
onWebResourceFailedWithTlsErrors :: (IsWebResource a, MonadIO m) => a -> WebResourceFailedWithTlsErrorsCallback -> m SignalHandlerId
onWebResourceFailedWithTlsErrors :: a -> WebResourceFailedWithTlsErrorsCallback -> m SignalHandlerId
onWebResourceFailedWithTlsErrors obj :: a
obj cb :: WebResourceFailedWithTlsErrorsCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceFailedWithTlsErrorsCallback
cb' = WebResourceFailedWithTlsErrorsCallback
-> C_WebResourceFailedWithTlsErrorsCallback
wrap_WebResourceFailedWithTlsErrorsCallback WebResourceFailedWithTlsErrorsCallback
cb
    FunPtr C_WebResourceFailedWithTlsErrorsCallback
cb'' <- C_WebResourceFailedWithTlsErrorsCallback
-> IO (FunPtr C_WebResourceFailedWithTlsErrorsCallback)
mk_WebResourceFailedWithTlsErrorsCallback C_WebResourceFailedWithTlsErrorsCallback
cb'
    a
-> Text
-> FunPtr C_WebResourceFailedWithTlsErrorsCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "failed-with-tls-errors" FunPtr C_WebResourceFailedWithTlsErrorsCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [failedWithTlsErrors](#signal:failedWithTlsErrors) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' webResource #failedWithTlsErrors callback
-- @
-- 
-- 
afterWebResourceFailedWithTlsErrors :: (IsWebResource a, MonadIO m) => a -> WebResourceFailedWithTlsErrorsCallback -> m SignalHandlerId
afterWebResourceFailedWithTlsErrors :: a -> WebResourceFailedWithTlsErrorsCallback -> m SignalHandlerId
afterWebResourceFailedWithTlsErrors obj :: a
obj cb :: WebResourceFailedWithTlsErrorsCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceFailedWithTlsErrorsCallback
cb' = WebResourceFailedWithTlsErrorsCallback
-> C_WebResourceFailedWithTlsErrorsCallback
wrap_WebResourceFailedWithTlsErrorsCallback WebResourceFailedWithTlsErrorsCallback
cb
    FunPtr C_WebResourceFailedWithTlsErrorsCallback
cb'' <- C_WebResourceFailedWithTlsErrorsCallback
-> IO (FunPtr C_WebResourceFailedWithTlsErrorsCallback)
mk_WebResourceFailedWithTlsErrorsCallback C_WebResourceFailedWithTlsErrorsCallback
cb'
    a
-> Text
-> FunPtr C_WebResourceFailedWithTlsErrorsCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "failed-with-tls-errors" FunPtr C_WebResourceFailedWithTlsErrorsCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data WebResourceFailedWithTlsErrorsSignalInfo
instance SignalInfo WebResourceFailedWithTlsErrorsSignalInfo where
    type HaskellCallbackType WebResourceFailedWithTlsErrorsSignalInfo = WebResourceFailedWithTlsErrorsCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_WebResourceFailedWithTlsErrorsCallback cb
        cb'' <- mk_WebResourceFailedWithTlsErrorsCallback cb'
        connectSignalFunPtr obj "failed-with-tls-errors" cb'' connectMode detail

#endif

-- signal WebResource::finished
-- | This signal is emitted when the resource load finishes successfully
-- or due to an error. In case of errors [failed]("GI.WebKit2.Objects.WebResource#signal:failed") signal
-- is emitted before this one.
type WebResourceFinishedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `WebResourceFinishedCallback`@.
noWebResourceFinishedCallback :: Maybe WebResourceFinishedCallback
noWebResourceFinishedCallback :: Maybe (IO ())
noWebResourceFinishedCallback = Maybe (IO ())
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_WebResourceFinished :: MonadIO m => WebResourceFinishedCallback -> m (GClosure C_WebResourceFinishedCallback)
genClosure_WebResourceFinished :: IO () -> m (GClosure C_WebResourceFinishedCallback)
genClosure_WebResourceFinished cb :: IO ()
cb = IO (GClosure C_WebResourceFinishedCallback)
-> m (GClosure C_WebResourceFinishedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_WebResourceFinishedCallback)
 -> m (GClosure C_WebResourceFinishedCallback))
-> IO (GClosure C_WebResourceFinishedCallback)
-> m (GClosure C_WebResourceFinishedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceFinishedCallback
cb' = IO () -> C_WebResourceFinishedCallback
wrap_WebResourceFinishedCallback IO ()
cb
    C_WebResourceFinishedCallback
-> IO (FunPtr C_WebResourceFinishedCallback)
mk_WebResourceFinishedCallback C_WebResourceFinishedCallback
cb' IO (FunPtr C_WebResourceFinishedCallback)
-> (FunPtr C_WebResourceFinishedCallback
    -> IO (GClosure C_WebResourceFinishedCallback))
-> IO (GClosure C_WebResourceFinishedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_WebResourceFinishedCallback
-> IO (GClosure C_WebResourceFinishedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `WebResourceFinishedCallback` into a `C_WebResourceFinishedCallback`.
wrap_WebResourceFinishedCallback ::
    WebResourceFinishedCallback ->
    C_WebResourceFinishedCallback
wrap_WebResourceFinishedCallback :: IO () -> C_WebResourceFinishedCallback
wrap_WebResourceFinishedCallback _cb :: IO ()
_cb _ _ = do
    IO ()
_cb 


-- | Connect a signal handler for the [finished](#signal:finished) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' webResource #finished callback
-- @
-- 
-- 
onWebResourceFinished :: (IsWebResource a, MonadIO m) => a -> WebResourceFinishedCallback -> m SignalHandlerId
onWebResourceFinished :: a -> IO () -> m SignalHandlerId
onWebResourceFinished obj :: a
obj cb :: IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceFinishedCallback
cb' = IO () -> C_WebResourceFinishedCallback
wrap_WebResourceFinishedCallback IO ()
cb
    FunPtr C_WebResourceFinishedCallback
cb'' <- C_WebResourceFinishedCallback
-> IO (FunPtr C_WebResourceFinishedCallback)
mk_WebResourceFinishedCallback C_WebResourceFinishedCallback
cb'
    a
-> Text
-> FunPtr C_WebResourceFinishedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "finished" FunPtr C_WebResourceFinishedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [finished](#signal:finished) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' webResource #finished callback
-- @
-- 
-- 
afterWebResourceFinished :: (IsWebResource a, MonadIO m) => a -> WebResourceFinishedCallback -> m SignalHandlerId
afterWebResourceFinished :: a -> IO () -> m SignalHandlerId
afterWebResourceFinished obj :: a
obj cb :: IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceFinishedCallback
cb' = IO () -> C_WebResourceFinishedCallback
wrap_WebResourceFinishedCallback IO ()
cb
    FunPtr C_WebResourceFinishedCallback
cb'' <- C_WebResourceFinishedCallback
-> IO (FunPtr C_WebResourceFinishedCallback)
mk_WebResourceFinishedCallback C_WebResourceFinishedCallback
cb'
    a
-> Text
-> FunPtr C_WebResourceFinishedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "finished" FunPtr C_WebResourceFinishedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data WebResourceFinishedSignalInfo
instance SignalInfo WebResourceFinishedSignalInfo where
    type HaskellCallbackType WebResourceFinishedSignalInfo = WebResourceFinishedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_WebResourceFinishedCallback cb
        cb'' <- mk_WebResourceFinishedCallback cb'
        connectSignalFunPtr obj "finished" cb'' connectMode detail

#endif

-- signal WebResource::received-data
-- | This signal is emitted after response is received,
-- every time new data has been received. It\'s
-- useful to know the progress of the resource load operation.
type WebResourceReceivedDataCallback =
    Word64
    -- ^ /@dataLength@/: the length of data received in bytes
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `WebResourceReceivedDataCallback`@.
noWebResourceReceivedDataCallback :: Maybe WebResourceReceivedDataCallback
noWebResourceReceivedDataCallback :: Maybe WebResourceReceivedDataCallback
noWebResourceReceivedDataCallback = Maybe WebResourceReceivedDataCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_WebResourceReceivedData :: MonadIO m => WebResourceReceivedDataCallback -> m (GClosure C_WebResourceReceivedDataCallback)
genClosure_WebResourceReceivedData :: WebResourceReceivedDataCallback
-> m (GClosure C_WebResourceReceivedDataCallback)
genClosure_WebResourceReceivedData cb :: WebResourceReceivedDataCallback
cb = IO (GClosure C_WebResourceReceivedDataCallback)
-> m (GClosure C_WebResourceReceivedDataCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_WebResourceReceivedDataCallback)
 -> m (GClosure C_WebResourceReceivedDataCallback))
-> IO (GClosure C_WebResourceReceivedDataCallback)
-> m (GClosure C_WebResourceReceivedDataCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceReceivedDataCallback
cb' = WebResourceReceivedDataCallback
-> C_WebResourceReceivedDataCallback
wrap_WebResourceReceivedDataCallback WebResourceReceivedDataCallback
cb
    C_WebResourceReceivedDataCallback
-> IO (FunPtr C_WebResourceReceivedDataCallback)
mk_WebResourceReceivedDataCallback C_WebResourceReceivedDataCallback
cb' IO (FunPtr C_WebResourceReceivedDataCallback)
-> (FunPtr C_WebResourceReceivedDataCallback
    -> IO (GClosure C_WebResourceReceivedDataCallback))
-> IO (GClosure C_WebResourceReceivedDataCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_WebResourceReceivedDataCallback
-> IO (GClosure C_WebResourceReceivedDataCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `WebResourceReceivedDataCallback` into a `C_WebResourceReceivedDataCallback`.
wrap_WebResourceReceivedDataCallback ::
    WebResourceReceivedDataCallback ->
    C_WebResourceReceivedDataCallback
wrap_WebResourceReceivedDataCallback :: WebResourceReceivedDataCallback
-> C_WebResourceReceivedDataCallback
wrap_WebResourceReceivedDataCallback _cb :: WebResourceReceivedDataCallback
_cb _ dataLength :: Word64
dataLength _ = do
    WebResourceReceivedDataCallback
_cb  Word64
dataLength


-- | Connect a signal handler for the [receivedData](#signal:receivedData) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' webResource #receivedData callback
-- @
-- 
-- 
onWebResourceReceivedData :: (IsWebResource a, MonadIO m) => a -> WebResourceReceivedDataCallback -> m SignalHandlerId
onWebResourceReceivedData :: a -> WebResourceReceivedDataCallback -> m SignalHandlerId
onWebResourceReceivedData obj :: a
obj cb :: WebResourceReceivedDataCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceReceivedDataCallback
cb' = WebResourceReceivedDataCallback
-> C_WebResourceReceivedDataCallback
wrap_WebResourceReceivedDataCallback WebResourceReceivedDataCallback
cb
    FunPtr C_WebResourceReceivedDataCallback
cb'' <- C_WebResourceReceivedDataCallback
-> IO (FunPtr C_WebResourceReceivedDataCallback)
mk_WebResourceReceivedDataCallback C_WebResourceReceivedDataCallback
cb'
    a
-> Text
-> FunPtr C_WebResourceReceivedDataCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "received-data" FunPtr C_WebResourceReceivedDataCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [receivedData](#signal:receivedData) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' webResource #receivedData callback
-- @
-- 
-- 
afterWebResourceReceivedData :: (IsWebResource a, MonadIO m) => a -> WebResourceReceivedDataCallback -> m SignalHandlerId
afterWebResourceReceivedData :: a -> WebResourceReceivedDataCallback -> m SignalHandlerId
afterWebResourceReceivedData obj :: a
obj cb :: WebResourceReceivedDataCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceReceivedDataCallback
cb' = WebResourceReceivedDataCallback
-> C_WebResourceReceivedDataCallback
wrap_WebResourceReceivedDataCallback WebResourceReceivedDataCallback
cb
    FunPtr C_WebResourceReceivedDataCallback
cb'' <- C_WebResourceReceivedDataCallback
-> IO (FunPtr C_WebResourceReceivedDataCallback)
mk_WebResourceReceivedDataCallback C_WebResourceReceivedDataCallback
cb'
    a
-> Text
-> FunPtr C_WebResourceReceivedDataCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "received-data" FunPtr C_WebResourceReceivedDataCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data WebResourceReceivedDataSignalInfo
instance SignalInfo WebResourceReceivedDataSignalInfo where
    type HaskellCallbackType WebResourceReceivedDataSignalInfo = WebResourceReceivedDataCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_WebResourceReceivedDataCallback cb
        cb'' <- mk_WebResourceReceivedDataCallback cb'
        connectSignalFunPtr obj "received-data" cb'' connectMode detail

#endif

-- signal WebResource::sent-request
-- | This signal is emitted when /@request@/ has been sent to the
-- server. In case of a server redirection this signal is
-- emitted again with the /@request@/ argument containing the new
-- request sent to the server due to the redirection and the
-- /@redirectedResponse@/ parameter containing the response
-- received by the server for the initial request.
type WebResourceSentRequestCallback =
    WebKit2.URIRequest.URIRequest
    -- ^ /@request@/: a t'GI.WebKit2.Objects.URIRequest.URIRequest'
    -> WebKit2.URIResponse.URIResponse
    -- ^ /@redirectedResponse@/: a t'GI.WebKit2.Objects.URIResponse.URIResponse', or 'P.Nothing'
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `WebResourceSentRequestCallback`@.
noWebResourceSentRequestCallback :: Maybe WebResourceSentRequestCallback
noWebResourceSentRequestCallback :: Maybe WebResourceSentRequestCallback
noWebResourceSentRequestCallback = Maybe WebResourceSentRequestCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_WebResourceSentRequestCallback =
    Ptr () ->                               -- object
    Ptr WebKit2.URIRequest.URIRequest ->
    Ptr WebKit2.URIResponse.URIResponse ->
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_WebResourceSentRequest :: MonadIO m => WebResourceSentRequestCallback -> m (GClosure C_WebResourceSentRequestCallback)
genClosure_WebResourceSentRequest :: WebResourceSentRequestCallback
-> m (GClosure C_WebResourceSentRequestCallback)
genClosure_WebResourceSentRequest cb :: WebResourceSentRequestCallback
cb = IO (GClosure C_WebResourceSentRequestCallback)
-> m (GClosure C_WebResourceSentRequestCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_WebResourceSentRequestCallback)
 -> m (GClosure C_WebResourceSentRequestCallback))
-> IO (GClosure C_WebResourceSentRequestCallback)
-> m (GClosure C_WebResourceSentRequestCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceSentRequestCallback
cb' = WebResourceSentRequestCallback -> C_WebResourceSentRequestCallback
wrap_WebResourceSentRequestCallback WebResourceSentRequestCallback
cb
    C_WebResourceSentRequestCallback
-> IO (FunPtr C_WebResourceSentRequestCallback)
mk_WebResourceSentRequestCallback C_WebResourceSentRequestCallback
cb' IO (FunPtr C_WebResourceSentRequestCallback)
-> (FunPtr C_WebResourceSentRequestCallback
    -> IO (GClosure C_WebResourceSentRequestCallback))
-> IO (GClosure C_WebResourceSentRequestCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_WebResourceSentRequestCallback
-> IO (GClosure C_WebResourceSentRequestCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `WebResourceSentRequestCallback` into a `C_WebResourceSentRequestCallback`.
wrap_WebResourceSentRequestCallback ::
    WebResourceSentRequestCallback ->
    C_WebResourceSentRequestCallback
wrap_WebResourceSentRequestCallback :: WebResourceSentRequestCallback -> C_WebResourceSentRequestCallback
wrap_WebResourceSentRequestCallback _cb :: WebResourceSentRequestCallback
_cb _ request :: Ptr URIRequest
request redirectedResponse :: Ptr URIResponse
redirectedResponse _ = do
    URIRequest
request' <- ((ManagedPtr URIRequest -> URIRequest)
-> Ptr URIRequest -> IO URIRequest
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr URIRequest -> URIRequest
WebKit2.URIRequest.URIRequest) Ptr URIRequest
request
    URIResponse
redirectedResponse' <- ((ManagedPtr URIResponse -> URIResponse)
-> Ptr URIResponse -> IO URIResponse
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr URIResponse -> URIResponse
WebKit2.URIResponse.URIResponse) Ptr URIResponse
redirectedResponse
    WebResourceSentRequestCallback
_cb  URIRequest
request' URIResponse
redirectedResponse'


-- | Connect a signal handler for the [sentRequest](#signal:sentRequest) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' webResource #sentRequest callback
-- @
-- 
-- 
onWebResourceSentRequest :: (IsWebResource a, MonadIO m) => a -> WebResourceSentRequestCallback -> m SignalHandlerId
onWebResourceSentRequest :: a -> WebResourceSentRequestCallback -> m SignalHandlerId
onWebResourceSentRequest obj :: a
obj cb :: WebResourceSentRequestCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceSentRequestCallback
cb' = WebResourceSentRequestCallback -> C_WebResourceSentRequestCallback
wrap_WebResourceSentRequestCallback WebResourceSentRequestCallback
cb
    FunPtr C_WebResourceSentRequestCallback
cb'' <- C_WebResourceSentRequestCallback
-> IO (FunPtr C_WebResourceSentRequestCallback)
mk_WebResourceSentRequestCallback C_WebResourceSentRequestCallback
cb'
    a
-> Text
-> FunPtr C_WebResourceSentRequestCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "sent-request" FunPtr C_WebResourceSentRequestCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [sentRequest](#signal:sentRequest) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' webResource #sentRequest callback
-- @
-- 
-- 
afterWebResourceSentRequest :: (IsWebResource a, MonadIO m) => a -> WebResourceSentRequestCallback -> m SignalHandlerId
afterWebResourceSentRequest :: a -> WebResourceSentRequestCallback -> m SignalHandlerId
afterWebResourceSentRequest obj :: a
obj cb :: WebResourceSentRequestCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_WebResourceSentRequestCallback
cb' = WebResourceSentRequestCallback -> C_WebResourceSentRequestCallback
wrap_WebResourceSentRequestCallback WebResourceSentRequestCallback
cb
    FunPtr C_WebResourceSentRequestCallback
cb'' <- C_WebResourceSentRequestCallback
-> IO (FunPtr C_WebResourceSentRequestCallback)
mk_WebResourceSentRequestCallback C_WebResourceSentRequestCallback
cb'
    a
-> Text
-> FunPtr C_WebResourceSentRequestCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "sent-request" FunPtr C_WebResourceSentRequestCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data WebResourceSentRequestSignalInfo
instance SignalInfo WebResourceSentRequestSignalInfo where
    type HaskellCallbackType WebResourceSentRequestSignalInfo = WebResourceSentRequestCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_WebResourceSentRequestCallback cb
        cb'' <- mk_WebResourceSentRequestCallback cb'
        connectSignalFunPtr obj "sent-request" cb'' connectMode detail

#endif

-- VVV Prop "response"
   -- Type: TInterface (Name {namespace = "WebKit2", name = "URIResponse"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Just True,Nothing)

-- | Get the value of the “@response@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' webResource #response
-- @
getWebResourceResponse :: (MonadIO m, IsWebResource o) => o -> m (Maybe WebKit2.URIResponse.URIResponse)
getWebResourceResponse :: o -> m (Maybe URIResponse)
getWebResourceResponse obj :: o
obj = IO (Maybe URIResponse) -> m (Maybe URIResponse)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe URIResponse) -> m (Maybe URIResponse))
-> IO (Maybe URIResponse) -> m (Maybe URIResponse)
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr URIResponse -> URIResponse)
-> IO (Maybe URIResponse)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj "response" ManagedPtr URIResponse -> URIResponse
WebKit2.URIResponse.URIResponse

#if defined(ENABLE_OVERLOADING)
data WebResourceResponsePropertyInfo
instance AttrInfo WebResourceResponsePropertyInfo where
    type AttrAllowedOps WebResourceResponsePropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint WebResourceResponsePropertyInfo = IsWebResource
    type AttrSetTypeConstraint WebResourceResponsePropertyInfo = (~) ()
    type AttrTransferTypeConstraint WebResourceResponsePropertyInfo = (~) ()
    type AttrTransferType WebResourceResponsePropertyInfo = ()
    type AttrGetType WebResourceResponsePropertyInfo = (Maybe WebKit2.URIResponse.URIResponse)
    type AttrLabel WebResourceResponsePropertyInfo = "response"
    type AttrOrigin WebResourceResponsePropertyInfo = WebResource
    attrGet = getWebResourceResponse
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
#endif

-- VVV Prop "uri"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@uri@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' webResource #uri
-- @
getWebResourceUri :: (MonadIO m, IsWebResource o) => o -> m T.Text
getWebResourceUri :: o -> m Text
getWebResourceUri obj :: o
obj = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe Text) -> IO Text
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing "getWebResourceUri" (IO (Maybe Text) -> IO Text) -> IO (Maybe Text) -> IO Text
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj "uri"

#if defined(ENABLE_OVERLOADING)
data WebResourceUriPropertyInfo
instance AttrInfo WebResourceUriPropertyInfo where
    type AttrAllowedOps WebResourceUriPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint WebResourceUriPropertyInfo = IsWebResource
    type AttrSetTypeConstraint WebResourceUriPropertyInfo = (~) ()
    type AttrTransferTypeConstraint WebResourceUriPropertyInfo = (~) ()
    type AttrTransferType WebResourceUriPropertyInfo = ()
    type AttrGetType WebResourceUriPropertyInfo = T.Text
    type AttrLabel WebResourceUriPropertyInfo = "uri"
    type AttrOrigin WebResourceUriPropertyInfo = WebResource
    attrGet = getWebResourceUri
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList WebResource
type instance O.AttributeList WebResource = WebResourceAttributeList
type WebResourceAttributeList = ('[ '("response", WebResourceResponsePropertyInfo), '("uri", WebResourceUriPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
webResourceResponse :: AttrLabelProxy "response"
webResourceResponse = AttrLabelProxy

webResourceUri :: AttrLabelProxy "uri"
webResourceUri = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList WebResource = WebResourceSignalList
type WebResourceSignalList = ('[ '("failed", WebResourceFailedSignalInfo), '("failedWithTlsErrors", WebResourceFailedWithTlsErrorsSignalInfo), '("finished", WebResourceFinishedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("receivedData", WebResourceReceivedDataSignalInfo), '("sentRequest", WebResourceSentRequestSignalInfo)] :: [(Symbol, *)])

#endif

-- method WebResource::get_data
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resource"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "WebResource" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitWebResource"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable or %NULL to ignore"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a #GAsyncReadyCallback to call when the request is satisfied"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data to pass to callback function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_resource_get_data" webkit_web_resource_get_data :: 
    Ptr WebResource ->                      -- resource : TInterface (Name {namespace = "WebKit2", name = "WebResource"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Asynchronously get the raw data for /@resource@/.
-- 
-- When the operation is finished, /@callback@/ will be called. You can then call
-- 'GI.WebKit2.Objects.WebResource.webResourceGetDataFinish' to get the result of the operation.
webResourceGetData ::
    (B.CallStack.HasCallStack, MonadIO m, IsWebResource a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@resource@/: a t'GI.WebKit2.Objects.WebResource.WebResource'
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing' to ignore
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: a t'GI.Gio.Callbacks.AsyncReadyCallback' to call when the request is satisfied
    -> m ()
webResourceGetData :: a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
webResourceGetData resource :: a
resource cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr WebResource
resource' <- a -> IO (Ptr WebResource)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resource
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just jCancellable :: b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just jCallback :: AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr WebResource
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
webkit_web_resource_get_data Ptr WebResource
resource' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resource
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data WebResourceGetDataMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsWebResource a, Gio.Cancellable.IsCancellable b) => O.MethodInfo WebResourceGetDataMethodInfo a signature where
    overloadedMethod = webResourceGetData

#endif

-- method WebResource::get_data_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resource"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "WebResource" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitWebResource"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GAsyncResult" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return location for the length of the resource data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "length"
--              , argType = TBasicType TUInt64
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "return location for the length of the resource data"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TCArray False (-1) 2 (TBasicType TUInt8))
-- throws : True
-- Skip return : False

foreign import ccall "webkit_web_resource_get_data_finish" webkit_web_resource_get_data_finish :: 
    Ptr WebResource ->                      -- resource : TInterface (Name {namespace = "WebKit2", name = "WebResource"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Word8)

-- | Finish an asynchronous operation started with 'GI.WebKit2.Objects.WebResource.webResourceGetData'.
webResourceGetDataFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsWebResource a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@resource@/: a t'GI.WebKit2.Objects.WebResource.WebResource'
    -> b
    -- ^ /@result@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult'
    -> m ByteString
    -- ^ __Returns:__ a
    --    string with the data of /@resource@/, or 'P.Nothing' in case of error. if /@length@/
    --    is not 'P.Nothing', the size of the data will be assigned to it. /(Can throw 'Data.GI.Base.GError.GError')/
webResourceGetDataFinish :: a -> b -> m ByteString
webResourceGetDataFinish resource :: a
resource result_ :: b
result_ = IO ByteString -> m ByteString
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString -> m ByteString) -> IO ByteString -> m ByteString
forall a b. (a -> b) -> a -> b
$ do
    Ptr WebResource
resource' <- a -> IO (Ptr WebResource)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resource
    Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    Ptr Word64
length_ <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    IO ByteString -> IO () -> IO ByteString
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr Word8
result <- (Ptr (Ptr GError) -> IO (Ptr Word8)) -> IO (Ptr Word8)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Word8)) -> IO (Ptr Word8))
-> (Ptr (Ptr GError) -> IO (Ptr Word8)) -> IO (Ptr Word8)
forall a b. (a -> b) -> a -> b
$ Ptr WebResource
-> Ptr AsyncResult
-> Ptr Word64
-> Ptr (Ptr GError)
-> IO (Ptr Word8)
webkit_web_resource_get_data_finish Ptr WebResource
resource' Ptr AsyncResult
result_' Ptr Word64
length_
        Word64
length_' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
length_
        Text -> Ptr Word8 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "webResourceGetDataFinish" Ptr Word8
result
        ByteString
result' <- (Word64 -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word64
length_') Ptr Word8
result
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
result
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resource
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
        ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
result'
     ) (do
        Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
     )

#if defined(ENABLE_OVERLOADING)
data WebResourceGetDataFinishMethodInfo
instance (signature ~ (b -> m ByteString), MonadIO m, IsWebResource a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo WebResourceGetDataFinishMethodInfo a signature where
    overloadedMethod = webResourceGetDataFinish

#endif

-- method WebResource::get_response
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resource"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "WebResource" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitWebResource"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "WebKit2" , name = "URIResponse" })
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_resource_get_response" webkit_web_resource_get_response :: 
    Ptr WebResource ->                      -- resource : TInterface (Name {namespace = "WebKit2", name = "WebResource"})
    IO (Ptr WebKit2.URIResponse.URIResponse)

-- | Retrieves the t'GI.WebKit2.Objects.URIResponse.URIResponse' of the resource load operation.
-- This method returns 'P.Nothing' if called before the response
-- is received from the server. You can connect to notify[response](#signal:response)
-- signal to be notified when the response is received.
webResourceGetResponse ::
    (B.CallStack.HasCallStack, MonadIO m, IsWebResource a) =>
    a
    -- ^ /@resource@/: a t'GI.WebKit2.Objects.WebResource.WebResource'
    -> m (Maybe WebKit2.URIResponse.URIResponse)
    -- ^ __Returns:__ the t'GI.WebKit2.Objects.URIResponse.URIResponse', or 'P.Nothing' if
    --     the response hasn\'t been received yet.
webResourceGetResponse :: a -> m (Maybe URIResponse)
webResourceGetResponse resource :: a
resource = IO (Maybe URIResponse) -> m (Maybe URIResponse)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe URIResponse) -> m (Maybe URIResponse))
-> IO (Maybe URIResponse) -> m (Maybe URIResponse)
forall a b. (a -> b) -> a -> b
$ do
    Ptr WebResource
resource' <- a -> IO (Ptr WebResource)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resource
    Ptr URIResponse
result <- Ptr WebResource -> IO (Ptr URIResponse)
webkit_web_resource_get_response Ptr WebResource
resource'
    Maybe URIResponse
maybeResult <- Ptr URIResponse
-> (Ptr URIResponse -> IO URIResponse) -> IO (Maybe URIResponse)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr URIResponse
result ((Ptr URIResponse -> IO URIResponse) -> IO (Maybe URIResponse))
-> (Ptr URIResponse -> IO URIResponse) -> IO (Maybe URIResponse)
forall a b. (a -> b) -> a -> b
$ \result' :: Ptr URIResponse
result' -> do
        URIResponse
result'' <- ((ManagedPtr URIResponse -> URIResponse)
-> Ptr URIResponse -> IO URIResponse
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr URIResponse -> URIResponse
WebKit2.URIResponse.URIResponse) Ptr URIResponse
result'
        URIResponse -> IO URIResponse
forall (m :: * -> *) a. Monad m => a -> m a
return URIResponse
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resource
    Maybe URIResponse -> IO (Maybe URIResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe URIResponse
maybeResult

#if defined(ENABLE_OVERLOADING)
data WebResourceGetResponseMethodInfo
instance (signature ~ (m (Maybe WebKit2.URIResponse.URIResponse)), MonadIO m, IsWebResource a) => O.MethodInfo WebResourceGetResponseMethodInfo a signature where
    overloadedMethod = webResourceGetResponse

#endif

-- method WebResource::get_uri
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resource"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "WebResource" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitWebResource"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_resource_get_uri" webkit_web_resource_get_uri :: 
    Ptr WebResource ->                      -- resource : TInterface (Name {namespace = "WebKit2", name = "WebResource"})
    IO CString

-- | Returns the current active URI of /@resource@/. The active URI might change during
-- a load operation:
-- 
-- \<orderedlist>
-- \<listitem>\<para>
--   When the resource load starts, the active URI is the requested URI
-- \<\/para>\<\/listitem>
-- \<listitem>\<para>
--   When the initial request is sent to the server, [sentRequest]("GI.WebKit2.Objects.WebResource#signal:sentRequest")
--   signal is emitted without a redirected response, the active URI is the URI of
--   the request sent to the server.
-- \<\/para>\<\/listitem>
-- \<listitem>\<para>
--   In case of a server redirection, [sentRequest]("GI.WebKit2.Objects.WebResource#signal:sentRequest") signal
--   is emitted again with a redirected response, the active URI is the URI the request
--   was redirected to.
-- \<\/para>\<\/listitem>
-- \<listitem>\<para>
--   When the response is received from the server, the active URI is the final
--   one and it will not change again.
-- \<\/para>\<\/listitem>
-- \<\/orderedlist>
-- 
-- You can monitor the active URI by connecting to the notify[uri](#signal:uri)
-- signal of /@resource@/.
webResourceGetUri ::
    (B.CallStack.HasCallStack, MonadIO m, IsWebResource a) =>
    a
    -- ^ /@resource@/: a t'GI.WebKit2.Objects.WebResource.WebResource'
    -> m T.Text
    -- ^ __Returns:__ the current active URI of /@resource@/
webResourceGetUri :: a -> m Text
webResourceGetUri resource :: a
resource = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr WebResource
resource' <- a -> IO (Ptr WebResource)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resource
    CString
result <- Ptr WebResource -> IO CString
webkit_web_resource_get_uri Ptr WebResource
resource'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "webResourceGetUri" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resource
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data WebResourceGetUriMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsWebResource a) => O.MethodInfo WebResourceGetUriMethodInfo a signature where
    overloadedMethod = webResourceGetUri

#endif