{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Soup.Objects.WebsocketExtension
(
WebsocketExtension(..) ,
IsWebsocketExtension ,
toWebsocketExtension ,
#if defined(ENABLE_OVERLOADING)
ResolveWebsocketExtensionMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
WebsocketExtensionConfigureMethodInfo ,
#endif
websocketExtensionConfigure ,
#if defined(ENABLE_OVERLOADING)
WebsocketExtensionGetRequestParamsMethodInfo,
#endif
websocketExtensionGetRequestParams ,
#if defined(ENABLE_OVERLOADING)
WebsocketExtensionGetResponseParamsMethodInfo,
#endif
websocketExtensionGetResponseParams ,
#if defined(ENABLE_OVERLOADING)
WebsocketExtensionProcessIncomingMessageMethodInfo,
#endif
websocketExtensionProcessIncomingMessage,
#if defined(ENABLE_OVERLOADING)
WebsocketExtensionProcessOutgoingMessageMethodInfo,
#endif
websocketExtensionProcessOutgoingMessage,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Soup.Enums as Soup.Enums
newtype WebsocketExtension = WebsocketExtension (SP.ManagedPtr WebsocketExtension)
deriving (WebsocketExtension -> WebsocketExtension -> Bool
(WebsocketExtension -> WebsocketExtension -> Bool)
-> (WebsocketExtension -> WebsocketExtension -> Bool)
-> Eq WebsocketExtension
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WebsocketExtension -> WebsocketExtension -> Bool
== :: WebsocketExtension -> WebsocketExtension -> Bool
$c/= :: WebsocketExtension -> WebsocketExtension -> Bool
/= :: WebsocketExtension -> WebsocketExtension -> Bool
Eq)
instance SP.ManagedPtrNewtype WebsocketExtension where
toManagedPtr :: WebsocketExtension -> ManagedPtr WebsocketExtension
toManagedPtr (WebsocketExtension ManagedPtr WebsocketExtension
p) = ManagedPtr WebsocketExtension
p
foreign import ccall "soup_websocket_extension_get_type"
c_soup_websocket_extension_get_type :: IO B.Types.GType
instance B.Types.TypedObject WebsocketExtension where
glibType :: IO GType
glibType = IO GType
c_soup_websocket_extension_get_type
instance B.Types.GObject WebsocketExtension
class (SP.GObject o, O.IsDescendantOf WebsocketExtension o) => IsWebsocketExtension o
instance (SP.GObject o, O.IsDescendantOf WebsocketExtension o) => IsWebsocketExtension o
instance O.HasParentTypes WebsocketExtension
type instance O.ParentTypes WebsocketExtension = '[GObject.Object.Object]
toWebsocketExtension :: (MIO.MonadIO m, IsWebsocketExtension o) => o -> m WebsocketExtension
toWebsocketExtension :: forall (m :: * -> *) o.
(MonadIO m, IsWebsocketExtension o) =>
o -> m WebsocketExtension
toWebsocketExtension = IO WebsocketExtension -> m WebsocketExtension
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO WebsocketExtension -> m WebsocketExtension)
-> (o -> IO WebsocketExtension) -> o -> m WebsocketExtension
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr WebsocketExtension -> WebsocketExtension)
-> o -> IO WebsocketExtension
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr WebsocketExtension -> WebsocketExtension
WebsocketExtension
instance B.GValue.IsGValue (Maybe WebsocketExtension) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_soup_websocket_extension_get_type
gvalueSet_ :: Ptr GValue -> Maybe WebsocketExtension -> IO ()
gvalueSet_ Ptr GValue
gv Maybe WebsocketExtension
P.Nothing = Ptr GValue -> Ptr WebsocketExtension -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr WebsocketExtension
forall a. Ptr a
FP.nullPtr :: FP.Ptr WebsocketExtension)
gvalueSet_ Ptr GValue
gv (P.Just WebsocketExtension
obj) = WebsocketExtension -> (Ptr WebsocketExtension -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr WebsocketExtension
obj (Ptr GValue -> Ptr WebsocketExtension -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe WebsocketExtension)
gvalueGet_ Ptr GValue
gv = do
Ptr WebsocketExtension
ptr <- Ptr GValue -> IO (Ptr WebsocketExtension)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr WebsocketExtension)
if Ptr WebsocketExtension
ptr Ptr WebsocketExtension -> Ptr WebsocketExtension -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr WebsocketExtension
forall a. Ptr a
FP.nullPtr
then WebsocketExtension -> Maybe WebsocketExtension
forall a. a -> Maybe a
P.Just (WebsocketExtension -> Maybe WebsocketExtension)
-> IO WebsocketExtension -> IO (Maybe WebsocketExtension)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr WebsocketExtension -> WebsocketExtension)
-> Ptr WebsocketExtension -> IO WebsocketExtension
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr WebsocketExtension -> WebsocketExtension
WebsocketExtension Ptr WebsocketExtension
ptr
else Maybe WebsocketExtension -> IO (Maybe WebsocketExtension)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe WebsocketExtension
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveWebsocketExtensionMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveWebsocketExtensionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveWebsocketExtensionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveWebsocketExtensionMethod "configure" o = WebsocketExtensionConfigureMethodInfo
ResolveWebsocketExtensionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveWebsocketExtensionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveWebsocketExtensionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveWebsocketExtensionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveWebsocketExtensionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveWebsocketExtensionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveWebsocketExtensionMethod "processIncomingMessage" o = WebsocketExtensionProcessIncomingMessageMethodInfo
ResolveWebsocketExtensionMethod "processOutgoingMessage" o = WebsocketExtensionProcessOutgoingMessageMethodInfo
ResolveWebsocketExtensionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveWebsocketExtensionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveWebsocketExtensionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveWebsocketExtensionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveWebsocketExtensionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveWebsocketExtensionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveWebsocketExtensionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveWebsocketExtensionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveWebsocketExtensionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveWebsocketExtensionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveWebsocketExtensionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveWebsocketExtensionMethod "getRequestParams" o = WebsocketExtensionGetRequestParamsMethodInfo
ResolveWebsocketExtensionMethod "getResponseParams" o = WebsocketExtensionGetResponseParamsMethodInfo
ResolveWebsocketExtensionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveWebsocketExtensionMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveWebsocketExtensionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveWebsocketExtensionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveWebsocketExtensionMethod t WebsocketExtension, O.OverloadedMethod info WebsocketExtension p) => OL.IsLabel t (WebsocketExtension -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveWebsocketExtensionMethod t WebsocketExtension, O.OverloadedMethod info WebsocketExtension p, R.HasField t WebsocketExtension p) => R.HasField t WebsocketExtension p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveWebsocketExtensionMethod t WebsocketExtension, O.OverloadedMethodInfo info WebsocketExtension) => OL.IsLabel t (O.MethodProxy info WebsocketExtension) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList WebsocketExtension
type instance O.AttributeList WebsocketExtension = WebsocketExtensionAttributeList
type WebsocketExtensionAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList WebsocketExtension = WebsocketExtensionSignalList
type WebsocketExtensionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "soup_websocket_extension_configure" soup_websocket_extension_configure ::
Ptr WebsocketExtension ->
CUInt ->
Ptr (GHashTable (Ptr ()) (Ptr ())) ->
Ptr (Ptr GError) ->
IO CInt
websocketExtensionConfigure ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketExtension a) =>
a
-> Soup.Enums.WebsocketConnectionType
-> Maybe (Map.Map (Ptr ()) (Ptr ()))
-> m ()
websocketExtensionConfigure :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsWebsocketExtension a) =>
a
-> WebsocketConnectionType -> Maybe (Map (Ptr ()) (Ptr ())) -> m ()
websocketExtensionConfigure a
extension WebsocketConnectionType
connectionType Maybe (Map (Ptr ()) (Ptr ()))
params = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr WebsocketExtension
extension' <- a -> IO (Ptr WebsocketExtension)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
extension
let connectionType' :: CUInt
connectionType' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt)
-> (WebsocketConnectionType -> Int)
-> WebsocketConnectionType
-> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WebsocketConnectionType -> Int
forall a. Enum a => a -> Int
fromEnum) WebsocketConnectionType
connectionType
Ptr (GHashTable (Ptr ()) (Ptr ()))
maybeParams <- case Maybe (Map (Ptr ()) (Ptr ()))
params of
Maybe (Map (Ptr ()) (Ptr ()))
Nothing -> Ptr (GHashTable (Ptr ()) (Ptr ()))
-> IO (Ptr (GHashTable (Ptr ()) (Ptr ())))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GHashTable (Ptr ()) (Ptr ()))
forall a. Ptr a
nullPtr
Just Map (Ptr ()) (Ptr ())
jParams -> do
let jParams' :: [(Ptr (), Ptr ())]
jParams' = Map (Ptr ()) (Ptr ()) -> [(Ptr (), Ptr ())]
forall k a. Map k a -> [(k, a)]
Map.toList Map (Ptr ()) (Ptr ())
jParams
let jParams'' :: [(PtrWrapped (Ptr ()), Ptr ())]
jParams'' = (Ptr () -> PtrWrapped (Ptr ()))
-> [(Ptr (), Ptr ())] -> [(PtrWrapped (Ptr ()), Ptr ())]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst Ptr () -> PtrWrapped (Ptr ())
forall a. Ptr a -> PtrWrapped (Ptr a)
B.GHT.ptrPackPtr [(Ptr (), Ptr ())]
jParams'
let jParams''' :: [(PtrWrapped (Ptr ()), PtrWrapped (Ptr ()))]
jParams''' = (Ptr () -> PtrWrapped (Ptr ()))
-> [(PtrWrapped (Ptr ()), Ptr ())]
-> [(PtrWrapped (Ptr ()), PtrWrapped (Ptr ()))]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond Ptr () -> PtrWrapped (Ptr ())
forall a. Ptr a -> PtrWrapped (Ptr a)
B.GHT.ptrPackPtr [(PtrWrapped (Ptr ()), Ptr ())]
jParams''
Ptr (GHashTable (Ptr ()) (Ptr ()))
jParams'''' <- GHashFunc (Ptr ())
-> GEqualFunc (Ptr ())
-> Maybe (GDestroyNotify (Ptr ()))
-> Maybe (GDestroyNotify (Ptr ()))
-> [(PtrWrapped (Ptr ()), PtrWrapped (Ptr ()))]
-> IO (Ptr (GHashTable (Ptr ()) (Ptr ())))
forall a b.
GHashFunc a
-> GEqualFunc a
-> Maybe (GDestroyNotify a)
-> Maybe (GDestroyNotify b)
-> [(PtrWrapped a, PtrWrapped b)]
-> IO (Ptr (GHashTable a b))
packGHashTable GHashFunc (Ptr ())
forall a. GHashFunc (Ptr a)
gDirectHash GEqualFunc (Ptr ())
forall a. GEqualFunc (Ptr a)
gDirectEqual Maybe (GDestroyNotify (Ptr ()))
forall a. Maybe a
Nothing Maybe (GDestroyNotify (Ptr ()))
forall a. Maybe a
Nothing [(PtrWrapped (Ptr ()), PtrWrapped (Ptr ()))]
jParams'''
Ptr (GHashTable (Ptr ()) (Ptr ()))
-> IO (Ptr (GHashTable (Ptr ()) (Ptr ())))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GHashTable (Ptr ()) (Ptr ()))
jParams''''
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr WebsocketExtension
-> CUInt
-> Ptr (GHashTable (Ptr ()) (Ptr ()))
-> Ptr (Ptr GError)
-> IO CInt
soup_websocket_extension_configure Ptr WebsocketExtension
extension' CUInt
connectionType' Ptr (GHashTable (Ptr ()) (Ptr ()))
maybeParams
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
extension
Ptr (GHashTable (Ptr ()) (Ptr ())) -> IO ()
forall a b. Ptr (GHashTable a b) -> IO ()
unrefGHashTable Ptr (GHashTable (Ptr ()) (Ptr ()))
maybeParams
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
Ptr (GHashTable (Ptr ()) (Ptr ())) -> IO ()
forall a b. Ptr (GHashTable a b) -> IO ()
unrefGHashTable Ptr (GHashTable (Ptr ()) (Ptr ()))
maybeParams
)
#if defined(ENABLE_OVERLOADING)
data WebsocketExtensionConfigureMethodInfo
instance (signature ~ (Soup.Enums.WebsocketConnectionType -> Maybe (Map.Map (Ptr ()) (Ptr ())) -> m ()), MonadIO m, IsWebsocketExtension a) => O.OverloadedMethod WebsocketExtensionConfigureMethodInfo a signature where
overloadedMethod = websocketExtensionConfigure
instance O.OverloadedMethodInfo WebsocketExtensionConfigureMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.WebsocketExtension.websocketExtensionConfigure",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-3.0.2/docs/GI-Soup-Objects-WebsocketExtension.html#v:websocketExtensionConfigure"
})
#endif
foreign import ccall "soup_websocket_extension_get_request_params" soup_websocket_extension_get_request_params ::
Ptr WebsocketExtension ->
IO CString
websocketExtensionGetRequestParams ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketExtension a) =>
a
-> m (Maybe T.Text)
websocketExtensionGetRequestParams :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsWebsocketExtension a) =>
a -> m (Maybe Text)
websocketExtensionGetRequestParams a
extension = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr WebsocketExtension
extension' <- a -> IO (Ptr WebsocketExtension)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
extension
CString
result <- Ptr WebsocketExtension -> IO CString
soup_websocket_extension_get_request_params Ptr WebsocketExtension
extension'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
extension
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data WebsocketExtensionGetRequestParamsMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsWebsocketExtension a) => O.OverloadedMethod WebsocketExtensionGetRequestParamsMethodInfo a signature where
overloadedMethod = websocketExtensionGetRequestParams
instance O.OverloadedMethodInfo WebsocketExtensionGetRequestParamsMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.WebsocketExtension.websocketExtensionGetRequestParams",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-3.0.2/docs/GI-Soup-Objects-WebsocketExtension.html#v:websocketExtensionGetRequestParams"
})
#endif
foreign import ccall "soup_websocket_extension_get_response_params" soup_websocket_extension_get_response_params ::
Ptr WebsocketExtension ->
IO CString
websocketExtensionGetResponseParams ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketExtension a) =>
a
-> m (Maybe T.Text)
websocketExtensionGetResponseParams :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsWebsocketExtension a) =>
a -> m (Maybe Text)
websocketExtensionGetResponseParams a
extension = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr WebsocketExtension
extension' <- a -> IO (Ptr WebsocketExtension)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
extension
CString
result <- Ptr WebsocketExtension -> IO CString
soup_websocket_extension_get_response_params Ptr WebsocketExtension
extension'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
extension
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data WebsocketExtensionGetResponseParamsMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsWebsocketExtension a) => O.OverloadedMethod WebsocketExtensionGetResponseParamsMethodInfo a signature where
overloadedMethod = websocketExtensionGetResponseParams
instance O.OverloadedMethodInfo WebsocketExtensionGetResponseParamsMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.WebsocketExtension.websocketExtensionGetResponseParams",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-3.0.2/docs/GI-Soup-Objects-WebsocketExtension.html#v:websocketExtensionGetResponseParams"
})
#endif
foreign import ccall "soup_websocket_extension_process_incoming_message" soup_websocket_extension_process_incoming_message ::
Ptr WebsocketExtension ->
Ptr Word8 ->
Ptr GLib.Bytes.Bytes ->
Ptr (Ptr GError) ->
IO (Ptr GLib.Bytes.Bytes)
websocketExtensionProcessIncomingMessage ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketExtension a) =>
a
-> Word8
-> GLib.Bytes.Bytes
-> m ((GLib.Bytes.Bytes, Word8))
websocketExtensionProcessIncomingMessage :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsWebsocketExtension a) =>
a -> Word8 -> Bytes -> m (Bytes, Word8)
websocketExtensionProcessIncomingMessage a
extension Word8
header Bytes
payload = IO (Bytes, Word8) -> m (Bytes, Word8)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bytes, Word8) -> m (Bytes, Word8))
-> IO (Bytes, Word8) -> m (Bytes, Word8)
forall a b. (a -> b) -> a -> b
$ do
Ptr WebsocketExtension
extension' <- a -> IO (Ptr WebsocketExtension)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
extension
Ptr Word8
header' <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Word8
header' Word8
header
Ptr Bytes
payload' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed Bytes
payload
IO (Bytes, Word8) -> IO () -> IO (Bytes, Word8)
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Bytes
result <- (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes))
-> (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
forall a b. (a -> b) -> a -> b
$ Ptr WebsocketExtension
-> Ptr Word8 -> Ptr Bytes -> Ptr (Ptr GError) -> IO (Ptr Bytes)
soup_websocket_extension_process_incoming_message Ptr WebsocketExtension
extension' Ptr Word8
header' Ptr Bytes
payload'
Text -> Ptr Bytes -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"websocketExtensionProcessIncomingMessage" Ptr Bytes
result
Bytes
result' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
result
Word8
header'' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
header'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
extension
Bytes -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Bytes
payload
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
header'
(Bytes, Word8) -> IO (Bytes, Word8)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Bytes
result', Word8
header'')
) (do
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
header'
)
#if defined(ENABLE_OVERLOADING)
data WebsocketExtensionProcessIncomingMessageMethodInfo
instance (signature ~ (Word8 -> GLib.Bytes.Bytes -> m ((GLib.Bytes.Bytes, Word8))), MonadIO m, IsWebsocketExtension a) => O.OverloadedMethod WebsocketExtensionProcessIncomingMessageMethodInfo a signature where
overloadedMethod = websocketExtensionProcessIncomingMessage
instance O.OverloadedMethodInfo WebsocketExtensionProcessIncomingMessageMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.WebsocketExtension.websocketExtensionProcessIncomingMessage",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-3.0.2/docs/GI-Soup-Objects-WebsocketExtension.html#v:websocketExtensionProcessIncomingMessage"
})
#endif
foreign import ccall "soup_websocket_extension_process_outgoing_message" soup_websocket_extension_process_outgoing_message ::
Ptr WebsocketExtension ->
Ptr Word8 ->
Ptr GLib.Bytes.Bytes ->
Ptr (Ptr GError) ->
IO (Ptr GLib.Bytes.Bytes)
websocketExtensionProcessOutgoingMessage ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketExtension a) =>
a
-> Word8
-> GLib.Bytes.Bytes
-> m ((GLib.Bytes.Bytes, Word8))
websocketExtensionProcessOutgoingMessage :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsWebsocketExtension a) =>
a -> Word8 -> Bytes -> m (Bytes, Word8)
websocketExtensionProcessOutgoingMessage a
extension Word8
header Bytes
payload = IO (Bytes, Word8) -> m (Bytes, Word8)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bytes, Word8) -> m (Bytes, Word8))
-> IO (Bytes, Word8) -> m (Bytes, Word8)
forall a b. (a -> b) -> a -> b
$ do
Ptr WebsocketExtension
extension' <- a -> IO (Ptr WebsocketExtension)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
extension
Ptr Word8
header' <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Word8
header' Word8
header
Ptr Bytes
payload' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed Bytes
payload
IO (Bytes, Word8) -> IO () -> IO (Bytes, Word8)
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Bytes
result <- (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes))
-> (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
forall a b. (a -> b) -> a -> b
$ Ptr WebsocketExtension
-> Ptr Word8 -> Ptr Bytes -> Ptr (Ptr GError) -> IO (Ptr Bytes)
soup_websocket_extension_process_outgoing_message Ptr WebsocketExtension
extension' Ptr Word8
header' Ptr Bytes
payload'
Text -> Ptr Bytes -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"websocketExtensionProcessOutgoingMessage" Ptr Bytes
result
Bytes
result' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
result
Word8
header'' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
header'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
extension
Bytes -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Bytes
payload
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
header'
(Bytes, Word8) -> IO (Bytes, Word8)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Bytes
result', Word8
header'')
) (do
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
header'
)
#if defined(ENABLE_OVERLOADING)
data WebsocketExtensionProcessOutgoingMessageMethodInfo
instance (signature ~ (Word8 -> GLib.Bytes.Bytes -> m ((GLib.Bytes.Bytes, Word8))), MonadIO m, IsWebsocketExtension a) => O.OverloadedMethod WebsocketExtensionProcessOutgoingMessageMethodInfo a signature where
overloadedMethod = websocketExtensionProcessOutgoingMessage
instance O.OverloadedMethodInfo WebsocketExtensionProcessOutgoingMessageMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.WebsocketExtension.websocketExtensionProcessOutgoingMessage",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-3.0.2/docs/GI-Soup-Objects-WebsocketExtension.html#v:websocketExtensionProcessOutgoingMessage"
})
#endif