mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-27 15:48:54 +00:00
fixes
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,868 @@
|
||||
# API Events
|
||||
|
||||
This file is generated automatically.
|
||||
|
||||
[Contact connection events](#contact-connection-events)
|
||||
- Main event
|
||||
- [ContactConnected](#contactconnected)
|
||||
- Other events
|
||||
- [ContactUpdated](#contactupdated)
|
||||
- [ContactDeletedByContact](#contactdeletedbycontact)
|
||||
- [ReceivedContactRequest](#receivedcontactrequest)
|
||||
- [NewMemberContactReceivedInv](#newmembercontactreceivedinv)
|
||||
- [ContactSndReady](#contactsndready)
|
||||
|
||||
[Message events](#message-events)
|
||||
- Main event
|
||||
- [NewChatItems](#newchatitems)
|
||||
- Other events
|
||||
- [ChatItemReaction](#chatitemreaction)
|
||||
- [ChatItemsDeleted](#chatitemsdeleted)
|
||||
- [ChatItemUpdated](#chatitemupdated)
|
||||
- [GroupChatItemsDeleted](#groupchatitemsdeleted)
|
||||
- [ChatItemsStatusesUpdated](#chatitemsstatusesupdated)
|
||||
|
||||
[Group events](#group-events)
|
||||
- Main events
|
||||
- [ReceivedGroupInvitation](#receivedgroupinvitation)
|
||||
- [UserJoinedGroup](#userjoinedgroup)
|
||||
- [GroupUpdated](#groupupdated)
|
||||
- [JoinedGroupMember](#joinedgroupmember)
|
||||
- [MemberRole](#memberrole)
|
||||
- [DeletedMember](#deletedmember)
|
||||
- [LeftMember](#leftmember)
|
||||
- [DeletedMemberUser](#deletedmemberuser)
|
||||
- [GroupDeleted](#groupdeleted)
|
||||
- Other events
|
||||
- [ConnectedToGroupMember](#connectedtogroupmember)
|
||||
- [MemberAcceptedByOther](#memberacceptedbyother)
|
||||
- [MemberBlockedForAll](#memberblockedforall)
|
||||
- [GroupMemberUpdated](#groupmemberupdated)
|
||||
- [GroupLinkDataUpdated](#grouplinkdataupdated)
|
||||
- [GroupRelayUpdated](#grouprelayupdated)
|
||||
|
||||
[File events](#file-events)
|
||||
- Main events
|
||||
- [RcvFileDescrReady](#rcvfiledescrready)
|
||||
- [RcvFileComplete](#rcvfilecomplete)
|
||||
- [SndFileCompleteXFTP](#sndfilecompletexftp)
|
||||
- Other events
|
||||
- [RcvFileStart](#rcvfilestart)
|
||||
- [RcvFileSndCancelled](#rcvfilesndcancelled)
|
||||
- [RcvFileAccepted](#rcvfileaccepted)
|
||||
- [RcvFileError](#rcvfileerror)
|
||||
- [RcvFileWarning](#rcvfilewarning)
|
||||
- [SndFileError](#sndfileerror)
|
||||
- [SndFileWarning](#sndfilewarning)
|
||||
|
||||
[Connection progress events](#connection-progress-events)
|
||||
- [AcceptingContactRequest](#acceptingcontactrequest)
|
||||
- [AcceptingBusinessRequest](#acceptingbusinessrequest)
|
||||
- [ContactConnecting](#contactconnecting)
|
||||
- [BusinessLinkConnecting](#businesslinkconnecting)
|
||||
- [JoinedGroupMemberConnecting](#joinedgroupmemberconnecting)
|
||||
- [GroupLinkConnecting](#grouplinkconnecting)
|
||||
|
||||
[Network connection events](#network-connection-events)
|
||||
- [HostConnected](#hostconnected)
|
||||
- [HostDisconnected](#hostdisconnected)
|
||||
- [SubscriptionStatus](#subscriptionstatus)
|
||||
|
||||
[Service events](#service-events)
|
||||
- [ServiceRequest](#servicerequest)
|
||||
- [ServiceReplySent](#servicereplysent)
|
||||
|
||||
[Remote control events](#remote-control-events)
|
||||
- [RemoteCtrlSessionCode](#remotectrlsessioncode)
|
||||
- [RemoteCtrlStopped](#remotectrlstopped)
|
||||
|
||||
[Error events](#error-events)
|
||||
- [MessageError](#messageerror)
|
||||
- [ChatError](#chaterror)
|
||||
- [ChatErrors](#chaterrors)
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Contact connection events
|
||||
|
||||
Bots must use these events to process connecting users.
|
||||
|
||||
Most bots enable auto-accept and don't need to accept connections via commands.
|
||||
|
||||
You may create bot SimpleX address manually via CLI or desktop app or from bot code with these commands:
|
||||
- [APIShowMyAddress](./COMMANDS.md#apishowmyaddress) to check if address exists,
|
||||
- [APICreateMyAddress](./COMMANDS.md#apicreatemyaddress) to create address,
|
||||
- [APISetAddressSettings](./COMMANDS.md#apisetaddresssettings) to enable auto-access.
|
||||
|
||||
|
||||
### ContactConnected
|
||||
|
||||
This event is sent after a user connects via bot SimpleX address (not a business address).
|
||||
|
||||
**Record type**:
|
||||
- type: "contactConnected"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- contact: [Contact](./TYPES.md#contact)
|
||||
- userCustomProfile: [Profile](./TYPES.md#profile)?
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ContactUpdated
|
||||
|
||||
Contact profile of another user is updated.
|
||||
|
||||
**Record type**:
|
||||
- type: "contactUpdated"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- fromContact: [Contact](./TYPES.md#contact)
|
||||
- toContact: [Contact](./TYPES.md#contact)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ContactDeletedByContact
|
||||
|
||||
Bot user's connection with another contact is deleted (conversation is kept).
|
||||
|
||||
**Record type**:
|
||||
- type: "contactDeletedByContact"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- contact: [Contact](./TYPES.md#contact)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ReceivedContactRequest
|
||||
|
||||
Contact request received.
|
||||
|
||||
This event is only sent when auto-accept is disabled.
|
||||
|
||||
The request needs to be accepted using [APIAcceptContact](./COMMANDS.md#apiacceptcontact) command
|
||||
|
||||
**Record type**:
|
||||
- type: "receivedContactRequest"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- contactRequest: [UserContactRequest](./TYPES.md#usercontactrequest)
|
||||
- chat_: [AChat](./TYPES.md#achat)?
|
||||
|
||||
---
|
||||
|
||||
|
||||
### NewMemberContactReceivedInv
|
||||
|
||||
Received invitation to connect directly with a group member.
|
||||
|
||||
This event only needs to be processed to associate contact with group, the connection will proceed automatically.
|
||||
|
||||
**Record type**:
|
||||
- type: "newMemberContactReceivedInv"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- contact: [Contact](./TYPES.md#contact)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- member: [GroupMember](./TYPES.md#groupmember)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ContactSndReady
|
||||
|
||||
Connecting via 1-time invitation or after accepting contact request.
|
||||
|
||||
After this event bot can send messages to this contact.
|
||||
|
||||
**Record type**:
|
||||
- type: "contactSndReady"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- contact: [Contact](./TYPES.md#contact)
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Message events
|
||||
|
||||
Bots must use these events to process received messages.
|
||||
|
||||
|
||||
### NewChatItems
|
||||
|
||||
Received message(s).
|
||||
|
||||
**Record type**:
|
||||
- type: "newChatItems"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItems: [[AChatItem](./TYPES.md#achatitem)]
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ChatItemReaction
|
||||
|
||||
Received message reaction.
|
||||
|
||||
**Record type**:
|
||||
- type: "chatItemReaction"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- added: bool
|
||||
- reaction: [ACIReaction](./TYPES.md#acireaction)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ChatItemsDeleted
|
||||
|
||||
Message was deleted by another user.
|
||||
|
||||
**Record type**:
|
||||
- type: "chatItemsDeleted"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItemDeletions: [[ChatItemDeletion](./TYPES.md#chatitemdeletion)]
|
||||
- byUser: bool
|
||||
- timed: bool
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ChatItemUpdated
|
||||
|
||||
Message was updated by another user.
|
||||
|
||||
**Record type**:
|
||||
- type: "chatItemUpdated"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItem: [AChatItem](./TYPES.md#achatitem)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### GroupChatItemsDeleted
|
||||
|
||||
Group messages are deleted or moderated.
|
||||
|
||||
**Record type**:
|
||||
- type: "groupChatItemsDeleted"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- chatItemIDs: [int64]
|
||||
- byUser: bool
|
||||
- member_: [GroupMember](./TYPES.md#groupmember)?
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ChatItemsStatusesUpdated
|
||||
|
||||
Message delivery status updates.
|
||||
|
||||
**Record type**:
|
||||
- type: "chatItemsStatusesUpdated"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItems: [[AChatItem](./TYPES.md#achatitem)]
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Group events
|
||||
|
||||
Bots may use these events to manage users' groups and business address groups.
|
||||
|
||||
*Please note*: programming groups is more complex than programming direct connections
|
||||
|
||||
|
||||
### ReceivedGroupInvitation
|
||||
|
||||
Received group invitation.
|
||||
|
||||
**Record type**:
|
||||
- type: "receivedGroupInvitation"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- contact: [Contact](./TYPES.md#contact)
|
||||
- fromMemberRole: [GroupMemberRole](./TYPES.md#groupmemberrole)
|
||||
- memberRole: [GroupMemberRole](./TYPES.md#groupmemberrole)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### UserJoinedGroup
|
||||
|
||||
Bot user joined group. Received when connection via group link completes.
|
||||
|
||||
**Record type**:
|
||||
- type: "userJoinedGroup"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- hostMember: [GroupMember](./TYPES.md#groupmember)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### GroupUpdated
|
||||
|
||||
Group profile or preferences updated.
|
||||
|
||||
**Record type**:
|
||||
- type: "groupUpdated"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- fromGroup: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- toGroup: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- member_: [GroupMember](./TYPES.md#groupmember)?
|
||||
- msgSigned: [MsgSigStatus](./TYPES.md#msgsigstatus)?
|
||||
|
||||
---
|
||||
|
||||
|
||||
### JoinedGroupMember
|
||||
|
||||
Another member joined group.
|
||||
|
||||
**Record type**:
|
||||
- type: "joinedGroupMember"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- member: [GroupMember](./TYPES.md#groupmember)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### MemberRole
|
||||
|
||||
Member (or bot user's) group role changed.
|
||||
|
||||
**Record type**:
|
||||
- type: "memberRole"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- byMember: [GroupMember](./TYPES.md#groupmember)
|
||||
- member: [GroupMember](./TYPES.md#groupmember)
|
||||
- fromRole: [GroupMemberRole](./TYPES.md#groupmemberrole)
|
||||
- toRole: [GroupMemberRole](./TYPES.md#groupmemberrole)
|
||||
- msgSigned: [MsgSigStatus](./TYPES.md#msgsigstatus)?
|
||||
|
||||
---
|
||||
|
||||
|
||||
### DeletedMember
|
||||
|
||||
Another member is removed from the group.
|
||||
|
||||
**Record type**:
|
||||
- type: "deletedMember"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- byMember: [GroupMember](./TYPES.md#groupmember)
|
||||
- deletedMember: [GroupMember](./TYPES.md#groupmember)
|
||||
- withMessages: bool
|
||||
- msgSigned: [MsgSigStatus](./TYPES.md#msgsigstatus)?
|
||||
|
||||
---
|
||||
|
||||
|
||||
### LeftMember
|
||||
|
||||
Another member left the group.
|
||||
|
||||
**Record type**:
|
||||
- type: "leftMember"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- member: [GroupMember](./TYPES.md#groupmember)
|
||||
- msgSigned: [MsgSigStatus](./TYPES.md#msgsigstatus)?
|
||||
|
||||
---
|
||||
|
||||
|
||||
### DeletedMemberUser
|
||||
|
||||
Bot user was removed from the group.
|
||||
|
||||
**Record type**:
|
||||
- type: "deletedMemberUser"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- member: [GroupMember](./TYPES.md#groupmember)
|
||||
- withMessages: bool
|
||||
- msgSigned: [MsgSigStatus](./TYPES.md#msgsigstatus)?
|
||||
|
||||
---
|
||||
|
||||
|
||||
### GroupDeleted
|
||||
|
||||
Group was deleted by the owner (not bot user).
|
||||
|
||||
**Record type**:
|
||||
- type: "groupDeleted"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- member: [GroupMember](./TYPES.md#groupmember)
|
||||
- msgSigned: [MsgSigStatus](./TYPES.md#msgsigstatus)?
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ConnectedToGroupMember
|
||||
|
||||
Connected to another group member.
|
||||
|
||||
**Record type**:
|
||||
- type: "connectedToGroupMember"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- member: [GroupMember](./TYPES.md#groupmember)
|
||||
- memberContact: [Contact](./TYPES.md#contact)?
|
||||
|
||||
---
|
||||
|
||||
|
||||
### MemberAcceptedByOther
|
||||
|
||||
Another group owner, admin or moderator accepted member to the group after review ("knocking").
|
||||
|
||||
**Record type**:
|
||||
- type: "memberAcceptedByOther"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- acceptingMember: [GroupMember](./TYPES.md#groupmember)
|
||||
- member: [GroupMember](./TYPES.md#groupmember)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### MemberBlockedForAll
|
||||
|
||||
Another member blocked for all members.
|
||||
|
||||
**Record type**:
|
||||
- type: "memberBlockedForAll"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- byMember: [GroupMember](./TYPES.md#groupmember)
|
||||
- member: [GroupMember](./TYPES.md#groupmember)
|
||||
- blocked: bool
|
||||
- msgSigned: [MsgSigStatus](./TYPES.md#msgsigstatus)?
|
||||
|
||||
---
|
||||
|
||||
|
||||
### GroupMemberUpdated
|
||||
|
||||
Another group member profile updated.
|
||||
|
||||
**Record type**:
|
||||
- type: "groupMemberUpdated"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- fromMember: [GroupMember](./TYPES.md#groupmember)
|
||||
- toMember: [GroupMember](./TYPES.md#groupmember)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### GroupLinkDataUpdated
|
||||
|
||||
Group link data updated.
|
||||
|
||||
**Record type**:
|
||||
- type: "groupLinkDataUpdated"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- groupLink: [GroupLink](./TYPES.md#grouplink)
|
||||
- groupRelays: [[GroupRelay](./TYPES.md#grouprelay)]
|
||||
- relaysChanged: bool
|
||||
|
||||
---
|
||||
|
||||
|
||||
### GroupRelayUpdated
|
||||
|
||||
Group relay member updated.
|
||||
|
||||
**Record type**:
|
||||
- type: "groupRelayUpdated"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- member: [GroupMember](./TYPES.md#groupmember)
|
||||
- groupRelay: [GroupRelay](./TYPES.md#grouprelay)
|
||||
|
||||
---
|
||||
|
||||
|
||||
## File events
|
||||
|
||||
Bots that send or receive files may process these events to track delivery status and to process completion.
|
||||
|
||||
Bots that need to receive or moderate files (e.g., based on name, size or extension), can use relevant commands (e.g., [ReceiveFile](./COMMANDS.md#receivefile) or [APIDeleteMemberChatItem](./COMMANDS.md#apideletememberchatitem)) when processing [NewChatItems](#newchatitems) event.
|
||||
|
||||
Bots that need to send files should use [APISendMessages](./COMMANDS.md#apisendmessages) command.
|
||||
|
||||
|
||||
### RcvFileDescrReady
|
||||
|
||||
File is ready to be received.
|
||||
|
||||
This event is useful for processing sender file servers and monitoring file reception progress.
|
||||
|
||||
[ReceiveFile](./COMMANDS.md#receivefile) command can be used before this event.
|
||||
|
||||
**Record type**:
|
||||
- type: "rcvFileDescrReady"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItem: [AChatItem](./TYPES.md#achatitem)
|
||||
- rcvFileTransfer: [RcvFileTransfer](./TYPES.md#rcvfiletransfer)
|
||||
- rcvFileDescr: [RcvFileDescr](./TYPES.md#rcvfiledescr)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### RcvFileComplete
|
||||
|
||||
File reception is competed.
|
||||
|
||||
**Record type**:
|
||||
- type: "rcvFileComplete"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItem: [AChatItem](./TYPES.md#achatitem)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### SndFileCompleteXFTP
|
||||
|
||||
File upload is competed.
|
||||
|
||||
**Record type**:
|
||||
- type: "sndFileCompleteXFTP"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItem: [AChatItem](./TYPES.md#achatitem)
|
||||
- fileTransferMeta: [FileTransferMeta](./TYPES.md#filetransfermeta)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### RcvFileStart
|
||||
|
||||
File reception started. This event will be sent after [CEvtRcvFileDescrReady](#rcvfiledescrready) event.
|
||||
|
||||
**Record type**:
|
||||
- type: "rcvFileStart"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItem: [AChatItem](./TYPES.md#achatitem)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### RcvFileSndCancelled
|
||||
|
||||
File was cancelled by the sender. This event may be sent instead of [CEvtRcvFileDescrReady](#rcvfiledescrready) event.
|
||||
|
||||
**Record type**:
|
||||
- type: "rcvFileSndCancelled"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItem: [AChatItem](./TYPES.md#achatitem)
|
||||
- rcvFileTransfer: [RcvFileTransfer](./TYPES.md#rcvfiletransfer)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### RcvFileAccepted
|
||||
|
||||
This event will be sent when file is automatically accepted because of CLI option.
|
||||
|
||||
**Record type**:
|
||||
- type: "rcvFileAccepted"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItem: [AChatItem](./TYPES.md#achatitem)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### RcvFileError
|
||||
|
||||
Error receiving file.
|
||||
|
||||
**Record type**:
|
||||
- type: "rcvFileError"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItem_: [AChatItem](./TYPES.md#achatitem)?
|
||||
- agentError: [AgentErrorType](./TYPES.md#agenterrortype)
|
||||
- rcvFileTransfer: [RcvFileTransfer](./TYPES.md#rcvfiletransfer)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### RcvFileWarning
|
||||
|
||||
Warning when receiving file. It can happen when CLI settings do not allow to connect to file server(s).
|
||||
|
||||
**Record type**:
|
||||
- type: "rcvFileWarning"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItem_: [AChatItem](./TYPES.md#achatitem)?
|
||||
- agentError: [AgentErrorType](./TYPES.md#agenterrortype)
|
||||
- rcvFileTransfer: [RcvFileTransfer](./TYPES.md#rcvfiletransfer)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### SndFileError
|
||||
|
||||
Error sending file.
|
||||
|
||||
**Record type**:
|
||||
- type: "sndFileError"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItem_: [AChatItem](./TYPES.md#achatitem)?
|
||||
- fileTransferMeta: [FileTransferMeta](./TYPES.md#filetransfermeta)
|
||||
- errorMessage: string
|
||||
|
||||
---
|
||||
|
||||
|
||||
### SndFileWarning
|
||||
|
||||
Warning when sending file.
|
||||
|
||||
**Record type**:
|
||||
- type: "sndFileWarning"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- chatItem_: [AChatItem](./TYPES.md#achatitem)?
|
||||
- fileTransferMeta: [FileTransferMeta](./TYPES.md#filetransfermeta)
|
||||
- errorMessage: string
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Connection progress events
|
||||
|
||||
Bots may use these events to track progress of connections for monitoring or debugging.
|
||||
|
||||
|
||||
### AcceptingContactRequest
|
||||
|
||||
Automatically accepting contact request via bot's SimpleX address with auto-accept enabled.
|
||||
|
||||
**Record type**:
|
||||
- type: "acceptingContactRequest"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- contact: [Contact](./TYPES.md#contact)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### AcceptingBusinessRequest
|
||||
|
||||
Automatically accepting contact request via bot's business address.
|
||||
|
||||
**Record type**:
|
||||
- type: "acceptingBusinessRequest"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ContactConnecting
|
||||
|
||||
Contact confirmed connection.
|
||||
|
||||
Sent when contact started connecting via bot's 1-time invitation link or when bot connects to another SimpleX address.
|
||||
|
||||
**Record type**:
|
||||
- type: "contactConnecting"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- contact: [Contact](./TYPES.md#contact)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### BusinessLinkConnecting
|
||||
|
||||
Contact confirmed connection.
|
||||
|
||||
Sent when bot connects to another business address.
|
||||
|
||||
**Record type**:
|
||||
- type: "businessLinkConnecting"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- hostMember: [GroupMember](./TYPES.md#groupmember)
|
||||
- fromContact: [Contact](./TYPES.md#contact)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### JoinedGroupMemberConnecting
|
||||
|
||||
Group member is announced to the group and will be connecting to bot.
|
||||
|
||||
**Record type**:
|
||||
- type: "joinedGroupMemberConnecting"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- hostMember: [GroupMember](./TYPES.md#groupmember)
|
||||
- member: [GroupMember](./TYPES.md#groupmember)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### GroupLinkConnecting
|
||||
|
||||
Sent when bot joins group via another user link.
|
||||
|
||||
**Record type**:
|
||||
- type: "groupLinkConnecting"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- groupInfo: [GroupInfo](./TYPES.md#groupinfo)
|
||||
- hostMember: [GroupMember](./TYPES.md#groupmember)
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Network connection events
|
||||
|
||||
|
||||
|
||||
|
||||
### HostConnected
|
||||
|
||||
Messaging or file server connected
|
||||
|
||||
**Record type**:
|
||||
- type: "hostConnected"
|
||||
- protocol: string
|
||||
- transportHost: string
|
||||
|
||||
---
|
||||
|
||||
|
||||
### HostDisconnected
|
||||
|
||||
Messaging or file server disconnected
|
||||
|
||||
**Record type**:
|
||||
- type: "hostDisconnected"
|
||||
- protocol: string
|
||||
- transportHost: string
|
||||
|
||||
---
|
||||
|
||||
|
||||
### SubscriptionStatus
|
||||
|
||||
Messaging subscription status changed
|
||||
|
||||
**Record type**:
|
||||
- type: "subscriptionStatus"
|
||||
- server: string
|
||||
- subscriptionStatus: [SubscriptionStatus](./TYPES.md#subscriptionstatus)
|
||||
- connections: [string]
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Service events
|
||||
|
||||
Bots with a double ratchet address, started with service request processing enabled, can answer service requests - a single request with a single response (RPC).
|
||||
|
||||
|
||||
### ServiceRequest
|
||||
|
||||
Service request received.
|
||||
|
||||
The request needs to be answered using [APISendServiceResponse](./COMMANDS.md#apisendserviceresponse) command.
|
||||
|
||||
**Record type**:
|
||||
- type: "serviceRequest"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- requestId: string
|
||||
- signerKey: string?
|
||||
- requestData: JSONObject
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ServiceReplySent
|
||||
|
||||
Service reply was sent (delivered to the server).
|
||||
|
||||
Correlate `connectionId` with the connection ID from the response to [APISendServiceResponse](./COMMANDS.md#apisendserviceresponse) to learn when the reply is delivered.
|
||||
|
||||
**Record type**:
|
||||
- type: "serviceReplySent"
|
||||
- connectionId: string
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Remote control events
|
||||
|
||||
Bots that act as remote control hosts receive these events during the remote control session lifecycle.
|
||||
|
||||
|
||||
### RemoteCtrlSessionCode
|
||||
|
||||
Remote controller session code ready for verification.
|
||||
|
||||
Use [VerifyRemoteCtrlSession](./COMMANDS.md#verifyremotectrlsession) to complete the connection.
|
||||
|
||||
**Record type**:
|
||||
- type: "remoteCtrlSessionCode"
|
||||
- remoteCtrl_: [RemoteCtrlInfo](./TYPES.md#remotectrlinfo)?
|
||||
- sessionCode: string
|
||||
|
||||
---
|
||||
|
||||
|
||||
### RemoteCtrlStopped
|
||||
|
||||
Remote controller session stopped.
|
||||
|
||||
**Record type**:
|
||||
- type: "remoteCtrlStopped"
|
||||
- rcsState: [RemoteCtrlSessionState](./TYPES.md#remotectrlsessionstate)
|
||||
- rcStopReason: [RemoteCtrlStopReason](./TYPES.md#remotectrlstopreason)
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Error events
|
||||
|
||||
Bots may log these events for debugging. There will be many error events - this does NOT indicate a malfunction - e.g., they may happen because of bad network connectivity, or because messages may be delivered to deleted chats for a short period of time (they will be ignored).
|
||||
|
||||
|
||||
### MessageError
|
||||
|
||||
Message error.
|
||||
|
||||
**Record type**:
|
||||
- type: "messageError"
|
||||
- user: [User](./TYPES.md#user)
|
||||
- severity: string
|
||||
- errorMessage: string
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ChatError
|
||||
|
||||
Chat error (only used in WebSockets API).
|
||||
|
||||
**Record type**:
|
||||
- type: "chatError"
|
||||
- chatError: [ChatError](./TYPES.md#chaterror)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### ChatErrors
|
||||
|
||||
Chat errors.
|
||||
|
||||
**Record type**:
|
||||
- type: "chatErrors"
|
||||
- chatErrors: [[ChatError](./TYPES.md#chaterror)]
|
||||
|
||||
---
|
||||
|
||||
+4786
File diff suppressed because it is too large
Load Diff
@@ -47,7 +47,7 @@ import Simplex.Messaging.Agent.Protocol
|
||||
import Simplex.Messaging.Client
|
||||
import Simplex.Messaging.Crypto.File
|
||||
import Simplex.Messaging.Parsers (dropPrefix, fstToLower)
|
||||
import Simplex.Messaging.Protocol (BlockingInfo (..), BlockingReason (..), CommandError (..), ErrorType (..), NameErrorType (..), NetworkError (..), ProxyError (..))
|
||||
import Simplex.Messaging.Protocol (BlockingInfo (..), BlockingReason (..), CommandError (..), ErrorType (..), NameErrorType (..), NamePricing (..), NameRecord (..), NameRegistration (..), NameReservedReason (..), NetworkError (..), ProxyError (..))
|
||||
import Simplex.Messaging.Protocol.Types (ClientNotice (..))
|
||||
import Simplex.Messaging.Transport
|
||||
import Simplex.Chat.Remote.Types (CtrlAppInfo (..))
|
||||
@@ -183,6 +183,14 @@ ciQuoteType =
|
||||
updateRecord (RecordTypeInfo name fields) = RecordTypeInfo name $ map optChatDir fields
|
||||
in st {recordTypes = map updateRecord records} -- need to map even though there is one constructor in this type
|
||||
|
||||
-- JSON field names drop the "nr" prefix, as NameRecord's deriveJSON does
|
||||
nameRecordType :: SumTypeInfo
|
||||
nameRecordType =
|
||||
let st@(STI _ records) = sti @NameRecord
|
||||
dropNr (FieldInfo n t) = FieldInfo (dropPrefix "nr" n) t
|
||||
updateRecord (RecordTypeInfo name fields) = RecordTypeInfo name $ map dropNr fields
|
||||
in st {recordTypes = map updateRecord records}
|
||||
|
||||
-- type info, JSON encoding, constructor prefix, removed constructors, string encoding for commands, description
|
||||
chatTypesDocsData :: [(SumTypeInfo, SumTypeJsonEncoding, String, [ConsName], Expr, Text)]
|
||||
chatTypesDocsData =
|
||||
@@ -331,6 +339,10 @@ chatTypesDocsData =
|
||||
(sti @MsgSigStatus, STEnum, "MSS", [], "", ""),
|
||||
(sti @MsgVerified, STUnion, "MV", [], "", ""),
|
||||
(sti @NameErrorType, STUnion, "", [], "", ""),
|
||||
(sti @NamePricing, STRecord, "", [], "", ""),
|
||||
(nameRecordType, STRecord, "", [], "", ""),
|
||||
(sti @NameRegistration, STUnion, "NR", [], "", ""),
|
||||
(sti @NameReservedReason, STEnum, "NRR", ["NRRUnknown"], "", ""),
|
||||
(sti @NetworkError, STUnion, "NE", [], "", ""),
|
||||
(sti @NewUser, STRecord, "", [], "", ""),
|
||||
(sti @NoteFolder, STRecord, "", [], "", ""),
|
||||
@@ -571,6 +583,10 @@ deriving instance Generic MsgReceiptStatus
|
||||
deriving instance Generic MsgSigStatus
|
||||
deriving instance Generic MsgVerified
|
||||
deriving instance Generic NameErrorType
|
||||
deriving instance Generic NamePricing
|
||||
deriving instance Generic NameRecord
|
||||
deriving instance Generic NameRegistration
|
||||
deriving instance Generic NameReservedReason
|
||||
deriving instance Generic NetworkError
|
||||
deriving instance Generic NewUser
|
||||
deriving instance Generic NoteFolder
|
||||
|
||||
@@ -169,6 +169,8 @@ toTypeInfo tr =
|
||||
"AgentUserId" -> ST TInt64 []
|
||||
"DBEntityId'" -> ST TInt64 []
|
||||
"Integer" -> ST TInt64 []
|
||||
"RoundedSystemTime" -> ST TInt64 []
|
||||
"USDCents" -> ST TInt64 []
|
||||
"Version" -> ST TInt []
|
||||
"VersionRoster" -> ST TInt64 []
|
||||
"BoolDef" -> ST TBool []
|
||||
|
||||
@@ -0,0 +1,938 @@
|
||||
// API Commands
|
||||
// This file is generated automatically.
|
||||
|
||||
import * as T from "./types"
|
||||
|
||||
import {CR} from "./responses"
|
||||
|
||||
// Address commands
|
||||
// Bots can use these commands to automatically check and create address when initialized
|
||||
|
||||
// Create bot address.
|
||||
// Network usage: interactive.
|
||||
export interface APICreateMyAddress {
|
||||
userId: number // int64
|
||||
pqRatchet?: boolean
|
||||
}
|
||||
|
||||
export namespace APICreateMyAddress {
|
||||
export type Response = CR.UserContactLinkCreated | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APICreateMyAddress): string {
|
||||
return '/_address ' + self.userId + (typeof self.pqRatchet == 'boolean' ? ' pq_ratchet=' + (self.pqRatchet ? 'on' : 'off') : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Delete bot address.
|
||||
// Network usage: background.
|
||||
export interface APIDeleteMyAddress {
|
||||
userId: number // int64
|
||||
}
|
||||
|
||||
export namespace APIDeleteMyAddress {
|
||||
export type Response = CR.UserContactLinkDeleted | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIDeleteMyAddress): string {
|
||||
return '/_delete_address ' + self.userId
|
||||
}
|
||||
}
|
||||
|
||||
// Get bot address and settings.
|
||||
// Network usage: no.
|
||||
export interface APIShowMyAddress {
|
||||
userId: number // int64
|
||||
}
|
||||
|
||||
export namespace APIShowMyAddress {
|
||||
export type Response = CR.UserContactLink | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIShowMyAddress): string {
|
||||
return '/_show_address ' + self.userId
|
||||
}
|
||||
}
|
||||
|
||||
// Add address to bot profile.
|
||||
// Network usage: interactive.
|
||||
export interface APISetProfileAddress {
|
||||
userId: number // int64
|
||||
enable: boolean
|
||||
}
|
||||
|
||||
export namespace APISetProfileAddress {
|
||||
export type Response = CR.UserProfileUpdated | CR.UserProfileNoChange | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APISetProfileAddress): string {
|
||||
return '/_profile_address ' + self.userId + ' ' + (self.enable ? 'on' : 'off')
|
||||
}
|
||||
}
|
||||
|
||||
// Set bot address settings.
|
||||
// Network usage: interactive.
|
||||
export interface APISetAddressSettings {
|
||||
userId: number // int64
|
||||
pqRatchet?: boolean
|
||||
settings: T.AddressSettings
|
||||
}
|
||||
|
||||
export namespace APISetAddressSettings {
|
||||
export type Response = CR.UserContactLinkUpdated | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APISetAddressSettings): string {
|
||||
return '/_address_settings ' + self.userId + (typeof self.pqRatchet == 'boolean' ? ' pq_ratchet=' + (self.pqRatchet ? 'on' : 'off') : '') + ' ' + JSON.stringify(self.settings)
|
||||
}
|
||||
}
|
||||
|
||||
// Message commands
|
||||
// Commands to send, update, delete, moderate messages and set message reactions
|
||||
|
||||
// Send messages.
|
||||
// Network usage: background.
|
||||
export interface APISendMessages {
|
||||
sendRef: T.ChatRef
|
||||
liveMessage: boolean
|
||||
ttl?: number // int
|
||||
signMessages: boolean
|
||||
composedMessages: T.ComposedMessage[] // non-empty
|
||||
}
|
||||
|
||||
export namespace APISendMessages {
|
||||
export type Response = CR.NewChatItems | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APISendMessages): string {
|
||||
return '/_send ' + T.ChatRef.cmdString(self.sendRef) + (self.liveMessage ? ' live=on' : '') + (self.ttl ? ' ttl=' + self.ttl : '') + (self.signMessages ? ' sign=on' : '') + ' json ' + JSON.stringify(self.composedMessages)
|
||||
}
|
||||
}
|
||||
|
||||
// Update message.
|
||||
// Network usage: background.
|
||||
export interface APIUpdateChatItem {
|
||||
chatRef: T.ChatRef
|
||||
chatItemId: number // int64
|
||||
liveMessage: boolean
|
||||
updatedMessage: T.UpdatedMessage
|
||||
}
|
||||
|
||||
export namespace APIUpdateChatItem {
|
||||
export type Response = CR.ChatItemUpdated | CR.ChatItemNotChanged | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIUpdateChatItem): string {
|
||||
return '/_update item ' + T.ChatRef.cmdString(self.chatRef) + ' ' + self.chatItemId + (self.liveMessage ? ' live=on' : '') + ' json ' + JSON.stringify(self.updatedMessage)
|
||||
}
|
||||
}
|
||||
|
||||
// Delete message.
|
||||
// Network usage: background.
|
||||
export interface APIDeleteChatItem {
|
||||
chatRef: T.ChatRef
|
||||
chatItemIds: number[] // int64, non-empty
|
||||
deleteMode: T.CIDeleteMode
|
||||
}
|
||||
|
||||
export namespace APIDeleteChatItem {
|
||||
export type Response = CR.ChatItemsDeleted | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIDeleteChatItem): string {
|
||||
return '/_delete item ' + T.ChatRef.cmdString(self.chatRef) + ' ' + self.chatItemIds.join(',') + ' ' + self.deleteMode
|
||||
}
|
||||
}
|
||||
|
||||
// Moderate message. Requires Moderator role (and higher than message author's).
|
||||
// Network usage: background.
|
||||
export interface APIDeleteMemberChatItem {
|
||||
groupId: number // int64
|
||||
chatItemIds: number[] // int64, non-empty
|
||||
}
|
||||
|
||||
export namespace APIDeleteMemberChatItem {
|
||||
export type Response = CR.ChatItemsDeleted | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIDeleteMemberChatItem): string {
|
||||
return '/_delete member item #' + self.groupId + ' ' + self.chatItemIds.join(',')
|
||||
}
|
||||
}
|
||||
|
||||
// Add/remove message reaction.
|
||||
// Network usage: background.
|
||||
export interface APIChatItemReaction {
|
||||
chatRef: T.ChatRef
|
||||
chatItemId: number // int64
|
||||
add: boolean
|
||||
reaction: T.MsgReaction
|
||||
}
|
||||
|
||||
export namespace APIChatItemReaction {
|
||||
export type Response = CR.ChatItemReaction | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIChatItemReaction): string {
|
||||
return '/_reaction ' + T.ChatRef.cmdString(self.chatRef) + ' ' + self.chatItemId + ' ' + (self.add ? 'on' : 'off') + ' ' + JSON.stringify(self.reaction)
|
||||
}
|
||||
}
|
||||
|
||||
// Share user address card
|
||||
// Network usage: no.
|
||||
export interface APIShareMyAddress {
|
||||
toSendRef: T.ChatRef
|
||||
}
|
||||
|
||||
export namespace APIShareMyAddress {
|
||||
export type Response = CR.ChatMsgContent
|
||||
|
||||
export function cmdString(self: APIShareMyAddress): string {
|
||||
return '/_share address ' + T.ChatRef.cmdString(self.toSendRef)
|
||||
}
|
||||
}
|
||||
|
||||
// Share channel address
|
||||
// Network usage: no.
|
||||
export interface APIShareChatMsgContent {
|
||||
shareChatRef: T.ChatRef
|
||||
toSendRef: T.ChatRef
|
||||
}
|
||||
|
||||
export namespace APIShareChatMsgContent {
|
||||
export type Response = CR.ChatMsgContent
|
||||
|
||||
export function cmdString(self: APIShareChatMsgContent): string {
|
||||
return '/_share chat content ' + T.ChatRef.cmdString(self.shareChatRef) + ' ' + T.ChatRef.cmdString(self.toSendRef)
|
||||
}
|
||||
}
|
||||
|
||||
// File commands
|
||||
// Commands to receive and to cancel files. Files are sent as part of the message, there are no separate commands to send files.
|
||||
|
||||
// Receive file.
|
||||
// Network usage: no.
|
||||
export interface ReceiveFile {
|
||||
fileId: number // int64
|
||||
userApprovedRelays: boolean
|
||||
storeEncrypted?: boolean
|
||||
fileInline?: boolean
|
||||
filePath?: string
|
||||
}
|
||||
|
||||
export namespace ReceiveFile {
|
||||
export type Response = CR.RcvFileAccepted | CR.RcvFileAcceptedSndCancelled | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: ReceiveFile): string {
|
||||
return '/freceive ' + self.fileId + (self.userApprovedRelays ? ' approved_relays=on' : '') + (typeof self.storeEncrypted == 'boolean' ? ' encrypt=' + (self.storeEncrypted ? 'on' : 'off') : '') + (typeof self.fileInline == 'boolean' ? ' inline=' + (self.fileInline ? 'on' : 'off') : '') + (self.filePath ? ' ' + self.filePath : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Cancel file.
|
||||
// Network usage: background.
|
||||
export interface CancelFile {
|
||||
fileId: number // int64
|
||||
}
|
||||
|
||||
export namespace CancelFile {
|
||||
export type Response = CR.SndFileCancelled | CR.RcvFileCancelled | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: CancelFile): string {
|
||||
return '/fcancel ' + self.fileId
|
||||
}
|
||||
}
|
||||
|
||||
// Group commands
|
||||
// Commands to manage and moderate groups. These commands can be used with business chats as well - they are groups. E.g., a common scenario would be to add human agents to business chat with the customer who connected via business address.
|
||||
|
||||
// Add contact to group. Requires bot to have Admin role.
|
||||
// Network usage: interactive.
|
||||
export interface APIAddMember {
|
||||
groupId: number // int64
|
||||
contactId: number // int64
|
||||
memberRole: T.GroupMemberRole
|
||||
}
|
||||
|
||||
export namespace APIAddMember {
|
||||
export type Response = CR.SentGroupInvitation | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIAddMember): string {
|
||||
return '/_add #' + self.groupId + ' ' + self.contactId + ' ' + self.memberRole
|
||||
}
|
||||
}
|
||||
|
||||
// Join group.
|
||||
// Network usage: interactive.
|
||||
export interface APIJoinGroup {
|
||||
groupId: number // int64
|
||||
}
|
||||
|
||||
export namespace APIJoinGroup {
|
||||
export type Response = CR.UserAcceptedGroupSent | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIJoinGroup): string {
|
||||
return '/_join #' + self.groupId
|
||||
}
|
||||
}
|
||||
|
||||
// Accept group member. Requires Admin role.
|
||||
// Network usage: background.
|
||||
export interface APIAcceptMember {
|
||||
groupId: number // int64
|
||||
groupMemberId: number // int64
|
||||
memberRole: T.GroupMemberRole
|
||||
}
|
||||
|
||||
export namespace APIAcceptMember {
|
||||
export type Response = CR.MemberAccepted | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIAcceptMember): string {
|
||||
return '/_accept member #' + self.groupId + ' ' + self.groupMemberId + ' ' + self.memberRole
|
||||
}
|
||||
}
|
||||
|
||||
// Set members role. Requires Admin role.
|
||||
// Network usage: background.
|
||||
export interface APIMembersRole {
|
||||
groupId: number // int64
|
||||
groupMemberIds: number[] // int64, non-empty
|
||||
memberRole: T.GroupMemberRole
|
||||
}
|
||||
|
||||
export namespace APIMembersRole {
|
||||
export type Response = CR.MembersRoleUser | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIMembersRole): string {
|
||||
return '/_member role #' + self.groupId + ' ' + self.groupMemberIds.join(',') + ' ' + self.memberRole
|
||||
}
|
||||
}
|
||||
|
||||
// Block members. Requires Moderator role.
|
||||
// Network usage: background.
|
||||
export interface APIBlockMembersForAll {
|
||||
groupId: number // int64
|
||||
groupMemberIds: number[] // int64, non-empty
|
||||
blocked: boolean
|
||||
}
|
||||
|
||||
export namespace APIBlockMembersForAll {
|
||||
export type Response = CR.MembersBlockedForAllUser | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIBlockMembersForAll): string {
|
||||
return '/_block #' + self.groupId + ' ' + self.groupMemberIds.join(',') + ' blocked=' + (self.blocked ? 'on' : 'off')
|
||||
}
|
||||
}
|
||||
|
||||
// Remove members. Requires Admin role.
|
||||
// Network usage: background.
|
||||
export interface APIRemoveMembers {
|
||||
groupId: number // int64
|
||||
groupMemberIds: number[] // int64, non-empty
|
||||
withMessages: boolean
|
||||
}
|
||||
|
||||
export namespace APIRemoveMembers {
|
||||
export type Response = CR.UserDeletedMembers | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIRemoveMembers): string {
|
||||
return '/_remove #' + self.groupId + ' ' + self.groupMemberIds.join(',') + (self.withMessages ? ' messages=on' : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Leave group.
|
||||
// Network usage: background.
|
||||
export interface APILeaveGroup {
|
||||
groupId: number // int64
|
||||
}
|
||||
|
||||
export namespace APILeaveGroup {
|
||||
export type Response = CR.LeftMemberUser | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APILeaveGroup): string {
|
||||
return '/_leave #' + self.groupId
|
||||
}
|
||||
}
|
||||
|
||||
// Get group members.
|
||||
// Network usage: no.
|
||||
export interface APIListMembers {
|
||||
groupId: number // int64
|
||||
}
|
||||
|
||||
export namespace APIListMembers {
|
||||
export type Response = CR.GroupMembers | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIListMembers): string {
|
||||
return '/_members #' + self.groupId
|
||||
}
|
||||
}
|
||||
|
||||
// Create group.
|
||||
// Network usage: no.
|
||||
export interface APINewGroup {
|
||||
userId: number // int64
|
||||
incognito: boolean
|
||||
groupProfile: T.GroupProfile
|
||||
}
|
||||
|
||||
export namespace APINewGroup {
|
||||
export type Response = CR.GroupCreated | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APINewGroup): string {
|
||||
return '/_group ' + self.userId + (self.incognito ? ' incognito=on' : '') + ' ' + JSON.stringify(self.groupProfile)
|
||||
}
|
||||
}
|
||||
|
||||
// Create public group.
|
||||
// Network usage: interactive.
|
||||
export interface APINewPublicGroup {
|
||||
userId: number // int64
|
||||
incognito: boolean
|
||||
relayIds: number[] // int64, non-empty
|
||||
groupProfile: T.GroupProfile
|
||||
}
|
||||
|
||||
export namespace APINewPublicGroup {
|
||||
export type Response = CR.PublicGroupCreated | CR.PublicGroupCreationFailed | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APINewPublicGroup): string {
|
||||
return '/_public group ' + self.userId + (self.incognito ? ' incognito=on' : '') + ' ' + self.relayIds.join(',') + ' ' + JSON.stringify(self.groupProfile)
|
||||
}
|
||||
}
|
||||
|
||||
// Get group relays.
|
||||
// Network usage: no.
|
||||
export interface APIGetGroupRelays {
|
||||
groupId: number // int64
|
||||
}
|
||||
|
||||
export namespace APIGetGroupRelays {
|
||||
export type Response = CR.GroupRelays | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIGetGroupRelays): string {
|
||||
return '/_get relays #' + self.groupId
|
||||
}
|
||||
}
|
||||
|
||||
// Add relays to group.
|
||||
// Network usage: interactive.
|
||||
export interface APIAddGroupRelays {
|
||||
groupId: number // int64
|
||||
relayIds: number[] // int64, non-empty
|
||||
}
|
||||
|
||||
export namespace APIAddGroupRelays {
|
||||
export type Response = CR.GroupRelaysAdded | CR.GroupRelaysAddFailed | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIAddGroupRelays): string {
|
||||
return '/_add relays #' + self.groupId + ' ' + self.relayIds.join(',')
|
||||
}
|
||||
}
|
||||
|
||||
// Clear relay rejection for a channel (relay operator).
|
||||
// Network usage: background.
|
||||
export interface APIAllowRelayGroup {
|
||||
groupId: number // int64
|
||||
}
|
||||
|
||||
export namespace APIAllowRelayGroup {
|
||||
export type Response = CR.RelayGroupAllowed | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIAllowRelayGroup): string {
|
||||
return '/_relay allow #' + self.groupId
|
||||
}
|
||||
}
|
||||
|
||||
// Update group profile.
|
||||
// Network usage: background.
|
||||
export interface APIUpdateGroupProfile {
|
||||
groupId: number // int64
|
||||
groupProfile: T.GroupProfile
|
||||
}
|
||||
|
||||
export namespace APIUpdateGroupProfile {
|
||||
export type Response = CR.GroupUpdated | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIUpdateGroupProfile): string {
|
||||
return '/_group_profile #' + self.groupId + ' ' + JSON.stringify(self.groupProfile)
|
||||
}
|
||||
}
|
||||
|
||||
// Verify group domain
|
||||
// Network usage: interactive.
|
||||
export interface APIVerifyGroupDomain {
|
||||
groupId: number // int64
|
||||
}
|
||||
|
||||
export namespace APIVerifyGroupDomain {
|
||||
export type Response = CR.GroupDomainVerified
|
||||
|
||||
export function cmdString(self: APIVerifyGroupDomain): string {
|
||||
return '/_verify domain #' + self.groupId
|
||||
}
|
||||
}
|
||||
|
||||
// Group link commands
|
||||
// These commands can be used by bots that manage multiple public groups
|
||||
|
||||
// Create group link.
|
||||
// Network usage: interactive.
|
||||
export interface APICreateGroupLink {
|
||||
groupId: number // int64
|
||||
memberRole: T.GroupMemberRole
|
||||
}
|
||||
|
||||
export namespace APICreateGroupLink {
|
||||
export type Response = CR.GroupLinkCreated | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APICreateGroupLink): string {
|
||||
return '/_create link #' + self.groupId + ' ' + self.memberRole
|
||||
}
|
||||
}
|
||||
|
||||
// Set member role for group link.
|
||||
// Network usage: no.
|
||||
export interface APIGroupLinkMemberRole {
|
||||
groupId: number // int64
|
||||
memberRole: T.GroupMemberRole
|
||||
}
|
||||
|
||||
export namespace APIGroupLinkMemberRole {
|
||||
export type Response = CR.GroupLink | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIGroupLinkMemberRole): string {
|
||||
return '/_set link role #' + self.groupId + ' ' + self.memberRole
|
||||
}
|
||||
}
|
||||
|
||||
// Delete group link.
|
||||
// Network usage: background.
|
||||
export interface APIDeleteGroupLink {
|
||||
groupId: number // int64
|
||||
}
|
||||
|
||||
export namespace APIDeleteGroupLink {
|
||||
export type Response = CR.GroupLinkDeleted | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIDeleteGroupLink): string {
|
||||
return '/_delete link #' + self.groupId
|
||||
}
|
||||
}
|
||||
|
||||
// Get group link.
|
||||
// Network usage: no.
|
||||
export interface APIGetGroupLink {
|
||||
groupId: number // int64
|
||||
}
|
||||
|
||||
export namespace APIGetGroupLink {
|
||||
export type Response = CR.GroupLink | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIGetGroupLink): string {
|
||||
return '/_get link #' + self.groupId
|
||||
}
|
||||
}
|
||||
|
||||
// Connection commands
|
||||
// These commands may be used to create connections. Most bots do not need to use them - bot users will connect via bot address with auto-accept enabled.
|
||||
|
||||
// Create 1-time invitation link.
|
||||
// Network usage: interactive.
|
||||
export interface APIAddContact {
|
||||
userId: number // int64
|
||||
incognito: boolean
|
||||
}
|
||||
|
||||
export namespace APIAddContact {
|
||||
export type Response = CR.Invitation | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIAddContact): string {
|
||||
return '/_connect ' + self.userId + (self.incognito ? ' incognito=on' : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Determine SimpleX link type and if the bot is already connected via this link or name.
|
||||
// Network usage: interactive.
|
||||
export interface APIConnectPlan {
|
||||
userId: number // int64
|
||||
connectTarget?: string
|
||||
resolveMode: T.PlanResolveMode
|
||||
linkOwnerSig?: T.LinkOwnerSig
|
||||
}
|
||||
|
||||
export namespace APIConnectPlan {
|
||||
export type Response = CR.ConnectionPlan | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIConnectPlan): string {
|
||||
return '/_connect plan ' + self.userId + ' ' + self.connectTarget
|
||||
}
|
||||
}
|
||||
|
||||
// Connect via prepared SimpleX link. The link can be 1-time invitation link, contact address or group link.
|
||||
// Network usage: interactive.
|
||||
export interface APIConnect {
|
||||
userId: number // int64
|
||||
incognito: boolean
|
||||
preparedLink_?: T.CreatedConnLink
|
||||
}
|
||||
|
||||
export namespace APIConnect {
|
||||
export type Response = CR.SentConfirmation | CR.ContactAlreadyExists | CR.SentInvitation | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIConnect): string {
|
||||
return '/_connect ' + self.userId + (self.incognito ? ' incognito=on' : '') + (self.preparedLink_ ? ' ' + T.CreatedConnLink.cmdString(self.preparedLink_) : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Connect via SimpleX link or name as string in the active user profile.
|
||||
// Network usage: interactive.
|
||||
export interface Connect {
|
||||
incognito: boolean
|
||||
connTarget_?: string
|
||||
}
|
||||
|
||||
export namespace Connect {
|
||||
export type Response =
|
||||
| CR.SentConfirmation
|
||||
| CR.ContactAlreadyExists
|
||||
| CR.SentInvitation
|
||||
| CR.ConnectionPlan
|
||||
| CR.SentInvitationToContact
|
||||
| CR.StartedConnectionToContact
|
||||
| CR.StartedConnectionToGroup
|
||||
| CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: Connect): string {
|
||||
return '/connect' + (self.connTarget_ ? ' ' + self.connTarget_ : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Accept contact request.
|
||||
// Network usage: interactive.
|
||||
export interface APIAcceptContact {
|
||||
contactReqId: number // int64
|
||||
}
|
||||
|
||||
export namespace APIAcceptContact {
|
||||
export type Response = CR.AcceptingContactRequest | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIAcceptContact): string {
|
||||
return '/_accept ' + self.contactReqId
|
||||
}
|
||||
}
|
||||
|
||||
// Reject contact request. The user who sent the request is **not notified**.
|
||||
// Network usage: no.
|
||||
export interface APIRejectContact {
|
||||
contactReqId: number // int64
|
||||
notify: boolean
|
||||
}
|
||||
|
||||
export namespace APIRejectContact {
|
||||
export type Response = CR.ContactRequestRejected | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIRejectContact): string {
|
||||
return '/_reject ' + self.contactReqId
|
||||
}
|
||||
}
|
||||
|
||||
// Chat commands
|
||||
// Commands to list and delete conversations.
|
||||
|
||||
// Get contacts.
|
||||
// Network usage: no.
|
||||
export interface APIListContacts {
|
||||
userId: number // int64
|
||||
}
|
||||
|
||||
export namespace APIListContacts {
|
||||
export type Response = CR.ContactsList | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIListContacts): string {
|
||||
return '/_contacts ' + self.userId
|
||||
}
|
||||
}
|
||||
|
||||
// Get groups.
|
||||
// Network usage: no.
|
||||
export interface APIListGroups {
|
||||
userId: number // int64
|
||||
contactId_?: number // int64
|
||||
search?: string
|
||||
}
|
||||
|
||||
export namespace APIListGroups {
|
||||
export type Response = CR.GroupsList | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIListGroups): string {
|
||||
return '/_groups ' + self.userId + (self.contactId_ ? ' @' + self.contactId_ : '') + (self.search ? ' ' + self.search : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Get chat previews. Supports time-based pagination — use this instead of APIListContacts / APIListGroups when scanning at scale (those load every record into memory and fail on large databases).
|
||||
// Network usage: no.
|
||||
export interface APIGetChats {
|
||||
userId: number // int64
|
||||
pendingConnections: boolean
|
||||
pagination?: T.PaginationByTime
|
||||
query: T.ChatListQuery
|
||||
}
|
||||
|
||||
export namespace APIGetChats {
|
||||
export type Response = CR.ApiChats | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIGetChats): string {
|
||||
return '/_get chats ' + self.userId + (self.pendingConnections ? ' pcc=on' : '') + (self.pagination ? ' ' + T.PaginationByTime.cmdString(self.pagination) : '') + ' ' + JSON.stringify(self.query)
|
||||
}
|
||||
}
|
||||
|
||||
// Delete chat.
|
||||
// Network usage: background.
|
||||
export interface APIDeleteChat {
|
||||
chatRef: T.ChatRef
|
||||
chatDeleteMode: T.ChatDeleteMode
|
||||
}
|
||||
|
||||
export namespace APIDeleteChat {
|
||||
export type Response = CR.ContactDeleted | CR.ContactConnectionDeleted | CR.GroupDeletedUser | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIDeleteChat): string {
|
||||
return '/_delete ' + T.ChatRef.cmdString(self.chatRef) + ' ' + T.ChatDeleteMode.cmdString(self.chatDeleteMode)
|
||||
}
|
||||
}
|
||||
|
||||
// Set group custom data.
|
||||
// Network usage: no.
|
||||
export interface APISetGroupCustomData {
|
||||
groupId: number // int64
|
||||
customData?: object
|
||||
}
|
||||
|
||||
export namespace APISetGroupCustomData {
|
||||
export type Response = CR.CmdOk | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APISetGroupCustomData): string {
|
||||
return '/_set custom #' + self.groupId + (self.customData ? ' ' + JSON.stringify(self.customData) : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Set contact custom data.
|
||||
// Network usage: no.
|
||||
export interface APISetContactCustomData {
|
||||
contactId: number // int64
|
||||
customData?: object
|
||||
}
|
||||
|
||||
export namespace APISetContactCustomData {
|
||||
export type Response = CR.CmdOk | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APISetContactCustomData): string {
|
||||
return '/_set custom @' + self.contactId + (self.customData ? ' ' + JSON.stringify(self.customData) : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Set auto-accept member contacts.
|
||||
// Network usage: no.
|
||||
export interface APISetUserAutoAcceptMemberContacts {
|
||||
userId: number // int64
|
||||
onOff: boolean
|
||||
}
|
||||
|
||||
export namespace APISetUserAutoAcceptMemberContacts {
|
||||
export type Response = CR.CmdOk | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APISetUserAutoAcceptMemberContacts): string {
|
||||
return '/_set accept member contacts ' + self.userId + ' ' + (self.onOff ? 'on' : 'off')
|
||||
}
|
||||
}
|
||||
|
||||
// Set auto-accept group invitations.
|
||||
// Network usage: no.
|
||||
export interface APISetUserAutoAcceptGroupInvitations {
|
||||
userId: number // int64
|
||||
onOff: boolean
|
||||
}
|
||||
|
||||
export namespace APISetUserAutoAcceptGroupInvitations {
|
||||
export type Response = CR.CmdOk | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APISetUserAutoAcceptGroupInvitations): string {
|
||||
return '/_set accept group invitations ' + self.userId + ' ' + (self.onOff ? 'on' : 'off')
|
||||
}
|
||||
}
|
||||
|
||||
// User profile commands
|
||||
// Most bots don't need to use these commands, as bot profile can be configured manually via CLI or desktop client. These commands can be used by bots that need to manage multiple user profiles (e.g., the profiles of support agents).
|
||||
|
||||
// Get active user profile.
|
||||
// Network usage: no.
|
||||
export interface ShowActiveUser {
|
||||
}
|
||||
|
||||
export namespace ShowActiveUser {
|
||||
export type Response = CR.ActiveUser | CR.ChatCmdError
|
||||
|
||||
export function cmdString(_self: ShowActiveUser): string {
|
||||
return '/user'
|
||||
}
|
||||
}
|
||||
|
||||
// Create new user profile.
|
||||
// Network usage: no.
|
||||
export interface CreateActiveUser {
|
||||
newUser: T.NewUser
|
||||
}
|
||||
|
||||
export namespace CreateActiveUser {
|
||||
export type Response = CR.ActiveUser | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: CreateActiveUser): string {
|
||||
return '/_create user ' + JSON.stringify(self.newUser)
|
||||
}
|
||||
}
|
||||
|
||||
// Get all user profiles.
|
||||
// Network usage: no.
|
||||
export interface ListUsers {
|
||||
}
|
||||
|
||||
export namespace ListUsers {
|
||||
export type Response = CR.UsersList | CR.ChatCmdError
|
||||
|
||||
export function cmdString(_self: ListUsers): string {
|
||||
return '/users'
|
||||
}
|
||||
}
|
||||
|
||||
// Set active user profile.
|
||||
// Network usage: no.
|
||||
export interface APISetActiveUser {
|
||||
userId: number // int64
|
||||
viewPwd?: string
|
||||
}
|
||||
|
||||
export namespace APISetActiveUser {
|
||||
export type Response = CR.ActiveUser | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APISetActiveUser): string {
|
||||
return '/_user ' + self.userId + (self.viewPwd ? ' ' + JSON.stringify(self.viewPwd) : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Delete user profile.
|
||||
// Network usage: background.
|
||||
export interface APIDeleteUser {
|
||||
userId: number // int64
|
||||
delSMPQueues: boolean
|
||||
viewPwd?: string
|
||||
}
|
||||
|
||||
export namespace APIDeleteUser {
|
||||
export type Response = CR.CmdOk | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIDeleteUser): string {
|
||||
return '/_delete user ' + self.userId + ' del_smp=' + (self.delSMPQueues ? 'on' : 'off') + (self.viewPwd ? ' ' + JSON.stringify(self.viewPwd) : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Update user profile.
|
||||
// Network usage: background.
|
||||
export interface APIUpdateProfile {
|
||||
userId: number // int64
|
||||
profile: T.Profile
|
||||
}
|
||||
|
||||
export namespace APIUpdateProfile {
|
||||
export type Response = CR.UserProfileUpdated | CR.UserProfileNoChange | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APIUpdateProfile): string {
|
||||
return '/_profile ' + self.userId + ' ' + JSON.stringify(self.profile)
|
||||
}
|
||||
}
|
||||
|
||||
// Configure chat preference overrides for the contact.
|
||||
// Network usage: background.
|
||||
export interface APISetContactPrefs {
|
||||
contactId: number // int64
|
||||
preferences: T.Preferences
|
||||
}
|
||||
|
||||
export namespace APISetContactPrefs {
|
||||
export type Response = CR.ContactPrefsUpdated | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APISetContactPrefs): string {
|
||||
return '/_set prefs @' + self.contactId + ' ' + JSON.stringify(self.preferences)
|
||||
}
|
||||
}
|
||||
|
||||
// Service commands
|
||||
// Bots with a double ratchet address can answer service requests.
|
||||
|
||||
// Send a reply to a received service request. Returns the connection ID that correlates the reply delivery event.
|
||||
// Network usage: background.
|
||||
export interface APISendServiceResponse {
|
||||
userId: number // int64
|
||||
requestId: string
|
||||
responseData: object
|
||||
}
|
||||
|
||||
export namespace APISendServiceResponse {
|
||||
export type Response = CR.ServiceReplyAccepted | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: APISendServiceResponse): string {
|
||||
return '/_service_response ' + self.userId + ' ' + self.requestId + ' ' + JSON.stringify(self.responseData)
|
||||
}
|
||||
}
|
||||
|
||||
// Chat management
|
||||
// These commands should not be used with CLI-based bots
|
||||
|
||||
// Start chat controller.
|
||||
// Network usage: no.
|
||||
export interface StartChat {
|
||||
mainApp: boolean
|
||||
enableSndFiles: boolean
|
||||
serviceRequests: boolean
|
||||
}
|
||||
|
||||
export namespace StartChat {
|
||||
export type Response = CR.ChatStarted | CR.ChatRunning
|
||||
|
||||
export function cmdString(self: StartChat): string {
|
||||
return '/_start main=' + (self.mainApp ? 'on' : 'off') + (!self.enableSndFiles ? ' snd_files=off' : '') + (self.serviceRequests ? ' service_requests=on' : '')
|
||||
}
|
||||
}
|
||||
|
||||
// Stop chat controller.
|
||||
// Network usage: no.
|
||||
export interface APIStopChat {
|
||||
}
|
||||
|
||||
export namespace APIStopChat {
|
||||
export type Response = CR.ChatStopped
|
||||
|
||||
export function cmdString(_self: APIStopChat): string {
|
||||
return '/_stop'
|
||||
}
|
||||
}
|
||||
|
||||
// Remote control commands
|
||||
// Allows a bot to accept an incoming remote control session from a SimpleX Desktop client, giving the desktop live access to the bot's SimpleX instance.
|
||||
|
||||
// Connect to a remote controller using an OOB invitation link.
|
||||
// Network usage: interactive.
|
||||
export interface ConnectRemoteCtrl {
|
||||
remoteInvitation: string
|
||||
}
|
||||
|
||||
export namespace ConnectRemoteCtrl {
|
||||
export type Response = CR.RemoteCtrlConnecting | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: ConnectRemoteCtrl): string {
|
||||
return '/crc ' + self.remoteInvitation
|
||||
}
|
||||
}
|
||||
|
||||
// Verify the remote controller session code to complete the connection.
|
||||
// Network usage: no.
|
||||
export interface VerifyRemoteCtrlSession {
|
||||
sessionCode: string
|
||||
}
|
||||
|
||||
export namespace VerifyRemoteCtrlSession {
|
||||
export type Response = CR.RemoteCtrlConnected | CR.ChatCmdError
|
||||
|
||||
export function cmdString(self: VerifyRemoteCtrlSession): string {
|
||||
return '/verify remote ctrl ' + self.sessionCode
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,506 @@
|
||||
// API Events
|
||||
// This file is generated automatically.
|
||||
|
||||
import * as T from "./types"
|
||||
|
||||
export type ChatEvent =
|
||||
| CEvt.ContactConnected
|
||||
| CEvt.ContactUpdated
|
||||
| CEvt.ContactDeletedByContact
|
||||
| CEvt.ReceivedContactRequest
|
||||
| CEvt.NewMemberContactReceivedInv
|
||||
| CEvt.ContactSndReady
|
||||
| CEvt.NewChatItems
|
||||
| CEvt.ChatItemReaction
|
||||
| CEvt.ChatItemsDeleted
|
||||
| CEvt.ChatItemUpdated
|
||||
| CEvt.GroupChatItemsDeleted
|
||||
| CEvt.ChatItemsStatusesUpdated
|
||||
| CEvt.ReceivedGroupInvitation
|
||||
| CEvt.UserJoinedGroup
|
||||
| CEvt.GroupUpdated
|
||||
| CEvt.JoinedGroupMember
|
||||
| CEvt.MemberRole
|
||||
| CEvt.DeletedMember
|
||||
| CEvt.LeftMember
|
||||
| CEvt.DeletedMemberUser
|
||||
| CEvt.GroupDeleted
|
||||
| CEvt.ConnectedToGroupMember
|
||||
| CEvt.MemberAcceptedByOther
|
||||
| CEvt.MemberBlockedForAll
|
||||
| CEvt.GroupMemberUpdated
|
||||
| CEvt.GroupLinkDataUpdated
|
||||
| CEvt.GroupRelayUpdated
|
||||
| CEvt.RcvFileDescrReady
|
||||
| CEvt.RcvFileComplete
|
||||
| CEvt.SndFileCompleteXFTP
|
||||
| CEvt.RcvFileStart
|
||||
| CEvt.RcvFileSndCancelled
|
||||
| CEvt.RcvFileAccepted
|
||||
| CEvt.RcvFileError
|
||||
| CEvt.RcvFileWarning
|
||||
| CEvt.SndFileError
|
||||
| CEvt.SndFileWarning
|
||||
| CEvt.AcceptingContactRequest
|
||||
| CEvt.AcceptingBusinessRequest
|
||||
| CEvt.ContactConnecting
|
||||
| CEvt.BusinessLinkConnecting
|
||||
| CEvt.JoinedGroupMemberConnecting
|
||||
| CEvt.GroupLinkConnecting
|
||||
| CEvt.HostConnected
|
||||
| CEvt.HostDisconnected
|
||||
| CEvt.SubscriptionStatus
|
||||
| CEvt.ServiceRequest
|
||||
| CEvt.ServiceReplySent
|
||||
| CEvt.RemoteCtrlSessionCode
|
||||
| CEvt.RemoteCtrlStopped
|
||||
| CEvt.MessageError
|
||||
| CEvt.ChatError
|
||||
| CEvt.ChatErrors
|
||||
|
||||
export namespace CEvt {
|
||||
export type Tag =
|
||||
| "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"
|
||||
| "groupLinkConnecting"
|
||||
| "hostConnected"
|
||||
| "hostDisconnected"
|
||||
| "subscriptionStatus"
|
||||
| "serviceRequest"
|
||||
| "serviceReplySent"
|
||||
| "remoteCtrlSessionCode"
|
||||
| "remoteCtrlStopped"
|
||||
| "messageError"
|
||||
| "chatError"
|
||||
| "chatErrors"
|
||||
|
||||
interface Interface {
|
||||
type: Tag
|
||||
}
|
||||
|
||||
export interface ContactConnected extends Interface {
|
||||
type: "contactConnected"
|
||||
user: T.User
|
||||
contact: T.Contact
|
||||
userCustomProfile?: T.Profile
|
||||
}
|
||||
|
||||
export interface ContactUpdated extends Interface {
|
||||
type: "contactUpdated"
|
||||
user: T.User
|
||||
fromContact: T.Contact
|
||||
toContact: T.Contact
|
||||
}
|
||||
|
||||
export interface ContactDeletedByContact extends Interface {
|
||||
type: "contactDeletedByContact"
|
||||
user: T.User
|
||||
contact: T.Contact
|
||||
}
|
||||
|
||||
export interface ReceivedContactRequest extends Interface {
|
||||
type: "receivedContactRequest"
|
||||
user: T.User
|
||||
contactRequest: T.UserContactRequest
|
||||
chat_?: T.AChat
|
||||
}
|
||||
|
||||
export interface NewMemberContactReceivedInv extends Interface {
|
||||
type: "newMemberContactReceivedInv"
|
||||
user: T.User
|
||||
contact: T.Contact
|
||||
groupInfo: T.GroupInfo
|
||||
member: T.GroupMember
|
||||
}
|
||||
|
||||
export interface ContactSndReady extends Interface {
|
||||
type: "contactSndReady"
|
||||
user: T.User
|
||||
contact: T.Contact
|
||||
}
|
||||
|
||||
export interface NewChatItems extends Interface {
|
||||
type: "newChatItems"
|
||||
user: T.User
|
||||
chatItems: T.AChatItem[]
|
||||
}
|
||||
|
||||
export interface ChatItemReaction extends Interface {
|
||||
type: "chatItemReaction"
|
||||
user: T.User
|
||||
added: boolean
|
||||
reaction: T.ACIReaction
|
||||
}
|
||||
|
||||
export interface ChatItemsDeleted extends Interface {
|
||||
type: "chatItemsDeleted"
|
||||
user: T.User
|
||||
chatItemDeletions: T.ChatItemDeletion[]
|
||||
byUser: boolean
|
||||
timed: boolean
|
||||
}
|
||||
|
||||
export interface ChatItemUpdated extends Interface {
|
||||
type: "chatItemUpdated"
|
||||
user: T.User
|
||||
chatItem: T.AChatItem
|
||||
}
|
||||
|
||||
export interface GroupChatItemsDeleted extends Interface {
|
||||
type: "groupChatItemsDeleted"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
chatItemIDs: number[] // int64
|
||||
byUser: boolean
|
||||
member_?: T.GroupMember
|
||||
}
|
||||
|
||||
export interface ChatItemsStatusesUpdated extends Interface {
|
||||
type: "chatItemsStatusesUpdated"
|
||||
user: T.User
|
||||
chatItems: T.AChatItem[]
|
||||
}
|
||||
|
||||
export interface ReceivedGroupInvitation extends Interface {
|
||||
type: "receivedGroupInvitation"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
contact: T.Contact
|
||||
fromMemberRole: T.GroupMemberRole
|
||||
memberRole: T.GroupMemberRole
|
||||
}
|
||||
|
||||
export interface UserJoinedGroup extends Interface {
|
||||
type: "userJoinedGroup"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
hostMember: T.GroupMember
|
||||
}
|
||||
|
||||
export interface GroupUpdated extends Interface {
|
||||
type: "groupUpdated"
|
||||
user: T.User
|
||||
fromGroup: T.GroupInfo
|
||||
toGroup: T.GroupInfo
|
||||
member_?: T.GroupMember
|
||||
msgSigned?: T.MsgSigStatus
|
||||
}
|
||||
|
||||
export interface JoinedGroupMember extends Interface {
|
||||
type: "joinedGroupMember"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
member: T.GroupMember
|
||||
}
|
||||
|
||||
export interface MemberRole extends Interface {
|
||||
type: "memberRole"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
byMember: T.GroupMember
|
||||
member: T.GroupMember
|
||||
fromRole: T.GroupMemberRole
|
||||
toRole: T.GroupMemberRole
|
||||
msgSigned?: T.MsgSigStatus
|
||||
}
|
||||
|
||||
export interface DeletedMember extends Interface {
|
||||
type: "deletedMember"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
byMember: T.GroupMember
|
||||
deletedMember: T.GroupMember
|
||||
withMessages: boolean
|
||||
msgSigned?: T.MsgSigStatus
|
||||
}
|
||||
|
||||
export interface LeftMember extends Interface {
|
||||
type: "leftMember"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
member: T.GroupMember
|
||||
msgSigned?: T.MsgSigStatus
|
||||
}
|
||||
|
||||
export interface DeletedMemberUser extends Interface {
|
||||
type: "deletedMemberUser"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
member: T.GroupMember
|
||||
withMessages: boolean
|
||||
msgSigned?: T.MsgSigStatus
|
||||
}
|
||||
|
||||
export interface GroupDeleted extends Interface {
|
||||
type: "groupDeleted"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
member: T.GroupMember
|
||||
msgSigned?: T.MsgSigStatus
|
||||
}
|
||||
|
||||
export interface ConnectedToGroupMember extends Interface {
|
||||
type: "connectedToGroupMember"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
member: T.GroupMember
|
||||
memberContact?: T.Contact
|
||||
}
|
||||
|
||||
export interface MemberAcceptedByOther extends Interface {
|
||||
type: "memberAcceptedByOther"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
acceptingMember: T.GroupMember
|
||||
member: T.GroupMember
|
||||
}
|
||||
|
||||
export interface MemberBlockedForAll extends Interface {
|
||||
type: "memberBlockedForAll"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
byMember: T.GroupMember
|
||||
member: T.GroupMember
|
||||
blocked: boolean
|
||||
msgSigned?: T.MsgSigStatus
|
||||
}
|
||||
|
||||
export interface GroupMemberUpdated extends Interface {
|
||||
type: "groupMemberUpdated"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
fromMember: T.GroupMember
|
||||
toMember: T.GroupMember
|
||||
}
|
||||
|
||||
export interface GroupLinkDataUpdated extends Interface {
|
||||
type: "groupLinkDataUpdated"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
groupLink: T.GroupLink
|
||||
groupRelays: T.GroupRelay[]
|
||||
relaysChanged: boolean
|
||||
}
|
||||
|
||||
export interface GroupRelayUpdated extends Interface {
|
||||
type: "groupRelayUpdated"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
member: T.GroupMember
|
||||
groupRelay: T.GroupRelay
|
||||
}
|
||||
|
||||
export interface RcvFileDescrReady extends Interface {
|
||||
type: "rcvFileDescrReady"
|
||||
user: T.User
|
||||
chatItem: T.AChatItem
|
||||
rcvFileTransfer: T.RcvFileTransfer
|
||||
rcvFileDescr: T.RcvFileDescr
|
||||
}
|
||||
|
||||
export interface RcvFileComplete extends Interface {
|
||||
type: "rcvFileComplete"
|
||||
user: T.User
|
||||
chatItem: T.AChatItem
|
||||
}
|
||||
|
||||
export interface SndFileCompleteXFTP extends Interface {
|
||||
type: "sndFileCompleteXFTP"
|
||||
user: T.User
|
||||
chatItem: T.AChatItem
|
||||
fileTransferMeta: T.FileTransferMeta
|
||||
}
|
||||
|
||||
export interface RcvFileStart extends Interface {
|
||||
type: "rcvFileStart"
|
||||
user: T.User
|
||||
chatItem: T.AChatItem
|
||||
}
|
||||
|
||||
export interface RcvFileSndCancelled extends Interface {
|
||||
type: "rcvFileSndCancelled"
|
||||
user: T.User
|
||||
chatItem: T.AChatItem
|
||||
rcvFileTransfer: T.RcvFileTransfer
|
||||
}
|
||||
|
||||
export interface RcvFileAccepted extends Interface {
|
||||
type: "rcvFileAccepted"
|
||||
user: T.User
|
||||
chatItem: T.AChatItem
|
||||
}
|
||||
|
||||
export interface RcvFileError extends Interface {
|
||||
type: "rcvFileError"
|
||||
user: T.User
|
||||
chatItem_?: T.AChatItem
|
||||
agentError: T.AgentErrorType
|
||||
rcvFileTransfer: T.RcvFileTransfer
|
||||
}
|
||||
|
||||
export interface RcvFileWarning extends Interface {
|
||||
type: "rcvFileWarning"
|
||||
user: T.User
|
||||
chatItem_?: T.AChatItem
|
||||
agentError: T.AgentErrorType
|
||||
rcvFileTransfer: T.RcvFileTransfer
|
||||
}
|
||||
|
||||
export interface SndFileError extends Interface {
|
||||
type: "sndFileError"
|
||||
user: T.User
|
||||
chatItem_?: T.AChatItem
|
||||
fileTransferMeta: T.FileTransferMeta
|
||||
errorMessage: string
|
||||
}
|
||||
|
||||
export interface SndFileWarning extends Interface {
|
||||
type: "sndFileWarning"
|
||||
user: T.User
|
||||
chatItem_?: T.AChatItem
|
||||
fileTransferMeta: T.FileTransferMeta
|
||||
errorMessage: string
|
||||
}
|
||||
|
||||
export interface AcceptingContactRequest extends Interface {
|
||||
type: "acceptingContactRequest"
|
||||
user: T.User
|
||||
contact: T.Contact
|
||||
}
|
||||
|
||||
export interface AcceptingBusinessRequest extends Interface {
|
||||
type: "acceptingBusinessRequest"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
}
|
||||
|
||||
export interface ContactConnecting extends Interface {
|
||||
type: "contactConnecting"
|
||||
user: T.User
|
||||
contact: T.Contact
|
||||
}
|
||||
|
||||
export interface BusinessLinkConnecting extends Interface {
|
||||
type: "businessLinkConnecting"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
hostMember: T.GroupMember
|
||||
fromContact: T.Contact
|
||||
}
|
||||
|
||||
export interface JoinedGroupMemberConnecting extends Interface {
|
||||
type: "joinedGroupMemberConnecting"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
hostMember: T.GroupMember
|
||||
member: T.GroupMember
|
||||
}
|
||||
|
||||
export interface GroupLinkConnecting extends Interface {
|
||||
type: "groupLinkConnecting"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
hostMember: T.GroupMember
|
||||
}
|
||||
|
||||
export interface HostConnected extends Interface {
|
||||
type: "hostConnected"
|
||||
protocol: string
|
||||
transportHost: string
|
||||
}
|
||||
|
||||
export interface HostDisconnected extends Interface {
|
||||
type: "hostDisconnected"
|
||||
protocol: string
|
||||
transportHost: string
|
||||
}
|
||||
|
||||
export interface SubscriptionStatus extends Interface {
|
||||
type: "subscriptionStatus"
|
||||
server: string
|
||||
subscriptionStatus: T.SubscriptionStatus
|
||||
connections: string[]
|
||||
}
|
||||
|
||||
export interface ServiceRequest extends Interface {
|
||||
type: "serviceRequest"
|
||||
user: T.User
|
||||
requestId: string
|
||||
signerKey?: string
|
||||
requestData: object
|
||||
}
|
||||
|
||||
export interface ServiceReplySent extends Interface {
|
||||
type: "serviceReplySent"
|
||||
connectionId: string
|
||||
}
|
||||
|
||||
export interface RemoteCtrlSessionCode extends Interface {
|
||||
type: "remoteCtrlSessionCode"
|
||||
remoteCtrl_?: T.RemoteCtrlInfo
|
||||
sessionCode: string
|
||||
}
|
||||
|
||||
export interface RemoteCtrlStopped extends Interface {
|
||||
type: "remoteCtrlStopped"
|
||||
rcsState: T.RemoteCtrlSessionState
|
||||
rcStopReason: T.RemoteCtrlStopReason
|
||||
}
|
||||
|
||||
export interface MessageError extends Interface {
|
||||
type: "messageError"
|
||||
user: T.User
|
||||
severity: string
|
||||
errorMessage: string
|
||||
}
|
||||
|
||||
export interface ChatError extends Interface {
|
||||
type: "chatError"
|
||||
chatError: T.ChatError
|
||||
}
|
||||
|
||||
export interface ChatErrors extends Interface {
|
||||
type: "chatErrors"
|
||||
chatErrors: T.ChatError[]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,553 @@
|
||||
// API Responses
|
||||
// This file is generated automatically.
|
||||
|
||||
import * as T from "./types"
|
||||
|
||||
export type ChatResponse =
|
||||
| CR.AcceptingContactRequest
|
||||
| CR.ActiveUser
|
||||
| CR.ChatItemNotChanged
|
||||
| CR.ChatItemReaction
|
||||
| CR.ChatItemUpdated
|
||||
| CR.ChatItemsDeleted
|
||||
| CR.ChatMsgContent
|
||||
| CR.ChatRunning
|
||||
| CR.ChatStarted
|
||||
| CR.ChatStopped
|
||||
| CR.CmdOk
|
||||
| CR.ChatCmdError
|
||||
| CR.ConnectionPlan
|
||||
| CR.ContactAlreadyExists
|
||||
| CR.ContactConnectionDeleted
|
||||
| CR.ContactDeleted
|
||||
| CR.ContactPrefsUpdated
|
||||
| CR.ContactRequestRejected
|
||||
| CR.ContactsList
|
||||
| CR.GroupDeletedUser
|
||||
| CR.GroupLink
|
||||
| CR.GroupLinkCreated
|
||||
| CR.GroupLinkDeleted
|
||||
| CR.GroupCreated
|
||||
| CR.PublicGroupCreated
|
||||
| CR.PublicGroupCreationFailed
|
||||
| CR.GroupRelays
|
||||
| CR.GroupRelaysAdded
|
||||
| CR.GroupRelaysAddFailed
|
||||
| CR.RelayGroupAllowed
|
||||
| CR.GroupMembers
|
||||
| CR.GroupUpdated
|
||||
| CR.GroupsList
|
||||
| CR.GroupDomainVerified
|
||||
| CR.Invitation
|
||||
| CR.LeftMemberUser
|
||||
| CR.MemberAccepted
|
||||
| CR.MembersBlockedForAllUser
|
||||
| CR.MembersRoleUser
|
||||
| CR.NewChatItems
|
||||
| CR.RcvFileAccepted
|
||||
| CR.RcvFileAcceptedSndCancelled
|
||||
| CR.RcvFileCancelled
|
||||
| CR.RemoteCtrlConnected
|
||||
| CR.RemoteCtrlConnecting
|
||||
| CR.SentConfirmation
|
||||
| CR.SentGroupInvitation
|
||||
| CR.SentInvitation
|
||||
| CR.SentInvitationToContact
|
||||
| CR.ServiceReplyAccepted
|
||||
| CR.SndFileCancelled
|
||||
| CR.StartedConnectionToContact
|
||||
| CR.StartedConnectionToGroup
|
||||
| CR.UserAcceptedGroupSent
|
||||
| CR.UserContactLink
|
||||
| CR.UserContactLinkCreated
|
||||
| CR.UserContactLinkDeleted
|
||||
| CR.UserContactLinkUpdated
|
||||
| CR.UserDeletedMembers
|
||||
| CR.UserProfileUpdated
|
||||
| CR.UserProfileNoChange
|
||||
| CR.UsersList
|
||||
| CR.ApiChats
|
||||
|
||||
export namespace CR {
|
||||
export type Tag =
|
||||
| "acceptingContactRequest"
|
||||
| "activeUser"
|
||||
| "chatItemNotChanged"
|
||||
| "chatItemReaction"
|
||||
| "chatItemUpdated"
|
||||
| "chatItemsDeleted"
|
||||
| "chatMsgContent"
|
||||
| "chatRunning"
|
||||
| "chatStarted"
|
||||
| "chatStopped"
|
||||
| "cmdOk"
|
||||
| "chatCmdError"
|
||||
| "connectionPlan"
|
||||
| "contactAlreadyExists"
|
||||
| "contactConnectionDeleted"
|
||||
| "contactDeleted"
|
||||
| "contactPrefsUpdated"
|
||||
| "contactRequestRejected"
|
||||
| "contactsList"
|
||||
| "groupDeletedUser"
|
||||
| "groupLink"
|
||||
| "groupLinkCreated"
|
||||
| "groupLinkDeleted"
|
||||
| "groupCreated"
|
||||
| "publicGroupCreated"
|
||||
| "publicGroupCreationFailed"
|
||||
| "groupRelays"
|
||||
| "groupRelaysAdded"
|
||||
| "groupRelaysAddFailed"
|
||||
| "relayGroupAllowed"
|
||||
| "groupMembers"
|
||||
| "groupUpdated"
|
||||
| "groupsList"
|
||||
| "groupDomainVerified"
|
||||
| "invitation"
|
||||
| "leftMemberUser"
|
||||
| "memberAccepted"
|
||||
| "membersBlockedForAllUser"
|
||||
| "membersRoleUser"
|
||||
| "newChatItems"
|
||||
| "rcvFileAccepted"
|
||||
| "rcvFileAcceptedSndCancelled"
|
||||
| "rcvFileCancelled"
|
||||
| "remoteCtrlConnected"
|
||||
| "remoteCtrlConnecting"
|
||||
| "sentConfirmation"
|
||||
| "sentGroupInvitation"
|
||||
| "sentInvitation"
|
||||
| "sentInvitationToContact"
|
||||
| "serviceReplyAccepted"
|
||||
| "sndFileCancelled"
|
||||
| "startedConnectionToContact"
|
||||
| "startedConnectionToGroup"
|
||||
| "userAcceptedGroupSent"
|
||||
| "userContactLink"
|
||||
| "userContactLinkCreated"
|
||||
| "userContactLinkDeleted"
|
||||
| "userContactLinkUpdated"
|
||||
| "userDeletedMembers"
|
||||
| "userProfileUpdated"
|
||||
| "userProfileNoChange"
|
||||
| "usersList"
|
||||
| "apiChats"
|
||||
|
||||
interface Interface {
|
||||
type: Tag
|
||||
}
|
||||
|
||||
export interface AcceptingContactRequest extends Interface {
|
||||
type: "acceptingContactRequest"
|
||||
user: T.User
|
||||
contact: T.Contact
|
||||
}
|
||||
|
||||
export interface ActiveUser extends Interface {
|
||||
type: "activeUser"
|
||||
user: T.User
|
||||
}
|
||||
|
||||
export interface ChatItemNotChanged extends Interface {
|
||||
type: "chatItemNotChanged"
|
||||
user: T.User
|
||||
chatItem: T.AChatItem
|
||||
}
|
||||
|
||||
export interface ChatItemReaction extends Interface {
|
||||
type: "chatItemReaction"
|
||||
user: T.User
|
||||
added: boolean
|
||||
reaction: T.ACIReaction
|
||||
}
|
||||
|
||||
export interface ChatItemUpdated extends Interface {
|
||||
type: "chatItemUpdated"
|
||||
user: T.User
|
||||
chatItem: T.AChatItem
|
||||
}
|
||||
|
||||
export interface ChatItemsDeleted extends Interface {
|
||||
type: "chatItemsDeleted"
|
||||
user: T.User
|
||||
chatItemDeletions: T.ChatItemDeletion[]
|
||||
byUser: boolean
|
||||
timed: boolean
|
||||
}
|
||||
|
||||
export interface ChatMsgContent extends Interface {
|
||||
type: "chatMsgContent"
|
||||
user: T.User
|
||||
msgContent: T.MsgContent
|
||||
}
|
||||
|
||||
export interface ChatRunning extends Interface {
|
||||
type: "chatRunning"
|
||||
}
|
||||
|
||||
export interface ChatStarted extends Interface {
|
||||
type: "chatStarted"
|
||||
}
|
||||
|
||||
export interface ChatStopped extends Interface {
|
||||
type: "chatStopped"
|
||||
}
|
||||
|
||||
export interface CmdOk extends Interface {
|
||||
type: "cmdOk"
|
||||
user_?: T.User
|
||||
}
|
||||
|
||||
export interface ChatCmdError extends Interface {
|
||||
type: "chatCmdError"
|
||||
chatError: T.ChatError
|
||||
}
|
||||
|
||||
export interface ConnectionPlan extends Interface {
|
||||
type: "connectionPlan"
|
||||
user: T.User
|
||||
connLink?: T.CreatedConnLink
|
||||
planSimplexName?: T.SimplexNameInfo
|
||||
otherSimplexName?: T.SimplexNameInfo
|
||||
connectionPlan: T.ConnectionPlan
|
||||
}
|
||||
|
||||
export interface ContactAlreadyExists extends Interface {
|
||||
type: "contactAlreadyExists"
|
||||
user: T.User
|
||||
contact: T.Contact
|
||||
}
|
||||
|
||||
export interface ContactConnectionDeleted extends Interface {
|
||||
type: "contactConnectionDeleted"
|
||||
user: T.User
|
||||
connection: T.PendingContactConnection
|
||||
}
|
||||
|
||||
export interface ContactDeleted extends Interface {
|
||||
type: "contactDeleted"
|
||||
user: T.User
|
||||
contact: T.Contact
|
||||
}
|
||||
|
||||
export interface ContactPrefsUpdated extends Interface {
|
||||
type: "contactPrefsUpdated"
|
||||
user: T.User
|
||||
fromContact: T.Contact
|
||||
toContact: T.Contact
|
||||
}
|
||||
|
||||
export interface ContactRequestRejected extends Interface {
|
||||
type: "contactRequestRejected"
|
||||
user: T.User
|
||||
contactRequest: T.UserContactRequest
|
||||
contact_?: T.Contact
|
||||
}
|
||||
|
||||
export interface ContactsList extends Interface {
|
||||
type: "contactsList"
|
||||
user: T.User
|
||||
contacts: T.Contact[]
|
||||
}
|
||||
|
||||
export interface GroupDeletedUser extends Interface {
|
||||
type: "groupDeletedUser"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
msgSigned: boolean
|
||||
localDeletion: boolean
|
||||
}
|
||||
|
||||
export interface GroupLink extends Interface {
|
||||
type: "groupLink"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
groupLink: T.GroupLink
|
||||
}
|
||||
|
||||
export interface GroupLinkCreated extends Interface {
|
||||
type: "groupLinkCreated"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
groupLink: T.GroupLink
|
||||
}
|
||||
|
||||
export interface GroupLinkDeleted extends Interface {
|
||||
type: "groupLinkDeleted"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
}
|
||||
|
||||
export interface GroupCreated extends Interface {
|
||||
type: "groupCreated"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
}
|
||||
|
||||
export interface PublicGroupCreated extends Interface {
|
||||
type: "publicGroupCreated"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
groupLink: T.GroupLink
|
||||
groupRelays: T.GroupRelay[]
|
||||
}
|
||||
|
||||
export interface PublicGroupCreationFailed extends Interface {
|
||||
type: "publicGroupCreationFailed"
|
||||
user: T.User
|
||||
addRelayResults: T.AddRelayResult[]
|
||||
}
|
||||
|
||||
export interface GroupRelays extends Interface {
|
||||
type: "groupRelays"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
groupRelays: T.GroupRelay[]
|
||||
}
|
||||
|
||||
export interface GroupRelaysAdded extends Interface {
|
||||
type: "groupRelaysAdded"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
groupLink: T.GroupLink
|
||||
groupRelays: T.GroupRelay[]
|
||||
}
|
||||
|
||||
export interface GroupRelaysAddFailed extends Interface {
|
||||
type: "groupRelaysAddFailed"
|
||||
user: T.User
|
||||
addRelayResults: T.AddRelayResult[]
|
||||
}
|
||||
|
||||
export interface RelayGroupAllowed extends Interface {
|
||||
type: "relayGroupAllowed"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
}
|
||||
|
||||
export interface GroupMembers extends Interface {
|
||||
type: "groupMembers"
|
||||
user: T.User
|
||||
group: T.Group
|
||||
}
|
||||
|
||||
export interface GroupUpdated extends Interface {
|
||||
type: "groupUpdated"
|
||||
user: T.User
|
||||
fromGroup: T.GroupInfo
|
||||
toGroup: T.GroupInfo
|
||||
member_?: T.GroupMember
|
||||
msgSigned: boolean
|
||||
}
|
||||
|
||||
export interface GroupsList extends Interface {
|
||||
type: "groupsList"
|
||||
user: T.User
|
||||
groups: T.GroupInfo[]
|
||||
}
|
||||
|
||||
export interface GroupDomainVerified extends Interface {
|
||||
type: "groupDomainVerified"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
verificationFailure?: string
|
||||
}
|
||||
|
||||
export interface Invitation extends Interface {
|
||||
type: "invitation"
|
||||
user: T.User
|
||||
connLinkInvitation: T.CreatedConnLink
|
||||
connection: T.PendingContactConnection
|
||||
}
|
||||
|
||||
export interface LeftMemberUser extends Interface {
|
||||
type: "leftMemberUser"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
}
|
||||
|
||||
export interface MemberAccepted extends Interface {
|
||||
type: "memberAccepted"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
member: T.GroupMember
|
||||
}
|
||||
|
||||
export interface MembersBlockedForAllUser extends Interface {
|
||||
type: "membersBlockedForAllUser"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
members: T.GroupMember[]
|
||||
blocked: boolean
|
||||
msgSigned: boolean
|
||||
}
|
||||
|
||||
export interface MembersRoleUser extends Interface {
|
||||
type: "membersRoleUser"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
members: T.GroupMember[]
|
||||
toRole: T.GroupMemberRole
|
||||
msgSigned: boolean
|
||||
}
|
||||
|
||||
export interface NewChatItems extends Interface {
|
||||
type: "newChatItems"
|
||||
user: T.User
|
||||
chatItems: T.AChatItem[]
|
||||
}
|
||||
|
||||
export interface RcvFileAccepted extends Interface {
|
||||
type: "rcvFileAccepted"
|
||||
user: T.User
|
||||
chatItem: T.AChatItem
|
||||
}
|
||||
|
||||
export interface RcvFileAcceptedSndCancelled extends Interface {
|
||||
type: "rcvFileAcceptedSndCancelled"
|
||||
user: T.User
|
||||
rcvFileTransfer: T.RcvFileTransfer
|
||||
}
|
||||
|
||||
export interface RcvFileCancelled extends Interface {
|
||||
type: "rcvFileCancelled"
|
||||
user: T.User
|
||||
chatItem_?: T.AChatItem
|
||||
rcvFileTransfer: T.RcvFileTransfer
|
||||
}
|
||||
|
||||
export interface RemoteCtrlConnected extends Interface {
|
||||
type: "remoteCtrlConnected"
|
||||
remoteCtrl: T.RemoteCtrlInfo
|
||||
compression: boolean
|
||||
}
|
||||
|
||||
export interface RemoteCtrlConnecting extends Interface {
|
||||
type: "remoteCtrlConnecting"
|
||||
remoteCtrl_?: T.RemoteCtrlInfo
|
||||
ctrlAppInfo: T.CtrlAppInfo
|
||||
appVersion: string
|
||||
}
|
||||
|
||||
export interface SentConfirmation extends Interface {
|
||||
type: "sentConfirmation"
|
||||
user: T.User
|
||||
connection: T.PendingContactConnection
|
||||
customUserProfile?: T.Profile
|
||||
}
|
||||
|
||||
export interface SentGroupInvitation extends Interface {
|
||||
type: "sentGroupInvitation"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
contact: T.Contact
|
||||
member: T.GroupMember
|
||||
}
|
||||
|
||||
export interface SentInvitation extends Interface {
|
||||
type: "sentInvitation"
|
||||
user: T.User
|
||||
connection: T.PendingContactConnection
|
||||
customUserProfile?: T.Profile
|
||||
}
|
||||
|
||||
export interface SentInvitationToContact extends Interface {
|
||||
type: "sentInvitationToContact"
|
||||
user: T.User
|
||||
contact: T.Contact
|
||||
customUserProfile?: T.Profile
|
||||
}
|
||||
|
||||
export interface ServiceReplyAccepted extends Interface {
|
||||
type: "serviceReplyAccepted"
|
||||
user: T.User
|
||||
connectionId: string
|
||||
}
|
||||
|
||||
export interface SndFileCancelled extends Interface {
|
||||
type: "sndFileCancelled"
|
||||
user: T.User
|
||||
chatItem_?: T.AChatItem
|
||||
fileTransferMeta: T.FileTransferMeta
|
||||
sndFileTransfers: T.SndFileTransfer[]
|
||||
}
|
||||
|
||||
export interface StartedConnectionToContact extends Interface {
|
||||
type: "startedConnectionToContact"
|
||||
user: T.User
|
||||
contact: T.Contact
|
||||
customUserProfile?: T.Profile
|
||||
}
|
||||
|
||||
export interface StartedConnectionToGroup extends Interface {
|
||||
type: "startedConnectionToGroup"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
customUserProfile?: T.Profile
|
||||
relayResults: T.RelayConnectionResult[]
|
||||
}
|
||||
|
||||
export interface UserAcceptedGroupSent extends Interface {
|
||||
type: "userAcceptedGroupSent"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
hostContact?: T.Contact
|
||||
}
|
||||
|
||||
export interface UserContactLink extends Interface {
|
||||
type: "userContactLink"
|
||||
user: T.User
|
||||
contactLink: T.UserContactLink
|
||||
}
|
||||
|
||||
export interface UserContactLinkCreated extends Interface {
|
||||
type: "userContactLinkCreated"
|
||||
user: T.User
|
||||
connLinkContact: T.CreatedConnLink
|
||||
}
|
||||
|
||||
export interface UserContactLinkDeleted extends Interface {
|
||||
type: "userContactLinkDeleted"
|
||||
user: T.User
|
||||
}
|
||||
|
||||
export interface UserContactLinkUpdated extends Interface {
|
||||
type: "userContactLinkUpdated"
|
||||
user: T.User
|
||||
contactLink: T.UserContactLink
|
||||
}
|
||||
|
||||
export interface UserDeletedMembers extends Interface {
|
||||
type: "userDeletedMembers"
|
||||
user: T.User
|
||||
groupInfo: T.GroupInfo
|
||||
members: T.GroupMember[]
|
||||
withMessages: boolean
|
||||
msgSigned: boolean
|
||||
}
|
||||
|
||||
export interface UserProfileUpdated extends Interface {
|
||||
type: "userProfileUpdated"
|
||||
user: T.User
|
||||
fromProfile: T.Profile
|
||||
toProfile: T.Profile
|
||||
updateSummary: T.UserProfileUpdateSummary
|
||||
}
|
||||
|
||||
export interface UserProfileNoChange extends Interface {
|
||||
type: "userProfileNoChange"
|
||||
user: T.User
|
||||
}
|
||||
|
||||
export interface UsersList extends Interface {
|
||||
type: "usersList"
|
||||
users: T.UserInfo[]
|
||||
}
|
||||
|
||||
export interface ApiChats extends Interface {
|
||||
type: "apiChats"
|
||||
user: T.User
|
||||
chats: T.AChat[]
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,825 @@
|
||||
# API Commands
|
||||
# This file is generated automatically.
|
||||
from __future__ import annotations
|
||||
import json
|
||||
from typing import NotRequired, TypedDict
|
||||
from . import _types as T
|
||||
from . import _responses as CR
|
||||
|
||||
# Address commands
|
||||
# Bots can use these commands to automatically check and create address when initialized
|
||||
|
||||
# Create bot address.
|
||||
# Network usage: interactive.
|
||||
class APICreateMyAddress(TypedDict):
|
||||
userId: int # int64
|
||||
pqRatchet: NotRequired[bool]
|
||||
|
||||
|
||||
def APICreateMyAddress_cmd_string(self: APICreateMyAddress) -> str:
|
||||
return '/_address ' + str(self['userId']) + ((' pq_ratchet=' + ('on' if self.get('pqRatchet') else 'off')) if self.get('pqRatchet') is not None else '')
|
||||
|
||||
APICreateMyAddress_Response = CR.UserContactLinkCreated | CR.ChatCmdError
|
||||
|
||||
|
||||
# Delete bot address.
|
||||
# Network usage: background.
|
||||
class APIDeleteMyAddress(TypedDict):
|
||||
userId: int # int64
|
||||
|
||||
|
||||
def APIDeleteMyAddress_cmd_string(self: APIDeleteMyAddress) -> str:
|
||||
return '/_delete_address ' + str(self['userId'])
|
||||
|
||||
APIDeleteMyAddress_Response = CR.UserContactLinkDeleted | CR.ChatCmdError
|
||||
|
||||
|
||||
# Get bot address and settings.
|
||||
# Network usage: no.
|
||||
class APIShowMyAddress(TypedDict):
|
||||
userId: int # int64
|
||||
|
||||
|
||||
def APIShowMyAddress_cmd_string(self: APIShowMyAddress) -> str:
|
||||
return '/_show_address ' + str(self['userId'])
|
||||
|
||||
APIShowMyAddress_Response = CR.UserContactLink | CR.ChatCmdError
|
||||
|
||||
|
||||
# Add address to bot profile.
|
||||
# Network usage: interactive.
|
||||
class APISetProfileAddress(TypedDict):
|
||||
userId: int # int64
|
||||
enable: bool
|
||||
|
||||
|
||||
def APISetProfileAddress_cmd_string(self: APISetProfileAddress) -> str:
|
||||
return '/_profile_address ' + str(self['userId']) + ' ' + ('on' if self['enable'] else 'off')
|
||||
|
||||
APISetProfileAddress_Response = CR.UserProfileUpdated | CR.UserProfileNoChange | CR.ChatCmdError
|
||||
|
||||
|
||||
# Set bot address settings.
|
||||
# Network usage: interactive.
|
||||
class APISetAddressSettings(TypedDict):
|
||||
userId: int # int64
|
||||
pqRatchet: NotRequired[bool]
|
||||
settings: "T.AddressSettings"
|
||||
|
||||
|
||||
def APISetAddressSettings_cmd_string(self: APISetAddressSettings) -> str:
|
||||
return '/_address_settings ' + str(self['userId']) + ((' pq_ratchet=' + ('on' if self.get('pqRatchet') else 'off')) if self.get('pqRatchet') is not None else '') + ' ' + json.dumps(self['settings'])
|
||||
|
||||
APISetAddressSettings_Response = CR.UserContactLinkUpdated | CR.ChatCmdError
|
||||
|
||||
|
||||
# Message commands
|
||||
# Commands to send, update, delete, moderate messages and set message reactions
|
||||
|
||||
# Send messages.
|
||||
# Network usage: background.
|
||||
class APISendMessages(TypedDict):
|
||||
sendRef: "T.ChatRef"
|
||||
liveMessage: bool
|
||||
ttl: NotRequired[int] # int
|
||||
signMessages: bool
|
||||
composedMessages: list["T.ComposedMessage"] # non-empty
|
||||
|
||||
|
||||
def APISendMessages_cmd_string(self: APISendMessages) -> str:
|
||||
return '/_send ' + T.ChatRef_cmd_string(self['sendRef']) + (' live=on' if self['liveMessage'] else '') + ((' ttl=' + str(self.get('ttl'))) if self.get('ttl') is not None else '') + (' sign=on' if self['signMessages'] else '') + ' json ' + json.dumps(self['composedMessages'])
|
||||
|
||||
APISendMessages_Response = CR.NewChatItems | CR.ChatCmdError
|
||||
|
||||
|
||||
# Update message.
|
||||
# Network usage: background.
|
||||
class APIUpdateChatItem(TypedDict):
|
||||
chatRef: "T.ChatRef"
|
||||
chatItemId: int # int64
|
||||
liveMessage: bool
|
||||
updatedMessage: "T.UpdatedMessage"
|
||||
|
||||
|
||||
def APIUpdateChatItem_cmd_string(self: APIUpdateChatItem) -> str:
|
||||
return '/_update item ' + T.ChatRef_cmd_string(self['chatRef']) + ' ' + str(self['chatItemId']) + (' live=on' if self['liveMessage'] else '') + ' json ' + json.dumps(self['updatedMessage'])
|
||||
|
||||
APIUpdateChatItem_Response = CR.ChatItemUpdated | CR.ChatItemNotChanged | CR.ChatCmdError
|
||||
|
||||
|
||||
# Delete message.
|
||||
# Network usage: background.
|
||||
class APIDeleteChatItem(TypedDict):
|
||||
chatRef: "T.ChatRef"
|
||||
chatItemIds: list[int] # int64, non-empty
|
||||
deleteMode: "T.CIDeleteMode"
|
||||
|
||||
|
||||
def APIDeleteChatItem_cmd_string(self: APIDeleteChatItem) -> str:
|
||||
return '/_delete item ' + T.ChatRef_cmd_string(self['chatRef']) + ' ' + ','.join(map(str, self['chatItemIds'])) + ' ' + str(self['deleteMode'])
|
||||
|
||||
APIDeleteChatItem_Response = CR.ChatItemsDeleted | CR.ChatCmdError
|
||||
|
||||
|
||||
# Moderate message. Requires Moderator role (and higher than message author's).
|
||||
# Network usage: background.
|
||||
class APIDeleteMemberChatItem(TypedDict):
|
||||
groupId: int # int64
|
||||
chatItemIds: list[int] # int64, non-empty
|
||||
|
||||
|
||||
def APIDeleteMemberChatItem_cmd_string(self: APIDeleteMemberChatItem) -> str:
|
||||
return '/_delete member item #' + str(self['groupId']) + ' ' + ','.join(map(str, self['chatItemIds']))
|
||||
|
||||
APIDeleteMemberChatItem_Response = CR.ChatItemsDeleted | CR.ChatCmdError
|
||||
|
||||
|
||||
# Add/remove message reaction.
|
||||
# Network usage: background.
|
||||
class APIChatItemReaction(TypedDict):
|
||||
chatRef: "T.ChatRef"
|
||||
chatItemId: int # int64
|
||||
add: bool
|
||||
reaction: "T.MsgReaction"
|
||||
|
||||
|
||||
def APIChatItemReaction_cmd_string(self: APIChatItemReaction) -> str:
|
||||
return '/_reaction ' + T.ChatRef_cmd_string(self['chatRef']) + ' ' + str(self['chatItemId']) + ' ' + ('on' if self['add'] else 'off') + ' ' + json.dumps(self['reaction'])
|
||||
|
||||
APIChatItemReaction_Response = CR.ChatItemReaction | CR.ChatCmdError
|
||||
|
||||
|
||||
# Share user address card
|
||||
# Network usage: no.
|
||||
class APIShareMyAddress(TypedDict):
|
||||
toSendRef: "T.ChatRef"
|
||||
|
||||
|
||||
def APIShareMyAddress_cmd_string(self: APIShareMyAddress) -> str:
|
||||
return '/_share address ' + T.ChatRef_cmd_string(self['toSendRef'])
|
||||
|
||||
APIShareMyAddress_Response = CR.ChatMsgContent
|
||||
|
||||
|
||||
# Share channel address
|
||||
# Network usage: no.
|
||||
class APIShareChatMsgContent(TypedDict):
|
||||
shareChatRef: "T.ChatRef"
|
||||
toSendRef: "T.ChatRef"
|
||||
|
||||
|
||||
def APIShareChatMsgContent_cmd_string(self: APIShareChatMsgContent) -> str:
|
||||
return '/_share chat content ' + T.ChatRef_cmd_string(self['shareChatRef']) + ' ' + T.ChatRef_cmd_string(self['toSendRef'])
|
||||
|
||||
APIShareChatMsgContent_Response = CR.ChatMsgContent
|
||||
|
||||
|
||||
# File commands
|
||||
# Commands to receive and to cancel files. Files are sent as part of the message, there are no separate commands to send files.
|
||||
|
||||
# Receive file.
|
||||
# Network usage: no.
|
||||
class ReceiveFile(TypedDict):
|
||||
fileId: int # int64
|
||||
userApprovedRelays: bool
|
||||
storeEncrypted: NotRequired[bool]
|
||||
fileInline: NotRequired[bool]
|
||||
filePath: NotRequired[str]
|
||||
|
||||
|
||||
def ReceiveFile_cmd_string(self: ReceiveFile) -> str:
|
||||
return '/freceive ' + str(self['fileId']) + (' approved_relays=on' if self['userApprovedRelays'] else '') + ((' encrypt=' + ('on' if self.get('storeEncrypted') else 'off')) if self.get('storeEncrypted') is not None else '') + ((' inline=' + ('on' if self.get('fileInline') else 'off')) if self.get('fileInline') is not None else '') + ((' ' + self.get('filePath')) if self.get('filePath') is not None else '')
|
||||
|
||||
ReceiveFile_Response = CR.RcvFileAccepted | CR.RcvFileAcceptedSndCancelled | CR.ChatCmdError
|
||||
|
||||
|
||||
# Cancel file.
|
||||
# Network usage: background.
|
||||
class CancelFile(TypedDict):
|
||||
fileId: int # int64
|
||||
|
||||
|
||||
def CancelFile_cmd_string(self: CancelFile) -> str:
|
||||
return '/fcancel ' + str(self['fileId'])
|
||||
|
||||
CancelFile_Response = CR.SndFileCancelled | CR.RcvFileCancelled | CR.ChatCmdError
|
||||
|
||||
|
||||
# Group commands
|
||||
# Commands to manage and moderate groups. These commands can be used with business chats as well - they are groups. E.g., a common scenario would be to add human agents to business chat with the customer who connected via business address.
|
||||
|
||||
# Add contact to group. Requires bot to have Admin role.
|
||||
# Network usage: interactive.
|
||||
class APIAddMember(TypedDict):
|
||||
groupId: int # int64
|
||||
contactId: int # int64
|
||||
memberRole: "T.GroupMemberRole"
|
||||
|
||||
|
||||
def APIAddMember_cmd_string(self: APIAddMember) -> str:
|
||||
return '/_add #' + str(self['groupId']) + ' ' + str(self['contactId']) + ' ' + str(self['memberRole'])
|
||||
|
||||
APIAddMember_Response = CR.SentGroupInvitation | CR.ChatCmdError
|
||||
|
||||
|
||||
# Join group.
|
||||
# Network usage: interactive.
|
||||
class APIJoinGroup(TypedDict):
|
||||
groupId: int # int64
|
||||
|
||||
|
||||
def APIJoinGroup_cmd_string(self: APIJoinGroup) -> str:
|
||||
return '/_join #' + str(self['groupId'])
|
||||
|
||||
APIJoinGroup_Response = CR.UserAcceptedGroupSent | CR.ChatCmdError
|
||||
|
||||
|
||||
# Accept group member. Requires Admin role.
|
||||
# Network usage: background.
|
||||
class APIAcceptMember(TypedDict):
|
||||
groupId: int # int64
|
||||
groupMemberId: int # int64
|
||||
memberRole: "T.GroupMemberRole"
|
||||
|
||||
|
||||
def APIAcceptMember_cmd_string(self: APIAcceptMember) -> str:
|
||||
return '/_accept member #' + str(self['groupId']) + ' ' + str(self['groupMemberId']) + ' ' + str(self['memberRole'])
|
||||
|
||||
APIAcceptMember_Response = CR.MemberAccepted | CR.ChatCmdError
|
||||
|
||||
|
||||
# Set members role. Requires Admin role.
|
||||
# Network usage: background.
|
||||
class APIMembersRole(TypedDict):
|
||||
groupId: int # int64
|
||||
groupMemberIds: list[int] # int64, non-empty
|
||||
memberRole: "T.GroupMemberRole"
|
||||
|
||||
|
||||
def APIMembersRole_cmd_string(self: APIMembersRole) -> str:
|
||||
return '/_member role #' + str(self['groupId']) + ' ' + ','.join(map(str, self['groupMemberIds'])) + ' ' + str(self['memberRole'])
|
||||
|
||||
APIMembersRole_Response = CR.MembersRoleUser | CR.ChatCmdError
|
||||
|
||||
|
||||
# Block members. Requires Moderator role.
|
||||
# Network usage: background.
|
||||
class APIBlockMembersForAll(TypedDict):
|
||||
groupId: int # int64
|
||||
groupMemberIds: list[int] # int64, non-empty
|
||||
blocked: bool
|
||||
|
||||
|
||||
def APIBlockMembersForAll_cmd_string(self: APIBlockMembersForAll) -> str:
|
||||
return '/_block #' + str(self['groupId']) + ' ' + ','.join(map(str, self['groupMemberIds'])) + ' blocked=' + ('on' if self['blocked'] else 'off')
|
||||
|
||||
APIBlockMembersForAll_Response = CR.MembersBlockedForAllUser | CR.ChatCmdError
|
||||
|
||||
|
||||
# Remove members. Requires Admin role.
|
||||
# Network usage: background.
|
||||
class APIRemoveMembers(TypedDict):
|
||||
groupId: int # int64
|
||||
groupMemberIds: list[int] # int64, non-empty
|
||||
withMessages: bool
|
||||
|
||||
|
||||
def APIRemoveMembers_cmd_string(self: APIRemoveMembers) -> str:
|
||||
return '/_remove #' + str(self['groupId']) + ' ' + ','.join(map(str, self['groupMemberIds'])) + (' messages=on' if self['withMessages'] else '')
|
||||
|
||||
APIRemoveMembers_Response = CR.UserDeletedMembers | CR.ChatCmdError
|
||||
|
||||
|
||||
# Leave group.
|
||||
# Network usage: background.
|
||||
class APILeaveGroup(TypedDict):
|
||||
groupId: int # int64
|
||||
|
||||
|
||||
def APILeaveGroup_cmd_string(self: APILeaveGroup) -> str:
|
||||
return '/_leave #' + str(self['groupId'])
|
||||
|
||||
APILeaveGroup_Response = CR.LeftMemberUser | CR.ChatCmdError
|
||||
|
||||
|
||||
# Get group members.
|
||||
# Network usage: no.
|
||||
class APIListMembers(TypedDict):
|
||||
groupId: int # int64
|
||||
|
||||
|
||||
def APIListMembers_cmd_string(self: APIListMembers) -> str:
|
||||
return '/_members #' + str(self['groupId'])
|
||||
|
||||
APIListMembers_Response = CR.GroupMembers | CR.ChatCmdError
|
||||
|
||||
|
||||
# Create group.
|
||||
# Network usage: no.
|
||||
class APINewGroup(TypedDict):
|
||||
userId: int # int64
|
||||
incognito: bool
|
||||
groupProfile: "T.GroupProfile"
|
||||
|
||||
|
||||
def APINewGroup_cmd_string(self: APINewGroup) -> str:
|
||||
return '/_group ' + str(self['userId']) + (' incognito=on' if self['incognito'] else '') + ' ' + json.dumps(self['groupProfile'])
|
||||
|
||||
APINewGroup_Response = CR.GroupCreated | CR.ChatCmdError
|
||||
|
||||
|
||||
# Create public group.
|
||||
# Network usage: interactive.
|
||||
class APINewPublicGroup(TypedDict):
|
||||
userId: int # int64
|
||||
incognito: bool
|
||||
relayIds: list[int] # int64, non-empty
|
||||
groupProfile: "T.GroupProfile"
|
||||
|
||||
|
||||
def APINewPublicGroup_cmd_string(self: APINewPublicGroup) -> str:
|
||||
return '/_public group ' + str(self['userId']) + (' incognito=on' if self['incognito'] else '') + ' ' + ','.join(map(str, self['relayIds'])) + ' ' + json.dumps(self['groupProfile'])
|
||||
|
||||
APINewPublicGroup_Response = CR.PublicGroupCreated | CR.PublicGroupCreationFailed | CR.ChatCmdError
|
||||
|
||||
|
||||
# Get group relays.
|
||||
# Network usage: no.
|
||||
class APIGetGroupRelays(TypedDict):
|
||||
groupId: int # int64
|
||||
|
||||
|
||||
def APIGetGroupRelays_cmd_string(self: APIGetGroupRelays) -> str:
|
||||
return '/_get relays #' + str(self['groupId'])
|
||||
|
||||
APIGetGroupRelays_Response = CR.GroupRelays | CR.ChatCmdError
|
||||
|
||||
|
||||
# Add relays to group.
|
||||
# Network usage: interactive.
|
||||
class APIAddGroupRelays(TypedDict):
|
||||
groupId: int # int64
|
||||
relayIds: list[int] # int64, non-empty
|
||||
|
||||
|
||||
def APIAddGroupRelays_cmd_string(self: APIAddGroupRelays) -> str:
|
||||
return '/_add relays #' + str(self['groupId']) + ' ' + ','.join(map(str, self['relayIds']))
|
||||
|
||||
APIAddGroupRelays_Response = CR.GroupRelaysAdded | CR.GroupRelaysAddFailed | CR.ChatCmdError
|
||||
|
||||
|
||||
# Clear relay rejection for a channel (relay operator).
|
||||
# Network usage: background.
|
||||
class APIAllowRelayGroup(TypedDict):
|
||||
groupId: int # int64
|
||||
|
||||
|
||||
def APIAllowRelayGroup_cmd_string(self: APIAllowRelayGroup) -> str:
|
||||
return '/_relay allow #' + str(self['groupId'])
|
||||
|
||||
APIAllowRelayGroup_Response = CR.RelayGroupAllowed | CR.ChatCmdError
|
||||
|
||||
|
||||
# Update group profile.
|
||||
# Network usage: background.
|
||||
class APIUpdateGroupProfile(TypedDict):
|
||||
groupId: int # int64
|
||||
groupProfile: "T.GroupProfile"
|
||||
|
||||
|
||||
def APIUpdateGroupProfile_cmd_string(self: APIUpdateGroupProfile) -> str:
|
||||
return '/_group_profile #' + str(self['groupId']) + ' ' + json.dumps(self['groupProfile'])
|
||||
|
||||
APIUpdateGroupProfile_Response = CR.GroupUpdated | CR.ChatCmdError
|
||||
|
||||
|
||||
# Verify group domain
|
||||
# Network usage: interactive.
|
||||
class APIVerifyGroupDomain(TypedDict):
|
||||
groupId: int # int64
|
||||
|
||||
|
||||
def APIVerifyGroupDomain_cmd_string(self: APIVerifyGroupDomain) -> str:
|
||||
return '/_verify domain #' + str(self['groupId'])
|
||||
|
||||
APIVerifyGroupDomain_Response = CR.GroupDomainVerified
|
||||
|
||||
|
||||
# Group link commands
|
||||
# These commands can be used by bots that manage multiple public groups
|
||||
|
||||
# Create group link.
|
||||
# Network usage: interactive.
|
||||
class APICreateGroupLink(TypedDict):
|
||||
groupId: int # int64
|
||||
memberRole: "T.GroupMemberRole"
|
||||
|
||||
|
||||
def APICreateGroupLink_cmd_string(self: APICreateGroupLink) -> str:
|
||||
return '/_create link #' + str(self['groupId']) + ' ' + str(self['memberRole'])
|
||||
|
||||
APICreateGroupLink_Response = CR.GroupLinkCreated | CR.ChatCmdError
|
||||
|
||||
|
||||
# Set member role for group link.
|
||||
# Network usage: no.
|
||||
class APIGroupLinkMemberRole(TypedDict):
|
||||
groupId: int # int64
|
||||
memberRole: "T.GroupMemberRole"
|
||||
|
||||
|
||||
def APIGroupLinkMemberRole_cmd_string(self: APIGroupLinkMemberRole) -> str:
|
||||
return '/_set link role #' + str(self['groupId']) + ' ' + str(self['memberRole'])
|
||||
|
||||
APIGroupLinkMemberRole_Response = CR.GroupLink | CR.ChatCmdError
|
||||
|
||||
|
||||
# Delete group link.
|
||||
# Network usage: background.
|
||||
class APIDeleteGroupLink(TypedDict):
|
||||
groupId: int # int64
|
||||
|
||||
|
||||
def APIDeleteGroupLink_cmd_string(self: APIDeleteGroupLink) -> str:
|
||||
return '/_delete link #' + str(self['groupId'])
|
||||
|
||||
APIDeleteGroupLink_Response = CR.GroupLinkDeleted | CR.ChatCmdError
|
||||
|
||||
|
||||
# Get group link.
|
||||
# Network usage: no.
|
||||
class APIGetGroupLink(TypedDict):
|
||||
groupId: int # int64
|
||||
|
||||
|
||||
def APIGetGroupLink_cmd_string(self: APIGetGroupLink) -> str:
|
||||
return '/_get link #' + str(self['groupId'])
|
||||
|
||||
APIGetGroupLink_Response = CR.GroupLink | CR.ChatCmdError
|
||||
|
||||
|
||||
# Connection commands
|
||||
# These commands may be used to create connections. Most bots do not need to use them - bot users will connect via bot address with auto-accept enabled.
|
||||
|
||||
# Create 1-time invitation link.
|
||||
# Network usage: interactive.
|
||||
class APIAddContact(TypedDict):
|
||||
userId: int # int64
|
||||
incognito: bool
|
||||
|
||||
|
||||
def APIAddContact_cmd_string(self: APIAddContact) -> str:
|
||||
return '/_connect ' + str(self['userId']) + (' incognito=on' if self['incognito'] else '')
|
||||
|
||||
APIAddContact_Response = CR.Invitation | CR.ChatCmdError
|
||||
|
||||
|
||||
# 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
|
||||
connectTarget: NotRequired[str]
|
||||
resolveMode: "T.PlanResolveMode"
|
||||
linkOwnerSig: NotRequired["T.LinkOwnerSig"]
|
||||
|
||||
|
||||
def APIConnectPlan_cmd_string(self: APIConnectPlan) -> str:
|
||||
return '/_connect plan ' + str(self['userId']) + ' ' + self.get('connectTarget')
|
||||
|
||||
APIConnectPlan_Response = CR.ConnectionPlan | CR.ChatCmdError
|
||||
|
||||
|
||||
# Connect via prepared SimpleX link. The link can be 1-time invitation link, contact address or group link.
|
||||
# Network usage: interactive.
|
||||
class APIConnect(TypedDict):
|
||||
userId: int # int64
|
||||
incognito: bool
|
||||
preparedLink_: NotRequired["T.CreatedConnLink"]
|
||||
|
||||
|
||||
def APIConnect_cmd_string(self: APIConnect) -> str:
|
||||
return '/_connect ' + str(self['userId']) + (' incognito=on' if self['incognito'] else '') + ((' ' + T.CreatedConnLink_cmd_string(self.get('preparedLink_'))) if self.get('preparedLink_') is not None else '')
|
||||
|
||||
APIConnect_Response = CR.SentConfirmation | CR.ContactAlreadyExists | CR.SentInvitation | CR.ChatCmdError
|
||||
|
||||
|
||||
# Connect via SimpleX link or name as string in the active user profile.
|
||||
# Network usage: interactive.
|
||||
class Connect(TypedDict):
|
||||
incognito: bool
|
||||
connTarget_: NotRequired[str]
|
||||
|
||||
|
||||
def Connect_cmd_string(self: Connect) -> str:
|
||||
return '/connect' + ((' ' + self.get('connTarget_')) if self.get('connTarget_') is not None else '')
|
||||
|
||||
Connect_Response = (
|
||||
CR.SentConfirmation
|
||||
| CR.ContactAlreadyExists
|
||||
| CR.SentInvitation
|
||||
| CR.ConnectionPlan
|
||||
| CR.SentInvitationToContact
|
||||
| CR.StartedConnectionToContact
|
||||
| CR.StartedConnectionToGroup
|
||||
| CR.ChatCmdError
|
||||
)
|
||||
|
||||
|
||||
# Accept contact request.
|
||||
# Network usage: interactive.
|
||||
class APIAcceptContact(TypedDict):
|
||||
contactReqId: int # int64
|
||||
|
||||
|
||||
def APIAcceptContact_cmd_string(self: APIAcceptContact) -> str:
|
||||
return '/_accept ' + str(self['contactReqId'])
|
||||
|
||||
APIAcceptContact_Response = CR.AcceptingContactRequest | CR.ChatCmdError
|
||||
|
||||
|
||||
# Reject contact request. The user who sent the request is **not notified**.
|
||||
# Network usage: no.
|
||||
class APIRejectContact(TypedDict):
|
||||
contactReqId: int # int64
|
||||
notify: bool
|
||||
|
||||
|
||||
def APIRejectContact_cmd_string(self: APIRejectContact) -> str:
|
||||
return '/_reject ' + str(self['contactReqId'])
|
||||
|
||||
APIRejectContact_Response = CR.ContactRequestRejected | CR.ChatCmdError
|
||||
|
||||
|
||||
# Chat commands
|
||||
# Commands to list and delete conversations.
|
||||
|
||||
# Get contacts.
|
||||
# Network usage: no.
|
||||
class APIListContacts(TypedDict):
|
||||
userId: int # int64
|
||||
|
||||
|
||||
def APIListContacts_cmd_string(self: APIListContacts) -> str:
|
||||
return '/_contacts ' + str(self['userId'])
|
||||
|
||||
APIListContacts_Response = CR.ContactsList | CR.ChatCmdError
|
||||
|
||||
|
||||
# Get groups.
|
||||
# Network usage: no.
|
||||
class APIListGroups(TypedDict):
|
||||
userId: int # int64
|
||||
contactId_: NotRequired[int] # int64
|
||||
search: NotRequired[str]
|
||||
|
||||
|
||||
def APIListGroups_cmd_string(self: APIListGroups) -> str:
|
||||
return '/_groups ' + str(self['userId']) + ((' @' + str(self.get('contactId_'))) if self.get('contactId_') is not None else '') + ((' ' + self.get('search')) if self.get('search') is not None else '')
|
||||
|
||||
APIListGroups_Response = CR.GroupsList | CR.ChatCmdError
|
||||
|
||||
|
||||
# Get chat previews. Supports time-based pagination — use this instead of APIListContacts / APIListGroups when scanning at scale (those load every record into memory and fail on large databases).
|
||||
# Network usage: no.
|
||||
class APIGetChats(TypedDict):
|
||||
userId: int # int64
|
||||
pendingConnections: bool
|
||||
pagination: NotRequired["T.PaginationByTime"]
|
||||
query: "T.ChatListQuery"
|
||||
|
||||
|
||||
def APIGetChats_cmd_string(self: APIGetChats) -> str:
|
||||
return '/_get chats ' + str(self['userId']) + (' pcc=on' if self['pendingConnections'] else '') + ((' ' + T.PaginationByTime_cmd_string(self.get('pagination'))) if self.get('pagination') is not None else '') + ' ' + json.dumps(self['query'])
|
||||
|
||||
APIGetChats_Response = CR.ApiChats | CR.ChatCmdError
|
||||
|
||||
|
||||
# Delete chat.
|
||||
# Network usage: background.
|
||||
class APIDeleteChat(TypedDict):
|
||||
chatRef: "T.ChatRef"
|
||||
chatDeleteMode: "T.ChatDeleteMode"
|
||||
|
||||
|
||||
def APIDeleteChat_cmd_string(self: APIDeleteChat) -> str:
|
||||
return '/_delete ' + T.ChatRef_cmd_string(self['chatRef']) + ' ' + T.ChatDeleteMode_cmd_string(self['chatDeleteMode'])
|
||||
|
||||
APIDeleteChat_Response = CR.ContactDeleted | CR.ContactConnectionDeleted | CR.GroupDeletedUser | CR.ChatCmdError
|
||||
|
||||
|
||||
# Set group custom data.
|
||||
# Network usage: no.
|
||||
class APISetGroupCustomData(TypedDict):
|
||||
groupId: int # int64
|
||||
customData: NotRequired[dict[str, object]]
|
||||
|
||||
|
||||
def APISetGroupCustomData_cmd_string(self: APISetGroupCustomData) -> str:
|
||||
return '/_set custom #' + str(self['groupId']) + ((' ' + json.dumps(self.get('customData'))) if self.get('customData') is not None else '')
|
||||
|
||||
APISetGroupCustomData_Response = CR.CmdOk | CR.ChatCmdError
|
||||
|
||||
|
||||
# Set contact custom data.
|
||||
# Network usage: no.
|
||||
class APISetContactCustomData(TypedDict):
|
||||
contactId: int # int64
|
||||
customData: NotRequired[dict[str, object]]
|
||||
|
||||
|
||||
def APISetContactCustomData_cmd_string(self: APISetContactCustomData) -> str:
|
||||
return '/_set custom @' + str(self['contactId']) + ((' ' + json.dumps(self.get('customData'))) if self.get('customData') is not None else '')
|
||||
|
||||
APISetContactCustomData_Response = CR.CmdOk | CR.ChatCmdError
|
||||
|
||||
|
||||
# Set auto-accept member contacts.
|
||||
# Network usage: no.
|
||||
class APISetUserAutoAcceptMemberContacts(TypedDict):
|
||||
userId: int # int64
|
||||
onOff: bool
|
||||
|
||||
|
||||
def APISetUserAutoAcceptMemberContacts_cmd_string(self: APISetUserAutoAcceptMemberContacts) -> str:
|
||||
return '/_set accept member contacts ' + str(self['userId']) + ' ' + ('on' if self['onOff'] else 'off')
|
||||
|
||||
APISetUserAutoAcceptMemberContacts_Response = CR.CmdOk | CR.ChatCmdError
|
||||
|
||||
|
||||
# Set auto-accept group invitations.
|
||||
# Network usage: no.
|
||||
class APISetUserAutoAcceptGroupInvitations(TypedDict):
|
||||
userId: int # int64
|
||||
onOff: bool
|
||||
|
||||
|
||||
def APISetUserAutoAcceptGroupInvitations_cmd_string(self: APISetUserAutoAcceptGroupInvitations) -> str:
|
||||
return '/_set accept group invitations ' + str(self['userId']) + ' ' + ('on' if self['onOff'] else 'off')
|
||||
|
||||
APISetUserAutoAcceptGroupInvitations_Response = CR.CmdOk | CR.ChatCmdError
|
||||
|
||||
|
||||
# User profile commands
|
||||
# Most bots don't need to use these commands, as bot profile can be configured manually via CLI or desktop client. These commands can be used by bots that need to manage multiple user profiles (e.g., the profiles of support agents).
|
||||
|
||||
# Get active user profile.
|
||||
# Network usage: no.
|
||||
class ShowActiveUser(TypedDict):
|
||||
pass
|
||||
|
||||
|
||||
def ShowActiveUser_cmd_string(self: ShowActiveUser) -> str:
|
||||
return '/user'
|
||||
|
||||
ShowActiveUser_Response = CR.ActiveUser | CR.ChatCmdError
|
||||
|
||||
|
||||
# Create new user profile.
|
||||
# Network usage: no.
|
||||
class CreateActiveUser(TypedDict):
|
||||
newUser: "T.NewUser"
|
||||
|
||||
|
||||
def CreateActiveUser_cmd_string(self: CreateActiveUser) -> str:
|
||||
return '/_create user ' + json.dumps(self['newUser'])
|
||||
|
||||
CreateActiveUser_Response = CR.ActiveUser | CR.ChatCmdError
|
||||
|
||||
|
||||
# Get all user profiles.
|
||||
# Network usage: no.
|
||||
class ListUsers(TypedDict):
|
||||
pass
|
||||
|
||||
|
||||
def ListUsers_cmd_string(self: ListUsers) -> str:
|
||||
return '/users'
|
||||
|
||||
ListUsers_Response = CR.UsersList | CR.ChatCmdError
|
||||
|
||||
|
||||
# Set active user profile.
|
||||
# Network usage: no.
|
||||
class APISetActiveUser(TypedDict):
|
||||
userId: int # int64
|
||||
viewPwd: NotRequired[str]
|
||||
|
||||
|
||||
def APISetActiveUser_cmd_string(self: APISetActiveUser) -> str:
|
||||
return '/_user ' + str(self['userId']) + ((' ' + json.dumps(self.get('viewPwd'))) if self.get('viewPwd') is not None else '')
|
||||
|
||||
APISetActiveUser_Response = CR.ActiveUser | CR.ChatCmdError
|
||||
|
||||
|
||||
# Delete user profile.
|
||||
# Network usage: background.
|
||||
class APIDeleteUser(TypedDict):
|
||||
userId: int # int64
|
||||
delSMPQueues: bool
|
||||
viewPwd: NotRequired[str]
|
||||
|
||||
|
||||
def APIDeleteUser_cmd_string(self: APIDeleteUser) -> str:
|
||||
return '/_delete user ' + str(self['userId']) + ' del_smp=' + ('on' if self['delSMPQueues'] else 'off') + ((' ' + json.dumps(self.get('viewPwd'))) if self.get('viewPwd') is not None else '')
|
||||
|
||||
APIDeleteUser_Response = CR.CmdOk | CR.ChatCmdError
|
||||
|
||||
|
||||
# Update user profile.
|
||||
# Network usage: background.
|
||||
class APIUpdateProfile(TypedDict):
|
||||
userId: int # int64
|
||||
profile: "T.Profile"
|
||||
|
||||
|
||||
def APIUpdateProfile_cmd_string(self: APIUpdateProfile) -> str:
|
||||
return '/_profile ' + str(self['userId']) + ' ' + json.dumps(self['profile'])
|
||||
|
||||
APIUpdateProfile_Response = CR.UserProfileUpdated | CR.UserProfileNoChange | CR.ChatCmdError
|
||||
|
||||
|
||||
# Configure chat preference overrides for the contact.
|
||||
# Network usage: background.
|
||||
class APISetContactPrefs(TypedDict):
|
||||
contactId: int # int64
|
||||
preferences: "T.Preferences"
|
||||
|
||||
|
||||
def APISetContactPrefs_cmd_string(self: APISetContactPrefs) -> str:
|
||||
return '/_set prefs @' + str(self['contactId']) + ' ' + json.dumps(self['preferences'])
|
||||
|
||||
APISetContactPrefs_Response = CR.ContactPrefsUpdated | CR.ChatCmdError
|
||||
|
||||
|
||||
# Service commands
|
||||
# Bots with a double ratchet address can answer service requests.
|
||||
|
||||
# Send a reply to a received service request. Returns the connection ID that correlates the reply delivery event.
|
||||
# Network usage: background.
|
||||
class APISendServiceResponse(TypedDict):
|
||||
userId: int # int64
|
||||
requestId: str
|
||||
responseData: dict[str, object]
|
||||
|
||||
|
||||
def APISendServiceResponse_cmd_string(self: APISendServiceResponse) -> str:
|
||||
return '/_service_response ' + str(self['userId']) + ' ' + self['requestId'] + ' ' + json.dumps(self['responseData'])
|
||||
|
||||
APISendServiceResponse_Response = CR.ServiceReplyAccepted | CR.ChatCmdError
|
||||
|
||||
|
||||
# Chat management
|
||||
# These commands should not be used with CLI-based bots
|
||||
|
||||
# Start chat controller.
|
||||
# Network usage: no.
|
||||
class StartChat(TypedDict):
|
||||
mainApp: bool
|
||||
enableSndFiles: bool
|
||||
serviceRequests: bool
|
||||
|
||||
|
||||
def StartChat_cmd_string(self: StartChat) -> str:
|
||||
return '/_start' + ' main=' + ('on' if self['mainApp'] else 'off') + (' snd_files=off' if not self['enableSndFiles'] else '') + (' service_requests=on' if self['serviceRequests'] else '')
|
||||
|
||||
StartChat_Response = CR.ChatStarted | CR.ChatRunning
|
||||
|
||||
|
||||
# Stop chat controller.
|
||||
# Network usage: no.
|
||||
class APIStopChat(TypedDict):
|
||||
pass
|
||||
|
||||
|
||||
def APIStopChat_cmd_string(self: APIStopChat) -> str:
|
||||
return '/_stop'
|
||||
|
||||
APIStopChat_Response = CR.ChatStopped
|
||||
|
||||
|
||||
# Remote control commands
|
||||
# Allows a bot to accept an incoming remote control session from a SimpleX Desktop client, giving the desktop live access to the bot's SimpleX instance.
|
||||
|
||||
# Connect to a remote controller using an OOB invitation link.
|
||||
# Network usage: interactive.
|
||||
class ConnectRemoteCtrl(TypedDict):
|
||||
remoteInvitation: str
|
||||
|
||||
|
||||
def ConnectRemoteCtrl_cmd_string(self: ConnectRemoteCtrl) -> str:
|
||||
return '/crc ' + self['remoteInvitation']
|
||||
|
||||
ConnectRemoteCtrl_Response = CR.RemoteCtrlConnecting | CR.ChatCmdError
|
||||
|
||||
|
||||
# Verify the remote controller session code to complete the connection.
|
||||
# Network usage: no.
|
||||
class VerifyRemoteCtrlSession(TypedDict):
|
||||
sessionCode: str
|
||||
|
||||
|
||||
def VerifyRemoteCtrlSession_cmd_string(self: VerifyRemoteCtrlSession) -> str:
|
||||
return '/verify remote ctrl ' + self['sessionCode']
|
||||
|
||||
VerifyRemoteCtrlSession_Response = CR.RemoteCtrlConnected | CR.ChatCmdError
|
||||
|
||||
|
||||
@@ -0,0 +1,730 @@
|
||||
# API Events
|
||||
# This file is generated automatically.
|
||||
from __future__ import annotations
|
||||
from collections.abc import Awaitable, Callable
|
||||
from typing import Literal, NotRequired, Protocol, TypedDict, overload
|
||||
from . import _types as T
|
||||
|
||||
class ContactConnected(TypedDict):
|
||||
type: Literal["contactConnected"]
|
||||
user: "T.User"
|
||||
contact: "T.Contact"
|
||||
userCustomProfile: NotRequired["T.Profile"]
|
||||
|
||||
class ContactUpdated(TypedDict):
|
||||
type: Literal["contactUpdated"]
|
||||
user: "T.User"
|
||||
fromContact: "T.Contact"
|
||||
toContact: "T.Contact"
|
||||
|
||||
class ContactDeletedByContact(TypedDict):
|
||||
type: Literal["contactDeletedByContact"]
|
||||
user: "T.User"
|
||||
contact: "T.Contact"
|
||||
|
||||
class ReceivedContactRequest(TypedDict):
|
||||
type: Literal["receivedContactRequest"]
|
||||
user: "T.User"
|
||||
contactRequest: "T.UserContactRequest"
|
||||
chat_: NotRequired["T.AChat"]
|
||||
|
||||
class NewMemberContactReceivedInv(TypedDict):
|
||||
type: Literal["newMemberContactReceivedInv"]
|
||||
user: "T.User"
|
||||
contact: "T.Contact"
|
||||
groupInfo: "T.GroupInfo"
|
||||
member: "T.GroupMember"
|
||||
|
||||
class ContactSndReady(TypedDict):
|
||||
type: Literal["contactSndReady"]
|
||||
user: "T.User"
|
||||
contact: "T.Contact"
|
||||
|
||||
class NewChatItems(TypedDict):
|
||||
type: Literal["newChatItems"]
|
||||
user: "T.User"
|
||||
chatItems: list["T.AChatItem"]
|
||||
|
||||
class ChatItemReaction(TypedDict):
|
||||
type: Literal["chatItemReaction"]
|
||||
user: "T.User"
|
||||
added: bool
|
||||
reaction: "T.ACIReaction"
|
||||
|
||||
class ChatItemsDeleted(TypedDict):
|
||||
type: Literal["chatItemsDeleted"]
|
||||
user: "T.User"
|
||||
chatItemDeletions: list["T.ChatItemDeletion"]
|
||||
byUser: bool
|
||||
timed: bool
|
||||
|
||||
class ChatItemUpdated(TypedDict):
|
||||
type: Literal["chatItemUpdated"]
|
||||
user: "T.User"
|
||||
chatItem: "T.AChatItem"
|
||||
|
||||
class GroupChatItemsDeleted(TypedDict):
|
||||
type: Literal["groupChatItemsDeleted"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
chatItemIDs: list[int] # int64
|
||||
byUser: bool
|
||||
member_: NotRequired["T.GroupMember"]
|
||||
|
||||
class ChatItemsStatusesUpdated(TypedDict):
|
||||
type: Literal["chatItemsStatusesUpdated"]
|
||||
user: "T.User"
|
||||
chatItems: list["T.AChatItem"]
|
||||
|
||||
class ReceivedGroupInvitation(TypedDict):
|
||||
type: Literal["receivedGroupInvitation"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
contact: "T.Contact"
|
||||
fromMemberRole: "T.GroupMemberRole"
|
||||
memberRole: "T.GroupMemberRole"
|
||||
|
||||
class UserJoinedGroup(TypedDict):
|
||||
type: Literal["userJoinedGroup"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
hostMember: "T.GroupMember"
|
||||
|
||||
class GroupUpdated(TypedDict):
|
||||
type: Literal["groupUpdated"]
|
||||
user: "T.User"
|
||||
fromGroup: "T.GroupInfo"
|
||||
toGroup: "T.GroupInfo"
|
||||
member_: NotRequired["T.GroupMember"]
|
||||
msgSigned: NotRequired["T.MsgSigStatus"]
|
||||
|
||||
class JoinedGroupMember(TypedDict):
|
||||
type: Literal["joinedGroupMember"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
member: "T.GroupMember"
|
||||
|
||||
class MemberRole(TypedDict):
|
||||
type: Literal["memberRole"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
byMember: "T.GroupMember"
|
||||
member: "T.GroupMember"
|
||||
fromRole: "T.GroupMemberRole"
|
||||
toRole: "T.GroupMemberRole"
|
||||
msgSigned: NotRequired["T.MsgSigStatus"]
|
||||
|
||||
class DeletedMember(TypedDict):
|
||||
type: Literal["deletedMember"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
byMember: "T.GroupMember"
|
||||
deletedMember: "T.GroupMember"
|
||||
withMessages: bool
|
||||
msgSigned: NotRequired["T.MsgSigStatus"]
|
||||
|
||||
class LeftMember(TypedDict):
|
||||
type: Literal["leftMember"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
member: "T.GroupMember"
|
||||
msgSigned: NotRequired["T.MsgSigStatus"]
|
||||
|
||||
class DeletedMemberUser(TypedDict):
|
||||
type: Literal["deletedMemberUser"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
member: "T.GroupMember"
|
||||
withMessages: bool
|
||||
msgSigned: NotRequired["T.MsgSigStatus"]
|
||||
|
||||
class GroupDeleted(TypedDict):
|
||||
type: Literal["groupDeleted"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
member: "T.GroupMember"
|
||||
msgSigned: NotRequired["T.MsgSigStatus"]
|
||||
|
||||
class ConnectedToGroupMember(TypedDict):
|
||||
type: Literal["connectedToGroupMember"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
member: "T.GroupMember"
|
||||
memberContact: NotRequired["T.Contact"]
|
||||
|
||||
class MemberAcceptedByOther(TypedDict):
|
||||
type: Literal["memberAcceptedByOther"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
acceptingMember: "T.GroupMember"
|
||||
member: "T.GroupMember"
|
||||
|
||||
class MemberBlockedForAll(TypedDict):
|
||||
type: Literal["memberBlockedForAll"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
byMember: "T.GroupMember"
|
||||
member: "T.GroupMember"
|
||||
blocked: bool
|
||||
msgSigned: NotRequired["T.MsgSigStatus"]
|
||||
|
||||
class GroupMemberUpdated(TypedDict):
|
||||
type: Literal["groupMemberUpdated"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
fromMember: "T.GroupMember"
|
||||
toMember: "T.GroupMember"
|
||||
|
||||
class GroupLinkDataUpdated(TypedDict):
|
||||
type: Literal["groupLinkDataUpdated"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
groupLink: "T.GroupLink"
|
||||
groupRelays: list["T.GroupRelay"]
|
||||
relaysChanged: bool
|
||||
|
||||
class GroupRelayUpdated(TypedDict):
|
||||
type: Literal["groupRelayUpdated"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
member: "T.GroupMember"
|
||||
groupRelay: "T.GroupRelay"
|
||||
|
||||
class RcvFileDescrReady(TypedDict):
|
||||
type: Literal["rcvFileDescrReady"]
|
||||
user: "T.User"
|
||||
chatItem: "T.AChatItem"
|
||||
rcvFileTransfer: "T.RcvFileTransfer"
|
||||
rcvFileDescr: "T.RcvFileDescr"
|
||||
|
||||
class RcvFileComplete(TypedDict):
|
||||
type: Literal["rcvFileComplete"]
|
||||
user: "T.User"
|
||||
chatItem: "T.AChatItem"
|
||||
|
||||
class SndFileCompleteXFTP(TypedDict):
|
||||
type: Literal["sndFileCompleteXFTP"]
|
||||
user: "T.User"
|
||||
chatItem: "T.AChatItem"
|
||||
fileTransferMeta: "T.FileTransferMeta"
|
||||
|
||||
class RcvFileStart(TypedDict):
|
||||
type: Literal["rcvFileStart"]
|
||||
user: "T.User"
|
||||
chatItem: "T.AChatItem"
|
||||
|
||||
class RcvFileSndCancelled(TypedDict):
|
||||
type: Literal["rcvFileSndCancelled"]
|
||||
user: "T.User"
|
||||
chatItem: "T.AChatItem"
|
||||
rcvFileTransfer: "T.RcvFileTransfer"
|
||||
|
||||
class RcvFileAccepted(TypedDict):
|
||||
type: Literal["rcvFileAccepted"]
|
||||
user: "T.User"
|
||||
chatItem: "T.AChatItem"
|
||||
|
||||
class RcvFileError(TypedDict):
|
||||
type: Literal["rcvFileError"]
|
||||
user: "T.User"
|
||||
chatItem_: NotRequired["T.AChatItem"]
|
||||
agentError: "T.AgentErrorType"
|
||||
rcvFileTransfer: "T.RcvFileTransfer"
|
||||
|
||||
class RcvFileWarning(TypedDict):
|
||||
type: Literal["rcvFileWarning"]
|
||||
user: "T.User"
|
||||
chatItem_: NotRequired["T.AChatItem"]
|
||||
agentError: "T.AgentErrorType"
|
||||
rcvFileTransfer: "T.RcvFileTransfer"
|
||||
|
||||
class SndFileError(TypedDict):
|
||||
type: Literal["sndFileError"]
|
||||
user: "T.User"
|
||||
chatItem_: NotRequired["T.AChatItem"]
|
||||
fileTransferMeta: "T.FileTransferMeta"
|
||||
errorMessage: str
|
||||
|
||||
class SndFileWarning(TypedDict):
|
||||
type: Literal["sndFileWarning"]
|
||||
user: "T.User"
|
||||
chatItem_: NotRequired["T.AChatItem"]
|
||||
fileTransferMeta: "T.FileTransferMeta"
|
||||
errorMessage: str
|
||||
|
||||
class AcceptingContactRequest(TypedDict):
|
||||
type: Literal["acceptingContactRequest"]
|
||||
user: "T.User"
|
||||
contact: "T.Contact"
|
||||
|
||||
class AcceptingBusinessRequest(TypedDict):
|
||||
type: Literal["acceptingBusinessRequest"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
|
||||
class ContactConnecting(TypedDict):
|
||||
type: Literal["contactConnecting"]
|
||||
user: "T.User"
|
||||
contact: "T.Contact"
|
||||
|
||||
class BusinessLinkConnecting(TypedDict):
|
||||
type: Literal["businessLinkConnecting"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
hostMember: "T.GroupMember"
|
||||
fromContact: "T.Contact"
|
||||
|
||||
class JoinedGroupMemberConnecting(TypedDict):
|
||||
type: Literal["joinedGroupMemberConnecting"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
hostMember: "T.GroupMember"
|
||||
member: "T.GroupMember"
|
||||
|
||||
class GroupLinkConnecting(TypedDict):
|
||||
type: Literal["groupLinkConnecting"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
hostMember: "T.GroupMember"
|
||||
|
||||
class HostConnected(TypedDict):
|
||||
type: Literal["hostConnected"]
|
||||
protocol: str
|
||||
transportHost: str
|
||||
|
||||
class HostDisconnected(TypedDict):
|
||||
type: Literal["hostDisconnected"]
|
||||
protocol: str
|
||||
transportHost: str
|
||||
|
||||
class SubscriptionStatus(TypedDict):
|
||||
type: Literal["subscriptionStatus"]
|
||||
server: str
|
||||
subscriptionStatus: "T.SubscriptionStatus"
|
||||
connections: list[str]
|
||||
|
||||
class ServiceRequest(TypedDict):
|
||||
type: Literal["serviceRequest"]
|
||||
user: "T.User"
|
||||
requestId: str
|
||||
signerKey: NotRequired[str]
|
||||
requestData: dict[str, object]
|
||||
|
||||
class ServiceReplySent(TypedDict):
|
||||
type: Literal["serviceReplySent"]
|
||||
connectionId: str
|
||||
|
||||
class RemoteCtrlSessionCode(TypedDict):
|
||||
type: Literal["remoteCtrlSessionCode"]
|
||||
remoteCtrl_: NotRequired["T.RemoteCtrlInfo"]
|
||||
sessionCode: str
|
||||
|
||||
class RemoteCtrlStopped(TypedDict):
|
||||
type: Literal["remoteCtrlStopped"]
|
||||
rcsState: "T.RemoteCtrlSessionState"
|
||||
rcStopReason: "T.RemoteCtrlStopReason"
|
||||
|
||||
class MessageError(TypedDict):
|
||||
type: Literal["messageError"]
|
||||
user: "T.User"
|
||||
severity: str
|
||||
errorMessage: str
|
||||
|
||||
class ChatError(TypedDict):
|
||||
type: Literal["chatError"]
|
||||
chatError: "T.ChatError"
|
||||
|
||||
class ChatErrors(TypedDict):
|
||||
type: Literal["chatErrors"]
|
||||
chatErrors: list["T.ChatError"]
|
||||
|
||||
ChatEvent = (
|
||||
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
|
||||
| GroupLinkConnecting
|
||||
| HostConnected
|
||||
| HostDisconnected
|
||||
| SubscriptionStatus
|
||||
| ServiceRequest
|
||||
| ServiceReplySent
|
||||
| RemoteCtrlSessionCode
|
||||
| RemoteCtrlStopped
|
||||
| MessageError
|
||||
| ChatError
|
||||
| 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", "groupLinkConnecting", "hostConnected", "hostDisconnected", "subscriptionStatus", "serviceRequest", "serviceReplySent", "remoteCtrlSessionCode", "remoteCtrlStopped", "messageError", "chatError", "chatErrors"]
|
||||
|
||||
|
||||
class OnEventDecorator(Protocol):
|
||||
"""Per-tag narrowing protocol for ``Client.on_event``.
|
||||
|
||||
``@client.on_event("contactConnected")`` types the handler's
|
||||
``evt`` parameter as :class:`ContactConnected` rather than the
|
||||
unnarrowed :data:`ChatEvent` union.
|
||||
"""
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["contactConnected"], /) -> Callable[
|
||||
[Callable[["ContactConnected"], Awaitable[None]]],
|
||||
Callable[["ContactConnected"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["contactUpdated"], /) -> Callable[
|
||||
[Callable[["ContactUpdated"], Awaitable[None]]],
|
||||
Callable[["ContactUpdated"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["contactDeletedByContact"], /) -> Callable[
|
||||
[Callable[["ContactDeletedByContact"], Awaitable[None]]],
|
||||
Callable[["ContactDeletedByContact"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["receivedContactRequest"], /) -> Callable[
|
||||
[Callable[["ReceivedContactRequest"], Awaitable[None]]],
|
||||
Callable[["ReceivedContactRequest"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["newMemberContactReceivedInv"], /) -> Callable[
|
||||
[Callable[["NewMemberContactReceivedInv"], Awaitable[None]]],
|
||||
Callable[["NewMemberContactReceivedInv"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["contactSndReady"], /) -> Callable[
|
||||
[Callable[["ContactSndReady"], Awaitable[None]]],
|
||||
Callable[["ContactSndReady"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["newChatItems"], /) -> Callable[
|
||||
[Callable[["NewChatItems"], Awaitable[None]]],
|
||||
Callable[["NewChatItems"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["chatItemReaction"], /) -> Callable[
|
||||
[Callable[["ChatItemReaction"], Awaitable[None]]],
|
||||
Callable[["ChatItemReaction"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["chatItemsDeleted"], /) -> Callable[
|
||||
[Callable[["ChatItemsDeleted"], Awaitable[None]]],
|
||||
Callable[["ChatItemsDeleted"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["chatItemUpdated"], /) -> Callable[
|
||||
[Callable[["ChatItemUpdated"], Awaitable[None]]],
|
||||
Callable[["ChatItemUpdated"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["groupChatItemsDeleted"], /) -> Callable[
|
||||
[Callable[["GroupChatItemsDeleted"], Awaitable[None]]],
|
||||
Callable[["GroupChatItemsDeleted"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["chatItemsStatusesUpdated"], /) -> Callable[
|
||||
[Callable[["ChatItemsStatusesUpdated"], Awaitable[None]]],
|
||||
Callable[["ChatItemsStatusesUpdated"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["receivedGroupInvitation"], /) -> Callable[
|
||||
[Callable[["ReceivedGroupInvitation"], Awaitable[None]]],
|
||||
Callable[["ReceivedGroupInvitation"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["userJoinedGroup"], /) -> Callable[
|
||||
[Callable[["UserJoinedGroup"], Awaitable[None]]],
|
||||
Callable[["UserJoinedGroup"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["groupUpdated"], /) -> Callable[
|
||||
[Callable[["GroupUpdated"], Awaitable[None]]],
|
||||
Callable[["GroupUpdated"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["joinedGroupMember"], /) -> Callable[
|
||||
[Callable[["JoinedGroupMember"], Awaitable[None]]],
|
||||
Callable[["JoinedGroupMember"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["memberRole"], /) -> Callable[
|
||||
[Callable[["MemberRole"], Awaitable[None]]],
|
||||
Callable[["MemberRole"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["deletedMember"], /) -> Callable[
|
||||
[Callable[["DeletedMember"], Awaitable[None]]],
|
||||
Callable[["DeletedMember"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["leftMember"], /) -> Callable[
|
||||
[Callable[["LeftMember"], Awaitable[None]]],
|
||||
Callable[["LeftMember"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["deletedMemberUser"], /) -> Callable[
|
||||
[Callable[["DeletedMemberUser"], Awaitable[None]]],
|
||||
Callable[["DeletedMemberUser"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["groupDeleted"], /) -> Callable[
|
||||
[Callable[["GroupDeleted"], Awaitable[None]]],
|
||||
Callable[["GroupDeleted"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["connectedToGroupMember"], /) -> Callable[
|
||||
[Callable[["ConnectedToGroupMember"], Awaitable[None]]],
|
||||
Callable[["ConnectedToGroupMember"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["memberAcceptedByOther"], /) -> Callable[
|
||||
[Callable[["MemberAcceptedByOther"], Awaitable[None]]],
|
||||
Callable[["MemberAcceptedByOther"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["memberBlockedForAll"], /) -> Callable[
|
||||
[Callable[["MemberBlockedForAll"], Awaitable[None]]],
|
||||
Callable[["MemberBlockedForAll"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["groupMemberUpdated"], /) -> Callable[
|
||||
[Callable[["GroupMemberUpdated"], Awaitable[None]]],
|
||||
Callable[["GroupMemberUpdated"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["groupLinkDataUpdated"], /) -> Callable[
|
||||
[Callable[["GroupLinkDataUpdated"], Awaitable[None]]],
|
||||
Callable[["GroupLinkDataUpdated"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["groupRelayUpdated"], /) -> Callable[
|
||||
[Callable[["GroupRelayUpdated"], Awaitable[None]]],
|
||||
Callable[["GroupRelayUpdated"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["rcvFileDescrReady"], /) -> Callable[
|
||||
[Callable[["RcvFileDescrReady"], Awaitable[None]]],
|
||||
Callable[["RcvFileDescrReady"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["rcvFileComplete"], /) -> Callable[
|
||||
[Callable[["RcvFileComplete"], Awaitable[None]]],
|
||||
Callable[["RcvFileComplete"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["sndFileCompleteXFTP"], /) -> Callable[
|
||||
[Callable[["SndFileCompleteXFTP"], Awaitable[None]]],
|
||||
Callable[["SndFileCompleteXFTP"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["rcvFileStart"], /) -> Callable[
|
||||
[Callable[["RcvFileStart"], Awaitable[None]]],
|
||||
Callable[["RcvFileStart"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["rcvFileSndCancelled"], /) -> Callable[
|
||||
[Callable[["RcvFileSndCancelled"], Awaitable[None]]],
|
||||
Callable[["RcvFileSndCancelled"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["rcvFileAccepted"], /) -> Callable[
|
||||
[Callable[["RcvFileAccepted"], Awaitable[None]]],
|
||||
Callable[["RcvFileAccepted"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["rcvFileError"], /) -> Callable[
|
||||
[Callable[["RcvFileError"], Awaitable[None]]],
|
||||
Callable[["RcvFileError"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["rcvFileWarning"], /) -> Callable[
|
||||
[Callable[["RcvFileWarning"], Awaitable[None]]],
|
||||
Callable[["RcvFileWarning"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["sndFileError"], /) -> Callable[
|
||||
[Callable[["SndFileError"], Awaitable[None]]],
|
||||
Callable[["SndFileError"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["sndFileWarning"], /) -> Callable[
|
||||
[Callable[["SndFileWarning"], Awaitable[None]]],
|
||||
Callable[["SndFileWarning"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["acceptingContactRequest"], /) -> Callable[
|
||||
[Callable[["AcceptingContactRequest"], Awaitable[None]]],
|
||||
Callable[["AcceptingContactRequest"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["acceptingBusinessRequest"], /) -> Callable[
|
||||
[Callable[["AcceptingBusinessRequest"], Awaitable[None]]],
|
||||
Callable[["AcceptingBusinessRequest"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["contactConnecting"], /) -> Callable[
|
||||
[Callable[["ContactConnecting"], Awaitable[None]]],
|
||||
Callable[["ContactConnecting"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["businessLinkConnecting"], /) -> Callable[
|
||||
[Callable[["BusinessLinkConnecting"], Awaitable[None]]],
|
||||
Callable[["BusinessLinkConnecting"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["joinedGroupMemberConnecting"], /) -> Callable[
|
||||
[Callable[["JoinedGroupMemberConnecting"], Awaitable[None]]],
|
||||
Callable[["JoinedGroupMemberConnecting"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["groupLinkConnecting"], /) -> Callable[
|
||||
[Callable[["GroupLinkConnecting"], Awaitable[None]]],
|
||||
Callable[["GroupLinkConnecting"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["hostConnected"], /) -> Callable[
|
||||
[Callable[["HostConnected"], Awaitable[None]]],
|
||||
Callable[["HostConnected"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["hostDisconnected"], /) -> Callable[
|
||||
[Callable[["HostDisconnected"], Awaitable[None]]],
|
||||
Callable[["HostDisconnected"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["subscriptionStatus"], /) -> Callable[
|
||||
[Callable[["SubscriptionStatus"], Awaitable[None]]],
|
||||
Callable[["SubscriptionStatus"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["serviceRequest"], /) -> Callable[
|
||||
[Callable[["ServiceRequest"], Awaitable[None]]],
|
||||
Callable[["ServiceRequest"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["serviceReplySent"], /) -> Callable[
|
||||
[Callable[["ServiceReplySent"], Awaitable[None]]],
|
||||
Callable[["ServiceReplySent"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["remoteCtrlSessionCode"], /) -> Callable[
|
||||
[Callable[["RemoteCtrlSessionCode"], Awaitable[None]]],
|
||||
Callable[["RemoteCtrlSessionCode"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["remoteCtrlStopped"], /) -> Callable[
|
||||
[Callable[["RemoteCtrlStopped"], Awaitable[None]]],
|
||||
Callable[["RemoteCtrlStopped"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["messageError"], /) -> Callable[
|
||||
[Callable[["MessageError"], Awaitable[None]]],
|
||||
Callable[["MessageError"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["chatError"], /) -> Callable[
|
||||
[Callable[["ChatError"], Awaitable[None]]],
|
||||
Callable[["ChatError"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: Literal["chatErrors"], /) -> Callable[
|
||||
[Callable[["ChatErrors"], Awaitable[None]]],
|
||||
Callable[["ChatErrors"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, event: str, /) -> Callable[
|
||||
[Callable[["ChatEvent"], Awaitable[None]]],
|
||||
Callable[["ChatEvent"], Awaitable[None]],
|
||||
]: ...
|
||||
|
||||
@@ -0,0 +1,423 @@
|
||||
# API Responses
|
||||
# This file is generated automatically.
|
||||
from __future__ import annotations
|
||||
from typing import Literal, NotRequired, TypedDict
|
||||
from . import _types as T
|
||||
|
||||
class AcceptingContactRequest(TypedDict):
|
||||
type: Literal["acceptingContactRequest"]
|
||||
user: "T.User"
|
||||
contact: "T.Contact"
|
||||
|
||||
class ActiveUser(TypedDict):
|
||||
type: Literal["activeUser"]
|
||||
user: "T.User"
|
||||
|
||||
class ChatItemNotChanged(TypedDict):
|
||||
type: Literal["chatItemNotChanged"]
|
||||
user: "T.User"
|
||||
chatItem: "T.AChatItem"
|
||||
|
||||
class ChatItemReaction(TypedDict):
|
||||
type: Literal["chatItemReaction"]
|
||||
user: "T.User"
|
||||
added: bool
|
||||
reaction: "T.ACIReaction"
|
||||
|
||||
class ChatItemUpdated(TypedDict):
|
||||
type: Literal["chatItemUpdated"]
|
||||
user: "T.User"
|
||||
chatItem: "T.AChatItem"
|
||||
|
||||
class ChatItemsDeleted(TypedDict):
|
||||
type: Literal["chatItemsDeleted"]
|
||||
user: "T.User"
|
||||
chatItemDeletions: list["T.ChatItemDeletion"]
|
||||
byUser: bool
|
||||
timed: bool
|
||||
|
||||
class ChatMsgContent(TypedDict):
|
||||
type: Literal["chatMsgContent"]
|
||||
user: "T.User"
|
||||
msgContent: "T.MsgContent"
|
||||
|
||||
class ChatRunning(TypedDict):
|
||||
type: Literal["chatRunning"]
|
||||
|
||||
class ChatStarted(TypedDict):
|
||||
type: Literal["chatStarted"]
|
||||
|
||||
class ChatStopped(TypedDict):
|
||||
type: Literal["chatStopped"]
|
||||
|
||||
class CmdOk(TypedDict):
|
||||
type: Literal["cmdOk"]
|
||||
user_: NotRequired["T.User"]
|
||||
|
||||
class ChatCmdError(TypedDict):
|
||||
type: Literal["chatCmdError"]
|
||||
chatError: "T.ChatError"
|
||||
|
||||
class ConnectionPlan(TypedDict):
|
||||
type: Literal["connectionPlan"]
|
||||
user: "T.User"
|
||||
connLink: NotRequired["T.CreatedConnLink"]
|
||||
planSimplexName: NotRequired["T.SimplexNameInfo"]
|
||||
otherSimplexName: NotRequired["T.SimplexNameInfo"]
|
||||
connectionPlan: "T.ConnectionPlan"
|
||||
|
||||
class ContactAlreadyExists(TypedDict):
|
||||
type: Literal["contactAlreadyExists"]
|
||||
user: "T.User"
|
||||
contact: "T.Contact"
|
||||
|
||||
class ContactConnectionDeleted(TypedDict):
|
||||
type: Literal["contactConnectionDeleted"]
|
||||
user: "T.User"
|
||||
connection: "T.PendingContactConnection"
|
||||
|
||||
class ContactDeleted(TypedDict):
|
||||
type: Literal["contactDeleted"]
|
||||
user: "T.User"
|
||||
contact: "T.Contact"
|
||||
|
||||
class ContactPrefsUpdated(TypedDict):
|
||||
type: Literal["contactPrefsUpdated"]
|
||||
user: "T.User"
|
||||
fromContact: "T.Contact"
|
||||
toContact: "T.Contact"
|
||||
|
||||
class ContactRequestRejected(TypedDict):
|
||||
type: Literal["contactRequestRejected"]
|
||||
user: "T.User"
|
||||
contactRequest: "T.UserContactRequest"
|
||||
contact_: NotRequired["T.Contact"]
|
||||
|
||||
class ContactsList(TypedDict):
|
||||
type: Literal["contactsList"]
|
||||
user: "T.User"
|
||||
contacts: list["T.Contact"]
|
||||
|
||||
class GroupDeletedUser(TypedDict):
|
||||
type: Literal["groupDeletedUser"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
msgSigned: bool
|
||||
localDeletion: bool
|
||||
|
||||
class GroupLink(TypedDict):
|
||||
type: Literal["groupLink"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
groupLink: "T.GroupLink"
|
||||
|
||||
class GroupLinkCreated(TypedDict):
|
||||
type: Literal["groupLinkCreated"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
groupLink: "T.GroupLink"
|
||||
|
||||
class GroupLinkDeleted(TypedDict):
|
||||
type: Literal["groupLinkDeleted"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
|
||||
class GroupCreated(TypedDict):
|
||||
type: Literal["groupCreated"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
|
||||
class PublicGroupCreated(TypedDict):
|
||||
type: Literal["publicGroupCreated"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
groupLink: "T.GroupLink"
|
||||
groupRelays: list["T.GroupRelay"]
|
||||
|
||||
class PublicGroupCreationFailed(TypedDict):
|
||||
type: Literal["publicGroupCreationFailed"]
|
||||
user: "T.User"
|
||||
addRelayResults: list["T.AddRelayResult"]
|
||||
|
||||
class GroupRelays(TypedDict):
|
||||
type: Literal["groupRelays"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
groupRelays: list["T.GroupRelay"]
|
||||
|
||||
class GroupRelaysAdded(TypedDict):
|
||||
type: Literal["groupRelaysAdded"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
groupLink: "T.GroupLink"
|
||||
groupRelays: list["T.GroupRelay"]
|
||||
|
||||
class GroupRelaysAddFailed(TypedDict):
|
||||
type: Literal["groupRelaysAddFailed"]
|
||||
user: "T.User"
|
||||
addRelayResults: list["T.AddRelayResult"]
|
||||
|
||||
class RelayGroupAllowed(TypedDict):
|
||||
type: Literal["relayGroupAllowed"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
|
||||
class GroupMembers(TypedDict):
|
||||
type: Literal["groupMembers"]
|
||||
user: "T.User"
|
||||
group: "T.Group"
|
||||
|
||||
class GroupUpdated(TypedDict):
|
||||
type: Literal["groupUpdated"]
|
||||
user: "T.User"
|
||||
fromGroup: "T.GroupInfo"
|
||||
toGroup: "T.GroupInfo"
|
||||
member_: NotRequired["T.GroupMember"]
|
||||
msgSigned: bool
|
||||
|
||||
class GroupsList(TypedDict):
|
||||
type: Literal["groupsList"]
|
||||
user: "T.User"
|
||||
groups: list["T.GroupInfo"]
|
||||
|
||||
class GroupDomainVerified(TypedDict):
|
||||
type: Literal["groupDomainVerified"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
verificationFailure: NotRequired[str]
|
||||
|
||||
class Invitation(TypedDict):
|
||||
type: Literal["invitation"]
|
||||
user: "T.User"
|
||||
connLinkInvitation: "T.CreatedConnLink"
|
||||
connection: "T.PendingContactConnection"
|
||||
|
||||
class LeftMemberUser(TypedDict):
|
||||
type: Literal["leftMemberUser"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
|
||||
class MemberAccepted(TypedDict):
|
||||
type: Literal["memberAccepted"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
member: "T.GroupMember"
|
||||
|
||||
class MembersBlockedForAllUser(TypedDict):
|
||||
type: Literal["membersBlockedForAllUser"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
members: list["T.GroupMember"]
|
||||
blocked: bool
|
||||
msgSigned: bool
|
||||
|
||||
class MembersRoleUser(TypedDict):
|
||||
type: Literal["membersRoleUser"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
members: list["T.GroupMember"]
|
||||
toRole: "T.GroupMemberRole"
|
||||
msgSigned: bool
|
||||
|
||||
class NewChatItems(TypedDict):
|
||||
type: Literal["newChatItems"]
|
||||
user: "T.User"
|
||||
chatItems: list["T.AChatItem"]
|
||||
|
||||
class RcvFileAccepted(TypedDict):
|
||||
type: Literal["rcvFileAccepted"]
|
||||
user: "T.User"
|
||||
chatItem: "T.AChatItem"
|
||||
|
||||
class RcvFileAcceptedSndCancelled(TypedDict):
|
||||
type: Literal["rcvFileAcceptedSndCancelled"]
|
||||
user: "T.User"
|
||||
rcvFileTransfer: "T.RcvFileTransfer"
|
||||
|
||||
class RcvFileCancelled(TypedDict):
|
||||
type: Literal["rcvFileCancelled"]
|
||||
user: "T.User"
|
||||
chatItem_: NotRequired["T.AChatItem"]
|
||||
rcvFileTransfer: "T.RcvFileTransfer"
|
||||
|
||||
class RemoteCtrlConnected(TypedDict):
|
||||
type: Literal["remoteCtrlConnected"]
|
||||
remoteCtrl: "T.RemoteCtrlInfo"
|
||||
compression: bool
|
||||
|
||||
class RemoteCtrlConnecting(TypedDict):
|
||||
type: Literal["remoteCtrlConnecting"]
|
||||
remoteCtrl_: NotRequired["T.RemoteCtrlInfo"]
|
||||
ctrlAppInfo: "T.CtrlAppInfo"
|
||||
appVersion: str
|
||||
|
||||
class SentConfirmation(TypedDict):
|
||||
type: Literal["sentConfirmation"]
|
||||
user: "T.User"
|
||||
connection: "T.PendingContactConnection"
|
||||
customUserProfile: NotRequired["T.Profile"]
|
||||
|
||||
class SentGroupInvitation(TypedDict):
|
||||
type: Literal["sentGroupInvitation"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
contact: "T.Contact"
|
||||
member: "T.GroupMember"
|
||||
|
||||
class SentInvitation(TypedDict):
|
||||
type: Literal["sentInvitation"]
|
||||
user: "T.User"
|
||||
connection: "T.PendingContactConnection"
|
||||
customUserProfile: NotRequired["T.Profile"]
|
||||
|
||||
class SentInvitationToContact(TypedDict):
|
||||
type: Literal["sentInvitationToContact"]
|
||||
user: "T.User"
|
||||
contact: "T.Contact"
|
||||
customUserProfile: NotRequired["T.Profile"]
|
||||
|
||||
class ServiceReplyAccepted(TypedDict):
|
||||
type: Literal["serviceReplyAccepted"]
|
||||
user: "T.User"
|
||||
connectionId: str
|
||||
|
||||
class SndFileCancelled(TypedDict):
|
||||
type: Literal["sndFileCancelled"]
|
||||
user: "T.User"
|
||||
chatItem_: NotRequired["T.AChatItem"]
|
||||
fileTransferMeta: "T.FileTransferMeta"
|
||||
sndFileTransfers: list["T.SndFileTransfer"]
|
||||
|
||||
class StartedConnectionToContact(TypedDict):
|
||||
type: Literal["startedConnectionToContact"]
|
||||
user: "T.User"
|
||||
contact: "T.Contact"
|
||||
customUserProfile: NotRequired["T.Profile"]
|
||||
|
||||
class StartedConnectionToGroup(TypedDict):
|
||||
type: Literal["startedConnectionToGroup"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
customUserProfile: NotRequired["T.Profile"]
|
||||
relayResults: list["T.RelayConnectionResult"]
|
||||
|
||||
class UserAcceptedGroupSent(TypedDict):
|
||||
type: Literal["userAcceptedGroupSent"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
hostContact: NotRequired["T.Contact"]
|
||||
|
||||
class UserContactLink(TypedDict):
|
||||
type: Literal["userContactLink"]
|
||||
user: "T.User"
|
||||
contactLink: "T.UserContactLink"
|
||||
|
||||
class UserContactLinkCreated(TypedDict):
|
||||
type: Literal["userContactLinkCreated"]
|
||||
user: "T.User"
|
||||
connLinkContact: "T.CreatedConnLink"
|
||||
|
||||
class UserContactLinkDeleted(TypedDict):
|
||||
type: Literal["userContactLinkDeleted"]
|
||||
user: "T.User"
|
||||
|
||||
class UserContactLinkUpdated(TypedDict):
|
||||
type: Literal["userContactLinkUpdated"]
|
||||
user: "T.User"
|
||||
contactLink: "T.UserContactLink"
|
||||
|
||||
class UserDeletedMembers(TypedDict):
|
||||
type: Literal["userDeletedMembers"]
|
||||
user: "T.User"
|
||||
groupInfo: "T.GroupInfo"
|
||||
members: list["T.GroupMember"]
|
||||
withMessages: bool
|
||||
msgSigned: bool
|
||||
|
||||
class UserProfileUpdated(TypedDict):
|
||||
type: Literal["userProfileUpdated"]
|
||||
user: "T.User"
|
||||
fromProfile: "T.Profile"
|
||||
toProfile: "T.Profile"
|
||||
updateSummary: "T.UserProfileUpdateSummary"
|
||||
|
||||
class UserProfileNoChange(TypedDict):
|
||||
type: Literal["userProfileNoChange"]
|
||||
user: "T.User"
|
||||
|
||||
class UsersList(TypedDict):
|
||||
type: Literal["usersList"]
|
||||
users: list["T.UserInfo"]
|
||||
|
||||
class ApiChats(TypedDict):
|
||||
type: Literal["apiChats"]
|
||||
user: "T.User"
|
||||
chats: list["T.AChat"]
|
||||
|
||||
ChatResponse = (
|
||||
AcceptingContactRequest
|
||||
| ActiveUser
|
||||
| ChatItemNotChanged
|
||||
| ChatItemReaction
|
||||
| ChatItemUpdated
|
||||
| ChatItemsDeleted
|
||||
| ChatMsgContent
|
||||
| ChatRunning
|
||||
| ChatStarted
|
||||
| ChatStopped
|
||||
| CmdOk
|
||||
| ChatCmdError
|
||||
| ConnectionPlan
|
||||
| ContactAlreadyExists
|
||||
| ContactConnectionDeleted
|
||||
| ContactDeleted
|
||||
| ContactPrefsUpdated
|
||||
| ContactRequestRejected
|
||||
| ContactsList
|
||||
| GroupDeletedUser
|
||||
| GroupLink
|
||||
| GroupLinkCreated
|
||||
| GroupLinkDeleted
|
||||
| GroupCreated
|
||||
| PublicGroupCreated
|
||||
| PublicGroupCreationFailed
|
||||
| GroupRelays
|
||||
| GroupRelaysAdded
|
||||
| GroupRelaysAddFailed
|
||||
| RelayGroupAllowed
|
||||
| GroupMembers
|
||||
| GroupUpdated
|
||||
| GroupsList
|
||||
| GroupDomainVerified
|
||||
| Invitation
|
||||
| LeftMemberUser
|
||||
| MemberAccepted
|
||||
| MembersBlockedForAllUser
|
||||
| MembersRoleUser
|
||||
| NewChatItems
|
||||
| RcvFileAccepted
|
||||
| RcvFileAcceptedSndCancelled
|
||||
| RcvFileCancelled
|
||||
| RemoteCtrlConnected
|
||||
| RemoteCtrlConnecting
|
||||
| SentConfirmation
|
||||
| SentGroupInvitation
|
||||
| SentInvitation
|
||||
| SentInvitationToContact
|
||||
| ServiceReplyAccepted
|
||||
| SndFileCancelled
|
||||
| StartedConnectionToContact
|
||||
| StartedConnectionToGroup
|
||||
| UserAcceptedGroupSent
|
||||
| UserContactLink
|
||||
| UserContactLinkCreated
|
||||
| UserContactLinkDeleted
|
||||
| UserContactLinkUpdated
|
||||
| UserDeletedMembers
|
||||
| UserProfileUpdated
|
||||
| UserProfileNoChange
|
||||
| UsersList
|
||||
| ApiChats
|
||||
)
|
||||
|
||||
ChatResponse_Tag = Literal["acceptingContactRequest", "activeUser", "chatItemNotChanged", "chatItemReaction", "chatItemUpdated", "chatItemsDeleted", "chatMsgContent", "chatRunning", "chatStarted", "chatStopped", "cmdOk", "chatCmdError", "connectionPlan", "contactAlreadyExists", "contactConnectionDeleted", "contactDeleted", "contactPrefsUpdated", "contactRequestRejected", "contactsList", "groupDeletedUser", "groupLink", "groupLinkCreated", "groupLinkDeleted", "groupCreated", "publicGroupCreated", "publicGroupCreationFailed", "groupRelays", "groupRelaysAdded", "groupRelaysAddFailed", "relayGroupAllowed", "groupMembers", "groupUpdated", "groupsList", "groupDomainVerified", "invitation", "leftMemberUser", "memberAccepted", "membersBlockedForAllUser", "membersRoleUser", "newChatItems", "rcvFileAccepted", "rcvFileAcceptedSndCancelled", "rcvFileCancelled", "remoteCtrlConnected", "remoteCtrlConnecting", "sentConfirmation", "sentGroupInvitation", "sentInvitation", "sentInvitationToContact", "serviceReplyAccepted", "sndFileCancelled", "startedConnectionToContact", "startedConnectionToGroup", "userAcceptedGroupSent", "userContactLink", "userContactLinkCreated", "userContactLinkDeleted", "userContactLinkUpdated", "userDeletedMembers", "userProfileUpdated", "userProfileNoChange", "usersList", "apiChats"]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -273,6 +273,16 @@ Query:
|
||||
Plan:
|
||||
SEARCH connections USING PRIMARY KEY (conn_id=?)
|
||||
|
||||
Query:
|
||||
SELECT user_id FROM users u
|
||||
WHERE u.deleted = ?
|
||||
AND NOT EXISTS (SELECT c.conn_id FROM connections c WHERE c.user_id = u.user_id)
|
||||
|
||||
Plan:
|
||||
SCAN u
|
||||
CORRELATED SCALAR SUBQUERY 1
|
||||
SEARCH c USING COVERING INDEX idx_connections_user (user_id=?)
|
||||
|
||||
Query:
|
||||
SELECT user_id FROM users u
|
||||
WHERE u.user_id = ?
|
||||
@@ -567,6 +577,15 @@ Query:
|
||||
Plan:
|
||||
SEARCH address_ratchet_keys USING INDEX idx_address_ratchet_keys (conn_id=? AND ratchet_key_id=?)
|
||||
|
||||
Query:
|
||||
UPDATE rcv_messages
|
||||
SET receive_attempts = receive_attempts + 1
|
||||
WHERE conn_id = ? AND internal_id = ?
|
||||
RETURNING receive_attempts
|
||||
|
||||
Plan:
|
||||
SEARCH rcv_messages USING COVERING INDEX idx_rcv_messages_conn_id_internal_id (conn_id=? AND internal_id=?)
|
||||
|
||||
Query:
|
||||
DELETE FROM address_ratchet_keys
|
||||
WHERE conn_id = ?
|
||||
@@ -591,6 +610,54 @@ Query:
|
||||
Plan:
|
||||
SEARCH conn_confirmations USING COVERING INDEX idx_conn_confirmations_conn_id (conn_id=?)
|
||||
|
||||
Query:
|
||||
DELETE FROM encrypted_rcv_message_hashes
|
||||
WHERE encrypted_rcv_message_hash_id IN (
|
||||
SELECT encrypted_rcv_message_hash_id
|
||||
FROM encrypted_rcv_message_hashes
|
||||
WHERE created_at < ?
|
||||
ORDER BY created_at ASC
|
||||
LIMIT ?
|
||||
)
|
||||
|
||||
Plan:
|
||||
SEARCH encrypted_rcv_message_hashes USING INTEGER PRIMARY KEY (rowid=?)
|
||||
LIST SUBQUERY 1
|
||||
SEARCH encrypted_rcv_message_hashes USING COVERING INDEX idx_encrypted_rcv_message_hashes_created_at (created_at<?)
|
||||
|
||||
Query:
|
||||
DELETE FROM messages
|
||||
WHERE (conn_id, internal_id) IN (
|
||||
SELECT conn_id, internal_id
|
||||
FROM messages
|
||||
WHERE internal_ts < ? AND internal_snd_id IS NOT NULL
|
||||
ORDER BY internal_ts ASC
|
||||
LIMIT ?
|
||||
)
|
||||
|
||||
Plan:
|
||||
SEARCH messages USING COVERING INDEX idx_messages_conn_id (conn_id=? AND internal_id=?)
|
||||
LIST SUBQUERY 1
|
||||
SEARCH messages USING INDEX idx_messages_internal_ts (internal_ts<?)
|
||||
SEARCH snd_message_deliveries USING COVERING INDEX idx_snd_message_deliveries_conn_id_internal_id (conn_id=? AND internal_id=?)
|
||||
SEARCH snd_messages USING COVERING INDEX idx_snd_messages_conn_id_internal_id (conn_id=? AND internal_id=?)
|
||||
SEARCH rcv_messages USING COVERING INDEX idx_rcv_messages_conn_id_internal_id (conn_id=? AND internal_id=?)
|
||||
|
||||
Query:
|
||||
DELETE FROM processed_ratchet_key_hashes
|
||||
WHERE processed_ratchet_key_hash_id IN (
|
||||
SELECT processed_ratchet_key_hash_id
|
||||
FROM processed_ratchet_key_hashes
|
||||
WHERE created_at < ?
|
||||
ORDER BY created_at ASC
|
||||
LIMIT ?
|
||||
)
|
||||
|
||||
Plan:
|
||||
SEARCH processed_ratchet_key_hashes USING INTEGER PRIMARY KEY (rowid=?)
|
||||
LIST SUBQUERY 1
|
||||
SEARCH processed_ratchet_key_hashes USING COVERING INDEX idx_processed_ratchet_key_hashes_created_at (created_at<?)
|
||||
|
||||
Query:
|
||||
INSERT INTO address_ratchet_keys
|
||||
(conn_id, ratchet_key_id, x3dh_priv_key_1, x3dh_priv_key_2, pq_priv_kem)
|
||||
@@ -732,6 +799,30 @@ Query:
|
||||
|
||||
Plan:
|
||||
|
||||
Query:
|
||||
SELECT rcv_file_id, rcv_file_entity_id, prefix_path
|
||||
FROM rcv_files
|
||||
WHERE created_at < ?
|
||||
|
||||
Plan:
|
||||
SCAN rcv_files
|
||||
|
||||
Query:
|
||||
SELECT rcv_file_id, rcv_file_entity_id, prefix_path
|
||||
FROM rcv_files
|
||||
WHERE deleted = 1
|
||||
|
||||
Plan:
|
||||
SCAN rcv_files
|
||||
|
||||
Query:
|
||||
SELECT rcv_file_id, rcv_file_entity_id, tmp_path
|
||||
FROM rcv_files
|
||||
WHERE status IN (?,?) AND tmp_path IS NOT NULL
|
||||
|
||||
Plan:
|
||||
SEARCH rcv_files USING INDEX idx_rcv_files_status_created_at (status=?)
|
||||
|
||||
Query:
|
||||
SELECT rcv_replica_id, rcv_replica_key
|
||||
FROM snd_file_chunk_replica_recipients
|
||||
@@ -740,6 +831,30 @@ Query:
|
||||
Plan:
|
||||
SEARCH snd_file_chunk_replica_recipients USING INDEX idx_snd_file_chunk_replica_recipients_snd_file_chunk_replica_id (snd_file_chunk_replica_id=?)
|
||||
|
||||
Query:
|
||||
SELECT snd_file_id, snd_file_entity_id, prefix_path
|
||||
FROM snd_files
|
||||
WHERE created_at < ?
|
||||
|
||||
Plan:
|
||||
SCAN snd_files
|
||||
|
||||
Query:
|
||||
SELECT snd_file_id, snd_file_entity_id, prefix_path
|
||||
FROM snd_files
|
||||
WHERE deleted = 1
|
||||
|
||||
Plan:
|
||||
SCAN snd_files
|
||||
|
||||
Query:
|
||||
SELECT snd_file_id, snd_file_entity_id, prefix_path
|
||||
FROM snd_files
|
||||
WHERE status IN (?,?) AND prefix_path IS NOT NULL
|
||||
|
||||
Plan:
|
||||
SEARCH snd_files USING INDEX idx_snd_files_status_created_at (status=?)
|
||||
|
||||
Query:
|
||||
UPDATE client_services
|
||||
SET service_id = ?
|
||||
@@ -1044,6 +1159,10 @@ Query: DELETE FROM conn_invitations WHERE invitation_id = ?
|
||||
Plan:
|
||||
SEARCH conn_invitations USING PRIMARY KEY (invitation_id=?)
|
||||
|
||||
Query: DELETE FROM conn_invitations WHERE service_request = 1 AND created_at < ?
|
||||
Plan:
|
||||
SCAN conn_invitations
|
||||
|
||||
Query: DELETE FROM connections WHERE conn_id = ?
|
||||
Plan:
|
||||
SEARCH connections USING PRIMARY KEY (conn_id=?)
|
||||
@@ -1074,6 +1193,10 @@ SEARCH messages USING COVERING INDEX idx_messages_conn_id (conn_id=?)
|
||||
SEARCH snd_queues USING COVERING INDEX idx_snd_queue_id (conn_id=?)
|
||||
SEARCH rcv_queues USING COVERING INDEX idx_rcv_queue_id (conn_id=?)
|
||||
|
||||
Query: DELETE FROM deleted_snd_chunk_replicas WHERE created_at < ?
|
||||
Plan:
|
||||
SEARCH deleted_snd_chunk_replicas USING COVERING INDEX idx_deleted_snd_chunk_replicas_pending (created_at<?)
|
||||
|
||||
Query: DELETE FROM deleted_snd_chunk_replicas WHERE deleted_snd_chunk_replica_id = ?
|
||||
Plan:
|
||||
SEARCH deleted_snd_chunk_replicas USING INTEGER PRIMARY KEY (rowid=?)
|
||||
@@ -1093,6 +1216,10 @@ Query: DELETE FROM ntf_subscriptions WHERE conn_id = ?
|
||||
Plan:
|
||||
SEARCH ntf_subscriptions USING PRIMARY KEY (conn_id=?)
|
||||
|
||||
Query: DELETE FROM ntf_tokens_to_delete WHERE created_at < ?
|
||||
Plan:
|
||||
SCAN ntf_tokens_to_delete
|
||||
|
||||
Query: DELETE FROM ratchets WHERE conn_id = ?
|
||||
Plan:
|
||||
SEARCH ratchets USING PRIMARY KEY (conn_id=?)
|
||||
@@ -1218,6 +1345,18 @@ Query: SELECT conn_id FROM connections WHERE deleted = 0
|
||||
Plan:
|
||||
SEARCH connections USING COVERING INDEX idx_connections_deleted (deleted=?)
|
||||
|
||||
Query: SELECT conn_id FROM connections WHERE deleted = ?
|
||||
Plan:
|
||||
SEARCH connections USING COVERING INDEX idx_connections_deleted (deleted=?)
|
||||
|
||||
Query: SELECT conn_id FROM connections WHERE deleted_at_wait_delivery IS NOT NULL
|
||||
Plan:
|
||||
SCAN connections
|
||||
|
||||
Query: SELECT conn_id FROM connections WHERE service_request_expires_at < ? AND deleted = 0 AND deleted_at_wait_delivery IS NULL
|
||||
Plan:
|
||||
SEARCH connections USING INDEX idx_connections_deleted (deleted=?)
|
||||
|
||||
Query: SELECT conn_id FROM connections WHERE user_id = ?
|
||||
Plan:
|
||||
SEARCH connections USING COVERING INDEX idx_connections_user (user_id=?)
|
||||
@@ -1346,10 +1485,6 @@ Query: UPDATE ratchets SET ratchet_state = ? WHERE conn_id = ?
|
||||
Plan:
|
||||
SEARCH ratchets USING PRIMARY KEY (conn_id=?)
|
||||
|
||||
Query: UPDATE rcv_file_chunk_replicas SET delay = ?, retries = retries + 1, updated_at = ? WHERE rcv_file_chunk_replica_id = ?
|
||||
Plan:
|
||||
SEARCH rcv_file_chunk_replicas USING INTEGER PRIMARY KEY (rowid=?)
|
||||
|
||||
Query: UPDATE rcv_file_chunk_replicas SET received = 1, updated_at = ? WHERE rcv_file_chunk_replica_id = ?
|
||||
Plan:
|
||||
SEARCH rcv_file_chunk_replicas USING INTEGER PRIMARY KEY (rowid=?)
|
||||
|
||||
@@ -926,16 +926,6 @@ Query:
|
||||
Plan:
|
||||
SEARCH chat_items USING COVERING INDEX idx_chat_items_contacts_created_at (user_id=? AND contact_id=?)
|
||||
|
||||
Query:
|
||||
SELECT chat_item_id
|
||||
FROM chat_items
|
||||
WHERE user_id = ? AND group_id = ? AND group_member_id = ?
|
||||
ORDER BY item_ts DESC, chat_item_id DESC
|
||||
LIMIT 1
|
||||
|
||||
Plan:
|
||||
SEARCH chat_items USING INDEX idx_chat_items_groups_item_ts (user_id=? AND group_id=?)
|
||||
|
||||
Query:
|
||||
SELECT chat_item_id, contact_id, group_id, group_scope_tag, group_scope_group_member_id, note_folder_id
|
||||
FROM chat_items
|
||||
@@ -4927,13 +4917,6 @@ Query:
|
||||
|
||||
Plan:
|
||||
|
||||
Query:
|
||||
INSERT INTO calls
|
||||
(contact_id, shared_call_id, call_uuid, chat_item_id, call_state, call_ts, user_id, created_at, updated_at)
|
||||
VALUES (?,?,?,?,?,?,?,?,?)
|
||||
|
||||
Plan:
|
||||
|
||||
Query:
|
||||
INSERT INTO chat_item_versions (chat_item_id, msg_content, item_version_ts)
|
||||
VALUES (?,?,?)
|
||||
@@ -6518,6 +6501,13 @@ Query:
|
||||
Plan:
|
||||
SEARCH user_contact_links USING INDEX sqlite_autoindex_user_contact_links_1 (user_id=?)
|
||||
|
||||
Query:
|
||||
SELECT user_contact_link_id, conn_req_contact, short_link_contact, short_link_data_set, short_link_large_data_set, business_address, auto_accept, auto_accept_incognito, auto_reply_msg_content
|
||||
FROM user_contact_links
|
||||
WHERE user_id = ? AND group_id IS NULL AND short_link_contact IS NOT NULL
|
||||
Plan:
|
||||
SEARCH user_contact_links USING INDEX idx_user_contact_links_group_id (group_id=?)
|
||||
|
||||
Query:
|
||||
SELECT user_contact_link_id, conn_req_contact, short_link_contact, short_link_data_set, short_link_large_data_set, business_address, auto_accept, auto_accept_incognito, auto_reply_msg_content
|
||||
FROM user_contact_links
|
||||
@@ -6644,10 +6634,6 @@ Error: SQLite3 returned ErrorError while attempting to perform prepare "explain
|
||||
Query: DELETE FROM app_settings
|
||||
Plan:
|
||||
|
||||
Query: DELETE FROM calls WHERE user_id = ? AND contact_id = ?
|
||||
Plan:
|
||||
SEARCH calls USING INDEX idx_calls_contact_id (contact_id=?)
|
||||
|
||||
Query: DELETE FROM chat_item_mentions WHERE chat_item_id = ?
|
||||
Plan:
|
||||
SEARCH chat_item_mentions USING COVERING INDEX idx_chat_item_mentions_chat_item_id (chat_item_id=?)
|
||||
@@ -7455,6 +7441,10 @@ Query: SELECT contact_domain_resolved_at, contact_domain_expires_at FROM contact
|
||||
Plan:
|
||||
SEARCH contact_profiles USING INTEGER PRIMARY KEY (rowid=?)
|
||||
|
||||
Query: SELECT contact_id FROM contacts WHERE user_id = ? AND chat_item_ttl > 0
|
||||
Plan:
|
||||
SEARCH contacts USING INDEX idx_contacts_chat_ts (user_id=?)
|
||||
|
||||
Query: SELECT contact_id FROM contacts WHERE user_id = ? AND chat_item_ttl > 0 OR chat_item_ttl IS NULL
|
||||
Plan:
|
||||
SCAN contacts
|
||||
@@ -7495,10 +7485,6 @@ Query: SELECT count(1) FROM files WHERE file_digest IS NOT NULL
|
||||
Plan:
|
||||
SCAN files
|
||||
|
||||
Query: SELECT count(1) FROM group_members
|
||||
Plan:
|
||||
SCAN group_members USING COVERING INDEX idx_group_members_invited_by_group_member_id
|
||||
|
||||
Query: SELECT count(1) FROM pending_group_messages
|
||||
Plan:
|
||||
SCAN pending_group_messages USING COVERING INDEX idx_pending_group_messages_group_member_id
|
||||
@@ -7553,6 +7539,10 @@ Query: SELECT group_id FROM groups WHERE inv_queue_info = ? AND user_id = ? LIMI
|
||||
Plan:
|
||||
SEARCH groups USING INDEX sqlite_autoindex_groups_2 (user_id=?)
|
||||
|
||||
Query: SELECT group_id FROM groups WHERE user_id = ? AND chat_item_ttl > 0
|
||||
Plan:
|
||||
SEARCH groups USING INDEX sqlite_autoindex_groups_2 (user_id=?)
|
||||
|
||||
Query: SELECT group_id FROM groups WHERE user_id = ? AND chat_item_ttl > 0 OR chat_item_ttl IS NULL
|
||||
Plan:
|
||||
SCAN groups
|
||||
|
||||
Reference in New Issue
Block a user