mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-02 02:41:41 +00:00
chat: register ConnectTarget + CEvtSimplexNameConflict in bot docs
Bot API docs generator failed with "Undefined type: ConnectTarget" sincef2394d121(prior plan) flipped APIConnectPlan/Connect from Maybe AConnectionLink to Maybe ConnectTarget without updating bots/src/API/Docs/*. Also adds SimplexNameConflictEntity (new incd0de9659) and documents the CEvtSimplexNameConflict event for peer-name displacement notifications. Regenerates the affected markdown / TypeScript / Python artefacts.
This commit is contained in:
@@ -434,17 +434,17 @@ def APIAddContact_cmd_string(self: APIAddContact) -> str:
|
||||
APIAddContact_Response = CR.Invitation | CR.ChatCmdError
|
||||
|
||||
|
||||
# Determine SimpleX link type and if the bot is already connected via this link.
|
||||
# Determine SimpleX link type and if the bot is already connected via this link or name.
|
||||
# Network usage: interactive.
|
||||
class APIConnectPlan(TypedDict):
|
||||
userId: int # int64
|
||||
connectionLink: NotRequired[str]
|
||||
connectTarget: NotRequired["T.ConnectTarget"]
|
||||
resolveKnown: bool
|
||||
linkOwnerSig: NotRequired["T.LinkOwnerSig"]
|
||||
|
||||
|
||||
def APIConnectPlan_cmd_string(self: APIConnectPlan) -> str:
|
||||
return '/_connect plan ' + str(self['userId']) + ' ' + self.get('connectionLink')
|
||||
return '/_connect plan ' + str(self['userId']) + ' ' + str(self.get('connectTarget'))
|
||||
|
||||
APIConnectPlan_Response = CR.ConnectionPlan | CR.ChatCmdError
|
||||
|
||||
@@ -463,15 +463,15 @@ def APIConnect_cmd_string(self: APIConnect) -> str:
|
||||
APIConnect_Response = CR.SentConfirmation | CR.ContactAlreadyExists | CR.SentInvitation | CR.ChatCmdError
|
||||
|
||||
|
||||
# Connect via SimpleX link as string in the active user profile.
|
||||
# Connect via SimpleX link or name as string in the active user profile.
|
||||
# Network usage: interactive.
|
||||
class Connect(TypedDict):
|
||||
incognito: bool
|
||||
connLink_: NotRequired[str]
|
||||
connTarget_: NotRequired["T.ConnectTarget"]
|
||||
|
||||
|
||||
def Connect_cmd_string(self: Connect) -> str:
|
||||
return '/connect' + ((' ' + self.get('connLink_')) if self.get('connLink_') is not None else '')
|
||||
return '/connect' + ((' ' + str(self.get('connTarget_'))) if self.get('connTarget_') is not None else '')
|
||||
|
||||
Connect_Response = CR.SentConfirmation | CR.ContactAlreadyExists | CR.SentInvitation | CR.ChatCmdError
|
||||
|
||||
|
||||
@@ -35,6 +35,14 @@ class NewMemberContactReceivedInv(TypedDict):
|
||||
groupInfo: "T.GroupInfo"
|
||||
member: "T.GroupMember"
|
||||
|
||||
class SimplexNameConflict(TypedDict):
|
||||
type: Literal["simplexNameConflict"]
|
||||
user: "T.User"
|
||||
simplexName: "T.SimplexNameInfo"
|
||||
entity: "T.SimplexNameConflictEntity"
|
||||
claimedBy: str
|
||||
displacedFrom: str
|
||||
|
||||
class ContactSndReady(TypedDict):
|
||||
type: Literal["contactSndReady"]
|
||||
user: "T.User"
|
||||
@@ -330,6 +338,7 @@ ChatEvent = (
|
||||
| ContactDeletedByContact
|
||||
| ReceivedContactRequest
|
||||
| NewMemberContactReceivedInv
|
||||
| SimplexNameConflict
|
||||
| ContactSndReady
|
||||
| NewChatItems
|
||||
| ChatItemReaction
|
||||
@@ -377,7 +386,7 @@ ChatEvent = (
|
||||
| ChatErrors
|
||||
)
|
||||
|
||||
ChatEvent_Tag = Literal["contactConnected", "contactUpdated", "contactDeletedByContact", "receivedContactRequest", "newMemberContactReceivedInv", "contactSndReady", "newChatItems", "chatItemReaction", "chatItemsDeleted", "chatItemUpdated", "groupChatItemsDeleted", "chatItemsStatusesUpdated", "receivedGroupInvitation", "userJoinedGroup", "groupUpdated", "joinedGroupMember", "memberRole", "deletedMember", "leftMember", "deletedMemberUser", "groupDeleted", "connectedToGroupMember", "memberAcceptedByOther", "memberBlockedForAll", "groupMemberUpdated", "groupLinkDataUpdated", "groupRelayUpdated", "rcvFileDescrReady", "rcvFileComplete", "sndFileCompleteXFTP", "rcvFileStart", "rcvFileSndCancelled", "rcvFileAccepted", "rcvFileError", "rcvFileWarning", "sndFileError", "sndFileWarning", "acceptingContactRequest", "acceptingBusinessRequest", "contactConnecting", "businessLinkConnecting", "joinedGroupMemberConnecting", "sentGroupInvitation", "groupLinkConnecting", "hostConnected", "hostDisconnected", "subscriptionStatus", "messageError", "chatError", "chatErrors"]
|
||||
ChatEvent_Tag = Literal["contactConnected", "contactUpdated", "contactDeletedByContact", "receivedContactRequest", "newMemberContactReceivedInv", "simplexNameConflict", "contactSndReady", "newChatItems", "chatItemReaction", "chatItemsDeleted", "chatItemUpdated", "groupChatItemsDeleted", "chatItemsStatusesUpdated", "receivedGroupInvitation", "userJoinedGroup", "groupUpdated", "joinedGroupMember", "memberRole", "deletedMember", "leftMember", "deletedMemberUser", "groupDeleted", "connectedToGroupMember", "memberAcceptedByOther", "memberBlockedForAll", "groupMemberUpdated", "groupLinkDataUpdated", "groupRelayUpdated", "rcvFileDescrReady", "rcvFileComplete", "sndFileCompleteXFTP", "rcvFileStart", "rcvFileSndCancelled", "rcvFileAccepted", "rcvFileError", "rcvFileWarning", "sndFileError", "sndFileWarning", "acceptingContactRequest", "acceptingBusinessRequest", "contactConnecting", "businessLinkConnecting", "joinedGroupMemberConnecting", "sentGroupInvitation", "groupLinkConnecting", "hostConnected", "hostDisconnected", "subscriptionStatus", "messageError", "chatError", "chatErrors"]
|
||||
|
||||
|
||||
class OnEventDecorator(Protocol):
|
||||
@@ -418,6 +427,12 @@ class OnEventDecorator(Protocol):
|
||||
Callable[["NewMemberContactReceivedInv"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["simplexNameConflict"], /) -> Callable[
|
||||
[Callable[["SimplexNameConflict"], Awaitable[None]]],
|
||||
Callable[["SimplexNameConflict"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["contactSndReady"], /) -> Callable[
|
||||
[Callable[["ContactSndReady"], Awaitable[None]]],
|
||||
|
||||
@@ -769,6 +769,18 @@ class ChatErrorType_chatStoreChanged(TypedDict):
|
||||
class ChatErrorType_invalidConnReq(TypedDict):
|
||||
type: Literal["invalidConnReq"]
|
||||
|
||||
class ChatErrorType_simplexNameNotFound(TypedDict):
|
||||
type: Literal["simplexNameNotFound"]
|
||||
simplexName: "SimplexNameInfo"
|
||||
|
||||
class ChatErrorType_simplexNameUnprepared(TypedDict):
|
||||
type: Literal["simplexNameUnprepared"]
|
||||
simplexName: "SimplexNameInfo"
|
||||
|
||||
class ChatErrorType_simplexNameResolverUnavailable(TypedDict):
|
||||
type: Literal["simplexNameResolverUnavailable"]
|
||||
simplexName: "SimplexNameInfo"
|
||||
|
||||
class ChatErrorType_unsupportedConnReq(TypedDict):
|
||||
type: Literal["unsupportedConnReq"]
|
||||
|
||||
@@ -999,6 +1011,9 @@ ChatErrorType = (
|
||||
| ChatErrorType_chatNotStopped
|
||||
| ChatErrorType_chatStoreChanged
|
||||
| ChatErrorType_invalidConnReq
|
||||
| ChatErrorType_simplexNameNotFound
|
||||
| ChatErrorType_simplexNameUnprepared
|
||||
| ChatErrorType_simplexNameResolverUnavailable
|
||||
| ChatErrorType_unsupportedConnReq
|
||||
| ChatErrorType_connReqMessageProhibited
|
||||
| ChatErrorType_contactNotReady
|
||||
@@ -1055,7 +1070,7 @@ ChatErrorType = (
|
||||
| ChatErrorType_exception
|
||||
)
|
||||
|
||||
ChatErrorType_Tag = Literal["noActiveUser", "noConnectionUser", "noSndFileUser", "noRcvFileUser", "userUnknown", "userExists", "chatRelayExists", "differentActiveUser", "cantDeleteActiveUser", "cantDeleteLastUser", "cantHideLastUser", "hiddenUserAlwaysMuted", "emptyUserPassword", "userAlreadyHidden", "userNotHidden", "invalidDisplayName", "chatNotStarted", "chatNotStopped", "chatStoreChanged", "invalidConnReq", "unsupportedConnReq", "connReqMessageProhibited", "contactNotReady", "contactNotActive", "contactDisabled", "connectionDisabled", "groupUserRole", "groupMemberInitialRole", "contactIncognitoCantInvite", "groupIncognitoCantInvite", "groupContactRole", "groupDuplicateMember", "groupDuplicateMemberId", "groupNotJoined", "groupMemberNotActive", "cantBlockMemberForSelf", "groupMemberUserRemoved", "groupMemberNotFound", "groupCantResendInvitation", "groupInternal", "fileNotFound", "fileSize", "fileAlreadyReceiving", "fileCancelled", "fileCancel", "fileAlreadyExists", "fileWrite", "fileSend", "fileRcvChunk", "fileInternal", "fileImageType", "fileImageSize", "fileNotReceived", "fileNotApproved", "fallbackToSMPProhibited", "inlineFileProhibited", "invalidForward", "invalidChatItemUpdate", "invalidChatItemDelete", "hasCurrentCall", "noCurrentCall", "callContact", "directMessagesProhibited", "agentVersion", "agentNoSubResult", "commandError", "agentCommandError", "invalidFileDescription", "connectionIncognitoChangeProhibited", "connectionUserChangeProhibited", "peerChatVRangeIncompatible", "relayTestError", "internalError", "exception"]
|
||||
ChatErrorType_Tag = Literal["noActiveUser", "noConnectionUser", "noSndFileUser", "noRcvFileUser", "userUnknown", "userExists", "chatRelayExists", "differentActiveUser", "cantDeleteActiveUser", "cantDeleteLastUser", "cantHideLastUser", "hiddenUserAlwaysMuted", "emptyUserPassword", "userAlreadyHidden", "userNotHidden", "invalidDisplayName", "chatNotStarted", "chatNotStopped", "chatStoreChanged", "invalidConnReq", "simplexNameNotFound", "simplexNameUnprepared", "simplexNameResolverUnavailable", "unsupportedConnReq", "connReqMessageProhibited", "contactNotReady", "contactNotActive", "contactDisabled", "connectionDisabled", "groupUserRole", "groupMemberInitialRole", "contactIncognitoCantInvite", "groupIncognitoCantInvite", "groupContactRole", "groupDuplicateMember", "groupDuplicateMemberId", "groupNotJoined", "groupMemberNotActive", "cantBlockMemberForSelf", "groupMemberUserRemoved", "groupMemberNotFound", "groupCantResendInvitation", "groupInternal", "fileNotFound", "fileSize", "fileAlreadyReceiving", "fileCancelled", "fileCancel", "fileAlreadyExists", "fileWrite", "fileSend", "fileRcvChunk", "fileInternal", "fileImageType", "fileImageSize", "fileNotReceived", "fileNotApproved", "fallbackToSMPProhibited", "inlineFileProhibited", "invalidForward", "invalidChatItemUpdate", "invalidChatItemDelete", "hasCurrentCall", "noCurrentCall", "callContact", "directMessagesProhibited", "agentVersion", "agentNoSubResult", "commandError", "agentCommandError", "invalidFileDescription", "connectionIncognitoChangeProhibited", "connectionUserChangeProhibited", "peerChatVRangeIncompatible", "relayTestError", "internalError", "exception"]
|
||||
|
||||
ChatFeature = Literal["timedMessages", "fullDelete", "reactions", "voice", "files", "calls", "sessions"]
|
||||
|
||||
@@ -1273,6 +1288,20 @@ ConnStatus_Tag = Literal["new", "prepared", "joined", "requested", "accepted", "
|
||||
|
||||
ConnType = Literal["contact", "member", "user_contact"]
|
||||
|
||||
# Connect target: SimpleX link (`CTLink`) or SimpleX name (`CTName`). Wire form is the bare string returned by `strEncode` — `simplex:/...` for links, `#name.simplex` / `@name.simplex` for names.
|
||||
|
||||
class ConnectTarget_link(TypedDict):
|
||||
type: Literal["link"]
|
||||
: str
|
||||
|
||||
class ConnectTarget_name(TypedDict):
|
||||
type: Literal["name"]
|
||||
: "SimplexNameInfo"
|
||||
|
||||
ConnectTarget = ConnectTarget_link | ConnectTarget_name
|
||||
|
||||
ConnectTarget_Tag = Literal["link", "name"]
|
||||
|
||||
class Connection(TypedDict):
|
||||
connId: int # int64
|
||||
agentConnId: str
|
||||
@@ -1298,6 +1327,7 @@ class Connection(TypedDict):
|
||||
authErrCounter: int # int
|
||||
quotaErrCounter: int # int
|
||||
createdAt: str # ISO-8601 timestamp
|
||||
simplexName: NotRequired["SimplexNameInfo"]
|
||||
|
||||
class ConnectionEntity_rcvDirectMsgConnection(TypedDict):
|
||||
type: Literal["rcvDirectMsgConnection"]
|
||||
@@ -1398,6 +1428,7 @@ class Contact(TypedDict):
|
||||
uiThemes: NotRequired["UIThemeEntityOverrides"]
|
||||
chatDeleted: bool
|
||||
customData: NotRequired[dict[str, object]]
|
||||
simplexName: NotRequired["SimplexNameInfo"]
|
||||
|
||||
class ContactAddressPlan_ok(TypedDict):
|
||||
type: Literal["ok"]
|
||||
@@ -1809,6 +1840,7 @@ class GroupInfo(TypedDict):
|
||||
membersRequireAttention: int # int
|
||||
viaGroupLinkUri: NotRequired[str]
|
||||
groupKeys: NotRequired["GroupKeys"]
|
||||
simplexName: NotRequired["SimplexNameInfo"]
|
||||
|
||||
class GroupKeys(TypedDict):
|
||||
publicGroupId: str
|
||||
@@ -1936,6 +1968,7 @@ class GroupProfile(TypedDict):
|
||||
description: NotRequired[str]
|
||||
image: NotRequired[str]
|
||||
publicGroup: NotRequired["PublicGroupProfile"]
|
||||
simplexName: NotRequired["SimplexNameInfo"]
|
||||
groupPreferences: NotRequired["GroupPreferences"]
|
||||
memberAdmission: NotRequired["GroupMemberAdmission"]
|
||||
|
||||
@@ -2062,6 +2095,7 @@ class LocalProfile(TypedDict):
|
||||
shortDescr: NotRequired[str]
|
||||
image: NotRequired[str]
|
||||
contactLink: NotRequired[str]
|
||||
simplexName: NotRequired["SimplexNameInfo"]
|
||||
preferences: NotRequired["Preferences"]
|
||||
peerType: NotRequired["ChatPeerType"]
|
||||
localAlias: str
|
||||
@@ -2313,6 +2347,7 @@ class Profile(TypedDict):
|
||||
shortDescr: NotRequired[str]
|
||||
image: NotRequired[str]
|
||||
contactLink: NotRequired[str]
|
||||
simplexName: NotRequired["SimplexNameInfo"]
|
||||
preferences: NotRequired["Preferences"]
|
||||
peerType: NotRequired["ChatPeerType"]
|
||||
|
||||
@@ -2700,6 +2735,8 @@ class SimplePreference(TypedDict):
|
||||
|
||||
SimplexLinkType = Literal["contact", "invitation", "group", "channel", "relay"]
|
||||
|
||||
SimplexNameConflictEntity = Literal["contact", "group"]
|
||||
|
||||
class SimplexNameDomain(TypedDict):
|
||||
nameTLD: "SimplexTLD"
|
||||
domain: str
|
||||
|
||||
Reference in New Issue
Block a user