#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.WebKit2.Objects.WebResource
(
WebResource(..) ,
IsWebResource ,
toWebResource ,
noWebResource ,
#if ENABLE_OVERLOADING
WebResourceGetDataMethodInfo ,
#endif
webResourceGetData ,
#if ENABLE_OVERLOADING
WebResourceGetDataFinishMethodInfo ,
#endif
webResourceGetDataFinish ,
#if ENABLE_OVERLOADING
WebResourceGetResponseMethodInfo ,
#endif
webResourceGetResponse ,
#if ENABLE_OVERLOADING
WebResourceGetUriMethodInfo ,
#endif
webResourceGetUri ,
#if ENABLE_OVERLOADING
WebResourceResponsePropertyInfo ,
#endif
getWebResourceResponse ,
#if ENABLE_OVERLOADING
webResourceResponse ,
#endif
#if ENABLE_OVERLOADING
WebResourceUriPropertyInfo ,
#endif
getWebResourceUri ,
#if ENABLE_OVERLOADING
webResourceUri ,
#endif
C_WebResourceFailedCallback ,
WebResourceFailedCallback ,
#if ENABLE_OVERLOADING
WebResourceFailedSignalInfo ,
#endif
afterWebResourceFailed ,
genClosure_WebResourceFailed ,
mk_WebResourceFailedCallback ,
noWebResourceFailedCallback ,
onWebResourceFailed ,
wrap_WebResourceFailedCallback ,
C_WebResourceFailedWithTlsErrorsCallback,
WebResourceFailedWithTlsErrorsCallback ,
#if ENABLE_OVERLOADING
WebResourceFailedWithTlsErrorsSignalInfo,
#endif
afterWebResourceFailedWithTlsErrors ,
genClosure_WebResourceFailedWithTlsErrors,
mk_WebResourceFailedWithTlsErrorsCallback,
noWebResourceFailedWithTlsErrorsCallback,
onWebResourceFailedWithTlsErrors ,
wrap_WebResourceFailedWithTlsErrorsCallback,
C_WebResourceFinishedCallback ,
WebResourceFinishedCallback ,
#if ENABLE_OVERLOADING
WebResourceFinishedSignalInfo ,
#endif
afterWebResourceFinished ,
genClosure_WebResourceFinished ,
mk_WebResourceFinishedCallback ,
noWebResourceFinishedCallback ,
onWebResourceFinished ,
wrap_WebResourceFinishedCallback ,
C_WebResourceReceivedDataCallback ,
WebResourceReceivedDataCallback ,
#if ENABLE_OVERLOADING
WebResourceReceivedDataSignalInfo ,
#endif
afterWebResourceReceivedData ,
genClosure_WebResourceReceivedData ,
mk_WebResourceReceivedDataCallback ,
noWebResourceReceivedDataCallback ,
onWebResourceReceivedData ,
wrap_WebResourceReceivedDataCallback ,
C_WebResourceSentRequestCallback ,
WebResourceSentRequestCallback ,
#if 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.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
newtype WebResource = WebResource (ManagedPtr WebResource)
foreign import ccall "webkit_web_resource_get_type"
c_webkit_web_resource_get_type :: IO GType
instance GObject WebResource where
gobjectType = c_webkit_web_resource_get_type
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]
toWebResource :: (MonadIO m, IsWebResource o) => o -> m WebResource
toWebResource = liftIO . unsafeCastTo WebResource
noWebResource :: Maybe WebResource
noWebResource = Nothing
#if 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 "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 (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
type WebResourceFailedCallback =
GError
-> IO ()
noWebResourceFailedCallback :: Maybe WebResourceFailedCallback
noWebResourceFailedCallback = Nothing
type C_WebResourceFailedCallback =
Ptr () ->
Ptr GError ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_WebResourceFailedCallback :: C_WebResourceFailedCallback -> IO (FunPtr C_WebResourceFailedCallback)
genClosure_WebResourceFailed :: MonadIO m => WebResourceFailedCallback -> m (GClosure C_WebResourceFailedCallback)
genClosure_WebResourceFailed cb = liftIO $ do
let cb' = wrap_WebResourceFailedCallback cb
mk_WebResourceFailedCallback cb' >>= B.GClosure.newGClosure
wrap_WebResourceFailedCallback ::
WebResourceFailedCallback ->
C_WebResourceFailedCallback
wrap_WebResourceFailedCallback _cb _ error_ _ = do
error_' <- (newBoxed GError) error_
_cb error_'
onWebResourceFailed :: (IsWebResource a, MonadIO m) => a -> WebResourceFailedCallback -> m SignalHandlerId
onWebResourceFailed obj cb = liftIO $ do
let cb' = wrap_WebResourceFailedCallback cb
cb'' <- mk_WebResourceFailedCallback cb'
connectSignalFunPtr obj "failed" cb'' SignalConnectBefore
afterWebResourceFailed :: (IsWebResource a, MonadIO m) => a -> WebResourceFailedCallback -> m SignalHandlerId
afterWebResourceFailed obj cb = liftIO $ do
let cb' = wrap_WebResourceFailedCallback cb
cb'' <- mk_WebResourceFailedCallback cb'
connectSignalFunPtr obj "failed" cb'' SignalConnectAfter
type WebResourceFailedWithTlsErrorsCallback =
Gio.TlsCertificate.TlsCertificate
-> [Gio.Flags.TlsCertificateFlags]
-> IO ()
noWebResourceFailedWithTlsErrorsCallback :: Maybe WebResourceFailedWithTlsErrorsCallback
noWebResourceFailedWithTlsErrorsCallback = Nothing
type C_WebResourceFailedWithTlsErrorsCallback =
Ptr () ->
Ptr Gio.TlsCertificate.TlsCertificate ->
CUInt ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_WebResourceFailedWithTlsErrorsCallback :: C_WebResourceFailedWithTlsErrorsCallback -> IO (FunPtr C_WebResourceFailedWithTlsErrorsCallback)
genClosure_WebResourceFailedWithTlsErrors :: MonadIO m => WebResourceFailedWithTlsErrorsCallback -> m (GClosure C_WebResourceFailedWithTlsErrorsCallback)
genClosure_WebResourceFailedWithTlsErrors cb = liftIO $ do
let cb' = wrap_WebResourceFailedWithTlsErrorsCallback cb
mk_WebResourceFailedWithTlsErrorsCallback cb' >>= B.GClosure.newGClosure
wrap_WebResourceFailedWithTlsErrorsCallback ::
WebResourceFailedWithTlsErrorsCallback ->
C_WebResourceFailedWithTlsErrorsCallback
wrap_WebResourceFailedWithTlsErrorsCallback _cb _ certificate errors _ = do
certificate' <- (newObject Gio.TlsCertificate.TlsCertificate) certificate
let errors' = wordToGFlags errors
_cb certificate' errors'
onWebResourceFailedWithTlsErrors :: (IsWebResource a, MonadIO m) => a -> WebResourceFailedWithTlsErrorsCallback -> m SignalHandlerId
onWebResourceFailedWithTlsErrors obj cb = liftIO $ do
let cb' = wrap_WebResourceFailedWithTlsErrorsCallback cb
cb'' <- mk_WebResourceFailedWithTlsErrorsCallback cb'
connectSignalFunPtr obj "failed-with-tls-errors" cb'' SignalConnectBefore
afterWebResourceFailedWithTlsErrors :: (IsWebResource a, MonadIO m) => a -> WebResourceFailedWithTlsErrorsCallback -> m SignalHandlerId
afterWebResourceFailedWithTlsErrors obj cb = liftIO $ do
let cb' = wrap_WebResourceFailedWithTlsErrorsCallback cb
cb'' <- mk_WebResourceFailedWithTlsErrorsCallback cb'
connectSignalFunPtr obj "failed-with-tls-errors" cb'' SignalConnectAfter
type WebResourceFinishedCallback =
IO ()
noWebResourceFinishedCallback :: Maybe WebResourceFinishedCallback
noWebResourceFinishedCallback = Nothing
type C_WebResourceFinishedCallback =
Ptr () ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_WebResourceFinishedCallback :: C_WebResourceFinishedCallback -> IO (FunPtr C_WebResourceFinishedCallback)
genClosure_WebResourceFinished :: MonadIO m => WebResourceFinishedCallback -> m (GClosure C_WebResourceFinishedCallback)
genClosure_WebResourceFinished cb = liftIO $ do
let cb' = wrap_WebResourceFinishedCallback cb
mk_WebResourceFinishedCallback cb' >>= B.GClosure.newGClosure
wrap_WebResourceFinishedCallback ::
WebResourceFinishedCallback ->
C_WebResourceFinishedCallback
wrap_WebResourceFinishedCallback _cb _ _ = do
_cb
onWebResourceFinished :: (IsWebResource a, MonadIO m) => a -> WebResourceFinishedCallback -> m SignalHandlerId
onWebResourceFinished obj cb = liftIO $ do
let cb' = wrap_WebResourceFinishedCallback cb
cb'' <- mk_WebResourceFinishedCallback cb'
connectSignalFunPtr obj "finished" cb'' SignalConnectBefore
afterWebResourceFinished :: (IsWebResource a, MonadIO m) => a -> WebResourceFinishedCallback -> m SignalHandlerId
afterWebResourceFinished obj cb = liftIO $ do
let cb' = wrap_WebResourceFinishedCallback cb
cb'' <- mk_WebResourceFinishedCallback cb'
connectSignalFunPtr obj "finished" cb'' SignalConnectAfter
type WebResourceReceivedDataCallback =
Word64
-> IO ()
noWebResourceReceivedDataCallback :: Maybe WebResourceReceivedDataCallback
noWebResourceReceivedDataCallback = Nothing
type C_WebResourceReceivedDataCallback =
Ptr () ->
Word64 ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_WebResourceReceivedDataCallback :: C_WebResourceReceivedDataCallback -> IO (FunPtr C_WebResourceReceivedDataCallback)
genClosure_WebResourceReceivedData :: MonadIO m => WebResourceReceivedDataCallback -> m (GClosure C_WebResourceReceivedDataCallback)
genClosure_WebResourceReceivedData cb = liftIO $ do
let cb' = wrap_WebResourceReceivedDataCallback cb
mk_WebResourceReceivedDataCallback cb' >>= B.GClosure.newGClosure
wrap_WebResourceReceivedDataCallback ::
WebResourceReceivedDataCallback ->
C_WebResourceReceivedDataCallback
wrap_WebResourceReceivedDataCallback _cb _ dataLength _ = do
_cb dataLength
onWebResourceReceivedData :: (IsWebResource a, MonadIO m) => a -> WebResourceReceivedDataCallback -> m SignalHandlerId
onWebResourceReceivedData obj cb = liftIO $ do
let cb' = wrap_WebResourceReceivedDataCallback cb
cb'' <- mk_WebResourceReceivedDataCallback cb'
connectSignalFunPtr obj "received-data" cb'' SignalConnectBefore
afterWebResourceReceivedData :: (IsWebResource a, MonadIO m) => a -> WebResourceReceivedDataCallback -> m SignalHandlerId
afterWebResourceReceivedData obj cb = liftIO $ do
let cb' = wrap_WebResourceReceivedDataCallback cb
cb'' <- mk_WebResourceReceivedDataCallback cb'
connectSignalFunPtr obj "received-data" cb'' SignalConnectAfter
type WebResourceSentRequestCallback =
WebKit2.URIRequest.URIRequest
-> WebKit2.URIResponse.URIResponse
-> IO ()
noWebResourceSentRequestCallback :: Maybe WebResourceSentRequestCallback
noWebResourceSentRequestCallback = Nothing
type C_WebResourceSentRequestCallback =
Ptr () ->
Ptr WebKit2.URIRequest.URIRequest ->
Ptr WebKit2.URIResponse.URIResponse ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_WebResourceSentRequestCallback :: C_WebResourceSentRequestCallback -> IO (FunPtr C_WebResourceSentRequestCallback)
genClosure_WebResourceSentRequest :: MonadIO m => WebResourceSentRequestCallback -> m (GClosure C_WebResourceSentRequestCallback)
genClosure_WebResourceSentRequest cb = liftIO $ do
let cb' = wrap_WebResourceSentRequestCallback cb
mk_WebResourceSentRequestCallback cb' >>= B.GClosure.newGClosure
wrap_WebResourceSentRequestCallback ::
WebResourceSentRequestCallback ->
C_WebResourceSentRequestCallback
wrap_WebResourceSentRequestCallback _cb _ request redirectedResponse _ = do
request' <- (newObject WebKit2.URIRequest.URIRequest) request
redirectedResponse' <- (newObject WebKit2.URIResponse.URIResponse) redirectedResponse
_cb request' redirectedResponse'
onWebResourceSentRequest :: (IsWebResource a, MonadIO m) => a -> WebResourceSentRequestCallback -> m SignalHandlerId
onWebResourceSentRequest obj cb = liftIO $ do
let cb' = wrap_WebResourceSentRequestCallback cb
cb'' <- mk_WebResourceSentRequestCallback cb'
connectSignalFunPtr obj "sent-request" cb'' SignalConnectBefore
afterWebResourceSentRequest :: (IsWebResource a, MonadIO m) => a -> WebResourceSentRequestCallback -> m SignalHandlerId
afterWebResourceSentRequest obj cb = liftIO $ do
let cb' = wrap_WebResourceSentRequestCallback cb
cb'' <- mk_WebResourceSentRequestCallback cb'
connectSignalFunPtr obj "sent-request" cb'' SignalConnectAfter
getWebResourceResponse :: (MonadIO m, IsWebResource o) => o -> m (Maybe WebKit2.URIResponse.URIResponse)
getWebResourceResponse obj = liftIO $ B.Properties.getObjectPropertyObject obj "response" WebKit2.URIResponse.URIResponse
#if ENABLE_OVERLOADING
data WebResourceResponsePropertyInfo
instance AttrInfo WebResourceResponsePropertyInfo where
type AttrAllowedOps WebResourceResponsePropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint WebResourceResponsePropertyInfo = (~) ()
type AttrBaseTypeConstraint WebResourceResponsePropertyInfo = IsWebResource
type AttrGetType WebResourceResponsePropertyInfo = (Maybe WebKit2.URIResponse.URIResponse)
type AttrLabel WebResourceResponsePropertyInfo = "response"
type AttrOrigin WebResourceResponsePropertyInfo = WebResource
attrGet _ = getWebResourceResponse
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getWebResourceUri :: (MonadIO m, IsWebResource o) => o -> m T.Text
getWebResourceUri obj = liftIO $ checkUnexpectedNothing "getWebResourceUri" $ B.Properties.getObjectPropertyString obj "uri"
#if ENABLE_OVERLOADING
data WebResourceUriPropertyInfo
instance AttrInfo WebResourceUriPropertyInfo where
type AttrAllowedOps WebResourceUriPropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint WebResourceUriPropertyInfo = (~) ()
type AttrBaseTypeConstraint WebResourceUriPropertyInfo = IsWebResource
type AttrGetType WebResourceUriPropertyInfo = T.Text
type AttrLabel WebResourceUriPropertyInfo = "uri"
type AttrOrigin WebResourceUriPropertyInfo = WebResource
attrGet _ = getWebResourceUri
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList WebResource
type instance O.AttributeList WebResource = WebResourceAttributeList
type WebResourceAttributeList = ('[ '("response", WebResourceResponsePropertyInfo), '("uri", WebResourceUriPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
webResourceResponse :: AttrLabelProxy "response"
webResourceResponse = AttrLabelProxy
webResourceUri :: AttrLabelProxy "uri"
webResourceUri = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
data WebResourceFailedSignalInfo
instance SignalInfo WebResourceFailedSignalInfo where
type HaskellCallbackType WebResourceFailedSignalInfo = WebResourceFailedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_WebResourceFailedCallback cb
cb'' <- mk_WebResourceFailedCallback cb'
connectSignalFunPtr obj "failed" cb'' connectMode
data WebResourceFailedWithTlsErrorsSignalInfo
instance SignalInfo WebResourceFailedWithTlsErrorsSignalInfo where
type HaskellCallbackType WebResourceFailedWithTlsErrorsSignalInfo = WebResourceFailedWithTlsErrorsCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_WebResourceFailedWithTlsErrorsCallback cb
cb'' <- mk_WebResourceFailedWithTlsErrorsCallback cb'
connectSignalFunPtr obj "failed-with-tls-errors" cb'' connectMode
data WebResourceFinishedSignalInfo
instance SignalInfo WebResourceFinishedSignalInfo where
type HaskellCallbackType WebResourceFinishedSignalInfo = WebResourceFinishedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_WebResourceFinishedCallback cb
cb'' <- mk_WebResourceFinishedCallback cb'
connectSignalFunPtr obj "finished" cb'' connectMode
data WebResourceReceivedDataSignalInfo
instance SignalInfo WebResourceReceivedDataSignalInfo where
type HaskellCallbackType WebResourceReceivedDataSignalInfo = WebResourceReceivedDataCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_WebResourceReceivedDataCallback cb
cb'' <- mk_WebResourceReceivedDataCallback cb'
connectSignalFunPtr obj "received-data" cb'' connectMode
data WebResourceSentRequestSignalInfo
instance SignalInfo WebResourceSentRequestSignalInfo where
type HaskellCallbackType WebResourceSentRequestSignalInfo = WebResourceSentRequestCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_WebResourceSentRequestCallback cb
cb'' <- mk_WebResourceSentRequestCallback cb'
connectSignalFunPtr obj "sent-request" cb'' connectMode
type instance O.SignalList WebResource = WebResourceSignalList
type WebResourceSignalList = ('[ '("failed", WebResourceFailedSignalInfo), '("failedWithTlsErrors", WebResourceFailedWithTlsErrorsSignalInfo), '("finished", WebResourceFinishedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("receivedData", WebResourceReceivedDataSignalInfo), '("sentRequest", WebResourceSentRequestSignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "webkit_web_resource_get_data" webkit_web_resource_get_data ::
Ptr WebResource ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
webResourceGetData ::
(B.CallStack.HasCallStack, MonadIO m, IsWebResource a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
webResourceGetData resource cancellable callback = liftIO $ do
resource' <- unsafeManagedPtrCastPtr resource
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = nullPtr
webkit_web_resource_get_data resource' maybeCancellable maybeCallback userData
touchManagedPtr resource
whenJust cancellable touchManagedPtr
return ()
#if 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
foreign import ccall "webkit_web_resource_get_data_finish" webkit_web_resource_get_data_finish ::
Ptr WebResource ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr Word64 ->
Ptr (Ptr GError) ->
IO (Ptr Word8)
webResourceGetDataFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsWebResource a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ByteString
webResourceGetDataFinish resource result_ = liftIO $ do
resource' <- unsafeManagedPtrCastPtr resource
result_' <- unsafeManagedPtrCastPtr result_
length_ <- allocMem :: IO (Ptr Word64)
onException (do
result <- propagateGError $ webkit_web_resource_get_data_finish resource' result_' length_
length_' <- peek length_
checkUnexpectedReturnNULL "webResourceGetDataFinish" result
result' <- (unpackByteStringWithLength length_') result
freeMem result
touchManagedPtr resource
touchManagedPtr result_
freeMem length_
return result'
) (do
freeMem length_
)
#if 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
foreign import ccall "webkit_web_resource_get_response" webkit_web_resource_get_response ::
Ptr WebResource ->
IO (Ptr WebKit2.URIResponse.URIResponse)
webResourceGetResponse ::
(B.CallStack.HasCallStack, MonadIO m, IsWebResource a) =>
a
-> m (Maybe WebKit2.URIResponse.URIResponse)
webResourceGetResponse resource = liftIO $ do
resource' <- unsafeManagedPtrCastPtr resource
result <- webkit_web_resource_get_response resource'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newObject WebKit2.URIResponse.URIResponse) result'
return result''
touchManagedPtr resource
return maybeResult
#if ENABLE_OVERLOADING
data WebResourceGetResponseMethodInfo
instance (signature ~ (m (Maybe WebKit2.URIResponse.URIResponse)), MonadIO m, IsWebResource a) => O.MethodInfo WebResourceGetResponseMethodInfo a signature where
overloadedMethod _ = webResourceGetResponse
#endif
foreign import ccall "webkit_web_resource_get_uri" webkit_web_resource_get_uri ::
Ptr WebResource ->
IO CString
webResourceGetUri ::
(B.CallStack.HasCallStack, MonadIO m, IsWebResource a) =>
a
-> m T.Text
webResourceGetUri resource = liftIO $ do
resource' <- unsafeManagedPtrCastPtr resource
result <- webkit_web_resource_get_uri resource'
checkUnexpectedReturnNULL "webResourceGetUri" result
result' <- cstringToText result
touchManagedPtr resource
return result'
#if ENABLE_OVERLOADING
data WebResourceGetUriMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsWebResource a) => O.MethodInfo WebResourceGetUriMethodInfo a signature where
overloadedMethod _ = webResourceGetUri
#endif