diff --git a/apps/ios/Shared/Model/AppAPITypes.swift b/apps/ios/Shared/Model/AppAPITypes.swift index 357d3a28c5..0c9825eda7 100644 --- a/apps/ios/Shared/Model/AppAPITypes.swift +++ b/apps/ios/Shared/Model/AppAPITypes.swift @@ -1496,29 +1496,28 @@ enum NameRegistration: Hashable { } } -// stock derivation cannot decode this: the core encodes it with a flat "type" tag, not swift's nested shape extension NameRegistration: Decodable { private enum CodingKeys: String, CodingKey { case type, expires, graceUntil, reservedReason_, pricing, reservedReason } init(from decoder: Decoder) throws { - let c = try decoder.container(keyedBy: CodingKeys.self) - let type = try c.decode(String.self, forKey: CodingKeys.type) + let container = try decoder.container(keyedBy: CodingKeys.self) + let type = try container.decode(String.self, forKey: .type) switch type { case "registered": - let expires = try c.decodeIfPresent(Int64.self, forKey: CodingKeys.expires) - let graceUntil = try c.decodeIfPresent(Int64.self, forKey: CodingKeys.graceUntil) - let reservedReason_ = try c.decodeIfPresent(String.self, forKey: CodingKeys.reservedReason_) + let expires = try container.decodeIfPresent(Int64.self, forKey: .expires) + let graceUntil = try container.decodeIfPresent(Int64.self, forKey: .graceUntil) + let reservedReason_ = try container.decodeIfPresent(String.self, forKey: .reservedReason_) self = .registered(expires: expires, graceUntil: graceUntil, reservedReason_: reservedReason_) case "available": - let pricing = try c.decode(NamePricing.self, forKey: CodingKeys.pricing) + let pricing = try container.decode(NamePricing.self, forKey: .pricing) self = .available(pricing: pricing) case "reserved": - let reservedReason = try c.decode(String.self, forKey: CodingKeys.reservedReason) + let reservedReason = try container.decode(String.self, forKey: .reservedReason) self = .reserved(reservedReason: reservedReason) default: - throw DecodingError.dataCorruptedError(forKey: CodingKeys.type, in: c, debugDescription: "Unsupported name registration type: \(type)") + throw DecodingError.dataCorruptedError(forKey: .type, in: container, debugDescription: "Unknown NameRegistration type: \(type)") } } } diff --git a/apps/ios/Shared/Model/ChatModel.swift b/apps/ios/Shared/Model/ChatModel.swift index 48f47b8b63..6a5b1de353 100644 --- a/apps/ios/Shared/Model/ChatModel.swift +++ b/apps/ios/Shared/Model/ChatModel.swift @@ -1499,8 +1499,3 @@ enum UIRemoteCtrlSessionState { case pendingConfirmation(remoteCtrl_: RemoteCtrlInfo?, sessionCode: String) case connected(remoteCtrl: RemoteCtrlInfo, sessionCode: String) } - -struct SimplexNameResolved: Codable { - var at: Int64 - var expires: Int64? -} diff --git a/apps/ios/Shared/Model/SimpleXAPI.swift b/apps/ios/Shared/Model/SimpleXAPI.swift index 2324fbd42a..742ef20688 100644 --- a/apps/ios/Shared/Model/SimpleXAPI.swift +++ b/apps/ios/Shared/Model/SimpleXAPI.swift @@ -1051,7 +1051,7 @@ func apiConnectPlan(connLink: String, resolveMode: PlanResolveMode = .unknown, l } // a .never (typing) search that matches nothing locally is not an error to surface if case .error(.error(.notResolvedLocally)) = r { return nil } - if let r, inProgress.boxedValue { await apiConnectResponseAlert(r) } + if let r { await apiConnectResponseAlert(r) } return nil } diff --git a/apps/ios/Shared/Views/NewChat/NewChatView.swift b/apps/ios/Shared/Views/NewChat/NewChatView.swift index 76b6ffb7da..86ad421c8b 100644 --- a/apps/ios/Shared/Views/NewChat/NewChatView.swift +++ b/apps/ios/Shared/Views/NewChat/NewChatView.swift @@ -1321,34 +1321,6 @@ private func showOpenKnownGroupAlert( private let simplexNamesHowToURL = "https://simplex.domains/#testing" -private let nameResolvedDaySeconds: Int64 = 24 * 60 * 60 - -private func nowSeconds() -> Int64 { Int64(Date.now.timeIntervalSince1970) } - -private func saveNamesResolvedAt(_ m: [String: SimplexNameResolved]) { - let now = nowSeconds() - simplexNamesResolvedAtDefault.set(m.filter { now - $0.value.at < 7 * nameResolvedDaySeconds }) -} - -func simplexNameResolvedRecently(_ domain: SimplexDomain) -> Bool { - guard let r = simplexNamesResolvedAtDefault.get()[domain.fullDomainName] else { return false } - let now = nowSeconds() - if now - r.at >= nameResolvedDaySeconds { return false } - return r.expires.map { now < $0 } ?? true -} - -func recordSimplexNameResolved(_ domain: SimplexDomain, _ reg: NameRegistration?) { - var m = simplexNamesResolvedAtDefault.get() - let expires: Int64? = if case let .registered(expires, _, _) = reg { expires } else { nil } - m[domain.fullDomainName] = SimplexNameResolved(at: nowSeconds(), expires: expires) - saveNamesResolvedAt(m) -} - -func clearSimplexNameResolved(_ fullDomainName: String) { - var m = simplexNamesResolvedAtDefault.get() - if m.removeValue(forKey: fullDomainName) != nil { saveNamesResolvedAt(m) } -} - private func nameDate(_ seconds: Int64) -> String { Date(timeIntervalSince1970: TimeInterval(seconds)).formatted(date: .abbreviated, time: .omitted) } @@ -1477,17 +1449,7 @@ func planAndConnect( func connectTask(_ inProgress: BoxedValue) { Task { - let nameTarget: SimplexNameInfo? = if case let .name(_, nameInfo) = strConnectTarget(shortOrFullLink) { nameInfo } else { nil } - var result: ConnectionPlanResult? = nil - if let nameTarget, simplexNameResolvedRecently(nameTarget.nameDomain) { - result = await apiConnectPlan(connLink: shortOrFullLink, resolveMode: .never, linkOwnerSig: linkOwnerSig, inProgress: BoxedValue(false)) - } - if result == nil && inProgress.boxedValue { - result = await apiConnectPlan(connLink: shortOrFullLink, resolveMode: nameTarget != nil ? .all : .unknown, linkOwnerSig: linkOwnerSig, inProgress: inProgress) - if let nameTarget, let result { - recordSimplexNameResolved(nameTarget.nameDomain, result.connectionPlan.nameRegistration) - } - } + let result = await apiConnectPlan(connLink: shortOrFullLink, linkOwnerSig: linkOwnerSig, inProgress: inProgress) await MainActor.run { ConnectProgressManager.shared.stopConnectProgress() } diff --git a/apps/ios/Shared/Views/UserSettings/SettingsView.swift b/apps/ios/Shared/Views/UserSettings/SettingsView.swift index 9e8a28434a..c1d1e5b111 100644 --- a/apps/ios/Shared/Views/UserSettings/SettingsView.swift +++ b/apps/ios/Shared/Views/UserSettings/SettingsView.swift @@ -33,7 +33,6 @@ let DEFAULT_PRIVACY_LINK_PREVIEWS = "privacyLinkPreviews" // deprecated, moved t let DEFAULT_PRIVACY_SIMPLEX_LINK_MODE = "privacySimplexLinkMode" let DEFAULT_PRIVACY_SHOW_CHAT_PREVIEWS = "privacyShowChatPreviews" let DEFAULT_PRIVACY_VERIFY_SIMPLEX_NAMES = "privacyVerifySimplexNames" -let DEFAULT_SIMPLEX_NAMES_RESOLVED_AT = "simplexNamesResolvedAt" let DEFAULT_PRIVACY_SHOW_SIGNATURE = "privacyShowSignature" let DEFAULT_PRIVACY_SHOW_FILE_ENCRYPTION = "privacyShowEncryption" let DEFAULT_PRIVACY_SAVE_LAST_DRAFT = "privacySaveLastDraft" @@ -291,8 +290,6 @@ public class CodableDefault { let networkProxyDefault: CodableDefault = CodableDefault(defaults: UserDefaults.standard, forKey: DEFAULT_NETWORK_PROXY, withDefault: NetworkProxy.def) -let simplexNamesResolvedAtDefault = CodableDefault<[String: SimplexNameResolved]>(defaults: UserDefaults.standard, forKey: DEFAULT_SIMPLEX_NAMES_RESOLVED_AT, withDefault: [:]) - struct SettingsView: View { @Environment(\.colorScheme) var colorScheme @Environment(\.dismiss) var dismiss diff --git a/apps/ios/Shared/Views/UserSettings/UserAddressView.swift b/apps/ios/Shared/Views/UserSettings/UserAddressView.swift index 97d3c715f3..9711f3d6f8 100644 --- a/apps/ios/Shared/Views/UserSettings/UserAddressView.swift +++ b/apps/ios/Shared/Views/UserSettings/UserAddressView.swift @@ -205,7 +205,6 @@ struct UserAddressView: View { save: { simplexDomain in do { let u = try await apiSetUserDomain(simplexDomain) - if let d = chatModel.currentUser?.profile.contactDomain?.domain { clearSimplexNameResolved(d) } await MainActor.run { chatModel.updateUser(u) } return true } catch { diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt index 7bbc775556..05e9975daf 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt @@ -5252,9 +5252,6 @@ enum class SimplexTLD { @SerialName("web") web } -@Serializable -data class SimplexNameResolved(val at: Long, val expires: Long? = null) - @Serializable sealed class NameRegistration { // held by someone; expires/graceUntil are absent from an older router, which means "not known", not "live forever" diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt index f6711f7b22..d66c99eb48 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt @@ -123,7 +123,6 @@ class AppPreferences { val privacyAcceptImages = mkBoolPreference(SHARED_PREFS_PRIVACY_ACCEPT_IMAGES, true) val privacyLinkPreviews = mkBoolPreference(SHARED_PREFS_PRIVACY_LINK_PREVIEWS, true) val privacyVerifySimplexNames = mkBoolPreference(SHARED_PREFS_PRIVACY_VERIFY_SIMPLEX_NAMES, false) - val simplexNamesResolvedAt = mkStrPreference(SHARED_PREFS_SIMPLEX_NAMES_RESOLVED_AT, null) val privacyLinkPreviewsShowAlert = mkBoolPreference(SHARED_PREFS_PRIVACY_LINK_PREVIEWS_SHOW_ALERT, true) val privacySanitizeLinks = mkBoolPreference(SHARED_PREFS_PRIVACY_SANITIZE_LINKS, false) // TODO remove @@ -412,7 +411,6 @@ class AppPreferences { private const val SHARED_PREFS_PRIVACY_TRANSFER_IMAGES_INLINE = "PrivacyTransferImagesInline" private const val SHARED_PREFS_PRIVACY_LINK_PREVIEWS = "PrivacyLinkPreviews" private const val SHARED_PREFS_PRIVACY_VERIFY_SIMPLEX_NAMES = "PrivacyVerifySimplexNames" - private const val SHARED_PREFS_SIMPLEX_NAMES_RESOLVED_AT = "SimplexNamesResolvedAt" private const val SHARED_PREFS_PRIVACY_LINK_PREVIEWS_SHOW_ALERT = "PrivacyLinkPreviewsShowAlert" private const val SHARED_PREFS_PRIVACY_SANITIZE_LINKS = "PrivacySanitizeLinks" private const val SHARED_PREFS_PRIVACY_CHAT_LIST_OPEN_LINKS = "ChatListOpenLinks" // TODO remove diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/ConnectPlan.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/ConnectPlan.kt index db334450ae..84b57814db 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/ConnectPlan.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/ConnectPlan.kt @@ -22,7 +22,6 @@ import chat.simplex.common.views.usersettings.simplexTeamUri import chat.simplex.res.MR import kotlinx.coroutines.* import kotlinx.datetime.* -import kotlinx.serialization.* enum class ConnectionLinkType { INVITATION, CONTACT, GROUP @@ -73,46 +72,8 @@ private fun openNameHowTo(uriHandler: UriHandler) = openBrowserAlert(SIMPLEX_NAM private const val SIMPLEX_NAMES_HOWTO_URL = "https://simplex.domains/#testing" -private const val NAME_RESOLVED_DAY_SECONDS = 24 * 60 * 60L - private fun nowSeconds(): Long = Clock.System.now().epochSeconds -private fun loadNamesResolvedAt(): MutableMap = - try { - val s = ChatController.appPrefs.simplexNamesResolvedAt.get() ?: return mutableMapOf() - json.decodeFromString>(s).toMutableMap() - } catch (e: Exception) { - mutableMapOf() - } - -private fun saveNamesResolvedAt(m: Map) { - val now = nowSeconds() - val kept = m.filterValues { now - it.at < 7 * NAME_RESOLVED_DAY_SECONDS } - try { - ChatController.appPrefs.simplexNamesResolvedAt.set(json.encodeToString>(kept)) - } catch (e: Exception) { - Log.e(TAG, "saveNamesResolvedAt: ${e.stackTraceToString()}") - } -} - -fun simplexNameResolvedRecently(domain: SimplexDomain): Boolean { - val r = loadNamesResolvedAt()[domain.fullDomainName] ?: return false - val now = nowSeconds() - if (now - r.at >= NAME_RESOLVED_DAY_SECONDS) return false - return r.expires == null || now < r.expires -} - -fun recordSimplexNameResolved(domain: SimplexDomain, reg: NameRegistration?) { - val m = loadNamesResolvedAt() - m[domain.fullDomainName] = SimplexNameResolved(nowSeconds(), (reg as? NameRegistration.Registered)?.expires) - saveNamesResolvedAt(m) -} - -fun clearSimplexNameResolved(fullDomainName: String) { - val m = loadNamesResolvedAt() - if (m.remove(fullDomainName) != null) saveNamesResolvedAt(m) -} - private fun showNameRegistrationAlert( rhId: Long?, domain: SimplexDomain, @@ -230,18 +191,7 @@ private suspend fun planAndConnectTask( cleanup?.invoke() completable.complete(!completable.isActive) } - val nameTarget = (strConnectTarget(shortOrFullLink.trim()) as? ConnectTarget.Name)?.nameInfo - val freshName = nameTarget != null && simplexNameResolvedRecently(nameTarget.nameDomain) - var result = if (freshName) { - chatModel.controller.apiConnectPlan(rhId, shortOrFullLink, PlanResolveMode.PRMNever, linkOwnerSig, mutableStateOf(false)) - } else null - if (result == null && inProgress.value) { - val mode = if (nameTarget != null) PlanResolveMode.PRMAll else PlanResolveMode.PRMUnknown - result = chatModel.controller.apiConnectPlan(rhId, shortOrFullLink, mode, linkOwnerSig, inProgress) - if (nameTarget != null && result != null) { - recordSimplexNameResolved(nameTarget.nameDomain, result.connectionPlan.nameRegistration()) - } - } + val result = chatModel.controller.apiConnectPlan(rhId, shortOrFullLink, linkOwnerSig = linkOwnerSig, inProgress = inProgress) connectProgressManager.stopConnectProgress() if (!inProgress.value) { return completable } if (result != null) { diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/UserAddressView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/UserAddressView.kt index 401d241220..87660c7e65 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/UserAddressView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/UserAddressView.kt @@ -388,7 +388,6 @@ private fun UserAddressLayout( save = { simplexDomain -> try { val u = chatModel.controller.apiSetUserDomain(user?.remoteHostId, simplexDomain) - domain?.let { clearSimplexNameResolved(it) } withContext(Dispatchers.Main) { chatModel.updateUser(u) } true } catch (e: Exception) { diff --git a/bots/api/COMMANDS.md b/bots/api/COMMANDS.md index f90e8e08da..e69de29bb2 100644 --- a/bots/api/COMMANDS.md +++ b/bots/api/COMMANDS.md @@ -1,2487 +0,0 @@ -# API Commands and Responses - -This file is generated automatically. - -[Address commands](#address-commands) -- [APICreateMyAddress](#apicreatemyaddress) -- [APIDeleteMyAddress](#apideletemyaddress) -- [APIShowMyAddress](#apishowmyaddress) -- [APISetProfileAddress](#apisetprofileaddress) -- [APISetAddressSettings](#apisetaddresssettings) - -[Message commands](#message-commands) -- [APISendMessages](#apisendmessages) -- [APIUpdateChatItem](#apiupdatechatitem) -- [APIDeleteChatItem](#apideletechatitem) -- [APIDeleteMemberChatItem](#apideletememberchatitem) -- [APIChatItemReaction](#apichatitemreaction) -- [APIShareMyAddress](#apisharemyaddress) -- [APIShareChatMsgContent](#apisharechatmsgcontent) - -[File commands](#file-commands) -- [ReceiveFile](#receivefile) -- [CancelFile](#cancelfile) - -[Group commands](#group-commands) -- [APIAddMember](#apiaddmember) -- [APIJoinGroup](#apijoingroup) -- [APIAcceptMember](#apiacceptmember) -- [APIMembersRole](#apimembersrole) -- [APIBlockMembersForAll](#apiblockmembersforall) -- [APIRemoveMembers](#apiremovemembers) -- [APILeaveGroup](#apileavegroup) -- [APIListMembers](#apilistmembers) -- [APINewGroup](#apinewgroup) -- [APINewPublicGroup](#apinewpublicgroup) -- [APIGetGroupRelays](#apigetgrouprelays) -- [APIAddGroupRelays](#apiaddgrouprelays) -- [APIAllowRelayGroup](#apiallowrelaygroup) -- [APIUpdateGroupProfile](#apiupdategroupprofile) -- [APIVerifyGroupDomain](#apiverifygroupdomain) - -[Group link commands](#group-link-commands) -- [APICreateGroupLink](#apicreategrouplink) -- [APIGroupLinkMemberRole](#apigrouplinkmemberrole) -- [APIDeleteGroupLink](#apideletegrouplink) -- [APIGetGroupLink](#apigetgrouplink) - -[Connection commands](#connection-commands) -- [APIAddContact](#apiaddcontact) -- [APIConnectPlan](#apiconnectplan) -- [APIConnect](#apiconnect) -- [Connect](#connect) -- [APIAcceptContact](#apiacceptcontact) -- [APIRejectContact](#apirejectcontact) - -[Chat commands](#chat-commands) -- [APIListContacts](#apilistcontacts) -- [APIListGroups](#apilistgroups) -- [APIGetChats](#apigetchats) -- [APIDeleteChat](#apideletechat) -- [APISetGroupCustomData](#apisetgroupcustomdata) -- [APISetContactCustomData](#apisetcontactcustomdata) -- [APISetUserAutoAcceptMemberContacts](#apisetuserautoacceptmembercontacts) -- [APISetUserAutoAcceptGroupInvitations](#apisetuserautoacceptgroupinvitations) - -[User profile commands](#user-profile-commands) -- [ShowActiveUser](#showactiveuser) -- [CreateActiveUser](#createactiveuser) -- [ListUsers](#listusers) -- [APISetActiveUser](#apisetactiveuser) -- [APIDeleteUser](#apideleteuser) -- [APIUpdateProfile](#apiupdateprofile) -- [APISetContactPrefs](#apisetcontactprefs) - -[Service commands](#service-commands) -- [APISendServiceResponse](#apisendserviceresponse) - -[Chat management](#chat-management) -- [StartChat](#startchat) -- [APIStopChat](#apistopchat) - -[Remote control commands](#remote-control-commands) -- [ConnectRemoteCtrl](#connectremotectrl) -- [VerifyRemoteCtrlSession](#verifyremotectrlsession) - ---- - - -## Address commands - -Bots can use these commands to automatically check and create address when initialized - - -### APICreateMyAddress - -Create bot address. - -*Network usage*: interactive. - -**Parameters**: -- userId: int64 -- pqRatchet: bool? - -**Syntax**: - -``` -/_address [ pq_ratchet=on|off] -``` - -```javascript -'/_address ' + userId + (typeof pqRatchet == 'boolean' ? ' pq_ratchet=' + (pqRatchet ? 'on' : 'off') : '') // JavaScript -``` - -```python -'/_address ' + str(userId) + ((' pq_ratchet=' + ('on' if pqRatchet else 'off')) if pqRatchet is not None else '') # Python -``` - -**Responses**: - -UserContactLinkCreated: User contact address created. -- type: "userContactLinkCreated" -- user: [User](./TYPES.md#user) -- connLinkContact: [CreatedConnLink](./TYPES.md#createdconnlink) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIDeleteMyAddress - -Delete bot address. - -*Network usage*: background. - -**Parameters**: -- userId: int64 - -**Syntax**: - -``` -/_delete_address -``` - -```javascript -'/_delete_address ' + userId // JavaScript -``` - -```python -'/_delete_address ' + str(userId) # Python -``` - -**Responses**: - -UserContactLinkDeleted: User contact address deleted. -- type: "userContactLinkDeleted" -- user: [User](./TYPES.md#user) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIShowMyAddress - -Get bot address and settings. - -*Network usage*: no. - -**Parameters**: -- userId: int64 - -**Syntax**: - -``` -/_show_address -``` - -```javascript -'/_show_address ' + userId // JavaScript -``` - -```python -'/_show_address ' + str(userId) # Python -``` - -**Responses**: - -UserContactLink: User contact address. -- type: "userContactLink" -- user: [User](./TYPES.md#user) -- contactLink: [UserContactLink](./TYPES.md#usercontactlink) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APISetProfileAddress - -Add address to bot profile. - -*Network usage*: interactive. - -**Parameters**: -- userId: int64 -- enable: bool - -**Syntax**: - -``` -/_profile_address on|off -``` - -```javascript -'/_profile_address ' + userId + ' ' + (enable ? 'on' : 'off') // JavaScript -``` - -```python -'/_profile_address ' + str(userId) + ' ' + ('on' if enable else 'off') # Python -``` - -**Responses**: - -UserProfileUpdated: User profile updated. -- type: "userProfileUpdated" -- user: [User](./TYPES.md#user) -- fromProfile: [Profile](./TYPES.md#profile) -- toProfile: [Profile](./TYPES.md#profile) -- updateSummary: [UserProfileUpdateSummary](./TYPES.md#userprofileupdatesummary) - -UserProfileNoChange: User profile was not changed. -- type: "userProfileNoChange" -- user: [User](./TYPES.md#user) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APISetAddressSettings - -Set bot address settings. - -*Network usage*: interactive. - -**Parameters**: -- userId: int64 -- pqRatchet: bool? -- settings: [AddressSettings](./TYPES.md#addresssettings) - -**Syntax**: - -``` -/_address_settings [ pq_ratchet=on|off] -``` - -```javascript -'/_address_settings ' + userId + (typeof pqRatchet == 'boolean' ? ' pq_ratchet=' + (pqRatchet ? 'on' : 'off') : '') + ' ' + JSON.stringify(settings) // JavaScript -``` - -```python -'/_address_settings ' + str(userId) + ((' pq_ratchet=' + ('on' if pqRatchet else 'off')) if pqRatchet is not None else '') + ' ' + json.dumps(settings) # Python -``` - -**Responses**: - -UserContactLinkUpdated: User contact address updated. -- type: "userContactLinkUpdated" -- user: [User](./TYPES.md#user) -- contactLink: [UserContactLink](./TYPES.md#usercontactlink) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -## Message commands - -Commands to send, update, delete, moderate messages and set message reactions - - -### APISendMessages - -Send messages. - -*Network usage*: background. - -**Parameters**: -- sendRef: [ChatRef](./TYPES.md#chatref) -- liveMessage: bool -- ttl: int? -- signMessages: bool -- composedMessages: [[ComposedMessage](./TYPES.md#composedmessage)] - -**Syntax**: - -``` -/_send [ live=on][ ttl=][ sign=on] json -``` - -```javascript -'/_send ' + ChatRef.cmdString(sendRef) + (liveMessage ? ' live=on' : '') + (ttl ? ' ttl=' + ttl : '') + (signMessages ? ' sign=on' : '') + ' json ' + JSON.stringify(composedMessages) // JavaScript -``` - -```python -'/_send ' + ChatRef_cmd_string(sendRef) + (' live=on' if liveMessage else '') + ((' ttl=' + str(ttl)) if ttl is not None else '') + (' sign=on' if signMessages else '') + ' json ' + json.dumps(composedMessages) # Python -``` - -**Responses**: - -NewChatItems: New messages. -- type: "newChatItems" -- user: [User](./TYPES.md#user) -- chatItems: [[AChatItem](./TYPES.md#achatitem)] - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIUpdateChatItem - -Update message. - -*Network usage*: background. - -**Parameters**: -- chatRef: [ChatRef](./TYPES.md#chatref) -- chatItemId: int64 -- liveMessage: bool -- updatedMessage: [UpdatedMessage](./TYPES.md#updatedmessage) - -**Syntax**: - -``` -/_update item [ live=on] json -``` - -```javascript -'/_update item ' + ChatRef.cmdString(chatRef) + ' ' + chatItemId + (liveMessage ? ' live=on' : '') + ' json ' + JSON.stringify(updatedMessage) // JavaScript -``` - -```python -'/_update item ' + ChatRef_cmd_string(chatRef) + ' ' + str(chatItemId) + (' live=on' if liveMessage else '') + ' json ' + json.dumps(updatedMessage) # Python -``` - -**Responses**: - -ChatItemUpdated: Message updated. -- type: "chatItemUpdated" -- user: [User](./TYPES.md#user) -- chatItem: [AChatItem](./TYPES.md#achatitem) - -ChatItemNotChanged: Message not changed. -- type: "chatItemNotChanged" -- user: [User](./TYPES.md#user) -- chatItem: [AChatItem](./TYPES.md#achatitem) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - -**Errors**: -- InvalidChatItemUpdate: Not user's message or cannot be edited. - ---- - - -### APIDeleteChatItem - -Delete message. - -*Network usage*: background. - -**Parameters**: -- chatRef: [ChatRef](./TYPES.md#chatref) -- chatItemIds: [int64] -- deleteMode: [CIDeleteMode](./TYPES.md#cideletemode) - -**Syntax**: - -``` -/_delete item [,...] broadcast|internal|internalMark|history -``` - -```javascript -'/_delete item ' + ChatRef.cmdString(chatRef) + ' ' + chatItemIds.join(',') + ' ' + deleteMode // JavaScript -``` - -```python -'/_delete item ' + ChatRef_cmd_string(chatRef) + ' ' + ','.join(map(str, chatItemIds)) + ' ' + str(deleteMode) # Python -``` - -**Responses**: - -ChatItemsDeleted: Messages deleted. -- type: "chatItemsDeleted" -- user: [User](./TYPES.md#user) -- chatItemDeletions: [[ChatItemDeletion](./TYPES.md#chatitemdeletion)] -- byUser: bool -- timed: bool - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIDeleteMemberChatItem - -Moderate message. Requires Moderator role (and higher than message author's). - -*Network usage*: background. - -**Parameters**: -- groupId: int64 -- chatItemIds: [int64] - -**Syntax**: - -``` -/_delete member item # [,...] -``` - -```javascript -'/_delete member item #' + groupId + ' ' + chatItemIds.join(',') // JavaScript -``` - -```python -'/_delete member item #' + str(groupId) + ' ' + ','.join(map(str, chatItemIds)) # Python -``` - -**Responses**: - -ChatItemsDeleted: Messages deleted. -- type: "chatItemsDeleted" -- user: [User](./TYPES.md#user) -- chatItemDeletions: [[ChatItemDeletion](./TYPES.md#chatitemdeletion)] -- byUser: bool -- timed: bool - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIChatItemReaction - -Add/remove message reaction. - -*Network usage*: background. - -**Parameters**: -- chatRef: [ChatRef](./TYPES.md#chatref) -- chatItemId: int64 -- add: bool -- reaction: [MsgReaction](./TYPES.md#msgreaction) - -**Syntax**: - -``` -/_reaction on|off -``` - -```javascript -'/_reaction ' + ChatRef.cmdString(chatRef) + ' ' + chatItemId + ' ' + (add ? 'on' : 'off') + ' ' + JSON.stringify(reaction) // JavaScript -``` - -```python -'/_reaction ' + ChatRef_cmd_string(chatRef) + ' ' + str(chatItemId) + ' ' + ('on' if add else 'off') + ' ' + json.dumps(reaction) # Python -``` - -**Responses**: - -ChatItemReaction: Message reaction. -- type: "chatItemReaction" -- user: [User](./TYPES.md#user) -- added: bool -- reaction: [ACIReaction](./TYPES.md#acireaction) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIShareMyAddress - -Share user address card - -*Network usage*: no. - -**Parameters**: -- toSendRef: [ChatRef](./TYPES.md#chatref) - -**Syntax**: - -``` -/_share address -``` - -```javascript -'/_share address ' + ChatRef.cmdString(toSendRef) // JavaScript -``` - -```python -'/_share address ' + ChatRef_cmd_string(toSendRef) # Python -``` - -**Response**: - -ChatMsgContent: Chat card content that can be sent. -- type: "chatMsgContent" -- user: [User](./TYPES.md#user) -- msgContent: [MsgContent](./TYPES.md#msgcontent) - ---- - - -### APIShareChatMsgContent - -Share channel address - -*Network usage*: no. - -**Parameters**: -- shareChatRef: [ChatRef](./TYPES.md#chatref) -- toSendRef: [ChatRef](./TYPES.md#chatref) - -**Syntax**: - -``` -/_share chat content -``` - -```javascript -'/_share chat content ' + ChatRef.cmdString(shareChatRef) + ' ' + ChatRef.cmdString(toSendRef) // JavaScript -``` - -```python -'/_share chat content ' + ChatRef_cmd_string(shareChatRef) + ' ' + ChatRef_cmd_string(toSendRef) # Python -``` - -**Response**: - -ChatMsgContent: Chat card content that can be sent. -- type: "chatMsgContent" -- user: [User](./TYPES.md#user) -- msgContent: [MsgContent](./TYPES.md#msgcontent) - ---- - - -## 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. - - -### ReceiveFile - -Receive file. - -*Network usage*: no. - -**Parameters**: -- fileId: int64 -- userApprovedRelays: bool -- storeEncrypted: bool? -- fileInline: bool? -- filePath: string? - -**Syntax**: - -``` -/freceive [ approved_relays=on][ encrypt=on|off][ inline=on|off][ ] -``` - -```javascript -'/freceive ' + fileId + (userApprovedRelays ? ' approved_relays=on' : '') + (typeof storeEncrypted == 'boolean' ? ' encrypt=' + (storeEncrypted ? 'on' : 'off') : '') + (typeof fileInline == 'boolean' ? ' inline=' + (fileInline ? 'on' : 'off') : '') + (filePath ? ' ' + filePath : '') // JavaScript -``` - -```python -'/freceive ' + str(fileId) + (' approved_relays=on' if userApprovedRelays else '') + ((' encrypt=' + ('on' if storeEncrypted else 'off')) if storeEncrypted is not None else '') + ((' inline=' + ('on' if fileInline else 'off')) if fileInline is not None else '') + ((' ' + filePath) if filePath is not None else '') # Python -``` - -**Responses**: - -RcvFileAccepted: File accepted to be received. -- type: "rcvFileAccepted" -- user: [User](./TYPES.md#user) -- chatItem: [AChatItem](./TYPES.md#achatitem) - -RcvFileAcceptedSndCancelled: File accepted, but no longer sent. -- type: "rcvFileAcceptedSndCancelled" -- user: [User](./TYPES.md#user) -- rcvFileTransfer: [RcvFileTransfer](./TYPES.md#rcvfiletransfer) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### CancelFile - -Cancel file. - -*Network usage*: background. - -**Parameters**: -- fileId: int64 - -**Syntax**: - -``` -/fcancel -``` - -```javascript -'/fcancel ' + fileId // JavaScript -``` - -```python -'/fcancel ' + str(fileId) # Python -``` - -**Responses**: - -SndFileCancelled: Cancelled sending file. -- type: "sndFileCancelled" -- user: [User](./TYPES.md#user) -- chatItem_: [AChatItem](./TYPES.md#achatitem)? -- fileTransferMeta: [FileTransferMeta](./TYPES.md#filetransfermeta) -- sndFileTransfers: [[SndFileTransfer](./TYPES.md#sndfiletransfer)] - -RcvFileCancelled: Cancelled receiving file. -- type: "rcvFileCancelled" -- user: [User](./TYPES.md#user) -- chatItem_: [AChatItem](./TYPES.md#achatitem)? -- rcvFileTransfer: [RcvFileTransfer](./TYPES.md#rcvfiletransfer) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - -**Errors**: -- FileCancel: Cannot cancel file. - ---- - - -## 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. - - -### APIAddMember - -Add contact to group. Requires bot to have Admin role. - -*Network usage*: interactive. - -**Parameters**: -- groupId: int64 -- contactId: int64 -- memberRole: [GroupMemberRole](./TYPES.md#groupmemberrole) - -**Syntax**: - -``` -/_add # relay|observer|author|member|moderator|admin|owner -``` - -```javascript -'/_add #' + groupId + ' ' + contactId + ' ' + memberRole // JavaScript -``` - -```python -'/_add #' + str(groupId) + ' ' + str(contactId) + ' ' + str(memberRole) # Python -``` - -**Responses**: - -SentGroupInvitation: Group invitation sent. -- type: "sentGroupInvitation" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- contact: [Contact](./TYPES.md#contact) -- member: [GroupMember](./TYPES.md#groupmember) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIJoinGroup - -Join group. - -*Network usage*: interactive. - -**Parameters**: -- groupId: int64 - -**Syntax**: - -``` -/_join # -``` - -```javascript -'/_join #' + groupId // JavaScript -``` - -```python -'/_join #' + str(groupId) # Python -``` - -**Responses**: - -UserAcceptedGroupSent: User accepted group invitation. -- type: "userAcceptedGroupSent" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- hostContact: [Contact](./TYPES.md#contact)? - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIAcceptMember - -Accept group member. Requires Admin role. - -*Network usage*: background. - -**Parameters**: -- groupId: int64 -- groupMemberId: int64 -- memberRole: [GroupMemberRole](./TYPES.md#groupmemberrole) - -**Syntax**: - -``` -/_accept member # relay|observer|author|member|moderator|admin|owner -``` - -```javascript -'/_accept member #' + groupId + ' ' + groupMemberId + ' ' + memberRole // JavaScript -``` - -```python -'/_accept member #' + str(groupId) + ' ' + str(groupMemberId) + ' ' + str(memberRole) # Python -``` - -**Responses**: - -MemberAccepted: Member accepted to group. -- type: "memberAccepted" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- member: [GroupMember](./TYPES.md#groupmember) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - -**Errors**: -- GroupMemberNotActive: Member is not connected yet. - ---- - - -### APIMembersRole - -Set members role. Requires Admin role. - -*Network usage*: background. - -**Parameters**: -- groupId: int64 -- groupMemberIds: [int64] -- memberRole: [GroupMemberRole](./TYPES.md#groupmemberrole) - -**Syntax**: - -``` -/_member role # [,...] relay|observer|author|member|moderator|admin|owner -``` - -```javascript -'/_member role #' + groupId + ' ' + groupMemberIds.join(',') + ' ' + memberRole // JavaScript -``` - -```python -'/_member role #' + str(groupId) + ' ' + ','.join(map(str, groupMemberIds)) + ' ' + str(memberRole) # Python -``` - -**Responses**: - -MembersRoleUser: Members role changed by user. -- type: "membersRoleUser" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- members: [[GroupMember](./TYPES.md#groupmember)] -- toRole: [GroupMemberRole](./TYPES.md#groupmemberrole) -- msgSigned: bool - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIBlockMembersForAll - -Block members. Requires Moderator role. - -*Network usage*: background. - -**Parameters**: -- groupId: int64 -- groupMemberIds: [int64] -- blocked: bool - -**Syntax**: - -``` -/_block # [,...] blocked=on|off -``` - -```javascript -'/_block #' + groupId + ' ' + groupMemberIds.join(',') + ' blocked=' + (blocked ? 'on' : 'off') // JavaScript -``` - -```python -'/_block #' + str(groupId) + ' ' + ','.join(map(str, groupMemberIds)) + ' blocked=' + ('on' if blocked else 'off') # Python -``` - -**Responses**: - -MembersBlockedForAllUser: Members blocked for all by admin. -- type: "membersBlockedForAllUser" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- members: [[GroupMember](./TYPES.md#groupmember)] -- blocked: bool -- msgSigned: bool - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIRemoveMembers - -Remove members. Requires Admin role. - -*Network usage*: background. - -**Parameters**: -- groupId: int64 -- groupMemberIds: [int64] -- withMessages: bool - -**Syntax**: - -``` -/_remove # [,...][ messages=on] -``` - -```javascript -'/_remove #' + groupId + ' ' + groupMemberIds.join(',') + (withMessages ? ' messages=on' : '') // JavaScript -``` - -```python -'/_remove #' + str(groupId) + ' ' + ','.join(map(str, groupMemberIds)) + (' messages=on' if withMessages else '') # Python -``` - -**Responses**: - -UserDeletedMembers: Members deleted. -- type: "userDeletedMembers" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- members: [[GroupMember](./TYPES.md#groupmember)] -- withMessages: bool -- msgSigned: bool - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - -**Errors**: -- GroupMemberNotFound: Group member not found. - ---- - - -### APILeaveGroup - -Leave group. - -*Network usage*: background. - -**Parameters**: -- groupId: int64 - -**Syntax**: - -``` -/_leave # -``` - -```javascript -'/_leave #' + groupId // JavaScript -``` - -```python -'/_leave #' + str(groupId) # Python -``` - -**Responses**: - -LeftMemberUser: User left group. -- type: "leftMemberUser" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIListMembers - -Get group members. - -*Network usage*: no. - -**Parameters**: -- groupId: int64 - -**Syntax**: - -``` -/_members # -``` - -```javascript -'/_members #' + groupId // JavaScript -``` - -```python -'/_members #' + str(groupId) # Python -``` - -**Responses**: - -GroupMembers: Group members. -- type: "groupMembers" -- user: [User](./TYPES.md#user) -- group: [Group](./TYPES.md#group) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APINewGroup - -Create group. - -*Network usage*: no. - -**Parameters**: -- userId: int64 -- incognito: bool -- groupProfile: [GroupProfile](./TYPES.md#groupprofile) - -**Syntax**: - -``` -/_group [ incognito=on] -``` - -```javascript -'/_group ' + userId + (incognito ? ' incognito=on' : '') + ' ' + JSON.stringify(groupProfile) // JavaScript -``` - -```python -'/_group ' + str(userId) + (' incognito=on' if incognito else '') + ' ' + json.dumps(groupProfile) # Python -``` - -**Responses**: - -GroupCreated: Group created. -- type: "groupCreated" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APINewPublicGroup - -Create public group. - -*Network usage*: interactive. - -**Parameters**: -- userId: int64 -- incognito: bool -- relayIds: [int64] -- groupProfile: [GroupProfile](./TYPES.md#groupprofile) - -**Syntax**: - -``` -/_public group [ incognito=on] [,...] -``` - -```javascript -'/_public group ' + userId + (incognito ? ' incognito=on' : '') + ' ' + relayIds.join(',') + ' ' + JSON.stringify(groupProfile) // JavaScript -``` - -```python -'/_public group ' + str(userId) + (' incognito=on' if incognito else '') + ' ' + ','.join(map(str, relayIds)) + ' ' + json.dumps(groupProfile) # Python -``` - -**Responses**: - -PublicGroupCreated: Public group created. -- type: "publicGroupCreated" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- groupLink: [GroupLink](./TYPES.md#grouplink) -- groupRelays: [[GroupRelay](./TYPES.md#grouprelay)] - -PublicGroupCreationFailed: Public group creation failed. -- type: "publicGroupCreationFailed" -- user: [User](./TYPES.md#user) -- addRelayResults: [[AddRelayResult](./TYPES.md#addrelayresult)] - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIGetGroupRelays - -Get group relays. - -*Network usage*: no. - -**Parameters**: -- groupId: int64 - -**Syntax**: - -``` -/_get relays # -``` - -```javascript -'/_get relays #' + groupId // JavaScript -``` - -```python -'/_get relays #' + str(groupId) # Python -``` - -**Responses**: - -GroupRelays: Group relays. -- type: "groupRelays" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- groupRelays: [[GroupRelay](./TYPES.md#grouprelay)] - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIAddGroupRelays - -Add relays to group. - -*Network usage*: interactive. - -**Parameters**: -- groupId: int64 -- relayIds: [int64] - -**Syntax**: - -``` -/_add relays # [,...] -``` - -```javascript -'/_add relays #' + groupId + ' ' + relayIds.join(',') // JavaScript -``` - -```python -'/_add relays #' + str(groupId) + ' ' + ','.join(map(str, relayIds)) # Python -``` - -**Responses**: - -GroupRelaysAdded: Group relays added. -- type: "groupRelaysAdded" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- groupLink: [GroupLink](./TYPES.md#grouplink) -- groupRelays: [[GroupRelay](./TYPES.md#grouprelay)] - -GroupRelaysAddFailed: Group relays add failed. -- type: "groupRelaysAddFailed" -- user: [User](./TYPES.md#user) -- addRelayResults: [[AddRelayResult](./TYPES.md#addrelayresult)] - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIAllowRelayGroup - -Clear relay rejection for a channel (relay operator). - -*Network usage*: background. - -**Parameters**: -- groupId: int64 - -**Syntax**: - -``` -/_relay allow # -``` - -```javascript -'/_relay allow #' + groupId // JavaScript -``` - -```python -'/_relay allow #' + str(groupId) # Python -``` - -**Responses**: - -RelayGroupAllowed: Relay rejection cleared for a channel. -- type: "relayGroupAllowed" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIUpdateGroupProfile - -Update group profile. - -*Network usage*: background. - -**Parameters**: -- groupId: int64 -- groupProfile: [GroupProfile](./TYPES.md#groupprofile) - -**Syntax**: - -``` -/_group_profile # -``` - -```javascript -'/_group_profile #' + groupId + ' ' + JSON.stringify(groupProfile) // JavaScript -``` - -```python -'/_group_profile #' + str(groupId) + ' ' + json.dumps(groupProfile) # Python -``` - -**Responses**: - -GroupUpdated: Group updated. -- type: "groupUpdated" -- user: [User](./TYPES.md#user) -- fromGroup: [GroupInfo](./TYPES.md#groupinfo) -- toGroup: [GroupInfo](./TYPES.md#groupinfo) -- member_: [GroupMember](./TYPES.md#groupmember)? -- msgSigned: bool - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIVerifyGroupDomain - -Verify group domain - -*Network usage*: interactive. - -**Parameters**: -- groupId: int64 - -**Syntax**: - -``` -/_verify domain # -``` - -```javascript -'/_verify domain #' + groupId // JavaScript -``` - -```python -'/_verify domain #' + str(groupId) # Python -``` - -**Response**: - -GroupDomainVerified: Group domain verified. -- type: "groupDomainVerified" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- verificationFailure: string? - ---- - - -## Group link commands - -These commands can be used by bots that manage multiple public groups - - -### APICreateGroupLink - -Create group link. - -*Network usage*: interactive. - -**Parameters**: -- groupId: int64 -- memberRole: [GroupMemberRole](./TYPES.md#groupmemberrole) - -**Syntax**: - -``` -/_create link # relay|observer|author|member|moderator|admin|owner -``` - -```javascript -'/_create link #' + groupId + ' ' + memberRole // JavaScript -``` - -```python -'/_create link #' + str(groupId) + ' ' + str(memberRole) # Python -``` - -**Responses**: - -GroupLinkCreated: Group link created. -- type: "groupLinkCreated" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- groupLink: [GroupLink](./TYPES.md#grouplink) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIGroupLinkMemberRole - -Set member role for group link. - -*Network usage*: no. - -**Parameters**: -- groupId: int64 -- memberRole: [GroupMemberRole](./TYPES.md#groupmemberrole) - -**Syntax**: - -``` -/_set link role # relay|observer|author|member|moderator|admin|owner -``` - -```javascript -'/_set link role #' + groupId + ' ' + memberRole // JavaScript -``` - -```python -'/_set link role #' + str(groupId) + ' ' + str(memberRole) # Python -``` - -**Responses**: - -GroupLink: Group link. -- type: "groupLink" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- groupLink: [GroupLink](./TYPES.md#grouplink) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIDeleteGroupLink - -Delete group link. - -*Network usage*: background. - -**Parameters**: -- groupId: int64 - -**Syntax**: - -``` -/_delete link # -``` - -```javascript -'/_delete link #' + groupId // JavaScript -``` - -```python -'/_delete link #' + str(groupId) # Python -``` - -**Responses**: - -GroupLinkDeleted: Group link deleted. -- type: "groupLinkDeleted" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIGetGroupLink - -Get group link. - -*Network usage*: no. - -**Parameters**: -- groupId: int64 - -**Syntax**: - -``` -/_get link # -``` - -```javascript -'/_get link #' + groupId // JavaScript -``` - -```python -'/_get link #' + str(groupId) # Python -``` - -**Responses**: - -GroupLink: Group link. -- type: "groupLink" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- groupLink: [GroupLink](./TYPES.md#grouplink) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -## 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. - - -### APIAddContact - -Create 1-time invitation link. - -*Network usage*: interactive. - -**Parameters**: -- userId: int64 -- incognito: bool - -**Syntax**: - -``` -/_connect [ incognito=on] -``` - -```javascript -'/_connect ' + userId + (incognito ? ' incognito=on' : '') // JavaScript -``` - -```python -'/_connect ' + str(userId) + (' incognito=on' if incognito else '') # Python -``` - -**Responses**: - -Invitation: One-time invitation. -- type: "invitation" -- user: [User](./TYPES.md#user) -- connLinkInvitation: [CreatedConnLink](./TYPES.md#createdconnlink) -- connection: [PendingContactConnection](./TYPES.md#pendingcontactconnection) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIConnectPlan - -Determine SimpleX link type and if the bot is already connected via this link or name. - -*Network usage*: interactive. - -**Parameters**: -- userId: int64 -- connectTarget: string? -- resolveMode: [PlanResolveMode](./TYPES.md#planresolvemode) -- linkOwnerSig: [LinkOwnerSig](./TYPES.md#linkownersig)? - -**Syntax**: - -``` -/_connect plan -``` - -```javascript -'/_connect plan ' + userId + ' ' + connectTarget // JavaScript -``` - -```python -'/_connect plan ' + str(userId) + ' ' + connectTarget # Python -``` - -**Responses**: - -ConnectionPlan: Connection link information. -- type: "connectionPlan" -- user: [User](./TYPES.md#user) -- connLink: [CreatedConnLink](./TYPES.md#createdconnlink) -- planSimplexName: [SimplexNameInfo](./TYPES.md#simplexnameinfo)? -- otherSimplexName: [SimplexNameInfo](./TYPES.md#simplexnameinfo)? -- connectionPlan: [ConnectionPlan](./TYPES.md#connectionplan) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIConnect - -Connect via prepared SimpleX link. The link can be 1-time invitation link, contact address or group link. - -*Network usage*: interactive. - -**Parameters**: -- userId: int64 -- incognito: bool -- preparedLink_: [CreatedConnLink](./TYPES.md#createdconnlink)? - -**Syntax**: - -``` -/_connect [ incognito=on][ ] -``` - -```javascript -'/_connect ' + userId + (incognito ? ' incognito=on' : '') + (preparedLink_ ? ' ' + CreatedConnLink.cmdString(preparedLink_) : '') // JavaScript -``` - -```python -'/_connect ' + str(userId) + (' incognito=on' if incognito else '') + ((' ' + CreatedConnLink_cmd_string(preparedLink_)) if preparedLink_ is not None else '') # Python -``` - -**Responses**: - -SentConfirmation: Confirmation sent to one-time invitation. -- type: "sentConfirmation" -- user: [User](./TYPES.md#user) -- connection: [PendingContactConnection](./TYPES.md#pendingcontactconnection) -- customUserProfile: [Profile](./TYPES.md#profile)? - -ContactAlreadyExists: Contact already exists. -- type: "contactAlreadyExists" -- user: [User](./TYPES.md#user) -- contact: [Contact](./TYPES.md#contact) - -SentInvitation: Invitation sent to contact address. -- type: "sentInvitation" -- user: [User](./TYPES.md#user) -- connection: [PendingContactConnection](./TYPES.md#pendingcontactconnection) -- customUserProfile: [Profile](./TYPES.md#profile)? - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### Connect - -Connect via SimpleX link or name as string in the active user profile. - -*Network usage*: interactive. - -**Parameters**: -- incognito: bool -- connTarget_: string? - -**Syntax**: - -``` -/connect[ ] -``` - -```javascript -'/connect' + (connTarget_ ? ' ' + connTarget_ : '') // JavaScript -``` - -```python -'/connect' + ((' ' + connTarget_) if connTarget_ is not None else '') # Python -``` - -**Responses**: - -SentConfirmation: Confirmation sent to one-time invitation. -- type: "sentConfirmation" -- user: [User](./TYPES.md#user) -- connection: [PendingContactConnection](./TYPES.md#pendingcontactconnection) -- customUserProfile: [Profile](./TYPES.md#profile)? - -ContactAlreadyExists: Contact already exists. -- type: "contactAlreadyExists" -- user: [User](./TYPES.md#user) -- contact: [Contact](./TYPES.md#contact) - -SentInvitation: Invitation sent to contact address. -- type: "sentInvitation" -- user: [User](./TYPES.md#user) -- connection: [PendingContactConnection](./TYPES.md#pendingcontactconnection) -- customUserProfile: [Profile](./TYPES.md#profile)? - -ConnectionPlan: Connection link information. -- type: "connectionPlan" -- user: [User](./TYPES.md#user) -- connLink: [CreatedConnLink](./TYPES.md#createdconnlink) -- planSimplexName: [SimplexNameInfo](./TYPES.md#simplexnameinfo)? -- otherSimplexName: [SimplexNameInfo](./TYPES.md#simplexnameinfo)? -- connectionPlan: [ConnectionPlan](./TYPES.md#connectionplan) - -SentInvitationToContact: Invitation sent to contact (when connecting via SimpleX name to a known contact address).. -- type: "sentInvitationToContact" -- user: [User](./TYPES.md#user) -- contact: [Contact](./TYPES.md#contact) -- customUserProfile: [Profile](./TYPES.md#profile)? - -StartedConnectionToContact: Connection to contact started (when connecting via prepared contact).. -- type: "startedConnectionToContact" -- user: [User](./TYPES.md#user) -- contact: [Contact](./TYPES.md#contact) -- customUserProfile: [Profile](./TYPES.md#profile)? - -StartedConnectionToGroup: Connection to channel started (when connecting via channel link).. -- type: "startedConnectionToGroup" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- customUserProfile: [Profile](./TYPES.md#profile)? -- relayResults: [[RelayConnectionResult](./TYPES.md#relayconnectionresult)] - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIAcceptContact - -Accept contact request. - -*Network usage*: interactive. - -**Parameters**: -- contactReqId: int64 - -**Syntax**: - -``` -/_accept -``` - -```javascript -'/_accept ' + contactReqId // JavaScript -``` - -```python -'/_accept ' + str(contactReqId) # Python -``` - -**Responses**: - -AcceptingContactRequest: Contact request accepted. -- type: "acceptingContactRequest" -- user: [User](./TYPES.md#user) -- contact: [Contact](./TYPES.md#contact) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIRejectContact - -Reject contact request. The user who sent the request is **not notified**. - -*Network usage*: no. - -**Parameters**: -- contactReqId: int64 -- notify: bool - -**Syntax**: - -``` -/_reject -``` - -```javascript -'/_reject ' + contactReqId // JavaScript -``` - -```python -'/_reject ' + str(contactReqId) # Python -``` - -**Responses**: - -ContactRequestRejected: Contact request rejected. -- type: "contactRequestRejected" -- user: [User](./TYPES.md#user) -- contactRequest: [UserContactRequest](./TYPES.md#usercontactrequest) -- contact_: [Contact](./TYPES.md#contact)? - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -## Chat commands - -Commands to list and delete conversations. - - -### APIListContacts - -Get contacts. - -*Network usage*: no. - -**Parameters**: -- userId: int64 - -**Syntax**: - -``` -/_contacts -``` - -```javascript -'/_contacts ' + userId // JavaScript -``` - -```python -'/_contacts ' + str(userId) # Python -``` - -**Responses**: - -ContactsList: Contacts. -- type: "contactsList" -- user: [User](./TYPES.md#user) -- contacts: [[Contact](./TYPES.md#contact)] - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIListGroups - -Get groups. - -*Network usage*: no. - -**Parameters**: -- userId: int64 -- contactId_: int64? -- search: string? - -**Syntax**: - -``` -/_groups [ @][ ] -``` - -```javascript -'/_groups ' + userId + (contactId_ ? ' @' + contactId_ : '') + (search ? ' ' + search : '') // JavaScript -``` - -```python -'/_groups ' + str(userId) + ((' @' + str(contactId_)) if contactId_ is not None else '') + ((' ' + search) if search is not None else '') # Python -``` - -**Responses**: - -GroupsList: Groups. -- type: "groupsList" -- user: [User](./TYPES.md#user) -- groups: [[GroupInfo](./TYPES.md#groupinfo)] - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIGetChats - -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. - -**Parameters**: -- userId: int64 -- pendingConnections: bool -- pagination: [PaginationByTime](./TYPES.md#paginationbytime)? -- query: [ChatListQuery](./TYPES.md#chatlistquery) - -**Syntax**: - -``` -/_get chats [ pcc=on][ ] -``` - -```javascript -'/_get chats ' + userId + (pendingConnections ? ' pcc=on' : '') + (pagination ? ' ' + PaginationByTime.cmdString(pagination) : '') + ' ' + JSON.stringify(query) // JavaScript -``` - -```python -'/_get chats ' + str(userId) + (' pcc=on' if pendingConnections else '') + ((' ' + PaginationByTime_cmd_string(pagination)) if pagination is not None else '') + ' ' + json.dumps(query) # Python -``` - -**Responses**: - -ApiChats: Chat previews (paginated). Use this instead of CRContactsList / CRGroupsList when scanning at scale.. -- type: "apiChats" -- user: [User](./TYPES.md#user) -- chats: [[AChat](./TYPES.md#achat)] - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIDeleteChat - -Delete chat. - -*Network usage*: background. - -**Parameters**: -- chatRef: [ChatRef](./TYPES.md#chatref) -- chatDeleteMode: [ChatDeleteMode](./TYPES.md#chatdeletemode) - -**Syntax**: - -``` -/_delete -``` - -```javascript -'/_delete ' + ChatRef.cmdString(chatRef) + ' ' + ChatDeleteMode.cmdString(chatDeleteMode) // JavaScript -``` - -```python -'/_delete ' + ChatRef_cmd_string(chatRef) + ' ' + ChatDeleteMode_cmd_string(chatDeleteMode) # Python -``` - -**Responses**: - -ContactDeleted: Contact deleted. -- type: "contactDeleted" -- user: [User](./TYPES.md#user) -- contact: [Contact](./TYPES.md#contact) - -ContactConnectionDeleted: Connection deleted. -- type: "contactConnectionDeleted" -- user: [User](./TYPES.md#user) -- connection: [PendingContactConnection](./TYPES.md#pendingcontactconnection) - -GroupDeletedUser: User deleted group. -- type: "groupDeletedUser" -- user: [User](./TYPES.md#user) -- groupInfo: [GroupInfo](./TYPES.md#groupinfo) -- msgSigned: bool -- localDeletion: bool - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APISetGroupCustomData - -Set group custom data. - -*Network usage*: no. - -**Parameters**: -- groupId: int64 -- customData: JSONObject? - -**Syntax**: - -``` -/_set custom #[ ] -``` - -```javascript -'/_set custom #' + groupId + (customData ? ' ' + JSON.stringify(customData) : '') // JavaScript -``` - -```python -'/_set custom #' + str(groupId) + ((' ' + json.dumps(customData)) if customData is not None else '') # Python -``` - -**Responses**: - -CmdOk: Ok. -- type: "cmdOk" -- user_: [User](./TYPES.md#user)? - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APISetContactCustomData - -Set contact custom data. - -*Network usage*: no. - -**Parameters**: -- contactId: int64 -- customData: JSONObject? - -**Syntax**: - -``` -/_set custom @[ ] -``` - -```javascript -'/_set custom @' + contactId + (customData ? ' ' + JSON.stringify(customData) : '') // JavaScript -``` - -```python -'/_set custom @' + str(contactId) + ((' ' + json.dumps(customData)) if customData is not None else '') # Python -``` - -**Responses**: - -CmdOk: Ok. -- type: "cmdOk" -- user_: [User](./TYPES.md#user)? - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APISetUserAutoAcceptMemberContacts - -Set auto-accept member contacts. - -*Network usage*: no. - -**Parameters**: -- userId: int64 -- onOff: bool - -**Syntax**: - -``` -/_set accept member contacts on|off -``` - -```javascript -'/_set accept member contacts ' + userId + ' ' + (onOff ? 'on' : 'off') // JavaScript -``` - -```python -'/_set accept member contacts ' + str(userId) + ' ' + ('on' if onOff else 'off') # Python -``` - -**Responses**: - -CmdOk: Ok. -- type: "cmdOk" -- user_: [User](./TYPES.md#user)? - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APISetUserAutoAcceptGroupInvitations - -Set auto-accept group invitations. - -*Network usage*: no. - -**Parameters**: -- userId: int64 -- onOff: bool - -**Syntax**: - -``` -/_set accept group invitations on|off -``` - -```javascript -'/_set accept group invitations ' + userId + ' ' + (onOff ? 'on' : 'off') // JavaScript -``` - -```python -'/_set accept group invitations ' + str(userId) + ' ' + ('on' if onOff else 'off') # Python -``` - -**Responses**: - -CmdOk: Ok. -- type: "cmdOk" -- user_: [User](./TYPES.md#user)? - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -## 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). - - -### ShowActiveUser - -Get active user profile. - -*Network usage*: no. - -**Syntax**: - -``` -/user -``` - -**Responses**: - -ActiveUser: Active user profile. -- type: "activeUser" -- user: [User](./TYPES.md#user) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### CreateActiveUser - -Create new user profile. - -*Network usage*: no. - -**Parameters**: -- newUser: [NewUser](./TYPES.md#newuser) - -**Syntax**: - -``` -/_create user -``` - -```javascript -'/_create user ' + JSON.stringify(newUser) // JavaScript -``` - -```python -'/_create user ' + json.dumps(newUser) # Python -``` - -**Responses**: - -ActiveUser: Active user profile. -- type: "activeUser" -- user: [User](./TYPES.md#user) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - -**Errors**: -- UserExists: User or contact with this name already exists. -- InvalidDisplayName: Invalid user display name. - ---- - - -### ListUsers - -Get all user profiles. - -*Network usage*: no. - -**Syntax**: - -``` -/users -``` - -**Responses**: - -UsersList: Users. -- type: "usersList" -- users: [[UserInfo](./TYPES.md#userinfo)] - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APISetActiveUser - -Set active user profile. - -*Network usage*: no. - -**Parameters**: -- userId: int64 -- viewPwd: string? - -**Syntax**: - -``` -/_user [ ] -``` - -```javascript -'/_user ' + userId + (viewPwd ? ' ' + JSON.stringify(viewPwd) : '') // JavaScript -``` - -```python -'/_user ' + str(userId) + ((' ' + json.dumps(viewPwd)) if viewPwd is not None else '') # Python -``` - -**Responses**: - -ActiveUser: Active user profile. -- type: "activeUser" -- user: [User](./TYPES.md#user) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - -**Errors**: -- ChatNotStarted: Chat not started. - ---- - - -### APIDeleteUser - -Delete user profile. - -*Network usage*: background. - -**Parameters**: -- userId: int64 -- delSMPQueues: bool -- viewPwd: string? - -**Syntax**: - -``` -/_delete user del_smp=on|off[ ] -``` - -```javascript -'/_delete user ' + userId + ' del_smp=' + (delSMPQueues ? 'on' : 'off') + (viewPwd ? ' ' + JSON.stringify(viewPwd) : '') // JavaScript -``` - -```python -'/_delete user ' + str(userId) + ' del_smp=' + ('on' if delSMPQueues else 'off') + ((' ' + json.dumps(viewPwd)) if viewPwd is not None else '') # Python -``` - -**Responses**: - -CmdOk: Ok. -- type: "cmdOk" -- user_: [User](./TYPES.md#user)? - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APIUpdateProfile - -Update user profile. - -*Network usage*: background. - -**Parameters**: -- userId: int64 -- profile: [Profile](./TYPES.md#profile) - -**Syntax**: - -``` -/_profile -``` - -```javascript -'/_profile ' + userId + ' ' + JSON.stringify(profile) // JavaScript -``` - -```python -'/_profile ' + str(userId) + ' ' + json.dumps(profile) # Python -``` - -**Responses**: - -UserProfileUpdated: User profile updated. -- type: "userProfileUpdated" -- user: [User](./TYPES.md#user) -- fromProfile: [Profile](./TYPES.md#profile) -- toProfile: [Profile](./TYPES.md#profile) -- updateSummary: [UserProfileUpdateSummary](./TYPES.md#userprofileupdatesummary) - -UserProfileNoChange: User profile was not changed. -- type: "userProfileNoChange" -- user: [User](./TYPES.md#user) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### APISetContactPrefs - -Configure chat preference overrides for the contact. - -*Network usage*: background. - -**Parameters**: -- contactId: int64 -- preferences: [Preferences](./TYPES.md#preferences) - -**Syntax**: - -``` -/_set prefs @ -``` - -```javascript -'/_set prefs @' + contactId + ' ' + JSON.stringify(preferences) // JavaScript -``` - -```python -'/_set prefs @' + str(contactId) + ' ' + json.dumps(preferences) # Python -``` - -**Responses**: - -ContactPrefsUpdated: Contact preferences updated. -- type: "contactPrefsUpdated" -- user: [User](./TYPES.md#user) -- fromContact: [Contact](./TYPES.md#contact) -- toContact: [Contact](./TYPES.md#contact) - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -## Service commands - -Bots with a double ratchet address can answer service requests. - - -### APISendServiceResponse - -Send a reply to a received service request. Returns the connection ID that correlates the reply delivery event. - -*Network usage*: background. - -**Parameters**: -- userId: int64 -- requestId: string -- responseData: JSONObject - -**Syntax**: - -``` -/_service_response -``` - -```javascript -'/_service_response ' + userId + ' ' + requestId + ' ' + JSON.stringify(responseData) // JavaScript -``` - -```python -'/_service_response ' + str(userId) + ' ' + requestId + ' ' + json.dumps(responseData) # Python -``` - -**Responses**: - -ServiceReplyAccepted: Service reply accepted for delivery. `connectionId` correlates the reply delivery event.. -- type: "serviceReplyAccepted" -- user: [User](./TYPES.md#user) -- connectionId: string - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -## Chat management - -These commands should not be used with CLI-based bots - - -### StartChat - -Start chat controller. - -*Network usage*: no. - -**Parameters**: -- mainApp: bool -- enableSndFiles: bool -- serviceRequests: bool - -**Syntax**: - -``` -/_start main=on|off[ snd_files=off][ service_requests=on] -``` - -```javascript -'/_start main=' + (mainApp ? 'on' : 'off') + (!enableSndFiles ? ' snd_files=off' : '') + (serviceRequests ? ' service_requests=on' : '') // JavaScript -``` - -```python -'/_start' + ' main=' + ('on' if mainApp else 'off') + (' snd_files=off' if not enableSndFiles else '') + (' service_requests=on' if serviceRequests else '') # Python -``` - -**Responses**: - -ChatStarted: Chat started. -- type: "chatStarted" - -ChatRunning: Chat running. -- type: "chatRunning" - ---- - - -### APIStopChat - -Stop chat controller. - -*Network usage*: no. - -**Syntax**: - -``` -/_stop -``` - -**Response**: - -ChatStopped: Chat stopped. -- type: "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. - - -### ConnectRemoteCtrl - -Connect to a remote controller using an OOB invitation link. - -*Network usage*: interactive. - -**Parameters**: -- remoteInvitation: string - -**Syntax**: - -``` -/crc -``` - -```javascript -'/crc ' + remoteInvitation // JavaScript -``` - -```python -'/crc ' + remoteInvitation # Python -``` - -**Responses**: - -RemoteCtrlConnecting: Remote controller is connecting.. -- type: "remoteCtrlConnecting" -- remoteCtrl_: [RemoteCtrlInfo](./TYPES.md#remotectrlinfo)? -- ctrlAppInfo: [CtrlAppInfo](./TYPES.md#ctrlappinfo) -- appVersion: string - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- - - -### VerifyRemoteCtrlSession - -Verify the remote controller session code to complete the connection. - -*Network usage*: no. - -**Parameters**: -- sessionCode: string - -**Syntax**: - -``` -/verify remote ctrl -``` - -```javascript -'/verify remote ctrl ' + sessionCode // JavaScript -``` - -```python -'/verify remote ctrl ' + sessionCode # Python -``` - -**Responses**: - -RemoteCtrlConnected: Remote controller session connected.. -- type: "remoteCtrlConnected" -- remoteCtrl: [RemoteCtrlInfo](./TYPES.md#remotectrlinfo) -- compression: bool - -ChatCmdError: Command error (only used in WebSockets API). -- type: "chatCmdError" -- chatError: [ChatError](./TYPES.md#chaterror) - ---- diff --git a/bots/api/EVENTS.md b/bots/api/EVENTS.md index 5416fe4c0e..e69de29bb2 100644 --- a/bots/api/EVENTS.md +++ b/bots/api/EVENTS.md @@ -1,868 +0,0 @@ -# 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)] - ---- diff --git a/bots/api/TYPES.md b/bots/api/TYPES.md index f1122979a9..e69de29bb2 100644 --- a/bots/api/TYPES.md +++ b/bots/api/TYPES.md @@ -1,4712 +0,0 @@ -# API Types - -This file is generated automatically. - -- [ACIReaction](#acireaction) -- [AChat](#achat) -- [AChatItem](#achatitem) -- [AddRelayResult](#addrelayresult) -- [AddressSettings](#addresssettings) -- [AgentCryptoError](#agentcryptoerror) -- [AgentErrorType](#agenterrortype) -- [AgentServiceError](#agentserviceerror) -- [AppVersionRange](#appversionrange) -- [AutoAccept](#autoaccept) -- [BadgeInfo](#badgeinfo) -- [BadgeProof](#badgeproof) -- [BadgeRedeemError](#badgeredeemerror) -- [BadgeServiceErrorCode](#badgeserviceerrorcode) -- [BadgeStatus](#badgestatus) -- [BadgeType](#badgetype) -- [BlockingInfo](#blockinginfo) -- [BlockingReason](#blockingreason) -- [BrokerErrorType](#brokererrortype) -- [BusinessChatInfo](#businesschatinfo) -- [BusinessChatType](#businesschattype) -- [CICallStatus](#cicallstatus) -- [CIContent](#cicontent) -- [CIDeleteMode](#cideletemode) -- [CIDeleted](#cideleted) -- [CIDirection](#cidirection) -- [CIFile](#cifile) -- [CIFileStatus](#cifilestatus) -- [CIForwardedFrom](#ciforwardedfrom) -- [CIGroupInvitation](#cigroupinvitation) -- [CIGroupInvitationStatus](#cigroupinvitationstatus) -- [CIMention](#cimention) -- [CIMentionMember](#cimentionmember) -- [CIMeta](#cimeta) -- [CIQuote](#ciquote) -- [CIReaction](#cireaction) -- [CIReactionCount](#cireactioncount) -- [CIStatus](#cistatus) -- [CITimed](#citimed) -- [ChatBotCommand](#chatbotcommand) -- [ChatDeleteMode](#chatdeletemode) -- [ChatError](#chaterror) -- [ChatErrorType](#chaterrortype) -- [ChatFeature](#chatfeature) -- [ChatInfo](#chatinfo) -- [ChatItem](#chatitem) -- [ChatItemDeletion](#chatitemdeletion) -- [ChatListQuery](#chatlistquery) -- [ChatPeerType](#chatpeertype) -- [ChatRef](#chatref) -- [ChatSettings](#chatsettings) -- [ChatStats](#chatstats) -- [ChatType](#chattype) -- [ChatWallpaper](#chatwallpaper) -- [ChatWallpaperScale](#chatwallpaperscale) -- [ClientNotice](#clientnotice) -- [Color](#color) -- [CommandError](#commanderror) -- [CommandErrorType](#commanderrortype) -- [CommentsGroupPreference](#commentsgrouppreference) -- [ComposedMessage](#composedmessage) -- [ConnStatus](#connstatus) -- [ConnType](#conntype) -- [Connection](#connection) -- [ConnectionEntity](#connectionentity) -- [ConnectionErrorType](#connectionerrortype) -- [ConnectionMode](#connectionmode) -- [ConnectionPlan](#connectionplan) -- [Contact](#contact) -- [ContactAddressPlan](#contactaddressplan) -- [ContactShortLinkData](#contactshortlinkdata) -- [ContactStatus](#contactstatus) -- [ContactUserPref](#contactuserpref) -- [ContactUserPreference](#contactuserpreference) -- [ContactUserPreferences](#contactuserpreferences) -- [CreatedConnLink](#createdconnlink) -- [CryptoFile](#cryptofile) -- [CryptoFileArgs](#cryptofileargs) -- [CtrlAppInfo](#ctrlappinfo) -- [DroppedMsg](#droppedmsg) -- [E2EInfo](#e2einfo) -- [ErrorType](#errortype) -- [FeatureAllowed](#featureallowed) -- [FileDescr](#filedescr) -- [FileError](#fileerror) -- [FileErrorType](#fileerrortype) -- [FileInvitation](#fileinvitation) -- [FileProhibited](#fileprohibited) -- [FileProtocol](#fileprotocol) -- [FileStatus](#filestatus) -- [FileTransferMeta](#filetransfermeta) -- [FileType](#filetype) -- [Format](#format) -- [FormattedText](#formattedtext) -- [FullGroupPreferences](#fullgrouppreferences) -- [FullPreferences](#fullpreferences) -- [Group](#group) -- [GroupChatScope](#groupchatscope) -- [GroupChatScopeInfo](#groupchatscopeinfo) -- [GroupDirectInvitation](#groupdirectinvitation) -- [GroupFeature](#groupfeature) -- [GroupFeatureEnabled](#groupfeatureenabled) -- [GroupInfo](#groupinfo) -- [GroupLink](#grouplink) -- [GroupLinkOwner](#grouplinkowner) -- [GroupLinkPlan](#grouplinkplan) -- [GroupMember](#groupmember) -- [GroupMemberAdmission](#groupmemberadmission) -- [GroupMemberCategory](#groupmembercategory) -- [GroupMemberRef](#groupmemberref) -- [GroupMemberRole](#groupmemberrole) -- [GroupMemberSettings](#groupmembersettings) -- [GroupMemberStatus](#groupmemberstatus) -- [GroupPreference](#grouppreference) -- [GroupPreferences](#grouppreferences) -- [GroupProfile](#groupprofile) -- [GroupRelay](#grouprelay) -- [GroupShortLinkData](#groupshortlinkdata) -- [GroupShortLinkInfo](#groupshortlinkinfo) -- [GroupSummary](#groupsummary) -- [GroupSupportChat](#groupsupportchat) -- [GroupType](#grouptype) -- [HandshakeError](#handshakeerror) -- [InlineFileMode](#inlinefilemode) -- [InvitationLinkPlan](#invitationlinkplan) -- [InvitedBy](#invitedby) -- [LinkContent](#linkcontent) -- [LinkOwnerSig](#linkownersig) -- [LinkPreview](#linkpreview) -- [LocalBadge](#localbadge) -- [LocalProfile](#localprofile) -- [MemberCriteria](#membercriteria) -- [MsgChatLink](#msgchatlink) -- [MsgContent](#msgcontent) -- [MsgDecryptError](#msgdecrypterror) -- [MsgDirection](#msgdirection) -- [MsgErrorType](#msgerrortype) -- [MsgFilter](#msgfilter) -- [MsgReaction](#msgreaction) -- [MsgReceiptStatus](#msgreceiptstatus) -- [MsgSigStatus](#msgsigstatus) -- [MsgVerified](#msgverified) -- [NameErrorType](#nameerrortype) -- [NetworkError](#networkerror) -- [NewUser](#newuser) -- [NoteFolder](#notefolder) -- [OwnerVerification](#ownerverification) -- [PaginationByTime](#paginationbytime) -- [PendingContactConnection](#pendingcontactconnection) -- [PlanResolveMode](#planresolvemode) -- [PrefEnabled](#prefenabled) -- [Preferences](#preferences) -- [PreparedContact](#preparedcontact) -- [PreparedGroup](#preparedgroup) -- [Profile](#profile) -- [ProxyClientError](#proxyclienterror) -- [ProxyError](#proxyerror) -- [PublicGroupAccess](#publicgroupaccess) -- [PublicGroupData](#publicgroupdata) -- [PublicGroupProfile](#publicgroupprofile) -- [RCErrorType](#rcerrortype) -- [RatchetSyncState](#ratchetsyncstate) -- [RcvConnEvent](#rcvconnevent) -- [RcvDirectEvent](#rcvdirectevent) -- [RcvFileDescr](#rcvfiledescr) -- [RcvFileStatus](#rcvfilestatus) -- [RcvFileTransfer](#rcvfiletransfer) -- [RcvGroupEvent](#rcvgroupevent) -- [RcvMsgError](#rcvmsgerror) -- [RelayCapabilities](#relaycapabilities) -- [RelayConnectionResult](#relayconnectionresult) -- [RelayProfile](#relayprofile) -- [RelayStatus](#relaystatus) -- [RemoteCtrlInfo](#remotectrlinfo) -- [RemoteCtrlSessionState](#remotectrlsessionstate) -- [RemoteCtrlStopReason](#remotectrlstopreason) -- [ReportReason](#reportreason) -- [RoleGroupPreference](#rolegrouppreference) -- [SMPAgentError](#smpagenterror) -- [SecurityCode](#securitycode) -- [SimplePreference](#simplepreference) -- [SimplexDomain](#simplexdomain) -- [SimplexDomainClaim](#simplexdomainclaim) -- [SimplexDomainError](#simplexdomainerror) -- [SimplexDomainProof](#simplexdomainproof) -- [SimplexLinkType](#simplexlinktype) -- [SimplexNameInfo](#simplexnameinfo) -- [SimplexNameType](#simplexnametype) -- [SimplexTLD](#simplextld) -- [SndCIStatusProgress](#sndcistatusprogress) -- [SndConnEvent](#sndconnevent) -- [SndError](#snderror) -- [SndFileTransfer](#sndfiletransfer) -- [SndGroupEvent](#sndgroupevent) -- [SrvError](#srverror) -- [StoreError](#storeerror) -- [SubscriptionStatus](#subscriptionstatus) -- [SupportGroupPreference](#supportgrouppreference) -- [SwitchPhase](#switchphase) -- [TimedMessagesGroupPreference](#timedmessagesgrouppreference) -- [TimedMessagesPreference](#timedmessagespreference) -- [TransportError](#transporterror) -- [UIColorMode](#uicolormode) -- [UIColors](#uicolors) -- [UIThemeEntityOverride](#uithemeentityoverride) -- [UIThemeEntityOverrides](#uithemeentityoverrides) -- [UpdatedMessage](#updatedmessage) -- [User](#user) -- [UserChatRelay](#userchatrelay) -- [UserContact](#usercontact) -- [UserContactLink](#usercontactlink) -- [UserContactRequest](#usercontactrequest) -- [UserContactRequestRef](#usercontactrequestref) -- [UserInfo](#userinfo) -- [UserProfileUpdateSummary](#userprofileupdatesummary) -- [UserPwdHash](#userpwdhash) -- [VersionRange](#versionrange) -- [XFTPErrorType](#xftperrortype) -- [XFTPRcvFile](#xftprcvfile) -- [XFTPSndFile](#xftpsndfile) - - ---- - -## ACIReaction - -**Record type**: -- chatInfo: [ChatInfo](#chatinfo) -- chatReaction: [CIReaction](#cireaction) - - ---- - -## AChat - -**Record type**: -- chatInfo: [ChatInfo](#chatinfo) -- chatItems: [[ChatItem](#chatitem)] -- chatStats: [ChatStats](#chatstats) - - ---- - -## AChatItem - -**Record type**: -- chatInfo: [ChatInfo](#chatinfo) -- chatItem: [ChatItem](#chatitem) - - ---- - -## AddRelayResult - -**Record type**: -- relay: [UserChatRelay](#userchatrelay) -- relayError: [ChatError](#chaterror)? - - ---- - -## AddressSettings - -**Record type**: -- businessAddress: bool -- autoAccept: [AutoAccept](#autoaccept)? -- autoReply: [MsgContent](#msgcontent)? - - ---- - -## AgentCryptoError - -**Discriminated union type**: - -DECRYPT_AES: -- type: "DECRYPT_AES" - -DECRYPT_CB: -- type: "DECRYPT_CB" - -RATCHET_HEADER: -- type: "RATCHET_HEADER" - -RATCHET_SYNC: -- type: "RATCHET_SYNC" - - ---- - -## AgentErrorType - -**Discriminated union type**: - -CMD: -- type: "CMD" -- cmdErr: [CommandErrorType](#commanderrortype) -- errContext: string - -CONN: -- type: "CONN" -- connErr: [ConnectionErrorType](#connectionerrortype) -- errContext: string - -NO_USER: -- type: "NO_USER" - -SMP: -- type: "SMP" -- serverAddress: string -- smpErr: [ErrorType](#errortype) - -NTF: -- type: "NTF" -- serverAddress: string -- ntfErr: [ErrorType](#errortype) - -XFTP: -- type: "XFTP" -- serverAddress: string -- xftpErr: [XFTPErrorType](#xftperrortype) - -FILE: -- type: "FILE" -- fileErr: [FileErrorType](#fileerrortype) - -NO_NAME_SERVERS: -- type: "NO_NAME_SERVERS" - -PROXY: -- type: "PROXY" -- proxyServer: string -- relayServer: string -- proxyErr: [ProxyClientError](#proxyclienterror) - -RCP: -- type: "RCP" -- rcpErr: [RCErrorType](#rcerrortype) - -BROKER: -- type: "BROKER" -- brokerAddress: string -- brokerErr: [BrokerErrorType](#brokererrortype) - -AGENT: -- type: "AGENT" -- agentErr: [SMPAgentError](#smpagenterror) - -NOTICE: -- type: "NOTICE" -- server: string -- preset: bool -- expiresAt: UTCTime? - -INTERNAL: -- type: "INTERNAL" -- internalErr: string - -CRITICAL: -- type: "CRITICAL" -- offerRestart: bool -- criticalErr: string - -INACTIVE: -- type: "INACTIVE" - - ---- - -## AgentServiceError - -**Discriminated union type**: - -Rejected: -- type: "rejected" -- rejectReason: string - -Timeout: -- type: "timeout" - -NoPendingRequest: -- type: "noPendingRequest" - -NotDRAddress: -- type: "notDRAddress" - -BadSignature: -- type: "badSignature" - - ---- - -## AppVersionRange - -Remote controller app version range (min and max as version strings). - -**Record type**: -- minVersion: string -- maxVersion: string - - ---- - -## AutoAccept - -**Record type**: -- acceptIncognito: bool - - ---- - -## BadgeInfo - -**Record type**: -- badgeType: [BadgeType](#badgetype) -- badgeExpiry: UTCTime -- badgeExtra: string - - ---- - -## BadgeProof - -**Record type**: -- badgeKeyIdx: int -- presHeader: string -- proof: string -- badgeInfo: [BadgeInfo](#badgeinfo) - - ---- - -## BadgeRedeemError - -**Discriminated union type**: - -InvalidCode: -- type: "invalidCode" - -ServiceNotConfigured: -- type: "serviceNotConfigured" - -BadgeActive: -- type: "badgeActive" - -ServiceError: -- type: "serviceError" -- serviceError: [BadgeServiceErrorCode](#badgeserviceerrorcode) - -InvalidResponse: -- type: "invalidResponse" -- message: string - -UnknownKeyIndex: -- type: "unknownKeyIndex" - -CredentialNotVerified: -- type: "credentialNotVerified" - - ---- - -## BadgeServiceErrorCode - -**Enum type**: -- "bad_request" -- "unsupported_version" -- "unknown_purchase_key" -- "unknown_offer_id" -- "offer_disabled" -- "offer_mismatch" -- "product_unavailable" -- "payment_not_entitled" -- "payment_pending" -- "provider_unavailable" -- "rate_limited" -- "code_invalid" -- "code_used" -- "code_expired" -- "receipt_invalid" -- "receipt_used" -- "internal" - - ---- - -## BadgeStatus - -**Enum type**: -- "active" -- "expired" -- "expiredOld" -- "failed" -- "unknownKey" - - ---- - -## BadgeType - -**Enum type**: -- "supporter" -- "legend" -- "investor" - - ---- - -## BlockingInfo - -**Record type**: -- reason: [BlockingReason](#blockingreason) -- notice: [ClientNotice](#clientnotice)? - - ---- - -## BlockingReason - -**Enum type**: -- "spam" -- "content" - - ---- - -## BrokerErrorType - -**Discriminated union type**: - -RESPONSE: -- type: "RESPONSE" -- respErr: string - -UNEXPECTED: -- type: "UNEXPECTED" -- respErr: string - -NETWORK: -- type: "NETWORK" -- networkError: [NetworkError](#networkerror) - -HOST: -- type: "HOST" - -NO_SERVICE: -- type: "NO_SERVICE" - -TRANSPORT: -- type: "TRANSPORT" -- transportErr: [TransportError](#transporterror) - -TIMEOUT: -- type: "TIMEOUT" - - ---- - -## BusinessChatInfo - -**Record type**: -- chatType: [BusinessChatType](#businesschattype) -- businessId: string -- customerId: string -- businessDomain: [SimplexDomainClaim](#simplexdomainclaim)? - - ---- - -## BusinessChatType - -**Enum type**: -- "business" -- "customer" - - ---- - -## CICallStatus - -**Enum type**: -- "pending" -- "missed" -- "rejected" -- "accepted" -- "negotiated" -- "progress" -- "ended" -- "error" - - ---- - -## CIContent - -**Discriminated union type**: - -SndMsgContent: -- type: "sndMsgContent" -- msgContent: [MsgContent](#msgcontent) - -RcvMsgContent: -- type: "rcvMsgContent" -- msgContent: [MsgContent](#msgcontent) - -SndDeleted: -- type: "sndDeleted" -- deleteMode: [CIDeleteMode](#cideletemode) - -RcvDeleted: -- type: "rcvDeleted" -- deleteMode: [CIDeleteMode](#cideletemode) - -SndCall: -- type: "sndCall" -- status: [CICallStatus](#cicallstatus) -- duration: int - -RcvCall: -- type: "rcvCall" -- status: [CICallStatus](#cicallstatus) -- duration: int - -RcvIntegrityError: -- type: "rcvIntegrityError" -- msgError: [MsgErrorType](#msgerrortype) - -RcvDecryptionError: -- type: "rcvDecryptionError" -- msgDecryptError: [MsgDecryptError](#msgdecrypterror) -- msgCount: word32 - -RcvMsgError: -- type: "rcvMsgError" -- rcvMsgError: [RcvMsgError](#rcvmsgerror) - -RcvGroupInvitation: -- type: "rcvGroupInvitation" -- groupInvitation: [CIGroupInvitation](#cigroupinvitation) -- memberRole: [GroupMemberRole](#groupmemberrole) - -SndGroupInvitation: -- type: "sndGroupInvitation" -- groupInvitation: [CIGroupInvitation](#cigroupinvitation) -- memberRole: [GroupMemberRole](#groupmemberrole) - -RcvDirectEvent: -- type: "rcvDirectEvent" -- rcvDirectEvent: [RcvDirectEvent](#rcvdirectevent) - -RcvGroupEvent: -- type: "rcvGroupEvent" -- rcvGroupEvent: [RcvGroupEvent](#rcvgroupevent) - -SndGroupEvent: -- type: "sndGroupEvent" -- sndGroupEvent: [SndGroupEvent](#sndgroupevent) - -RcvConnEvent: -- type: "rcvConnEvent" -- rcvConnEvent: [RcvConnEvent](#rcvconnevent) - -SndConnEvent: -- type: "sndConnEvent" -- sndConnEvent: [SndConnEvent](#sndconnevent) - -RcvChatFeature: -- type: "rcvChatFeature" -- feature: [ChatFeature](#chatfeature) -- enabled: [PrefEnabled](#prefenabled) -- param: int? - -SndChatFeature: -- type: "sndChatFeature" -- feature: [ChatFeature](#chatfeature) -- enabled: [PrefEnabled](#prefenabled) -- param: int? - -RcvChatPreference: -- type: "rcvChatPreference" -- feature: [ChatFeature](#chatfeature) -- allowed: [FeatureAllowed](#featureallowed) -- param: int? - -SndChatPreference: -- type: "sndChatPreference" -- feature: [ChatFeature](#chatfeature) -- allowed: [FeatureAllowed](#featureallowed) -- param: int? - -RcvGroupFeature: -- type: "rcvGroupFeature" -- groupFeature: [GroupFeature](#groupfeature) -- preference: [GroupPreference](#grouppreference) -- param: int? -- memberRole_: [GroupMemberRole](#groupmemberrole)? - -SndGroupFeature: -- type: "sndGroupFeature" -- groupFeature: [GroupFeature](#groupfeature) -- preference: [GroupPreference](#grouppreference) -- param: int? -- memberRole_: [GroupMemberRole](#groupmemberrole)? - -RcvChatFeatureRejected: -- type: "rcvChatFeatureRejected" -- feature: [ChatFeature](#chatfeature) - -RcvGroupFeatureRejected: -- type: "rcvGroupFeatureRejected" -- groupFeature: [GroupFeature](#groupfeature) - -SndModerated: -- type: "sndModerated" - -RcvModerated: -- type: "rcvModerated" - -RcvBlocked: -- type: "rcvBlocked" - -SndDirectE2EEInfo: -- type: "sndDirectE2EEInfo" -- e2eeInfo: [E2EInfo](#e2einfo) - -RcvDirectE2EEInfo: -- type: "rcvDirectE2EEInfo" -- e2eeInfo: [E2EInfo](#e2einfo) - -SndGroupE2EEInfo: -- type: "sndGroupE2EEInfo" -- e2eeInfo: [E2EInfo](#e2einfo) - -RcvGroupE2EEInfo: -- type: "rcvGroupE2EEInfo" -- e2eeInfo: [E2EInfo](#e2einfo) - -ChatBanner: -- type: "chatBanner" - - ---- - -## CIDeleteMode - -**Enum type**: -- "broadcast" -- "internal" -- "internalMark" -- "history" - - ---- - -## CIDeleted - -**Discriminated union type**: - -Deleted: -- type: "deleted" -- deletedTs: UTCTime? -- chatType: [ChatType](#chattype) - -Blocked: -- type: "blocked" -- deletedTs: UTCTime? - -BlockedByAdmin: -- type: "blockedByAdmin" -- deletedTs: UTCTime? - -Moderated: -- type: "moderated" -- deletedTs: UTCTime? -- byGroupMember: [GroupMember](#groupmember) - - ---- - -## CIDirection - -**Discriminated union type**: - -DirectSnd: -- type: "directSnd" - -DirectRcv: -- type: "directRcv" - -GroupSnd: -- type: "groupSnd" - -GroupRcv: -- type: "groupRcv" -- groupMember: [GroupMember](#groupmember) - -ChannelRcv: -- type: "channelRcv" - -LocalSnd: -- type: "localSnd" - -LocalRcv: -- type: "localRcv" - - ---- - -## CIFile - -**Record type**: -- fileId: int64 -- fileName: string -- fileSize: int64 -- fileSource: [CryptoFile](#cryptofile)? -- fileStatus: [CIFileStatus](#cifilestatus) -- fileProtocol: [FileProtocol](#fileprotocol) -- fileExpires: UTCTime? -- fileProhibited: [FileProhibited](#fileprohibited)? - - ---- - -## CIFileStatus - -**Discriminated union type**: - -SndStored: -- type: "sndStored" - -SndTransfer: -- type: "sndTransfer" -- sndProgress: int64 -- sndTotal: int64 - -SndCancelled: -- type: "sndCancelled" - -SndComplete: -- type: "sndComplete" - -SndError: -- type: "sndError" -- sndFileError: [FileError](#fileerror) - -SndWarning: -- type: "sndWarning" -- sndFileError: [FileError](#fileerror) - -RcvInvitation: -- type: "rcvInvitation" - -RcvAccepted: -- type: "rcvAccepted" - -RcvTransfer: -- type: "rcvTransfer" -- rcvProgress: int64 -- rcvTotal: int64 - -RcvAborted: -- type: "rcvAborted" - -RcvComplete: -- type: "rcvComplete" - -RcvCancelled: -- type: "rcvCancelled" - -RcvError: -- type: "rcvError" -- rcvFileError: [FileError](#fileerror) - -RcvWarning: -- type: "rcvWarning" -- rcvFileError: [FileError](#fileerror) - -Invalid: -- type: "invalid" -- text: string - - ---- - -## CIForwardedFrom - -**Discriminated union type**: - -Unknown: -- type: "unknown" - -Contact: -- type: "contact" -- chatName: string -- msgDir: [MsgDirection](#msgdirection) -- contactId: int64? -- chatItemId: int64? - -Group: -- type: "group" -- chatName: string -- msgDir: [MsgDirection](#msgdirection) -- groupId: int64? -- chatItemId: int64? -- memberId: string? -- sharedMsgId_: string? -- groupType: [GroupType](#grouptype)? - -GroupLink: -- type: "groupLink" -- chatName: string -- msgDir: [MsgDirection](#msgdirection) -- groupLink: string -- publicGroupId: string -- memberId: string? -- sharedMsgId: string -- groupType: [GroupType](#grouptype)? - - ---- - -## CIGroupInvitation - -**Record type**: -- groupId: int64 -- groupMemberId: int64 -- localDisplayName: string -- groupProfile: [GroupProfile](#groupprofile) -- status: [CIGroupInvitationStatus](#cigroupinvitationstatus) - - ---- - -## CIGroupInvitationStatus - -**Enum type**: -- "pending" -- "accepted" -- "rejected" -- "expired" - - ---- - -## CIMention - -**Record type**: -- memberId: string -- memberRef: [CIMentionMember](#cimentionmember)? - - ---- - -## CIMentionMember - -**Record type**: -- groupMemberId: int64 -- displayName: string -- localAlias: string? -- memberRole: [GroupMemberRole](#groupmemberrole) - - ---- - -## CIMeta - -**Record type**: -- itemId: int64 -- itemTs: UTCTime -- itemText: string -- itemStatus: [CIStatus](#cistatus) -- sentViaProxy: bool? -- itemSharedMsgId: string? -- itemForwarded: [CIForwardedFrom](#ciforwardedfrom)? -- itemDeleted: [CIDeleted](#cideleted)? -- itemEdited: bool -- itemTimed: [CITimed](#citimed)? -- itemLive: bool? -- userMention: bool -- hasLink: bool -- deletable: bool -- editable: bool -- forwardedByMember: int64? -- showGroupAsSender: bool -- msgVerified: [MsgVerified](#msgverified)? -- createdAt: UTCTime -- updatedAt: UTCTime - - ---- - -## CIQuote - -**Record type**: -- chatDir: [CIDirection](#cidirection)? -- itemId: int64? -- sharedMsgId: string? -- sentAt: UTCTime -- content: [MsgContent](#msgcontent) -- formattedText: [[FormattedText](#formattedtext)]? - - ---- - -## CIReaction - -**Record type**: -- chatDir: [CIDirection](#cidirection) -- chatItem: [ChatItem](#chatitem) -- sentAt: UTCTime -- reaction: [MsgReaction](#msgreaction) - - ---- - -## CIReactionCount - -**Record type**: -- reaction: [MsgReaction](#msgreaction) -- userReacted: bool -- totalReacted: int - - ---- - -## CIStatus - -**Discriminated union type**: - -SndNew: -- type: "sndNew" - -SndSent: -- type: "sndSent" -- sndProgress: [SndCIStatusProgress](#sndcistatusprogress) - -SndRcvd: -- type: "sndRcvd" -- msgRcptStatus: [MsgReceiptStatus](#msgreceiptstatus) -- sndProgress: [SndCIStatusProgress](#sndcistatusprogress) - -SndErrorAuth: -- type: "sndErrorAuth" - -SndError: -- type: "sndError" -- agentError: [SndError](#snderror) - -SndWarning: -- type: "sndWarning" -- agentError: [SndError](#snderror) - -RcvNew: -- type: "rcvNew" - -RcvRead: -- type: "rcvRead" - -Invalid: -- type: "invalid" -- text: string - - ---- - -## CITimed - -**Record type**: -- ttl: int -- deleteAt: UTCTime? - - ---- - -## ChatBotCommand - -**Discriminated union type**: - -Command: -- type: "command" -- keyword: string -- label: string -- params: string? - -Menu: -- type: "menu" -- label: string -- commands: [[ChatBotCommand](#chatbotcommand)] - - ---- - -## ChatDeleteMode - -**Discriminated union type**: - -Full: -- type: "full" -- notify: bool - -Entity: -- type: "entity" -- notify: bool - -Messages: -- type: "messages" - -**Syntax**: - -``` -full|entity|messages[ notify=off] -``` - -```javascript -type + (type == 'messages' ? '' : (!notify ? ' notify=off' : '')) // JavaScript -``` - -```python -str(type) + ('' if str(type) == 'messages' else (' notify=off' if not notify else '')) # Python -``` - - ---- - -## ChatError - -**Discriminated union type**: - -Error: -- type: "error" -- errorType: [ChatErrorType](#chaterrortype) - -ErrorAgent: -- type: "errorAgent" -- agentError: [AgentErrorType](#agenterrortype) -- agentConnId: string -- connectionEntity_: [ConnectionEntity](#connectionentity)? - -ErrorStore: -- type: "errorStore" -- storeError: [StoreError](#storeerror) - - ---- - -## ChatErrorType - -**Discriminated union type**: - -NoActiveUser: -- type: "noActiveUser" - -NoConnectionUser: -- type: "noConnectionUser" -- agentConnId: string - -NoSndFileUser: -- type: "noSndFileUser" -- agentSndFileId: string - -NoRcvFileUser: -- type: "noRcvFileUser" -- agentRcvFileId: string - -UserUnknown: -- type: "userUnknown" - -UserExists: -- type: "userExists" -- contactName: string - -ChatRelayExists: -- type: "chatRelayExists" - -DifferentActiveUser: -- type: "differentActiveUser" -- commandUserId: int64 -- activeUserId: int64 - -CantDeleteActiveUser: -- type: "cantDeleteActiveUser" -- userId: int64 - -CantDeleteLastUser: -- type: "cantDeleteLastUser" -- userId: int64 - -CantHideLastUser: -- type: "cantHideLastUser" -- userId: int64 - -HiddenUserAlwaysMuted: -- type: "hiddenUserAlwaysMuted" -- userId: int64 - -EmptyUserPassword: -- type: "emptyUserPassword" -- userId: int64 - -UserAlreadyHidden: -- type: "userAlreadyHidden" -- userId: int64 - -UserNotHidden: -- type: "userNotHidden" -- userId: int64 - -InvalidDisplayName: -- type: "invalidDisplayName" -- displayName: string -- validName: string - -ChatNotStarted: -- type: "chatNotStarted" - -ChatNotStopped: -- type: "chatNotStopped" - -ChatStoreChanged: -- type: "chatStoreChanged" - -InvalidConnReq: -- type: "invalidConnReq" - -SimplexDomainNotReady: -- type: "simplexDomainNotReady" -- simplexDomain: [SimplexDomain](#simplexdomain) -- simplexDomainError: [SimplexDomainError](#simplexdomainerror) - -NotResolvedLocally: -- type: "notResolvedLocally" - -UnsupportedConnReq: -- type: "unsupportedConnReq" - -ConnReqMessageProhibited: -- type: "connReqMessageProhibited" - -ContactNotReady: -- type: "contactNotReady" -- contact: [Contact](#contact) - -ContactNotActive: -- type: "contactNotActive" -- contact: [Contact](#contact) - -ContactDisabled: -- type: "contactDisabled" -- contact: [Contact](#contact) - -ConnectionDisabled: -- type: "connectionDisabled" -- connection: [Connection](#connection) - -GroupUserRole: -- type: "groupUserRole" -- groupInfo: [GroupInfo](#groupinfo) -- requiredRole: [GroupMemberRole](#groupmemberrole) - -GroupMemberInitialRole: -- type: "groupMemberInitialRole" -- groupInfo: [GroupInfo](#groupinfo) -- initialRole: [GroupMemberRole](#groupmemberrole) - -ContactIncognitoCantInvite: -- type: "contactIncognitoCantInvite" - -GroupIncognitoCantInvite: -- type: "groupIncognitoCantInvite" - -GroupContactRole: -- type: "groupContactRole" -- contactName: string - -GroupDuplicateMember: -- type: "groupDuplicateMember" -- contactName: string - -GroupDuplicateMemberId: -- type: "groupDuplicateMemberId" - -GroupNotJoined: -- type: "groupNotJoined" -- groupInfo: [GroupInfo](#groupinfo) - -GroupMemberNotActive: -- type: "groupMemberNotActive" - -CantBlockMemberForSelf: -- type: "cantBlockMemberForSelf" -- groupInfo: [GroupInfo](#groupinfo) -- member: [GroupMember](#groupmember) -- setShowMessages: bool - -GroupMemberUserRemoved: -- type: "groupMemberUserRemoved" - -GroupMemberNotFound: -- type: "groupMemberNotFound" - -GroupCantResendInvitation: -- type: "groupCantResendInvitation" -- groupInfo: [GroupInfo](#groupinfo) -- contactName: string - -GroupInternal: -- type: "groupInternal" -- message: string - -FileNotFound: -- type: "fileNotFound" -- message: string - -FileSize: -- type: "fileSize" -- filePath: string - -FileAlreadyReceiving: -- type: "fileAlreadyReceiving" -- message: string - -FileCancelled: -- type: "fileCancelled" -- message: string - -FileCancel: -- type: "fileCancel" -- fileId: int64 -- message: string - -FileAlreadyExists: -- type: "fileAlreadyExists" -- filePath: string - -FileWrite: -- type: "fileWrite" -- filePath: string -- message: string - -FileSend: -- type: "fileSend" -- fileId: int64 -- agentError: [AgentErrorType](#agenterrortype) - -FileRcvChunk: -- type: "fileRcvChunk" -- message: string - -FileInternal: -- type: "fileInternal" -- message: string - -FileImageType: -- type: "fileImageType" -- filePath: string - -FileImageSize: -- type: "fileImageSize" -- filePath: string - -FileNotReceived: -- type: "fileNotReceived" -- fileId: int64 - -FileNotApproved: -- type: "fileNotApproved" -- fileId: int64 -- unknownServers: [string] - -FallbackToSMPProhibited: -- type: "fallbackToSMPProhibited" -- fileId: int64 - -InlineFileProhibited: -- type: "inlineFileProhibited" -- fileId: int64 - -InvalidForward: -- type: "invalidForward" - -InvalidChatItemUpdate: -- type: "invalidChatItemUpdate" - -InvalidChatItemDelete: -- type: "invalidChatItemDelete" - -HasCurrentCall: -- type: "hasCurrentCall" - -NoCurrentCall: -- type: "noCurrentCall" - -CallContact: -- type: "callContact" -- contactId: int64 - -DirectMessagesProhibited: -- type: "directMessagesProhibited" -- direction: [MsgDirection](#msgdirection) -- contact: [Contact](#contact) - -AgentVersion: -- type: "agentVersion" - -AgentNoSubResult: -- type: "agentNoSubResult" -- agentConnId: string - -CommandError: -- type: "commandError" -- message: string - -BadgeRedeemError: -- type: "badgeRedeemError" -- badgeRedeemError: [BadgeRedeemError](#badgeredeemerror) - -AgentCommandError: -- type: "agentCommandError" -- message: string - -InvalidFileDescription: -- type: "invalidFileDescription" -- message: string - -ConnectionIncognitoChangeProhibited: -- type: "connectionIncognitoChangeProhibited" - -ConnectionUserChangeProhibited: -- type: "connectionUserChangeProhibited" - -PeerChatVRangeIncompatible: -- type: "peerChatVRangeIncompatible" - -RelayTestError: -- type: "relayTestError" -- message: string - -InternalError: -- type: "internalError" -- message: string - -Exception: -- type: "exception" -- message: string - - ---- - -## ChatFeature - -**Enum type**: -- "timedMessages" -- "fullDelete" -- "reactions" -- "voice" -- "files" -- "calls" -- "sessions" - - ---- - -## ChatInfo - -**Discriminated union type**: - -Direct: -- type: "direct" -- contact: [Contact](#contact) - -Group: -- type: "group" -- groupInfo: [GroupInfo](#groupinfo) -- groupChatScope: [GroupChatScopeInfo](#groupchatscopeinfo)? - -Local: -- type: "local" -- noteFolder: [NoteFolder](#notefolder) - -ContactRequest: -- type: "contactRequest" -- contactRequest: [UserContactRequest](#usercontactrequest) - -ContactConnection: -- type: "contactConnection" -- contactConnection: [PendingContactConnection](#pendingcontactconnection) - - ---- - -## ChatItem - -**Record type**: -- chatDir: [CIDirection](#cidirection) -- meta: [CIMeta](#cimeta) -- content: [CIContent](#cicontent) -- mentions: {string : [CIMention](#cimention)} -- formattedText: [[FormattedText](#formattedtext)]? -- quotedItem: [CIQuote](#ciquote)? -- reactions: [[CIReactionCount](#cireactioncount)] -- file: [CIFile](#cifile)? - - ---- - -## ChatItemDeletion - -Message deletion result. - -**Record type**: -- deletedChatItem: [AChatItem](#achatitem) -- toChatItem: [AChatItem](#achatitem)? - - ---- - -## ChatListQuery - -**Discriminated union type**: - -Filters: -- type: "filters" -- favorite: bool -- unread: bool - -Search: -- type: "search" -- search: string - - ---- - -## ChatPeerType - -**Enum type**: -- "human" -- "bot" -- "business" - - ---- - -## ChatRef - -Used in API commands. Chat scope can only be passed with groups. - -**Record type**: -- chatType: [ChatType](#chattype) -- chatId: int64 -- chatScope: [GroupChatScope](#groupchatscope)? - -**Syntax**: - -``` -[] -``` - -```javascript -ChatType.cmdString(chatType) + chatId + (chatScope ? GroupChatScope.cmdString(chatScope) : '') // JavaScript -``` - -```python -ChatType_cmd_string(chatType) + str(chatId) + ((GroupChatScope_cmd_string(chatScope)) if chatScope is not None else '') # Python -``` - - ---- - -## ChatSettings - -**Record type**: -- enableNtfs: [MsgFilter](#msgfilter) -- sendRcpts: bool? -- favorite: bool - - ---- - -## ChatStats - -**Record type**: -- unreadCount: int -- unreadMentions: int -- reportsCount: int -- minUnreadItemId: int64 -- unreadChat: bool - - ---- - -## ChatType - -**Enum type**: -- "direct" -- "group" -- "local" - -**Syntax**: - -``` -@|#|*| -``` - -```javascript -self == 'direct' ? '@' : self == 'group' ? '#' : self == 'local' ? '*' : '' // JavaScript -``` - -```python -'@' if str(self) == 'direct' else '#' if str(self) == 'group' else '*' if str(self) == 'local' else '' # Python -``` - - ---- - -## ChatWallpaper - -**Record type**: -- preset: string? -- imageFile: string? -- background: string? -- tint: string? -- scaleType: [ChatWallpaperScale](#chatwallpaperscale)? -- scale: double? - - ---- - -## ChatWallpaperScale - -**Enum type**: -- "fill" -- "fit" -- "repeat" - - ---- - -## ClientNotice - -**Record type**: -- ttl: int64? - - ---- - -## Color - -**Enum type**: -- "black" -- "red" -- "green" -- "yellow" -- "blue" -- "magenta" -- "cyan" -- "white" - - ---- - -## CommandError - -**Discriminated union type**: - -UNKNOWN: -- type: "UNKNOWN" - -SYNTAX: -- type: "SYNTAX" - -PROHIBITED: -- type: "PROHIBITED" - -NO_AUTH: -- type: "NO_AUTH" - -HAS_AUTH: -- type: "HAS_AUTH" - -NO_ENTITY: -- type: "NO_ENTITY" - - ---- - -## CommandErrorType - -**Discriminated union type**: - -PROHIBITED: -- type: "PROHIBITED" - -SYNTAX: -- type: "SYNTAX" - -NO_CONN: -- type: "NO_CONN" - -SIZE: -- type: "SIZE" - -LARGE: -- type: "LARGE" - - ---- - -## CommentsGroupPreference - -**Record type**: -- enable: [GroupFeatureEnabled](#groupfeatureenabled) -- duration: int? - - ---- - -## ComposedMessage - -**Record type**: -- fileSource: [CryptoFile](#cryptofile)? -- quotedItemId: int64? -- msgContent: [MsgContent](#msgcontent) -- mentions: {string : int64} - - ---- - -## ConnStatus - -**Discriminated union type**: - -New: -- type: "new" - -Prepared: -- type: "prepared" - -Joined: -- type: "joined" - -Requested: -- type: "requested" - -Accepted: -- type: "accepted" - -SndReady: -- type: "sndReady" - -Ready: -- type: "ready" - -Deleted: -- type: "deleted" - -Failed: -- type: "failed" -- connError: string - - ---- - -## ConnType - -**Enum type**: -- "contact" -- "member" -- "user_contact" - - ---- - -## Connection - -**Record type**: -- connId: int64 -- agentConnId: string -- connChatVersion: int -- peerChatVRange: [VersionRange](#versionrange) -- connLevel: int -- viaContact: int64? -- viaUserContactLink: int64? -- viaGroupLink: bool -- groupLinkId: string? -- xContactId: string? -- customUserProfileId: int64? -- connType: [ConnType](#conntype) -- connStatus: [ConnStatus](#connstatus) -- contactConnInitiated: bool -- localAlias: string -- entityId: int64? -- connectionCode: [SecurityCode](#securitycode)? -- pqSupport: bool -- pqEncryption: bool -- pqSndEnabled: bool? -- pqRcvEnabled: bool? -- authErrCounter: int -- quotaErrCounter: int -- createdAt: UTCTime - - ---- - -## ConnectionEntity - -**Discriminated union type**: - -RcvDirectMsgConnection: -- type: "rcvDirectMsgConnection" -- entityConnection: [Connection](#connection) -- contact: [Contact](#contact)? - -RcvGroupMsgConnection: -- type: "rcvGroupMsgConnection" -- entityConnection: [Connection](#connection) -- groupInfo: [GroupInfo](#groupinfo) -- groupMember: [GroupMember](#groupmember) - -UserContactConnection: -- type: "userContactConnection" -- entityConnection: [Connection](#connection) -- userContact: [UserContact](#usercontact) - - ---- - -## ConnectionErrorType - -**Discriminated union type**: - -NOT_FOUND: -- type: "NOT_FOUND" - -DUPLICATE: -- type: "DUPLICATE" - -SIMPLEX: -- type: "SIMPLEX" - -NOT_ACCEPTED: -- type: "NOT_ACCEPTED" - -NOT_AVAILABLE: -- type: "NOT_AVAILABLE" - - ---- - -## ConnectionMode - -**Enum type**: -- "inv" -- "con" - - ---- - -## ConnectionPlan - -**Discriminated union type**: - -InvitationLink: -- type: "invitationLink" -- invitationLinkPlan: [InvitationLinkPlan](#invitationlinkplan) - -ContactAddress: -- type: "contactAddress" -- contactAddressPlan: [ContactAddressPlan](#contactaddressplan) - -GroupLink: -- type: "groupLink" -- groupLinkPlan: [GroupLinkPlan](#grouplinkplan) - -Error: -- type: "error" -- chatError: [ChatError](#chaterror) - - ---- - -## Contact - -**Record type**: -- contactId: int64 -- localDisplayName: string -- profile: [LocalProfile](#localprofile) -- activeConn: [Connection](#connection)? -- contactUsed: bool -- contactStatus: [ContactStatus](#contactstatus) -- chatSettings: [ChatSettings](#chatsettings) -- userPreferences: [Preferences](#preferences) -- mergedPreferences: [ContactUserPreferences](#contactuserpreferences) -- createdAt: UTCTime -- updatedAt: UTCTime -- chatTs: UTCTime? -- preparedContact: [PreparedContact](#preparedcontact)? -- contactRequestId: int64? -- contactRequest: [UserContactRequestRef](#usercontactrequestref)? -- contactGroupMemberId: int64? -- contactGrpInvSent: bool -- groupDirectInv: [GroupDirectInvitation](#groupdirectinvitation)? -- chatTags: [int64] -- chatItemTTL: int64? -- uiThemes: [UIThemeEntityOverrides](#uithemeentityoverrides)? -- chatDeleted: bool -- customData: JSONObject? - - ---- - -## ContactAddressPlan - -**Discriminated union type**: - -Ok: -- type: "ok" -- contactSLinkData_: [ContactShortLinkData](#contactshortlinkdata)? -- ownerVerification: [OwnerVerification](#ownerverification)? - -OwnLink: -- type: "ownLink" - -ConnectingConfirmReconnect: -- type: "connectingConfirmReconnect" - -ConnectingProhibit: -- type: "connectingProhibit" -- contact: [Contact](#contact) - -Known: -- type: "known" -- contact: [Contact](#contact) - -ContactViaAddress: -- type: "contactViaAddress" -- contact: [Contact](#contact) - - ---- - -## ContactShortLinkData - -**Record type**: -- profile: [Profile](#profile) -- message: [MsgContent](#msgcontent)? -- business: bool -- localBadge: [LocalBadge](#localbadge)? - - ---- - -## ContactStatus - -**Enum type**: -- "active" -- "deleted" -- "deletedByUser" -- "rejected" - - ---- - -## ContactUserPref - -**Discriminated union type**: - -Contact: -- type: "contact" -- preference: [SimplePreference](#simplepreference) - -User: -- type: "user" -- preference: [SimplePreference](#simplepreference) - - ---- - -## ContactUserPreference - -**Record type**: -- enabled: [PrefEnabled](#prefenabled) -- userPreference: [ContactUserPref](#contactuserpref) -- contactPreference: [SimplePreference](#simplepreference) - - ---- - -## ContactUserPreferences - -**Record type**: -- timedMessages: [ContactUserPreference](#contactuserpreference) -- fullDelete: [ContactUserPreference](#contactuserpreference) -- reactions: [ContactUserPreference](#contactuserpreference) -- voice: [ContactUserPreference](#contactuserpreference) -- files: [ContactUserPreference](#contactuserpreference) -- calls: [ContactUserPreference](#contactuserpreference) -- sessions: [ContactUserPreference](#contactuserpreference) -- commands: [[ChatBotCommand](#chatbotcommand)]? - - ---- - -## CreatedConnLink - -**Record type**: -- connFullLink: string -- connShortLink: string? - -**Syntax**: - -``` -[ ] -``` - -```javascript -connFullLink + (connShortLink ? ' ' + connShortLink : '') // JavaScript -``` - -```python -connFullLink + ((' ' + connShortLink) if connShortLink is not None else '') # Python -``` - - ---- - -## CryptoFile - -**Record type**: -- filePath: string -- cryptoArgs: [CryptoFileArgs](#cryptofileargs)? - - ---- - -## CryptoFileArgs - -**Record type**: -- fileKey: string -- fileNonce: string - - ---- - -## CtrlAppInfo - -Remote controller application info. - -**Record type**: -- appVersionRange: [AppVersionRange](#appversionrange) -- deviceName: string -- compression: bool - - ---- - -## DroppedMsg - -**Record type**: -- brokerTs: UTCTime -- attempts: int - - ---- - -## E2EInfo - -**Record type**: -- public: bool? -- pqEnabled: bool? - - ---- - -## ErrorType - -**Discriminated union type**: - -BLOCK: -- type: "BLOCK" - -SESSION: -- type: "SESSION" - -CMD: -- type: "CMD" -- cmdErr: [CommandError](#commanderror) - -PROXY: -- type: "PROXY" -- proxyErr: [ProxyError](#proxyerror) - -AUTH: -- type: "AUTH" - -BLOCKED: -- type: "BLOCKED" -- blockInfo: [BlockingInfo](#blockinginfo) - -SERVICE: -- type: "SERVICE" - -CRYPTO: -- type: "CRYPTO" - -QUOTA: -- type: "QUOTA" - -STORE: -- type: "STORE" -- storeErr: string - -NO_MSG: -- type: "NO_MSG" - -LARGE_MSG: -- type: "LARGE_MSG" - -EXPIRED: -- type: "EXPIRED" - -INTERNAL: -- type: "INTERNAL" - -NAME: -- type: "NAME" -- nameErr: [NameErrorType](#nameerrortype) - -DUPLICATE_: -- type: "DUPLICATE_" - - ---- - -## FeatureAllowed - -**Enum type**: -- "always" -- "yes" -- "no" - - ---- - -## FileDescr - -**Record type**: -- fileDescrText: string -- fileDescrPartNo: int -- fileDescrComplete: bool - - ---- - -## FileError - -**Discriminated union type**: - -Auth: -- type: "auth" - -Blocked: -- type: "blocked" -- server: string -- blockInfo: [BlockingInfo](#blockinginfo) - -NoFile: -- type: "noFile" - -Relay: -- type: "relay" -- srvError: [SrvError](#srverror) - -Other: -- type: "other" -- fileError: string - - ---- - -## FileErrorType - -**Discriminated union type**: - -NOT_APPROVED: -- type: "NOT_APPROVED" - -SIZE: -- type: "SIZE" - -REDIRECT: -- type: "REDIRECT" -- redirectError: string - -FILE_IO: -- type: "FILE_IO" -- fileIOError: string - -NO_FILE: -- type: "NO_FILE" - - ---- - -## FileInvitation - -**Record type**: -- fileName: string -- fileSize: int64 -- fileDigest: string? -- fileConnReq: string? -- fileInline: [InlineFileMode](#inlinefilemode)? -- fileDescr: [FileDescr](#filedescr)? -- fileBadge: [BadgeProof](#badgeproof)? - - ---- - -## FileProhibited - -**Record type**: -- maxSize: int64 -- badgeStatus: [BadgeStatus](#badgestatus)? - - ---- - -## FileProtocol - -**Enum type**: -- "smp" -- "xftp" -- "local" - - ---- - -## FileStatus - -**Enum type**: -- "new" -- "accepted" -- "connected" -- "complete" -- "cancelled" - - ---- - -## FileTransferMeta - -**Record type**: -- fileId: int64 -- xftpSndFile: [XFTPSndFile](#xftpsndfile)? -- xftpRedirectFor: int64? -- fileName: string -- filePath: string -- fileSize: int64 -- fileInline: [InlineFileMode](#inlinefilemode)? -- chunkSize: int64 -- cancelled: bool - - ---- - -## FileType - -**Enum type**: -- "normal" -- "roster" - - ---- - -## Format - -**Discriminated union type**: - -Bold: -- type: "bold" - -Italic: -- type: "italic" - -StrikeThrough: -- type: "strikeThrough" - -Snippet: -- type: "snippet" - -Secret: -- type: "secret" - -Small: -- type: "small" - -Colored: -- type: "colored" -- color: [Color](#color) - -Uri: -- type: "uri" - -HyperLink: -- type: "hyperLink" -- showText: string? -- linkUri: string - -SimplexLink: -- type: "simplexLink" -- showText: string? -- linkType: [SimplexLinkType](#simplexlinktype) -- simplexUri: string -- smpHosts: [string] - -SimplexName: -- type: "simplexName" -- nameInfo: [SimplexNameInfo](#simplexnameinfo) - -Command: -- type: "command" -- commandStr: string - -Mention: -- type: "mention" -- memberName: string - -Email: -- type: "email" - -Phone: -- type: "phone" - - ---- - -## FormattedText - -**Record type**: -- format: [Format](#format)? -- text: string - - ---- - -## FullGroupPreferences - -**Record type**: -- timedMessages: [TimedMessagesGroupPreference](#timedmessagesgrouppreference) -- directMessages: [RoleGroupPreference](#rolegrouppreference) -- fullDelete: [GroupPreference](#grouppreference) -- reactions: [GroupPreference](#grouppreference) -- voice: [RoleGroupPreference](#rolegrouppreference) -- files: [RoleGroupPreference](#rolegrouppreference) -- simplexLinks: [RoleGroupPreference](#rolegrouppreference) -- reports: [GroupPreference](#grouppreference) -- history: [GroupPreference](#grouppreference) -- support: [SupportGroupPreference](#supportgrouppreference) -- sessions: [RoleGroupPreference](#rolegrouppreference) -- comments: [CommentsGroupPreference](#commentsgrouppreference) -- signMessages: [GroupPreference](#grouppreference) -- commands: [[ChatBotCommand](#chatbotcommand)] - - ---- - -## FullPreferences - -**Record type**: -- timedMessages: [TimedMessagesPreference](#timedmessagespreference) -- fullDelete: [SimplePreference](#simplepreference) -- reactions: [SimplePreference](#simplepreference) -- voice: [SimplePreference](#simplepreference) -- files: [SimplePreference](#simplepreference) -- calls: [SimplePreference](#simplepreference) -- sessions: [SimplePreference](#simplepreference) -- commands: [[ChatBotCommand](#chatbotcommand)] - - ---- - -## Group - -**Record type**: -- groupInfo: [GroupInfo](#groupinfo) -- members: [[GroupMember](#groupmember)] - - ---- - -## GroupChatScope - -**Discriminated union type**: - -MemberSupport: -- type: "memberSupport" -- groupMemberId_: int64? - -**Syntax**: - -``` -(_support[:]) -``` - -```javascript -'(_support' + (groupMemberId_ ? ':' + groupMemberId_ : '') + ')' // JavaScript -``` - -```python -'(_support' + ((':' + str(groupMemberId_)) if groupMemberId_ is not None else '') + ')' # Python -``` - - ---- - -## GroupChatScopeInfo - -**Discriminated union type**: - -MemberSupport: -- type: "memberSupport" -- groupMember_: [GroupMember](#groupmember)? - - ---- - -## GroupDirectInvitation - -**Record type**: -- groupDirectInvLink: string -- fromGroupId_: int64? -- fromGroupMemberId_: int64? -- fromGroupMemberConnId_: int64? -- groupDirectInvStartedConnection: bool - - ---- - -## GroupFeature - -**Enum type**: -- "timedMessages" -- "directMessages" -- "fullDelete" -- "reactions" -- "voice" -- "files" -- "simplexLinks" -- "reports" -- "history" -- "support" -- "sessions" -- "comments" -- "signMessages" - - ---- - -## GroupFeatureEnabled - -**Enum type**: -- "on" -- "off" - - ---- - -## GroupInfo - -**Record type**: -- groupId: int64 -- useRelays: bool -- relayOwnStatus: [RelayStatus](#relaystatus)? -- localDisplayName: string -- groupProfile: [GroupProfile](#groupprofile) -- localAlias: string -- businessChat: [BusinessChatInfo](#businesschatinfo)? -- fullGroupPreferences: [FullGroupPreferences](#fullgrouppreferences) -- membership: [GroupMember](#groupmember) -- chatSettings: [ChatSettings](#chatsettings) -- createdAt: UTCTime -- updatedAt: UTCTime -- chatTs: UTCTime? -- userMemberProfileSentAt: UTCTime? -- preparedGroup: [PreparedGroup](#preparedgroup)? -- chatTags: [int64] -- chatItemTTL: int64? -- uiThemes: [UIThemeEntityOverrides](#uithemeentityoverrides)? -- customData: JSONObject? -- groupSummary: [GroupSummary](#groupsummary) -- rosterVersion: int64? -- membersRequireAttention: int -- viaGroupLinkUri: string? -- groupDomainVerified: bool? - - ---- - -## GroupLink - -**Record type**: -- userContactLinkId: int64 -- connLinkContact: [CreatedConnLink](#createdconnlink) -- shortLinkDataSet: bool -- shortLinkLargeDataSet: bool -- groupLinkId: string -- acceptMemberRole: [GroupMemberRole](#groupmemberrole) - - ---- - -## GroupLinkOwner - -**Record type**: -- memberId: string -- memberKey: string - - ---- - -## GroupLinkPlan - -**Discriminated union type**: - -Ok: -- type: "ok" -- groupSLinkInfo_: [GroupShortLinkInfo](#groupshortlinkinfo)? -- groupSLinkData_: [GroupShortLinkData](#groupshortlinkdata)? -- ownerVerification: [OwnerVerification](#ownerverification)? - -OwnLink: -- type: "ownLink" -- groupInfo: [GroupInfo](#groupinfo) - -ConnectingConfirmReconnect: -- type: "connectingConfirmReconnect" - -ConnectingProhibit: -- type: "connectingProhibit" -- groupInfo_: [GroupInfo](#groupinfo)? - -Known: -- type: "known" -- groupInfo: [GroupInfo](#groupinfo) -- groupUpdated: bool -- ownerVerification: [OwnerVerification](#ownerverification)? -- linkOwners: [[GroupLinkOwner](#grouplinkowner)] - -NoRelays: -- type: "noRelays" -- groupSLinkData_: [GroupShortLinkData](#groupshortlinkdata)? - -UpdateRequired: -- type: "updateRequired" -- groupSLinkData_: [GroupShortLinkData](#groupshortlinkdata)? - - ---- - -## GroupMember - -**Record type**: -- groupMemberId: int64 -- groupId: int64 -- indexInGroup: int64 -- memberId: string -- memberRole: [GroupMemberRole](#groupmemberrole) -- memberCategory: [GroupMemberCategory](#groupmembercategory) -- memberStatus: [GroupMemberStatus](#groupmemberstatus) -- memberSettings: [GroupMemberSettings](#groupmembersettings) -- blockedByAdmin: bool -- invitedBy: [InvitedBy](#invitedby) -- invitedByGroupMemberId: int64? -- localDisplayName: string -- memberProfile: [LocalProfile](#localprofile) -- memberContactId: int64? -- memberContactProfileId: int64 -- activeConn: [Connection](#connection)? -- memberChatVRange: [VersionRange](#versionrange) -- createdAt: UTCTime -- updatedAt: UTCTime -- supportChat: [GroupSupportChat](#groupsupportchat)? -- memberPubKey: string? -- relayLink: string? -- memberVerifiedCode: [SecurityCode](#securitycode)? - - ---- - -## GroupMemberAdmission - -**Record type**: -- review: [MemberCriteria](#membercriteria)? - - ---- - -## GroupMemberCategory - -**Enum type**: -- "user" -- "invitee" -- "host" -- "pre" -- "post" - - ---- - -## GroupMemberRef - -**Record type**: -- groupMemberId: int64 -- profile: [Profile](#profile) - - ---- - -## GroupMemberRole - -**Enum type**: -- "relay" -- "observer" -- "author" -- "member" -- "moderator" -- "admin" -- "owner" - - ---- - -## GroupMemberSettings - -**Record type**: -- showMessages: bool - - ---- - -## GroupMemberStatus - -**Enum type**: -- "rejected" -- "removed" -- "left" -- "deleted" -- "unknown" -- "invited" -- "pending_approval" -- "pending_review" -- "introduced" -- "intro-inv" -- "accepted" -- "announced" -- "connected" -- "complete" -- "creator" - - ---- - -## GroupPreference - -**Record type**: -- enable: [GroupFeatureEnabled](#groupfeatureenabled) - - ---- - -## GroupPreferences - -**Record type**: -- timedMessages: [TimedMessagesGroupPreference](#timedmessagesgrouppreference)? -- directMessages: [RoleGroupPreference](#rolegrouppreference)? -- fullDelete: [GroupPreference](#grouppreference)? -- reactions: [GroupPreference](#grouppreference)? -- voice: [RoleGroupPreference](#rolegrouppreference)? -- files: [RoleGroupPreference](#rolegrouppreference)? -- simplexLinks: [RoleGroupPreference](#rolegrouppreference)? -- reports: [GroupPreference](#grouppreference)? -- history: [GroupPreference](#grouppreference)? -- support: [SupportGroupPreference](#supportgrouppreference)? -- sessions: [RoleGroupPreference](#rolegrouppreference)? -- comments: [CommentsGroupPreference](#commentsgrouppreference)? -- signMessages: [GroupPreference](#grouppreference)? -- commands: [[ChatBotCommand](#chatbotcommand)]? - - ---- - -## GroupProfile - -**Record type**: -- displayName: string -- fullName: string -- shortDescr: string? -- description: string? -- image: string? -- publicGroup: [PublicGroupProfile](#publicgroupprofile)? -- groupPreferences: [GroupPreferences](#grouppreferences)? -- memberAdmission: [GroupMemberAdmission](#groupmemberadmission)? - - ---- - -## GroupRelay - -**Record type**: -- groupRelayId: int64 -- groupMemberId: int64 -- userChatRelay: [UserChatRelay](#userchatrelay) -- relayStatus: [RelayStatus](#relaystatus) -- relayLink: string? -- relayCap: [RelayCapabilities](#relaycapabilities) - - ---- - -## GroupShortLinkData - -**Record type**: -- groupProfile: [GroupProfile](#groupprofile) -- publicGroupData: [PublicGroupData](#publicgroupdata)? - - ---- - -## GroupShortLinkInfo - -**Record type**: -- direct: bool -- groupRelays: [string] -- publicGroupId: string? - - ---- - -## GroupSummary - -**Record type**: -- currentMembers: int64 -- publicMemberCount: int64? - - ---- - -## GroupSupportChat - -**Record type**: -- chatTs: UTCTime -- unread: int64 -- memberAttention: int64 -- mentions: int64 -- lastMsgFromMemberTs: UTCTime? - - ---- - -## GroupType - -**Enum type**: -- "channel" -- "group" - - ---- - -## HandshakeError - -**Enum type**: -- "PARSE" -- "IDENTITY" -- "BAD_AUTH" -- "BAD_SERVICE" - - ---- - -## InlineFileMode - -**Enum type**: -- "offer" -- "sent" - - ---- - -## InvitationLinkPlan - -**Discriminated union type**: - -Ok: -- type: "ok" -- contactSLinkData_: [ContactShortLinkData](#contactshortlinkdata)? -- ownerVerification: [OwnerVerification](#ownerverification)? - -OwnLink: -- type: "ownLink" - -Connecting: -- type: "connecting" -- contact_: [Contact](#contact)? - -Known: -- type: "known" -- contact: [Contact](#contact) - - ---- - -## InvitedBy - -**Discriminated union type**: - -Contact: -- type: "contact" -- byContactId: int64 - -User: -- type: "user" - -Unknown: -- type: "unknown" - - ---- - -## LinkContent - -**Discriminated union type**: - -Page: -- type: "page" - -Image: -- type: "image" - -Video: -- type: "video" -- duration: int? - -Unknown: -- type: "unknown" -- tag: string -- json: JSONObject - - ---- - -## LinkOwnerSig - -**Record type**: -- ownerId: string? -- chatBinding: string -- ownerSig: string - - ---- - -## LinkPreview - -**Record type**: -- uri: string -- title: string -- description: string -- image: string -- content: [LinkContent](#linkcontent)? - - ---- - -## LocalBadge - -**Record type**: -- badge: [BadgeInfo](#badgeinfo) -- status: [BadgeStatus](#badgestatus) - - ---- - -## LocalProfile - -**Record type**: -- profileId: int64 -- displayName: string -- fullName: string -- shortDescr: string? -- description: string? -- image: string? -- contactLink: string? -- preferences: [Preferences](#preferences)? -- peerType: [ChatPeerType](#chatpeertype)? -- localBadge: [LocalBadge](#localbadge)? -- localAlias: string -- contactDomain: [SimplexDomainClaim](#simplexdomainclaim)? -- contactDomainVerified: bool? - - ---- - -## MemberCriteria - -**Enum type**: -- "all" - - ---- - -## MsgChatLink - -Connection link sent in a message - only short links are allowed. - -**Discriminated union type**: - -Contact: -- type: "contact" -- connLink: string -- profile: [Profile](#profile) -- business: bool - -Invitation: -- type: "invitation" -- invLink: string -- profile: [Profile](#profile) - -Group: -- type: "group" -- connLink: string -- groupProfile: [GroupProfile](#groupprofile) - - ---- - -## MsgContent - -**Discriminated union type**: - -Text: -- type: "text" -- text: string - -Link: -- type: "link" -- text: string -- preview: [LinkPreview](#linkpreview) - -Image: -- type: "image" -- text: string -- image: string - -Video: -- type: "video" -- text: string -- image: string -- duration: int - -Voice: -- type: "voice" -- text: string -- duration: int - -File: -- type: "file" -- text: string - -Report: -- type: "report" -- text: string -- reason: [ReportReason](#reportreason) - -Chat: -- type: "chat" -- text: string -- chatLink: [MsgChatLink](#msgchatlink) -- ownerSig: [LinkOwnerSig](#linkownersig)? - -Unknown: -- type: "unknown" -- tag: string -- text: string -- json: JSONObject - - ---- - -## MsgDecryptError - -**Enum type**: -- "ratchetHeader" -- "tooManySkipped" -- "ratchetEarlier" -- "other" -- "ratchetSync" - - ---- - -## MsgDirection - -**Enum type**: -- "rcv" -- "snd" - - ---- - -## MsgErrorType - -**Discriminated union type**: - -MsgSkipped: -- type: "msgSkipped" -- fromMsgId: int64 -- toMsgId: int64 - -MsgBadId: -- type: "msgBadId" -- msgId: int64 - -MsgBadHash: -- type: "msgBadHash" - -MsgDuplicate: -- type: "msgDuplicate" - - ---- - -## MsgFilter - -**Enum type**: -- "none" -- "all" -- "mentions" - - ---- - -## MsgReaction - -**Discriminated union type**: - -Emoji: -- type: "emoji" -- emoji: string - -Unknown: -- type: "unknown" -- tag: string -- json: JSONObject - - ---- - -## MsgReceiptStatus - -**Enum type**: -- "ok" -- "badMsgHash" - - ---- - -## MsgSigStatus - -**Enum type**: -- "verified" -- "signedNoKey" - - ---- - -## MsgVerified - -**Discriminated union type**: - -Signed: -- type: "signed" -- sigStatus: [MsgSigStatus](#msgsigstatus) - -SigMissing: -- type: "sigMissing" - - ---- - -## NameErrorType - -**Discriminated union type**: - -NO_RESOLVER: -- type: "NO_RESOLVER" - -NOT_FOUND: -- type: "NOT_FOUND" - -RESOLVER: -- type: "RESOLVER" -- resolverErr: string - - ---- - -## NetworkError - -**Discriminated union type**: - -ConnectError: -- type: "connectError" -- connectError: string - -TLSError: -- type: "tLSError" -- tlsError: string - -UnknownCAError: -- type: "unknownCAError" - -FailedError: -- type: "failedError" - -TimeoutError: -- type: "timeoutError" - -SubscribeError: -- type: "subscribeError" -- subscribeError: string - - ---- - -## NewUser - -**Record type**: -- profile: [Profile](#profile)? -- pastTimestamp: bool -- userChatRelay: bool -- clientService: bool - - ---- - -## NoteFolder - -**Record type**: -- noteFolderId: int64 -- userId: int64 -- createdAt: UTCTime -- updatedAt: UTCTime -- chatTs: UTCTime -- favorite: bool -- unread: bool - - ---- - -## OwnerVerification - -**Discriminated union type**: - -Verified: -- type: "verified" - -Failed: -- type: "failed" -- reason: string - - ---- - -## PaginationByTime - -**Discriminated union type**: - -Last: -- type: "last" -- count: int - -**Syntax**: - -``` -count= -``` - -```javascript -'count=' + count // JavaScript -``` - -```python -'count=' + str(count) # Python -``` - - ---- - -## PendingContactConnection - -**Record type**: -- pccConnId: int64 -- pccAgentConnId: string -- pccConnStatus: [ConnStatus](#connstatus) -- viaContactUri: bool -- viaUserContactLink: int64? -- groupLinkId: string? -- customUserProfileId: int64? -- connLinkInv: [CreatedConnLink](#createdconnlink)? -- localAlias: string -- createdAt: UTCTime -- updatedAt: UTCTime - - ---- - -## PlanResolveMode - -**Enum type**: -- "allGroups" -- "unknown" -- "never" - - ---- - -## PrefEnabled - -**Record type**: -- forUser: bool -- forContact: bool - - ---- - -## Preferences - -**Record type**: -- timedMessages: [TimedMessagesPreference](#timedmessagespreference)? -- fullDelete: [SimplePreference](#simplepreference)? -- reactions: [SimplePreference](#simplepreference)? -- voice: [SimplePreference](#simplepreference)? -- files: [SimplePreference](#simplepreference)? -- calls: [SimplePreference](#simplepreference)? -- sessions: [SimplePreference](#simplepreference)? -- commands: [[ChatBotCommand](#chatbotcommand)]? - - ---- - -## PreparedContact - -**Record type**: -- connLinkToConnect: [CreatedConnLink](#createdconnlink) -- uiConnLinkType: [ConnectionMode](#connectionmode) -- welcomeSharedMsgId: string? -- requestSharedMsgId: string? - - ---- - -## PreparedGroup - -**Record type**: -- connLinkToConnect: [CreatedConnLink](#createdconnlink) -- connLinkPreparedConnection: bool -- connLinkStartedConnection: bool -- welcomeSharedMsgId: string? -- requestSharedMsgId: string? - - ---- - -## Profile - -**Record type**: -- displayName: string -- fullName: string -- shortDescr: string? -- description: string? -- image: string? -- contactLink: string? -- preferences: [Preferences](#preferences)? -- peerType: [ChatPeerType](#chatpeertype)? -- badge: [BadgeProof](#badgeproof)? -- contactDomain: [SimplexDomainClaim](#simplexdomainclaim)? - - ---- - -## ProxyClientError - -**Discriminated union type**: - -ProtocolError: -- type: "protocolError" -- protocolErr: [ErrorType](#errortype) - -UnexpectedResponse: -- type: "unexpectedResponse" -- responseStr: string - -ResponseError: -- type: "responseError" -- responseErr: [ErrorType](#errortype) - - ---- - -## ProxyError - -**Discriminated union type**: - -PROTOCOL: -- type: "PROTOCOL" -- protocolErr: [ErrorType](#errortype) - -BROKER: -- type: "BROKER" -- brokerErr: [BrokerErrorType](#brokererrortype) - -BASIC_AUTH: -- type: "BASIC_AUTH" - -NO_SESSION: -- type: "NO_SESSION" - - ---- - -## PublicGroupAccess - -**Record type**: -- groupWebPage: string? -- groupDomainClaim: [SimplexDomainClaim](#simplexdomainclaim)? -- domainWebPage: bool -- allowEmbedding: bool - - ---- - -## PublicGroupData - -**Record type**: -- publicMemberCount: int64 - - ---- - -## PublicGroupProfile - -**Record type**: -- groupType: [GroupType](#grouptype) -- groupLink: string -- publicGroupId: string -- publicGroupAccess: [PublicGroupAccess](#publicgroupaccess)? - - ---- - -## RCErrorType - -**Discriminated union type**: - -Internal: -- type: "internal" -- internalErr: string - -Identity: -- type: "identity" - -NoLocalAddress: -- type: "noLocalAddress" - -NewController: -- type: "newController" - -NotDiscovered: -- type: "notDiscovered" - -TLSStartFailed: -- type: "tLSStartFailed" - -Exception: -- type: "exception" -- exception: string - -CtrlAuth: -- type: "ctrlAuth" - -CtrlNotFound: -- type: "ctrlNotFound" - -CtrlError: -- type: "ctrlError" -- ctrlErr: string - -Invitation: -- type: "invitation" - -Version: -- type: "version" - -Encrypt: -- type: "encrypt" - -Decrypt: -- type: "decrypt" - -BlockSize: -- type: "blockSize" - -Syntax: -- type: "syntax" -- syntaxErr: string - - ---- - -## RatchetSyncState - -**Enum type**: -- "ok" -- "allowed" -- "required" -- "started" -- "agreed" - - ---- - -## RcvConnEvent - -**Discriminated union type**: - -SwitchQueue: -- type: "switchQueue" -- phase: [SwitchPhase](#switchphase) - -RatchetSync: -- type: "ratchetSync" -- syncStatus: [RatchetSyncState](#ratchetsyncstate) - -VerificationCodeReset: -- type: "verificationCodeReset" - -PqEnabled: -- type: "pqEnabled" -- enabled: bool - - ---- - -## RcvDirectEvent - -**Discriminated union type**: - -ContactDeleted: -- type: "contactDeleted" - -ProfileUpdated: -- type: "profileUpdated" -- fromProfile: [Profile](#profile) -- toProfile: [Profile](#profile) - -GroupInvLinkReceived: -- type: "groupInvLinkReceived" -- groupProfile: [GroupProfile](#groupprofile) - - ---- - -## RcvFileDescr - -**Record type**: -- fileDescrId: int64 -- fileDescrText: string -- fileDescrPartNo: int -- fileDescrComplete: bool - - ---- - -## RcvFileStatus - -**Discriminated union type**: - -New: -- type: "new" - -Accepted: -- type: "accepted" -- filePath: string - -Connected: -- type: "connected" -- filePath: string - -Complete: -- type: "complete" -- filePath: string - -Cancelled: -- type: "cancelled" -- filePath_: string? - - ---- - -## RcvFileTransfer - -**Record type**: -- fileId: int64 -- xftpRcvFile: [XFTPRcvFile](#xftprcvfile)? -- fileInvitation: [FileInvitation](#fileinvitation) -- fileProhibited: [FileProhibited](#fileprohibited)? -- fileStatus: [RcvFileStatus](#rcvfilestatus) -- fileType: [FileType](#filetype) -- rcvFileInline: [InlineFileMode](#inlinefilemode)? -- senderDisplayName: string -- chunkSize: int64 -- cancelled: bool -- grpMemberId: int64? -- cryptoArgs: [CryptoFileArgs](#cryptofileargs)? - - ---- - -## RcvGroupEvent - -**Discriminated union type**: - -MemberAdded: -- type: "memberAdded" -- groupMemberId: int64 -- profile: [Profile](#profile) - -MemberConnected: -- type: "memberConnected" - -MemberAccepted: -- type: "memberAccepted" -- groupMemberId: int64 -- profile: [Profile](#profile) - -UserAccepted: -- type: "userAccepted" - -MemberLeft: -- type: "memberLeft" - -MemberRole: -- type: "memberRole" -- groupMemberId: int64 -- profile: [Profile](#profile) -- role: [GroupMemberRole](#groupmemberrole) - -MemberBlocked: -- type: "memberBlocked" -- groupMemberId: int64 -- profile: [Profile](#profile) -- blocked: bool - -UserRole: -- type: "userRole" -- role: [GroupMemberRole](#groupmemberrole) - -MemberDeleted: -- type: "memberDeleted" -- groupMemberId: int64 -- profile: [Profile](#profile) - -UserDeleted: -- type: "userDeleted" - -GroupDeleted: -- type: "groupDeleted" - -GroupUpdated: -- type: "groupUpdated" -- groupProfile: [GroupProfile](#groupprofile) - -InvitedViaGroupLink: -- type: "invitedViaGroupLink" - -MemberCreatedContact: -- type: "memberCreatedContact" - -MemberProfileUpdated: -- type: "memberProfileUpdated" -- fromProfile: [Profile](#profile) -- toProfile: [Profile](#profile) - -NewMemberPendingReview: -- type: "newMemberPendingReview" - -MsgBadSignature: -- type: "msgBadSignature" - - ---- - -## RcvMsgError - -**Discriminated union type**: - -Dropped: -- type: "dropped" -- attempts: int - -ParseError: -- type: "parseError" -- parseError: string - - ---- - -## RelayCapabilities - -**Record type**: -- webDomain: string? - - ---- - -## RelayConnectionResult - -**Record type**: -- relayMember: [GroupMember](#groupmember) -- relayError: [ChatError](#chaterror)? - - ---- - -## RelayProfile - -**Record type**: -- displayName: string -- fullName: string -- shortDescr: string? -- image: string? - - ---- - -## RelayStatus - -**Enum type**: -- "new" -- "invited" -- "accepted" -- "acknowledgedRoster" -- "active" -- "inactive" -- "rejected" - - ---- - -## RemoteCtrlInfo - -**Record type**: -- remoteCtrlId: int64 -- ctrlDeviceName: string -- sessionState: [RemoteCtrlSessionState](#remotectrlsessionstate)? - - ---- - -## RemoteCtrlSessionState - -**Discriminated union type**: - -Starting: -- type: "starting" - -Searching: -- type: "searching" - -Connecting: -- type: "connecting" - -PendingConfirmation: -- type: "pendingConfirmation" -- sessionCode: string - -Connected: -- type: "connected" -- sessionCode: string - - ---- - -## RemoteCtrlStopReason - -**Discriminated union type**: - -DiscoveryFailed: -- type: "discoveryFailed" -- chatError: [ChatError](#chaterror) - -ConnectionFailed: -- type: "connectionFailed" -- chatError: [ChatError](#chaterror) - -SetupFailed: -- type: "setupFailed" -- chatError: [ChatError](#chaterror) - -Disconnected: -- type: "disconnected" - - ---- - -## ReportReason - -**Enum type**: -- "spam" -- "content" -- "community" -- "profile" -- "other" - - ---- - -## RoleGroupPreference - -**Record type**: -- enable: [GroupFeatureEnabled](#groupfeatureenabled) -- role: [GroupMemberRole](#groupmemberrole)? - - ---- - -## SMPAgentError - -**Discriminated union type**: - -A_MESSAGE: -- type: "A_MESSAGE" -- messageErr: string - -A_PROHIBITED: -- type: "A_PROHIBITED" -- prohibitedErr: string - -A_VERSION: -- type: "A_VERSION" - -A_LINK: -- type: "A_LINK" -- linkErr: string - -A_CRYPTO: -- type: "A_CRYPTO" -- cryptoErr: [AgentCryptoError](#agentcryptoerror) - -A_DUPLICATE: -- type: "A_DUPLICATE" -- droppedMsg_: [DroppedMsg](#droppedmsg)? - -A_QUEUE: -- type: "A_QUEUE" -- queueErr: string - -A_SERVICE: -- type: "A_SERVICE" -- serviceError: [AgentServiceError](#agentserviceerror) - - ---- - -## SecurityCode - -**Record type**: -- securityCode: string -- verifiedAt: UTCTime - - ---- - -## SimplePreference - -**Record type**: -- allow: [FeatureAllowed](#featureallowed) - - ---- - -## SimplexDomain - -**Record type**: -- nameTLD: [SimplexTLD](#simplextld) -- domain: string -- subDomain: [string] - - ---- - -## SimplexDomainClaim - -**Record type**: -- domain: string -- proof: [SimplexDomainProof](#simplexdomainproof)? - - ---- - -## SimplexDomainError - -**Discriminated union type**: - -NoValidLink: -- type: "noValidLink" - -UnknownDomain: -- type: "unknownDomain" - - ---- - -## SimplexDomainProof - -**Record type**: -- linkOwnerId: string? -- presHeader: string -- signature: string - - ---- - -## SimplexLinkType - -**Enum type**: -- "contact" -- "invitation" -- "group" -- "channel" -- "relay" - - ---- - -## SimplexNameInfo - -**Record type**: -- nameType: [SimplexNameType](#simplexnametype) -- nameDomain: [SimplexDomain](#simplexdomain) - - ---- - -## SimplexNameType - -**Enum type**: -- "publicGroup" -- "contact" - - ---- - -## SimplexTLD - -**Enum type**: -- "simplex" -- "testing" -- "web" - - ---- - -## SndCIStatusProgress - -**Enum type**: -- "partial" -- "complete" - - ---- - -## SndConnEvent - -**Discriminated union type**: - -SwitchQueue: -- type: "switchQueue" -- phase: [SwitchPhase](#switchphase) -- member: [GroupMemberRef](#groupmemberref)? - -RatchetSync: -- type: "ratchetSync" -- syncStatus: [RatchetSyncState](#ratchetsyncstate) -- member: [GroupMemberRef](#groupmemberref)? - -PqEnabled: -- type: "pqEnabled" -- enabled: bool - - ---- - -## SndError - -**Discriminated union type**: - -Auth: -- type: "auth" - -Quota: -- type: "quota" - -Expired: -- type: "expired" - -Relay: -- type: "relay" -- srvError: [SrvError](#srverror) - -Proxy: -- type: "proxy" -- proxyServer: string -- srvError: [SrvError](#srverror) - -ProxyRelay: -- type: "proxyRelay" -- proxyServer: string -- srvError: [SrvError](#srverror) - -Other: -- type: "other" -- sndError: string - - ---- - -## SndFileTransfer - -**Record type**: -- fileId: int64 -- fileName: string -- filePath: string -- fileSize: int64 -- chunkSize: int64 -- recipientDisplayName: string -- connId: int64 -- agentConnId: string -- groupMemberId: int64? -- fileStatus: [FileStatus](#filestatus) -- fileDescrId: int64? -- fileInline: [InlineFileMode](#inlinefilemode)? - - ---- - -## SndGroupEvent - -**Discriminated union type**: - -MemberRole: -- type: "memberRole" -- groupMemberId: int64 -- profile: [Profile](#profile) -- role: [GroupMemberRole](#groupmemberrole) - -MemberBlocked: -- type: "memberBlocked" -- groupMemberId: int64 -- profile: [Profile](#profile) -- blocked: bool - -UserRole: -- type: "userRole" -- role: [GroupMemberRole](#groupmemberrole) - -MemberDeleted: -- type: "memberDeleted" -- groupMemberId: int64 -- profile: [Profile](#profile) - -UserLeft: -- type: "userLeft" - -GroupUpdated: -- type: "groupUpdated" -- groupProfile: [GroupProfile](#groupprofile) - -MemberAccepted: -- type: "memberAccepted" -- groupMemberId: int64 -- profile: [Profile](#profile) - -UserPendingReview: -- type: "userPendingReview" - - ---- - -## SrvError - -**Discriminated union type**: - -Host: -- type: "host" - -Version: -- type: "version" - -Other: -- type: "other" -- srvError: string - - ---- - -## StoreError - -**Discriminated union type**: - -DuplicateName: -- type: "duplicateName" - -UserNotFound: -- type: "userNotFound" -- userId: int64 - -RelayUserNotFound: -- type: "relayUserNotFound" - -UserNotFoundByName: -- type: "userNotFoundByName" -- contactName: string - -UserNotFoundByContactId: -- type: "userNotFoundByContactId" -- contactId: int64 - -UserNotFoundByGroupId: -- type: "userNotFoundByGroupId" -- groupId: int64 - -UserNotFoundByFileId: -- type: "userNotFoundByFileId" -- fileId: int64 - -UserNotFoundByContactRequestId: -- type: "userNotFoundByContactRequestId" -- contactRequestId: int64 - -ContactNotFound: -- type: "contactNotFound" -- contactId: int64 - -ContactNotFoundByName: -- type: "contactNotFoundByName" -- contactName: string - -ContactNotFoundByMemberId: -- type: "contactNotFoundByMemberId" -- groupMemberId: int64 - -ContactNotReady: -- type: "contactNotReady" -- contactName: string - -DuplicateContactLink: -- type: "duplicateContactLink" - -UserContactLinkNotFound: -- type: "userContactLinkNotFound" - -ContactRequestNotFound: -- type: "contactRequestNotFound" -- contactRequestId: int64 - -ContactRequestNotFoundByName: -- type: "contactRequestNotFoundByName" -- contactName: string - -InvalidContactRequestEntity: -- type: "invalidContactRequestEntity" -- contactRequestId: int64 - -InvalidBusinessChatContactRequest: -- type: "invalidBusinessChatContactRequest" - -GroupNotFound: -- type: "groupNotFound" -- groupId: int64 - -GroupNotFoundByName: -- type: "groupNotFoundByName" -- groupName: string - -GroupMemberNameNotFound: -- type: "groupMemberNameNotFound" -- groupId: int64 -- groupMemberName: string - -GroupMemberNotFound: -- type: "groupMemberNotFound" -- groupMemberId: int64 - -GroupMemberNotFoundByIndex: -- type: "groupMemberNotFoundByIndex" -- groupMemberIndex: int64 - -MemberRelationsVectorNotFound: -- type: "memberRelationsVectorNotFound" -- groupMemberId: int64 - -GroupHostMemberNotFound: -- type: "groupHostMemberNotFound" -- groupId: int64 - -GroupMemberNotFoundByMemberId: -- type: "groupMemberNotFoundByMemberId" -- memberId: string - -MemberContactGroupMemberNotFound: -- type: "memberContactGroupMemberNotFound" -- contactId: int64 - -InvalidMemberRelationUpdate: -- type: "invalidMemberRelationUpdate" - -GroupWithoutUser: -- type: "groupWithoutUser" - -DuplicateGroupMember: -- type: "duplicateGroupMember" - -DuplicateMemberId: -- type: "duplicateMemberId" - -GroupAlreadyJoined: -- type: "groupAlreadyJoined" - -GroupInvitationNotFound: -- type: "groupInvitationNotFound" - -NoteFolderAlreadyExists: -- type: "noteFolderAlreadyExists" -- noteFolderId: int64 - -NoteFolderNotFound: -- type: "noteFolderNotFound" -- noteFolderId: int64 - -UserNoteFolderNotFound: -- type: "userNoteFolderNotFound" - -SndFileNotFound: -- type: "sndFileNotFound" -- fileId: int64 - -SndFileInvalid: -- type: "sndFileInvalid" -- fileId: int64 - -RcvFileNotFound: -- type: "rcvFileNotFound" -- fileId: int64 - -RcvFileDescrNotFound: -- type: "rcvFileDescrNotFound" -- fileId: int64 - -FileNotFound: -- type: "fileNotFound" -- fileId: int64 - -RcvFileInvalid: -- type: "rcvFileInvalid" -- fileId: int64 - -RcvFileInvalidDescrPart: -- type: "rcvFileInvalidDescrPart" - -LocalFileNoTransfer: -- type: "localFileNoTransfer" -- fileId: int64 - -SharedMsgIdNotFoundByFileId: -- type: "sharedMsgIdNotFoundByFileId" -- fileId: int64 - -FileIdNotFoundBySharedMsgId: -- type: "fileIdNotFoundBySharedMsgId" -- sharedMsgId: string - -SndFileNotFoundXFTP: -- type: "sndFileNotFoundXFTP" -- agentSndFileId: string - -RcvFileNotFoundXFTP: -- type: "rcvFileNotFoundXFTP" -- agentRcvFileId: string - -ConnectionNotFound: -- type: "connectionNotFound" -- agentConnId: string - -ConnectionNotFoundById: -- type: "connectionNotFoundById" -- connId: int64 - -ConnectionNotFoundByMemberId: -- type: "connectionNotFoundByMemberId" -- groupMemberId: int64 - -PendingConnectionNotFound: -- type: "pendingConnectionNotFound" -- connId: int64 - -UniqueID: -- type: "uniqueID" - -LargeMsg: -- type: "largeMsg" - -InternalError: -- type: "internalError" -- message: string - -DBException: -- type: "dBException" -- message: string - -DBBusyError: -- type: "dBBusyError" -- message: string - -BadChatItem: -- type: "badChatItem" -- itemId: int64 -- itemTs: UTCTime? - -ChatItemNotFound: -- type: "chatItemNotFound" -- itemId: int64 - -ChatItemNotFoundByText: -- type: "chatItemNotFoundByText" -- text: string - -ChatItemSharedMsgIdNotFound: -- type: "chatItemSharedMsgIdNotFound" -- sharedMsgId: string - -ChatItemNotFoundByFileId: -- type: "chatItemNotFoundByFileId" -- fileId: int64 - -ChatItemNotFoundByContactId: -- type: "chatItemNotFoundByContactId" -- contactId: int64 - -ChatItemNotFoundByGroupId: -- type: "chatItemNotFoundByGroupId" -- groupId: int64 - -ProfileNotFound: -- type: "profileNotFound" -- profileId: int64 - -DuplicateGroupLink: -- type: "duplicateGroupLink" -- groupInfo: [GroupInfo](#groupinfo) - -GroupLinkNotFound: -- type: "groupLinkNotFound" -- groupInfo: [GroupInfo](#groupinfo) - -HostMemberIdNotFound: -- type: "hostMemberIdNotFound" -- groupId: int64 - -ContactNotFoundByFileId: -- type: "contactNotFoundByFileId" -- fileId: int64 - -NoGroupSndStatus: -- type: "noGroupSndStatus" -- itemId: int64 -- groupMemberId: int64 - -DuplicateGroupMessage: -- type: "duplicateGroupMessage" -- groupId: int64 -- sharedMsgId: string -- authorGroupMemberId: int64? -- forwardedByGroupMemberId: int64? - -RemoteHostNotFound: -- type: "remoteHostNotFound" -- remoteHostId: int64 - -RemoteHostUnknown: -- type: "remoteHostUnknown" - -RemoteHostDuplicateCA: -- type: "remoteHostDuplicateCA" - -RemoteCtrlNotFound: -- type: "remoteCtrlNotFound" -- remoteCtrlId: int64 - -RemoteCtrlDuplicateCA: -- type: "remoteCtrlDuplicateCA" - -ProhibitedDeleteUser: -- type: "prohibitedDeleteUser" -- userId: int64 -- contactId: int64 - -OperatorNotFound: -- type: "operatorNotFound" -- serverOperatorId: int64 - -UsageConditionsNotFound: -- type: "usageConditionsNotFound" - -UserChatRelayNotFound: -- type: "userChatRelayNotFound" -- chatRelayId: int64 - -GroupRelayNotFound: -- type: "groupRelayNotFound" -- groupRelayId: int64 - -GroupRelayNotFoundByMemberId: -- type: "groupRelayNotFoundByMemberId" -- groupMemberId: int64 - -InvalidQuote: -- type: "invalidQuote" - -InvalidMention: -- type: "invalidMention" - -InvalidDeliveryTask: -- type: "invalidDeliveryTask" -- taskId: int64 - -DeliveryTaskNotFound: -- type: "deliveryTaskNotFound" -- taskId: int64 - -InvalidDeliveryJob: -- type: "invalidDeliveryJob" -- jobId: int64 - -DeliveryJobNotFound: -- type: "deliveryJobNotFound" -- jobId: int64 - -WorkItemError: -- type: "workItemError" -- errContext: string - - ---- - -## SubscriptionStatus - -**Discriminated union type**: - -Active: -- type: "active" - -Pending: -- type: "pending" - -Removed: -- type: "removed" -- subError: string - -NoSub: -- type: "noSub" - - ---- - -## SupportGroupPreference - -**Record type**: -- enable: [GroupFeatureEnabled](#groupfeatureenabled) - - ---- - -## SwitchPhase - -**Enum type**: -- "started" -- "confirmed" -- "secured" -- "completed" - - ---- - -## TimedMessagesGroupPreference - -**Record type**: -- enable: [GroupFeatureEnabled](#groupfeatureenabled) -- ttl: int? - - ---- - -## TimedMessagesPreference - -**Record type**: -- allow: [FeatureAllowed](#featureallowed) -- ttl: int? - - ---- - -## TransportError - -**Discriminated union type**: - -BadBlock: -- type: "badBlock" - -Version: -- type: "version" - -LargeMsg: -- type: "largeMsg" - -BadSession: -- type: "badSession" - -NoServerAuth: -- type: "noServerAuth" - -Handshake: -- type: "handshake" -- handshakeErr: [HandshakeError](#handshakeerror) - - ---- - -## UIColorMode - -**Enum type**: -- "light" -- "dark" - - ---- - -## UIColors - -**Record type**: -- accent: string? -- accentVariant: string? -- secondary: string? -- secondaryVariant: string? -- background: string? -- menus: string? -- title: string? -- accentVariant2: string? -- sentMessage: string? -- sentReply: string? -- receivedMessage: string? -- receivedReply: string? - - ---- - -## UIThemeEntityOverride - -**Record type**: -- mode: [UIColorMode](#uicolormode) -- wallpaper: [ChatWallpaper](#chatwallpaper)? -- colors: [UIColors](#uicolors) - - ---- - -## UIThemeEntityOverrides - -**Record type**: -- light: [UIThemeEntityOverride](#uithemeentityoverride)? -- dark: [UIThemeEntityOverride](#uithemeentityoverride)? - - ---- - -## UpdatedMessage - -**Record type**: -- msgContent: [MsgContent](#msgcontent) -- mentions: {string : int64} - - ---- - -## User - -**Record type**: -- userId: int64 -- agentUserId: int64 -- userContactId: int64 -- localDisplayName: string -- profile: [LocalProfile](#localprofile) -- fullPreferences: [FullPreferences](#fullpreferences) -- activeUser: bool -- activeOrder: int64 -- viewPwdHash: [UserPwdHash](#userpwdhash)? -- showNtfs: bool -- sendRcptsContacts: bool -- sendRcptsSmallGroups: bool -- autoAcceptMemberContacts: bool -- autoAcceptGroupInvitations: bool -- userMemberProfileUpdatedAt: UTCTime? -- userChatRelay: bool -- clientService: bool -- uiThemes: [UIThemeEntityOverrides](#uithemeentityoverrides)? - - ---- - -## UserChatRelay - -**Record type**: -- chatRelayId: int64 -- address: string -- relayProfile: [RelayProfile](#relayprofile) -- domains: [string] -- preset: bool -- tested: bool? -- enabled: bool -- deleted: bool - - ---- - -## UserContact - -**Record type**: -- userContactLinkId: int64 -- connReqContact: string -- groupId: int64? - - ---- - -## UserContactLink - -**Record type**: -- userContactLinkId: int64 -- connLinkContact: [CreatedConnLink](#createdconnlink) -- shortLinkDataSet: bool -- shortLinkLargeDataSet: bool -- addressSettings: [AddressSettings](#addresssettings) - - ---- - -## UserContactRequest - -**Record type**: -- contactRequestId: int64 -- agentInvitationId: string -- contactId_: int64? -- businessGroupId_: int64? -- userContactLinkId_: int64? -- cReqChatVRange: [VersionRange](#versionrange) -- localDisplayName: string -- profileId: int64 -- profile: [LocalProfile](#localprofile) -- createdAt: UTCTime -- updatedAt: UTCTime -- xContactId: string? -- pqSupport: bool -- welcomeSharedMsgId: string? -- requestSharedMsgId: string? -- rejectionSupported: bool - - ---- - -## UserContactRequestRef - -**Record type**: -- contactRequestId: int64 -- rejectionSupported: bool - - ---- - -## UserInfo - -**Record type**: -- user: [User](#user) -- unreadCount: int - - ---- - -## UserProfileUpdateSummary - -**Record type**: -- updateSuccesses: int -- updateFailures: int -- changedContacts: [[Contact](#contact)] - - ---- - -## UserPwdHash - -**Record type**: -- hash: string -- salt: string - - ---- - -## VersionRange - -**Record type**: -- minVersion: int -- maxVersion: int - - ---- - -## XFTPErrorType - -**Discriminated union type**: - -BLOCK: -- type: "BLOCK" - -SESSION: -- type: "SESSION" - -HANDSHAKE: -- type: "HANDSHAKE" - -CMD: -- type: "CMD" -- cmdErr: [CommandError](#commanderror) - -AUTH: -- type: "AUTH" - -BLOCKED: -- type: "BLOCKED" -- blockInfo: [BlockingInfo](#blockinginfo) - -SIZE: -- type: "SIZE" - -QUOTA: -- type: "QUOTA" - -DIGEST: -- type: "DIGEST" - -CRYPTO: -- type: "CRYPTO" - -NO_FILE: -- type: "NO_FILE" - -HAS_FILE: -- type: "HAS_FILE" - -FILE_IO: -- type: "FILE_IO" - -TIMEOUT: -- type: "TIMEOUT" - -INTERNAL: -- type: "INTERNAL" - -DUPLICATE_: -- type: "DUPLICATE_" - - ---- - -## XFTPRcvFile - -**Record type**: -- rcvFileDescription: [RcvFileDescr](#rcvfiledescr) -- agentRcvFileId: string? -- agentRcvFileDeleted: bool -- userApprovedRelays: bool - - ---- - -## XFTPSndFile - -**Record type**: -- agentSndFileId: string -- privateSndFileDescr: string? -- agentSndFileDeleted: bool -- cryptoArgs: [CryptoFileArgs](#cryptofileargs)? diff --git a/packages/simplex-chat-client/types/typescript/src/commands.ts b/packages/simplex-chat-client/types/typescript/src/commands.ts index c217ef944c..e69de29bb2 100644 --- a/packages/simplex-chat-client/types/typescript/src/commands.ts +++ b/packages/simplex-chat-client/types/typescript/src/commands.ts @@ -1,938 +0,0 @@ -// 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 - } -} diff --git a/packages/simplex-chat-client/types/typescript/src/events.ts b/packages/simplex-chat-client/types/typescript/src/events.ts index 5b644ee41e..e69de29bb2 100644 --- a/packages/simplex-chat-client/types/typescript/src/events.ts +++ b/packages/simplex-chat-client/types/typescript/src/events.ts @@ -1,506 +0,0 @@ -// 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[] - } -} diff --git a/packages/simplex-chat-client/types/typescript/src/responses.ts b/packages/simplex-chat-client/types/typescript/src/responses.ts index 647427f0dc..e69de29bb2 100644 --- a/packages/simplex-chat-client/types/typescript/src/responses.ts +++ b/packages/simplex-chat-client/types/typescript/src/responses.ts @@ -1,553 +0,0 @@ -// 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[] - } -} diff --git a/packages/simplex-chat-client/types/typescript/src/types.ts b/packages/simplex-chat-client/types/typescript/src/types.ts index d7db7f259f..e69de29bb2 100644 --- a/packages/simplex-chat-client/types/typescript/src/types.ts +++ b/packages/simplex-chat-client/types/typescript/src/types.ts @@ -1,5423 +0,0 @@ -// API Types -// This file is generated automatically. - -export interface ACIReaction { - chatInfo: ChatInfo - chatReaction: CIReaction -} - -export interface AChat { - chatInfo: ChatInfo - chatItems: ChatItem[] - chatStats: ChatStats -} - -export interface AChatItem { - chatInfo: ChatInfo - chatItem: ChatItem -} - -export interface AddRelayResult { - relay: UserChatRelay - relayError?: ChatError -} - -export interface AddressSettings { - businessAddress: boolean - autoAccept?: AutoAccept - autoReply?: MsgContent -} - -export type AgentCryptoError = - | AgentCryptoError.DECRYPT_AES - | AgentCryptoError.DECRYPT_CB - | AgentCryptoError.RATCHET_HEADER - | AgentCryptoError.RATCHET_SYNC - -export namespace AgentCryptoError { - export type Tag = "DECRYPT_AES" | "DECRYPT_CB" | "RATCHET_HEADER" | "RATCHET_SYNC" - - interface Interface { - type: Tag - } - - export interface DECRYPT_AES extends Interface { - type: "DECRYPT_AES" - } - - export interface DECRYPT_CB extends Interface { - type: "DECRYPT_CB" - } - - export interface RATCHET_HEADER extends Interface { - type: "RATCHET_HEADER" - } - - export interface RATCHET_SYNC extends Interface { - type: "RATCHET_SYNC" - } -} - -export type AgentErrorType = - | AgentErrorType.CMD - | AgentErrorType.CONN - | AgentErrorType.NO_USER - | AgentErrorType.SMP - | AgentErrorType.NTF - | AgentErrorType.XFTP - | AgentErrorType.FILE - | AgentErrorType.NO_NAME_SERVERS - | AgentErrorType.PROXY - | AgentErrorType.RCP - | AgentErrorType.BROKER - | AgentErrorType.AGENT - | AgentErrorType.NOTICE - | AgentErrorType.INTERNAL - | AgentErrorType.CRITICAL - | AgentErrorType.INACTIVE - -export namespace AgentErrorType { - export type Tag = - | "CMD" - | "CONN" - | "NO_USER" - | "SMP" - | "NTF" - | "XFTP" - | "FILE" - | "NO_NAME_SERVERS" - | "PROXY" - | "RCP" - | "BROKER" - | "AGENT" - | "NOTICE" - | "INTERNAL" - | "CRITICAL" - | "INACTIVE" - - interface Interface { - type: Tag - } - - export interface CMD extends Interface { - type: "CMD" - cmdErr: CommandErrorType - errContext: string - } - - export interface CONN extends Interface { - type: "CONN" - connErr: ConnectionErrorType - errContext: string - } - - export interface NO_USER extends Interface { - type: "NO_USER" - } - - export interface SMP extends Interface { - type: "SMP" - serverAddress: string - smpErr: ErrorType - } - - export interface NTF extends Interface { - type: "NTF" - serverAddress: string - ntfErr: ErrorType - } - - export interface XFTP extends Interface { - type: "XFTP" - serverAddress: string - xftpErr: XFTPErrorType - } - - export interface FILE extends Interface { - type: "FILE" - fileErr: FileErrorType - } - - export interface NO_NAME_SERVERS extends Interface { - type: "NO_NAME_SERVERS" - } - - export interface PROXY extends Interface { - type: "PROXY" - proxyServer: string - relayServer: string - proxyErr: ProxyClientError - } - - export interface RCP extends Interface { - type: "RCP" - rcpErr: RCErrorType - } - - export interface BROKER extends Interface { - type: "BROKER" - brokerAddress: string - brokerErr: BrokerErrorType - } - - export interface AGENT extends Interface { - type: "AGENT" - agentErr: SMPAgentError - } - - export interface NOTICE extends Interface { - type: "NOTICE" - server: string - preset: boolean - expiresAt?: string // ISO-8601 timestamp - } - - export interface INTERNAL extends Interface { - type: "INTERNAL" - internalErr: string - } - - export interface CRITICAL extends Interface { - type: "CRITICAL" - offerRestart: boolean - criticalErr: string - } - - export interface INACTIVE extends Interface { - type: "INACTIVE" - } -} - -export type AgentServiceError = - | AgentServiceError.Rejected - | AgentServiceError.Timeout - | AgentServiceError.NoPendingRequest - | AgentServiceError.NotDRAddress - | AgentServiceError.BadSignature - -export namespace AgentServiceError { - export type Tag = "rejected" | "timeout" | "noPendingRequest" | "notDRAddress" | "badSignature" - - interface Interface { - type: Tag - } - - export interface Rejected extends Interface { - type: "rejected" - rejectReason: string - } - - export interface Timeout extends Interface { - type: "timeout" - } - - export interface NoPendingRequest extends Interface { - type: "noPendingRequest" - } - - export interface NotDRAddress extends Interface { - type: "notDRAddress" - } - - export interface BadSignature extends Interface { - type: "badSignature" - } -} -// Remote controller app version range (min and max as version strings). - -export interface AppVersionRange { - minVersion: string - maxVersion: string -} - -export interface AutoAccept { - acceptIncognito: boolean -} - -export interface BadgeInfo { - badgeType: BadgeType - badgeExpiry: string // ISO-8601 timestamp - badgeExtra: string -} - -export interface BadgeProof { - badgeKeyIdx: number // int - presHeader: string - proof: string - badgeInfo: BadgeInfo -} - -export type BadgeRedeemError = - | BadgeRedeemError.InvalidCode - | BadgeRedeemError.ServiceNotConfigured - | BadgeRedeemError.BadgeActive - | BadgeRedeemError.ServiceError - | BadgeRedeemError.InvalidResponse - | BadgeRedeemError.UnknownKeyIndex - | BadgeRedeemError.CredentialNotVerified - -export namespace BadgeRedeemError { - export type Tag = - | "invalidCode" - | "serviceNotConfigured" - | "badgeActive" - | "serviceError" - | "invalidResponse" - | "unknownKeyIndex" - | "credentialNotVerified" - - interface Interface { - type: Tag - } - - export interface InvalidCode extends Interface { - type: "invalidCode" - } - - export interface ServiceNotConfigured extends Interface { - type: "serviceNotConfigured" - } - - export interface BadgeActive extends Interface { - type: "badgeActive" - } - - export interface ServiceError extends Interface { - type: "serviceError" - serviceError: BadgeServiceErrorCode - } - - export interface InvalidResponse extends Interface { - type: "invalidResponse" - message: string - } - - export interface UnknownKeyIndex extends Interface { - type: "unknownKeyIndex" - } - - export interface CredentialNotVerified extends Interface { - type: "credentialNotVerified" - } -} - -export enum BadgeServiceErrorCode { - Bad_request = "bad_request", - Unsupported_version = "unsupported_version", - Unknown_purchase_key = "unknown_purchase_key", - Unknown_offer_id = "unknown_offer_id", - Offer_disabled = "offer_disabled", - Offer_mismatch = "offer_mismatch", - Product_unavailable = "product_unavailable", - Payment_not_entitled = "payment_not_entitled", - Payment_pending = "payment_pending", - Provider_unavailable = "provider_unavailable", - Rate_limited = "rate_limited", - Code_invalid = "code_invalid", - Code_used = "code_used", - Code_expired = "code_expired", - Receipt_invalid = "receipt_invalid", - Receipt_used = "receipt_used", - Internal = "internal", -} - -export enum BadgeStatus { - Active = "active", - Expired = "expired", - ExpiredOld = "expiredOld", - Failed = "failed", - UnknownKey = "unknownKey", -} - -export enum BadgeType { - Supporter = "supporter", - Legend = "legend", - Investor = "investor", -} - -export interface BlockingInfo { - reason: BlockingReason - notice?: ClientNotice -} - -export enum BlockingReason { - Spam = "spam", - Content = "content", -} - -export type BrokerErrorType = - | BrokerErrorType.RESPONSE - | BrokerErrorType.UNEXPECTED - | BrokerErrorType.NETWORK - | BrokerErrorType.HOST - | BrokerErrorType.NO_SERVICE - | BrokerErrorType.TRANSPORT - | BrokerErrorType.TIMEOUT - -export namespace BrokerErrorType { - export type Tag = - | "RESPONSE" - | "UNEXPECTED" - | "NETWORK" - | "HOST" - | "NO_SERVICE" - | "TRANSPORT" - | "TIMEOUT" - - interface Interface { - type: Tag - } - - export interface RESPONSE extends Interface { - type: "RESPONSE" - respErr: string - } - - export interface UNEXPECTED extends Interface { - type: "UNEXPECTED" - respErr: string - } - - export interface NETWORK extends Interface { - type: "NETWORK" - networkError: NetworkError - } - - export interface HOST extends Interface { - type: "HOST" - } - - export interface NO_SERVICE extends Interface { - type: "NO_SERVICE" - } - - export interface TRANSPORT extends Interface { - type: "TRANSPORT" - transportErr: TransportError - } - - export interface TIMEOUT extends Interface { - type: "TIMEOUT" - } -} - -export interface BusinessChatInfo { - chatType: BusinessChatType - businessId: string - customerId: string - businessDomain?: SimplexDomainClaim -} - -export enum BusinessChatType { - Business = "business", - Customer = "customer", -} - -export enum CICallStatus { - Pending = "pending", - Missed = "missed", - Rejected = "rejected", - Accepted = "accepted", - Negotiated = "negotiated", - Progress = "progress", - Ended = "ended", - Error = "error", -} - -export type CIContent = - | CIContent.SndMsgContent - | CIContent.RcvMsgContent - | CIContent.SndDeleted - | CIContent.RcvDeleted - | CIContent.SndCall - | CIContent.RcvCall - | CIContent.RcvIntegrityError - | CIContent.RcvDecryptionError - | CIContent.RcvMsgError - | CIContent.RcvGroupInvitation - | CIContent.SndGroupInvitation - | CIContent.RcvDirectEvent - | CIContent.RcvGroupEvent - | CIContent.SndGroupEvent - | CIContent.RcvConnEvent - | CIContent.SndConnEvent - | CIContent.RcvChatFeature - | CIContent.SndChatFeature - | CIContent.RcvChatPreference - | CIContent.SndChatPreference - | CIContent.RcvGroupFeature - | CIContent.SndGroupFeature - | CIContent.RcvChatFeatureRejected - | CIContent.RcvGroupFeatureRejected - | CIContent.SndModerated - | CIContent.RcvModerated - | CIContent.RcvBlocked - | CIContent.SndDirectE2EEInfo - | CIContent.RcvDirectE2EEInfo - | CIContent.SndGroupE2EEInfo - | CIContent.RcvGroupE2EEInfo - | CIContent.ChatBanner - -export namespace CIContent { - export type Tag = - | "sndMsgContent" - | "rcvMsgContent" - | "sndDeleted" - | "rcvDeleted" - | "sndCall" - | "rcvCall" - | "rcvIntegrityError" - | "rcvDecryptionError" - | "rcvMsgError" - | "rcvGroupInvitation" - | "sndGroupInvitation" - | "rcvDirectEvent" - | "rcvGroupEvent" - | "sndGroupEvent" - | "rcvConnEvent" - | "sndConnEvent" - | "rcvChatFeature" - | "sndChatFeature" - | "rcvChatPreference" - | "sndChatPreference" - | "rcvGroupFeature" - | "sndGroupFeature" - | "rcvChatFeatureRejected" - | "rcvGroupFeatureRejected" - | "sndModerated" - | "rcvModerated" - | "rcvBlocked" - | "sndDirectE2EEInfo" - | "rcvDirectE2EEInfo" - | "sndGroupE2EEInfo" - | "rcvGroupE2EEInfo" - | "chatBanner" - - interface Interface { - type: Tag - } - - export interface SndMsgContent extends Interface { - type: "sndMsgContent" - msgContent: MsgContent - } - - export interface RcvMsgContent extends Interface { - type: "rcvMsgContent" - msgContent: MsgContent - } - - export interface SndDeleted extends Interface { - type: "sndDeleted" - deleteMode: CIDeleteMode - } - - export interface RcvDeleted extends Interface { - type: "rcvDeleted" - deleteMode: CIDeleteMode - } - - export interface SndCall extends Interface { - type: "sndCall" - status: CICallStatus - duration: number // int - } - - export interface RcvCall extends Interface { - type: "rcvCall" - status: CICallStatus - duration: number // int - } - - export interface RcvIntegrityError extends Interface { - type: "rcvIntegrityError" - msgError: MsgErrorType - } - - export interface RcvDecryptionError extends Interface { - type: "rcvDecryptionError" - msgDecryptError: MsgDecryptError - msgCount: number // word32 - } - - export interface RcvMsgError extends Interface { - type: "rcvMsgError" - rcvMsgError: RcvMsgError - } - - export interface RcvGroupInvitation extends Interface { - type: "rcvGroupInvitation" - groupInvitation: CIGroupInvitation - memberRole: GroupMemberRole - } - - export interface SndGroupInvitation extends Interface { - type: "sndGroupInvitation" - groupInvitation: CIGroupInvitation - memberRole: GroupMemberRole - } - - export interface RcvDirectEvent extends Interface { - type: "rcvDirectEvent" - rcvDirectEvent: RcvDirectEvent - } - - export interface RcvGroupEvent extends Interface { - type: "rcvGroupEvent" - rcvGroupEvent: RcvGroupEvent - } - - export interface SndGroupEvent extends Interface { - type: "sndGroupEvent" - sndGroupEvent: SndGroupEvent - } - - export interface RcvConnEvent extends Interface { - type: "rcvConnEvent" - rcvConnEvent: RcvConnEvent - } - - export interface SndConnEvent extends Interface { - type: "sndConnEvent" - sndConnEvent: SndConnEvent - } - - export interface RcvChatFeature extends Interface { - type: "rcvChatFeature" - feature: ChatFeature - enabled: PrefEnabled - param?: number // int - } - - export interface SndChatFeature extends Interface { - type: "sndChatFeature" - feature: ChatFeature - enabled: PrefEnabled - param?: number // int - } - - export interface RcvChatPreference extends Interface { - type: "rcvChatPreference" - feature: ChatFeature - allowed: FeatureAllowed - param?: number // int - } - - export interface SndChatPreference extends Interface { - type: "sndChatPreference" - feature: ChatFeature - allowed: FeatureAllowed - param?: number // int - } - - export interface RcvGroupFeature extends Interface { - type: "rcvGroupFeature" - groupFeature: GroupFeature - preference: GroupPreference - param?: number // int - memberRole_?: GroupMemberRole - } - - export interface SndGroupFeature extends Interface { - type: "sndGroupFeature" - groupFeature: GroupFeature - preference: GroupPreference - param?: number // int - memberRole_?: GroupMemberRole - } - - export interface RcvChatFeatureRejected extends Interface { - type: "rcvChatFeatureRejected" - feature: ChatFeature - } - - export interface RcvGroupFeatureRejected extends Interface { - type: "rcvGroupFeatureRejected" - groupFeature: GroupFeature - } - - export interface SndModerated extends Interface { - type: "sndModerated" - } - - export interface RcvModerated extends Interface { - type: "rcvModerated" - } - - export interface RcvBlocked extends Interface { - type: "rcvBlocked" - } - - export interface SndDirectE2EEInfo extends Interface { - type: "sndDirectE2EEInfo" - e2eeInfo: E2EInfo - } - - export interface RcvDirectE2EEInfo extends Interface { - type: "rcvDirectE2EEInfo" - e2eeInfo: E2EInfo - } - - export interface SndGroupE2EEInfo extends Interface { - type: "sndGroupE2EEInfo" - e2eeInfo: E2EInfo - } - - export interface RcvGroupE2EEInfo extends Interface { - type: "rcvGroupE2EEInfo" - e2eeInfo: E2EInfo - } - - export interface ChatBanner extends Interface { - type: "chatBanner" - } -} - -export enum CIDeleteMode { - Broadcast = "broadcast", - Internal = "internal", - InternalMark = "internalMark", - History = "history", -} - -export type CIDeleted = CIDeleted.Deleted | CIDeleted.Blocked | CIDeleted.BlockedByAdmin | CIDeleted.Moderated - -export namespace CIDeleted { - export type Tag = "deleted" | "blocked" | "blockedByAdmin" | "moderated" - - interface Interface { - type: Tag - } - - export interface Deleted extends Interface { - type: "deleted" - deletedTs?: string // ISO-8601 timestamp - chatType: ChatType - } - - export interface Blocked extends Interface { - type: "blocked" - deletedTs?: string // ISO-8601 timestamp - } - - export interface BlockedByAdmin extends Interface { - type: "blockedByAdmin" - deletedTs?: string // ISO-8601 timestamp - } - - export interface Moderated extends Interface { - type: "moderated" - deletedTs?: string // ISO-8601 timestamp - byGroupMember: GroupMember - } -} - -export type CIDirection = - | CIDirection.DirectSnd - | CIDirection.DirectRcv - | CIDirection.GroupSnd - | CIDirection.GroupRcv - | CIDirection.ChannelRcv - | CIDirection.LocalSnd - | CIDirection.LocalRcv - -export namespace CIDirection { - export type Tag = - | "directSnd" - | "directRcv" - | "groupSnd" - | "groupRcv" - | "channelRcv" - | "localSnd" - | "localRcv" - - interface Interface { - type: Tag - } - - export interface DirectSnd extends Interface { - type: "directSnd" - } - - export interface DirectRcv extends Interface { - type: "directRcv" - } - - export interface GroupSnd extends Interface { - type: "groupSnd" - } - - export interface GroupRcv extends Interface { - type: "groupRcv" - groupMember: GroupMember - } - - export interface ChannelRcv extends Interface { - type: "channelRcv" - } - - export interface LocalSnd extends Interface { - type: "localSnd" - } - - export interface LocalRcv extends Interface { - type: "localRcv" - } -} - -export interface CIFile { - fileId: number // int64 - fileName: string - fileSize: number // int64 - fileSource?: CryptoFile - fileStatus: CIFileStatus - fileProtocol: FileProtocol - fileExpires?: string // ISO-8601 timestamp - fileProhibited?: FileProhibited -} - -export type CIFileStatus = - | CIFileStatus.SndStored - | CIFileStatus.SndTransfer - | CIFileStatus.SndCancelled - | CIFileStatus.SndComplete - | CIFileStatus.SndError - | CIFileStatus.SndWarning - | CIFileStatus.RcvInvitation - | CIFileStatus.RcvAccepted - | CIFileStatus.RcvTransfer - | CIFileStatus.RcvAborted - | CIFileStatus.RcvComplete - | CIFileStatus.RcvCancelled - | CIFileStatus.RcvError - | CIFileStatus.RcvWarning - | CIFileStatus.Invalid - -export namespace CIFileStatus { - export type Tag = - | "sndStored" - | "sndTransfer" - | "sndCancelled" - | "sndComplete" - | "sndError" - | "sndWarning" - | "rcvInvitation" - | "rcvAccepted" - | "rcvTransfer" - | "rcvAborted" - | "rcvComplete" - | "rcvCancelled" - | "rcvError" - | "rcvWarning" - | "invalid" - - interface Interface { - type: Tag - } - - export interface SndStored extends Interface { - type: "sndStored" - } - - export interface SndTransfer extends Interface { - type: "sndTransfer" - sndProgress: number // int64 - sndTotal: number // int64 - } - - export interface SndCancelled extends Interface { - type: "sndCancelled" - } - - export interface SndComplete extends Interface { - type: "sndComplete" - } - - export interface SndError extends Interface { - type: "sndError" - sndFileError: FileError - } - - export interface SndWarning extends Interface { - type: "sndWarning" - sndFileError: FileError - } - - export interface RcvInvitation extends Interface { - type: "rcvInvitation" - } - - export interface RcvAccepted extends Interface { - type: "rcvAccepted" - } - - export interface RcvTransfer extends Interface { - type: "rcvTransfer" - rcvProgress: number // int64 - rcvTotal: number // int64 - } - - export interface RcvAborted extends Interface { - type: "rcvAborted" - } - - export interface RcvComplete extends Interface { - type: "rcvComplete" - } - - export interface RcvCancelled extends Interface { - type: "rcvCancelled" - } - - export interface RcvError extends Interface { - type: "rcvError" - rcvFileError: FileError - } - - export interface RcvWarning extends Interface { - type: "rcvWarning" - rcvFileError: FileError - } - - export interface Invalid extends Interface { - type: "invalid" - text: string - } -} - -export type CIForwardedFrom = - | CIForwardedFrom.Unknown - | CIForwardedFrom.Contact - | CIForwardedFrom.Group - | CIForwardedFrom.GroupLink - -export namespace CIForwardedFrom { - export type Tag = "unknown" | "contact" | "group" | "groupLink" - - interface Interface { - type: Tag - } - - export interface Unknown extends Interface { - type: "unknown" - } - - export interface Contact extends Interface { - type: "contact" - chatName: string - msgDir: MsgDirection - contactId?: number // int64 - chatItemId?: number // int64 - } - - export interface Group extends Interface { - type: "group" - chatName: string - msgDir: MsgDirection - groupId?: number // int64 - chatItemId?: number // int64 - memberId?: string - sharedMsgId_?: string - groupType?: GroupType - } - - export interface GroupLink extends Interface { - type: "groupLink" - chatName: string - msgDir: MsgDirection - groupLink: string - publicGroupId: string - memberId?: string - sharedMsgId: string - groupType?: GroupType - } -} - -export interface CIGroupInvitation { - groupId: number // int64 - groupMemberId: number // int64 - localDisplayName: string - groupProfile: GroupProfile - status: CIGroupInvitationStatus -} - -export enum CIGroupInvitationStatus { - Pending = "pending", - Accepted = "accepted", - Rejected = "rejected", - Expired = "expired", -} - -export interface CIMention { - memberId: string - memberRef?: CIMentionMember -} - -export interface CIMentionMember { - groupMemberId: number // int64 - displayName: string - localAlias?: string - memberRole: GroupMemberRole -} - -export interface CIMeta { - itemId: number // int64 - itemTs: string // ISO-8601 timestamp - itemText: string - itemStatus: CIStatus - sentViaProxy?: boolean - itemSharedMsgId?: string - itemForwarded?: CIForwardedFrom - itemDeleted?: CIDeleted - itemEdited: boolean - itemTimed?: CITimed - itemLive?: boolean - userMention: boolean - hasLink: boolean - deletable: boolean - editable: boolean - forwardedByMember?: number // int64 - showGroupAsSender: boolean - msgVerified?: MsgVerified - createdAt: string // ISO-8601 timestamp - updatedAt: string // ISO-8601 timestamp -} - -export interface CIQuote { - chatDir?: CIDirection - itemId?: number // int64 - sharedMsgId?: string - sentAt: string // ISO-8601 timestamp - content: MsgContent - formattedText?: FormattedText[] -} - -export interface CIReaction { - chatDir: CIDirection - chatItem: ChatItem - sentAt: string // ISO-8601 timestamp - reaction: MsgReaction -} - -export interface CIReactionCount { - reaction: MsgReaction - userReacted: boolean - totalReacted: number // int -} - -export type CIStatus = - | CIStatus.SndNew - | CIStatus.SndSent - | CIStatus.SndRcvd - | CIStatus.SndErrorAuth - | CIStatus.SndError - | CIStatus.SndWarning - | CIStatus.RcvNew - | CIStatus.RcvRead - | CIStatus.Invalid - -export namespace CIStatus { - export type Tag = - | "sndNew" - | "sndSent" - | "sndRcvd" - | "sndErrorAuth" - | "sndError" - | "sndWarning" - | "rcvNew" - | "rcvRead" - | "invalid" - - interface Interface { - type: Tag - } - - export interface SndNew extends Interface { - type: "sndNew" - } - - export interface SndSent extends Interface { - type: "sndSent" - sndProgress: SndCIStatusProgress - } - - export interface SndRcvd extends Interface { - type: "sndRcvd" - msgRcptStatus: MsgReceiptStatus - sndProgress: SndCIStatusProgress - } - - export interface SndErrorAuth extends Interface { - type: "sndErrorAuth" - } - - export interface SndError extends Interface { - type: "sndError" - agentError: SndError - } - - export interface SndWarning extends Interface { - type: "sndWarning" - agentError: SndError - } - - export interface RcvNew extends Interface { - type: "rcvNew" - } - - export interface RcvRead extends Interface { - type: "rcvRead" - } - - export interface Invalid extends Interface { - type: "invalid" - text: string - } -} - -export interface CITimed { - ttl: number // int - deleteAt?: string // ISO-8601 timestamp -} - -export type ChatBotCommand = ChatBotCommand.Command | ChatBotCommand.Menu - -export namespace ChatBotCommand { - export type Tag = "command" | "menu" - - interface Interface { - type: Tag - } - - export interface Command extends Interface { - type: "command" - keyword: string - label: string - params?: string - } - - export interface Menu extends Interface { - type: "menu" - label: string - commands: ChatBotCommand[] - } -} - -export type ChatDeleteMode = ChatDeleteMode.Full | ChatDeleteMode.Entity | ChatDeleteMode.Messages - -export namespace ChatDeleteMode { - export type Tag = "full" | "entity" | "messages" - - interface Interface { - type: Tag - } - - export interface Full extends Interface { - type: "full" - notify: boolean - } - - export interface Entity extends Interface { - type: "entity" - notify: boolean - } - - export interface Messages extends Interface { - type: "messages" - } - - export function cmdString(self: ChatDeleteMode): string { - return self.type + (self.type == 'messages' ? '' : (!self.notify ? ' notify=off' : '')) - } -} - -export type ChatError = ChatError.Error | ChatError.ErrorAgent | ChatError.ErrorStore - -export namespace ChatError { - export type Tag = "error" | "errorAgent" | "errorStore" - - interface Interface { - type: Tag - } - - export interface Error extends Interface { - type: "error" - errorType: ChatErrorType - } - - export interface ErrorAgent extends Interface { - type: "errorAgent" - agentError: AgentErrorType - agentConnId: string - connectionEntity_?: ConnectionEntity - } - - export interface ErrorStore extends Interface { - type: "errorStore" - storeError: StoreError - } -} - -export type ChatErrorType = - | ChatErrorType.NoActiveUser - | ChatErrorType.NoConnectionUser - | ChatErrorType.NoSndFileUser - | ChatErrorType.NoRcvFileUser - | ChatErrorType.UserUnknown - | ChatErrorType.UserExists - | ChatErrorType.ChatRelayExists - | ChatErrorType.DifferentActiveUser - | ChatErrorType.CantDeleteActiveUser - | ChatErrorType.CantDeleteLastUser - | ChatErrorType.CantHideLastUser - | ChatErrorType.HiddenUserAlwaysMuted - | ChatErrorType.EmptyUserPassword - | ChatErrorType.UserAlreadyHidden - | ChatErrorType.UserNotHidden - | ChatErrorType.InvalidDisplayName - | ChatErrorType.ChatNotStarted - | ChatErrorType.ChatNotStopped - | ChatErrorType.ChatStoreChanged - | ChatErrorType.InvalidConnReq - | ChatErrorType.SimplexDomainNotReady - | ChatErrorType.NotResolvedLocally - | ChatErrorType.UnsupportedConnReq - | ChatErrorType.ConnReqMessageProhibited - | ChatErrorType.ContactNotReady - | ChatErrorType.ContactNotActive - | ChatErrorType.ContactDisabled - | ChatErrorType.ConnectionDisabled - | ChatErrorType.GroupUserRole - | ChatErrorType.GroupMemberInitialRole - | ChatErrorType.ContactIncognitoCantInvite - | ChatErrorType.GroupIncognitoCantInvite - | ChatErrorType.GroupContactRole - | ChatErrorType.GroupDuplicateMember - | ChatErrorType.GroupDuplicateMemberId - | ChatErrorType.GroupNotJoined - | ChatErrorType.GroupMemberNotActive - | ChatErrorType.CantBlockMemberForSelf - | ChatErrorType.GroupMemberUserRemoved - | ChatErrorType.GroupMemberNotFound - | ChatErrorType.GroupCantResendInvitation - | ChatErrorType.GroupInternal - | ChatErrorType.FileNotFound - | ChatErrorType.FileSize - | ChatErrorType.FileAlreadyReceiving - | ChatErrorType.FileCancelled - | ChatErrorType.FileCancel - | ChatErrorType.FileAlreadyExists - | ChatErrorType.FileWrite - | ChatErrorType.FileSend - | ChatErrorType.FileRcvChunk - | ChatErrorType.FileInternal - | ChatErrorType.FileImageType - | ChatErrorType.FileImageSize - | ChatErrorType.FileNotReceived - | ChatErrorType.FileNotApproved - | ChatErrorType.FallbackToSMPProhibited - | ChatErrorType.InlineFileProhibited - | ChatErrorType.InvalidForward - | ChatErrorType.InvalidChatItemUpdate - | ChatErrorType.InvalidChatItemDelete - | ChatErrorType.HasCurrentCall - | ChatErrorType.NoCurrentCall - | ChatErrorType.CallContact - | ChatErrorType.DirectMessagesProhibited - | ChatErrorType.AgentVersion - | ChatErrorType.AgentNoSubResult - | ChatErrorType.CommandError - | ChatErrorType.BadgeRedeemError - | ChatErrorType.AgentCommandError - | ChatErrorType.InvalidFileDescription - | ChatErrorType.ConnectionIncognitoChangeProhibited - | ChatErrorType.ConnectionUserChangeProhibited - | ChatErrorType.PeerChatVRangeIncompatible - | ChatErrorType.RelayTestError - | ChatErrorType.InternalError - | ChatErrorType.Exception - -export namespace ChatErrorType { - export type Tag = - | "noActiveUser" - | "noConnectionUser" - | "noSndFileUser" - | "noRcvFileUser" - | "userUnknown" - | "userExists" - | "chatRelayExists" - | "differentActiveUser" - | "cantDeleteActiveUser" - | "cantDeleteLastUser" - | "cantHideLastUser" - | "hiddenUserAlwaysMuted" - | "emptyUserPassword" - | "userAlreadyHidden" - | "userNotHidden" - | "invalidDisplayName" - | "chatNotStarted" - | "chatNotStopped" - | "chatStoreChanged" - | "invalidConnReq" - | "simplexDomainNotReady" - | "notResolvedLocally" - | "unsupportedConnReq" - | "connReqMessageProhibited" - | "contactNotReady" - | "contactNotActive" - | "contactDisabled" - | "connectionDisabled" - | "groupUserRole" - | "groupMemberInitialRole" - | "contactIncognitoCantInvite" - | "groupIncognitoCantInvite" - | "groupContactRole" - | "groupDuplicateMember" - | "groupDuplicateMemberId" - | "groupNotJoined" - | "groupMemberNotActive" - | "cantBlockMemberForSelf" - | "groupMemberUserRemoved" - | "groupMemberNotFound" - | "groupCantResendInvitation" - | "groupInternal" - | "fileNotFound" - | "fileSize" - | "fileAlreadyReceiving" - | "fileCancelled" - | "fileCancel" - | "fileAlreadyExists" - | "fileWrite" - | "fileSend" - | "fileRcvChunk" - | "fileInternal" - | "fileImageType" - | "fileImageSize" - | "fileNotReceived" - | "fileNotApproved" - | "fallbackToSMPProhibited" - | "inlineFileProhibited" - | "invalidForward" - | "invalidChatItemUpdate" - | "invalidChatItemDelete" - | "hasCurrentCall" - | "noCurrentCall" - | "callContact" - | "directMessagesProhibited" - | "agentVersion" - | "agentNoSubResult" - | "commandError" - | "badgeRedeemError" - | "agentCommandError" - | "invalidFileDescription" - | "connectionIncognitoChangeProhibited" - | "connectionUserChangeProhibited" - | "peerChatVRangeIncompatible" - | "relayTestError" - | "internalError" - | "exception" - - interface Interface { - type: Tag - } - - export interface NoActiveUser extends Interface { - type: "noActiveUser" - } - - export interface NoConnectionUser extends Interface { - type: "noConnectionUser" - agentConnId: string - } - - export interface NoSndFileUser extends Interface { - type: "noSndFileUser" - agentSndFileId: string - } - - export interface NoRcvFileUser extends Interface { - type: "noRcvFileUser" - agentRcvFileId: string - } - - export interface UserUnknown extends Interface { - type: "userUnknown" - } - - export interface UserExists extends Interface { - type: "userExists" - contactName: string - } - - export interface ChatRelayExists extends Interface { - type: "chatRelayExists" - } - - export interface DifferentActiveUser extends Interface { - type: "differentActiveUser" - commandUserId: number // int64 - activeUserId: number // int64 - } - - export interface CantDeleteActiveUser extends Interface { - type: "cantDeleteActiveUser" - userId: number // int64 - } - - export interface CantDeleteLastUser extends Interface { - type: "cantDeleteLastUser" - userId: number // int64 - } - - export interface CantHideLastUser extends Interface { - type: "cantHideLastUser" - userId: number // int64 - } - - export interface HiddenUserAlwaysMuted extends Interface { - type: "hiddenUserAlwaysMuted" - userId: number // int64 - } - - export interface EmptyUserPassword extends Interface { - type: "emptyUserPassword" - userId: number // int64 - } - - export interface UserAlreadyHidden extends Interface { - type: "userAlreadyHidden" - userId: number // int64 - } - - export interface UserNotHidden extends Interface { - type: "userNotHidden" - userId: number // int64 - } - - export interface InvalidDisplayName extends Interface { - type: "invalidDisplayName" - displayName: string - validName: string - } - - export interface ChatNotStarted extends Interface { - type: "chatNotStarted" - } - - export interface ChatNotStopped extends Interface { - type: "chatNotStopped" - } - - export interface ChatStoreChanged extends Interface { - type: "chatStoreChanged" - } - - export interface InvalidConnReq extends Interface { - type: "invalidConnReq" - } - - export interface SimplexDomainNotReady extends Interface { - type: "simplexDomainNotReady" - simplexDomain: SimplexDomain - simplexDomainError: SimplexDomainError - } - - export interface NotResolvedLocally extends Interface { - type: "notResolvedLocally" - } - - export interface UnsupportedConnReq extends Interface { - type: "unsupportedConnReq" - } - - export interface ConnReqMessageProhibited extends Interface { - type: "connReqMessageProhibited" - } - - export interface ContactNotReady extends Interface { - type: "contactNotReady" - contact: Contact - } - - export interface ContactNotActive extends Interface { - type: "contactNotActive" - contact: Contact - } - - export interface ContactDisabled extends Interface { - type: "contactDisabled" - contact: Contact - } - - export interface ConnectionDisabled extends Interface { - type: "connectionDisabled" - connection: Connection - } - - export interface GroupUserRole extends Interface { - type: "groupUserRole" - groupInfo: GroupInfo - requiredRole: GroupMemberRole - } - - export interface GroupMemberInitialRole extends Interface { - type: "groupMemberInitialRole" - groupInfo: GroupInfo - initialRole: GroupMemberRole - } - - export interface ContactIncognitoCantInvite extends Interface { - type: "contactIncognitoCantInvite" - } - - export interface GroupIncognitoCantInvite extends Interface { - type: "groupIncognitoCantInvite" - } - - export interface GroupContactRole extends Interface { - type: "groupContactRole" - contactName: string - } - - export interface GroupDuplicateMember extends Interface { - type: "groupDuplicateMember" - contactName: string - } - - export interface GroupDuplicateMemberId extends Interface { - type: "groupDuplicateMemberId" - } - - export interface GroupNotJoined extends Interface { - type: "groupNotJoined" - groupInfo: GroupInfo - } - - export interface GroupMemberNotActive extends Interface { - type: "groupMemberNotActive" - } - - export interface CantBlockMemberForSelf extends Interface { - type: "cantBlockMemberForSelf" - groupInfo: GroupInfo - member: GroupMember - setShowMessages: boolean - } - - export interface GroupMemberUserRemoved extends Interface { - type: "groupMemberUserRemoved" - } - - export interface GroupMemberNotFound extends Interface { - type: "groupMemberNotFound" - } - - export interface GroupCantResendInvitation extends Interface { - type: "groupCantResendInvitation" - groupInfo: GroupInfo - contactName: string - } - - export interface GroupInternal extends Interface { - type: "groupInternal" - message: string - } - - export interface FileNotFound extends Interface { - type: "fileNotFound" - message: string - } - - export interface FileSize extends Interface { - type: "fileSize" - filePath: string - } - - export interface FileAlreadyReceiving extends Interface { - type: "fileAlreadyReceiving" - message: string - } - - export interface FileCancelled extends Interface { - type: "fileCancelled" - message: string - } - - export interface FileCancel extends Interface { - type: "fileCancel" - fileId: number // int64 - message: string - } - - export interface FileAlreadyExists extends Interface { - type: "fileAlreadyExists" - filePath: string - } - - export interface FileWrite extends Interface { - type: "fileWrite" - filePath: string - message: string - } - - export interface FileSend extends Interface { - type: "fileSend" - fileId: number // int64 - agentError: AgentErrorType - } - - export interface FileRcvChunk extends Interface { - type: "fileRcvChunk" - message: string - } - - export interface FileInternal extends Interface { - type: "fileInternal" - message: string - } - - export interface FileImageType extends Interface { - type: "fileImageType" - filePath: string - } - - export interface FileImageSize extends Interface { - type: "fileImageSize" - filePath: string - } - - export interface FileNotReceived extends Interface { - type: "fileNotReceived" - fileId: number // int64 - } - - export interface FileNotApproved extends Interface { - type: "fileNotApproved" - fileId: number // int64 - unknownServers: string[] - } - - export interface FallbackToSMPProhibited extends Interface { - type: "fallbackToSMPProhibited" - fileId: number // int64 - } - - export interface InlineFileProhibited extends Interface { - type: "inlineFileProhibited" - fileId: number // int64 - } - - export interface InvalidForward extends Interface { - type: "invalidForward" - } - - export interface InvalidChatItemUpdate extends Interface { - type: "invalidChatItemUpdate" - } - - export interface InvalidChatItemDelete extends Interface { - type: "invalidChatItemDelete" - } - - export interface HasCurrentCall extends Interface { - type: "hasCurrentCall" - } - - export interface NoCurrentCall extends Interface { - type: "noCurrentCall" - } - - export interface CallContact extends Interface { - type: "callContact" - contactId: number // int64 - } - - export interface DirectMessagesProhibited extends Interface { - type: "directMessagesProhibited" - direction: MsgDirection - contact: Contact - } - - export interface AgentVersion extends Interface { - type: "agentVersion" - } - - export interface AgentNoSubResult extends Interface { - type: "agentNoSubResult" - agentConnId: string - } - - export interface CommandError extends Interface { - type: "commandError" - message: string - } - - export interface BadgeRedeemError extends Interface { - type: "badgeRedeemError" - badgeRedeemError: BadgeRedeemError - } - - export interface AgentCommandError extends Interface { - type: "agentCommandError" - message: string - } - - export interface InvalidFileDescription extends Interface { - type: "invalidFileDescription" - message: string - } - - export interface ConnectionIncognitoChangeProhibited extends Interface { - type: "connectionIncognitoChangeProhibited" - } - - export interface ConnectionUserChangeProhibited extends Interface { - type: "connectionUserChangeProhibited" - } - - export interface PeerChatVRangeIncompatible extends Interface { - type: "peerChatVRangeIncompatible" - } - - export interface RelayTestError extends Interface { - type: "relayTestError" - message: string - } - - export interface InternalError extends Interface { - type: "internalError" - message: string - } - - export interface Exception extends Interface { - type: "exception" - message: string - } -} - -export enum ChatFeature { - TimedMessages = "timedMessages", - FullDelete = "fullDelete", - Reactions = "reactions", - Voice = "voice", - Files = "files", - Calls = "calls", - Sessions = "sessions", -} - -export type ChatInfo = - | ChatInfo.Direct - | ChatInfo.Group - | ChatInfo.Local - | ChatInfo.ContactRequest - | ChatInfo.ContactConnection - -export namespace ChatInfo { - export type Tag = "direct" | "group" | "local" | "contactRequest" | "contactConnection" - - interface Interface { - type: Tag - } - - export interface Direct extends Interface { - type: "direct" - contact: Contact - } - - export interface Group extends Interface { - type: "group" - groupInfo: GroupInfo - groupChatScope?: GroupChatScopeInfo - } - - export interface Local extends Interface { - type: "local" - noteFolder: NoteFolder - } - - export interface ContactRequest extends Interface { - type: "contactRequest" - contactRequest: UserContactRequest - } - - export interface ContactConnection extends Interface { - type: "contactConnection" - contactConnection: PendingContactConnection - } -} - -export interface ChatItem { - chatDir: CIDirection - meta: CIMeta - content: CIContent - mentions: {[key: string]: CIMention} - formattedText?: FormattedText[] - quotedItem?: CIQuote - reactions: CIReactionCount[] - file?: CIFile -} -// Message deletion result. - -export interface ChatItemDeletion { - deletedChatItem: AChatItem - toChatItem?: AChatItem -} - -export type ChatListQuery = ChatListQuery.Filters | ChatListQuery.Search - -export namespace ChatListQuery { - export type Tag = "filters" | "search" - - interface Interface { - type: Tag - } - - export interface Filters extends Interface { - type: "filters" - favorite: boolean - unread: boolean - } - - export interface Search extends Interface { - type: "search" - search: string - } -} - -export enum ChatPeerType { - Human = "human", - Bot = "bot", - Business = "business", -} -// Used in API commands. Chat scope can only be passed with groups. - -export interface ChatRef { - chatType: ChatType - chatId: number // int64 - chatScope?: GroupChatScope -} - -export namespace ChatRef { - export function cmdString(self: ChatRef): string { - return ChatType.cmdString(self.chatType) + self.chatId + (self.chatScope ? GroupChatScope.cmdString(self.chatScope) : '') - } -} - -export interface ChatSettings { - enableNtfs: MsgFilter - sendRcpts?: boolean - favorite: boolean -} - -export interface ChatStats { - unreadCount: number // int - unreadMentions: number // int - reportsCount: number // int - minUnreadItemId: number // int64 - unreadChat: boolean -} - -export enum ChatType { - Direct = "direct", - Group = "group", - Local = "local", -} - -export namespace ChatType { - export function cmdString(self: ChatType): string { - return self == 'direct' ? '@' : self == 'group' ? '#' : self == 'local' ? '*' : '' - } -} - -export interface ChatWallpaper { - preset?: string - imageFile?: string - background?: string - tint?: string - scaleType?: ChatWallpaperScale - scale?: number // double -} - -export enum ChatWallpaperScale { - Fill = "fill", - Fit = "fit", - Repeat = "repeat", -} - -export interface ClientNotice { - ttl?: number // int64 -} - -export enum Color { - Black = "black", - Red = "red", - Green = "green", - Yellow = "yellow", - Blue = "blue", - Magenta = "magenta", - Cyan = "cyan", - White = "white", -} - -export type CommandError = - | CommandError.UNKNOWN - | CommandError.SYNTAX - | CommandError.PROHIBITED - | CommandError.NO_AUTH - | CommandError.HAS_AUTH - | CommandError.NO_ENTITY - -export namespace CommandError { - export type Tag = "UNKNOWN" | "SYNTAX" | "PROHIBITED" | "NO_AUTH" | "HAS_AUTH" | "NO_ENTITY" - - interface Interface { - type: Tag - } - - export interface UNKNOWN extends Interface { - type: "UNKNOWN" - } - - export interface SYNTAX extends Interface { - type: "SYNTAX" - } - - export interface PROHIBITED extends Interface { - type: "PROHIBITED" - } - - export interface NO_AUTH extends Interface { - type: "NO_AUTH" - } - - export interface HAS_AUTH extends Interface { - type: "HAS_AUTH" - } - - export interface NO_ENTITY extends Interface { - type: "NO_ENTITY" - } -} - -export type CommandErrorType = - | CommandErrorType.PROHIBITED - | CommandErrorType.SYNTAX - | CommandErrorType.NO_CONN - | CommandErrorType.SIZE - | CommandErrorType.LARGE - -export namespace CommandErrorType { - export type Tag = "PROHIBITED" | "SYNTAX" | "NO_CONN" | "SIZE" | "LARGE" - - interface Interface { - type: Tag - } - - export interface PROHIBITED extends Interface { - type: "PROHIBITED" - } - - export interface SYNTAX extends Interface { - type: "SYNTAX" - } - - export interface NO_CONN extends Interface { - type: "NO_CONN" - } - - export interface SIZE extends Interface { - type: "SIZE" - } - - export interface LARGE extends Interface { - type: "LARGE" - } -} - -export interface CommentsGroupPreference { - enable: GroupFeatureEnabled - duration?: number // int -} - -export interface ComposedMessage { - fileSource?: CryptoFile - quotedItemId?: number // int64 - msgContent: MsgContent - mentions: {[key: string]: number} // string : int64 -} - -export type ConnStatus = - | ConnStatus.New - | ConnStatus.Prepared - | ConnStatus.Joined - | ConnStatus.Requested - | ConnStatus.Accepted - | ConnStatus.SndReady - | ConnStatus.Ready - | ConnStatus.Deleted - | ConnStatus.Failed - -export namespace ConnStatus { - export type Tag = - | "new" - | "prepared" - | "joined" - | "requested" - | "accepted" - | "sndReady" - | "ready" - | "deleted" - | "failed" - - interface Interface { - type: Tag - } - - export interface New extends Interface { - type: "new" - } - - export interface Prepared extends Interface { - type: "prepared" - } - - export interface Joined extends Interface { - type: "joined" - } - - export interface Requested extends Interface { - type: "requested" - } - - export interface Accepted extends Interface { - type: "accepted" - } - - export interface SndReady extends Interface { - type: "sndReady" - } - - export interface Ready extends Interface { - type: "ready" - } - - export interface Deleted extends Interface { - type: "deleted" - } - - export interface Failed extends Interface { - type: "failed" - connError: string - } -} - -export enum ConnType { - Contact = "contact", - Member = "member", - User_contact = "user_contact", -} - -export interface Connection { - connId: number // int64 - agentConnId: string - connChatVersion: number // int - peerChatVRange: VersionRange - connLevel: number // int - viaContact?: number // int64 - viaUserContactLink?: number // int64 - viaGroupLink: boolean - groupLinkId?: string - xContactId?: string - customUserProfileId?: number // int64 - connType: ConnType - connStatus: ConnStatus - contactConnInitiated: boolean - localAlias: string - entityId?: number // int64 - connectionCode?: SecurityCode - pqSupport: boolean - pqEncryption: boolean - pqSndEnabled?: boolean - pqRcvEnabled?: boolean - authErrCounter: number // int - quotaErrCounter: number // int - createdAt: string // ISO-8601 timestamp -} - -export type ConnectionEntity = - | ConnectionEntity.RcvDirectMsgConnection - | ConnectionEntity.RcvGroupMsgConnection - | ConnectionEntity.UserContactConnection - -export namespace ConnectionEntity { - export type Tag = "rcvDirectMsgConnection" | "rcvGroupMsgConnection" | "userContactConnection" - - interface Interface { - type: Tag - } - - export interface RcvDirectMsgConnection extends Interface { - type: "rcvDirectMsgConnection" - entityConnection: Connection - contact?: Contact - } - - export interface RcvGroupMsgConnection extends Interface { - type: "rcvGroupMsgConnection" - entityConnection: Connection - groupInfo: GroupInfo - groupMember: GroupMember - } - - export interface UserContactConnection extends Interface { - type: "userContactConnection" - entityConnection: Connection - userContact: UserContact - } -} - -export type ConnectionErrorType = - | ConnectionErrorType.NOT_FOUND - | ConnectionErrorType.DUPLICATE - | ConnectionErrorType.SIMPLEX - | ConnectionErrorType.NOT_ACCEPTED - | ConnectionErrorType.NOT_AVAILABLE - -export namespace ConnectionErrorType { - export type Tag = "NOT_FOUND" | "DUPLICATE" | "SIMPLEX" | "NOT_ACCEPTED" | "NOT_AVAILABLE" - - interface Interface { - type: Tag - } - - export interface NOT_FOUND extends Interface { - type: "NOT_FOUND" - } - - export interface DUPLICATE extends Interface { - type: "DUPLICATE" - } - - export interface SIMPLEX extends Interface { - type: "SIMPLEX" - } - - export interface NOT_ACCEPTED extends Interface { - type: "NOT_ACCEPTED" - } - - export interface NOT_AVAILABLE extends Interface { - type: "NOT_AVAILABLE" - } -} - -export enum ConnectionMode { - INV = "inv", - CON = "con", -} - -export type ConnectionPlan = - | ConnectionPlan.InvitationLink - | ConnectionPlan.ContactAddress - | ConnectionPlan.GroupLink - | ConnectionPlan.Error - -export namespace ConnectionPlan { - export type Tag = "invitationLink" | "contactAddress" | "groupLink" | "error" - - interface Interface { - type: Tag - } - - export interface InvitationLink extends Interface { - type: "invitationLink" - invitationLinkPlan: InvitationLinkPlan - } - - export interface ContactAddress extends Interface { - type: "contactAddress" - contactAddressPlan: ContactAddressPlan - } - - export interface GroupLink extends Interface { - type: "groupLink" - groupLinkPlan: GroupLinkPlan - } - - export interface Error extends Interface { - type: "error" - chatError: ChatError - } -} - -export interface Contact { - contactId: number // int64 - localDisplayName: string - profile: LocalProfile - activeConn?: Connection - contactUsed: boolean - contactStatus: ContactStatus - chatSettings: ChatSettings - userPreferences: Preferences - mergedPreferences: ContactUserPreferences - createdAt: string // ISO-8601 timestamp - updatedAt: string // ISO-8601 timestamp - chatTs?: string // ISO-8601 timestamp - preparedContact?: PreparedContact - contactRequestId?: number // int64 - contactRequest?: UserContactRequestRef - contactGroupMemberId?: number // int64 - contactGrpInvSent: boolean - groupDirectInv?: GroupDirectInvitation - chatTags: number[] // int64 - chatItemTTL?: number // int64 - uiThemes?: UIThemeEntityOverrides - chatDeleted: boolean - customData?: object -} - -export type ContactAddressPlan = - | ContactAddressPlan.Ok - | ContactAddressPlan.OwnLink - | ContactAddressPlan.ConnectingConfirmReconnect - | ContactAddressPlan.ConnectingProhibit - | ContactAddressPlan.Known - | ContactAddressPlan.ContactViaAddress - -export namespace ContactAddressPlan { - export type Tag = - | "ok" - | "ownLink" - | "connectingConfirmReconnect" - | "connectingProhibit" - | "known" - | "contactViaAddress" - - interface Interface { - type: Tag - } - - export interface Ok extends Interface { - type: "ok" - contactSLinkData_?: ContactShortLinkData - ownerVerification?: OwnerVerification - } - - export interface OwnLink extends Interface { - type: "ownLink" - } - - export interface ConnectingConfirmReconnect extends Interface { - type: "connectingConfirmReconnect" - } - - export interface ConnectingProhibit extends Interface { - type: "connectingProhibit" - contact: Contact - } - - export interface Known extends Interface { - type: "known" - contact: Contact - } - - export interface ContactViaAddress extends Interface { - type: "contactViaAddress" - contact: Contact - } -} - -export interface ContactShortLinkData { - profile: Profile - message?: MsgContent - business: boolean - localBadge?: LocalBadge -} - -export enum ContactStatus { - Active = "active", - Deleted = "deleted", - DeletedByUser = "deletedByUser", - Rejected = "rejected", -} - -export type ContactUserPref = ContactUserPref.Contact | ContactUserPref.User - -export namespace ContactUserPref { - export type Tag = "contact" | "user" - - interface Interface { - type: Tag - } - - export interface Contact extends Interface { - type: "contact" - preference: SimplePreference - } - - export interface User extends Interface { - type: "user" - preference: SimplePreference - } -} - -export interface ContactUserPreference { - enabled: PrefEnabled - userPreference: ContactUserPref - contactPreference: SimplePreference -} - -export interface ContactUserPreferences { - timedMessages: ContactUserPreference - fullDelete: ContactUserPreference - reactions: ContactUserPreference - voice: ContactUserPreference - files: ContactUserPreference - calls: ContactUserPreference - sessions: ContactUserPreference - commands?: ChatBotCommand[] -} - -export interface CreatedConnLink { - connFullLink: string - connShortLink?: string -} - -export namespace CreatedConnLink { - export function cmdString(self: CreatedConnLink): string { - return self.connFullLink + (self.connShortLink ? ' ' + self.connShortLink : '') - } -} - -export interface CryptoFile { - filePath: string - cryptoArgs?: CryptoFileArgs -} - -export interface CryptoFileArgs { - fileKey: string - fileNonce: string -} -// Remote controller application info. - -export interface CtrlAppInfo { - appVersionRange: AppVersionRange - deviceName: string - compression: boolean -} - -export interface DroppedMsg { - brokerTs: string // ISO-8601 timestamp - attempts: number // int -} - -export interface E2EInfo { - public?: boolean - pqEnabled?: boolean -} - -export type ErrorType = - | ErrorType.BLOCK - | ErrorType.SESSION - | ErrorType.CMD - | ErrorType.PROXY - | ErrorType.AUTH - | ErrorType.BLOCKED - | ErrorType.SERVICE - | ErrorType.CRYPTO - | ErrorType.QUOTA - | ErrorType.STORE - | ErrorType.NO_MSG - | ErrorType.LARGE_MSG - | ErrorType.EXPIRED - | ErrorType.INTERNAL - | ErrorType.NAME - | ErrorType.DUPLICATE_ - -export namespace ErrorType { - export type Tag = - | "BLOCK" - | "SESSION" - | "CMD" - | "PROXY" - | "AUTH" - | "BLOCKED" - | "SERVICE" - | "CRYPTO" - | "QUOTA" - | "STORE" - | "NO_MSG" - | "LARGE_MSG" - | "EXPIRED" - | "INTERNAL" - | "NAME" - | "DUPLICATE_" - - interface Interface { - type: Tag - } - - export interface BLOCK extends Interface { - type: "BLOCK" - } - - export interface SESSION extends Interface { - type: "SESSION" - } - - export interface CMD extends Interface { - type: "CMD" - cmdErr: CommandError - } - - export interface PROXY extends Interface { - type: "PROXY" - proxyErr: ProxyError - } - - export interface AUTH extends Interface { - type: "AUTH" - } - - export interface BLOCKED extends Interface { - type: "BLOCKED" - blockInfo: BlockingInfo - } - - export interface SERVICE extends Interface { - type: "SERVICE" - } - - export interface CRYPTO extends Interface { - type: "CRYPTO" - } - - export interface QUOTA extends Interface { - type: "QUOTA" - } - - export interface STORE extends Interface { - type: "STORE" - storeErr: string - } - - export interface NO_MSG extends Interface { - type: "NO_MSG" - } - - export interface LARGE_MSG extends Interface { - type: "LARGE_MSG" - } - - export interface EXPIRED extends Interface { - type: "EXPIRED" - } - - export interface INTERNAL extends Interface { - type: "INTERNAL" - } - - export interface NAME extends Interface { - type: "NAME" - nameErr: NameErrorType - } - - export interface DUPLICATE_ extends Interface { - type: "DUPLICATE_" - } -} - -export enum FeatureAllowed { - Always = "always", - Yes = "yes", - No = "no", -} - -export interface FileDescr { - fileDescrText: string - fileDescrPartNo: number // int - fileDescrComplete: boolean -} - -export type FileError = - | FileError.Auth - | FileError.Blocked - | FileError.NoFile - | FileError.Relay - | FileError.Other - -export namespace FileError { - export type Tag = "auth" | "blocked" | "noFile" | "relay" | "other" - - interface Interface { - type: Tag - } - - export interface Auth extends Interface { - type: "auth" - } - - export interface Blocked extends Interface { - type: "blocked" - server: string - blockInfo: BlockingInfo - } - - export interface NoFile extends Interface { - type: "noFile" - } - - export interface Relay extends Interface { - type: "relay" - srvError: SrvError - } - - export interface Other extends Interface { - type: "other" - fileError: string - } -} - -export type FileErrorType = - | FileErrorType.NOT_APPROVED - | FileErrorType.SIZE - | FileErrorType.REDIRECT - | FileErrorType.FILE_IO - | FileErrorType.NO_FILE - -export namespace FileErrorType { - export type Tag = "NOT_APPROVED" | "SIZE" | "REDIRECT" | "FILE_IO" | "NO_FILE" - - interface Interface { - type: Tag - } - - export interface NOT_APPROVED extends Interface { - type: "NOT_APPROVED" - } - - export interface SIZE extends Interface { - type: "SIZE" - } - - export interface REDIRECT extends Interface { - type: "REDIRECT" - redirectError: string - } - - export interface FILE_IO extends Interface { - type: "FILE_IO" - fileIOError: string - } - - export interface NO_FILE extends Interface { - type: "NO_FILE" - } -} - -export interface FileInvitation { - fileName: string - fileSize: number // int64 - fileDigest?: string - fileConnReq?: string - fileInline?: InlineFileMode - fileDescr?: FileDescr - fileBadge?: BadgeProof -} - -export interface FileProhibited { - maxSize: number // int64 - badgeStatus?: BadgeStatus -} - -export enum FileProtocol { - SMP = "smp", - XFTP = "xftp", - LOCAL = "local", -} - -export enum FileStatus { - New = "new", - Accepted = "accepted", - Connected = "connected", - Complete = "complete", - Cancelled = "cancelled", -} - -export interface FileTransferMeta { - fileId: number // int64 - xftpSndFile?: XFTPSndFile - xftpRedirectFor?: number // int64 - fileName: string - filePath: string - fileSize: number // int64 - fileInline?: InlineFileMode - chunkSize: number // int64 - cancelled: boolean -} - -export enum FileType { - Normal = "normal", - Roster = "roster", -} - -export type Format = - | Format.Bold - | Format.Italic - | Format.StrikeThrough - | Format.Snippet - | Format.Secret - | Format.Small - | Format.Colored - | Format.Uri - | Format.HyperLink - | Format.SimplexLink - | Format.SimplexName - | Format.Command - | Format.Mention - | Format.Email - | Format.Phone - -export namespace Format { - export type Tag = - | "bold" - | "italic" - | "strikeThrough" - | "snippet" - | "secret" - | "small" - | "colored" - | "uri" - | "hyperLink" - | "simplexLink" - | "simplexName" - | "command" - | "mention" - | "email" - | "phone" - - interface Interface { - type: Tag - } - - export interface Bold extends Interface { - type: "bold" - } - - export interface Italic extends Interface { - type: "italic" - } - - export interface StrikeThrough extends Interface { - type: "strikeThrough" - } - - export interface Snippet extends Interface { - type: "snippet" - } - - export interface Secret extends Interface { - type: "secret" - } - - export interface Small extends Interface { - type: "small" - } - - export interface Colored extends Interface { - type: "colored" - color: Color - } - - export interface Uri extends Interface { - type: "uri" - } - - export interface HyperLink extends Interface { - type: "hyperLink" - showText?: string - linkUri: string - } - - export interface SimplexLink extends Interface { - type: "simplexLink" - showText?: string - linkType: SimplexLinkType - simplexUri: string - smpHosts: string[] // non-empty - } - - export interface SimplexName extends Interface { - type: "simplexName" - nameInfo: SimplexNameInfo - } - - export interface Command extends Interface { - type: "command" - commandStr: string - } - - export interface Mention extends Interface { - type: "mention" - memberName: string - } - - export interface Email extends Interface { - type: "email" - } - - export interface Phone extends Interface { - type: "phone" - } -} - -export interface FormattedText { - format?: Format - text: string -} - -export interface FullGroupPreferences { - timedMessages: TimedMessagesGroupPreference - directMessages: RoleGroupPreference - fullDelete: GroupPreference - reactions: GroupPreference - voice: RoleGroupPreference - files: RoleGroupPreference - simplexLinks: RoleGroupPreference - reports: GroupPreference - history: GroupPreference - support: SupportGroupPreference - sessions: RoleGroupPreference - comments: CommentsGroupPreference - signMessages: GroupPreference - commands: ChatBotCommand[] -} - -export interface FullPreferences { - timedMessages: TimedMessagesPreference - fullDelete: SimplePreference - reactions: SimplePreference - voice: SimplePreference - files: SimplePreference - calls: SimplePreference - sessions: SimplePreference - commands: ChatBotCommand[] -} - -export interface Group { - groupInfo: GroupInfo - members: GroupMember[] -} - -export type GroupChatScope = GroupChatScope.MemberSupport - -export namespace GroupChatScope { - export type Tag = "memberSupport" - - interface Interface { - type: Tag - } - - export interface MemberSupport extends Interface { - type: "memberSupport" - groupMemberId_?: number // int64 - } - - export function cmdString(self: GroupChatScope): string { - return '(_support' + (self.groupMemberId_ ? ':' + self.groupMemberId_ : '') + ')' - } -} - -export type GroupChatScopeInfo = GroupChatScopeInfo.MemberSupport - -export namespace GroupChatScopeInfo { - export type Tag = "memberSupport" - - interface Interface { - type: Tag - } - - export interface MemberSupport extends Interface { - type: "memberSupport" - groupMember_?: GroupMember - } -} - -export interface GroupDirectInvitation { - groupDirectInvLink: string - fromGroupId_?: number // int64 - fromGroupMemberId_?: number // int64 - fromGroupMemberConnId_?: number // int64 - groupDirectInvStartedConnection: boolean -} - -export enum GroupFeature { - TimedMessages = "timedMessages", - DirectMessages = "directMessages", - FullDelete = "fullDelete", - Reactions = "reactions", - Voice = "voice", - Files = "files", - SimplexLinks = "simplexLinks", - Reports = "reports", - History = "history", - Support = "support", - Sessions = "sessions", - Comments = "comments", - SignMessages = "signMessages", -} - -export enum GroupFeatureEnabled { - On = "on", - Off = "off", -} - -export interface GroupInfo { - groupId: number // int64 - useRelays: boolean - relayOwnStatus?: RelayStatus - localDisplayName: string - groupProfile: GroupProfile - localAlias: string - businessChat?: BusinessChatInfo - fullGroupPreferences: FullGroupPreferences - membership: GroupMember - chatSettings: ChatSettings - createdAt: string // ISO-8601 timestamp - updatedAt: string // ISO-8601 timestamp - chatTs?: string // ISO-8601 timestamp - userMemberProfileSentAt?: string // ISO-8601 timestamp - preparedGroup?: PreparedGroup - chatTags: number[] // int64 - chatItemTTL?: number // int64 - uiThemes?: UIThemeEntityOverrides - customData?: object - groupSummary: GroupSummary - rosterVersion?: number // int64 - membersRequireAttention: number // int - viaGroupLinkUri?: string - groupDomainVerified?: boolean -} - -export interface GroupLink { - userContactLinkId: number // int64 - connLinkContact: CreatedConnLink - shortLinkDataSet: boolean - shortLinkLargeDataSet: boolean - groupLinkId: string - acceptMemberRole: GroupMemberRole -} - -export interface GroupLinkOwner { - memberId: string - memberKey: string -} - -export type GroupLinkPlan = - | GroupLinkPlan.Ok - | GroupLinkPlan.OwnLink - | GroupLinkPlan.ConnectingConfirmReconnect - | GroupLinkPlan.ConnectingProhibit - | GroupLinkPlan.Known - | GroupLinkPlan.NoRelays - | GroupLinkPlan.UpdateRequired - -export namespace GroupLinkPlan { - export type Tag = - | "ok" - | "ownLink" - | "connectingConfirmReconnect" - | "connectingProhibit" - | "known" - | "noRelays" - | "updateRequired" - - interface Interface { - type: Tag - } - - export interface Ok extends Interface { - type: "ok" - groupSLinkInfo_?: GroupShortLinkInfo - groupSLinkData_?: GroupShortLinkData - ownerVerification?: OwnerVerification - } - - export interface OwnLink extends Interface { - type: "ownLink" - groupInfo: GroupInfo - } - - export interface ConnectingConfirmReconnect extends Interface { - type: "connectingConfirmReconnect" - } - - export interface ConnectingProhibit extends Interface { - type: "connectingProhibit" - groupInfo_?: GroupInfo - } - - export interface Known extends Interface { - type: "known" - groupInfo: GroupInfo - groupUpdated: boolean - ownerVerification?: OwnerVerification - linkOwners: GroupLinkOwner[] - } - - export interface NoRelays extends Interface { - type: "noRelays" - groupSLinkData_?: GroupShortLinkData - } - - export interface UpdateRequired extends Interface { - type: "updateRequired" - groupSLinkData_?: GroupShortLinkData - } -} - -export interface GroupMember { - groupMemberId: number // int64 - groupId: number // int64 - indexInGroup: number // int64 - memberId: string - memberRole: GroupMemberRole - memberCategory: GroupMemberCategory - memberStatus: GroupMemberStatus - memberSettings: GroupMemberSettings - blockedByAdmin: boolean - invitedBy: InvitedBy - invitedByGroupMemberId?: number // int64 - localDisplayName: string - memberProfile: LocalProfile - memberContactId?: number // int64 - memberContactProfileId: number // int64 - activeConn?: Connection - memberChatVRange: VersionRange - createdAt: string // ISO-8601 timestamp - updatedAt: string // ISO-8601 timestamp - supportChat?: GroupSupportChat - memberPubKey?: string - relayLink?: string - memberVerifiedCode?: SecurityCode -} - -export interface GroupMemberAdmission { - review?: MemberCriteria -} - -export enum GroupMemberCategory { - User = "user", - Invitee = "invitee", - Host = "host", - Pre = "pre", - Post = "post", -} - -export interface GroupMemberRef { - groupMemberId: number // int64 - profile: Profile -} - -export enum GroupMemberRole { - Relay = "relay", - Observer = "observer", - Author = "author", - Member = "member", - Moderator = "moderator", - Admin = "admin", - Owner = "owner", -} - -export interface GroupMemberSettings { - showMessages: boolean -} - -export enum GroupMemberStatus { - Rejected = "rejected", - Removed = "removed", - Left = "left", - Deleted = "deleted", - Unknown = "unknown", - Invited = "invited", - Pending_approval = "pending_approval", - Pending_review = "pending_review", - Introduced = "introduced", - Intro_inv = "intro-inv", - Accepted = "accepted", - Announced = "announced", - Connected = "connected", - Complete = "complete", - Creator = "creator", -} - -export interface GroupPreference { - enable: GroupFeatureEnabled -} - -export interface GroupPreferences { - timedMessages?: TimedMessagesGroupPreference - directMessages?: RoleGroupPreference - fullDelete?: GroupPreference - reactions?: GroupPreference - voice?: RoleGroupPreference - files?: RoleGroupPreference - simplexLinks?: RoleGroupPreference - reports?: GroupPreference - history?: GroupPreference - support?: SupportGroupPreference - sessions?: RoleGroupPreference - comments?: CommentsGroupPreference - signMessages?: GroupPreference - commands?: ChatBotCommand[] -} - -export interface GroupProfile { - displayName: string - fullName: string - shortDescr?: string - description?: string - image?: string - publicGroup?: PublicGroupProfile - groupPreferences?: GroupPreferences - memberAdmission?: GroupMemberAdmission -} - -export interface GroupRelay { - groupRelayId: number // int64 - groupMemberId: number // int64 - userChatRelay: UserChatRelay - relayStatus: RelayStatus - relayLink?: string - relayCap: RelayCapabilities -} - -export interface GroupShortLinkData { - groupProfile: GroupProfile - publicGroupData?: PublicGroupData -} - -export interface GroupShortLinkInfo { - direct: boolean - groupRelays: string[] - publicGroupId?: string -} - -export interface GroupSummary { - currentMembers: number // int64 - publicMemberCount?: number // int64 -} - -export interface GroupSupportChat { - chatTs: string // ISO-8601 timestamp - unread: number // int64 - memberAttention: number // int64 - mentions: number // int64 - lastMsgFromMemberTs?: string // ISO-8601 timestamp -} - -export enum GroupType { - Channel = "channel", - Group = "group", -} - -export enum HandshakeError { - PARSE = "PARSE", - IDENTITY = "IDENTITY", - BAD_AUTH = "BAD_AUTH", - BAD_SERVICE = "BAD_SERVICE", -} - -export enum InlineFileMode { - Offer = "offer", - Sent = "sent", -} - -export type InvitationLinkPlan = - | InvitationLinkPlan.Ok - | InvitationLinkPlan.OwnLink - | InvitationLinkPlan.Connecting - | InvitationLinkPlan.Known - -export namespace InvitationLinkPlan { - export type Tag = "ok" | "ownLink" | "connecting" | "known" - - interface Interface { - type: Tag - } - - export interface Ok extends Interface { - type: "ok" - contactSLinkData_?: ContactShortLinkData - ownerVerification?: OwnerVerification - } - - export interface OwnLink extends Interface { - type: "ownLink" - } - - export interface Connecting extends Interface { - type: "connecting" - contact_?: Contact - } - - export interface Known extends Interface { - type: "known" - contact: Contact - } -} - -export type InvitedBy = InvitedBy.Contact | InvitedBy.User | InvitedBy.Unknown - -export namespace InvitedBy { - export type Tag = "contact" | "user" | "unknown" - - interface Interface { - type: Tag - } - - export interface Contact extends Interface { - type: "contact" - byContactId: number // int64 - } - - export interface User extends Interface { - type: "user" - } - - export interface Unknown extends Interface { - type: "unknown" - } -} - -export type LinkContent = LinkContent.Page | LinkContent.Image | LinkContent.Video | LinkContent.Unknown - -export namespace LinkContent { - export type Tag = "page" | "image" | "video" | "unknown" - - interface Interface { - type: Tag - } - - export interface Page extends Interface { - type: "page" - } - - export interface Image extends Interface { - type: "image" - } - - export interface Video extends Interface { - type: "video" - duration?: number // int - } - - export interface Unknown extends Interface { - type: "unknown" - tag: string - json: object - } -} - -export interface LinkOwnerSig { - ownerId?: string - chatBinding: string - ownerSig: string -} - -export interface LinkPreview { - uri: string - title: string - description: string - image: string - content?: LinkContent -} - -export interface LocalBadge { - badge: BadgeInfo - status: BadgeStatus -} - -export interface LocalProfile { - profileId: number // int64 - displayName: string - fullName: string - shortDescr?: string - description?: string - image?: string - contactLink?: string - preferences?: Preferences - peerType?: ChatPeerType - localBadge?: LocalBadge - localAlias: string - contactDomain?: SimplexDomainClaim - contactDomainVerified?: boolean -} - -export enum MemberCriteria { - All = "all", -} -// Connection link sent in a message - only short links are allowed. - -export type MsgChatLink = MsgChatLink.Contact | MsgChatLink.Invitation | MsgChatLink.Group - -export namespace MsgChatLink { - export type Tag = "contact" | "invitation" | "group" - - interface Interface { - type: Tag - } - - export interface Contact extends Interface { - type: "contact" - connLink: string - profile: Profile - business: boolean - } - - export interface Invitation extends Interface { - type: "invitation" - invLink: string - profile: Profile - } - - export interface Group extends Interface { - type: "group" - connLink: string - groupProfile: GroupProfile - } -} - -export type MsgContent = - | MsgContent.Text - | MsgContent.Link - | MsgContent.Image - | MsgContent.Video - | MsgContent.Voice - | MsgContent.File - | MsgContent.Report - | MsgContent.Chat - | MsgContent.Unknown - -export namespace MsgContent { - export type Tag = "text" | "link" | "image" | "video" | "voice" | "file" | "report" | "chat" | "unknown" - - interface Interface { - type: Tag - } - - export interface Text extends Interface { - type: "text" - text: string - } - - export interface Link extends Interface { - type: "link" - text: string - preview: LinkPreview - } - - export interface Image extends Interface { - type: "image" - text: string - image: string - } - - export interface Video extends Interface { - type: "video" - text: string - image: string - duration: number // int - } - - export interface Voice extends Interface { - type: "voice" - text: string - duration: number // int - } - - export interface File extends Interface { - type: "file" - text: string - } - - export interface Report extends Interface { - type: "report" - text: string - reason: ReportReason - } - - export interface Chat extends Interface { - type: "chat" - text: string - chatLink: MsgChatLink - ownerSig?: LinkOwnerSig - } - - export interface Unknown extends Interface { - type: "unknown" - tag: string - text: string - json: object - } -} - -export enum MsgDecryptError { - RatchetHeader = "ratchetHeader", - TooManySkipped = "tooManySkipped", - RatchetEarlier = "ratchetEarlier", - Other = "other", - RatchetSync = "ratchetSync", -} - -export enum MsgDirection { - Rcv = "rcv", - Snd = "snd", -} - -export type MsgErrorType = - | MsgErrorType.MsgSkipped - | MsgErrorType.MsgBadId - | MsgErrorType.MsgBadHash - | MsgErrorType.MsgDuplicate - -export namespace MsgErrorType { - export type Tag = "msgSkipped" | "msgBadId" | "msgBadHash" | "msgDuplicate" - - interface Interface { - type: Tag - } - - export interface MsgSkipped extends Interface { - type: "msgSkipped" - fromMsgId: number // int64 - toMsgId: number // int64 - } - - export interface MsgBadId extends Interface { - type: "msgBadId" - msgId: number // int64 - } - - export interface MsgBadHash extends Interface { - type: "msgBadHash" - } - - export interface MsgDuplicate extends Interface { - type: "msgDuplicate" - } -} - -export enum MsgFilter { - None = "none", - All = "all", - Mentions = "mentions", -} - -export type MsgReaction = MsgReaction.Emoji | MsgReaction.Unknown - -export namespace MsgReaction { - export type Tag = "emoji" | "unknown" - - interface Interface { - type: Tag - } - - export interface Emoji extends Interface { - type: "emoji" - emoji: string - } - - export interface Unknown extends Interface { - type: "unknown" - tag: string - json: object - } -} - -export enum MsgReceiptStatus { - Ok = "ok", - BadMsgHash = "badMsgHash", -} - -export enum MsgSigStatus { - Verified = "verified", - SignedNoKey = "signedNoKey", -} - -export type MsgVerified = MsgVerified.Signed | MsgVerified.SigMissing - -export namespace MsgVerified { - export type Tag = "signed" | "sigMissing" - - interface Interface { - type: Tag - } - - export interface Signed extends Interface { - type: "signed" - sigStatus: MsgSigStatus - } - - export interface SigMissing extends Interface { - type: "sigMissing" - } -} - -export type NameErrorType = NameErrorType.NO_RESOLVER | NameErrorType.NOT_FOUND | NameErrorType.RESOLVER - -export namespace NameErrorType { - export type Tag = "NO_RESOLVER" | "NOT_FOUND" | "RESOLVER" - - interface Interface { - type: Tag - } - - export interface NO_RESOLVER extends Interface { - type: "NO_RESOLVER" - } - - export interface NOT_FOUND extends Interface { - type: "NOT_FOUND" - } - - export interface RESOLVER extends Interface { - type: "RESOLVER" - resolverErr: string - } -} - -export type NetworkError = - | NetworkError.ConnectError - | NetworkError.TLSError - | NetworkError.UnknownCAError - | NetworkError.FailedError - | NetworkError.TimeoutError - | NetworkError.SubscribeError - -export namespace NetworkError { - export type Tag = - | "connectError" - | "tLSError" - | "unknownCAError" - | "failedError" - | "timeoutError" - | "subscribeError" - - interface Interface { - type: Tag - } - - export interface ConnectError extends Interface { - type: "connectError" - connectError: string - } - - export interface TLSError extends Interface { - type: "tLSError" - tlsError: string - } - - export interface UnknownCAError extends Interface { - type: "unknownCAError" - } - - export interface FailedError extends Interface { - type: "failedError" - } - - export interface TimeoutError extends Interface { - type: "timeoutError" - } - - export interface SubscribeError extends Interface { - type: "subscribeError" - subscribeError: string - } -} - -export interface NewUser { - profile?: Profile - pastTimestamp: boolean - userChatRelay: boolean - clientService: boolean -} - -export interface NoteFolder { - noteFolderId: 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 type OwnerVerification = OwnerVerification.Verified | OwnerVerification.Failed - -export namespace OwnerVerification { - export type Tag = "verified" | "failed" - - interface Interface { - type: Tag - } - - export interface Verified extends Interface { - type: "verified" - } - - export interface Failed extends Interface { - type: "failed" - reason: string - } -} - -export type PaginationByTime = PaginationByTime.Last - -export namespace PaginationByTime { - export type Tag = "last" - - interface Interface { - type: Tag - } - - export interface Last extends Interface { - type: "last" - count: number // int - } - - export function cmdString(self: PaginationByTime): string { - return 'count=' + self.count - } -} - -export interface PendingContactConnection { - pccConnId: number // int64 - pccAgentConnId: string - pccConnStatus: ConnStatus - viaContactUri: boolean - viaUserContactLink?: number // int64 - groupLinkId?: string - customUserProfileId?: number // int64 - connLinkInv?: CreatedConnLink - localAlias: string - createdAt: string // ISO-8601 timestamp - updatedAt: string // ISO-8601 timestamp -} - -export enum PlanResolveMode { - AllGroups = "allGroups", - Unknown = "unknown", - Never = "never", -} - -export interface PrefEnabled { - forUser: boolean - forContact: boolean -} - -export interface Preferences { - timedMessages?: TimedMessagesPreference - fullDelete?: SimplePreference - reactions?: SimplePreference - voice?: SimplePreference - files?: SimplePreference - calls?: SimplePreference - sessions?: SimplePreference - commands?: ChatBotCommand[] -} - -export interface PreparedContact { - connLinkToConnect: CreatedConnLink - uiConnLinkType: ConnectionMode - welcomeSharedMsgId?: string - requestSharedMsgId?: string -} - -export interface PreparedGroup { - connLinkToConnect: CreatedConnLink - connLinkPreparedConnection: boolean - connLinkStartedConnection: boolean - welcomeSharedMsgId?: string - requestSharedMsgId?: string -} - -export interface Profile { - displayName: string - fullName: string - shortDescr?: string - description?: string - image?: string - contactLink?: string - preferences?: Preferences - peerType?: ChatPeerType - badge?: BadgeProof - contactDomain?: SimplexDomainClaim -} - -export type ProxyClientError = - | ProxyClientError.ProtocolError - | ProxyClientError.UnexpectedResponse - | ProxyClientError.ResponseError - -export namespace ProxyClientError { - export type Tag = "protocolError" | "unexpectedResponse" | "responseError" - - interface Interface { - type: Tag - } - - export interface ProtocolError extends Interface { - type: "protocolError" - protocolErr: ErrorType - } - - export interface UnexpectedResponse extends Interface { - type: "unexpectedResponse" - responseStr: string - } - - export interface ResponseError extends Interface { - type: "responseError" - responseErr: ErrorType - } -} - -export type ProxyError = ProxyError.PROTOCOL | ProxyError.BROKER | ProxyError.BASIC_AUTH | ProxyError.NO_SESSION - -export namespace ProxyError { - export type Tag = "PROTOCOL" | "BROKER" | "BASIC_AUTH" | "NO_SESSION" - - interface Interface { - type: Tag - } - - export interface PROTOCOL extends Interface { - type: "PROTOCOL" - protocolErr: ErrorType - } - - export interface BROKER extends Interface { - type: "BROKER" - brokerErr: BrokerErrorType - } - - export interface BASIC_AUTH extends Interface { - type: "BASIC_AUTH" - } - - export interface NO_SESSION extends Interface { - type: "NO_SESSION" - } -} - -export interface PublicGroupAccess { - groupWebPage?: string - groupDomainClaim?: SimplexDomainClaim - domainWebPage: boolean - allowEmbedding: boolean -} - -export interface PublicGroupData { - publicMemberCount: number // int64 -} - -export interface PublicGroupProfile { - groupType: GroupType - groupLink: string - publicGroupId: string - publicGroupAccess?: PublicGroupAccess -} - -export type RCErrorType = - | RCErrorType.Internal - | RCErrorType.Identity - | RCErrorType.NoLocalAddress - | RCErrorType.NewController - | RCErrorType.NotDiscovered - | RCErrorType.TLSStartFailed - | RCErrorType.Exception - | RCErrorType.CtrlAuth - | RCErrorType.CtrlNotFound - | RCErrorType.CtrlError - | RCErrorType.Invitation - | RCErrorType.Version - | RCErrorType.Encrypt - | RCErrorType.Decrypt - | RCErrorType.BlockSize - | RCErrorType.Syntax - -export namespace RCErrorType { - export type Tag = - | "internal" - | "identity" - | "noLocalAddress" - | "newController" - | "notDiscovered" - | "tLSStartFailed" - | "exception" - | "ctrlAuth" - | "ctrlNotFound" - | "ctrlError" - | "invitation" - | "version" - | "encrypt" - | "decrypt" - | "blockSize" - | "syntax" - - interface Interface { - type: Tag - } - - export interface Internal extends Interface { - type: "internal" - internalErr: string - } - - export interface Identity extends Interface { - type: "identity" - } - - export interface NoLocalAddress extends Interface { - type: "noLocalAddress" - } - - export interface NewController extends Interface { - type: "newController" - } - - export interface NotDiscovered extends Interface { - type: "notDiscovered" - } - - export interface TLSStartFailed extends Interface { - type: "tLSStartFailed" - } - - export interface Exception extends Interface { - type: "exception" - exception: string - } - - export interface CtrlAuth extends Interface { - type: "ctrlAuth" - } - - export interface CtrlNotFound extends Interface { - type: "ctrlNotFound" - } - - export interface CtrlError extends Interface { - type: "ctrlError" - ctrlErr: string - } - - export interface Invitation extends Interface { - type: "invitation" - } - - export interface Version extends Interface { - type: "version" - } - - export interface Encrypt extends Interface { - type: "encrypt" - } - - export interface Decrypt extends Interface { - type: "decrypt" - } - - export interface BlockSize extends Interface { - type: "blockSize" - } - - export interface Syntax extends Interface { - type: "syntax" - syntaxErr: string - } -} - -export enum RatchetSyncState { - Ok = "ok", - Allowed = "allowed", - Required = "required", - Started = "started", - Agreed = "agreed", -} - -export type RcvConnEvent = - | RcvConnEvent.SwitchQueue - | RcvConnEvent.RatchetSync - | RcvConnEvent.VerificationCodeReset - | RcvConnEvent.PqEnabled - -export namespace RcvConnEvent { - export type Tag = "switchQueue" | "ratchetSync" | "verificationCodeReset" | "pqEnabled" - - interface Interface { - type: Tag - } - - export interface SwitchQueue extends Interface { - type: "switchQueue" - phase: SwitchPhase - } - - export interface RatchetSync extends Interface { - type: "ratchetSync" - syncStatus: RatchetSyncState - } - - export interface VerificationCodeReset extends Interface { - type: "verificationCodeReset" - } - - export interface PqEnabled extends Interface { - type: "pqEnabled" - enabled: boolean - } -} - -export type RcvDirectEvent = - | RcvDirectEvent.ContactDeleted - | RcvDirectEvent.ProfileUpdated - | RcvDirectEvent.GroupInvLinkReceived - -export namespace RcvDirectEvent { - export type Tag = "contactDeleted" | "profileUpdated" | "groupInvLinkReceived" - - interface Interface { - type: Tag - } - - export interface ContactDeleted extends Interface { - type: "contactDeleted" - } - - export interface ProfileUpdated extends Interface { - type: "profileUpdated" - fromProfile: Profile - toProfile: Profile - } - - export interface GroupInvLinkReceived extends Interface { - type: "groupInvLinkReceived" - groupProfile: GroupProfile - } -} - -export interface RcvFileDescr { - fileDescrId: number // int64 - fileDescrText: string - fileDescrPartNo: number // int - fileDescrComplete: boolean -} - -export type RcvFileStatus = - | RcvFileStatus.New - | RcvFileStatus.Accepted - | RcvFileStatus.Connected - | RcvFileStatus.Complete - | RcvFileStatus.Cancelled - -export namespace RcvFileStatus { - export type Tag = "new" | "accepted" | "connected" | "complete" | "cancelled" - - interface Interface { - type: Tag - } - - export interface New extends Interface { - type: "new" - } - - export interface Accepted extends Interface { - type: "accepted" - filePath: string - } - - export interface Connected extends Interface { - type: "connected" - filePath: string - } - - export interface Complete extends Interface { - type: "complete" - filePath: string - } - - export interface Cancelled extends Interface { - type: "cancelled" - filePath_?: string - } -} - -export interface RcvFileTransfer { - fileId: number // int64 - xftpRcvFile?: XFTPRcvFile - fileInvitation: FileInvitation - fileProhibited?: FileProhibited - fileStatus: RcvFileStatus - fileType: FileType - rcvFileInline?: InlineFileMode - senderDisplayName: string - chunkSize: number // int64 - cancelled: boolean - grpMemberId?: number // int64 - cryptoArgs?: CryptoFileArgs -} - -export type RcvGroupEvent = - | RcvGroupEvent.MemberAdded - | RcvGroupEvent.MemberConnected - | RcvGroupEvent.MemberAccepted - | RcvGroupEvent.UserAccepted - | RcvGroupEvent.MemberLeft - | RcvGroupEvent.MemberRole - | RcvGroupEvent.MemberBlocked - | RcvGroupEvent.UserRole - | RcvGroupEvent.MemberDeleted - | RcvGroupEvent.UserDeleted - | RcvGroupEvent.GroupDeleted - | RcvGroupEvent.GroupUpdated - | RcvGroupEvent.InvitedViaGroupLink - | RcvGroupEvent.MemberCreatedContact - | RcvGroupEvent.MemberProfileUpdated - | RcvGroupEvent.NewMemberPendingReview - | RcvGroupEvent.MsgBadSignature - -export namespace RcvGroupEvent { - export type Tag = - | "memberAdded" - | "memberConnected" - | "memberAccepted" - | "userAccepted" - | "memberLeft" - | "memberRole" - | "memberBlocked" - | "userRole" - | "memberDeleted" - | "userDeleted" - | "groupDeleted" - | "groupUpdated" - | "invitedViaGroupLink" - | "memberCreatedContact" - | "memberProfileUpdated" - | "newMemberPendingReview" - | "msgBadSignature" - - interface Interface { - type: Tag - } - - export interface MemberAdded extends Interface { - type: "memberAdded" - groupMemberId: number // int64 - profile: Profile - } - - export interface MemberConnected extends Interface { - type: "memberConnected" - } - - export interface MemberAccepted extends Interface { - type: "memberAccepted" - groupMemberId: number // int64 - profile: Profile - } - - export interface UserAccepted extends Interface { - type: "userAccepted" - } - - export interface MemberLeft extends Interface { - type: "memberLeft" - } - - export interface MemberRole extends Interface { - type: "memberRole" - groupMemberId: number // int64 - profile: Profile - role: GroupMemberRole - } - - export interface MemberBlocked extends Interface { - type: "memberBlocked" - groupMemberId: number // int64 - profile: Profile - blocked: boolean - } - - export interface UserRole extends Interface { - type: "userRole" - role: GroupMemberRole - } - - export interface MemberDeleted extends Interface { - type: "memberDeleted" - groupMemberId: number // int64 - profile: Profile - } - - export interface UserDeleted extends Interface { - type: "userDeleted" - } - - export interface GroupDeleted extends Interface { - type: "groupDeleted" - } - - export interface GroupUpdated extends Interface { - type: "groupUpdated" - groupProfile: GroupProfile - } - - export interface InvitedViaGroupLink extends Interface { - type: "invitedViaGroupLink" - } - - export interface MemberCreatedContact extends Interface { - type: "memberCreatedContact" - } - - export interface MemberProfileUpdated extends Interface { - type: "memberProfileUpdated" - fromProfile: Profile - toProfile: Profile - } - - export interface NewMemberPendingReview extends Interface { - type: "newMemberPendingReview" - } - - export interface MsgBadSignature extends Interface { - type: "msgBadSignature" - } -} - -export type RcvMsgError = RcvMsgError.Dropped | RcvMsgError.ParseError - -export namespace RcvMsgError { - export type Tag = "dropped" | "parseError" - - interface Interface { - type: Tag - } - - export interface Dropped extends Interface { - type: "dropped" - attempts: number // int - } - - export interface ParseError extends Interface { - type: "parseError" - parseError: string - } -} - -export interface RelayCapabilities { - webDomain?: string -} - -export interface RelayConnectionResult { - relayMember: GroupMember - relayError?: ChatError -} - -export interface RelayProfile { - displayName: string - fullName: string - shortDescr?: string - image?: string -} - -export enum RelayStatus { - New = "new", - Invited = "invited", - Accepted = "accepted", - AcknowledgedRoster = "acknowledgedRoster", - Active = "active", - Inactive = "inactive", - Rejected = "rejected", -} - -export interface RemoteCtrlInfo { - remoteCtrlId: number // int64 - ctrlDeviceName: string - sessionState?: RemoteCtrlSessionState -} - -export type RemoteCtrlSessionState = - | RemoteCtrlSessionState.Starting - | RemoteCtrlSessionState.Searching - | RemoteCtrlSessionState.Connecting - | RemoteCtrlSessionState.PendingConfirmation - | RemoteCtrlSessionState.Connected - -export namespace RemoteCtrlSessionState { - export type Tag = - | "starting" - | "searching" - | "connecting" - | "pendingConfirmation" - | "connected" - - interface Interface { - type: Tag - } - - export interface Starting extends Interface { - type: "starting" - } - - export interface Searching extends Interface { - type: "searching" - } - - export interface Connecting extends Interface { - type: "connecting" - } - - export interface PendingConfirmation extends Interface { - type: "pendingConfirmation" - sessionCode: string - } - - export interface Connected extends Interface { - type: "connected" - sessionCode: string - } -} - -export type RemoteCtrlStopReason = - | RemoteCtrlStopReason.DiscoveryFailed - | RemoteCtrlStopReason.ConnectionFailed - | RemoteCtrlStopReason.SetupFailed - | RemoteCtrlStopReason.Disconnected - -export namespace RemoteCtrlStopReason { - export type Tag = "discoveryFailed" | "connectionFailed" | "setupFailed" | "disconnected" - - interface Interface { - type: Tag - } - - export interface DiscoveryFailed extends Interface { - type: "discoveryFailed" - chatError: ChatError - } - - export interface ConnectionFailed extends Interface { - type: "connectionFailed" - chatError: ChatError - } - - export interface SetupFailed extends Interface { - type: "setupFailed" - chatError: ChatError - } - - export interface Disconnected extends Interface { - type: "disconnected" - } -} - -export enum ReportReason { - Spam = "spam", - Content = "content", - Community = "community", - Profile = "profile", - Other = "other", -} - -export interface RoleGroupPreference { - enable: GroupFeatureEnabled - role?: GroupMemberRole -} - -export type SMPAgentError = - | SMPAgentError.A_MESSAGE - | SMPAgentError.A_PROHIBITED - | SMPAgentError.A_VERSION - | SMPAgentError.A_LINK - | SMPAgentError.A_CRYPTO - | SMPAgentError.A_DUPLICATE - | SMPAgentError.A_QUEUE - | SMPAgentError.A_SERVICE - -export namespace SMPAgentError { - export type Tag = - | "A_MESSAGE" - | "A_PROHIBITED" - | "A_VERSION" - | "A_LINK" - | "A_CRYPTO" - | "A_DUPLICATE" - | "A_QUEUE" - | "A_SERVICE" - - interface Interface { - type: Tag - } - - export interface A_MESSAGE extends Interface { - type: "A_MESSAGE" - messageErr: string - } - - export interface A_PROHIBITED extends Interface { - type: "A_PROHIBITED" - prohibitedErr: string - } - - export interface A_VERSION extends Interface { - type: "A_VERSION" - } - - export interface A_LINK extends Interface { - type: "A_LINK" - linkErr: string - } - - export interface A_CRYPTO extends Interface { - type: "A_CRYPTO" - cryptoErr: AgentCryptoError - } - - export interface A_DUPLICATE extends Interface { - type: "A_DUPLICATE" - droppedMsg_?: DroppedMsg - } - - export interface A_QUEUE extends Interface { - type: "A_QUEUE" - queueErr: string - } - - export interface A_SERVICE extends Interface { - type: "A_SERVICE" - serviceError: AgentServiceError - } -} - -export interface SecurityCode { - securityCode: string - verifiedAt: string // ISO-8601 timestamp -} - -export interface SimplePreference { - allow: FeatureAllowed -} - -export interface SimplexDomain { - nameTLD: SimplexTLD - domain: string - subDomain: string[] -} - -export interface SimplexDomainClaim { - domain: string - proof?: SimplexDomainProof -} - -export type SimplexDomainError = SimplexDomainError.NoValidLink | SimplexDomainError.UnknownDomain - -export namespace SimplexDomainError { - export type Tag = "noValidLink" | "unknownDomain" - - interface Interface { - type: Tag - } - - export interface NoValidLink extends Interface { - type: "noValidLink" - } - - export interface UnknownDomain extends Interface { - type: "unknownDomain" - } -} - -export interface SimplexDomainProof { - linkOwnerId?: string - presHeader: string - signature: string -} - -export enum SimplexLinkType { - Contact = "contact", - Invitation = "invitation", - Group = "group", - Channel = "channel", - Relay = "relay", -} - -export interface SimplexNameInfo { - nameType: SimplexNameType - nameDomain: SimplexDomain -} - -export enum SimplexNameType { - PublicGroup = "publicGroup", - Contact = "contact", -} - -export enum SimplexTLD { - Simplex = "simplex", - Testing = "testing", - Web = "web", -} - -export enum SndCIStatusProgress { - Partial = "partial", - Complete = "complete", -} - -export type SndConnEvent = SndConnEvent.SwitchQueue | SndConnEvent.RatchetSync | SndConnEvent.PqEnabled - -export namespace SndConnEvent { - export type Tag = "switchQueue" | "ratchetSync" | "pqEnabled" - - interface Interface { - type: Tag - } - - export interface SwitchQueue extends Interface { - type: "switchQueue" - phase: SwitchPhase - member?: GroupMemberRef - } - - export interface RatchetSync extends Interface { - type: "ratchetSync" - syncStatus: RatchetSyncState - member?: GroupMemberRef - } - - export interface PqEnabled extends Interface { - type: "pqEnabled" - enabled: boolean - } -} - -export type SndError = - | SndError.Auth - | SndError.Quota - | SndError.Expired - | SndError.Relay - | SndError.Proxy - | SndError.ProxyRelay - | SndError.Other - -export namespace SndError { - export type Tag = "auth" | "quota" | "expired" | "relay" | "proxy" | "proxyRelay" | "other" - - interface Interface { - type: Tag - } - - export interface Auth extends Interface { - type: "auth" - } - - export interface Quota extends Interface { - type: "quota" - } - - export interface Expired extends Interface { - type: "expired" - } - - export interface Relay extends Interface { - type: "relay" - srvError: SrvError - } - - export interface Proxy extends Interface { - type: "proxy" - proxyServer: string - srvError: SrvError - } - - export interface ProxyRelay extends Interface { - type: "proxyRelay" - proxyServer: string - srvError: SrvError - } - - export interface Other extends Interface { - type: "other" - sndError: string - } -} - -export interface SndFileTransfer { - fileId: number // int64 - fileName: string - filePath: string - fileSize: number // int64 - chunkSize: number // int64 - recipientDisplayName: string - connId: number // int64 - agentConnId: string - groupMemberId?: number // int64 - fileStatus: FileStatus - fileDescrId?: number // int64 - fileInline?: InlineFileMode -} - -export type SndGroupEvent = - | SndGroupEvent.MemberRole - | SndGroupEvent.MemberBlocked - | SndGroupEvent.UserRole - | SndGroupEvent.MemberDeleted - | SndGroupEvent.UserLeft - | SndGroupEvent.GroupUpdated - | SndGroupEvent.MemberAccepted - | SndGroupEvent.UserPendingReview - -export namespace SndGroupEvent { - export type Tag = - | "memberRole" - | "memberBlocked" - | "userRole" - | "memberDeleted" - | "userLeft" - | "groupUpdated" - | "memberAccepted" - | "userPendingReview" - - interface Interface { - type: Tag - } - - export interface MemberRole extends Interface { - type: "memberRole" - groupMemberId: number // int64 - profile: Profile - role: GroupMemberRole - } - - export interface MemberBlocked extends Interface { - type: "memberBlocked" - groupMemberId: number // int64 - profile: Profile - blocked: boolean - } - - export interface UserRole extends Interface { - type: "userRole" - role: GroupMemberRole - } - - export interface MemberDeleted extends Interface { - type: "memberDeleted" - groupMemberId: number // int64 - profile: Profile - } - - export interface UserLeft extends Interface { - type: "userLeft" - } - - export interface GroupUpdated extends Interface { - type: "groupUpdated" - groupProfile: GroupProfile - } - - export interface MemberAccepted extends Interface { - type: "memberAccepted" - groupMemberId: number // int64 - profile: Profile - } - - export interface UserPendingReview extends Interface { - type: "userPendingReview" - } -} - -export type SrvError = SrvError.Host | SrvError.Version | SrvError.Other - -export namespace SrvError { - export type Tag = "host" | "version" | "other" - - interface Interface { - type: Tag - } - - export interface Host extends Interface { - type: "host" - } - - export interface Version extends Interface { - type: "version" - } - - export interface Other extends Interface { - type: "other" - srvError: string - } -} - -export type StoreError = - | StoreError.DuplicateName - | StoreError.UserNotFound - | StoreError.RelayUserNotFound - | StoreError.UserNotFoundByName - | StoreError.UserNotFoundByContactId - | StoreError.UserNotFoundByGroupId - | StoreError.UserNotFoundByFileId - | StoreError.UserNotFoundByContactRequestId - | StoreError.ContactNotFound - | StoreError.ContactNotFoundByName - | StoreError.ContactNotFoundByMemberId - | StoreError.ContactNotReady - | StoreError.DuplicateContactLink - | StoreError.UserContactLinkNotFound - | StoreError.ContactRequestNotFound - | StoreError.ContactRequestNotFoundByName - | StoreError.InvalidContactRequestEntity - | StoreError.InvalidBusinessChatContactRequest - | StoreError.GroupNotFound - | StoreError.GroupNotFoundByName - | StoreError.GroupMemberNameNotFound - | StoreError.GroupMemberNotFound - | StoreError.GroupMemberNotFoundByIndex - | StoreError.MemberRelationsVectorNotFound - | StoreError.GroupHostMemberNotFound - | StoreError.GroupMemberNotFoundByMemberId - | StoreError.MemberContactGroupMemberNotFound - | StoreError.InvalidMemberRelationUpdate - | StoreError.GroupWithoutUser - | StoreError.DuplicateGroupMember - | StoreError.DuplicateMemberId - | StoreError.GroupAlreadyJoined - | StoreError.GroupInvitationNotFound - | StoreError.NoteFolderAlreadyExists - | StoreError.NoteFolderNotFound - | StoreError.UserNoteFolderNotFound - | StoreError.SndFileNotFound - | StoreError.SndFileInvalid - | StoreError.RcvFileNotFound - | StoreError.RcvFileDescrNotFound - | StoreError.FileNotFound - | StoreError.RcvFileInvalid - | StoreError.RcvFileInvalidDescrPart - | StoreError.LocalFileNoTransfer - | StoreError.SharedMsgIdNotFoundByFileId - | StoreError.FileIdNotFoundBySharedMsgId - | StoreError.SndFileNotFoundXFTP - | StoreError.RcvFileNotFoundXFTP - | StoreError.ConnectionNotFound - | StoreError.ConnectionNotFoundById - | StoreError.ConnectionNotFoundByMemberId - | StoreError.PendingConnectionNotFound - | StoreError.UniqueID - | StoreError.LargeMsg - | StoreError.InternalError - | StoreError.DBException - | StoreError.DBBusyError - | StoreError.BadChatItem - | StoreError.ChatItemNotFound - | StoreError.ChatItemNotFoundByText - | StoreError.ChatItemSharedMsgIdNotFound - | StoreError.ChatItemNotFoundByFileId - | StoreError.ChatItemNotFoundByContactId - | StoreError.ChatItemNotFoundByGroupId - | StoreError.ProfileNotFound - | StoreError.DuplicateGroupLink - | StoreError.GroupLinkNotFound - | StoreError.HostMemberIdNotFound - | StoreError.ContactNotFoundByFileId - | StoreError.NoGroupSndStatus - | StoreError.DuplicateGroupMessage - | StoreError.RemoteHostNotFound - | StoreError.RemoteHostUnknown - | StoreError.RemoteHostDuplicateCA - | StoreError.RemoteCtrlNotFound - | StoreError.RemoteCtrlDuplicateCA - | StoreError.ProhibitedDeleteUser - | StoreError.OperatorNotFound - | StoreError.UsageConditionsNotFound - | StoreError.UserChatRelayNotFound - | StoreError.GroupRelayNotFound - | StoreError.GroupRelayNotFoundByMemberId - | StoreError.InvalidQuote - | StoreError.InvalidMention - | StoreError.InvalidDeliveryTask - | StoreError.DeliveryTaskNotFound - | StoreError.InvalidDeliveryJob - | StoreError.DeliveryJobNotFound - | StoreError.WorkItemError - -export namespace StoreError { - export type Tag = - | "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" - - interface Interface { - type: Tag - } - - export interface DuplicateName extends Interface { - type: "duplicateName" - } - - export interface UserNotFound extends Interface { - type: "userNotFound" - userId: number // int64 - } - - export interface RelayUserNotFound extends Interface { - type: "relayUserNotFound" - } - - export interface UserNotFoundByName extends Interface { - type: "userNotFoundByName" - contactName: string - } - - export interface UserNotFoundByContactId extends Interface { - type: "userNotFoundByContactId" - contactId: number // int64 - } - - export interface UserNotFoundByGroupId extends Interface { - type: "userNotFoundByGroupId" - groupId: number // int64 - } - - export interface UserNotFoundByFileId extends Interface { - type: "userNotFoundByFileId" - fileId: number // int64 - } - - export interface UserNotFoundByContactRequestId extends Interface { - type: "userNotFoundByContactRequestId" - contactRequestId: number // int64 - } - - export interface ContactNotFound extends Interface { - type: "contactNotFound" - contactId: number // int64 - } - - export interface ContactNotFoundByName extends Interface { - type: "contactNotFoundByName" - contactName: string - } - - export interface ContactNotFoundByMemberId extends Interface { - type: "contactNotFoundByMemberId" - groupMemberId: number // int64 - } - - export interface ContactNotReady extends Interface { - type: "contactNotReady" - contactName: string - } - - export interface DuplicateContactLink extends Interface { - type: "duplicateContactLink" - } - - export interface UserContactLinkNotFound extends Interface { - type: "userContactLinkNotFound" - } - - export interface ContactRequestNotFound extends Interface { - type: "contactRequestNotFound" - contactRequestId: number // int64 - } - - export interface ContactRequestNotFoundByName extends Interface { - type: "contactRequestNotFoundByName" - contactName: string - } - - export interface InvalidContactRequestEntity extends Interface { - type: "invalidContactRequestEntity" - contactRequestId: number // int64 - } - - export interface InvalidBusinessChatContactRequest extends Interface { - type: "invalidBusinessChatContactRequest" - } - - export interface GroupNotFound extends Interface { - type: "groupNotFound" - groupId: number // int64 - } - - export interface GroupNotFoundByName extends Interface { - type: "groupNotFoundByName" - groupName: string - } - - export interface GroupMemberNameNotFound extends Interface { - type: "groupMemberNameNotFound" - groupId: number // int64 - groupMemberName: string - } - - export interface GroupMemberNotFound extends Interface { - type: "groupMemberNotFound" - groupMemberId: number // int64 - } - - export interface GroupMemberNotFoundByIndex extends Interface { - type: "groupMemberNotFoundByIndex" - groupMemberIndex: number // int64 - } - - export interface MemberRelationsVectorNotFound extends Interface { - type: "memberRelationsVectorNotFound" - groupMemberId: number // int64 - } - - export interface GroupHostMemberNotFound extends Interface { - type: "groupHostMemberNotFound" - groupId: number // int64 - } - - export interface GroupMemberNotFoundByMemberId extends Interface { - type: "groupMemberNotFoundByMemberId" - memberId: string - } - - export interface MemberContactGroupMemberNotFound extends Interface { - type: "memberContactGroupMemberNotFound" - contactId: number // int64 - } - - export interface InvalidMemberRelationUpdate extends Interface { - type: "invalidMemberRelationUpdate" - } - - export interface GroupWithoutUser extends Interface { - type: "groupWithoutUser" - } - - export interface DuplicateGroupMember extends Interface { - type: "duplicateGroupMember" - } - - export interface DuplicateMemberId extends Interface { - type: "duplicateMemberId" - } - - export interface GroupAlreadyJoined extends Interface { - type: "groupAlreadyJoined" - } - - export interface GroupInvitationNotFound extends Interface { - type: "groupInvitationNotFound" - } - - export interface NoteFolderAlreadyExists extends Interface { - type: "noteFolderAlreadyExists" - noteFolderId: number // int64 - } - - export interface NoteFolderNotFound extends Interface { - type: "noteFolderNotFound" - noteFolderId: number // int64 - } - - export interface UserNoteFolderNotFound extends Interface { - type: "userNoteFolderNotFound" - } - - export interface SndFileNotFound extends Interface { - type: "sndFileNotFound" - fileId: number // int64 - } - - export interface SndFileInvalid extends Interface { - type: "sndFileInvalid" - fileId: number // int64 - } - - export interface RcvFileNotFound extends Interface { - type: "rcvFileNotFound" - fileId: number // int64 - } - - export interface RcvFileDescrNotFound extends Interface { - type: "rcvFileDescrNotFound" - fileId: number // int64 - } - - export interface FileNotFound extends Interface { - type: "fileNotFound" - fileId: number // int64 - } - - export interface RcvFileInvalid extends Interface { - type: "rcvFileInvalid" - fileId: number // int64 - } - - export interface RcvFileInvalidDescrPart extends Interface { - type: "rcvFileInvalidDescrPart" - } - - export interface LocalFileNoTransfer extends Interface { - type: "localFileNoTransfer" - fileId: number // int64 - } - - export interface SharedMsgIdNotFoundByFileId extends Interface { - type: "sharedMsgIdNotFoundByFileId" - fileId: number // int64 - } - - export interface FileIdNotFoundBySharedMsgId extends Interface { - type: "fileIdNotFoundBySharedMsgId" - sharedMsgId: string - } - - export interface SndFileNotFoundXFTP extends Interface { - type: "sndFileNotFoundXFTP" - agentSndFileId: string - } - - export interface RcvFileNotFoundXFTP extends Interface { - type: "rcvFileNotFoundXFTP" - agentRcvFileId: string - } - - export interface ConnectionNotFound extends Interface { - type: "connectionNotFound" - agentConnId: string - } - - export interface ConnectionNotFoundById extends Interface { - type: "connectionNotFoundById" - connId: number // int64 - } - - export interface ConnectionNotFoundByMemberId extends Interface { - type: "connectionNotFoundByMemberId" - groupMemberId: number // int64 - } - - export interface PendingConnectionNotFound extends Interface { - type: "pendingConnectionNotFound" - connId: number // int64 - } - - export interface UniqueID extends Interface { - type: "uniqueID" - } - - export interface LargeMsg extends Interface { - type: "largeMsg" - } - - export interface InternalError extends Interface { - type: "internalError" - message: string - } - - export interface DBException extends Interface { - type: "dBException" - message: string - } - - export interface DBBusyError extends Interface { - type: "dBBusyError" - message: string - } - - export interface BadChatItem extends Interface { - type: "badChatItem" - itemId: number // int64 - itemTs?: string // ISO-8601 timestamp - } - - export interface ChatItemNotFound extends Interface { - type: "chatItemNotFound" - itemId: number // int64 - } - - export interface ChatItemNotFoundByText extends Interface { - type: "chatItemNotFoundByText" - text: string - } - - export interface ChatItemSharedMsgIdNotFound extends Interface { - type: "chatItemSharedMsgIdNotFound" - sharedMsgId: string - } - - export interface ChatItemNotFoundByFileId extends Interface { - type: "chatItemNotFoundByFileId" - fileId: number // int64 - } - - export interface ChatItemNotFoundByContactId extends Interface { - type: "chatItemNotFoundByContactId" - contactId: number // int64 - } - - export interface ChatItemNotFoundByGroupId extends Interface { - type: "chatItemNotFoundByGroupId" - groupId: number // int64 - } - - export interface ProfileNotFound extends Interface { - type: "profileNotFound" - profileId: number // int64 - } - - export interface DuplicateGroupLink extends Interface { - type: "duplicateGroupLink" - groupInfo: GroupInfo - } - - export interface GroupLinkNotFound extends Interface { - type: "groupLinkNotFound" - groupInfo: GroupInfo - } - - export interface HostMemberIdNotFound extends Interface { - type: "hostMemberIdNotFound" - groupId: number // int64 - } - - export interface ContactNotFoundByFileId extends Interface { - type: "contactNotFoundByFileId" - fileId: number // int64 - } - - export interface NoGroupSndStatus extends Interface { - type: "noGroupSndStatus" - itemId: number // int64 - groupMemberId: number // int64 - } - - export interface DuplicateGroupMessage extends Interface { - type: "duplicateGroupMessage" - groupId: number // int64 - sharedMsgId: string - authorGroupMemberId?: number // int64 - forwardedByGroupMemberId?: number // int64 - } - - export interface RemoteHostNotFound extends Interface { - type: "remoteHostNotFound" - remoteHostId: number // int64 - } - - export interface RemoteHostUnknown extends Interface { - type: "remoteHostUnknown" - } - - export interface RemoteHostDuplicateCA extends Interface { - type: "remoteHostDuplicateCA" - } - - export interface RemoteCtrlNotFound extends Interface { - type: "remoteCtrlNotFound" - remoteCtrlId: number // int64 - } - - export interface RemoteCtrlDuplicateCA extends Interface { - type: "remoteCtrlDuplicateCA" - } - - export interface ProhibitedDeleteUser extends Interface { - type: "prohibitedDeleteUser" - userId: number // int64 - contactId: number // int64 - } - - export interface OperatorNotFound extends Interface { - type: "operatorNotFound" - serverOperatorId: number // int64 - } - - export interface UsageConditionsNotFound extends Interface { - type: "usageConditionsNotFound" - } - - export interface UserChatRelayNotFound extends Interface { - type: "userChatRelayNotFound" - chatRelayId: number // int64 - } - - export interface GroupRelayNotFound extends Interface { - type: "groupRelayNotFound" - groupRelayId: number // int64 - } - - export interface GroupRelayNotFoundByMemberId extends Interface { - type: "groupRelayNotFoundByMemberId" - groupMemberId: number // int64 - } - - export interface InvalidQuote extends Interface { - type: "invalidQuote" - } - - export interface InvalidMention extends Interface { - type: "invalidMention" - } - - export interface InvalidDeliveryTask extends Interface { - type: "invalidDeliveryTask" - taskId: number // int64 - } - - export interface DeliveryTaskNotFound extends Interface { - type: "deliveryTaskNotFound" - taskId: number // int64 - } - - export interface InvalidDeliveryJob extends Interface { - type: "invalidDeliveryJob" - jobId: number // int64 - } - - export interface DeliveryJobNotFound extends Interface { - type: "deliveryJobNotFound" - jobId: number // int64 - } - - export interface WorkItemError extends Interface { - type: "workItemError" - errContext: string - } -} - -export type SubscriptionStatus = - | SubscriptionStatus.Active - | SubscriptionStatus.Pending - | SubscriptionStatus.Removed - | SubscriptionStatus.NoSub - -export namespace SubscriptionStatus { - export type Tag = "active" | "pending" | "removed" | "noSub" - - interface Interface { - type: Tag - } - - export interface Active extends Interface { - type: "active" - } - - export interface Pending extends Interface { - type: "pending" - } - - export interface Removed extends Interface { - type: "removed" - subError: string - } - - export interface NoSub extends Interface { - type: "noSub" - } -} - -export interface SupportGroupPreference { - enable: GroupFeatureEnabled -} - -export enum SwitchPhase { - Started = "started", - Confirmed = "confirmed", - Secured = "secured", - Completed = "completed", -} - -export interface TimedMessagesGroupPreference { - enable: GroupFeatureEnabled - ttl?: number // int -} - -export interface TimedMessagesPreference { - allow: FeatureAllowed - ttl?: number // int -} - -export type TransportError = - | TransportError.BadBlock - | TransportError.Version - | TransportError.LargeMsg - | TransportError.BadSession - | TransportError.NoServerAuth - | TransportError.Handshake - -export namespace TransportError { - export type Tag = "badBlock" | "version" | "largeMsg" | "badSession" | "noServerAuth" | "handshake" - - interface Interface { - type: Tag - } - - export interface BadBlock extends Interface { - type: "badBlock" - } - - export interface Version extends Interface { - type: "version" - } - - export interface LargeMsg extends Interface { - type: "largeMsg" - } - - export interface BadSession extends Interface { - type: "badSession" - } - - export interface NoServerAuth extends Interface { - type: "noServerAuth" - } - - export interface Handshake extends Interface { - type: "handshake" - handshakeErr: HandshakeError - } -} - -export enum UIColorMode { - Light = "light", - Dark = "dark", -} - -export interface UIColors { - accent?: string - accentVariant?: string - secondary?: string - secondaryVariant?: string - background?: string - menus?: string - title?: string - accentVariant2?: string - sentMessage?: string - sentReply?: string - receivedMessage?: string - receivedReply?: string -} - -export interface UIThemeEntityOverride { - mode: UIColorMode - wallpaper?: ChatWallpaper - colors: UIColors -} - -export interface UIThemeEntityOverrides { - light?: UIThemeEntityOverride - dark?: UIThemeEntityOverride -} - -export interface UpdatedMessage { - msgContent: MsgContent - mentions: {[key: string]: number} // string : int64 -} - -export interface User { - userId: number // int64 - agentUserId: number // int64 - userContactId: number // int64 - localDisplayName: string - profile: LocalProfile - fullPreferences: FullPreferences - activeUser: boolean - activeOrder: number // int64 - viewPwdHash?: UserPwdHash - showNtfs: boolean - sendRcptsContacts: boolean - sendRcptsSmallGroups: boolean - autoAcceptMemberContacts: boolean - autoAcceptGroupInvitations: boolean - userMemberProfileUpdatedAt?: string // ISO-8601 timestamp - userChatRelay: boolean - clientService: boolean - uiThemes?: UIThemeEntityOverrides -} - -export interface UserChatRelay { - chatRelayId: number // int64 - address: string - relayProfile: RelayProfile - domains: string[] - preset: boolean - tested?: boolean - enabled: boolean - deleted: boolean -} - -export interface UserContact { - userContactLinkId: number // int64 - connReqContact: string - groupId?: number // int64 -} - -export interface UserContactLink { - userContactLinkId: number // int64 - connLinkContact: CreatedConnLink - shortLinkDataSet: boolean - shortLinkLargeDataSet: boolean - addressSettings: AddressSettings -} - -export interface UserContactRequest { - contactRequestId: number // int64 - agentInvitationId: string - contactId_?: number // int64 - businessGroupId_?: number // int64 - userContactLinkId_?: number // int64 - cReqChatVRange: VersionRange - localDisplayName: string - profileId: number // int64 - profile: LocalProfile - createdAt: string // ISO-8601 timestamp - updatedAt: string // ISO-8601 timestamp - xContactId?: string - pqSupport: boolean - welcomeSharedMsgId?: string - requestSharedMsgId?: string - rejectionSupported: boolean -} - -export interface UserContactRequestRef { - contactRequestId: number // int64 - rejectionSupported: boolean -} - -export interface UserInfo { - user: User - unreadCount: number // int -} - -export interface UserProfileUpdateSummary { - updateSuccesses: number // int - updateFailures: number // int - changedContacts: Contact[] -} - -export interface UserPwdHash { - hash: string - salt: string -} - -export interface VersionRange { - minVersion: number // int - maxVersion: number // int -} - -export type XFTPErrorType = - | XFTPErrorType.BLOCK - | XFTPErrorType.SESSION - | XFTPErrorType.HANDSHAKE - | XFTPErrorType.CMD - | XFTPErrorType.AUTH - | XFTPErrorType.BLOCKED - | XFTPErrorType.SIZE - | XFTPErrorType.QUOTA - | XFTPErrorType.DIGEST - | XFTPErrorType.CRYPTO - | XFTPErrorType.NO_FILE - | XFTPErrorType.HAS_FILE - | XFTPErrorType.FILE_IO - | XFTPErrorType.TIMEOUT - | XFTPErrorType.INTERNAL - | XFTPErrorType.DUPLICATE_ - -export namespace XFTPErrorType { - export type Tag = - | "BLOCK" - | "SESSION" - | "HANDSHAKE" - | "CMD" - | "AUTH" - | "BLOCKED" - | "SIZE" - | "QUOTA" - | "DIGEST" - | "CRYPTO" - | "NO_FILE" - | "HAS_FILE" - | "FILE_IO" - | "TIMEOUT" - | "INTERNAL" - | "DUPLICATE_" - - interface Interface { - type: Tag - } - - export interface BLOCK extends Interface { - type: "BLOCK" - } - - export interface SESSION extends Interface { - type: "SESSION" - } - - export interface HANDSHAKE extends Interface { - type: "HANDSHAKE" - } - - export interface CMD extends Interface { - type: "CMD" - cmdErr: CommandError - } - - export interface AUTH extends Interface { - type: "AUTH" - } - - export interface BLOCKED extends Interface { - type: "BLOCKED" - blockInfo: BlockingInfo - } - - export interface SIZE extends Interface { - type: "SIZE" - } - - export interface QUOTA extends Interface { - type: "QUOTA" - } - - export interface DIGEST extends Interface { - type: "DIGEST" - } - - export interface CRYPTO extends Interface { - type: "CRYPTO" - } - - export interface NO_FILE extends Interface { - type: "NO_FILE" - } - - export interface HAS_FILE extends Interface { - type: "HAS_FILE" - } - - export interface FILE_IO extends Interface { - type: "FILE_IO" - } - - export interface TIMEOUT extends Interface { - type: "TIMEOUT" - } - - export interface INTERNAL extends Interface { - type: "INTERNAL" - } - - export interface DUPLICATE_ extends Interface { - type: "DUPLICATE_" - } -} - -export interface XFTPRcvFile { - rcvFileDescription: RcvFileDescr - agentRcvFileId?: string - agentRcvFileDeleted: boolean - userApprovedRelays: boolean -} - -export interface XFTPSndFile { - agentSndFileId: string - privateSndFileDescr?: string - agentSndFileDeleted: boolean - cryptoArgs?: CryptoFileArgs -} diff --git a/packages/simplex-chat-python/src/simplex_chat/types/_commands.py b/packages/simplex-chat-python/src/simplex_chat/types/_commands.py index e6155c9ce7..e69de29bb2 100644 --- a/packages/simplex-chat-python/src/simplex_chat/types/_commands.py +++ b/packages/simplex-chat-python/src/simplex_chat/types/_commands.py @@ -1,825 +0,0 @@ -# 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 - diff --git a/packages/simplex-chat-python/src/simplex_chat/types/_events.py b/packages/simplex-chat-python/src/simplex_chat/types/_events.py index bd73637ef8..e69de29bb2 100644 --- a/packages/simplex-chat-python/src/simplex_chat/types/_events.py +++ b/packages/simplex-chat-python/src/simplex_chat/types/_events.py @@ -1,730 +0,0 @@ -# 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]], - ]: ... diff --git a/packages/simplex-chat-python/src/simplex_chat/types/_responses.py b/packages/simplex-chat-python/src/simplex_chat/types/_responses.py index e3885fc16a..e69de29bb2 100644 --- a/packages/simplex-chat-python/src/simplex_chat/types/_responses.py +++ b/packages/simplex-chat-python/src/simplex_chat/types/_responses.py @@ -1,423 +0,0 @@ -# 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: "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"] 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 ab06a24f53..e69de29bb2 100644 --- a/packages/simplex-chat-python/src/simplex_chat/types/_types.py +++ b/packages/simplex-chat-python/src/simplex_chat/types/_types.py @@ -1,3801 +0,0 @@ -# API Types -# This file is generated automatically. -from __future__ import annotations -from typing import Literal, NotRequired, TypedDict - -class ACIReaction(TypedDict): - chatInfo: "ChatInfo" - chatReaction: "CIReaction" - -class AChat(TypedDict): - chatInfo: "ChatInfo" - chatItems: list["ChatItem"] - chatStats: "ChatStats" - -class AChatItem(TypedDict): - chatInfo: "ChatInfo" - chatItem: "ChatItem" - -class AddRelayResult(TypedDict): - relay: "UserChatRelay" - relayError: NotRequired["ChatError"] - -class AddressSettings(TypedDict): - businessAddress: bool - autoAccept: NotRequired["AutoAccept"] - autoReply: NotRequired["MsgContent"] - -class AgentCryptoError_DECRYPT_AES(TypedDict): - type: Literal["DECRYPT_AES"] - -class AgentCryptoError_DECRYPT_CB(TypedDict): - type: Literal["DECRYPT_CB"] - -class AgentCryptoError_RATCHET_HEADER(TypedDict): - type: Literal["RATCHET_HEADER"] - -class AgentCryptoError_RATCHET_SYNC(TypedDict): - type: Literal["RATCHET_SYNC"] - -AgentCryptoError = ( - AgentCryptoError_DECRYPT_AES - | AgentCryptoError_DECRYPT_CB - | AgentCryptoError_RATCHET_HEADER - | AgentCryptoError_RATCHET_SYNC -) - -AgentCryptoError_Tag = Literal["DECRYPT_AES", "DECRYPT_CB", "RATCHET_HEADER", "RATCHET_SYNC"] - -class AgentErrorType_CMD(TypedDict): - type: Literal["CMD"] - cmdErr: "CommandErrorType" - errContext: str - -class AgentErrorType_CONN(TypedDict): - type: Literal["CONN"] - connErr: "ConnectionErrorType" - errContext: str - -class AgentErrorType_NO_USER(TypedDict): - type: Literal["NO_USER"] - -class AgentErrorType_SMP(TypedDict): - type: Literal["SMP"] - serverAddress: str - smpErr: "ErrorType" - -class AgentErrorType_NTF(TypedDict): - type: Literal["NTF"] - serverAddress: str - ntfErr: "ErrorType" - -class AgentErrorType_XFTP(TypedDict): - type: Literal["XFTP"] - serverAddress: str - xftpErr: "XFTPErrorType" - -class AgentErrorType_FILE(TypedDict): - type: Literal["FILE"] - fileErr: "FileErrorType" - -class AgentErrorType_NO_NAME_SERVERS(TypedDict): - type: Literal["NO_NAME_SERVERS"] - -class AgentErrorType_PROXY(TypedDict): - type: Literal["PROXY"] - proxyServer: str - relayServer: str - proxyErr: "ProxyClientError" - -class AgentErrorType_RCP(TypedDict): - type: Literal["RCP"] - rcpErr: "RCErrorType" - -class AgentErrorType_BROKER(TypedDict): - type: Literal["BROKER"] - brokerAddress: str - brokerErr: "BrokerErrorType" - -class AgentErrorType_AGENT(TypedDict): - type: Literal["AGENT"] - agentErr: "SMPAgentError" - -class AgentErrorType_NOTICE(TypedDict): - type: Literal["NOTICE"] - server: str - preset: bool - expiresAt: NotRequired[str] # ISO-8601 timestamp - -class AgentErrorType_INTERNAL(TypedDict): - type: Literal["INTERNAL"] - internalErr: str - -class AgentErrorType_CRITICAL(TypedDict): - type: Literal["CRITICAL"] - offerRestart: bool - criticalErr: str - -class AgentErrorType_INACTIVE(TypedDict): - type: Literal["INACTIVE"] - -AgentErrorType = ( - AgentErrorType_CMD - | AgentErrorType_CONN - | AgentErrorType_NO_USER - | AgentErrorType_SMP - | AgentErrorType_NTF - | AgentErrorType_XFTP - | AgentErrorType_FILE - | AgentErrorType_NO_NAME_SERVERS - | AgentErrorType_PROXY - | AgentErrorType_RCP - | AgentErrorType_BROKER - | AgentErrorType_AGENT - | AgentErrorType_NOTICE - | AgentErrorType_INTERNAL - | AgentErrorType_CRITICAL - | AgentErrorType_INACTIVE -) - -AgentErrorType_Tag = Literal["CMD", "CONN", "NO_USER", "SMP", "NTF", "XFTP", "FILE", "NO_NAME_SERVERS", "PROXY", "RCP", "BROKER", "AGENT", "NOTICE", "INTERNAL", "CRITICAL", "INACTIVE"] - -class AgentServiceError_rejected(TypedDict): - type: Literal["rejected"] - rejectReason: str - -class AgentServiceError_timeout(TypedDict): - type: Literal["timeout"] - -class AgentServiceError_noPendingRequest(TypedDict): - type: Literal["noPendingRequest"] - -class AgentServiceError_notDRAddress(TypedDict): - type: Literal["notDRAddress"] - -class AgentServiceError_badSignature(TypedDict): - type: Literal["badSignature"] - -AgentServiceError = ( - AgentServiceError_rejected - | AgentServiceError_timeout - | AgentServiceError_noPendingRequest - | AgentServiceError_notDRAddress - | AgentServiceError_badSignature -) - -AgentServiceError_Tag = Literal["rejected", "timeout", "noPendingRequest", "notDRAddress", "badSignature"] - -# Remote controller app version range (min and max as version strings). - -class AppVersionRange(TypedDict): - minVersion: str - maxVersion: str - -class AutoAccept(TypedDict): - acceptIncognito: bool - -class BadgeInfo(TypedDict): - badgeType: "BadgeType" - badgeExpiry: str # ISO-8601 timestamp - badgeExtra: str - -class BadgeProof(TypedDict): - badgeKeyIdx: int # int - presHeader: str - proof: str - badgeInfo: "BadgeInfo" - -class BadgeRedeemError_invalidCode(TypedDict): - type: Literal["invalidCode"] - -class BadgeRedeemError_serviceNotConfigured(TypedDict): - type: Literal["serviceNotConfigured"] - -class BadgeRedeemError_badgeActive(TypedDict): - type: Literal["badgeActive"] - -class BadgeRedeemError_serviceError(TypedDict): - type: Literal["serviceError"] - serviceError: "BadgeServiceErrorCode" - -class BadgeRedeemError_invalidResponse(TypedDict): - type: Literal["invalidResponse"] - message: str - -class BadgeRedeemError_unknownKeyIndex(TypedDict): - type: Literal["unknownKeyIndex"] - -class BadgeRedeemError_credentialNotVerified(TypedDict): - type: Literal["credentialNotVerified"] - -BadgeRedeemError = ( - BadgeRedeemError_invalidCode - | BadgeRedeemError_serviceNotConfigured - | BadgeRedeemError_badgeActive - | BadgeRedeemError_serviceError - | BadgeRedeemError_invalidResponse - | BadgeRedeemError_unknownKeyIndex - | BadgeRedeemError_credentialNotVerified -) - -BadgeRedeemError_Tag = Literal["invalidCode", "serviceNotConfigured", "badgeActive", "serviceError", "invalidResponse", "unknownKeyIndex", "credentialNotVerified"] - -BadgeServiceErrorCode = Literal["bad_request", "unsupported_version", "unknown_purchase_key", "unknown_offer_id", "offer_disabled", "offer_mismatch", "product_unavailable", "payment_not_entitled", "payment_pending", "provider_unavailable", "rate_limited", "code_invalid", "code_used", "code_expired", "receipt_invalid", "receipt_used", "internal"] - -BadgeStatus = Literal["active", "expired", "expiredOld", "failed", "unknownKey"] - -BadgeType = Literal["supporter", "legend", "investor"] - -class BlockingInfo(TypedDict): - reason: "BlockingReason" - notice: NotRequired["ClientNotice"] - -BlockingReason = Literal["spam", "content"] - -class BrokerErrorType_RESPONSE(TypedDict): - type: Literal["RESPONSE"] - respErr: str - -class BrokerErrorType_UNEXPECTED(TypedDict): - type: Literal["UNEXPECTED"] - respErr: str - -class BrokerErrorType_NETWORK(TypedDict): - type: Literal["NETWORK"] - networkError: "NetworkError" - -class BrokerErrorType_HOST(TypedDict): - type: Literal["HOST"] - -class BrokerErrorType_NO_SERVICE(TypedDict): - type: Literal["NO_SERVICE"] - -class BrokerErrorType_TRANSPORT(TypedDict): - type: Literal["TRANSPORT"] - transportErr: "TransportError" - -class BrokerErrorType_TIMEOUT(TypedDict): - type: Literal["TIMEOUT"] - -BrokerErrorType = ( - BrokerErrorType_RESPONSE - | BrokerErrorType_UNEXPECTED - | BrokerErrorType_NETWORK - | BrokerErrorType_HOST - | BrokerErrorType_NO_SERVICE - | BrokerErrorType_TRANSPORT - | BrokerErrorType_TIMEOUT -) - -BrokerErrorType_Tag = Literal["RESPONSE", "UNEXPECTED", "NETWORK", "HOST", "NO_SERVICE", "TRANSPORT", "TIMEOUT"] - -class BusinessChatInfo(TypedDict): - chatType: "BusinessChatType" - businessId: str - customerId: str - businessDomain: NotRequired["SimplexDomainClaim"] - -BusinessChatType = Literal["business", "customer"] - -CICallStatus = Literal["pending", "missed", "rejected", "accepted", "negotiated", "progress", "ended", "error"] - -class CIContent_sndMsgContent(TypedDict): - type: Literal["sndMsgContent"] - msgContent: "MsgContent" - -class CIContent_rcvMsgContent(TypedDict): - type: Literal["rcvMsgContent"] - msgContent: "MsgContent" - -class CIContent_sndDeleted(TypedDict): - type: Literal["sndDeleted"] - deleteMode: "CIDeleteMode" - -class CIContent_rcvDeleted(TypedDict): - type: Literal["rcvDeleted"] - deleteMode: "CIDeleteMode" - -class CIContent_sndCall(TypedDict): - type: Literal["sndCall"] - status: "CICallStatus" - duration: int # int - -class CIContent_rcvCall(TypedDict): - type: Literal["rcvCall"] - status: "CICallStatus" - duration: int # int - -class CIContent_rcvIntegrityError(TypedDict): - type: Literal["rcvIntegrityError"] - msgError: "MsgErrorType" - -class CIContent_rcvDecryptionError(TypedDict): - type: Literal["rcvDecryptionError"] - msgDecryptError: "MsgDecryptError" - msgCount: int # word32 - -class CIContent_rcvMsgError(TypedDict): - type: Literal["rcvMsgError"] - rcvMsgError: "RcvMsgError" - -class CIContent_rcvGroupInvitation(TypedDict): - type: Literal["rcvGroupInvitation"] - groupInvitation: "CIGroupInvitation" - memberRole: "GroupMemberRole" - -class CIContent_sndGroupInvitation(TypedDict): - type: Literal["sndGroupInvitation"] - groupInvitation: "CIGroupInvitation" - memberRole: "GroupMemberRole" - -class CIContent_rcvDirectEvent(TypedDict): - type: Literal["rcvDirectEvent"] - rcvDirectEvent: "RcvDirectEvent" - -class CIContent_rcvGroupEvent(TypedDict): - type: Literal["rcvGroupEvent"] - rcvGroupEvent: "RcvGroupEvent" - -class CIContent_sndGroupEvent(TypedDict): - type: Literal["sndGroupEvent"] - sndGroupEvent: "SndGroupEvent" - -class CIContent_rcvConnEvent(TypedDict): - type: Literal["rcvConnEvent"] - rcvConnEvent: "RcvConnEvent" - -class CIContent_sndConnEvent(TypedDict): - type: Literal["sndConnEvent"] - sndConnEvent: "SndConnEvent" - -class CIContent_rcvChatFeature(TypedDict): - type: Literal["rcvChatFeature"] - feature: "ChatFeature" - enabled: "PrefEnabled" - param: NotRequired[int] # int - -class CIContent_sndChatFeature(TypedDict): - type: Literal["sndChatFeature"] - feature: "ChatFeature" - enabled: "PrefEnabled" - param: NotRequired[int] # int - -class CIContent_rcvChatPreference(TypedDict): - type: Literal["rcvChatPreference"] - feature: "ChatFeature" - allowed: "FeatureAllowed" - param: NotRequired[int] # int - -class CIContent_sndChatPreference(TypedDict): - type: Literal["sndChatPreference"] - feature: "ChatFeature" - allowed: "FeatureAllowed" - param: NotRequired[int] # int - -class CIContent_rcvGroupFeature(TypedDict): - type: Literal["rcvGroupFeature"] - groupFeature: "GroupFeature" - preference: "GroupPreference" - param: NotRequired[int] # int - memberRole_: NotRequired["GroupMemberRole"] - -class CIContent_sndGroupFeature(TypedDict): - type: Literal["sndGroupFeature"] - groupFeature: "GroupFeature" - preference: "GroupPreference" - param: NotRequired[int] # int - memberRole_: NotRequired["GroupMemberRole"] - -class CIContent_rcvChatFeatureRejected(TypedDict): - type: Literal["rcvChatFeatureRejected"] - feature: "ChatFeature" - -class CIContent_rcvGroupFeatureRejected(TypedDict): - type: Literal["rcvGroupFeatureRejected"] - groupFeature: "GroupFeature" - -class CIContent_sndModerated(TypedDict): - type: Literal["sndModerated"] - -class CIContent_rcvModerated(TypedDict): - type: Literal["rcvModerated"] - -class CIContent_rcvBlocked(TypedDict): - type: Literal["rcvBlocked"] - -class CIContent_sndDirectE2EEInfo(TypedDict): - type: Literal["sndDirectE2EEInfo"] - e2eeInfo: "E2EInfo" - -class CIContent_rcvDirectE2EEInfo(TypedDict): - type: Literal["rcvDirectE2EEInfo"] - e2eeInfo: "E2EInfo" - -class CIContent_sndGroupE2EEInfo(TypedDict): - type: Literal["sndGroupE2EEInfo"] - e2eeInfo: "E2EInfo" - -class CIContent_rcvGroupE2EEInfo(TypedDict): - type: Literal["rcvGroupE2EEInfo"] - e2eeInfo: "E2EInfo" - -class CIContent_chatBanner(TypedDict): - type: Literal["chatBanner"] - -CIContent = ( - CIContent_sndMsgContent - | CIContent_rcvMsgContent - | CIContent_sndDeleted - | CIContent_rcvDeleted - | CIContent_sndCall - | CIContent_rcvCall - | CIContent_rcvIntegrityError - | CIContent_rcvDecryptionError - | CIContent_rcvMsgError - | CIContent_rcvGroupInvitation - | CIContent_sndGroupInvitation - | CIContent_rcvDirectEvent - | CIContent_rcvGroupEvent - | CIContent_sndGroupEvent - | CIContent_rcvConnEvent - | CIContent_sndConnEvent - | CIContent_rcvChatFeature - | CIContent_sndChatFeature - | CIContent_rcvChatPreference - | CIContent_sndChatPreference - | CIContent_rcvGroupFeature - | CIContent_sndGroupFeature - | CIContent_rcvChatFeatureRejected - | CIContent_rcvGroupFeatureRejected - | CIContent_sndModerated - | CIContent_rcvModerated - | CIContent_rcvBlocked - | CIContent_sndDirectE2EEInfo - | CIContent_rcvDirectE2EEInfo - | CIContent_sndGroupE2EEInfo - | CIContent_rcvGroupE2EEInfo - | CIContent_chatBanner -) - -CIContent_Tag = Literal["sndMsgContent", "rcvMsgContent", "sndDeleted", "rcvDeleted", "sndCall", "rcvCall", "rcvIntegrityError", "rcvDecryptionError", "rcvMsgError", "rcvGroupInvitation", "sndGroupInvitation", "rcvDirectEvent", "rcvGroupEvent", "sndGroupEvent", "rcvConnEvent", "sndConnEvent", "rcvChatFeature", "sndChatFeature", "rcvChatPreference", "sndChatPreference", "rcvGroupFeature", "sndGroupFeature", "rcvChatFeatureRejected", "rcvGroupFeatureRejected", "sndModerated", "rcvModerated", "rcvBlocked", "sndDirectE2EEInfo", "rcvDirectE2EEInfo", "sndGroupE2EEInfo", "rcvGroupE2EEInfo", "chatBanner"] - -CIDeleteMode = Literal["broadcast", "internal", "internalMark", "history"] - -class CIDeleted_deleted(TypedDict): - type: Literal["deleted"] - deletedTs: NotRequired[str] # ISO-8601 timestamp - chatType: "ChatType" - -class CIDeleted_blocked(TypedDict): - type: Literal["blocked"] - deletedTs: NotRequired[str] # ISO-8601 timestamp - -class CIDeleted_blockedByAdmin(TypedDict): - type: Literal["blockedByAdmin"] - deletedTs: NotRequired[str] # ISO-8601 timestamp - -class CIDeleted_moderated(TypedDict): - type: Literal["moderated"] - deletedTs: NotRequired[str] # ISO-8601 timestamp - byGroupMember: "GroupMember" - -CIDeleted = CIDeleted_deleted | CIDeleted_blocked | CIDeleted_blockedByAdmin | CIDeleted_moderated - -CIDeleted_Tag = Literal["deleted", "blocked", "blockedByAdmin", "moderated"] - -class CIDirection_directSnd(TypedDict): - type: Literal["directSnd"] - -class CIDirection_directRcv(TypedDict): - type: Literal["directRcv"] - -class CIDirection_groupSnd(TypedDict): - type: Literal["groupSnd"] - -class CIDirection_groupRcv(TypedDict): - type: Literal["groupRcv"] - groupMember: "GroupMember" - -class CIDirection_channelRcv(TypedDict): - type: Literal["channelRcv"] - -class CIDirection_localSnd(TypedDict): - type: Literal["localSnd"] - -class CIDirection_localRcv(TypedDict): - type: Literal["localRcv"] - -CIDirection = ( - CIDirection_directSnd - | CIDirection_directRcv - | CIDirection_groupSnd - | CIDirection_groupRcv - | CIDirection_channelRcv - | CIDirection_localSnd - | CIDirection_localRcv -) - -CIDirection_Tag = Literal["directSnd", "directRcv", "groupSnd", "groupRcv", "channelRcv", "localSnd", "localRcv"] - -class CIFile(TypedDict): - fileId: int # int64 - fileName: str - fileSize: int # int64 - fileSource: NotRequired["CryptoFile"] - fileStatus: "CIFileStatus" - fileProtocol: "FileProtocol" - fileExpires: NotRequired[str] # ISO-8601 timestamp - fileProhibited: NotRequired["FileProhibited"] - -class CIFileStatus_sndStored(TypedDict): - type: Literal["sndStored"] - -class CIFileStatus_sndTransfer(TypedDict): - type: Literal["sndTransfer"] - sndProgress: int # int64 - sndTotal: int # int64 - -class CIFileStatus_sndCancelled(TypedDict): - type: Literal["sndCancelled"] - -class CIFileStatus_sndComplete(TypedDict): - type: Literal["sndComplete"] - -class CIFileStatus_sndError(TypedDict): - type: Literal["sndError"] - sndFileError: "FileError" - -class CIFileStatus_sndWarning(TypedDict): - type: Literal["sndWarning"] - sndFileError: "FileError" - -class CIFileStatus_rcvInvitation(TypedDict): - type: Literal["rcvInvitation"] - -class CIFileStatus_rcvAccepted(TypedDict): - type: Literal["rcvAccepted"] - -class CIFileStatus_rcvTransfer(TypedDict): - type: Literal["rcvTransfer"] - rcvProgress: int # int64 - rcvTotal: int # int64 - -class CIFileStatus_rcvAborted(TypedDict): - type: Literal["rcvAborted"] - -class CIFileStatus_rcvComplete(TypedDict): - type: Literal["rcvComplete"] - -class CIFileStatus_rcvCancelled(TypedDict): - type: Literal["rcvCancelled"] - -class CIFileStatus_rcvError(TypedDict): - type: Literal["rcvError"] - rcvFileError: "FileError" - -class CIFileStatus_rcvWarning(TypedDict): - type: Literal["rcvWarning"] - rcvFileError: "FileError" - -class CIFileStatus_invalid(TypedDict): - type: Literal["invalid"] - text: str - -CIFileStatus = ( - CIFileStatus_sndStored - | CIFileStatus_sndTransfer - | CIFileStatus_sndCancelled - | CIFileStatus_sndComplete - | CIFileStatus_sndError - | CIFileStatus_sndWarning - | CIFileStatus_rcvInvitation - | CIFileStatus_rcvAccepted - | CIFileStatus_rcvTransfer - | CIFileStatus_rcvAborted - | CIFileStatus_rcvComplete - | CIFileStatus_rcvCancelled - | CIFileStatus_rcvError - | CIFileStatus_rcvWarning - | CIFileStatus_invalid -) - -CIFileStatus_Tag = Literal["sndStored", "sndTransfer", "sndCancelled", "sndComplete", "sndError", "sndWarning", "rcvInvitation", "rcvAccepted", "rcvTransfer", "rcvAborted", "rcvComplete", "rcvCancelled", "rcvError", "rcvWarning", "invalid"] - -class CIForwardedFrom_unknown(TypedDict): - type: Literal["unknown"] - -class CIForwardedFrom_contact(TypedDict): - type: Literal["contact"] - chatName: str - msgDir: "MsgDirection" - contactId: NotRequired[int] # int64 - chatItemId: NotRequired[int] # int64 - -class CIForwardedFrom_group(TypedDict): - type: Literal["group"] - chatName: str - msgDir: "MsgDirection" - groupId: NotRequired[int] # int64 - chatItemId: NotRequired[int] # int64 - memberId: NotRequired[str] - sharedMsgId_: NotRequired[str] - groupType: NotRequired["GroupType"] - -class CIForwardedFrom_groupLink(TypedDict): - type: Literal["groupLink"] - chatName: str - msgDir: "MsgDirection" - groupLink: str - publicGroupId: str - memberId: NotRequired[str] - sharedMsgId: str - groupType: NotRequired["GroupType"] - -CIForwardedFrom = ( - CIForwardedFrom_unknown - | CIForwardedFrom_contact - | CIForwardedFrom_group - | CIForwardedFrom_groupLink -) - -CIForwardedFrom_Tag = Literal["unknown", "contact", "group", "groupLink"] - -class CIGroupInvitation(TypedDict): - groupId: int # int64 - groupMemberId: int # int64 - localDisplayName: str - groupProfile: "GroupProfile" - status: "CIGroupInvitationStatus" - -CIGroupInvitationStatus = Literal["pending", "accepted", "rejected", "expired"] - -class CIMention(TypedDict): - memberId: str - memberRef: NotRequired["CIMentionMember"] - -class CIMentionMember(TypedDict): - groupMemberId: int # int64 - displayName: str - localAlias: NotRequired[str] - memberRole: "GroupMemberRole" - -class CIMeta(TypedDict): - itemId: int # int64 - itemTs: str # ISO-8601 timestamp - itemText: str - itemStatus: "CIStatus" - sentViaProxy: NotRequired[bool] - itemSharedMsgId: NotRequired[str] - itemForwarded: NotRequired["CIForwardedFrom"] - itemDeleted: NotRequired["CIDeleted"] - itemEdited: bool - itemTimed: NotRequired["CITimed"] - itemLive: NotRequired[bool] - userMention: bool - hasLink: bool - deletable: bool - editable: bool - forwardedByMember: NotRequired[int] # int64 - showGroupAsSender: bool - msgVerified: NotRequired["MsgVerified"] - createdAt: str # ISO-8601 timestamp - updatedAt: str # ISO-8601 timestamp - -class CIQuote(TypedDict): - chatDir: NotRequired["CIDirection"] - itemId: NotRequired[int] # int64 - sharedMsgId: NotRequired[str] - sentAt: str # ISO-8601 timestamp - content: "MsgContent" - formattedText: NotRequired[list["FormattedText"]] - -class CIReaction(TypedDict): - chatDir: "CIDirection" - chatItem: "ChatItem" - sentAt: str # ISO-8601 timestamp - reaction: "MsgReaction" - -class CIReactionCount(TypedDict): - reaction: "MsgReaction" - userReacted: bool - totalReacted: int # int - -class CIStatus_sndNew(TypedDict): - type: Literal["sndNew"] - -class CIStatus_sndSent(TypedDict): - type: Literal["sndSent"] - sndProgress: "SndCIStatusProgress" - -class CIStatus_sndRcvd(TypedDict): - type: Literal["sndRcvd"] - msgRcptStatus: "MsgReceiptStatus" - sndProgress: "SndCIStatusProgress" - -class CIStatus_sndErrorAuth(TypedDict): - type: Literal["sndErrorAuth"] - -class CIStatus_sndError(TypedDict): - type: Literal["sndError"] - agentError: "SndError" - -class CIStatus_sndWarning(TypedDict): - type: Literal["sndWarning"] - agentError: "SndError" - -class CIStatus_rcvNew(TypedDict): - type: Literal["rcvNew"] - -class CIStatus_rcvRead(TypedDict): - type: Literal["rcvRead"] - -class CIStatus_invalid(TypedDict): - type: Literal["invalid"] - text: str - -CIStatus = ( - CIStatus_sndNew - | CIStatus_sndSent - | CIStatus_sndRcvd - | CIStatus_sndErrorAuth - | CIStatus_sndError - | CIStatus_sndWarning - | CIStatus_rcvNew - | CIStatus_rcvRead - | CIStatus_invalid -) - -CIStatus_Tag = Literal["sndNew", "sndSent", "sndRcvd", "sndErrorAuth", "sndError", "sndWarning", "rcvNew", "rcvRead", "invalid"] - -class CITimed(TypedDict): - ttl: int # int - deleteAt: NotRequired[str] # ISO-8601 timestamp - -class ChatBotCommand_command(TypedDict): - type: Literal["command"] - keyword: str - label: str - params: NotRequired[str] - -class ChatBotCommand_menu(TypedDict): - type: Literal["menu"] - label: str - commands: list["ChatBotCommand"] - -ChatBotCommand = ChatBotCommand_command | ChatBotCommand_menu - -ChatBotCommand_Tag = Literal["command", "menu"] - -class ChatDeleteMode_full(TypedDict): - type: Literal["full"] - notify: bool - -class ChatDeleteMode_entity(TypedDict): - type: Literal["entity"] - notify: bool - -class ChatDeleteMode_messages(TypedDict): - type: Literal["messages"] - -ChatDeleteMode = ChatDeleteMode_full | ChatDeleteMode_entity | ChatDeleteMode_messages - -ChatDeleteMode_Tag = Literal["full", "entity", "messages"] - - -def ChatDeleteMode_cmd_string(self: ChatDeleteMode) -> str: - return str(self['type']) + ('' if str(self['type']) == 'messages' else (' notify=off' if not self['notify'] else '')) # type: ignore[typeddict-item] - -class ChatError_error(TypedDict): - type: Literal["error"] - errorType: "ChatErrorType" - -class ChatError_errorAgent(TypedDict): - type: Literal["errorAgent"] - agentError: "AgentErrorType" - agentConnId: str - connectionEntity_: NotRequired["ConnectionEntity"] - -class ChatError_errorStore(TypedDict): - type: Literal["errorStore"] - storeError: "StoreError" - -ChatError = ChatError_error | ChatError_errorAgent | ChatError_errorStore - -ChatError_Tag = Literal["error", "errorAgent", "errorStore"] - -class ChatErrorType_noActiveUser(TypedDict): - type: Literal["noActiveUser"] - -class ChatErrorType_noConnectionUser(TypedDict): - type: Literal["noConnectionUser"] - agentConnId: str - -class ChatErrorType_noSndFileUser(TypedDict): - type: Literal["noSndFileUser"] - agentSndFileId: str - -class ChatErrorType_noRcvFileUser(TypedDict): - type: Literal["noRcvFileUser"] - agentRcvFileId: str - -class ChatErrorType_userUnknown(TypedDict): - type: Literal["userUnknown"] - -class ChatErrorType_userExists(TypedDict): - type: Literal["userExists"] - contactName: str - -class ChatErrorType_chatRelayExists(TypedDict): - type: Literal["chatRelayExists"] - -class ChatErrorType_differentActiveUser(TypedDict): - type: Literal["differentActiveUser"] - commandUserId: int # int64 - activeUserId: int # int64 - -class ChatErrorType_cantDeleteActiveUser(TypedDict): - type: Literal["cantDeleteActiveUser"] - userId: int # int64 - -class ChatErrorType_cantDeleteLastUser(TypedDict): - type: Literal["cantDeleteLastUser"] - userId: int # int64 - -class ChatErrorType_cantHideLastUser(TypedDict): - type: Literal["cantHideLastUser"] - userId: int # int64 - -class ChatErrorType_hiddenUserAlwaysMuted(TypedDict): - type: Literal["hiddenUserAlwaysMuted"] - userId: int # int64 - -class ChatErrorType_emptyUserPassword(TypedDict): - type: Literal["emptyUserPassword"] - userId: int # int64 - -class ChatErrorType_userAlreadyHidden(TypedDict): - type: Literal["userAlreadyHidden"] - userId: int # int64 - -class ChatErrorType_userNotHidden(TypedDict): - type: Literal["userNotHidden"] - userId: int # int64 - -class ChatErrorType_invalidDisplayName(TypedDict): - type: Literal["invalidDisplayName"] - displayName: str - validName: str - -class ChatErrorType_chatNotStarted(TypedDict): - type: Literal["chatNotStarted"] - -class ChatErrorType_chatNotStopped(TypedDict): - type: Literal["chatNotStopped"] - -class ChatErrorType_chatStoreChanged(TypedDict): - type: Literal["chatStoreChanged"] - -class ChatErrorType_invalidConnReq(TypedDict): - type: Literal["invalidConnReq"] - -class ChatErrorType_simplexDomainNotReady(TypedDict): - type: Literal["simplexDomainNotReady"] - simplexDomain: "SimplexDomain" - simplexDomainError: "SimplexDomainError" - -class ChatErrorType_notResolvedLocally(TypedDict): - type: Literal["notResolvedLocally"] - -class ChatErrorType_unsupportedConnReq(TypedDict): - type: Literal["unsupportedConnReq"] - -class ChatErrorType_connReqMessageProhibited(TypedDict): - type: Literal["connReqMessageProhibited"] - -class ChatErrorType_contactNotReady(TypedDict): - type: Literal["contactNotReady"] - contact: "Contact" - -class ChatErrorType_contactNotActive(TypedDict): - type: Literal["contactNotActive"] - contact: "Contact" - -class ChatErrorType_contactDisabled(TypedDict): - type: Literal["contactDisabled"] - contact: "Contact" - -class ChatErrorType_connectionDisabled(TypedDict): - type: Literal["connectionDisabled"] - connection: "Connection" - -class ChatErrorType_groupUserRole(TypedDict): - type: Literal["groupUserRole"] - groupInfo: "GroupInfo" - requiredRole: "GroupMemberRole" - -class ChatErrorType_groupMemberInitialRole(TypedDict): - type: Literal["groupMemberInitialRole"] - groupInfo: "GroupInfo" - initialRole: "GroupMemberRole" - -class ChatErrorType_contactIncognitoCantInvite(TypedDict): - type: Literal["contactIncognitoCantInvite"] - -class ChatErrorType_groupIncognitoCantInvite(TypedDict): - type: Literal["groupIncognitoCantInvite"] - -class ChatErrorType_groupContactRole(TypedDict): - type: Literal["groupContactRole"] - contactName: str - -class ChatErrorType_groupDuplicateMember(TypedDict): - type: Literal["groupDuplicateMember"] - contactName: str - -class ChatErrorType_groupDuplicateMemberId(TypedDict): - type: Literal["groupDuplicateMemberId"] - -class ChatErrorType_groupNotJoined(TypedDict): - type: Literal["groupNotJoined"] - groupInfo: "GroupInfo" - -class ChatErrorType_groupMemberNotActive(TypedDict): - type: Literal["groupMemberNotActive"] - -class ChatErrorType_cantBlockMemberForSelf(TypedDict): - type: Literal["cantBlockMemberForSelf"] - groupInfo: "GroupInfo" - member: "GroupMember" - setShowMessages: bool - -class ChatErrorType_groupMemberUserRemoved(TypedDict): - type: Literal["groupMemberUserRemoved"] - -class ChatErrorType_groupMemberNotFound(TypedDict): - type: Literal["groupMemberNotFound"] - -class ChatErrorType_groupCantResendInvitation(TypedDict): - type: Literal["groupCantResendInvitation"] - groupInfo: "GroupInfo" - contactName: str - -class ChatErrorType_groupInternal(TypedDict): - type: Literal["groupInternal"] - message: str - -class ChatErrorType_fileNotFound(TypedDict): - type: Literal["fileNotFound"] - message: str - -class ChatErrorType_fileSize(TypedDict): - type: Literal["fileSize"] - filePath: str - -class ChatErrorType_fileAlreadyReceiving(TypedDict): - type: Literal["fileAlreadyReceiving"] - message: str - -class ChatErrorType_fileCancelled(TypedDict): - type: Literal["fileCancelled"] - message: str - -class ChatErrorType_fileCancel(TypedDict): - type: Literal["fileCancel"] - fileId: int # int64 - message: str - -class ChatErrorType_fileAlreadyExists(TypedDict): - type: Literal["fileAlreadyExists"] - filePath: str - -class ChatErrorType_fileWrite(TypedDict): - type: Literal["fileWrite"] - filePath: str - message: str - -class ChatErrorType_fileSend(TypedDict): - type: Literal["fileSend"] - fileId: int # int64 - agentError: "AgentErrorType" - -class ChatErrorType_fileRcvChunk(TypedDict): - type: Literal["fileRcvChunk"] - message: str - -class ChatErrorType_fileInternal(TypedDict): - type: Literal["fileInternal"] - message: str - -class ChatErrorType_fileImageType(TypedDict): - type: Literal["fileImageType"] - filePath: str - -class ChatErrorType_fileImageSize(TypedDict): - type: Literal["fileImageSize"] - filePath: str - -class ChatErrorType_fileNotReceived(TypedDict): - type: Literal["fileNotReceived"] - fileId: int # int64 - -class ChatErrorType_fileNotApproved(TypedDict): - type: Literal["fileNotApproved"] - fileId: int # int64 - unknownServers: list[str] - -class ChatErrorType_fallbackToSMPProhibited(TypedDict): - type: Literal["fallbackToSMPProhibited"] - fileId: int # int64 - -class ChatErrorType_inlineFileProhibited(TypedDict): - type: Literal["inlineFileProhibited"] - fileId: int # int64 - -class ChatErrorType_invalidForward(TypedDict): - type: Literal["invalidForward"] - -class ChatErrorType_invalidChatItemUpdate(TypedDict): - type: Literal["invalidChatItemUpdate"] - -class ChatErrorType_invalidChatItemDelete(TypedDict): - type: Literal["invalidChatItemDelete"] - -class ChatErrorType_hasCurrentCall(TypedDict): - type: Literal["hasCurrentCall"] - -class ChatErrorType_noCurrentCall(TypedDict): - type: Literal["noCurrentCall"] - -class ChatErrorType_callContact(TypedDict): - type: Literal["callContact"] - contactId: int # int64 - -class ChatErrorType_directMessagesProhibited(TypedDict): - type: Literal["directMessagesProhibited"] - direction: "MsgDirection" - contact: "Contact" - -class ChatErrorType_agentVersion(TypedDict): - type: Literal["agentVersion"] - -class ChatErrorType_agentNoSubResult(TypedDict): - type: Literal["agentNoSubResult"] - agentConnId: str - -class ChatErrorType_commandError(TypedDict): - type: Literal["commandError"] - message: str - -class ChatErrorType_badgeRedeemError(TypedDict): - type: Literal["badgeRedeemError"] - badgeRedeemError: "BadgeRedeemError" - -class ChatErrorType_agentCommandError(TypedDict): - type: Literal["agentCommandError"] - message: str - -class ChatErrorType_invalidFileDescription(TypedDict): - type: Literal["invalidFileDescription"] - message: str - -class ChatErrorType_connectionIncognitoChangeProhibited(TypedDict): - type: Literal["connectionIncognitoChangeProhibited"] - -class ChatErrorType_connectionUserChangeProhibited(TypedDict): - type: Literal["connectionUserChangeProhibited"] - -class ChatErrorType_peerChatVRangeIncompatible(TypedDict): - type: Literal["peerChatVRangeIncompatible"] - -class ChatErrorType_relayTestError(TypedDict): - type: Literal["relayTestError"] - message: str - -class ChatErrorType_internalError(TypedDict): - type: Literal["internalError"] - message: str - -class ChatErrorType_exception(TypedDict): - type: Literal["exception"] - message: str - -ChatErrorType = ( - ChatErrorType_noActiveUser - | ChatErrorType_noConnectionUser - | ChatErrorType_noSndFileUser - | ChatErrorType_noRcvFileUser - | ChatErrorType_userUnknown - | ChatErrorType_userExists - | ChatErrorType_chatRelayExists - | ChatErrorType_differentActiveUser - | ChatErrorType_cantDeleteActiveUser - | ChatErrorType_cantDeleteLastUser - | ChatErrorType_cantHideLastUser - | ChatErrorType_hiddenUserAlwaysMuted - | ChatErrorType_emptyUserPassword - | ChatErrorType_userAlreadyHidden - | ChatErrorType_userNotHidden - | ChatErrorType_invalidDisplayName - | ChatErrorType_chatNotStarted - | ChatErrorType_chatNotStopped - | ChatErrorType_chatStoreChanged - | ChatErrorType_invalidConnReq - | ChatErrorType_simplexDomainNotReady - | ChatErrorType_notResolvedLocally - | ChatErrorType_unsupportedConnReq - | ChatErrorType_connReqMessageProhibited - | ChatErrorType_contactNotReady - | ChatErrorType_contactNotActive - | ChatErrorType_contactDisabled - | ChatErrorType_connectionDisabled - | ChatErrorType_groupUserRole - | ChatErrorType_groupMemberInitialRole - | ChatErrorType_contactIncognitoCantInvite - | ChatErrorType_groupIncognitoCantInvite - | ChatErrorType_groupContactRole - | ChatErrorType_groupDuplicateMember - | ChatErrorType_groupDuplicateMemberId - | ChatErrorType_groupNotJoined - | ChatErrorType_groupMemberNotActive - | ChatErrorType_cantBlockMemberForSelf - | ChatErrorType_groupMemberUserRemoved - | ChatErrorType_groupMemberNotFound - | ChatErrorType_groupCantResendInvitation - | ChatErrorType_groupInternal - | ChatErrorType_fileNotFound - | ChatErrorType_fileSize - | ChatErrorType_fileAlreadyReceiving - | ChatErrorType_fileCancelled - | ChatErrorType_fileCancel - | ChatErrorType_fileAlreadyExists - | ChatErrorType_fileWrite - | ChatErrorType_fileSend - | ChatErrorType_fileRcvChunk - | ChatErrorType_fileInternal - | ChatErrorType_fileImageType - | ChatErrorType_fileImageSize - | ChatErrorType_fileNotReceived - | ChatErrorType_fileNotApproved - | ChatErrorType_fallbackToSMPProhibited - | ChatErrorType_inlineFileProhibited - | ChatErrorType_invalidForward - | ChatErrorType_invalidChatItemUpdate - | ChatErrorType_invalidChatItemDelete - | ChatErrorType_hasCurrentCall - | ChatErrorType_noCurrentCall - | ChatErrorType_callContact - | ChatErrorType_directMessagesProhibited - | ChatErrorType_agentVersion - | ChatErrorType_agentNoSubResult - | ChatErrorType_commandError - | ChatErrorType_badgeRedeemError - | ChatErrorType_agentCommandError - | ChatErrorType_invalidFileDescription - | ChatErrorType_connectionIncognitoChangeProhibited - | ChatErrorType_connectionUserChangeProhibited - | ChatErrorType_peerChatVRangeIncompatible - | ChatErrorType_relayTestError - | ChatErrorType_internalError - | ChatErrorType_exception -) - -ChatErrorType_Tag = Literal["noActiveUser", "noConnectionUser", "noSndFileUser", "noRcvFileUser", "userUnknown", "userExists", "chatRelayExists", "differentActiveUser", "cantDeleteActiveUser", "cantDeleteLastUser", "cantHideLastUser", "hiddenUserAlwaysMuted", "emptyUserPassword", "userAlreadyHidden", "userNotHidden", "invalidDisplayName", "chatNotStarted", "chatNotStopped", "chatStoreChanged", "invalidConnReq", "simplexDomainNotReady", "notResolvedLocally", "unsupportedConnReq", "connReqMessageProhibited", "contactNotReady", "contactNotActive", "contactDisabled", "connectionDisabled", "groupUserRole", "groupMemberInitialRole", "contactIncognitoCantInvite", "groupIncognitoCantInvite", "groupContactRole", "groupDuplicateMember", "groupDuplicateMemberId", "groupNotJoined", "groupMemberNotActive", "cantBlockMemberForSelf", "groupMemberUserRemoved", "groupMemberNotFound", "groupCantResendInvitation", "groupInternal", "fileNotFound", "fileSize", "fileAlreadyReceiving", "fileCancelled", "fileCancel", "fileAlreadyExists", "fileWrite", "fileSend", "fileRcvChunk", "fileInternal", "fileImageType", "fileImageSize", "fileNotReceived", "fileNotApproved", "fallbackToSMPProhibited", "inlineFileProhibited", "invalidForward", "invalidChatItemUpdate", "invalidChatItemDelete", "hasCurrentCall", "noCurrentCall", "callContact", "directMessagesProhibited", "agentVersion", "agentNoSubResult", "commandError", "badgeRedeemError", "agentCommandError", "invalidFileDescription", "connectionIncognitoChangeProhibited", "connectionUserChangeProhibited", "peerChatVRangeIncompatible", "relayTestError", "internalError", "exception"] - -ChatFeature = Literal["timedMessages", "fullDelete", "reactions", "voice", "files", "calls", "sessions"] - -class ChatInfo_direct(TypedDict): - type: Literal["direct"] - contact: "Contact" - -class ChatInfo_group(TypedDict): - type: Literal["group"] - groupInfo: "GroupInfo" - groupChatScope: NotRequired["GroupChatScopeInfo"] - -class ChatInfo_local(TypedDict): - type: Literal["local"] - noteFolder: "NoteFolder" - -class ChatInfo_contactRequest(TypedDict): - type: Literal["contactRequest"] - contactRequest: "UserContactRequest" - -class ChatInfo_contactConnection(TypedDict): - type: Literal["contactConnection"] - contactConnection: "PendingContactConnection" - -ChatInfo = ( - ChatInfo_direct - | ChatInfo_group - | ChatInfo_local - | ChatInfo_contactRequest - | ChatInfo_contactConnection -) - -ChatInfo_Tag = Literal["direct", "group", "local", "contactRequest", "contactConnection"] - -class ChatItem(TypedDict): - chatDir: "CIDirection" - meta: "CIMeta" - content: "CIContent" - mentions: dict[str, "CIMention"] - formattedText: NotRequired[list["FormattedText"]] - quotedItem: NotRequired["CIQuote"] - reactions: list["CIReactionCount"] - file: NotRequired["CIFile"] - -# Message deletion result. - -class ChatItemDeletion(TypedDict): - deletedChatItem: "AChatItem" - toChatItem: NotRequired["AChatItem"] - -class ChatListQuery_filters(TypedDict): - type: Literal["filters"] - favorite: bool - unread: bool - -class ChatListQuery_search(TypedDict): - type: Literal["search"] - search: str - -ChatListQuery = ChatListQuery_filters | ChatListQuery_search - -ChatListQuery_Tag = Literal["filters", "search"] - -ChatPeerType = Literal["human", "bot", "business"] - -# Used in API commands. Chat scope can only be passed with groups. - -class ChatRef(TypedDict): - chatType: "ChatType" - chatId: int # int64 - chatScope: NotRequired["GroupChatScope"] - - -def ChatRef_cmd_string(self: ChatRef) -> str: - return ChatType_cmd_string(self['chatType']) + str(self['chatId']) + ((GroupChatScope_cmd_string(self.get('chatScope'))) if self.get('chatScope') is not None else '') - -class ChatSettings(TypedDict): - enableNtfs: "MsgFilter" - sendRcpts: NotRequired[bool] - favorite: bool - -class ChatStats(TypedDict): - unreadCount: int # int - unreadMentions: int # int - reportsCount: int # int - minUnreadItemId: int # int64 - unreadChat: bool - -ChatType = Literal["direct", "group", "local"] - - -def ChatType_cmd_string(self: ChatType) -> str: - return '@' if str(self) == 'direct' else '#' if str(self) == 'group' else '*' if str(self) == 'local' else '' - -class ChatWallpaper(TypedDict): - preset: NotRequired[str] - imageFile: NotRequired[str] - background: NotRequired[str] - tint: NotRequired[str] - scaleType: NotRequired["ChatWallpaperScale"] - scale: NotRequired[float] # double - -ChatWallpaperScale = Literal["fill", "fit", "repeat"] - -class ClientNotice(TypedDict): - ttl: NotRequired[int] # int64 - -Color = Literal["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"] - -class CommandError_UNKNOWN(TypedDict): - type: Literal["UNKNOWN"] - -class CommandError_SYNTAX(TypedDict): - type: Literal["SYNTAX"] - -class CommandError_PROHIBITED(TypedDict): - type: Literal["PROHIBITED"] - -class CommandError_NO_AUTH(TypedDict): - type: Literal["NO_AUTH"] - -class CommandError_HAS_AUTH(TypedDict): - type: Literal["HAS_AUTH"] - -class CommandError_NO_ENTITY(TypedDict): - type: Literal["NO_ENTITY"] - -CommandError = ( - CommandError_UNKNOWN - | CommandError_SYNTAX - | CommandError_PROHIBITED - | CommandError_NO_AUTH - | CommandError_HAS_AUTH - | CommandError_NO_ENTITY -) - -CommandError_Tag = Literal["UNKNOWN", "SYNTAX", "PROHIBITED", "NO_AUTH", "HAS_AUTH", "NO_ENTITY"] - -class CommandErrorType_PROHIBITED(TypedDict): - type: Literal["PROHIBITED"] - -class CommandErrorType_SYNTAX(TypedDict): - type: Literal["SYNTAX"] - -class CommandErrorType_NO_CONN(TypedDict): - type: Literal["NO_CONN"] - -class CommandErrorType_SIZE(TypedDict): - type: Literal["SIZE"] - -class CommandErrorType_LARGE(TypedDict): - type: Literal["LARGE"] - -CommandErrorType = ( - CommandErrorType_PROHIBITED - | CommandErrorType_SYNTAX - | CommandErrorType_NO_CONN - | CommandErrorType_SIZE - | CommandErrorType_LARGE -) - -CommandErrorType_Tag = Literal["PROHIBITED", "SYNTAX", "NO_CONN", "SIZE", "LARGE"] - -class CommentsGroupPreference(TypedDict): - enable: "GroupFeatureEnabled" - duration: NotRequired[int] # int - -class ComposedMessage(TypedDict): - fileSource: NotRequired["CryptoFile"] - quotedItemId: NotRequired[int] # int64 - msgContent: "MsgContent" - mentions: dict[str, int] # str : int64 - -class ConnStatus_new(TypedDict): - type: Literal["new"] - -class ConnStatus_prepared(TypedDict): - type: Literal["prepared"] - -class ConnStatus_joined(TypedDict): - type: Literal["joined"] - -class ConnStatus_requested(TypedDict): - type: Literal["requested"] - -class ConnStatus_accepted(TypedDict): - type: Literal["accepted"] - -class ConnStatus_sndReady(TypedDict): - type: Literal["sndReady"] - -class ConnStatus_ready(TypedDict): - type: Literal["ready"] - -class ConnStatus_deleted(TypedDict): - type: Literal["deleted"] - -class ConnStatus_failed(TypedDict): - type: Literal["failed"] - connError: str - -ConnStatus = ( - ConnStatus_new - | ConnStatus_prepared - | ConnStatus_joined - | ConnStatus_requested - | ConnStatus_accepted - | ConnStatus_sndReady - | ConnStatus_ready - | ConnStatus_deleted - | ConnStatus_failed -) - -ConnStatus_Tag = Literal["new", "prepared", "joined", "requested", "accepted", "sndReady", "ready", "deleted", "failed"] - -ConnType = Literal["contact", "member", "user_contact"] - -class Connection(TypedDict): - connId: int # int64 - agentConnId: str - connChatVersion: int # int - peerChatVRange: "VersionRange" - connLevel: int # int - viaContact: NotRequired[int] # int64 - viaUserContactLink: NotRequired[int] # int64 - viaGroupLink: bool - groupLinkId: NotRequired[str] - xContactId: NotRequired[str] - customUserProfileId: NotRequired[int] # int64 - connType: "ConnType" - connStatus: "ConnStatus" - contactConnInitiated: bool - localAlias: str - entityId: NotRequired[int] # int64 - connectionCode: NotRequired["SecurityCode"] - pqSupport: bool - pqEncryption: bool - pqSndEnabled: NotRequired[bool] - pqRcvEnabled: NotRequired[bool] - authErrCounter: int # int - quotaErrCounter: int # int - createdAt: str # ISO-8601 timestamp - -class ConnectionEntity_rcvDirectMsgConnection(TypedDict): - type: Literal["rcvDirectMsgConnection"] - entityConnection: "Connection" - contact: NotRequired["Contact"] - -class ConnectionEntity_rcvGroupMsgConnection(TypedDict): - type: Literal["rcvGroupMsgConnection"] - entityConnection: "Connection" - groupInfo: "GroupInfo" - groupMember: "GroupMember" - -class ConnectionEntity_userContactConnection(TypedDict): - type: Literal["userContactConnection"] - entityConnection: "Connection" - userContact: "UserContact" - -ConnectionEntity = ( - ConnectionEntity_rcvDirectMsgConnection - | ConnectionEntity_rcvGroupMsgConnection - | ConnectionEntity_userContactConnection -) - -ConnectionEntity_Tag = Literal["rcvDirectMsgConnection", "rcvGroupMsgConnection", "userContactConnection"] - -class ConnectionErrorType_NOT_FOUND(TypedDict): - type: Literal["NOT_FOUND"] - -class ConnectionErrorType_DUPLICATE(TypedDict): - type: Literal["DUPLICATE"] - -class ConnectionErrorType_SIMPLEX(TypedDict): - type: Literal["SIMPLEX"] - -class ConnectionErrorType_NOT_ACCEPTED(TypedDict): - type: Literal["NOT_ACCEPTED"] - -class ConnectionErrorType_NOT_AVAILABLE(TypedDict): - type: Literal["NOT_AVAILABLE"] - -ConnectionErrorType = ( - ConnectionErrorType_NOT_FOUND - | ConnectionErrorType_DUPLICATE - | ConnectionErrorType_SIMPLEX - | ConnectionErrorType_NOT_ACCEPTED - | ConnectionErrorType_NOT_AVAILABLE -) - -ConnectionErrorType_Tag = Literal["NOT_FOUND", "DUPLICATE", "SIMPLEX", "NOT_ACCEPTED", "NOT_AVAILABLE"] - -ConnectionMode = Literal["INV", "CON"] - -class ConnectionPlan_invitationLink(TypedDict): - type: Literal["invitationLink"] - invitationLinkPlan: "InvitationLinkPlan" - -class ConnectionPlan_contactAddress(TypedDict): - type: Literal["contactAddress"] - contactAddressPlan: "ContactAddressPlan" - -class ConnectionPlan_groupLink(TypedDict): - type: Literal["groupLink"] - groupLinkPlan: "GroupLinkPlan" - -class ConnectionPlan_error(TypedDict): - type: Literal["error"] - chatError: "ChatError" - -ConnectionPlan = ( - ConnectionPlan_invitationLink - | ConnectionPlan_contactAddress - | ConnectionPlan_groupLink - | ConnectionPlan_error -) - -ConnectionPlan_Tag = Literal["invitationLink", "contactAddress", "groupLink", "error"] - -class Contact(TypedDict): - contactId: int # int64 - localDisplayName: str - profile: "LocalProfile" - activeConn: NotRequired["Connection"] - contactUsed: bool - contactStatus: "ContactStatus" - chatSettings: "ChatSettings" - userPreferences: "Preferences" - mergedPreferences: "ContactUserPreferences" - createdAt: str # ISO-8601 timestamp - updatedAt: str # ISO-8601 timestamp - chatTs: NotRequired[str] # ISO-8601 timestamp - preparedContact: NotRequired["PreparedContact"] - contactRequestId: NotRequired[int] # int64 - contactRequest: NotRequired["UserContactRequestRef"] - contactGroupMemberId: NotRequired[int] # int64 - contactGrpInvSent: bool - groupDirectInv: NotRequired["GroupDirectInvitation"] - chatTags: list[int] # int64 - chatItemTTL: NotRequired[int] # int64 - uiThemes: NotRequired["UIThemeEntityOverrides"] - chatDeleted: bool - customData: NotRequired[dict[str, object]] - -class ContactAddressPlan_ok(TypedDict): - type: Literal["ok"] - contactSLinkData_: NotRequired["ContactShortLinkData"] - ownerVerification: NotRequired["OwnerVerification"] - -class ContactAddressPlan_ownLink(TypedDict): - type: Literal["ownLink"] - -class ContactAddressPlan_connectingConfirmReconnect(TypedDict): - type: Literal["connectingConfirmReconnect"] - -class ContactAddressPlan_connectingProhibit(TypedDict): - type: Literal["connectingProhibit"] - contact: "Contact" - -class ContactAddressPlan_known(TypedDict): - type: Literal["known"] - contact: "Contact" - -class ContactAddressPlan_contactViaAddress(TypedDict): - type: Literal["contactViaAddress"] - contact: "Contact" - -ContactAddressPlan = ( - ContactAddressPlan_ok - | ContactAddressPlan_ownLink - | ContactAddressPlan_connectingConfirmReconnect - | ContactAddressPlan_connectingProhibit - | ContactAddressPlan_known - | ContactAddressPlan_contactViaAddress -) - -ContactAddressPlan_Tag = Literal["ok", "ownLink", "connectingConfirmReconnect", "connectingProhibit", "known", "contactViaAddress"] - -class ContactShortLinkData(TypedDict): - profile: "Profile" - message: NotRequired["MsgContent"] - business: bool - localBadge: NotRequired["LocalBadge"] - -ContactStatus = Literal["active", "deleted", "deletedByUser", "rejected"] - -class ContactUserPref_contact(TypedDict): - type: Literal["contact"] - preference: "SimplePreference" - -class ContactUserPref_user(TypedDict): - type: Literal["user"] - preference: "SimplePreference" - -ContactUserPref = ContactUserPref_contact | ContactUserPref_user - -ContactUserPref_Tag = Literal["contact", "user"] - -class ContactUserPreference(TypedDict): - enabled: "PrefEnabled" - userPreference: "ContactUserPref" - contactPreference: "SimplePreference" - -class ContactUserPreferences(TypedDict): - timedMessages: "ContactUserPreference" - fullDelete: "ContactUserPreference" - reactions: "ContactUserPreference" - voice: "ContactUserPreference" - files: "ContactUserPreference" - calls: "ContactUserPreference" - sessions: "ContactUserPreference" - commands: NotRequired[list["ChatBotCommand"]] - -class CreatedConnLink(TypedDict): - connFullLink: str - connShortLink: NotRequired[str] - - -def CreatedConnLink_cmd_string(self: CreatedConnLink) -> str: - return self['connFullLink'] + ((' ' + self.get('connShortLink')) if self.get('connShortLink') is not None else '') - -class CryptoFile(TypedDict): - filePath: str - cryptoArgs: NotRequired["CryptoFileArgs"] - -class CryptoFileArgs(TypedDict): - fileKey: str - fileNonce: str - -# Remote controller application info. - -class CtrlAppInfo(TypedDict): - appVersionRange: "AppVersionRange" - deviceName: str - compression: bool - -class DroppedMsg(TypedDict): - brokerTs: str # ISO-8601 timestamp - attempts: int # int - -class E2EInfo(TypedDict): - public: NotRequired[bool] - pqEnabled: NotRequired[bool] - -class ErrorType_BLOCK(TypedDict): - type: Literal["BLOCK"] - -class ErrorType_SESSION(TypedDict): - type: Literal["SESSION"] - -class ErrorType_CMD(TypedDict): - type: Literal["CMD"] - cmdErr: "CommandError" - -class ErrorType_PROXY(TypedDict): - type: Literal["PROXY"] - proxyErr: "ProxyError" - -class ErrorType_AUTH(TypedDict): - type: Literal["AUTH"] - -class ErrorType_BLOCKED(TypedDict): - type: Literal["BLOCKED"] - blockInfo: "BlockingInfo" - -class ErrorType_SERVICE(TypedDict): - type: Literal["SERVICE"] - -class ErrorType_CRYPTO(TypedDict): - type: Literal["CRYPTO"] - -class ErrorType_QUOTA(TypedDict): - type: Literal["QUOTA"] - -class ErrorType_STORE(TypedDict): - type: Literal["STORE"] - storeErr: str - -class ErrorType_NO_MSG(TypedDict): - type: Literal["NO_MSG"] - -class ErrorType_LARGE_MSG(TypedDict): - type: Literal["LARGE_MSG"] - -class ErrorType_EXPIRED(TypedDict): - type: Literal["EXPIRED"] - -class ErrorType_INTERNAL(TypedDict): - type: Literal["INTERNAL"] - -class ErrorType_NAME(TypedDict): - type: Literal["NAME"] - nameErr: "NameErrorType" - -class ErrorType_DUPLICATE_(TypedDict): - type: Literal["DUPLICATE_"] - -ErrorType = ( - ErrorType_BLOCK - | ErrorType_SESSION - | ErrorType_CMD - | ErrorType_PROXY - | ErrorType_AUTH - | ErrorType_BLOCKED - | ErrorType_SERVICE - | ErrorType_CRYPTO - | ErrorType_QUOTA - | ErrorType_STORE - | ErrorType_NO_MSG - | ErrorType_LARGE_MSG - | ErrorType_EXPIRED - | ErrorType_INTERNAL - | ErrorType_NAME - | ErrorType_DUPLICATE_ -) - -ErrorType_Tag = Literal["BLOCK", "SESSION", "CMD", "PROXY", "AUTH", "BLOCKED", "SERVICE", "CRYPTO", "QUOTA", "STORE", "NO_MSG", "LARGE_MSG", "EXPIRED", "INTERNAL", "NAME", "DUPLICATE_"] - -FeatureAllowed = Literal["always", "yes", "no"] - -class FileDescr(TypedDict): - fileDescrText: str - fileDescrPartNo: int # int - fileDescrComplete: bool - -class FileError_auth(TypedDict): - type: Literal["auth"] - -class FileError_blocked(TypedDict): - type: Literal["blocked"] - server: str - blockInfo: "BlockingInfo" - -class FileError_noFile(TypedDict): - type: Literal["noFile"] - -class FileError_relay(TypedDict): - type: Literal["relay"] - srvError: "SrvError" - -class FileError_other(TypedDict): - type: Literal["other"] - fileError: str - -FileError = ( - FileError_auth - | FileError_blocked - | FileError_noFile - | FileError_relay - | FileError_other -) - -FileError_Tag = Literal["auth", "blocked", "noFile", "relay", "other"] - -class FileErrorType_NOT_APPROVED(TypedDict): - type: Literal["NOT_APPROVED"] - -class FileErrorType_SIZE(TypedDict): - type: Literal["SIZE"] - -class FileErrorType_REDIRECT(TypedDict): - type: Literal["REDIRECT"] - redirectError: str - -class FileErrorType_FILE_IO(TypedDict): - type: Literal["FILE_IO"] - fileIOError: str - -class FileErrorType_NO_FILE(TypedDict): - type: Literal["NO_FILE"] - -FileErrorType = ( - FileErrorType_NOT_APPROVED - | FileErrorType_SIZE - | FileErrorType_REDIRECT - | FileErrorType_FILE_IO - | FileErrorType_NO_FILE -) - -FileErrorType_Tag = Literal["NOT_APPROVED", "SIZE", "REDIRECT", "FILE_IO", "NO_FILE"] - -class FileInvitation(TypedDict): - fileName: str - fileSize: int # int64 - fileDigest: NotRequired[str] - fileConnReq: NotRequired[str] - fileInline: NotRequired["InlineFileMode"] - fileDescr: NotRequired["FileDescr"] - fileBadge: NotRequired["BadgeProof"] - -class FileProhibited(TypedDict): - maxSize: int # int64 - badgeStatus: NotRequired["BadgeStatus"] - -FileProtocol = Literal["SMP", "XFTP", "LOCAL"] - -FileStatus = Literal["new", "accepted", "connected", "complete", "cancelled"] - -class FileTransferMeta(TypedDict): - fileId: int # int64 - xftpSndFile: NotRequired["XFTPSndFile"] - xftpRedirectFor: NotRequired[int] # int64 - fileName: str - filePath: str - fileSize: int # int64 - fileInline: NotRequired["InlineFileMode"] - chunkSize: int # int64 - cancelled: bool - -FileType = Literal["normal", "roster"] - -class Format_bold(TypedDict): - type: Literal["bold"] - -class Format_italic(TypedDict): - type: Literal["italic"] - -class Format_strikeThrough(TypedDict): - type: Literal["strikeThrough"] - -class Format_snippet(TypedDict): - type: Literal["snippet"] - -class Format_secret(TypedDict): - type: Literal["secret"] - -class Format_small(TypedDict): - type: Literal["small"] - -class Format_colored(TypedDict): - type: Literal["colored"] - color: "Color" - -class Format_uri(TypedDict): - type: Literal["uri"] - -class Format_hyperLink(TypedDict): - type: Literal["hyperLink"] - showText: NotRequired[str] - linkUri: str - -class Format_simplexLink(TypedDict): - type: Literal["simplexLink"] - showText: NotRequired[str] - linkType: "SimplexLinkType" - simplexUri: str - smpHosts: list[str] # non-empty - -class Format_simplexName(TypedDict): - type: Literal["simplexName"] - nameInfo: "SimplexNameInfo" - -class Format_command(TypedDict): - type: Literal["command"] - commandStr: str - -class Format_mention(TypedDict): - type: Literal["mention"] - memberName: str - -class Format_email(TypedDict): - type: Literal["email"] - -class Format_phone(TypedDict): - type: Literal["phone"] - -Format = ( - Format_bold - | Format_italic - | Format_strikeThrough - | Format_snippet - | Format_secret - | Format_small - | Format_colored - | Format_uri - | Format_hyperLink - | Format_simplexLink - | Format_simplexName - | Format_command - | Format_mention - | Format_email - | Format_phone -) - -Format_Tag = Literal["bold", "italic", "strikeThrough", "snippet", "secret", "small", "colored", "uri", "hyperLink", "simplexLink", "simplexName", "command", "mention", "email", "phone"] - -class FormattedText(TypedDict): - format: NotRequired["Format"] - text: str - -class FullGroupPreferences(TypedDict): - timedMessages: "TimedMessagesGroupPreference" - directMessages: "RoleGroupPreference" - fullDelete: "GroupPreference" - reactions: "GroupPreference" - voice: "RoleGroupPreference" - files: "RoleGroupPreference" - simplexLinks: "RoleGroupPreference" - reports: "GroupPreference" - history: "GroupPreference" - support: "SupportGroupPreference" - sessions: "RoleGroupPreference" - comments: "CommentsGroupPreference" - signMessages: "GroupPreference" - commands: list["ChatBotCommand"] - -class FullPreferences(TypedDict): - timedMessages: "TimedMessagesPreference" - fullDelete: "SimplePreference" - reactions: "SimplePreference" - voice: "SimplePreference" - files: "SimplePreference" - calls: "SimplePreference" - sessions: "SimplePreference" - commands: list["ChatBotCommand"] - -class Group(TypedDict): - groupInfo: "GroupInfo" - members: list["GroupMember"] - -class GroupChatScope_memberSupport(TypedDict): - type: Literal["memberSupport"] - groupMemberId_: NotRequired[int] # int64 - -GroupChatScope = GroupChatScope_memberSupport - -GroupChatScope_Tag = Literal["memberSupport"] - - -def GroupChatScope_cmd_string(self: GroupChatScope) -> str: - return '(_support' + ((':' + str(self.get('groupMemberId_'))) if self.get('groupMemberId_') is not None else '') + ')' # type: ignore[typeddict-item] - -class GroupChatScopeInfo_memberSupport(TypedDict): - type: Literal["memberSupport"] - groupMember_: NotRequired["GroupMember"] - -GroupChatScopeInfo = GroupChatScopeInfo_memberSupport - -GroupChatScopeInfo_Tag = Literal["memberSupport"] - -class GroupDirectInvitation(TypedDict): - groupDirectInvLink: str - fromGroupId_: NotRequired[int] # int64 - fromGroupMemberId_: NotRequired[int] # int64 - fromGroupMemberConnId_: NotRequired[int] # int64 - groupDirectInvStartedConnection: bool - -GroupFeature = Literal["timedMessages", "directMessages", "fullDelete", "reactions", "voice", "files", "simplexLinks", "reports", "history", "support", "sessions", "comments", "signMessages"] - -GroupFeatureEnabled = Literal["on", "off"] - -class GroupInfo(TypedDict): - groupId: int # int64 - useRelays: bool - relayOwnStatus: NotRequired["RelayStatus"] - localDisplayName: str - groupProfile: "GroupProfile" - localAlias: str - businessChat: NotRequired["BusinessChatInfo"] - fullGroupPreferences: "FullGroupPreferences" - membership: "GroupMember" - chatSettings: "ChatSettings" - createdAt: str # ISO-8601 timestamp - updatedAt: str # ISO-8601 timestamp - chatTs: NotRequired[str] # ISO-8601 timestamp - userMemberProfileSentAt: NotRequired[str] # ISO-8601 timestamp - preparedGroup: NotRequired["PreparedGroup"] - chatTags: list[int] # int64 - chatItemTTL: NotRequired[int] # int64 - uiThemes: NotRequired["UIThemeEntityOverrides"] - customData: NotRequired[dict[str, object]] - groupSummary: "GroupSummary" - rosterVersion: NotRequired[int] # int64 - membersRequireAttention: int # int - viaGroupLinkUri: NotRequired[str] - groupDomainVerified: NotRequired[bool] - -class GroupLink(TypedDict): - userContactLinkId: int # int64 - connLinkContact: "CreatedConnLink" - shortLinkDataSet: bool - shortLinkLargeDataSet: bool - groupLinkId: str - acceptMemberRole: "GroupMemberRole" - -class GroupLinkOwner(TypedDict): - memberId: str - memberKey: str - -class GroupLinkPlan_ok(TypedDict): - type: Literal["ok"] - groupSLinkInfo_: NotRequired["GroupShortLinkInfo"] - groupSLinkData_: NotRequired["GroupShortLinkData"] - ownerVerification: NotRequired["OwnerVerification"] - -class GroupLinkPlan_ownLink(TypedDict): - type: Literal["ownLink"] - groupInfo: "GroupInfo" - -class GroupLinkPlan_connectingConfirmReconnect(TypedDict): - type: Literal["connectingConfirmReconnect"] - -class GroupLinkPlan_connectingProhibit(TypedDict): - type: Literal["connectingProhibit"] - groupInfo_: NotRequired["GroupInfo"] - -class GroupLinkPlan_known(TypedDict): - type: Literal["known"] - groupInfo: "GroupInfo" - groupUpdated: bool - ownerVerification: NotRequired["OwnerVerification"] - linkOwners: list["GroupLinkOwner"] - -class GroupLinkPlan_noRelays(TypedDict): - type: Literal["noRelays"] - groupSLinkData_: NotRequired["GroupShortLinkData"] - -class GroupLinkPlan_updateRequired(TypedDict): - type: Literal["updateRequired"] - groupSLinkData_: NotRequired["GroupShortLinkData"] - -GroupLinkPlan = ( - GroupLinkPlan_ok - | GroupLinkPlan_ownLink - | GroupLinkPlan_connectingConfirmReconnect - | GroupLinkPlan_connectingProhibit - | GroupLinkPlan_known - | GroupLinkPlan_noRelays - | GroupLinkPlan_updateRequired -) - -GroupLinkPlan_Tag = Literal["ok", "ownLink", "connectingConfirmReconnect", "connectingProhibit", "known", "noRelays", "updateRequired"] - -class GroupMember(TypedDict): - groupMemberId: int # int64 - groupId: int # int64 - indexInGroup: int # int64 - memberId: str - memberRole: "GroupMemberRole" - memberCategory: "GroupMemberCategory" - memberStatus: "GroupMemberStatus" - memberSettings: "GroupMemberSettings" - blockedByAdmin: bool - invitedBy: "InvitedBy" - invitedByGroupMemberId: NotRequired[int] # int64 - localDisplayName: str - memberProfile: "LocalProfile" - memberContactId: NotRequired[int] # int64 - memberContactProfileId: int # int64 - activeConn: NotRequired["Connection"] - memberChatVRange: "VersionRange" - createdAt: str # ISO-8601 timestamp - updatedAt: str # ISO-8601 timestamp - supportChat: NotRequired["GroupSupportChat"] - memberPubKey: NotRequired[str] - relayLink: NotRequired[str] - memberVerifiedCode: NotRequired["SecurityCode"] - -class GroupMemberAdmission(TypedDict): - review: NotRequired["MemberCriteria"] - -GroupMemberCategory = Literal["user", "invitee", "host", "pre", "post"] - -class GroupMemberRef(TypedDict): - groupMemberId: int # int64 - profile: "Profile" - -GroupMemberRole = Literal["relay", "observer", "author", "member", "moderator", "admin", "owner"] - -class GroupMemberSettings(TypedDict): - showMessages: bool - -GroupMemberStatus = Literal["rejected", "removed", "left", "deleted", "unknown", "invited", "pending_approval", "pending_review", "introduced", "intro-inv", "accepted", "announced", "connected", "complete", "creator"] - -class GroupPreference(TypedDict): - enable: "GroupFeatureEnabled" - -class GroupPreferences(TypedDict): - timedMessages: NotRequired["TimedMessagesGroupPreference"] - directMessages: NotRequired["RoleGroupPreference"] - fullDelete: NotRequired["GroupPreference"] - reactions: NotRequired["GroupPreference"] - voice: NotRequired["RoleGroupPreference"] - files: NotRequired["RoleGroupPreference"] - simplexLinks: NotRequired["RoleGroupPreference"] - reports: NotRequired["GroupPreference"] - history: NotRequired["GroupPreference"] - support: NotRequired["SupportGroupPreference"] - sessions: NotRequired["RoleGroupPreference"] - comments: NotRequired["CommentsGroupPreference"] - signMessages: NotRequired["GroupPreference"] - commands: NotRequired[list["ChatBotCommand"]] - -class GroupProfile(TypedDict): - displayName: str - fullName: str - shortDescr: NotRequired[str] - description: NotRequired[str] - image: NotRequired[str] - publicGroup: NotRequired["PublicGroupProfile"] - groupPreferences: NotRequired["GroupPreferences"] - memberAdmission: NotRequired["GroupMemberAdmission"] - -class GroupRelay(TypedDict): - groupRelayId: int # int64 - groupMemberId: int # int64 - userChatRelay: "UserChatRelay" - relayStatus: "RelayStatus" - relayLink: NotRequired[str] - relayCap: "RelayCapabilities" - -class GroupShortLinkData(TypedDict): - groupProfile: "GroupProfile" - publicGroupData: NotRequired["PublicGroupData"] - -class GroupShortLinkInfo(TypedDict): - direct: bool - groupRelays: list[str] - publicGroupId: NotRequired[str] - -class GroupSummary(TypedDict): - currentMembers: int # int64 - publicMemberCount: NotRequired[int] # int64 - -class GroupSupportChat(TypedDict): - chatTs: str # ISO-8601 timestamp - unread: int # int64 - memberAttention: int # int64 - mentions: int # int64 - lastMsgFromMemberTs: NotRequired[str] # ISO-8601 timestamp - -GroupType = Literal["channel", "group"] - -HandshakeError = Literal["PARSE", "IDENTITY", "BAD_AUTH", "BAD_SERVICE"] - -InlineFileMode = Literal["offer", "sent"] - -class InvitationLinkPlan_ok(TypedDict): - type: Literal["ok"] - contactSLinkData_: NotRequired["ContactShortLinkData"] - ownerVerification: NotRequired["OwnerVerification"] - -class InvitationLinkPlan_ownLink(TypedDict): - type: Literal["ownLink"] - -class InvitationLinkPlan_connecting(TypedDict): - type: Literal["connecting"] - contact_: NotRequired["Contact"] - -class InvitationLinkPlan_known(TypedDict): - type: Literal["known"] - contact: "Contact" - -InvitationLinkPlan = ( - InvitationLinkPlan_ok - | InvitationLinkPlan_ownLink - | InvitationLinkPlan_connecting - | InvitationLinkPlan_known -) - -InvitationLinkPlan_Tag = Literal["ok", "ownLink", "connecting", "known"] - -class InvitedBy_contact(TypedDict): - type: Literal["contact"] - byContactId: int # int64 - -class InvitedBy_user(TypedDict): - type: Literal["user"] - -class InvitedBy_unknown(TypedDict): - type: Literal["unknown"] - -InvitedBy = InvitedBy_contact | InvitedBy_user | InvitedBy_unknown - -InvitedBy_Tag = Literal["contact", "user", "unknown"] - -class LinkContent_page(TypedDict): - type: Literal["page"] - -class LinkContent_image(TypedDict): - type: Literal["image"] - -class LinkContent_video(TypedDict): - type: Literal["video"] - duration: NotRequired[int] # int - -class LinkContent_unknown(TypedDict): - type: Literal["unknown"] - tag: str - json: dict[str, object] - -LinkContent = LinkContent_page | LinkContent_image | LinkContent_video | LinkContent_unknown - -LinkContent_Tag = Literal["page", "image", "video", "unknown"] - -class LinkOwnerSig(TypedDict): - ownerId: NotRequired[str] - chatBinding: str - ownerSig: str - -class LinkPreview(TypedDict): - uri: str - title: str - description: str - image: str - content: NotRequired["LinkContent"] - -class LocalBadge(TypedDict): - badge: "BadgeInfo" - status: "BadgeStatus" - -class LocalProfile(TypedDict): - profileId: int # int64 - displayName: str - fullName: str - shortDescr: NotRequired[str] - description: NotRequired[str] - image: NotRequired[str] - contactLink: NotRequired[str] - preferences: NotRequired["Preferences"] - peerType: NotRequired["ChatPeerType"] - localBadge: NotRequired["LocalBadge"] - localAlias: str - contactDomain: NotRequired["SimplexDomainClaim"] - contactDomainVerified: NotRequired[bool] - -MemberCriteria = Literal["all"] - -# Connection link sent in a message - only short links are allowed. - -class MsgChatLink_contact(TypedDict): - type: Literal["contact"] - connLink: str - profile: "Profile" - business: bool - -class MsgChatLink_invitation(TypedDict): - type: Literal["invitation"] - invLink: str - profile: "Profile" - -class MsgChatLink_group(TypedDict): - type: Literal["group"] - connLink: str - groupProfile: "GroupProfile" - -MsgChatLink = MsgChatLink_contact | MsgChatLink_invitation | MsgChatLink_group - -MsgChatLink_Tag = Literal["contact", "invitation", "group"] - -class MsgContent_text(TypedDict): - type: Literal["text"] - text: str - -class MsgContent_link(TypedDict): - type: Literal["link"] - text: str - preview: "LinkPreview" - -class MsgContent_image(TypedDict): - type: Literal["image"] - text: str - image: str - -class MsgContent_video(TypedDict): - type: Literal["video"] - text: str - image: str - duration: int # int - -class MsgContent_voice(TypedDict): - type: Literal["voice"] - text: str - duration: int # int - -class MsgContent_file(TypedDict): - type: Literal["file"] - text: str - -class MsgContent_report(TypedDict): - type: Literal["report"] - text: str - reason: "ReportReason" - -class MsgContent_chat(TypedDict): - type: Literal["chat"] - text: str - chatLink: "MsgChatLink" - ownerSig: NotRequired["LinkOwnerSig"] - -class MsgContent_unknown(TypedDict): - type: Literal["unknown"] - tag: str - text: str - json: dict[str, object] - -MsgContent = ( - MsgContent_text - | MsgContent_link - | MsgContent_image - | MsgContent_video - | MsgContent_voice - | MsgContent_file - | MsgContent_report - | MsgContent_chat - | MsgContent_unknown -) - -MsgContent_Tag = Literal["text", "link", "image", "video", "voice", "file", "report", "chat", "unknown"] - -MsgDecryptError = Literal["ratchetHeader", "tooManySkipped", "ratchetEarlier", "other", "ratchetSync"] - -MsgDirection = Literal["rcv", "snd"] - -class MsgErrorType_msgSkipped(TypedDict): - type: Literal["msgSkipped"] - fromMsgId: int # int64 - toMsgId: int # int64 - -class MsgErrorType_msgBadId(TypedDict): - type: Literal["msgBadId"] - msgId: int # int64 - -class MsgErrorType_msgBadHash(TypedDict): - type: Literal["msgBadHash"] - -class MsgErrorType_msgDuplicate(TypedDict): - type: Literal["msgDuplicate"] - -MsgErrorType = ( - MsgErrorType_msgSkipped - | MsgErrorType_msgBadId - | MsgErrorType_msgBadHash - | MsgErrorType_msgDuplicate -) - -MsgErrorType_Tag = Literal["msgSkipped", "msgBadId", "msgBadHash", "msgDuplicate"] - -MsgFilter = Literal["none", "all", "mentions"] - -class MsgReaction_emoji(TypedDict): - type: Literal["emoji"] - emoji: str - -class MsgReaction_unknown(TypedDict): - type: Literal["unknown"] - tag: str - json: dict[str, object] - -MsgReaction = MsgReaction_emoji | MsgReaction_unknown - -MsgReaction_Tag = Literal["emoji", "unknown"] - -MsgReceiptStatus = Literal["ok", "badMsgHash"] - -MsgSigStatus = Literal["verified", "signedNoKey"] - -class MsgVerified_signed(TypedDict): - type: Literal["signed"] - sigStatus: "MsgSigStatus" - -class MsgVerified_sigMissing(TypedDict): - type: Literal["sigMissing"] - -MsgVerified = MsgVerified_signed | MsgVerified_sigMissing - -MsgVerified_Tag = Literal["signed", "sigMissing"] - -class NameErrorType_NO_RESOLVER(TypedDict): - type: Literal["NO_RESOLVER"] - -class NameErrorType_NOT_FOUND(TypedDict): - type: Literal["NOT_FOUND"] - -class NameErrorType_RESOLVER(TypedDict): - type: Literal["RESOLVER"] - resolverErr: str - -NameErrorType = NameErrorType_NO_RESOLVER | NameErrorType_NOT_FOUND | NameErrorType_RESOLVER - -NameErrorType_Tag = Literal["NO_RESOLVER", "NOT_FOUND", "RESOLVER"] - -class NetworkError_connectError(TypedDict): - type: Literal["connectError"] - connectError: str - -class NetworkError_tLSError(TypedDict): - type: Literal["tLSError"] - tlsError: str - -class NetworkError_unknownCAError(TypedDict): - type: Literal["unknownCAError"] - -class NetworkError_failedError(TypedDict): - type: Literal["failedError"] - -class NetworkError_timeoutError(TypedDict): - type: Literal["timeoutError"] - -class NetworkError_subscribeError(TypedDict): - type: Literal["subscribeError"] - subscribeError: str - -NetworkError = ( - NetworkError_connectError - | NetworkError_tLSError - | NetworkError_unknownCAError - | NetworkError_failedError - | NetworkError_timeoutError - | NetworkError_subscribeError -) - -NetworkError_Tag = Literal["connectError", "tLSError", "unknownCAError", "failedError", "timeoutError", "subscribeError"] - -class NewUser(TypedDict): - profile: NotRequired["Profile"] - pastTimestamp: bool - userChatRelay: bool - clientService: bool - -class NoteFolder(TypedDict): - noteFolderId: 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 OwnerVerification_verified(TypedDict): - type: Literal["verified"] - -class OwnerVerification_failed(TypedDict): - type: Literal["failed"] - reason: str - -OwnerVerification = OwnerVerification_verified | OwnerVerification_failed - -OwnerVerification_Tag = Literal["verified", "failed"] - -class PaginationByTime_last(TypedDict): - type: Literal["last"] - count: int # int - -PaginationByTime = PaginationByTime_last - -PaginationByTime_Tag = Literal["last"] - - -def PaginationByTime_cmd_string(self: PaginationByTime) -> str: - return 'count=' + str(self['count']) # type: ignore[typeddict-item] - -class PendingContactConnection(TypedDict): - pccConnId: int # int64 - pccAgentConnId: str - pccConnStatus: "ConnStatus" - viaContactUri: bool - viaUserContactLink: NotRequired[int] # int64 - groupLinkId: NotRequired[str] - customUserProfileId: NotRequired[int] # int64 - connLinkInv: NotRequired["CreatedConnLink"] - localAlias: str - createdAt: str # ISO-8601 timestamp - updatedAt: str # ISO-8601 timestamp - -PlanResolveMode = Literal["allGroups", "unknown", "never"] - -class PrefEnabled(TypedDict): - forUser: bool - forContact: bool - -class Preferences(TypedDict): - timedMessages: NotRequired["TimedMessagesPreference"] - fullDelete: NotRequired["SimplePreference"] - reactions: NotRequired["SimplePreference"] - voice: NotRequired["SimplePreference"] - files: NotRequired["SimplePreference"] - calls: NotRequired["SimplePreference"] - sessions: NotRequired["SimplePreference"] - commands: NotRequired[list["ChatBotCommand"]] - -class PreparedContact(TypedDict): - connLinkToConnect: "CreatedConnLink" - uiConnLinkType: "ConnectionMode" - welcomeSharedMsgId: NotRequired[str] - requestSharedMsgId: NotRequired[str] - -class PreparedGroup(TypedDict): - connLinkToConnect: "CreatedConnLink" - connLinkPreparedConnection: bool - connLinkStartedConnection: bool - welcomeSharedMsgId: NotRequired[str] - requestSharedMsgId: NotRequired[str] - -class Profile(TypedDict): - displayName: str - fullName: str - shortDescr: NotRequired[str] - description: NotRequired[str] - image: NotRequired[str] - contactLink: NotRequired[str] - preferences: NotRequired["Preferences"] - peerType: NotRequired["ChatPeerType"] - badge: NotRequired["BadgeProof"] - contactDomain: NotRequired["SimplexDomainClaim"] - -class ProxyClientError_protocolError(TypedDict): - type: Literal["protocolError"] - protocolErr: "ErrorType" - -class ProxyClientError_unexpectedResponse(TypedDict): - type: Literal["unexpectedResponse"] - responseStr: str - -class ProxyClientError_responseError(TypedDict): - type: Literal["responseError"] - responseErr: "ErrorType" - -ProxyClientError = ( - ProxyClientError_protocolError - | ProxyClientError_unexpectedResponse - | ProxyClientError_responseError -) - -ProxyClientError_Tag = Literal["protocolError", "unexpectedResponse", "responseError"] - -class ProxyError_PROTOCOL(TypedDict): - type: Literal["PROTOCOL"] - protocolErr: "ErrorType" - -class ProxyError_BROKER(TypedDict): - type: Literal["BROKER"] - brokerErr: "BrokerErrorType" - -class ProxyError_BASIC_AUTH(TypedDict): - type: Literal["BASIC_AUTH"] - -class ProxyError_NO_SESSION(TypedDict): - type: Literal["NO_SESSION"] - -ProxyError = ProxyError_PROTOCOL | ProxyError_BROKER | ProxyError_BASIC_AUTH | ProxyError_NO_SESSION - -ProxyError_Tag = Literal["PROTOCOL", "BROKER", "BASIC_AUTH", "NO_SESSION"] - -class PublicGroupAccess(TypedDict): - groupWebPage: NotRequired[str] - groupDomainClaim: NotRequired["SimplexDomainClaim"] - domainWebPage: bool - allowEmbedding: bool - -class PublicGroupData(TypedDict): - publicMemberCount: int # int64 - -class PublicGroupProfile(TypedDict): - groupType: "GroupType" - groupLink: str - publicGroupId: str - publicGroupAccess: NotRequired["PublicGroupAccess"] - -class RCErrorType_internal(TypedDict): - type: Literal["internal"] - internalErr: str - -class RCErrorType_identity(TypedDict): - type: Literal["identity"] - -class RCErrorType_noLocalAddress(TypedDict): - type: Literal["noLocalAddress"] - -class RCErrorType_newController(TypedDict): - type: Literal["newController"] - -class RCErrorType_notDiscovered(TypedDict): - type: Literal["notDiscovered"] - -class RCErrorType_tLSStartFailed(TypedDict): - type: Literal["tLSStartFailed"] - -class RCErrorType_exception(TypedDict): - type: Literal["exception"] - exception: str - -class RCErrorType_ctrlAuth(TypedDict): - type: Literal["ctrlAuth"] - -class RCErrorType_ctrlNotFound(TypedDict): - type: Literal["ctrlNotFound"] - -class RCErrorType_ctrlError(TypedDict): - type: Literal["ctrlError"] - ctrlErr: str - -class RCErrorType_invitation(TypedDict): - type: Literal["invitation"] - -class RCErrorType_version(TypedDict): - type: Literal["version"] - -class RCErrorType_encrypt(TypedDict): - type: Literal["encrypt"] - -class RCErrorType_decrypt(TypedDict): - type: Literal["decrypt"] - -class RCErrorType_blockSize(TypedDict): - type: Literal["blockSize"] - -class RCErrorType_syntax(TypedDict): - type: Literal["syntax"] - syntaxErr: str - -RCErrorType = ( - RCErrorType_internal - | RCErrorType_identity - | RCErrorType_noLocalAddress - | RCErrorType_newController - | RCErrorType_notDiscovered - | RCErrorType_tLSStartFailed - | RCErrorType_exception - | RCErrorType_ctrlAuth - | RCErrorType_ctrlNotFound - | RCErrorType_ctrlError - | RCErrorType_invitation - | RCErrorType_version - | RCErrorType_encrypt - | RCErrorType_decrypt - | RCErrorType_blockSize - | RCErrorType_syntax -) - -RCErrorType_Tag = Literal["internal", "identity", "noLocalAddress", "newController", "notDiscovered", "tLSStartFailed", "exception", "ctrlAuth", "ctrlNotFound", "ctrlError", "invitation", "version", "encrypt", "decrypt", "blockSize", "syntax"] - -RatchetSyncState = Literal["ok", "allowed", "required", "started", "agreed"] - -class RcvConnEvent_switchQueue(TypedDict): - type: Literal["switchQueue"] - phase: "SwitchPhase" - -class RcvConnEvent_ratchetSync(TypedDict): - type: Literal["ratchetSync"] - syncStatus: "RatchetSyncState" - -class RcvConnEvent_verificationCodeReset(TypedDict): - type: Literal["verificationCodeReset"] - -class RcvConnEvent_pqEnabled(TypedDict): - type: Literal["pqEnabled"] - enabled: bool - -RcvConnEvent = ( - RcvConnEvent_switchQueue - | RcvConnEvent_ratchetSync - | RcvConnEvent_verificationCodeReset - | RcvConnEvent_pqEnabled -) - -RcvConnEvent_Tag = Literal["switchQueue", "ratchetSync", "verificationCodeReset", "pqEnabled"] - -class RcvDirectEvent_contactDeleted(TypedDict): - type: Literal["contactDeleted"] - -class RcvDirectEvent_profileUpdated(TypedDict): - type: Literal["profileUpdated"] - fromProfile: "Profile" - toProfile: "Profile" - -class RcvDirectEvent_groupInvLinkReceived(TypedDict): - type: Literal["groupInvLinkReceived"] - groupProfile: "GroupProfile" - -RcvDirectEvent = ( - RcvDirectEvent_contactDeleted - | RcvDirectEvent_profileUpdated - | RcvDirectEvent_groupInvLinkReceived -) - -RcvDirectEvent_Tag = Literal["contactDeleted", "profileUpdated", "groupInvLinkReceived"] - -class RcvFileDescr(TypedDict): - fileDescrId: int # int64 - fileDescrText: str - fileDescrPartNo: int # int - fileDescrComplete: bool - -class RcvFileStatus_new(TypedDict): - type: Literal["new"] - -class RcvFileStatus_accepted(TypedDict): - type: Literal["accepted"] - filePath: str - -class RcvFileStatus_connected(TypedDict): - type: Literal["connected"] - filePath: str - -class RcvFileStatus_complete(TypedDict): - type: Literal["complete"] - filePath: str - -class RcvFileStatus_cancelled(TypedDict): - type: Literal["cancelled"] - filePath_: NotRequired[str] - -RcvFileStatus = ( - RcvFileStatus_new - | RcvFileStatus_accepted - | RcvFileStatus_connected - | RcvFileStatus_complete - | RcvFileStatus_cancelled -) - -RcvFileStatus_Tag = Literal["new", "accepted", "connected", "complete", "cancelled"] - -class RcvFileTransfer(TypedDict): - fileId: int # int64 - xftpRcvFile: NotRequired["XFTPRcvFile"] - fileInvitation: "FileInvitation" - fileProhibited: NotRequired["FileProhibited"] - fileStatus: "RcvFileStatus" - fileType: "FileType" - rcvFileInline: NotRequired["InlineFileMode"] - senderDisplayName: str - chunkSize: int # int64 - cancelled: bool - grpMemberId: NotRequired[int] # int64 - cryptoArgs: NotRequired["CryptoFileArgs"] - -class RcvGroupEvent_memberAdded(TypedDict): - type: Literal["memberAdded"] - groupMemberId: int # int64 - profile: "Profile" - -class RcvGroupEvent_memberConnected(TypedDict): - type: Literal["memberConnected"] - -class RcvGroupEvent_memberAccepted(TypedDict): - type: Literal["memberAccepted"] - groupMemberId: int # int64 - profile: "Profile" - -class RcvGroupEvent_userAccepted(TypedDict): - type: Literal["userAccepted"] - -class RcvGroupEvent_memberLeft(TypedDict): - type: Literal["memberLeft"] - -class RcvGroupEvent_memberRole(TypedDict): - type: Literal["memberRole"] - groupMemberId: int # int64 - profile: "Profile" - role: "GroupMemberRole" - -class RcvGroupEvent_memberBlocked(TypedDict): - type: Literal["memberBlocked"] - groupMemberId: int # int64 - profile: "Profile" - blocked: bool - -class RcvGroupEvent_userRole(TypedDict): - type: Literal["userRole"] - role: "GroupMemberRole" - -class RcvGroupEvent_memberDeleted(TypedDict): - type: Literal["memberDeleted"] - groupMemberId: int # int64 - profile: "Profile" - -class RcvGroupEvent_userDeleted(TypedDict): - type: Literal["userDeleted"] - -class RcvGroupEvent_groupDeleted(TypedDict): - type: Literal["groupDeleted"] - -class RcvGroupEvent_groupUpdated(TypedDict): - type: Literal["groupUpdated"] - groupProfile: "GroupProfile" - -class RcvGroupEvent_invitedViaGroupLink(TypedDict): - type: Literal["invitedViaGroupLink"] - -class RcvGroupEvent_memberCreatedContact(TypedDict): - type: Literal["memberCreatedContact"] - -class RcvGroupEvent_memberProfileUpdated(TypedDict): - type: Literal["memberProfileUpdated"] - fromProfile: "Profile" - toProfile: "Profile" - -class RcvGroupEvent_newMemberPendingReview(TypedDict): - type: Literal["newMemberPendingReview"] - -class RcvGroupEvent_msgBadSignature(TypedDict): - type: Literal["msgBadSignature"] - -RcvGroupEvent = ( - RcvGroupEvent_memberAdded - | RcvGroupEvent_memberConnected - | RcvGroupEvent_memberAccepted - | RcvGroupEvent_userAccepted - | RcvGroupEvent_memberLeft - | RcvGroupEvent_memberRole - | RcvGroupEvent_memberBlocked - | RcvGroupEvent_userRole - | RcvGroupEvent_memberDeleted - | RcvGroupEvent_userDeleted - | RcvGroupEvent_groupDeleted - | RcvGroupEvent_groupUpdated - | RcvGroupEvent_invitedViaGroupLink - | RcvGroupEvent_memberCreatedContact - | RcvGroupEvent_memberProfileUpdated - | RcvGroupEvent_newMemberPendingReview - | RcvGroupEvent_msgBadSignature -) - -RcvGroupEvent_Tag = Literal["memberAdded", "memberConnected", "memberAccepted", "userAccepted", "memberLeft", "memberRole", "memberBlocked", "userRole", "memberDeleted", "userDeleted", "groupDeleted", "groupUpdated", "invitedViaGroupLink", "memberCreatedContact", "memberProfileUpdated", "newMemberPendingReview", "msgBadSignature"] - -class RcvMsgError_dropped(TypedDict): - type: Literal["dropped"] - attempts: int # int - -class RcvMsgError_parseError(TypedDict): - type: Literal["parseError"] - parseError: str - -RcvMsgError = RcvMsgError_dropped | RcvMsgError_parseError - -RcvMsgError_Tag = Literal["dropped", "parseError"] - -class RelayCapabilities(TypedDict): - webDomain: NotRequired[str] - -class RelayConnectionResult(TypedDict): - relayMember: "GroupMember" - relayError: NotRequired["ChatError"] - -class RelayProfile(TypedDict): - displayName: str - fullName: str - shortDescr: NotRequired[str] - image: NotRequired[str] - -RelayStatus = Literal["new", "invited", "accepted", "acknowledgedRoster", "active", "inactive", "rejected"] - -class RemoteCtrlInfo(TypedDict): - remoteCtrlId: int # int64 - ctrlDeviceName: str - sessionState: NotRequired["RemoteCtrlSessionState"] - -class RemoteCtrlSessionState_starting(TypedDict): - type: Literal["starting"] - -class RemoteCtrlSessionState_searching(TypedDict): - type: Literal["searching"] - -class RemoteCtrlSessionState_connecting(TypedDict): - type: Literal["connecting"] - -class RemoteCtrlSessionState_pendingConfirmation(TypedDict): - type: Literal["pendingConfirmation"] - sessionCode: str - -class RemoteCtrlSessionState_connected(TypedDict): - type: Literal["connected"] - sessionCode: str - -RemoteCtrlSessionState = ( - RemoteCtrlSessionState_starting - | RemoteCtrlSessionState_searching - | RemoteCtrlSessionState_connecting - | RemoteCtrlSessionState_pendingConfirmation - | RemoteCtrlSessionState_connected -) - -RemoteCtrlSessionState_Tag = Literal["starting", "searching", "connecting", "pendingConfirmation", "connected"] - -class RemoteCtrlStopReason_discoveryFailed(TypedDict): - type: Literal["discoveryFailed"] - chatError: "ChatError" - -class RemoteCtrlStopReason_connectionFailed(TypedDict): - type: Literal["connectionFailed"] - chatError: "ChatError" - -class RemoteCtrlStopReason_setupFailed(TypedDict): - type: Literal["setupFailed"] - chatError: "ChatError" - -class RemoteCtrlStopReason_disconnected(TypedDict): - type: Literal["disconnected"] - -RemoteCtrlStopReason = ( - RemoteCtrlStopReason_discoveryFailed - | RemoteCtrlStopReason_connectionFailed - | RemoteCtrlStopReason_setupFailed - | RemoteCtrlStopReason_disconnected -) - -RemoteCtrlStopReason_Tag = Literal["discoveryFailed", "connectionFailed", "setupFailed", "disconnected"] - -ReportReason = Literal["spam", "content", "community", "profile", "other"] - -class RoleGroupPreference(TypedDict): - enable: "GroupFeatureEnabled" - role: NotRequired["GroupMemberRole"] - -class SMPAgentError_A_MESSAGE(TypedDict): - type: Literal["A_MESSAGE"] - messageErr: str - -class SMPAgentError_A_PROHIBITED(TypedDict): - type: Literal["A_PROHIBITED"] - prohibitedErr: str - -class SMPAgentError_A_VERSION(TypedDict): - type: Literal["A_VERSION"] - -class SMPAgentError_A_LINK(TypedDict): - type: Literal["A_LINK"] - linkErr: str - -class SMPAgentError_A_CRYPTO(TypedDict): - type: Literal["A_CRYPTO"] - cryptoErr: "AgentCryptoError" - -class SMPAgentError_A_DUPLICATE(TypedDict): - type: Literal["A_DUPLICATE"] - droppedMsg_: NotRequired["DroppedMsg"] - -class SMPAgentError_A_QUEUE(TypedDict): - type: Literal["A_QUEUE"] - queueErr: str - -class SMPAgentError_A_SERVICE(TypedDict): - type: Literal["A_SERVICE"] - serviceError: "AgentServiceError" - -SMPAgentError = ( - SMPAgentError_A_MESSAGE - | SMPAgentError_A_PROHIBITED - | SMPAgentError_A_VERSION - | SMPAgentError_A_LINK - | SMPAgentError_A_CRYPTO - | SMPAgentError_A_DUPLICATE - | SMPAgentError_A_QUEUE - | SMPAgentError_A_SERVICE -) - -SMPAgentError_Tag = Literal["A_MESSAGE", "A_PROHIBITED", "A_VERSION", "A_LINK", "A_CRYPTO", "A_DUPLICATE", "A_QUEUE", "A_SERVICE"] - -class SecurityCode(TypedDict): - securityCode: str - verifiedAt: str # ISO-8601 timestamp - -class SimplePreference(TypedDict): - allow: "FeatureAllowed" - -class SimplexDomain(TypedDict): - nameTLD: "SimplexTLD" - domain: str - subDomain: list[str] - -class SimplexDomainClaim(TypedDict): - domain: str - proof: NotRequired["SimplexDomainProof"] - -class SimplexDomainError_noValidLink(TypedDict): - type: Literal["noValidLink"] - -class SimplexDomainError_unknownDomain(TypedDict): - type: Literal["unknownDomain"] - -SimplexDomainError = SimplexDomainError_noValidLink | SimplexDomainError_unknownDomain - -SimplexDomainError_Tag = Literal["noValidLink", "unknownDomain"] - -class SimplexDomainProof(TypedDict): - linkOwnerId: NotRequired[str] - presHeader: str - signature: str - -SimplexLinkType = Literal["contact", "invitation", "group", "channel", "relay"] - -class SimplexNameInfo(TypedDict): - nameType: "SimplexNameType" - nameDomain: "SimplexDomain" - -SimplexNameType = Literal["publicGroup", "contact"] - -SimplexTLD = Literal["simplex", "testing", "web"] - -SndCIStatusProgress = Literal["partial", "complete"] - -class SndConnEvent_switchQueue(TypedDict): - type: Literal["switchQueue"] - phase: "SwitchPhase" - member: NotRequired["GroupMemberRef"] - -class SndConnEvent_ratchetSync(TypedDict): - type: Literal["ratchetSync"] - syncStatus: "RatchetSyncState" - member: NotRequired["GroupMemberRef"] - -class SndConnEvent_pqEnabled(TypedDict): - type: Literal["pqEnabled"] - enabled: bool - -SndConnEvent = SndConnEvent_switchQueue | SndConnEvent_ratchetSync | SndConnEvent_pqEnabled - -SndConnEvent_Tag = Literal["switchQueue", "ratchetSync", "pqEnabled"] - -class SndError_auth(TypedDict): - type: Literal["auth"] - -class SndError_quota(TypedDict): - type: Literal["quota"] - -class SndError_expired(TypedDict): - type: Literal["expired"] - -class SndError_relay(TypedDict): - type: Literal["relay"] - srvError: "SrvError" - -class SndError_proxy(TypedDict): - type: Literal["proxy"] - proxyServer: str - srvError: "SrvError" - -class SndError_proxyRelay(TypedDict): - type: Literal["proxyRelay"] - proxyServer: str - srvError: "SrvError" - -class SndError_other(TypedDict): - type: Literal["other"] - sndError: str - -SndError = ( - SndError_auth - | SndError_quota - | SndError_expired - | SndError_relay - | SndError_proxy - | SndError_proxyRelay - | SndError_other -) - -SndError_Tag = Literal["auth", "quota", "expired", "relay", "proxy", "proxyRelay", "other"] - -class SndFileTransfer(TypedDict): - fileId: int # int64 - fileName: str - filePath: str - fileSize: int # int64 - chunkSize: int # int64 - recipientDisplayName: str - connId: int # int64 - agentConnId: str - groupMemberId: NotRequired[int] # int64 - fileStatus: "FileStatus" - fileDescrId: NotRequired[int] # int64 - fileInline: NotRequired["InlineFileMode"] - -class SndGroupEvent_memberRole(TypedDict): - type: Literal["memberRole"] - groupMemberId: int # int64 - profile: "Profile" - role: "GroupMemberRole" - -class SndGroupEvent_memberBlocked(TypedDict): - type: Literal["memberBlocked"] - groupMemberId: int # int64 - profile: "Profile" - blocked: bool - -class SndGroupEvent_userRole(TypedDict): - type: Literal["userRole"] - role: "GroupMemberRole" - -class SndGroupEvent_memberDeleted(TypedDict): - type: Literal["memberDeleted"] - groupMemberId: int # int64 - profile: "Profile" - -class SndGroupEvent_userLeft(TypedDict): - type: Literal["userLeft"] - -class SndGroupEvent_groupUpdated(TypedDict): - type: Literal["groupUpdated"] - groupProfile: "GroupProfile" - -class SndGroupEvent_memberAccepted(TypedDict): - type: Literal["memberAccepted"] - groupMemberId: int # int64 - profile: "Profile" - -class SndGroupEvent_userPendingReview(TypedDict): - type: Literal["userPendingReview"] - -SndGroupEvent = ( - SndGroupEvent_memberRole - | SndGroupEvent_memberBlocked - | SndGroupEvent_userRole - | SndGroupEvent_memberDeleted - | SndGroupEvent_userLeft - | SndGroupEvent_groupUpdated - | SndGroupEvent_memberAccepted - | SndGroupEvent_userPendingReview -) - -SndGroupEvent_Tag = Literal["memberRole", "memberBlocked", "userRole", "memberDeleted", "userLeft", "groupUpdated", "memberAccepted", "userPendingReview"] - -class SrvError_host(TypedDict): - type: Literal["host"] - -class SrvError_version(TypedDict): - type: Literal["version"] - -class SrvError_other(TypedDict): - type: Literal["other"] - srvError: str - -SrvError = SrvError_host | SrvError_version | SrvError_other - -SrvError_Tag = Literal["host", "version", "other"] - -class StoreError_duplicateName(TypedDict): - type: Literal["duplicateName"] - -class StoreError_userNotFound(TypedDict): - type: Literal["userNotFound"] - userId: int # int64 - -class StoreError_relayUserNotFound(TypedDict): - type: Literal["relayUserNotFound"] - -class StoreError_userNotFoundByName(TypedDict): - type: Literal["userNotFoundByName"] - contactName: str - -class StoreError_userNotFoundByContactId(TypedDict): - type: Literal["userNotFoundByContactId"] - contactId: int # int64 - -class StoreError_userNotFoundByGroupId(TypedDict): - type: Literal["userNotFoundByGroupId"] - groupId: int # int64 - -class StoreError_userNotFoundByFileId(TypedDict): - type: Literal["userNotFoundByFileId"] - fileId: int # int64 - -class StoreError_userNotFoundByContactRequestId(TypedDict): - type: Literal["userNotFoundByContactRequestId"] - contactRequestId: int # int64 - -class StoreError_contactNotFound(TypedDict): - type: Literal["contactNotFound"] - contactId: int # int64 - -class StoreError_contactNotFoundByName(TypedDict): - type: Literal["contactNotFoundByName"] - contactName: str - -class StoreError_contactNotFoundByMemberId(TypedDict): - type: Literal["contactNotFoundByMemberId"] - groupMemberId: int # int64 - -class StoreError_contactNotReady(TypedDict): - type: Literal["contactNotReady"] - contactName: str - -class StoreError_duplicateContactLink(TypedDict): - type: Literal["duplicateContactLink"] - -class StoreError_userContactLinkNotFound(TypedDict): - type: Literal["userContactLinkNotFound"] - -class StoreError_contactRequestNotFound(TypedDict): - type: Literal["contactRequestNotFound"] - contactRequestId: int # int64 - -class StoreError_contactRequestNotFoundByName(TypedDict): - type: Literal["contactRequestNotFoundByName"] - contactName: str - -class StoreError_invalidContactRequestEntity(TypedDict): - type: Literal["invalidContactRequestEntity"] - contactRequestId: int # int64 - -class StoreError_invalidBusinessChatContactRequest(TypedDict): - type: Literal["invalidBusinessChatContactRequest"] - -class StoreError_groupNotFound(TypedDict): - type: Literal["groupNotFound"] - groupId: int # int64 - -class StoreError_groupNotFoundByName(TypedDict): - type: Literal["groupNotFoundByName"] - groupName: str - -class StoreError_groupMemberNameNotFound(TypedDict): - type: Literal["groupMemberNameNotFound"] - groupId: int # int64 - groupMemberName: str - -class StoreError_groupMemberNotFound(TypedDict): - type: Literal["groupMemberNotFound"] - groupMemberId: int # int64 - -class StoreError_groupMemberNotFoundByIndex(TypedDict): - type: Literal["groupMemberNotFoundByIndex"] - groupMemberIndex: int # int64 - -class StoreError_memberRelationsVectorNotFound(TypedDict): - type: Literal["memberRelationsVectorNotFound"] - groupMemberId: int # int64 - -class StoreError_groupHostMemberNotFound(TypedDict): - type: Literal["groupHostMemberNotFound"] - groupId: int # int64 - -class StoreError_groupMemberNotFoundByMemberId(TypedDict): - type: Literal["groupMemberNotFoundByMemberId"] - memberId: str - -class StoreError_memberContactGroupMemberNotFound(TypedDict): - type: Literal["memberContactGroupMemberNotFound"] - contactId: int # int64 - -class StoreError_invalidMemberRelationUpdate(TypedDict): - type: Literal["invalidMemberRelationUpdate"] - -class StoreError_groupWithoutUser(TypedDict): - type: Literal["groupWithoutUser"] - -class StoreError_duplicateGroupMember(TypedDict): - type: Literal["duplicateGroupMember"] - -class StoreError_duplicateMemberId(TypedDict): - type: Literal["duplicateMemberId"] - -class StoreError_groupAlreadyJoined(TypedDict): - type: Literal["groupAlreadyJoined"] - -class StoreError_groupInvitationNotFound(TypedDict): - type: Literal["groupInvitationNotFound"] - -class StoreError_noteFolderAlreadyExists(TypedDict): - type: Literal["noteFolderAlreadyExists"] - noteFolderId: int # int64 - -class StoreError_noteFolderNotFound(TypedDict): - type: Literal["noteFolderNotFound"] - noteFolderId: int # int64 - -class StoreError_userNoteFolderNotFound(TypedDict): - type: Literal["userNoteFolderNotFound"] - -class StoreError_sndFileNotFound(TypedDict): - type: Literal["sndFileNotFound"] - fileId: int # int64 - -class StoreError_sndFileInvalid(TypedDict): - type: Literal["sndFileInvalid"] - fileId: int # int64 - -class StoreError_rcvFileNotFound(TypedDict): - type: Literal["rcvFileNotFound"] - fileId: int # int64 - -class StoreError_rcvFileDescrNotFound(TypedDict): - type: Literal["rcvFileDescrNotFound"] - fileId: int # int64 - -class StoreError_fileNotFound(TypedDict): - type: Literal["fileNotFound"] - fileId: int # int64 - -class StoreError_rcvFileInvalid(TypedDict): - type: Literal["rcvFileInvalid"] - fileId: int # int64 - -class StoreError_rcvFileInvalidDescrPart(TypedDict): - type: Literal["rcvFileInvalidDescrPart"] - -class StoreError_localFileNoTransfer(TypedDict): - type: Literal["localFileNoTransfer"] - fileId: int # int64 - -class StoreError_sharedMsgIdNotFoundByFileId(TypedDict): - type: Literal["sharedMsgIdNotFoundByFileId"] - fileId: int # int64 - -class StoreError_fileIdNotFoundBySharedMsgId(TypedDict): - type: Literal["fileIdNotFoundBySharedMsgId"] - sharedMsgId: str - -class StoreError_sndFileNotFoundXFTP(TypedDict): - type: Literal["sndFileNotFoundXFTP"] - agentSndFileId: str - -class StoreError_rcvFileNotFoundXFTP(TypedDict): - type: Literal["rcvFileNotFoundXFTP"] - agentRcvFileId: str - -class StoreError_connectionNotFound(TypedDict): - type: Literal["connectionNotFound"] - agentConnId: str - -class StoreError_connectionNotFoundById(TypedDict): - type: Literal["connectionNotFoundById"] - connId: int # int64 - -class StoreError_connectionNotFoundByMemberId(TypedDict): - type: Literal["connectionNotFoundByMemberId"] - groupMemberId: int # int64 - -class StoreError_pendingConnectionNotFound(TypedDict): - type: Literal["pendingConnectionNotFound"] - connId: int # int64 - -class StoreError_uniqueID(TypedDict): - type: Literal["uniqueID"] - -class StoreError_largeMsg(TypedDict): - type: Literal["largeMsg"] - -class StoreError_internalError(TypedDict): - type: Literal["internalError"] - message: str - -class StoreError_dBException(TypedDict): - type: Literal["dBException"] - message: str - -class StoreError_dBBusyError(TypedDict): - type: Literal["dBBusyError"] - message: str - -class StoreError_badChatItem(TypedDict): - type: Literal["badChatItem"] - itemId: int # int64 - itemTs: NotRequired[str] # ISO-8601 timestamp - -class StoreError_chatItemNotFound(TypedDict): - type: Literal["chatItemNotFound"] - itemId: int # int64 - -class StoreError_chatItemNotFoundByText(TypedDict): - type: Literal["chatItemNotFoundByText"] - text: str - -class StoreError_chatItemSharedMsgIdNotFound(TypedDict): - type: Literal["chatItemSharedMsgIdNotFound"] - sharedMsgId: str - -class StoreError_chatItemNotFoundByFileId(TypedDict): - type: Literal["chatItemNotFoundByFileId"] - fileId: int # int64 - -class StoreError_chatItemNotFoundByContactId(TypedDict): - type: Literal["chatItemNotFoundByContactId"] - contactId: int # int64 - -class StoreError_chatItemNotFoundByGroupId(TypedDict): - type: Literal["chatItemNotFoundByGroupId"] - groupId: int # int64 - -class StoreError_profileNotFound(TypedDict): - type: Literal["profileNotFound"] - profileId: int # int64 - -class StoreError_duplicateGroupLink(TypedDict): - type: Literal["duplicateGroupLink"] - groupInfo: "GroupInfo" - -class StoreError_groupLinkNotFound(TypedDict): - type: Literal["groupLinkNotFound"] - groupInfo: "GroupInfo" - -class StoreError_hostMemberIdNotFound(TypedDict): - type: Literal["hostMemberIdNotFound"] - groupId: int # int64 - -class StoreError_contactNotFoundByFileId(TypedDict): - type: Literal["contactNotFoundByFileId"] - fileId: int # int64 - -class StoreError_noGroupSndStatus(TypedDict): - type: Literal["noGroupSndStatus"] - itemId: int # int64 - groupMemberId: int # int64 - -class StoreError_duplicateGroupMessage(TypedDict): - type: Literal["duplicateGroupMessage"] - groupId: int # int64 - sharedMsgId: str - authorGroupMemberId: NotRequired[int] # int64 - forwardedByGroupMemberId: NotRequired[int] # int64 - -class StoreError_remoteHostNotFound(TypedDict): - type: Literal["remoteHostNotFound"] - remoteHostId: int # int64 - -class StoreError_remoteHostUnknown(TypedDict): - type: Literal["remoteHostUnknown"] - -class StoreError_remoteHostDuplicateCA(TypedDict): - type: Literal["remoteHostDuplicateCA"] - -class StoreError_remoteCtrlNotFound(TypedDict): - type: Literal["remoteCtrlNotFound"] - remoteCtrlId: int # int64 - -class StoreError_remoteCtrlDuplicateCA(TypedDict): - type: Literal["remoteCtrlDuplicateCA"] - -class StoreError_prohibitedDeleteUser(TypedDict): - type: Literal["prohibitedDeleteUser"] - userId: int # int64 - contactId: int # int64 - -class StoreError_operatorNotFound(TypedDict): - type: Literal["operatorNotFound"] - serverOperatorId: int # int64 - -class StoreError_usageConditionsNotFound(TypedDict): - type: Literal["usageConditionsNotFound"] - -class StoreError_userChatRelayNotFound(TypedDict): - type: Literal["userChatRelayNotFound"] - chatRelayId: int # int64 - -class StoreError_groupRelayNotFound(TypedDict): - type: Literal["groupRelayNotFound"] - groupRelayId: int # int64 - -class StoreError_groupRelayNotFoundByMemberId(TypedDict): - type: Literal["groupRelayNotFoundByMemberId"] - groupMemberId: int # int64 - -class StoreError_invalidQuote(TypedDict): - type: Literal["invalidQuote"] - -class StoreError_invalidMention(TypedDict): - type: Literal["invalidMention"] - -class StoreError_invalidDeliveryTask(TypedDict): - type: Literal["invalidDeliveryTask"] - taskId: int # int64 - -class StoreError_deliveryTaskNotFound(TypedDict): - type: Literal["deliveryTaskNotFound"] - taskId: int # int64 - -class StoreError_invalidDeliveryJob(TypedDict): - type: Literal["invalidDeliveryJob"] - jobId: int # int64 - -class StoreError_deliveryJobNotFound(TypedDict): - type: Literal["deliveryJobNotFound"] - jobId: int # int64 - -class StoreError_workItemError(TypedDict): - type: Literal["workItemError"] - errContext: str - -StoreError = ( - StoreError_duplicateName - | StoreError_userNotFound - | StoreError_relayUserNotFound - | StoreError_userNotFoundByName - | StoreError_userNotFoundByContactId - | StoreError_userNotFoundByGroupId - | StoreError_userNotFoundByFileId - | StoreError_userNotFoundByContactRequestId - | StoreError_contactNotFound - | StoreError_contactNotFoundByName - | StoreError_contactNotFoundByMemberId - | StoreError_contactNotReady - | StoreError_duplicateContactLink - | StoreError_userContactLinkNotFound - | StoreError_contactRequestNotFound - | StoreError_contactRequestNotFoundByName - | StoreError_invalidContactRequestEntity - | StoreError_invalidBusinessChatContactRequest - | StoreError_groupNotFound - | StoreError_groupNotFoundByName - | StoreError_groupMemberNameNotFound - | StoreError_groupMemberNotFound - | StoreError_groupMemberNotFoundByIndex - | StoreError_memberRelationsVectorNotFound - | StoreError_groupHostMemberNotFound - | StoreError_groupMemberNotFoundByMemberId - | StoreError_memberContactGroupMemberNotFound - | StoreError_invalidMemberRelationUpdate - | StoreError_groupWithoutUser - | StoreError_duplicateGroupMember - | StoreError_duplicateMemberId - | StoreError_groupAlreadyJoined - | StoreError_groupInvitationNotFound - | StoreError_noteFolderAlreadyExists - | StoreError_noteFolderNotFound - | StoreError_userNoteFolderNotFound - | StoreError_sndFileNotFound - | StoreError_sndFileInvalid - | StoreError_rcvFileNotFound - | StoreError_rcvFileDescrNotFound - | StoreError_fileNotFound - | StoreError_rcvFileInvalid - | StoreError_rcvFileInvalidDescrPart - | StoreError_localFileNoTransfer - | StoreError_sharedMsgIdNotFoundByFileId - | StoreError_fileIdNotFoundBySharedMsgId - | StoreError_sndFileNotFoundXFTP - | StoreError_rcvFileNotFoundXFTP - | StoreError_connectionNotFound - | StoreError_connectionNotFoundById - | StoreError_connectionNotFoundByMemberId - | StoreError_pendingConnectionNotFound - | StoreError_uniqueID - | StoreError_largeMsg - | StoreError_internalError - | StoreError_dBException - | StoreError_dBBusyError - | StoreError_badChatItem - | StoreError_chatItemNotFound - | StoreError_chatItemNotFoundByText - | StoreError_chatItemSharedMsgIdNotFound - | StoreError_chatItemNotFoundByFileId - | StoreError_chatItemNotFoundByContactId - | StoreError_chatItemNotFoundByGroupId - | StoreError_profileNotFound - | StoreError_duplicateGroupLink - | StoreError_groupLinkNotFound - | StoreError_hostMemberIdNotFound - | StoreError_contactNotFoundByFileId - | StoreError_noGroupSndStatus - | StoreError_duplicateGroupMessage - | StoreError_remoteHostNotFound - | StoreError_remoteHostUnknown - | StoreError_remoteHostDuplicateCA - | StoreError_remoteCtrlNotFound - | StoreError_remoteCtrlDuplicateCA - | StoreError_prohibitedDeleteUser - | StoreError_operatorNotFound - | StoreError_usageConditionsNotFound - | StoreError_userChatRelayNotFound - | StoreError_groupRelayNotFound - | StoreError_groupRelayNotFoundByMemberId - | StoreError_invalidQuote - | StoreError_invalidMention - | StoreError_invalidDeliveryTask - | StoreError_deliveryTaskNotFound - | StoreError_invalidDeliveryJob - | StoreError_deliveryJobNotFound - | 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"] - -class SubscriptionStatus_active(TypedDict): - type: Literal["active"] - -class SubscriptionStatus_pending(TypedDict): - type: Literal["pending"] - -class SubscriptionStatus_removed(TypedDict): - type: Literal["removed"] - subError: str - -class SubscriptionStatus_noSub(TypedDict): - type: Literal["noSub"] - -SubscriptionStatus = ( - SubscriptionStatus_active - | SubscriptionStatus_pending - | SubscriptionStatus_removed - | SubscriptionStatus_noSub -) - -SubscriptionStatus_Tag = Literal["active", "pending", "removed", "noSub"] - -class SupportGroupPreference(TypedDict): - enable: "GroupFeatureEnabled" - -SwitchPhase = Literal["started", "confirmed", "secured", "completed"] - -class TimedMessagesGroupPreference(TypedDict): - enable: "GroupFeatureEnabled" - ttl: NotRequired[int] # int - -class TimedMessagesPreference(TypedDict): - allow: "FeatureAllowed" - ttl: NotRequired[int] # int - -class TransportError_badBlock(TypedDict): - type: Literal["badBlock"] - -class TransportError_version(TypedDict): - type: Literal["version"] - -class TransportError_largeMsg(TypedDict): - type: Literal["largeMsg"] - -class TransportError_badSession(TypedDict): - type: Literal["badSession"] - -class TransportError_noServerAuth(TypedDict): - type: Literal["noServerAuth"] - -class TransportError_handshake(TypedDict): - type: Literal["handshake"] - handshakeErr: "HandshakeError" - -TransportError = ( - TransportError_badBlock - | TransportError_version - | TransportError_largeMsg - | TransportError_badSession - | TransportError_noServerAuth - | TransportError_handshake -) - -TransportError_Tag = Literal["badBlock", "version", "largeMsg", "badSession", "noServerAuth", "handshake"] - -UIColorMode = Literal["light", "dark"] - -class UIColors(TypedDict): - accent: NotRequired[str] - accentVariant: NotRequired[str] - secondary: NotRequired[str] - secondaryVariant: NotRequired[str] - background: NotRequired[str] - menus: NotRequired[str] - title: NotRequired[str] - accentVariant2: NotRequired[str] - sentMessage: NotRequired[str] - sentReply: NotRequired[str] - receivedMessage: NotRequired[str] - receivedReply: NotRequired[str] - -class UIThemeEntityOverride(TypedDict): - mode: "UIColorMode" - wallpaper: NotRequired["ChatWallpaper"] - colors: "UIColors" - -class UIThemeEntityOverrides(TypedDict): - light: NotRequired["UIThemeEntityOverride"] - dark: NotRequired["UIThemeEntityOverride"] - -class UpdatedMessage(TypedDict): - msgContent: "MsgContent" - mentions: dict[str, int] # str : int64 - -class User(TypedDict): - userId: int # int64 - agentUserId: int # int64 - userContactId: int # int64 - localDisplayName: str - profile: "LocalProfile" - fullPreferences: "FullPreferences" - activeUser: bool - activeOrder: int # int64 - viewPwdHash: NotRequired["UserPwdHash"] - showNtfs: bool - sendRcptsContacts: bool - sendRcptsSmallGroups: bool - autoAcceptMemberContacts: bool - autoAcceptGroupInvitations: bool - userMemberProfileUpdatedAt: NotRequired[str] # ISO-8601 timestamp - userChatRelay: bool - clientService: bool - uiThemes: NotRequired["UIThemeEntityOverrides"] - -class UserChatRelay(TypedDict): - chatRelayId: int # int64 - address: str - relayProfile: "RelayProfile" - domains: list[str] - preset: bool - tested: NotRequired[bool] - enabled: bool - deleted: bool - -class UserContact(TypedDict): - userContactLinkId: int # int64 - connReqContact: str - groupId: NotRequired[int] # int64 - -class UserContactLink(TypedDict): - userContactLinkId: int # int64 - connLinkContact: "CreatedConnLink" - shortLinkDataSet: bool - shortLinkLargeDataSet: bool - addressSettings: "AddressSettings" - -class UserContactRequest(TypedDict): - contactRequestId: int # int64 - agentInvitationId: str - contactId_: NotRequired[int] # int64 - businessGroupId_: NotRequired[int] # int64 - userContactLinkId_: NotRequired[int] # int64 - cReqChatVRange: "VersionRange" - localDisplayName: str - profileId: int # int64 - profile: "LocalProfile" - createdAt: str # ISO-8601 timestamp - updatedAt: str # ISO-8601 timestamp - xContactId: NotRequired[str] - pqSupport: bool - welcomeSharedMsgId: NotRequired[str] - requestSharedMsgId: NotRequired[str] - rejectionSupported: bool - -class UserContactRequestRef(TypedDict): - contactRequestId: int # int64 - rejectionSupported: bool - -class UserInfo(TypedDict): - user: "User" - unreadCount: int # int - -class UserProfileUpdateSummary(TypedDict): - updateSuccesses: int # int - updateFailures: int # int - changedContacts: list["Contact"] - -class UserPwdHash(TypedDict): - hash: str - salt: str - -class VersionRange(TypedDict): - minVersion: int # int - maxVersion: int # int - -class XFTPErrorType_BLOCK(TypedDict): - type: Literal["BLOCK"] - -class XFTPErrorType_SESSION(TypedDict): - type: Literal["SESSION"] - -class XFTPErrorType_HANDSHAKE(TypedDict): - type: Literal["HANDSHAKE"] - -class XFTPErrorType_CMD(TypedDict): - type: Literal["CMD"] - cmdErr: "CommandError" - -class XFTPErrorType_AUTH(TypedDict): - type: Literal["AUTH"] - -class XFTPErrorType_BLOCKED(TypedDict): - type: Literal["BLOCKED"] - blockInfo: "BlockingInfo" - -class XFTPErrorType_SIZE(TypedDict): - type: Literal["SIZE"] - -class XFTPErrorType_QUOTA(TypedDict): - type: Literal["QUOTA"] - -class XFTPErrorType_DIGEST(TypedDict): - type: Literal["DIGEST"] - -class XFTPErrorType_CRYPTO(TypedDict): - type: Literal["CRYPTO"] - -class XFTPErrorType_NO_FILE(TypedDict): - type: Literal["NO_FILE"] - -class XFTPErrorType_HAS_FILE(TypedDict): - type: Literal["HAS_FILE"] - -class XFTPErrorType_FILE_IO(TypedDict): - type: Literal["FILE_IO"] - -class XFTPErrorType_TIMEOUT(TypedDict): - type: Literal["TIMEOUT"] - -class XFTPErrorType_INTERNAL(TypedDict): - type: Literal["INTERNAL"] - -class XFTPErrorType_DUPLICATE_(TypedDict): - type: Literal["DUPLICATE_"] - -XFTPErrorType = ( - XFTPErrorType_BLOCK - | XFTPErrorType_SESSION - | XFTPErrorType_HANDSHAKE - | XFTPErrorType_CMD - | XFTPErrorType_AUTH - | XFTPErrorType_BLOCKED - | XFTPErrorType_SIZE - | XFTPErrorType_QUOTA - | XFTPErrorType_DIGEST - | XFTPErrorType_CRYPTO - | XFTPErrorType_NO_FILE - | XFTPErrorType_HAS_FILE - | XFTPErrorType_FILE_IO - | XFTPErrorType_TIMEOUT - | XFTPErrorType_INTERNAL - | XFTPErrorType_DUPLICATE_ -) - -XFTPErrorType_Tag = Literal["BLOCK", "SESSION", "HANDSHAKE", "CMD", "AUTH", "BLOCKED", "SIZE", "QUOTA", "DIGEST", "CRYPTO", "NO_FILE", "HAS_FILE", "FILE_IO", "TIMEOUT", "INTERNAL", "DUPLICATE_"] - -class XFTPRcvFile(TypedDict): - rcvFileDescription: "RcvFileDescr" - agentRcvFileId: NotRequired[str] - agentRcvFileDeleted: bool - userApprovedRelays: bool - -class XFTPSndFile(TypedDict): - agentSndFileId: str - privateSndFileDescr: NotRequired[str] - agentSndFileDeleted: bool - cryptoArgs: NotRequired["CryptoFileArgs"] diff --git a/plans/2026-09-22-name-lookup-core-api.md b/plans/2026-09-22-name-lookup-core-api.md index 7bb81796e6..fee3cc28a3 100644 --- a/plans/2026-09-22-name-lookup-core-api.md +++ b/plans/2026-09-22-name-lookup-core-api.md @@ -2,7 +2,7 @@ Defines the core half of #7525 (`ab/names-lookup-api`). Model: `plans/sketches/2026-09-18-names-lookup-flows.excalidraw`, states 1a–4d. Sibling canvas `plans/sketches/2026-09-18-names-phase3a-registration.excalidraw` on `ab/names-actions-api` (#7530), §5. Registry types from simplexmq `ea43df2349f6d3dedd60d5e4aed21fd99316cad9`, `src/Simplex/Messaging/Names/Record.hs`. -No UI work here. This is the contract the Kotlin and Swift apps code against, and nothing in it depends on the wallet (#7475) or on either name-actions API. +The only UI work here is removing the name cache both apps kept (§9). This is the contract the Kotlin and Swift apps code against, and nothing in it depends on the wallet (#7475) or on either name-actions API. --- @@ -16,8 +16,9 @@ No UI work here. This is the contract the Kotlin and Swift apps code against, an 6. What stays an error 7. Decisions taken 8. Compile fixes and regeneration -9. Order of work -10. Done means +9. Re-resolution in core +10. Order of work +11. Done means --- @@ -43,9 +44,9 @@ None of it is reachable: - **`connLink :: Maybe` has no producer** — `Commands.hs:2178` and `:4586` still pass a bare `ACreatedConnLink`. - **It does not compile.** `View.hs:2234` and `:2252` pattern-match `CPContactAddress cap` / `CPGroupLink glp` at the old arity, `viewConnectionPlan` (`View.hs:2214`) takes a non-`Maybe` link and has no `CPNameNotConnectable` case, and `Commands.hs:2178`/`:4586` type-error on the response field. -**Scope.** Core only: types, producer, CLI rendering, generated client types, tests. No Kotlin, no Swift, no migration, no new chat command. +**Scope.** Core: types, producer, CLI rendering, generated client types, tests, and one migration per backend (§9); in the apps, only removing the name cache. No new chat command. -**Not in scope, deliberately.** Registration, renewal and pricing actions — those are #7530 and are reached from the UI, not from a connection plan (§7). No name-resolution cache or TTL in core: the once-a-day rule is expressible with the modes that already exist (§5). +**Not in scope, deliberately.** Registration, renewal and pricing actions — those are #7530 and are reached from the UI, not from a connection plan (§7). --- @@ -80,9 +81,9 @@ connectPlan :: User -> AConnectTarget -> PlanResolveMode -> Maybe LinkOwnerSig The fifth parameter is `NameRecord` today (`Commands.hs:4392`); widening it to `NameRegistration` is what lets the recursion carry expiry, pricing and reserved-reason down to the plan that is finally built. `resolveNameLink` (`:4568-4574`) pattern-matches `NRRegistered {nameRecord}` and throws `SDENoValidLink` otherwise, as it effectively does now. -**`PRMAll` gets its meaning.** It is the contact-side counterpart of `PRMAllGroups`: re-resolve a name whose chat is already known, instead of short-circuiting in `knownLinkPlans`. `PRMAllGroups` covers only groups (`Commands.hs:4509`); contacts have had no escape at all. +**`PRMAll` gets its meaning, and replaces `PRMAllGroups`.** It re-resolves a chat that is already known, instead of short-circuiting in `knownLinkPlans`. `PRMAllGroups` did this for groups only, so it is removed and the directory service uses `PRMAll`. -Nothing is removed. `SimplexDomainError` keeps both constructors (§6). +Nothing else is removed. `SimplexDomainError` keeps both constructors (§6). --- @@ -113,9 +114,9 @@ Step 4 is the whole of 2b–2f, 3d, 4c and 4d, and it is why `connLink` had to b **Expiry is a producer rule, not a UI rule.** An expired name must not yield a connectable plan — "It does not connect while only its owner can renew it". `expires` absent (a v20/v21 router sent the record alone) means expiry is unknown, so the name is treated as live — the only safe reading. The dateless fallback in §4 covers the other case: `expires` known and past, `graceUntil` absent. -**`addressChanged`.** Under `PRMAll`, when the target is a `CTName` and `knownLinkPlans` returns a known contact or group, resolve the link anyway and compare it with the stored one. Equal, or `PRMUnknown`: today's `CAPKnown` / `GLPKnown`, which is 3a. Different: return the `Ok` plan **for the new link**, with `addressChanged = True` — the canvas draws 3c as a profile card for the new address with *Open new chat*, not as a known chat. Every other construction site passes `False`. +**`addressChanged`.** Under `PRMAll`, or under `PRMUnknown` when the stored resolution is stale (§9), when the target is a `CTName` and `knownLinkPlans` returns a known contact or group, resolve the link anyway and compare it with the stored one. Equal, or fresh under `PRMUnknown`: today's `CAPKnown` / `GLPKnown`, which is 3a. Different: return the `Ok` plan **for the new link**, with `addressChanged = True` — the canvas draws 3c as a profile card for the new address with *Open new chat*, not as a known chat. Every other construction site passes `False`. -**Attach on every name target.** `nameRegistration_` is `Just` whenever the connect target was a name, `Nothing` for a link target, regardless of state — so 2a and 3a carry it too and the UI simply ignores it. One rule beats nine. +**Attach on every name target.** `nameRegistration_` is `Just` whenever the connect target was a name, `Nothing` for a link target, regardless of state — so 2a and 3a carry it too and the UI simply ignores it. One rule beats nine. The exception is a known chat answered from the store (§9): the registry is not asked, so it is `Nothing`. --- @@ -133,7 +134,7 @@ Step 4 is the whole of 2b–2f, 3d, 4c and 4d, and it is why `connLink` had to b | 2f | `NRRegistered`, live, no usable link | none | `CPNameNotConnectable d nr` | `Nothing` | | 2g | link resolved, its profile claims another name or none | — | `CPError (… SDEUnknownDomain)` | unchanged | | 2h | network or protocol failure | — | `CPError` | unchanged | -| 3a | any | known chat | `CPContactAddress (CAPKnown ct) (Just nr)` / `CPGroupLink (GLPKnown …) (Just nr)` | `Just` stored | +| 3a | any, or not asked when fresh (§9) | known chat | `CPContactAddress (CAPKnown ct) (Just nr)` / `CPGroupLink (GLPKnown …) (Just nr)`, with `Nothing` when not asked | `Just` stored | | 3b | `NRRegistered`, `expires` past | known chat | `CPContactAddress (CAPKnown ct) (Just nr)` | `Just` stored | | 3c | `NRRegistered`, live, link ≠ stored | known chat | `CPContactAddress (CAPOk … True) (Just nr)` | `Just` resolved | | 3d | `NRAvailable` or `NRReserved` | known chat | `CPContactAddress (CAPKnown ct) (Just nr)` | `Just` stored | @@ -155,16 +156,17 @@ Four readings are left to the UI, because core cannot make them without guessing ## 5. Resolve modes, and the once-a-day rule -The canvas asks that a name you have a chat for resolve at most once a day, or when past its expiry, and that any other name resolve on every tap. No new mode and no core state is needed, because a bare name is already resolved on every call except `PRMNever` (`Commands.hs:4415-4418`), and `PRMNever` already means *use my chat if I have one, otherwise tell me nothing*: +The canvas asks that a name you have a chat for resolve at most once a day, or when past its expiry, and that any other name resolve on every tap. Core applies this under the default mode, from state it stores beside the verification flags (§9): | caller state | mode | result | |---|---|---| -| known chat, answer fresh | `PRMNever` | `CAPKnown` from the store, no network — 3a | -| known chat, stale or past expiry | `PRMAll` | registry + link resolve + compare — 3b, 3c, 3d | -| no known chat | `PRMAll` | full resolution — band 2 | +| known chat, resolved within a day and not past expiry | `PRMUnknown` | `CAPKnown` from the store, no network — 3a | +| known chat, stale or past expiry | `PRMUnknown` | registry + link resolve + compare — 3b, 3c, 3d | +| no known chat | `PRMUnknown` | full resolution — band 2 | +| forced refresh (directory service) | `PRMAll` | always resolves | | per keystroke in search | `PRMNever` | local hit, or `CENotResolvedLocally` swallowed | -Core therefore stays stateless and needs no change for the rule at all. **Where the client keeps the freshness timestamp is left to the UI plan** — it is not a core decision, and the modes above serve it either way. `PRMUnknown` keeps today's meaning and stays the default for link targets and for every other caller; nothing existing changes behaviour. +Link targets keep today's `PRMUnknown` meaning: a known chat is answered from the store. `CENotResolvedLocally` continues to be returned for a `PRMNever` miss and continues to be swallowed by both apps. @@ -187,7 +189,7 @@ Registry and network failures stay `CPError` (2h). The canvas shows the resolver 3. **Dateless alerts rather than suppressed ones.** A user on an old router still learns the name expired; only the two dates go. 4. **Registration does not go through `ConnectionPlan`.** On the sibling canvas, 5a and 5b are the only registration states that would need one — 5a is `CPContactAddress (CAPKnown ct) (Just NRRegistered)`, 5b is `CPContactAddress (CAPOk …) (Just NRRegistered)` — and both are proposed for dropping (`b898b991d`, "suggest to drop 5a & 5b"). With them gone the registration check is a plain name-status call, this API keeps one consumer, and the two surfaces stop competing. Nothing here becomes removable as a result: every field 5a and 5b would have used is independently required by 3b and 3d. 5. **Consequently the lookup canvas's footer line "registration will always resolve" is obsolete** and should come off the sketch with this change. -6. **No cache in core.** §5 shows the rule is expressible with existing modes; a TTL column would be a migration bought for nothing. +6. **Reversed on review (2026-09-24): the freshness rule is in core, not the UIs.** Kept in the apps it was duplicated, lost on export, and keyed by domain name alone, so it was shared across user profiles and, under remote access, across hosts. §9. 7. **The constructor is `CPNameNotConnectable`, renamed from `CPSimplexName`.** All five states it carries share one invariant — you cannot connect — and the attached `NameRegistration` says why. Rejected, with reasons, so they are not re-litigated: *`CPUnregisteredSimplexName`* is false for 2b and 2f, which are registered; *`CPNonResolvingName`* is false for 2b, where both `resolveNameRecord` and `resolveNameLink` succeed and the refusal is policy, and it collides with `CENotResolvedLocally` and with 2h, the cases that genuinely do not resolve; *`CPSimplexName`* reads as a sibling of `CPContactAddress` / `CPGroupLink` naming the target kind, but a name that resolves produces those instead. `CPSimplexDomain`, asked for in review on `ea721d33f`, is vague rather than wrong and remains the fallback if the thread is reopened. The ordering follows the file's dominant negation pattern — `Not`, 20 constructors including the close sibling `CESimplexDomainNotReady`; a `Non` prefix appears nowhere in `src/`. --- @@ -200,7 +202,29 @@ Registry and network failures stay `CPError` (2h). The canvas shows the resolver - `CAPOk` / `GLPOk` construction sites take `addressChanged`. - Regenerate the client types: `bots/api/TYPES.md:1903-1922`, `packages/simplex-chat-client/types/typescript/src/types.ts`, `packages/simplex-chat-python/src/simplex_chat/types/_types.py` all still describe the three-constructor plan. Note that `bots/src/API/Docs/Commands.hs:142` and both generated clients never emit `resolve=`, which is fine and stays. -**Encoding note for the app work that follows.** `ConnectionPlan` derives through `sumTypeJSON`, which is `_owsf`-tagged on iOS and `type`-tagged elsewhere, but `NameRegistration` derives through `taggedObjectJSON` unconditionally — deliberately, since it is the RNAME payload. So one iOS response mixes both forms: `{"_owsf":"contactAddress","contactAddress":{…,"nameRegistration_":{"type":"registered",…}}}`. The Swift decoder for `NameRegistration` must be written for the `type` form. Its `reservedReason` is a bare string that may hold anything up to 32 characters (`NRRUnknown`), so both clients need a default branch. +**Encoding note for the app work that follows.** `ConnectionPlan` derives through `sumTypeJSON`, which is `_owsf`-tagged on iOS and `type`-tagged elsewhere, but `NameRegistration` derives through `taggedObjectJSON` unconditionally — deliberately, since it is the RNAME payload. So one iOS response mixes both forms: `{"_owsf":"contactAddress","contactAddress":{…,"nameRegistration_":{"type":"registered",…}}}`. The Swift decoder for `NameRegistration` is therefore hand-written for the `type` form, as `MsgChatLink`'s is (#6821) — a protocol type in the same position — and follows it: `private enum CodingKeys`, `forKey: .type`, a `container` binding, and an `"Unknown … type"` error. simplexmq cannot switch to `sumTypeJSON`: that is platform-conditional in the core too, so an iOS build would expect `_owsf` while the relay forwards the resolver's `type` form. Its `reservedReason` is a bare string that may hold anything up to 32 characters (`NRRUnknown`), so both clients need a default branch. + +--- + +## 9. Re-resolution in core + +Review on 2026-09-24 reversed decision 6. Each decision below was taken by the author, not the implementer. + +1. **Storage.** `contact_profiles.contact_domain_resolved_at` and `contact_domain_expires_at`; `groups.group_domain_resolved_at` and `group_domain_expires_at` — beside `contact_domain_verified` and `group_domain_verified`, which record whether the name checked out; these record when it was last resolved and when its registration expires. `TEXT` in SQLite, `TIMESTAMPTZ` in Postgres, `_at` as in `badge_purchases.expires_at`. One migration per backend. +2. **Rule.** Under `PRMUnknown`, a known chat reached by a name is re-resolved when `resolved_at` is `NULL` or over a day old, or `expires_at` has passed. `PRMAll` always resolves; `PRMNever` never does. A name with no chat is resolved on every call and nothing is stored; the user's own address is not a chat, so it too is resolved on every call. +3. **Writes.** Wherever core sets a verification flag after a resolution, it also sets `resolved_at` to now and `expires_at` to the registration's expiry, or `NULL` when the caller does not have it — then only the one-day limit applies until the next resolution. That is `setContactDomainVerified`, `setGroupDomainVerified`, and `createPreparedContact`, which inserts a chat created by name already verified. To supply the expiry, `resolveNameRecord` returns it beside the record, for `/_verify domain` (both kinds) and `APISetPublicGroupAccess` to pass on, and `updateGroupFromLinkData` takes it from its callers, since it must not resolve. One path gains a write: a re-resolution confirming the name still resolves to the known chat, which writes nothing today. It re-sets the flag to `True`, a no-op, since only verified chats are found by name. +4. **Moved name.** When re-resolution finds the name resolves elsewhere (3c), nothing is written to the old chat. It stays stale, so each default lookup re-resolves and reports the new address; `resolve=never` still returns the old chat. +5. **Reading.** A store function reads the two columns for the one chat being planned. `LocalProfile` and `GroupInfo` do not change, so the columns never reach the UIs; loading them there would touch 19 queries in 6 store files and both types' JSON. +6. **UIs.** Both apps lose the cache — the preference, `SimplexNameResolved`, the local probe before resolving, and the invalidation in `UserAddressView` — and plan a name with the default mode. +7. **iOS decoding.** Unchanged in substance, per §8. + +**Tests**, in core. A name re-pointed with `registerName` shows whether core queried the registry; a stored time is backdated with `withCCTransaction … DB.execute "UPDATE …"`, as `tests/ChatTests/Groups.hs:8825` does: +- a fresh known chat is answered from the store: after re-pointing, the default plan still returns the old contact; +- with `resolved_at` backdated, the default plan re-resolves and reports the new address; +- with `expires_at` in the past, likewise; +- a name with no chat resolves on every call and stores nothing; +- a moved name stays stale: two default lookups both report the new address; +- `resolve=all` and `resolve=never` are unchanged, and existing tests using them stay as they are. --- @@ -216,6 +240,8 @@ Registry and network failures stay `CPError` (2h). The canvas shows the resolver **E. Regeneration.** §8. Done when the generated types describe five constructors. +**F. Re-resolution in core.** §9: the migration and store functions, the rule and its writes, the core tests, then removing the cache from both apps and aligning the Swift decoder with `MsgChatLink` (§8). Done when the §9 tests and the full names suite pass and neither app keeps a name cache. + --- ## Done means @@ -223,9 +249,9 @@ Registry and network failures stay `CPError` (2h). The canvas shows the resolver - `tests/NameResolver.hs` can answer expired, reserved and available, not only registered-without-dates - every row of §4 is produced by core and asserted by a test - `CPNameNotConnectable` carries a domain and is returned only when no local chat claims the name -- `nameRegistration_` is `Just` for every name target and `Nothing` for every link target -- `PRMAll` re-resolves a known contact, `PRMAllGroups` is unchanged, `PRMNever` is unchanged +- `nameRegistration_` is `Just` for every name target the registry was asked about, and `Nothing` for every link target and every known chat answered from the store +- `PRMAll` re-resolves a known chat, `PRMAllGroups` is removed, `PRMNever` is unchanged, and `PRMUnknown` applies the rule in §9 - an expired name never yields a connectable plan, and an absent `expires` is treated as live - `resolve=all` on a known chat whose name moved returns an `Ok` plan with `addressChanged = True` - `cabal build` and `cabal test` are clean, and the generated client types match -- no migration, no new chat command, no UI file touched +- one migration per backend, no new chat command, and no name cache left in either app diff --git a/simplex-chat.cabal b/simplex-chat.cabal index 72f162d7d8..5497c9c9dc 100644 --- a/simplex-chat.cabal +++ b/simplex-chat.cabal @@ -167,6 +167,7 @@ library Simplex.Chat.Store.Postgres.Migrations.M20260904_file_badges Simplex.Chat.Store.Postgres.Migrations.M20260915_user_badges Simplex.Chat.Store.Postgres.Migrations.M20260918_badge_issue_errors + Simplex.Chat.Store.Postgres.Migrations.M20260924_simplex_name_resolved else exposed-modules: Simplex.Chat.Archive @@ -343,6 +344,7 @@ library Simplex.Chat.Store.SQLite.Migrations.M20260904_file_badges Simplex.Chat.Store.SQLite.Migrations.M20260915_user_badges Simplex.Chat.Store.SQLite.Migrations.M20260918_badge_issue_errors + Simplex.Chat.Store.SQLite.Migrations.M20260924_simplex_name_resolved other-modules: Paths_simplex_chat hs-source-dirs: diff --git a/src/Simplex/Chat/Library/Commands.hs b/src/Simplex/Chat/Library/Commands.hs index e75bd1e3d1..15f03c8b84 100644 --- a/src/Simplex/Chat/Library/Commands.hs +++ b/src/Simplex/Chat/Library/Commands.hs @@ -123,7 +123,7 @@ import Simplex.Messaging.Parsers (base64P) import Simplex.Messaging.Protocol (AProtoServerWithAuth (..), AProtocolType (..), ErrorType (NAME), MsgFlags (..), NameRecord (..), NameRegistration (..), NameResponse (..), NtfServer, ProtoServerWithAuth (..), ProtocolServer, ProtocolType (..), ProtocolTypeI (..), SProtocolType (..), SubscriptionMode (..), UserProtocol, userProtocol) import qualified Simplex.Messaging.Protocol as SMP import Simplex.Messaging.ServiceScheme (ServiceScheme (..)) -import Simplex.Messaging.SystemTime (getSystemSeconds) +import Simplex.Messaging.SystemTime (getSystemSeconds, roundedToUTCTime) import qualified Simplex.Messaging.TMap as TM import Simplex.Messaging.Transport.Client (defaultSocksProxyWithAuth) import Simplex.Messaging.Util @@ -1605,7 +1605,7 @@ processChatCommand cxt nm = \case UserContactLink {shortLinkDataSet, connLinkContact = CCLink _ sl_} <- withFastStore (`getUserAddress` user) case sl_ of Just sl | shortLinkDataSet -> do - NameRecord {nrSimplexContact} <- resolveNameRecord user nm domain + (NameRecord {nrSimplexContact}, _) <- resolveNameRecord user nm domain unless (nameResolvesTo sl nrSimplexContact) $ throwChatError $ CESimplexDomainNotReady domain SDENoValidLink pure $ Just (CLShort sl) _ -> throwCmdError "create the address short link and add it to name" @@ -1958,7 +1958,7 @@ processChatCommand cxt nm = \case (_, cData@(ContactLinkData _ UserContactData {relays = currentRelayLinks}), _) <- getShortLinkConnReq' nm user sLnk groupSLinkData_ <- liftIO $ decodeLinkUserData cData gInfo' <- case groupSLinkData_ of - Just sLinkData -> fst <$> updateGroupFromLinkData user gInfo sLinkData Nothing + Just sLinkData -> fst <$> updateGroupFromLinkData user gInfo sLinkData Nothing Nothing _ -> pure gInfo when (memberRole' (membership gInfo) /= GROwner && memberCurrent (membership gInfo)) $ withGroupLock "syncSubscriberRelays" groupId $ @@ -2410,21 +2410,21 @@ processChatCommand cxt nm = \case let connLink_ = preparedContact >>= \PreparedContact {connLinkToConnect = ACCL m (CCLink _ sLnk_)} -> ACSL m <$> sLnk_ domain <- maybe (throwCmdError "contact has no name to verify") pure contactDomain (verified, reason) <- verifyEntityDomain user nm NTContact domain connLink_ - ct' <- maybe (pure ct) (\v -> withFastStore' $ \db -> setContactDomainVerified db user ct v) verified + ct' <- maybe (pure ct) (\(v, expiresAt) -> withFastStore' $ \db -> setContactDomainVerified db user ct v expiresAt) verified pure $ CRContactDomainVerified user ct' reason APIVerifyGroupDomain groupId -> withUser $ \user -> do g@GroupInfo {groupProfile = GroupProfile {publicGroup}} <- withFastStore $ \db -> getGroupInfo db cxt user groupId PublicGroupProfile {groupLink, publicGroupAccess} <- maybe (throwCmdError "not a public group") pure publicGroup claim <- maybe (throwCmdError "group has no name to verify") pure $ publicGroupAccess >>= groupDomainClaim -- checks the profile link, not the link we joined through (which may have rotated) - (verified, reason) <- + (verified, reason, expiresAt) <- tryAllErrors (resolveNameRecord user nm (claimDomain claim)) >>= \case - Right NameRecord {nrSimplexChannel} - | nameResolvesTo groupLink nrSimplexChannel -> pure (True, Nothing) - | otherwise -> pure (False, Just "the name does not resolve to the link in the group profile") - Left (ChatErrorAgent {agentError = SMP _ (NAME SMP.NOT_FOUND)}) -> pure (False, Just "the name is not registered") + Right (NameRecord {nrSimplexChannel}, expiresAt) + | nameResolvesTo groupLink nrSimplexChannel -> pure (True, Nothing, expiresAt) + | otherwise -> pure (False, Just "the name does not resolve to the link in the group profile", expiresAt) + Left (ChatErrorAgent {agentError = SMP _ (NAME SMP.NOT_FOUND)}) -> pure (False, Just "the name is not registered", Nothing) Left e -> throwError e - g' <- withFastStore' $ \db -> setGroupDomainVerified db user g verified + g' <- withFastStore' $ \db -> setGroupDomainVerified db user g verified expiresAt pure $ CRGroupDomainVerified user g' reason APIConnectContactViaAddress userId incognito contactId -> withUserId userId $ \user -> do ct@Contact {profile = LocalProfile {contactLink}} <- withFastStore $ \db -> getContact db cxt user contactId @@ -3278,7 +3278,7 @@ processChatCommand cxt nm = \case processChatCommand cxt nm $ APIListGroups userId (contactId' <$> ct_) search_ APIUpdateGroupProfile groupId p' -> withUser $ \user -> do gInfo <- withFastStore $ \db -> getGroupInfoKeys db cxt user groupId - runUpdateGroupProfile user gInfo p' False + runUpdateGroupProfile user gInfo p' Nothing UpdateGroupNames gName GroupProfile {displayName, fullName, shortDescr} -> updateGroupProfileByName gName $ \p -> p {displayName, fullName, shortDescr} ShowGroupProfile gName -> withUser $ \user -> @@ -3292,11 +3292,11 @@ processChatCommand cxt nm = \case case publicGroup of Just pg@PublicGroupProfile {groupLink, publicGroupAccess = existingAccess} -> do let domainChanged = (claimDomain <$> newClaim) /= (claimDomain <$> (existingAccess >>= groupDomainClaim)) - forM_ (claimDomain <$> newClaim) $ \newDomain -> - when domainChanged $ do - NameRecord {nrSimplexChannel} <- resolveNameRecord user nm newDomain - unless (nameResolvesTo groupLink nrSimplexChannel) $ throwChatError $ CESimplexDomainNotReady newDomain SDENoValidLink - runUpdateGroupProfile user gInfo p {publicGroup = Just pg {publicGroupAccess = Just access}} (isJust newClaim && domainChanged) + verifiedExpiry_ <- forM (if domainChanged then claimDomain <$> newClaim else Nothing) $ \newDomain -> do + (NameRecord {nrSimplexChannel}, expiresAt) <- resolveNameRecord user nm newDomain + unless (nameResolvesTo groupLink nrSimplexChannel) $ throwChatError $ CESimplexDomainNotReady newDomain SDENoValidLink + pure expiresAt + runUpdateGroupProfile user gInfo p {publicGroup = Just pg {publicGroupAccess = Just access}} verifiedExpiry_ Nothing -> throwChatError $ CECommandError "not a public group" APICreateGroupLink groupId mRole -> withUser $ \user -> withGroupLock "createGroupLink" groupId $ do gInfo@GroupInfo {groupProfile} <- withFastStore $ \db -> getGroupInfo db cxt user groupId @@ -4097,8 +4097,8 @@ processChatCommand cxt nm = \case void (sendDirectContactMessage user ct' $ XInfo p Nothing) `catchAllErrors` eToView lift . when (directOrUsed ct') $ createSndFeatureItems user ct ct' pure $ CRContactPrefsUpdated user ct ct' - runUpdateGroupProfile :: User -> GroupInfoKeys -> GroupProfile -> Bool -> CM ChatResponse - runUpdateGroupProfile user (GIK gInfo@GroupInfo {businessChat, groupProfile = p@GroupProfile {displayName = n}} gks) p'@GroupProfile {displayName = n', image = img', memberAdmission = ma'} domainVerified = do + runUpdateGroupProfile :: User -> GroupInfoKeys -> GroupProfile -> Maybe (Maybe UTCTime) -> CM ChatResponse + runUpdateGroupProfile user (GIK gInfo@GroupInfo {businessChat, groupProfile = p@GroupProfile {displayName = n}} gks) p'@GroupProfile {displayName = n', image = img', memberAdmission = ma'} verifiedExpiry_ = do assertUserGroupRole gInfo GROwner when (n /= n') $ checkValidName n' checkProfileImageSize img' @@ -4107,7 +4107,7 @@ processChatCommand cxt nm = \case -- updateGroupProfile clears domain verification; re-set it when the caller already re-resolved the name gInfo' <- withStore $ \db -> do g <- updateGroupProfile db user gInfo p' - if domainVerified then liftIO $ setGroupDomainVerified db user g True else pure g + maybe (pure g) (liftIO . setGroupDomainVerified db user g True) verifiedExpiry_ msg <- case businessChat of Just BusinessChatInfo {businessId} -> do ms <- withStore' $ \db -> getGroupMembers db cxt user gInfo' @@ -4200,7 +4200,7 @@ processChatCommand cxt nm = \case applicable = if channel then groupFeatureInChannel feature else groupFeatureInRegularGroup feature unless applicable $ throwCmdError $ T.unpack (groupFeatureNameText feature) <> " is not available in " <> (if channel then "channels" else "groups") - runUpdateGroupProfile user gInfo (update p) False + runUpdateGroupProfile user gInfo (update p) Nothing withCurrentCall :: ContactId -> (User -> Contact -> Call -> CM (Maybe Call)) -> CM ChatResponse withCurrentCall ctId action = do (user, ct) <- withStore $ \db -> do @@ -4411,6 +4411,24 @@ processChatCommand cxt nm = \case invitationReqAndPlan cReq sLnk_ cld ov = do plan <- invitationRequestPlan user cReq cld ov `catchAllErrors` (pure . CPError) pure (Just (ACCL SCMInvitation (CCLink cReq sLnk_)), Nothing, Nothing, plan) + connectPlan user t@(ACTarget SCMContact ct) PRMUnknown sig_ Nothing + | isName = + tryAllErrors (connectPlan user t PRMNever sig_ Nothing) >>= \case + Right r@(_, _, _, p) -> ifM (resolvedRecently p) (pure r) resolvePlan + Left _ -> resolvePlan + where + isName = case ct of + CTDomain _ -> True + CTShortContact (CTName _) -> True + _ -> False + resolvePlan = connectPlan user t PRMAll sig_ Nothing + resolvedRecently p = do + resolution_ <- withFastStore' $ \db -> case p of + CPContactAddress (CAPKnown ct') _ -> getContactDomainResolution db user ct' + CPGroupLink (GLPKnown g _ _ _) _ -> getGroupDomainResolution db user g + _ -> pure Nothing + now <- liftIO getCurrentTime + pure $ maybe False (\(resolvedAt, expiresAt_) -> diffUTCTime now resolvedAt < nominalDay && maybe True (now <) expiresAt_) resolution_ connectPlan user (ACTarget SCMContact ct) resolveMode sig_ nameRec = case ct of CTDomain d -- local search only: look up #d then @d in the store, without online name resolution @@ -4466,7 +4484,7 @@ processChatCommand cxt nm = \case when (resolveMode == PRMNever) $ throwChatError CENotResolvedLocally l' <- resolveSLink case known_ of - Just r | knownLinkOf r == Just l' -> pure r + Just r@(_, p) | knownLinkOf r == Just l' -> r <$ when (isJust simplexName_) (setKnownVerified p) _ -> (if isJust known_ then second setAddressChanged else id) <$> resolvedPlan l' where resolvedPlan l' = do @@ -4476,7 +4494,7 @@ processChatCommand cxt nm = \case linkDomain_ = linkProfile_ >>= \Profile {contactDomain} -> claimDomain <$> contactDomain planDomain = case nl of CTName ni -> Just (nameDomain ni); _ -> Nothing refreshContact ct' = case (planDomain, linkProfile_) of - (Just _, Just p) -> updateContactFromLinkData user ct' p + (Just _, Just p) -> updateContactFromLinkData user ct' p expiresAt _ -> pure ct' forM_ planDomain $ \nameDomain -> unless (linkDomain_ == Just nameDomain) $ throwChatError $ CESimplexDomainNotReady nameDomain SDEUnknownDomain @@ -4519,6 +4537,11 @@ processChatCommand cxt nm = \case CTLink l' -> pure l' CTName n -> serverShortLink <$> resolveNameLink n con l' cReq = ACCL SCMContact $ CCLink cReq (Just l') + expiresAt = nameExpiresAt =<< eitherToMaybe =<< nameRec + setKnownVerified = \case + CPContactAddress (CAPKnown ct') _ -> void $ withFastStore' $ \db -> setContactDomainVerified db user ct' True expiresAt + CPGroupLink (GLPKnown g _ _ _) _ -> void $ withFastStore' $ \db -> setGroupDomainVerified db user g True expiresAt + _ -> pure () reResolveKnown (_, p) = resolveMode == PRMAll && case p of CPContactAddress (CAPKnown _) _ -> True CPGroupLink GLPKnown {} _ -> True @@ -4563,7 +4586,7 @@ processChatCommand cxt nm = \case -- data and mark it verified, so the check below passes and future by-name lookups match plan <- case (planDomain, plan0, groupSLinkData_) of (Just nameDomain, CPGroupLink (GLPKnown g u o os) _, Just sLinkData) -> - (\(g', _) -> CPGroupLink (GLPKnown g' u o os) Nothing) <$> updateGroupFromLinkData user g sLinkData (Just nameDomain) + (\(g', _) -> CPGroupLink (GLPKnown g' u o os) Nothing) <$> updateGroupFromLinkData user g sLinkData (Just nameDomain) expiresAt _ -> pure plan0 forM_ planDomain $ \nameDomain -> let domain_ = (\GroupProfile {publicGroup} -> claimDomain <$> (publicGroup >>= publicGroupAccess >>= groupDomainClaim)) =<< case plan of @@ -4588,7 +4611,7 @@ processChatCommand cxt nm = \case let ov = verifyLinkOwner rk owners l' sig_ glOwners = map (\OwnerAuth {ownerId, ownerKey} -> GroupLinkOwner {memberId = MemberId ownerId, memberKey = ownerKey}) owners (g', updated) <- case groupSLinkData_ of - Just sLinkData -> updateGroupFromLinkData user g sLinkData Nothing + Just sLinkData -> updateGroupFromLinkData user g sLinkData (nameDomain <$> simplexName_) expiresAt _ -> pure (g, False) pure (con l' cReq, CPGroupLink (GLPKnown g' updated ov (ListDef glOwners)) Nothing) -- resolve a name to its first contact/channel short link @@ -5111,10 +5134,10 @@ resolveNameRegistration user nm domain = registration <$> withAgent (\a -> resolveSimplexName a nm (aUserId user) domain) -- the resolver now also reports names that are not registered, which stay the agent's NAME NOT_FOUND -resolveNameRecord :: User -> NetworkRequestMode -> SimplexDomain -> CM NameRecord +resolveNameRecord :: User -> NetworkRequestMode -> SimplexDomain -> CM (NameRecord, Maybe UTCTime) resolveNameRecord user nm domain = resolveNameRegistration user nm domain >>= \case - NRRegistered {nameRecord} -> pure nameRecord + reg@NRRegistered {nameRecord} -> pure (nameRecord, nameExpiresAt reg) _ -> throwError $ chatErrorAgent $ SMP "" (NAME SMP.NOT_FOUND) nameExpired :: NameRegistration -> CM Bool @@ -5122,6 +5145,11 @@ nameExpired = \case NRRegistered {expires = Just expires} -> (expires <) <$> liftIO getSystemSeconds _ -> pure False +nameExpiresAt :: NameRegistration -> Maybe UTCTime +nameExpiresAt = \case + NRRegistered {expires} -> roundedToUTCTime <$> expires + _ -> Nothing + nameHasLink :: SimplexNameType -> NameRegistration -> Bool nameHasLink nameType = \case NRRegistered {nameRecord = NameRecord {nrSimplexContact, nrSimplexChannel}} -> case nameType of @@ -5143,20 +5171,20 @@ setAddressChanged = \case CPGroupLink (GLPOk li gld ov _) nr -> CPGroupLink (GLPOk li gld ov True) nr p -> p -verifyEntityDomain :: User -> NetworkRequestMode -> SimplexNameType -> SimplexDomainClaim -> Maybe AConnShortLink -> CM (Maybe Bool, Maybe Text) +verifyEntityDomain :: User -> NetworkRequestMode -> SimplexNameType -> SimplexDomainClaim -> Maybe AConnShortLink -> CM (Maybe (Bool, Maybe UTCTime), Maybe Text) verifyEntityDomain user nm nameType SimplexDomainClaim {domain = StrJSON domain, proof = proof_} connLink_ = case (proof_, connLink_) of (Nothing, _) -> pure (Nothing, Just "no name proof to verify") (_, Nothing) -> pure (Nothing, Just "no connection link to check the name against") (Just proof, Just (ACSL SCMContact profileSLnk)) -> do - NameRecord {nrSimplexContact, nrSimplexChannel} <- resolveNameRecord user nm domain + (NameRecord {nrSimplexContact, nrSimplexChannel}, expiresAt) <- resolveNameRecord user nm domain let resolvedLinks = case nameType of NTContact -> nrSimplexContact NTPublicGroup -> nrSimplexChannel if not (nameResolvesTo profileSLnk resolvedLinks) - then pure (Just False, Just "the name does not resolve to this address") + then pure (Just (False, expiresAt), Just "the name does not resolve to this address") else do ok <- verifyDomainProof proof profileSLnk - pure (Just ok, if ok then Nothing else Just "the name proof was not signed by this address's owner") + pure (Just (ok, expiresAt), if ok then Nothing else Just "the name proof was not signed by this address's owner") (Just _, Just _) -> pure (Nothing, Just "unexpected connection link type for name verification") where verifyDomainProof :: SimplexDomainProof -> ShortLinkContact -> CM Bool @@ -5777,7 +5805,7 @@ sendServiceRequestBytes nm user sendTarget requestTimeout signKey request = do _ -> throwCmdError "service request target must be a contact" CTDomain d -> resolveDomain d resolveDomain d = do - nr <- resolveNameRecord user nm d + (nr, _) <- resolveNameRecord user nm d case firstNameLink CCTContact (nrSimplexContact nr) of Just sLnk -> resolveShortLink sLnk Nothing -> throwChatError $ CESimplexDomainNotReady d SDENoValidLink diff --git a/src/Simplex/Chat/Library/Internal.hs b/src/Simplex/Chat/Library/Internal.hs index e40e2466a5..76e8687739 100644 --- a/src/Simplex/Chat/Library/Internal.hs +++ b/src/Simplex/Chat/Library/Internal.hs @@ -1611,8 +1611,8 @@ updatePublicGroupData user gInfo gks | otherwise = pure gInfo -- must not resolve names here: a background link-data refresh would leak channel membership to the resolver -updateGroupFromLinkData :: User -> GroupInfo -> GroupShortLinkData -> Maybe SimplexDomain -> CM (GroupInfo, Bool) -updateGroupFromLinkData user gInfo@GroupInfo {groupProfile = p, groupSummary = GroupSummary {publicMemberCount = localCount}} GroupShortLinkData {groupProfile, publicGroupData} resolvedDomain_ +updateGroupFromLinkData :: User -> GroupInfo -> GroupShortLinkData -> Maybe SimplexDomain -> Maybe UTCTime -> CM (GroupInfo, Bool) +updateGroupFromLinkData user gInfo@GroupInfo {groupProfile = p, groupSummary = GroupSummary {publicMemberCount = localCount}} GroupShortLinkData {groupProfile, publicGroupData} resolvedDomain_ expiresAt | profileChanged || countChanged || verifyResolved = do cxt <- chatStoreCxt withStore $ \db -> do @@ -1621,7 +1621,7 @@ updateGroupFromLinkData user gInfo@GroupInfo {groupProfile = p, groupSummary = G Just PublicGroupData {publicMemberCount} | countChanged -> setPublicMemberCount db cxt user g publicMemberCount _ -> pure g - g'' <- if verifyResolved then liftIO $ setGroupDomainVerified db user g' True else pure g' + g'' <- if verifyResolved then liftIO $ setGroupDomainVerified db user g' True expiresAt else pure g' pure (g'', profileChanged) | otherwise = pure (gInfo, False) where @@ -1633,13 +1633,13 @@ updateGroupFromLinkData user gInfo@GroupInfo {groupProfile = p, groupSummary = G newClaim = groupClaim groupProfile verifyResolved = isJust resolvedDomain_ && resolvedDomain_ == newClaim -updateContactFromLinkData :: User -> Contact -> Profile -> CM Contact -updateContactFromLinkData user ct@Contact {profile = profile@LocalProfile {contactDomain = prevClaim, contactDomainVerified}} linkProfile@Profile {contactDomain = newClaim} +updateContactFromLinkData :: User -> Contact -> Profile -> Maybe UTCTime -> CM Contact +updateContactFromLinkData user ct@Contact {profile = profile@LocalProfile {contactDomain = prevClaim, contactDomainVerified}} linkProfile@Profile {contactDomain = newClaim} expiresAt | profileChanged || verifyChanged = do cxt <- chatStoreCxt withFastStore $ \db -> do ct' <- updateContactProfile db cxt user ct linkProfile - if verifyChanged then liftIO $ setContactDomainVerified db user ct' True else pure ct' + if verifyChanged then liftIO $ setContactDomainVerified db user ct' True expiresAt else pure ct' | otherwise = pure ct where profileChanged = fromLocalProfile profile /= linkProfile diff --git a/src/Simplex/Chat/Store/Direct.hs b/src/Simplex/Chat/Store/Direct.hs index a87d266b03..2368107f2d 100644 --- a/src/Simplex/Chat/Store/Direct.hs +++ b/src/Simplex/Chat/Store/Direct.hs @@ -52,6 +52,7 @@ module Simplex.Chat.Store.Direct getContactIdByName, updateContactProfile, setContactDomainVerified, + getContactDomainResolution, updateContactUserPreferences, updateContactAlias, updateContactConnectionAlias, @@ -410,7 +411,7 @@ createPreparedContact db cxt user p connLinkToConnect welcomeSharedMsgId verifie let prepared = Just (connLinkToConnect, welcomeSharedMsgId) ctUserPreferences = newContactUserPrefs user p ct <- getContact db cxt user =<< createContact_ db cxt user p ctUserPreferences prepared "" currentTs - liftIO $ maybe (pure ct) (setContactDomainVerified db user ct) verified_ + liftIO $ maybe (pure ct) (\v -> setContactDomainVerified db user ct v Nothing) verified_ updatePreparedContactUser :: DB.Connection -> StoreCxt -> User -> Contact -> User -> ExceptT StoreError IO Contact updatePreparedContactUser @@ -590,17 +591,26 @@ updateContactProfile db cxt user@User {userId} c p' = do clearVerificationIfClaimChanged pure $ Right c {localDisplayName = ldn, profile, mergedPreferences} -setContactDomainVerified :: DB.Connection -> User -> Contact -> Bool -> IO Contact -setContactDomainVerified db User {userId} ct@Contact {contactId, profile = p} verified = do +setContactDomainVerified :: DB.Connection -> User -> Contact -> Bool -> Maybe UTCTime -> IO Contact +setContactDomainVerified db User {userId} ct@Contact {contactId, profile = p} verified expiresAt = do + currentTs <- getCurrentTime DB.execute db [sql| - UPDATE contact_profiles SET contact_domain_verified = ? + UPDATE contact_profiles SET contact_domain_verified = ?, contact_domain_resolved_at = ?, contact_domain_expires_at = ? WHERE contact_profile_id IN (SELECT contact_profile_id FROM contacts WHERE user_id = ? AND contact_id = ?) |] - (BI verified, userId, contactId) + (BI verified, currentTs, expiresAt, userId, contactId) pure (ct {profile = p {contactDomainVerified = Just verified}} :: Contact) +getContactDomainResolution :: DB.Connection -> User -> Contact -> IO (Maybe (UTCTime, Maybe UTCTime)) +getContactDomainResolution db User {userId} Contact {profile = LocalProfile {profileId}} = + maybeFirstRow id $ + DB.query + db + "SELECT contact_domain_resolved_at, contact_domain_expires_at FROM contact_profiles WHERE user_id = ? AND contact_profile_id = ? AND contact_domain_resolved_at IS NOT NULL" + (userId, profileId) + updateContactUserPreferences :: DB.Connection -> User -> Contact -> Preferences -> IO Contact updateContactUserPreferences db user@User {userId} c@Contact {contactId} userPreferences = do updatedAt <- getCurrentTime diff --git a/src/Simplex/Chat/Store/Groups.hs b/src/Simplex/Chat/Store/Groups.hs index 2c0b2dc080..9c252ececf 100644 --- a/src/Simplex/Chat/Store/Groups.hs +++ b/src/Simplex/Chat/Store/Groups.hs @@ -47,6 +47,7 @@ module Simplex.Chat.Store.Groups getGroupInfoByGroupLinkHash, updateGroupProfile, setGroupDomainVerified, + getGroupDomainResolution, updateGroupPreferences, updateGroupProfileFromMember, getGroupIdByName, @@ -669,7 +670,7 @@ createPreparedGroup db gVar cxt user@User {userId, userContactId} groupProfile b -- a business has no domain in its profile, so set it out-of-band; a channel already has it (createGroup_), just verify g' <- liftIO $ case verifiedDomain of Just d | business -> setPreparedGroupDomain db user g d - Just _ -> setGroupDomainVerified db user g True + Just _ -> setGroupDomainVerified db user g True Nothing Nothing -> pure g pure (g', hostMember_) where @@ -2740,14 +2741,23 @@ updateGroupProfile db user@User {userId} g@GroupInfo {groupId, localDisplayName, (ldn, currentTs, userId, groupId) safeDeleteLDN db user localDisplayName -setGroupDomainVerified :: DB.Connection -> User -> GroupInfo -> Bool -> IO GroupInfo -setGroupDomainVerified db User {userId} g@GroupInfo {groupId} verified = do +setGroupDomainVerified :: DB.Connection -> User -> GroupInfo -> Bool -> Maybe UTCTime -> IO GroupInfo +setGroupDomainVerified db User {userId} g@GroupInfo {groupId} verified expiresAt = do + currentTs <- getCurrentTime DB.execute db - "UPDATE groups SET group_domain_verified = ? WHERE user_id = ? AND group_id = ?" - (BI verified, userId, groupId) + "UPDATE groups SET group_domain_verified = ?, group_domain_resolved_at = ?, group_domain_expires_at = ? WHERE user_id = ? AND group_id = ?" + (BI verified, currentTs, expiresAt, userId, groupId) pure g {groupDomainVerified = Just verified} +getGroupDomainResolution :: DB.Connection -> User -> GroupInfo -> IO (Maybe (UTCTime, Maybe UTCTime)) +getGroupDomainResolution db User {userId} GroupInfo {groupId} = + maybeFirstRow id $ + DB.query + db + "SELECT group_domain_resolved_at, group_domain_expires_at FROM groups WHERE user_id = ? AND group_id = ? AND group_domain_resolved_at IS NOT NULL" + (userId, groupId) + -- A business group has no publicGroup claim, so the domain it was connected by (from its address) is written -- directly to group_domain and marked verified, so it is found by the local name search (getGroupToConnect). setPreparedGroupDomain :: DB.Connection -> User -> GroupInfo -> SimplexDomain -> IO GroupInfo @@ -2759,7 +2769,7 @@ setPreparedGroupDomain db user@User {userId} g@GroupInfo {groupId} domain = do WHERE group_profile_id IN (SELECT group_profile_id FROM groups WHERE user_id = ? AND group_id = ?) |] (domain, userId, groupId) - setGroupDomainVerified db user g True + setGroupDomainVerified db user g True Nothing updateGroupPreferences :: DB.Connection -> User -> GroupInfo -> GroupPreferences -> IO GroupInfo updateGroupPreferences db User {userId} g@GroupInfo {groupId, groupProfile = p} ps = do diff --git a/src/Simplex/Chat/Store/Postgres/Migrations.hs b/src/Simplex/Chat/Store/Postgres/Migrations.hs index 40c13527d9..2d351f4bec 100644 --- a/src/Simplex/Chat/Store/Postgres/Migrations.hs +++ b/src/Simplex/Chat/Store/Postgres/Migrations.hs @@ -52,6 +52,7 @@ import Simplex.Chat.Store.Postgres.Migrations.M20260828_file_expiry import Simplex.Chat.Store.Postgres.Migrations.M20260904_file_badges import Simplex.Chat.Store.Postgres.Migrations.M20260915_user_badges import Simplex.Chat.Store.Postgres.Migrations.M20260918_badge_issue_errors +import Simplex.Chat.Store.Postgres.Migrations.M20260924_simplex_name_resolved import Simplex.Messaging.Agent.Store.Shared (Migration (..)) schemaMigrations :: [(String, Text, Maybe Text)] @@ -103,7 +104,8 @@ schemaMigrations = ("20260828_file_expiry", m20260828_file_expiry, Just down_m20260828_file_expiry), ("20260904_file_badges", m20260904_file_badges, Just down_m20260904_file_badges), ("20260915_user_badges", m20260915_user_badges, Just down_m20260915_user_badges), - ("20260918_badge_issue_errors", m20260918_badge_issue_errors, Just down_m20260918_badge_issue_errors) + ("20260918_badge_issue_errors", m20260918_badge_issue_errors, Just down_m20260918_badge_issue_errors), + ("20260924_simplex_name_resolved", m20260924_simplex_name_resolved, Just down_m20260924_simplex_name_resolved) ] -- | The list of migrations in ascending order by date diff --git a/src/Simplex/Chat/Store/Postgres/Migrations/M20260924_simplex_name_resolved.hs b/src/Simplex/Chat/Store/Postgres/Migrations/M20260924_simplex_name_resolved.hs new file mode 100644 index 0000000000..aeb4bda563 --- /dev/null +++ b/src/Simplex/Chat/Store/Postgres/Migrations/M20260924_simplex_name_resolved.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuasiQuotes #-} + +module Simplex.Chat.Store.Postgres.Migrations.M20260924_simplex_name_resolved where + +import Data.Text (Text) +import Text.RawString.QQ (r) + +m20260924_simplex_name_resolved :: Text +m20260924_simplex_name_resolved = + [r| +ALTER TABLE contact_profiles ADD COLUMN contact_domain_resolved_at TIMESTAMPTZ; +ALTER TABLE contact_profiles ADD COLUMN contact_domain_expires_at TIMESTAMPTZ; + +ALTER TABLE groups ADD COLUMN group_domain_resolved_at TIMESTAMPTZ; +ALTER TABLE groups ADD COLUMN group_domain_expires_at TIMESTAMPTZ; +|] + +down_m20260924_simplex_name_resolved :: Text +down_m20260924_simplex_name_resolved = + [r| +ALTER TABLE contact_profiles DROP COLUMN contact_domain_resolved_at; +ALTER TABLE contact_profiles DROP COLUMN contact_domain_expires_at; + +ALTER TABLE groups DROP COLUMN group_domain_resolved_at; +ALTER TABLE groups DROP COLUMN group_domain_expires_at; +|] diff --git a/src/Simplex/Chat/Store/Postgres/Migrations/chat_schema.sql b/src/Simplex/Chat/Store/Postgres/Migrations/chat_schema.sql index 0c7bf85cb6..823ea602de 100644 --- a/src/Simplex/Chat/Store/Postgres/Migrations/chat_schema.sql +++ b/src/Simplex/Chat/Store/Postgres/Migrations/chat_schema.sql @@ -680,7 +680,9 @@ CREATE TABLE test_chat_schema.contact_profiles ( contact_domain text, contact_domain_proof text, contact_domain_verified smallint, - description text + description text, + contact_domain_resolved_at timestamp with time zone, + contact_domain_expires_at timestamp with time zone ); @@ -1168,7 +1170,9 @@ CREATE TABLE test_chat_schema.groups ( roster_blob bytea, group_domain_verified smallint, stored_roster_version bigint, - applied_complete_roster_version bigint + applied_complete_roster_version bigint, + group_domain_resolved_at timestamp with time zone, + group_domain_expires_at timestamp with time zone ); diff --git a/src/Simplex/Chat/Store/SQLite/Migrations.hs b/src/Simplex/Chat/Store/SQLite/Migrations.hs index f49495168e..55b1b7c3bb 100644 --- a/src/Simplex/Chat/Store/SQLite/Migrations.hs +++ b/src/Simplex/Chat/Store/SQLite/Migrations.hs @@ -175,6 +175,7 @@ import Simplex.Chat.Store.SQLite.Migrations.M20260828_file_expiry import Simplex.Chat.Store.SQLite.Migrations.M20260904_file_badges import Simplex.Chat.Store.SQLite.Migrations.M20260915_user_badges import Simplex.Chat.Store.SQLite.Migrations.M20260918_badge_issue_errors +import Simplex.Chat.Store.SQLite.Migrations.M20260924_simplex_name_resolved import Simplex.Messaging.Agent.Store.Shared (Migration (..)) schemaMigrations :: [(String, Query, Maybe Query)] @@ -349,7 +350,8 @@ schemaMigrations = ("20260828_file_expiry", m20260828_file_expiry, Just down_m20260828_file_expiry), ("20260904_file_badges", m20260904_file_badges, Just down_m20260904_file_badges), ("20260915_user_badges", m20260915_user_badges, Just down_m20260915_user_badges), - ("20260918_badge_issue_errors", m20260918_badge_issue_errors, Just down_m20260918_badge_issue_errors) + ("20260918_badge_issue_errors", m20260918_badge_issue_errors, Just down_m20260918_badge_issue_errors), + ("20260924_simplex_name_resolved", m20260924_simplex_name_resolved, Just down_m20260924_simplex_name_resolved) ] -- | The list of migrations in ascending order by date diff --git a/src/Simplex/Chat/Store/SQLite/Migrations/M20260924_simplex_name_resolved.hs b/src/Simplex/Chat/Store/SQLite/Migrations/M20260924_simplex_name_resolved.hs new file mode 100644 index 0000000000..1c7976434c --- /dev/null +++ b/src/Simplex/Chat/Store/SQLite/Migrations/M20260924_simplex_name_resolved.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE QuasiQuotes #-} + +module Simplex.Chat.Store.SQLite.Migrations.M20260924_simplex_name_resolved where + +import Database.SQLite.Simple (Query) +import Database.SQLite.Simple.QQ (sql) + +m20260924_simplex_name_resolved :: Query +m20260924_simplex_name_resolved = + [sql| +ALTER TABLE contact_profiles ADD COLUMN contact_domain_resolved_at TEXT; +ALTER TABLE contact_profiles ADD COLUMN contact_domain_expires_at TEXT; + +ALTER TABLE groups ADD COLUMN group_domain_resolved_at TEXT; +ALTER TABLE groups ADD COLUMN group_domain_expires_at TEXT; +|] + +down_m20260924_simplex_name_resolved :: Query +down_m20260924_simplex_name_resolved = + [sql| +ALTER TABLE contact_profiles DROP COLUMN contact_domain_resolved_at; +ALTER TABLE contact_profiles DROP COLUMN contact_domain_expires_at; + +ALTER TABLE groups DROP COLUMN group_domain_resolved_at; +ALTER TABLE groups DROP COLUMN group_domain_expires_at; +|] diff --git a/src/Simplex/Chat/Store/SQLite/Migrations/chat_query_plans.txt b/src/Simplex/Chat/Store/SQLite/Migrations/chat_query_plans.txt index 4062a1e8f6..fffd95495b 100644 --- a/src/Simplex/Chat/Store/SQLite/Migrations/chat_query_plans.txt +++ b/src/Simplex/Chat/Store/SQLite/Migrations/chat_query_plans.txt @@ -5392,7 +5392,7 @@ Plan: SEARCH contact_profiles USING INTEGER PRIMARY KEY (rowid=?) Query: - UPDATE contact_profiles SET contact_domain_verified = ? + UPDATE contact_profiles SET contact_domain_verified = ?, contact_domain_resolved_at = ?, contact_domain_expires_at = ? WHERE contact_profile_id IN (SELECT contact_profile_id FROM contacts WHERE user_id = ? AND contact_id = ?) Plan: @@ -7451,6 +7451,10 @@ Query: SELECT connection_id FROM connections WHERE user_id = ? AND group_member_ Plan: SEARCH connections USING INDEX idx_connections_group_member_id (group_member_id=?) +Query: SELECT contact_domain_resolved_at, contact_domain_expires_at FROM contact_profiles WHERE user_id = ? AND contact_profile_id = ? AND contact_domain_resolved_at IS NOT NULL +Plan: +SEARCH contact_profiles USING INTEGER PRIMARY KEY (rowid=?) + Query: SELECT contact_id FROM contacts WHERE user_id = ? AND chat_item_ttl > 0 OR chat_item_ttl IS NULL Plan: SCAN contacts @@ -7537,6 +7541,10 @@ Query: SELECT g.inv_queue_info FROM groups g WHERE g.group_id = ? AND g.user_id Plan: SEARCH g USING INTEGER PRIMARY KEY (rowid=?) +Query: SELECT group_domain_resolved_at, group_domain_expires_at FROM groups WHERE user_id = ? AND group_id = ? AND group_domain_resolved_at IS NOT NULL +Plan: +SEARCH groups USING INTEGER PRIMARY KEY (rowid=?) + Query: SELECT group_id FROM group_members WHERE group_member_id = ? Plan: SEARCH group_members USING INTEGER PRIMARY KEY (rowid=?) @@ -7861,6 +7869,14 @@ Query: UPDATE contact_profiles SET contact_domain = ?, updated_at = ? WHERE user Plan: SEARCH contact_profiles USING INTEGER PRIMARY KEY (rowid=?) +Query: UPDATE contact_profiles SET contact_domain_expires_at = datetime('now', '-1 hours') +Plan: +SCAN contact_profiles + +Query: UPDATE contact_profiles SET contact_domain_resolved_at = datetime('now', '-2 days') +Plan: +SCAN contact_profiles + Query: UPDATE contact_profiles SET image = ? WHERE display_name = ? Plan: SEARCH contact_profiles USING INDEX contact_profiles_index (display_name=?) @@ -8093,7 +8109,11 @@ Query: UPDATE groups SET enable_ntfs = ?, send_rcpts = ?, favorite = ? WHERE use Plan: SEARCH groups USING INTEGER PRIMARY KEY (rowid=?) -Query: UPDATE groups SET group_domain_verified = ? WHERE user_id = ? AND group_id = ? +Query: UPDATE groups SET group_domain_resolved_at = datetime('now', '-2 days') +Plan: +SCAN groups + +Query: UPDATE groups SET group_domain_verified = ?, group_domain_resolved_at = ?, group_domain_expires_at = ? WHERE user_id = ? AND group_id = ? Plan: SEARCH groups USING INTEGER PRIMARY KEY (rowid=?) diff --git a/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql b/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql index b6eddbaf0f..4e2be19828 100644 --- a/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql +++ b/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql @@ -32,7 +32,9 @@ CREATE TABLE contact_profiles( contact_domain TEXT, contact_domain_proof TEXT, contact_domain_verified INTEGER, - description TEXT + description TEXT, + contact_domain_resolved_at TEXT, + contact_domain_expires_at TEXT ) STRICT; CREATE TABLE users( user_id INTEGER PRIMARY KEY, @@ -209,7 +211,9 @@ CREATE TABLE groups( roster_blob BLOB, group_domain_verified INTEGER, stored_roster_version INTEGER, - applied_complete_roster_version INTEGER, -- received + applied_complete_roster_version INTEGER, + group_domain_resolved_at TEXT, + group_domain_expires_at TEXT, -- received FOREIGN KEY(user_id, local_display_name) REFERENCES display_names(user_id, local_display_name) ON DELETE CASCADE diff --git a/src/Simplex/Chat/View.hs b/src/Simplex/Chat/View.hs index 0438f3359a..40aef97dc5 100644 --- a/src/Simplex/Chat/View.hs +++ b/src/Simplex/Chat/View.hs @@ -74,7 +74,6 @@ import Simplex.Messaging.Encoding import Simplex.Messaging.Encoding.String import Simplex.Messaging.Parsers (dropPrefix, taggedObjectJSON) import Simplex.Messaging.Protocol (AProtoServerWithAuth (..), AProtocolType, BlockingInfo (..), BlockingReason (..), NameRegistration (..), NamePricing (..), NetworkError (..), ProtocolServer (..), ProtocolTypeI, SProtocolType (..), USDCents (..), UserProtocol) -import Simplex.Messaging.SimplexName (fullDomainName) import Simplex.Messaging.SystemTime (roundedSeconds) import qualified Simplex.Messaging.Protocol as SMP import Simplex.Messaging.Transport.Client (TransportHost (..)) diff --git a/tests/ChatTests/Names.hs b/tests/ChatTests/Names.hs index 4269477eb0..62a5a3e2ec 100644 --- a/tests/ChatTests/Names.hs +++ b/tests/ChatTests/Names.hs @@ -11,6 +11,7 @@ import Control.Concurrent.Async (concurrently_) import Data.Text (Text) import qualified Data.Text as T import NameResolver +import qualified Simplex.Messaging.Agent.Store.DB as DB import Simplex.Messaging.Names.Record (NameReservedReason (..)) import Simplex.Messaging.SimplexName (SimplexDomain (..), SimplexNameInfo (..), SimplexNameType (..), SimplexTLD (..)) import Test.Hspec hiding (it) @@ -38,6 +39,8 @@ chatNamesTests = do it "known chat, name expired" testPlanKnownNameExpired it "known chat, name moved to a new address" testPlanKnownNameAddressChanged it "known chat, name now available" testPlanKnownNameAvailable + it "known chat, resolved over a day ago or past expiry" testPlanKnownNameStale + it "no local chat, resolved on every call" testPlanNameResolvedEveryCall it "own name, live" testPlanOwnNameLive it "own name, expired" testPlanOwnNameExpired it "own name, now available" testPlanOwnNameAvailable @@ -255,6 +258,11 @@ testConnectByNameChannelAndContact ps = withSmpServerAndNames $ \reg -> bob <## "group link: known group #team" bob <## "SimpleX name: #team (verified)" bob <## "use #team to send messages" + withCCTransaction bob $ \db -> DB.execute_ db "UPDATE groups SET group_domain_resolved_at = datetime('now', '-2 days')" + bob ##> "/_connect plan 1 team.simplex" + bob <## "group link: known group #team" + bob <## "SimpleX name: #team (verified)" + bob <## "use #team to send messages" bob <## "You can also connect to @team.simplex in direct chat" bob <## "registered" where @@ -429,6 +437,35 @@ testPlanKnownNameAvailable = withAliceName $ \reg _l alice bob -> do bob <## "use @alice to send messages" bob <## "available: 1000 cents/year, min length 1" +testPlanKnownNameStale :: HasCallStack => TestParams -> IO () +testPlanKnownNameStale = withAliceName $ \_reg _l alice bob -> do + connectBobByName alice bob + planKnownAlice bob + withCCTransaction bob $ \db -> DB.execute_ db "UPDATE contact_profiles SET contact_domain_resolved_at = datetime('now', '-2 days')" + planKnownAlice bob + bob <## "registered" + planKnownAlice bob + withCCTransaction bob $ \db -> DB.execute_ db "UPDATE contact_profiles SET contact_domain_expires_at = datetime('now', '-1 hours')" + planKnownAlice bob + bob <## "registered" + planKnownAlice bob + where + planKnownAlice bob = do + bob ##> "/_connect plan 1 @alice.simplex" + bob <## "contact address: known contact alice" + bob <## "SimpleX name: @alice.simplex (verified)" + bob <## "use @alice to send messages" + +testPlanNameResolvedEveryCall :: HasCallStack => TestParams -> IO () +testPlanNameResolvedEveryCall = withAliceName $ \reg shortLink _alice bob -> do + bob ##> "/_connect plan 1 @alice.simplex" + bob <## "contact address: ok to connect" + _ <- getTermLine bob + registerExpiredName reg aliceSimplexName (contactNameRecord "alice.simplex" shortLink) + bob ##> "/_connect plan 1 @alice.simplex" + bob <## "SimpleX name alice.simplex: nothing to connect to" + bob <##. "registered, expires " + testPlanOwnNameLive :: HasCallStack => TestParams -> IO () testPlanOwnNameLive = withAliceName $ \_reg _l alice _bob -> do alice ##> "/_connect plan 1 @alice.simplex resolve=all" @@ -480,10 +517,16 @@ testPlanKnownNameAddressChanged ps = withSmpServerAndNames $ \reg -> bob <## "contact address: known contact alice" bob <## "SimpleX name: @alice.simplex (verified)" bob <## "use @alice to send messages" - bob <## "registered" bob ##> "/_connect plan 1 @alice.simplex resolve=all" bob <## "contact address: ok to connect, address changed" _ <- getTermLine bob -- the new address's short link data (JSON, printed in test view) + withCCTransaction bob $ \db -> DB.execute_ db "UPDATE contact_profiles SET contact_domain_resolved_at = datetime('now', '-2 days')" + bob ##> "/_connect plan 1 @alice.simplex" + bob <## "contact address: ok to connect, address changed" + _ <- getTermLine bob + bob ##> "/_connect plan 1 @alice.simplex" + bob <## "contact address: ok to connect, address changed" + _ <- getTermLine bob bob ##> "/_connect plan 1 @alice.simplex resolve=never" bob <## "contact address: known contact alice" bob <## "SimpleX name: @alice.simplex (verified)"