From 75a22367b9f81ddbb3d63c2860a60a570e460e41 Mon Sep 17 00:00:00 2001 From: kaichaosun Date: Fri, 9 May 2025 13:56:39 +0800 Subject: [PATCH] feat: create chat sdk --- chat_sdk.nimble | 12 ++++++++++++ src/chat_sdk.nim | 7 +++++++ src/chat_sdk/submodule.nim | 12 ++++++++++++ tests/config.nims | 1 + tests/test1.nim | 12 ++++++++++++ 5 files changed, 44 insertions(+) create mode 100644 chat_sdk.nimble create mode 100644 src/chat_sdk.nim create mode 100644 src/chat_sdk/submodule.nim create mode 100644 tests/config.nims create mode 100644 tests/test1.nim diff --git a/chat_sdk.nimble b/chat_sdk.nimble new file mode 100644 index 0000000..d9f6b71 --- /dev/null +++ b/chat_sdk.nimble @@ -0,0 +1,12 @@ +# Package + +version = "0.0.1" +author = "Waku Chat Team" +description = "Chat features over Waku" +license = "MIT" +srcDir = "src" + + +# Dependencies + +requires "nim >= 2.0.0" diff --git a/src/chat_sdk.nim b/src/chat_sdk.nim new file mode 100644 index 0000000..b7a2480 --- /dev/null +++ b/src/chat_sdk.nim @@ -0,0 +1,7 @@ +# This is just an example to get you started. A typical library package +# exports the main API in this file. Note that you cannot rename this file +# but you can remove it if you wish. + +proc add*(x, y: int): int = + ## Adds two numbers together. + return x + y diff --git a/src/chat_sdk/submodule.nim b/src/chat_sdk/submodule.nim new file mode 100644 index 0000000..60b6bce --- /dev/null +++ b/src/chat_sdk/submodule.nim @@ -0,0 +1,12 @@ +# This is just an example to get you started. Users of your library will +# import this file by writing ``import chat_sdk/submodule``. Feel free to rename or +# remove this file altogether. You may create additional modules alongside +# this file as required. + +type + Submodule* = object + name*: string + +proc initSubmodule*(): Submodule = + ## Initialises a new ``Submodule`` object. + Submodule(name: "Anonymous") diff --git a/tests/config.nims b/tests/config.nims new file mode 100644 index 0000000..3bb69f8 --- /dev/null +++ b/tests/config.nims @@ -0,0 +1 @@ +switch("path", "$projectDir/../src") \ No newline at end of file diff --git a/tests/test1.nim b/tests/test1.nim new file mode 100644 index 0000000..91dc097 --- /dev/null +++ b/tests/test1.nim @@ -0,0 +1,12 @@ +# This is just an example to get you started. You may wish to put all of your +# tests into a single file, or separate them into multiple `test1`, `test2` +# etc. files (better names are recommended, just make sure the name starts with +# the letter 't'). +# +# To run these tests, simply execute `nimble test`. + +import unittest + +import chat_sdk +test "can add": + check add(5, 5) == 10