module GI.WebKit.Objects.NetworkResponse
(
NetworkResponse(..) ,
IsNetworkResponse ,
toNetworkResponse ,
noNetworkResponse ,
NetworkResponseGetMessageMethodInfo ,
networkResponseGetMessage ,
NetworkResponseGetSuggestedFilenameMethodInfo,
networkResponseGetSuggestedFilename ,
NetworkResponseGetUriMethodInfo ,
networkResponseGetUri ,
networkResponseNew ,
NetworkResponseSetUriMethodInfo ,
networkResponseSetUri ,
NetworkResponseMessagePropertyInfo ,
constructNetworkResponseMessage ,
getNetworkResponseMessage ,
networkResponseMessage ,
NetworkResponseSuggestedFilenamePropertyInfo,
getNetworkResponseSuggestedFilename ,
networkResponseSuggestedFilename ,
NetworkResponseUriPropertyInfo ,
constructNetworkResponseUri ,
getNetworkResponseUri ,
networkResponseUri ,
setNetworkResponseUri ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Soup.Objects.Message as Soup.Message
newtype NetworkResponse = NetworkResponse (ManagedPtr NetworkResponse)
foreign import ccall "webkit_network_response_get_type"
c_webkit_network_response_get_type :: IO GType
instance GObject NetworkResponse where
gobjectType _ = c_webkit_network_response_get_type
class GObject o => IsNetworkResponse o
#if MIN_VERSION_base(4,9,0)
instance (GObject a, O.UnknownAncestorError NetworkResponse a) =>
IsNetworkResponse a
#endif
instance IsNetworkResponse NetworkResponse
instance GObject.Object.IsObject NetworkResponse
toNetworkResponse :: IsNetworkResponse o => o -> IO NetworkResponse
toNetworkResponse = unsafeCastTo NetworkResponse
noNetworkResponse :: Maybe NetworkResponse
noNetworkResponse = Nothing
type family ResolveNetworkResponseMethod (t :: Symbol) (o :: *) :: * where
ResolveNetworkResponseMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveNetworkResponseMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveNetworkResponseMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveNetworkResponseMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveNetworkResponseMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveNetworkResponseMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveNetworkResponseMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveNetworkResponseMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveNetworkResponseMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveNetworkResponseMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
ResolveNetworkResponseMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
ResolveNetworkResponseMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveNetworkResponseMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveNetworkResponseMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveNetworkResponseMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveNetworkResponseMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveNetworkResponseMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveNetworkResponseMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveNetworkResponseMethod "getMessage" o = NetworkResponseGetMessageMethodInfo
ResolveNetworkResponseMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveNetworkResponseMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveNetworkResponseMethod "getSuggestedFilename" o = NetworkResponseGetSuggestedFilenameMethodInfo
ResolveNetworkResponseMethod "getUri" o = NetworkResponseGetUriMethodInfo
ResolveNetworkResponseMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveNetworkResponseMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveNetworkResponseMethod "setUri" o = NetworkResponseSetUriMethodInfo
ResolveNetworkResponseMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveNetworkResponseMethod t NetworkResponse, O.MethodInfo info NetworkResponse p) => O.IsLabelProxy t (NetworkResponse -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveNetworkResponseMethod t NetworkResponse, O.MethodInfo info NetworkResponse p) => O.IsLabel t (NetworkResponse -> p) where
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
getNetworkResponseMessage :: (MonadIO m, IsNetworkResponse o) => o -> m Soup.Message.Message
getNetworkResponseMessage obj = liftIO $ checkUnexpectedNothing "getNetworkResponseMessage" $ getObjectPropertyObject obj "message" Soup.Message.Message
constructNetworkResponseMessage :: (IsNetworkResponse o, Soup.Message.IsMessage a) => a -> IO (GValueConstruct o)
constructNetworkResponseMessage val = constructObjectPropertyObject "message" (Just val)
data NetworkResponseMessagePropertyInfo
instance AttrInfo NetworkResponseMessagePropertyInfo where
type AttrAllowedOps NetworkResponseMessagePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint NetworkResponseMessagePropertyInfo = Soup.Message.IsMessage
type AttrBaseTypeConstraint NetworkResponseMessagePropertyInfo = IsNetworkResponse
type AttrGetType NetworkResponseMessagePropertyInfo = Soup.Message.Message
type AttrLabel NetworkResponseMessagePropertyInfo = "message"
type AttrOrigin NetworkResponseMessagePropertyInfo = NetworkResponse
attrGet _ = getNetworkResponseMessage
attrSet _ = undefined
attrConstruct _ = constructNetworkResponseMessage
attrClear _ = undefined
getNetworkResponseSuggestedFilename :: (MonadIO m, IsNetworkResponse o) => o -> m T.Text
getNetworkResponseSuggestedFilename obj = liftIO $ checkUnexpectedNothing "getNetworkResponseSuggestedFilename" $ getObjectPropertyString obj "suggested-filename"
data NetworkResponseSuggestedFilenamePropertyInfo
instance AttrInfo NetworkResponseSuggestedFilenamePropertyInfo where
type AttrAllowedOps NetworkResponseSuggestedFilenamePropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint NetworkResponseSuggestedFilenamePropertyInfo = (~) ()
type AttrBaseTypeConstraint NetworkResponseSuggestedFilenamePropertyInfo = IsNetworkResponse
type AttrGetType NetworkResponseSuggestedFilenamePropertyInfo = T.Text
type AttrLabel NetworkResponseSuggestedFilenamePropertyInfo = "suggested-filename"
type AttrOrigin NetworkResponseSuggestedFilenamePropertyInfo = NetworkResponse
attrGet _ = getNetworkResponseSuggestedFilename
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
getNetworkResponseUri :: (MonadIO m, IsNetworkResponse o) => o -> m T.Text
getNetworkResponseUri obj = liftIO $ checkUnexpectedNothing "getNetworkResponseUri" $ getObjectPropertyString obj "uri"
setNetworkResponseUri :: (MonadIO m, IsNetworkResponse o) => o -> T.Text -> m ()
setNetworkResponseUri obj val = liftIO $ setObjectPropertyString obj "uri" (Just val)
constructNetworkResponseUri :: (IsNetworkResponse o) => T.Text -> IO (GValueConstruct o)
constructNetworkResponseUri val = constructObjectPropertyString "uri" (Just val)
data NetworkResponseUriPropertyInfo
instance AttrInfo NetworkResponseUriPropertyInfo where
type AttrAllowedOps NetworkResponseUriPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint NetworkResponseUriPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint NetworkResponseUriPropertyInfo = IsNetworkResponse
type AttrGetType NetworkResponseUriPropertyInfo = T.Text
type AttrLabel NetworkResponseUriPropertyInfo = "uri"
type AttrOrigin NetworkResponseUriPropertyInfo = NetworkResponse
attrGet _ = getNetworkResponseUri
attrSet _ = setNetworkResponseUri
attrConstruct _ = constructNetworkResponseUri
attrClear _ = undefined
instance O.HasAttributeList NetworkResponse
type instance O.AttributeList NetworkResponse = NetworkResponseAttributeList
type NetworkResponseAttributeList = ('[ '("message", NetworkResponseMessagePropertyInfo), '("suggestedFilename", NetworkResponseSuggestedFilenamePropertyInfo), '("uri", NetworkResponseUriPropertyInfo)] :: [(Symbol, *)])
networkResponseMessage :: AttrLabelProxy "message"
networkResponseMessage = AttrLabelProxy
networkResponseSuggestedFilename :: AttrLabelProxy "suggestedFilename"
networkResponseSuggestedFilename = AttrLabelProxy
networkResponseUri :: AttrLabelProxy "uri"
networkResponseUri = AttrLabelProxy
type instance O.SignalList NetworkResponse = NetworkResponseSignalList
type NetworkResponseSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "webkit_network_response_new" webkit_network_response_new ::
CString ->
IO (Ptr NetworkResponse)
networkResponseNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m NetworkResponse
networkResponseNew uri = liftIO $ do
uri' <- textToCString uri
result <- webkit_network_response_new uri'
checkUnexpectedReturnNULL "networkResponseNew" 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.Message)
networkResponseGetMessage ::
(B.CallStack.HasCallStack, MonadIO m, IsNetworkResponse a) =>
a
-> m Soup.Message.Message
networkResponseGetMessage response = liftIO $ do
response' <- unsafeManagedPtrCastPtr response
result <- webkit_network_response_get_message response'
checkUnexpectedReturnNULL "networkResponseGetMessage" result
result' <- (newObject Soup.Message.Message) result
touchManagedPtr response
return result'
data NetworkResponseGetMessageMethodInfo
instance (signature ~ (m Soup.Message.Message), MonadIO m, IsNetworkResponse a) => O.MethodInfo NetworkResponseGetMessageMethodInfo a signature where
overloadedMethod _ = networkResponseGetMessage
foreign import ccall "webkit_network_response_get_suggested_filename" webkit_network_response_get_suggested_filename ::
Ptr NetworkResponse ->
IO CString
networkResponseGetSuggestedFilename ::
(B.CallStack.HasCallStack, MonadIO m, IsNetworkResponse a) =>
a
-> m T.Text
networkResponseGetSuggestedFilename response = liftIO $ do
response' <- unsafeManagedPtrCastPtr response
result <- webkit_network_response_get_suggested_filename response'
checkUnexpectedReturnNULL "networkResponseGetSuggestedFilename" result
result' <- cstringToText result
touchManagedPtr response
return result'
data NetworkResponseGetSuggestedFilenameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsNetworkResponse a) => O.MethodInfo NetworkResponseGetSuggestedFilenameMethodInfo a signature where
overloadedMethod _ = networkResponseGetSuggestedFilename
foreign import ccall "webkit_network_response_get_uri" webkit_network_response_get_uri ::
Ptr NetworkResponse ->
IO CString
networkResponseGetUri ::
(B.CallStack.HasCallStack, MonadIO m, IsNetworkResponse a) =>
a
-> m T.Text
networkResponseGetUri response = liftIO $ do
response' <- unsafeManagedPtrCastPtr response
result <- webkit_network_response_get_uri response'
checkUnexpectedReturnNULL "networkResponseGetUri" result
result' <- cstringToText result
touchManagedPtr response
return result'
data NetworkResponseGetUriMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsNetworkResponse a) => O.MethodInfo NetworkResponseGetUriMethodInfo a signature where
overloadedMethod _ = networkResponseGetUri
foreign import ccall "webkit_network_response_set_uri" webkit_network_response_set_uri ::
Ptr NetworkResponse ->
CString ->
IO ()
networkResponseSetUri ::
(B.CallStack.HasCallStack, MonadIO m, IsNetworkResponse a) =>
a
-> T.Text
-> m ()
networkResponseSetUri response uri = liftIO $ do
response' <- unsafeManagedPtrCastPtr response
uri' <- textToCString uri
webkit_network_response_set_uri response' uri'
touchManagedPtr response
freeMem uri'
return ()
data NetworkResponseSetUriMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsNetworkResponse a) => O.MethodInfo NetworkResponseSetUriMethodInfo a signature where
overloadedMethod _ = networkResponseSetUri