module GI.WebKit.Objects.NetworkResponse
(
NetworkResponse(..) ,
NetworkResponseK ,
toNetworkResponse ,
noNetworkResponse ,
networkResponseGetMessage ,
networkResponseGetSuggestedFilename ,
networkResponseGetUri ,
networkResponseNew ,
networkResponseSetUri ,
NetworkResponseMessagePropertyInfo ,
constructNetworkResponseMessage ,
getNetworkResponseMessage ,
NetworkResponseSuggestedFilenamePropertyInfo,
getNetworkResponseSuggestedFilename ,
NetworkResponseUriPropertyInfo ,
constructNetworkResponseUri ,
getNetworkResponseUri ,
setNetworkResponseUri ,
) 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.WebKit.Types
import GI.WebKit.Callbacks
import qualified GI.GObject as GObject
import qualified GI.Soup as Soup
newtype NetworkResponse = NetworkResponse (ForeignPtr NetworkResponse)
foreign import ccall "webkit_network_response_get_type"
c_webkit_network_response_get_type :: IO GType
type instance ParentTypes NetworkResponse = NetworkResponseParentTypes
type NetworkResponseParentTypes = '[GObject.Object]
instance GObject NetworkResponse where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_webkit_network_response_get_type
class GObject o => NetworkResponseK o
instance (GObject o, IsDescendantOf NetworkResponse o) => NetworkResponseK o
toNetworkResponse :: NetworkResponseK o => o -> IO NetworkResponse
toNetworkResponse = unsafeCastTo NetworkResponse
noNetworkResponse :: Maybe NetworkResponse
noNetworkResponse = Nothing
getNetworkResponseMessage :: (MonadIO m, NetworkResponseK o) => o -> m Soup.Message
getNetworkResponseMessage obj = liftIO $ getObjectPropertyObject obj "message" Soup.Message
constructNetworkResponseMessage :: (Soup.MessageK a) => a -> IO ([Char], GValue)
constructNetworkResponseMessage val = constructObjectPropertyObject "message" val
data NetworkResponseMessagePropertyInfo
instance AttrInfo NetworkResponseMessagePropertyInfo where
type AttrAllowedOps NetworkResponseMessagePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint NetworkResponseMessagePropertyInfo = Soup.MessageK
type AttrBaseTypeConstraint NetworkResponseMessagePropertyInfo = NetworkResponseK
type AttrGetType NetworkResponseMessagePropertyInfo = Soup.Message
type AttrLabel NetworkResponseMessagePropertyInfo = "NetworkResponse::message"
attrGet _ = getNetworkResponseMessage
attrSet _ = undefined
attrConstruct _ = constructNetworkResponseMessage
getNetworkResponseSuggestedFilename :: (MonadIO m, NetworkResponseK o) => o -> m T.Text
getNetworkResponseSuggestedFilename obj = liftIO $ getObjectPropertyString obj "suggested-filename"
data NetworkResponseSuggestedFilenamePropertyInfo
instance AttrInfo NetworkResponseSuggestedFilenamePropertyInfo where
type AttrAllowedOps NetworkResponseSuggestedFilenamePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint NetworkResponseSuggestedFilenamePropertyInfo = (~) ()
type AttrBaseTypeConstraint NetworkResponseSuggestedFilenamePropertyInfo = NetworkResponseK
type AttrGetType NetworkResponseSuggestedFilenamePropertyInfo = T.Text
type AttrLabel NetworkResponseSuggestedFilenamePropertyInfo = "NetworkResponse::suggested-filename"
attrGet _ = getNetworkResponseSuggestedFilename
attrSet _ = undefined
attrConstruct _ = undefined
getNetworkResponseUri :: (MonadIO m, NetworkResponseK o) => o -> m T.Text
getNetworkResponseUri obj = liftIO $ getObjectPropertyString obj "uri"
setNetworkResponseUri :: (MonadIO m, NetworkResponseK o) => o -> T.Text -> m ()
setNetworkResponseUri obj val = liftIO $ setObjectPropertyString obj "uri" val
constructNetworkResponseUri :: T.Text -> IO ([Char], GValue)
constructNetworkResponseUri val = constructObjectPropertyString "uri" val
data NetworkResponseUriPropertyInfo
instance AttrInfo NetworkResponseUriPropertyInfo where
type AttrAllowedOps NetworkResponseUriPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint NetworkResponseUriPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint NetworkResponseUriPropertyInfo = NetworkResponseK
type AttrGetType NetworkResponseUriPropertyInfo = T.Text
type AttrLabel NetworkResponseUriPropertyInfo = "NetworkResponse::uri"
attrGet _ = getNetworkResponseUri
attrSet _ = setNetworkResponseUri
attrConstruct _ = constructNetworkResponseUri
type instance AttributeList NetworkResponse = NetworkResponseAttributeList
type NetworkResponseAttributeList = ('[ '("message", NetworkResponseMessagePropertyInfo), '("suggested-filename", NetworkResponseSuggestedFilenamePropertyInfo), '("uri", NetworkResponseUriPropertyInfo)] :: [(Symbol, *)])
type instance SignalList NetworkResponse = NetworkResponseSignalList
type NetworkResponseSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "webkit_network_response_new" webkit_network_response_new ::
CString ->
IO (Ptr NetworkResponse)
networkResponseNew ::
(MonadIO m) =>
T.Text ->
m NetworkResponse
networkResponseNew uri = liftIO $ do
uri' <- textToCString uri
result <- webkit_network_response_new uri'
checkUnexpectedReturnNULL "webkit_network_response_new" result
result' <- (wrapObject NetworkResponse) result
freeMem uri'
return result'
foreign import ccall "webkit_network_response_get_message" webkit_network_response_get_message ::
Ptr NetworkResponse ->
IO (Ptr Soup.Message)
networkResponseGetMessage ::
(MonadIO m, NetworkResponseK a) =>
a ->
m Soup.Message
networkResponseGetMessage _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_network_response_get_message _obj'
checkUnexpectedReturnNULL "webkit_network_response_get_message" result
result' <- (newObject Soup.Message) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_network_response_get_suggested_filename" webkit_network_response_get_suggested_filename ::
Ptr NetworkResponse ->
IO CString
networkResponseGetSuggestedFilename ::
(MonadIO m, NetworkResponseK a) =>
a ->
m T.Text
networkResponseGetSuggestedFilename _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_network_response_get_suggested_filename _obj'
checkUnexpectedReturnNULL "webkit_network_response_get_suggested_filename" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_network_response_get_uri" webkit_network_response_get_uri ::
Ptr NetworkResponse ->
IO CString
networkResponseGetUri ::
(MonadIO m, NetworkResponseK a) =>
a ->
m T.Text
networkResponseGetUri _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_network_response_get_uri _obj'
checkUnexpectedReturnNULL "webkit_network_response_get_uri" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_network_response_set_uri" webkit_network_response_set_uri ::
Ptr NetworkResponse ->
CString ->
IO ()
networkResponseSetUri ::
(MonadIO m, NetworkResponseK a) =>
a ->
T.Text ->
m ()
networkResponseSetUri _obj uri = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
uri' <- textToCString uri
webkit_network_response_set_uri _obj' uri'
touchManagedPtr _obj
freeMem uri'
return ()