mirror of
https://github.com/logos-messaging/logos-messaging-python-bindings.git
synced 2026-04-10 06:13:17 +00:00
Adding wrapper for new APIs
This commit is contained in:
parent
e4ae16fe0f
commit
28ed908c0f
@ -56,6 +56,13 @@ int logosdelivery_unsubscribe(
|
|||||||
void *userData,
|
void *userData,
|
||||||
const char *contentTopic
|
const char *contentTopic
|
||||||
);
|
);
|
||||||
|
|
||||||
|
int logosdelivery_send(
|
||||||
|
void *ctx,
|
||||||
|
FFICallBack callback,
|
||||||
|
void *userData,
|
||||||
|
const char *messageJson
|
||||||
|
);
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -242,4 +249,21 @@ class NodeWrapper:
|
|||||||
if rc != 0:
|
if rc != 0:
|
||||||
return Err(f"unsubscribe_content_topic: immediate call failed (ret={rc})")
|
return Err(f"unsubscribe_content_topic: immediate call failed (ret={rc})")
|
||||||
|
|
||||||
return _wait_cb(state, f"unsubscribe({content_topic})", timeout_s)
|
return _wait_cb(state, f"unsubscribe({content_topic})", timeout_s)
|
||||||
|
|
||||||
|
def send_message(self, message: dict, *, timeout_s: float = 20.0) -> Result[int, str]:
|
||||||
|
state = _new_cb_state()
|
||||||
|
cb = self._make_waiting_cb(state)
|
||||||
|
|
||||||
|
message_json = json.dumps(message, separators=(",", ":"), ensure_ascii=False)
|
||||||
|
|
||||||
|
rc = lib.logosdelivery_send(
|
||||||
|
self.ctx,
|
||||||
|
cb,
|
||||||
|
ffi.NULL,
|
||||||
|
message_json.encode("utf-8"),
|
||||||
|
)
|
||||||
|
if rc != 0:
|
||||||
|
return Err(f"send_message: immediate call failed (ret={rc})")
|
||||||
|
|
||||||
|
return _wait_cb(state, "send_message", timeout_s)
|
||||||
Loading…
x
Reference in New Issue
Block a user