gi-webkit2webextension-0.2.10.13: GI/WebKit2WebExtension/Objects/URIRequest.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}
module GI.WebKit2WebExtension.Objects.URIRequest
(
-- * Exported types
URIRequest(..) ,
URIRequestK ,
toURIRequest ,
noURIRequest ,
-- * Methods
-- ** uRIRequestGetHttpHeaders
URIRequestGetHttpHeadersMethodInfo ,
uRIRequestGetHttpHeaders ,
-- ** uRIRequestGetUri
URIRequestGetUriMethodInfo ,
uRIRequestGetUri ,
-- ** uRIRequestNew
uRIRequestNew ,
-- ** uRIRequestSetUri
URIRequestSetUriMethodInfo ,
uRIRequestSetUri ,
-- * Properties
-- ** Uri
URIRequestUriPropertyInfo ,
constructURIRequestUri ,
getURIRequestUri ,
setURIRequestUri ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.WebKit2WebExtension.Types
import GI.WebKit2WebExtension.Callbacks
import qualified GI.GObject as GObject
import qualified GI.Soup as Soup
newtype URIRequest = URIRequest (ForeignPtr URIRequest)
foreign import ccall "webkit_uri_request_get_type"
c_webkit_uri_request_get_type :: IO GType
type instance ParentTypes URIRequest = URIRequestParentTypes
type URIRequestParentTypes = '[GObject.Object]
instance GObject URIRequest where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_webkit_uri_request_get_type
class GObject o => URIRequestK o
instance (GObject o, IsDescendantOf URIRequest o) => URIRequestK o
toURIRequest :: URIRequestK o => o -> IO URIRequest
toURIRequest = unsafeCastTo URIRequest
noURIRequest :: Maybe URIRequest
noURIRequest = Nothing
type family ResolveURIRequestMethod (t :: Symbol) (o :: *) :: * where
ResolveURIRequestMethod "bindProperty" o = GObject.ObjectBindPropertyMethodInfo
ResolveURIRequestMethod "bindPropertyFull" o = GObject.ObjectBindPropertyFullMethodInfo
ResolveURIRequestMethod "forceFloating" o = GObject.ObjectForceFloatingMethodInfo
ResolveURIRequestMethod "freezeNotify" o = GObject.ObjectFreezeNotifyMethodInfo
ResolveURIRequestMethod "isFloating" o = GObject.ObjectIsFloatingMethodInfo
ResolveURIRequestMethod "notify" o = GObject.ObjectNotifyMethodInfo
ResolveURIRequestMethod "notifyByPspec" o = GObject.ObjectNotifyByPspecMethodInfo
ResolveURIRequestMethod "ref" o = GObject.ObjectRefMethodInfo
ResolveURIRequestMethod "refSink" o = GObject.ObjectRefSinkMethodInfo
ResolveURIRequestMethod "replaceData" o = GObject.ObjectReplaceDataMethodInfo
ResolveURIRequestMethod "replaceQdata" o = GObject.ObjectReplaceQdataMethodInfo
ResolveURIRequestMethod "runDispose" o = GObject.ObjectRunDisposeMethodInfo
ResolveURIRequestMethod "stealData" o = GObject.ObjectStealDataMethodInfo
ResolveURIRequestMethod "stealQdata" o = GObject.ObjectStealQdataMethodInfo
ResolveURIRequestMethod "thawNotify" o = GObject.ObjectThawNotifyMethodInfo
ResolveURIRequestMethod "unref" o = GObject.ObjectUnrefMethodInfo
ResolveURIRequestMethod "watchClosure" o = GObject.ObjectWatchClosureMethodInfo
ResolveURIRequestMethod "getData" o = GObject.ObjectGetDataMethodInfo
ResolveURIRequestMethod "getHttpHeaders" o = URIRequestGetHttpHeadersMethodInfo
ResolveURIRequestMethod "getProperty" o = GObject.ObjectGetPropertyMethodInfo
ResolveURIRequestMethod "getQdata" o = GObject.ObjectGetQdataMethodInfo
ResolveURIRequestMethod "getUri" o = URIRequestGetUriMethodInfo
ResolveURIRequestMethod "setData" o = GObject.ObjectSetDataMethodInfo
ResolveURIRequestMethod "setProperty" o = GObject.ObjectSetPropertyMethodInfo
ResolveURIRequestMethod "setUri" o = URIRequestSetUriMethodInfo
ResolveURIRequestMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveURIRequestMethod t URIRequest, MethodInfo info URIRequest p) => IsLabelProxy t (URIRequest -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveURIRequestMethod t URIRequest, MethodInfo info URIRequest p) => IsLabel t (URIRequest -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif
-- VVV Prop "uri"
-- Type: TBasicType TUTF8
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
getURIRequestUri :: (MonadIO m, URIRequestK o) => o -> m T.Text
getURIRequestUri obj = liftIO $ getObjectPropertyString obj "uri"
setURIRequestUri :: (MonadIO m, URIRequestK o) => o -> T.Text -> m ()
setURIRequestUri obj val = liftIO $ setObjectPropertyString obj "uri" val
constructURIRequestUri :: T.Text -> IO ([Char], GValue)
constructURIRequestUri val = constructObjectPropertyString "uri" val
data URIRequestUriPropertyInfo
instance AttrInfo URIRequestUriPropertyInfo where
type AttrAllowedOps URIRequestUriPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint URIRequestUriPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint URIRequestUriPropertyInfo = URIRequestK
type AttrGetType URIRequestUriPropertyInfo = T.Text
type AttrLabel URIRequestUriPropertyInfo = "uri"
attrGet _ = getURIRequestUri
attrSet _ = setURIRequestUri
attrConstruct _ = constructURIRequestUri
type instance AttributeList URIRequest = URIRequestAttributeList
type URIRequestAttributeList = ('[ '("uri", URIRequestUriPropertyInfo)] :: [(Symbol, *)])
type instance SignalList URIRequest = URIRequestSignalList
type URIRequestSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method URIRequest::new
-- method type : Constructor
-- Args : [Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TInterface "WebKit2WebExtension" "URIRequest"
-- throws : False
-- Skip return : False
foreign import ccall "webkit_uri_request_new" webkit_uri_request_new ::
CString -> -- uri : TBasicType TUTF8
IO (Ptr URIRequest)
uRIRequestNew ::
(MonadIO m) =>
T.Text -- uri
-> m URIRequest -- result
uRIRequestNew uri = liftIO $ do
uri' <- textToCString uri
result <- webkit_uri_request_new uri'
checkUnexpectedReturnNULL "webkit_uri_request_new" result
result' <- (wrapObject URIRequest) result
freeMem uri'
return result'
-- method URIRequest::get_http_headers
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "WebKit2WebExtension" "URIRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TInterface "Soup" "MessageHeaders"
-- throws : False
-- Skip return : False
foreign import ccall "webkit_uri_request_get_http_headers" webkit_uri_request_get_http_headers ::
Ptr URIRequest -> -- _obj : TInterface "WebKit2WebExtension" "URIRequest"
IO (Ptr Soup.MessageHeaders)
uRIRequestGetHttpHeaders ::
(MonadIO m, URIRequestK a) =>
a -- _obj
-> m Soup.MessageHeaders -- result
uRIRequestGetHttpHeaders _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_uri_request_get_http_headers _obj'
checkUnexpectedReturnNULL "webkit_uri_request_get_http_headers" result
result' <- (wrapBoxed Soup.MessageHeaders) result
touchManagedPtr _obj
return result'
data URIRequestGetHttpHeadersMethodInfo
instance (signature ~ (m Soup.MessageHeaders), MonadIO m, URIRequestK a) => MethodInfo URIRequestGetHttpHeadersMethodInfo a signature where
overloadedMethod _ = uRIRequestGetHttpHeaders
-- method URIRequest::get_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "WebKit2WebExtension" "URIRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "webkit_uri_request_get_uri" webkit_uri_request_get_uri ::
Ptr URIRequest -> -- _obj : TInterface "WebKit2WebExtension" "URIRequest"
IO CString
uRIRequestGetUri ::
(MonadIO m, URIRequestK a) =>
a -- _obj
-> m T.Text -- result
uRIRequestGetUri _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_uri_request_get_uri _obj'
checkUnexpectedReturnNULL "webkit_uri_request_get_uri" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
data URIRequestGetUriMethodInfo
instance (signature ~ (m T.Text), MonadIO m, URIRequestK a) => MethodInfo URIRequestGetUriMethodInfo a signature where
overloadedMethod _ = uRIRequestGetUri
-- method URIRequest::set_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "WebKit2WebExtension" "URIRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "webkit_uri_request_set_uri" webkit_uri_request_set_uri ::
Ptr URIRequest -> -- _obj : TInterface "WebKit2WebExtension" "URIRequest"
CString -> -- uri : TBasicType TUTF8
IO ()
uRIRequestSetUri ::
(MonadIO m, URIRequestK a) =>
a -- _obj
-> T.Text -- uri
-> m () -- result
uRIRequestSetUri _obj uri = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
uri' <- textToCString uri
webkit_uri_request_set_uri _obj' uri'
touchManagedPtr _obj
freeMem uri'
return ()
data URIRequestSetUriMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, URIRequestK a) => MethodInfo URIRequestSetUriMethodInfo a signature where
overloadedMethod _ = uRIRequestSetUri