bots, nodejs: document chat, connection, member contact and network commands, typed commands in library (#7808)

* bots, nodejs: document chat, connection, member contact and network commands, typed commands in library

* bots, nodejs: restore apiConnect, wrap domain once, test all connect responses

* nodejs: JSDoc for new methods

* docs: plan for bot API commands and typed Node library methods

* tests: channel prepared with a domain has a verified SimpleX name

* docs: apply review fixes to the plan for bot API commands

* docs: apply second review pass to the plan for bot API commands

* docs: refer the bot API plan to the rewritten test commit

* docs: record decisions in the plan for bot API commands

* docs: plan tests of the generated Python command strings

* python: test the generated strings of the documented commands

* docs: plan the message information command for bots

* bots, nodejs: message information with the file servers for bots

* docs: plan the relay approval option of receiving files in Node

* nodejs: receive files without approving unknown relays

* docs: plan the user servers command for bots

* bots, nodejs: user servers and relays by operator for bots

* nodejs: document the message information method

* docs: plan the file upload progress event for bots

* bots: file upload progress event for bots

* bots: drop the file upload progress event

* docs: drop the upload progress event plan

* nodejs: document user servers and relay approval of received files
This commit is contained in:
Evgeny @ SimpleX Chat authored and GitHub committed 2026-10-31 22:30:16 +00:00
1 parent d1b3da8410
commit 99b91696f7
34 files changed
+3716 -204

No files matched your search

@@ -45,3 +45,102 @@ def test_api_connect_cmd_string_renders_incognito():
link = {"connFullLink": "L"}
assert CC.APIConnect_cmd_string({"userId": 1, "incognito": True, "preparedLink_": link}) == "/_connect 1 incognito=on L"
assert CC.APIConnect_cmd_string({"userId": 1, "incognito": False, "preparedLink_": link}) == "/_connect 1 L"
def test_chat_pagination_cmd_string():
assert T.ChatPagination_cmd_string({"type": "last", "count": 0}) == "count=0"
assert T.ChatPagination_cmd_string({"type": "initial", "count": 1}) == "initial=1"
assert (
T.ChatPagination_cmd_string({"type": "around", "chatItemId": 5, "count": 0})
== "around=5 count=0"
)
assert (
T.ChatPagination_cmd_string({"type": "after", "chatItemId": 5, "count": 100})
== "after=5 count=100"
)
assert (
T.ChatPagination_cmd_string({"type": "before", "chatItemId": 5, "count": 10})
== "before=5 count=10"
)
def test_api_get_chat_cmd_string():
ref = {"chatType": "direct", "chatId": 2}
last = {"type": "last", "count": 10}
assert (
CC.APIGetChat_cmd_string(
{"chatRef": ref, "contentTag": "image", "chatPagination": last, "search": "k"}
)
== "/_get chat @2 content=image count=10 search=k"
)
assert (
CC.APIGetChat_cmd_string(
{"chatRef": ref, "chatPagination": {"type": "initial", "count": 1}}
)
== "/_get chat @2 initial=1"
)
def test_api_chat_items_read_cmd_string():
ref = {"chatType": "direct", "chatId": 2}
assert (
CC.APIChatItemsRead_cmd_string({"chatRef": ref, "chatItemIds": [3, 4]})
== "/_read chat items @2 3,4"
)
def test_api_connect_plan_cmd_string_omits_default_resolve_mode():
assert T.PlanResolveMode_cmd_string("unknown") == ""
assert T.PlanResolveMode_cmd_string("allGroups") == " resolve=allGroups"
assert T.PlanResolveMode_cmd_string("never") == " resolve=never"
assert (
CC.APIConnectPlan_cmd_string({"userId": 1, "connectTarget": "L", "resolveMode": "unknown"})
== "/_connect plan 1 L"
)
assert (
CC.APIConnectPlan_cmd_string({"userId": 1, "connectTarget": "L", "resolveMode": "never"})
== "/_connect plan 1 L resolve=never"
)
def test_api_connect_prepared_group_cmd_string():
owner = {"contactId": 1, "memberId": "abc"}
msg = {"type": "text", "text": "hi"}
assert T.GroupOwnerContact_cmd_string(owner) == "contact=1 owner=abc"
assert (
CC.APIConnectPreparedGroup_cmd_string(
{"groupId": 3, "incognito": False, "ownerContact": owner}
)
== "/_connect group #3 contact=1 owner=abc"
)
assert (
CC.APIConnectPreparedGroup_cmd_string({"groupId": 3, "incognito": True, "msgContent_": msg})
== '/_connect group #3 incognito=on json {"type": "text", "text": "hi"}'
)
def test_member_contact_cmd_string():
assert (
CC.APICreateMemberContact_cmd_string({"groupId": 1, "groupMemberId": 2})
== "/_create member contact #1 2"
)
assert (
CC.APISendMemberContactInvitation_cmd_string({"contactId": 2})
== "/_invite member contact @2"
)
def test_api_get_network_config_cmd_string():
assert CC.APIGetNetworkConfig_cmd_string({}) == "/network"
def test_api_get_chat_item_info_cmd_string():
ref = {"chatType": "direct", "chatId": 2}
assert (
CC.APIGetChatItemInfo_cmd_string({"chatRef": ref, "chatItemId": 5})
== "/_get item info @2 5"
)
def test_api_get_user_servers_cmd_string():
assert CC.APIGetUserServers_cmd_string({"userId": 1}) == "/_servers 1"