From 87f8460856f6a7309bd84f3b2866a624f3d97f7b Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Fri, 11 Sep 2026 11:06:16 +0100 Subject: [PATCH] bot api types --- bots/api/TYPES.md | 60 +++++++++++++++- .../types/typescript/src/types.ts | 70 +++++++++++++++++-- .../src/simplex_chat/types/_types.py | 64 +++++++++++++++-- 3 files changed, 180 insertions(+), 14 deletions(-) diff --git a/bots/api/TYPES.md b/bots/api/TYPES.md index 203e790f1e..faa401f090 100644 --- a/bots/api/TYPES.md +++ b/bots/api/TYPES.md @@ -25,6 +25,7 @@ This file is generated automatically. - [CIDeleteMode](#cideletemode) - [CIDeleted](#cideleted) - [CIDirection](#cidirection) +- [CIFeed](#cifeed) - [CIFile](#cifile) - [CIFileStatus](#cifilestatus) - [CIForwardedFrom](#ciforwardedfrom) @@ -81,6 +82,7 @@ This file is generated automatically. - [E2EInfo](#e2einfo) - [ErrorType](#errortype) - [FeatureAllowed](#featureallowed) +- [Feed](#feed) - [FileDescr](#filedescr) - [FileError](#fileerror) - [FileErrorType](#fileerrortype) @@ -706,6 +708,10 @@ Moderated: - deletedTs: UTCTime? - byGroupMember: [GroupMember](#groupmember) +Deleting: +- type: "deleting" +- deletedTs: UTCTime? + --- @@ -735,6 +741,20 @@ LocalSnd: LocalRcv: - type: "localRcv" +FeedSnd: +- type: "feedSnd" + + +--- + +## CIFeed + +Whether feed edits still apply to the message in this chat. + +**Enum type**: +- "linked" +- "detached" + --- @@ -914,6 +934,7 @@ GroupLink: - forwardedByMember: int64? - showGroupAsSender: bool - msgVerified: [MsgVerified](#msgverified)? +- itemFeed: [CIFeed](#cifeed)? - createdAt: UTCTime - updatedAt: UTCTime @@ -1404,6 +1425,10 @@ Local: - type: "local" - noteFolder: [NoteFolder](#notefolder) +Feed: +- type: "feed" +- feed: [Feed](#feed) + ContactRequest: - type: "contactRequest" - contactRequest: [UserContactRequest](#usercontactrequest) @@ -1499,6 +1524,7 @@ ChatType_cmd_string(chatType) + str(chatId) + ((GroupChatScope_cmd_string(chatSc - enableNtfs: [MsgFilter](#msgfilter) - sendRcpts: bool? - favorite: bool +- dropFeed: bool --- @@ -1521,19 +1547,20 @@ ChatType_cmd_string(chatType) + str(chatId) + ((GroupChatScope_cmd_string(chatSc - "direct" - "group" - "local" +- "feed" **Syntax**: ``` -@|#|*| +@|#|*|%| ``` ```javascript -self == 'direct' ? '@' : self == 'group' ? '#' : self == 'local' ? '*' : '' // JavaScript +self == 'direct' ? '@' : self == 'group' ? '#' : self == 'local' ? '*' : self == 'feed' ? '%' : '' // JavaScript ``` ```python -'@' if str(self) == 'direct' else '#' if str(self) == 'group' else '*' if str(self) == 'local' else '' # Python +'@' if str(self) == 'direct' else '#' if str(self) == 'group' else '*' if str(self) == 'local' else '%' if str(self) == 'feed' else '' # Python ``` @@ -2054,6 +2081,22 @@ DUPLICATE_: - "no" +--- + +## Feed + +The chat of the messages broadcast to all contacts and customer groups. + +**Record type**: +- feedId: int64 +- userId: int64 +- createdAt: UTCTime +- updatedAt: UTCTime +- chatTs: UTCTime +- favorite: bool +- unread: bool + + --- ## FileDescr @@ -4014,6 +4057,17 @@ NoteFolderNotFound: UserNoteFolderNotFound: - type: "userNoteFolderNotFound" +FeedAlreadyExists: +- type: "feedAlreadyExists" +- feedId: int64 + +FeedNotFound: +- type: "feedNotFound" +- feedId: int64 + +UserFeedNotFound: +- type: "userFeedNotFound" + SndFileNotFound: - type: "sndFileNotFound" - fileId: int64 diff --git a/packages/simplex-chat-client/types/typescript/src/types.ts b/packages/simplex-chat-client/types/typescript/src/types.ts index 09c88069e2..79abf01788 100644 --- a/packages/simplex-chat-client/types/typescript/src/types.ts +++ b/packages/simplex-chat-client/types/typescript/src/types.ts @@ -600,10 +600,15 @@ export enum CIDeleteMode { History = "history", } -export type CIDeleted = CIDeleted.Deleted | CIDeleted.Blocked | CIDeleted.BlockedByAdmin | CIDeleted.Moderated +export type CIDeleted = + | CIDeleted.Deleted + | CIDeleted.Blocked + | CIDeleted.BlockedByAdmin + | CIDeleted.Moderated + | CIDeleted.Deleting export namespace CIDeleted { - export type Tag = "deleted" | "blocked" | "blockedByAdmin" | "moderated" + export type Tag = "deleted" | "blocked" | "blockedByAdmin" | "moderated" | "deleting" interface Interface { type: Tag @@ -630,6 +635,11 @@ export namespace CIDeleted { deletedTs?: string // ISO-8601 timestamp byGroupMember: GroupMember } + + export interface Deleting extends Interface { + type: "deleting" + deletedTs?: string // ISO-8601 timestamp + } } export type CIDirection = @@ -640,6 +650,7 @@ export type CIDirection = | CIDirection.ChannelRcv | CIDirection.LocalSnd | CIDirection.LocalRcv + | CIDirection.FeedSnd export namespace CIDirection { export type Tag = @@ -650,6 +661,7 @@ export namespace CIDirection { | "channelRcv" | "localSnd" | "localRcv" + | "feedSnd" interface Interface { type: Tag @@ -683,6 +695,16 @@ export namespace CIDirection { export interface LocalRcv extends Interface { type: "localRcv" } + + export interface FeedSnd extends Interface { + type: "feedSnd" + } +} +// Whether feed edits still apply to the message in this chat. + +export enum CIFeed { + Linked = "linked", + Detached = "detached", } export interface CIFile { @@ -898,6 +920,7 @@ export interface CIMeta { forwardedByMember?: number // int64 showGroupAsSender: boolean msgVerified?: MsgVerified + itemFeed?: CIFeed createdAt: string // ISO-8601 timestamp updatedAt: string // ISO-8601 timestamp } @@ -1621,11 +1644,12 @@ export type ChatInfo = | ChatInfo.Direct | ChatInfo.Group | ChatInfo.Local + | ChatInfo.Feed | ChatInfo.ContactRequest | ChatInfo.ContactConnection export namespace ChatInfo { - export type Tag = "direct" | "group" | "local" | "contactRequest" | "contactConnection" + export type Tag = "direct" | "group" | "local" | "feed" | "contactRequest" | "contactConnection" interface Interface { type: Tag @@ -1647,6 +1671,11 @@ export namespace ChatInfo { noteFolder: NoteFolder } + export interface Feed extends Interface { + type: "feed" + feed: Feed + } + export interface ContactRequest extends Interface { type: "contactRequest" contactRequest: UserContactRequest @@ -1719,6 +1748,7 @@ export interface ChatSettings { enableNtfs: MsgFilter sendRcpts?: boolean favorite: boolean + dropFeed: boolean } export interface ChatStats { @@ -1733,11 +1763,12 @@ export enum ChatType { Direct = "direct", Group = "group", Local = "local", + Feed = "feed", } export namespace ChatType { export function cmdString(self: ChatType): string { - return self == 'direct' ? '@' : self == 'group' ? '#' : self == 'local' ? '*' : '' + return self == 'direct' ? '@' : self == 'group' ? '#' : self == 'local' ? '*' : self == 'feed' ? '%' : '' } } @@ -2337,6 +2368,17 @@ export enum FeatureAllowed { Yes = "yes", No = "no", } +// The chat of the messages broadcast to all contacts and customer groups. + +export interface Feed { + feedId: number // int64 + userId: number // int64 + createdAt: string // ISO-8601 timestamp + updatedAt: string // ISO-8601 timestamp + chatTs: string // ISO-8601 timestamp + favorite: boolean + unread: boolean +} export interface FileDescr { fileDescrText: string @@ -4337,6 +4379,9 @@ export type StoreError = | StoreError.NoteFolderAlreadyExists | StoreError.NoteFolderNotFound | StoreError.UserNoteFolderNotFound + | StoreError.FeedAlreadyExists + | StoreError.FeedNotFound + | StoreError.UserFeedNotFound | StoreError.SndFileNotFound | StoreError.SndFileInvalid | StoreError.RcvFileNotFound @@ -4429,6 +4474,9 @@ export namespace StoreError { | "noteFolderAlreadyExists" | "noteFolderNotFound" | "userNoteFolderNotFound" + | "feedAlreadyExists" + | "feedNotFound" + | "userFeedNotFound" | "sndFileNotFound" | "sndFileInvalid" | "rcvFileNotFound" @@ -4656,6 +4704,20 @@ export namespace StoreError { type: "userNoteFolderNotFound" } + export interface FeedAlreadyExists extends Interface { + type: "feedAlreadyExists" + feedId: number // int64 + } + + export interface FeedNotFound extends Interface { + type: "feedNotFound" + feedId: number // int64 + } + + export interface UserFeedNotFound extends Interface { + type: "userFeedNotFound" + } + export interface SndFileNotFound extends Interface { type: "sndFileNotFound" fileId: number // int64 diff --git a/packages/simplex-chat-python/src/simplex_chat/types/_types.py b/packages/simplex-chat-python/src/simplex_chat/types/_types.py index 25206c8654..750d2f6eb6 100644 --- a/packages/simplex-chat-python/src/simplex_chat/types/_types.py +++ b/packages/simplex-chat-python/src/simplex_chat/types/_types.py @@ -436,9 +436,19 @@ class CIDeleted_moderated(TypedDict): deletedTs: NotRequired[str] # ISO-8601 timestamp byGroupMember: "GroupMember" -CIDeleted = CIDeleted_deleted | CIDeleted_blocked | CIDeleted_blockedByAdmin | CIDeleted_moderated +class CIDeleted_deleting(TypedDict): + type: Literal["deleting"] + deletedTs: NotRequired[str] # ISO-8601 timestamp -CIDeleted_Tag = Literal["deleted", "blocked", "blockedByAdmin", "moderated"] +CIDeleted = ( + CIDeleted_deleted + | CIDeleted_blocked + | CIDeleted_blockedByAdmin + | CIDeleted_moderated + | CIDeleted_deleting +) + +CIDeleted_Tag = Literal["deleted", "blocked", "blockedByAdmin", "moderated", "deleting"] class CIDirection_directSnd(TypedDict): type: Literal["directSnd"] @@ -462,6 +472,9 @@ class CIDirection_localSnd(TypedDict): class CIDirection_localRcv(TypedDict): type: Literal["localRcv"] +class CIDirection_feedSnd(TypedDict): + type: Literal["feedSnd"] + CIDirection = ( CIDirection_directSnd | CIDirection_directRcv @@ -470,9 +483,14 @@ CIDirection = ( | CIDirection_channelRcv | CIDirection_localSnd | CIDirection_localRcv + | CIDirection_feedSnd ) -CIDirection_Tag = Literal["directSnd", "directRcv", "groupSnd", "groupRcv", "channelRcv", "localSnd", "localRcv"] +CIDirection_Tag = Literal["directSnd", "directRcv", "groupSnd", "groupRcv", "channelRcv", "localSnd", "localRcv", "feedSnd"] + +# Whether feed edits still apply to the message in this chat. + +CIFeed = Literal["linked", "detached"] class CIFile(TypedDict): fileId: int # int64 @@ -634,6 +652,7 @@ class CIMeta(TypedDict): forwardedByMember: NotRequired[int] # int64 showGroupAsSender: bool msgVerified: NotRequired["MsgVerified"] + itemFeed: NotRequired["CIFeed"] createdAt: str # ISO-8601 timestamp updatedAt: str # ISO-8601 timestamp @@ -1147,6 +1166,10 @@ class ChatInfo_local(TypedDict): type: Literal["local"] noteFolder: "NoteFolder" +class ChatInfo_feed(TypedDict): + type: Literal["feed"] + feed: "Feed" + class ChatInfo_contactRequest(TypedDict): type: Literal["contactRequest"] contactRequest: "UserContactRequest" @@ -1159,11 +1182,12 @@ ChatInfo = ( ChatInfo_direct | ChatInfo_group | ChatInfo_local + | ChatInfo_feed | ChatInfo_contactRequest | ChatInfo_contactConnection ) -ChatInfo_Tag = Literal["direct", "group", "local", "contactRequest", "contactConnection"] +ChatInfo_Tag = Literal["direct", "group", "local", "feed", "contactRequest", "contactConnection"] class ChatItem(TypedDict): chatDir: "CIDirection" @@ -1211,6 +1235,7 @@ class ChatSettings(TypedDict): enableNtfs: "MsgFilter" sendRcpts: NotRequired[bool] favorite: bool + dropFeed: bool class ChatStats(TypedDict): unreadCount: int # int @@ -1219,11 +1244,11 @@ class ChatStats(TypedDict): minUnreadItemId: int # int64 unreadChat: bool -ChatType = Literal["direct", "group", "local"] +ChatType = Literal["direct", "group", "local", "feed"] def ChatType_cmd_string(self: ChatType) -> str: - return '@' if str(self) == 'direct' else '#' if str(self) == 'group' else '*' if str(self) == 'local' else '' + return '@' if str(self) == 'direct' else '#' if str(self) == 'group' else '*' if str(self) == 'local' else '%' if str(self) == 'feed' else '' class ChatWallpaper(TypedDict): preset: NotRequired[str] @@ -1644,6 +1669,17 @@ ErrorType_Tag = Literal["BLOCK", "SESSION", "CMD", "PROXY", "AUTH", "BLOCKED", " FeatureAllowed = Literal["always", "yes", "no"] +# The chat of the messages broadcast to all contacts and customer groups. + +class Feed(TypedDict): + feedId: int # int64 + userId: int # int64 + createdAt: str # ISO-8601 timestamp + updatedAt: str # ISO-8601 timestamp + chatTs: str # ISO-8601 timestamp + favorite: bool + unread: bool + class FileDescr(TypedDict): fileDescrText: str fileDescrPartNo: int # int @@ -3135,6 +3171,17 @@ class StoreError_noteFolderNotFound(TypedDict): class StoreError_userNoteFolderNotFound(TypedDict): type: Literal["userNoteFolderNotFound"] +class StoreError_feedAlreadyExists(TypedDict): + type: Literal["feedAlreadyExists"] + feedId: int # int64 + +class StoreError_feedNotFound(TypedDict): + type: Literal["feedNotFound"] + feedId: int # int64 + +class StoreError_userFeedNotFound(TypedDict): + type: Literal["userFeedNotFound"] + class StoreError_sndFileNotFound(TypedDict): type: Literal["sndFileNotFound"] fileId: int # int64 @@ -3381,6 +3428,9 @@ StoreError = ( | StoreError_noteFolderAlreadyExists | StoreError_noteFolderNotFound | StoreError_userNoteFolderNotFound + | StoreError_feedAlreadyExists + | StoreError_feedNotFound + | StoreError_userFeedNotFound | StoreError_sndFileNotFound | StoreError_sndFileInvalid | StoreError_rcvFileNotFound @@ -3436,7 +3486,7 @@ StoreError = ( | StoreError_workItemError ) -StoreError_Tag = Literal["duplicateName", "userNotFound", "relayUserNotFound", "userNotFoundByName", "userNotFoundByContactId", "userNotFoundByGroupId", "userNotFoundByFileId", "userNotFoundByContactRequestId", "contactNotFound", "contactNotFoundByName", "contactNotFoundByMemberId", "contactNotReady", "duplicateContactLink", "userContactLinkNotFound", "contactRequestNotFound", "contactRequestNotFoundByName", "invalidContactRequestEntity", "invalidBusinessChatContactRequest", "groupNotFound", "groupNotFoundByName", "groupMemberNameNotFound", "groupMemberNotFound", "groupMemberNotFoundByIndex", "memberRelationsVectorNotFound", "groupHostMemberNotFound", "groupMemberNotFoundByMemberId", "memberContactGroupMemberNotFound", "invalidMemberRelationUpdate", "groupWithoutUser", "duplicateGroupMember", "duplicateMemberId", "groupAlreadyJoined", "groupInvitationNotFound", "noteFolderAlreadyExists", "noteFolderNotFound", "userNoteFolderNotFound", "sndFileNotFound", "sndFileInvalid", "rcvFileNotFound", "rcvFileDescrNotFound", "fileNotFound", "rcvFileInvalid", "rcvFileInvalidDescrPart", "localFileNoTransfer", "sharedMsgIdNotFoundByFileId", "fileIdNotFoundBySharedMsgId", "sndFileNotFoundXFTP", "rcvFileNotFoundXFTP", "connectionNotFound", "connectionNotFoundById", "connectionNotFoundByMemberId", "pendingConnectionNotFound", "uniqueID", "largeMsg", "internalError", "dBException", "dBBusyError", "badChatItem", "chatItemNotFound", "chatItemNotFoundByText", "chatItemSharedMsgIdNotFound", "chatItemNotFoundByFileId", "chatItemNotFoundByContactId", "chatItemNotFoundByGroupId", "profileNotFound", "duplicateGroupLink", "groupLinkNotFound", "hostMemberIdNotFound", "contactNotFoundByFileId", "noGroupSndStatus", "duplicateGroupMessage", "remoteHostNotFound", "remoteHostUnknown", "remoteHostDuplicateCA", "remoteCtrlNotFound", "remoteCtrlDuplicateCA", "prohibitedDeleteUser", "operatorNotFound", "usageConditionsNotFound", "userChatRelayNotFound", "groupRelayNotFound", "groupRelayNotFoundByMemberId", "invalidQuote", "invalidMention", "invalidDeliveryTask", "deliveryTaskNotFound", "invalidDeliveryJob", "deliveryJobNotFound", "workItemError"] +StoreError_Tag = Literal["duplicateName", "userNotFound", "relayUserNotFound", "userNotFoundByName", "userNotFoundByContactId", "userNotFoundByGroupId", "userNotFoundByFileId", "userNotFoundByContactRequestId", "contactNotFound", "contactNotFoundByName", "contactNotFoundByMemberId", "contactNotReady", "duplicateContactLink", "userContactLinkNotFound", "contactRequestNotFound", "contactRequestNotFoundByName", "invalidContactRequestEntity", "invalidBusinessChatContactRequest", "groupNotFound", "groupNotFoundByName", "groupMemberNameNotFound", "groupMemberNotFound", "groupMemberNotFoundByIndex", "memberRelationsVectorNotFound", "groupHostMemberNotFound", "groupMemberNotFoundByMemberId", "memberContactGroupMemberNotFound", "invalidMemberRelationUpdate", "groupWithoutUser", "duplicateGroupMember", "duplicateMemberId", "groupAlreadyJoined", "groupInvitationNotFound", "noteFolderAlreadyExists", "noteFolderNotFound", "userNoteFolderNotFound", "feedAlreadyExists", "feedNotFound", "userFeedNotFound", "sndFileNotFound", "sndFileInvalid", "rcvFileNotFound", "rcvFileDescrNotFound", "fileNotFound", "rcvFileInvalid", "rcvFileInvalidDescrPart", "localFileNoTransfer", "sharedMsgIdNotFoundByFileId", "fileIdNotFoundBySharedMsgId", "sndFileNotFoundXFTP", "rcvFileNotFoundXFTP", "connectionNotFound", "connectionNotFoundById", "connectionNotFoundByMemberId", "pendingConnectionNotFound", "uniqueID", "largeMsg", "internalError", "dBException", "dBBusyError", "badChatItem", "chatItemNotFound", "chatItemNotFoundByText", "chatItemSharedMsgIdNotFound", "chatItemNotFoundByFileId", "chatItemNotFoundByContactId", "chatItemNotFoundByGroupId", "profileNotFound", "duplicateGroupLink", "groupLinkNotFound", "hostMemberIdNotFound", "contactNotFoundByFileId", "noGroupSndStatus", "duplicateGroupMessage", "remoteHostNotFound", "remoteHostUnknown", "remoteHostDuplicateCA", "remoteCtrlNotFound", "remoteCtrlDuplicateCA", "prohibitedDeleteUser", "operatorNotFound", "usageConditionsNotFound", "userChatRelayNotFound", "groupRelayNotFound", "groupRelayNotFoundByMemberId", "invalidQuote", "invalidMention", "invalidDeliveryTask", "deliveryTaskNotFound", "invalidDeliveryJob", "deliveryJobNotFound", "workItemError"] class SubscriptionStatus_active(TypedDict): type: Literal["active"]