mirror of
https://github.com/logos-messaging/nim-chat-poc.git
synced 2026-01-02 14:13:10 +00:00
expose decode in content_types for apps
This commit is contained in:
parent
171bdbf0a6
commit
15a40f8eff
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -26,3 +26,6 @@
|
||||
url = https://github.com/narimiran/blake2.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/illwill"]
|
||||
path = vendor/illwill
|
||||
url = https://github.com/johnnovak/illwill.git
|
||||
|
||||
@ -6,6 +6,7 @@ import ../src/chat_sdk/client
|
||||
import ../src/chat_sdk/conversations
|
||||
import ../src/chat_sdk/delivery/waku_client
|
||||
import ../src/chat_sdk/utils
|
||||
import ../src/chat_sdk/identity
|
||||
|
||||
import ../src/content_types/all
|
||||
|
||||
|
||||
@ -38,14 +38,14 @@ proc encode*(frame: object): seq[byte] =
|
||||
result = Protobuf.encode(frame)
|
||||
|
||||
|
||||
# proc decode*[T: object] (bytes: seq[byte], proto: typedesc[
|
||||
# T]): Result[T, string] =
|
||||
# ## Encodes the frame into a byte sequence using Protobuf serialization.
|
||||
proc decode*[T: object] (bytes: seq[byte], proto: typedesc[
|
||||
T]): Result[T, string] =
|
||||
## Encodes the frame into a byte sequence using Protobuf serialization.
|
||||
|
||||
# try:
|
||||
# result = ok(Protobuf.decode(bytes, proto))
|
||||
# except ProtobufError as e:
|
||||
# result = err("Failed to decode payload: " & e.msg)
|
||||
try:
|
||||
result = ok(Protobuf.decode(bytes, proto))
|
||||
except ProtobufError as e:
|
||||
result = err("Failed to decode payload: " & e.msg)
|
||||
|
||||
|
||||
proc toContentFrame*(frame: TextFrame): ContentFrame =
|
||||
|
||||
1
vendor/illwill
vendored
Submodule
1
vendor/illwill
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 99a120f7f69868b94f5d35ce7e21dd12535de70c
|
||||
Loading…
x
Reference in New Issue
Block a user