mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-06-26 11:29:28 +00:00
Rewrite the FFI root over the new per-layer APIs using nim-ffi v0.2.0 typed
{.ffiCtor.}/{.ffiDtor.}/{.ffi.}/{.ffiEvent.} + CBOR, replacing the
hand-written cstring/JSON bridge. Events are fed by internal nim-broker
listeners (no AppCallbacks). Adds the messaging_api/channels_api groups and
the broker-listener event modules, and drops the v0.1 scaffolding
(declare_lib, node_api, node_lifecycle_api, logos_delivery_api/*, json_*).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
10 lines
397 B
Nim
10 lines
397 B
Nim
proc messaging_send*(
|
|
self: LogosDelivery, contentTopic: string, payload: seq[byte], ephemeral: bool
|
|
): Future[Result[string, string]] {.ffi.} =
|
|
let envelope = MessageEnvelope.init(
|
|
contentTopic = ContentTopic(contentTopic), payload = payload, ephemeral = ephemeral
|
|
)
|
|
let requestId = (await self.messagingClient.send(envelope)).valueOr:
|
|
return err(error)
|
|
return ok($requestId)
|