mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
simplify remote api, add ios api (#3213)
This commit is contained in:
committed by
GitHub
parent
193361c09a
commit
5e6aaffb09
@@ -882,6 +882,38 @@ func apiCancelFile(fileId: Int64) async -> AChatItem? {
|
||||
}
|
||||
}
|
||||
|
||||
func startRemoteCtrl() async throws {
|
||||
try await sendCommandOkResp(.startRemoteCtrl)
|
||||
}
|
||||
|
||||
func registerRemoteCtrl(_ remoteCtrlOOB: RemoteCtrlOOB) async throws -> Int64 {
|
||||
let r = await chatSendCmd(.registerRemoteCtrl(remoteCtrlOOB: remoteCtrlOOB))
|
||||
if case let .remoteCtrlRegistered(rcId) = r { return rcId }
|
||||
throw r
|
||||
}
|
||||
|
||||
func listRemoteCtrls() async throws -> [RemoteCtrlInfo] {
|
||||
let r = await chatSendCmd(.listRemoteCtrls)
|
||||
if case let .remoteCtrlList(rcInfo) = r { return rcInfo }
|
||||
throw r
|
||||
}
|
||||
|
||||
func acceptRemoteCtrl(_ rcId: Int64) async throws {
|
||||
try await sendCommandOkResp(.acceptRemoteCtrl(remoteCtrlId: rcId))
|
||||
}
|
||||
|
||||
func rejectRemoteCtrl(_ rcId: Int64) async throws {
|
||||
try await sendCommandOkResp(.rejectRemoteCtrl(remoteCtrlId: rcId))
|
||||
}
|
||||
|
||||
func stopRemoteCtrl() async throws {
|
||||
try await sendCommandOkResp(.stopRemoteCtrl)
|
||||
}
|
||||
|
||||
func deleteRemoteCtrl(_ rcId: Int64) async throws {
|
||||
try await sendCommandOkResp(.deleteRemoteCtrl(remoteCtrlId: rcId))
|
||||
}
|
||||
|
||||
func networkErrorAlert(_ r: ChatResponse) -> Alert? {
|
||||
switch r {
|
||||
case let .chatCmdError(_, .errorAgent(.BROKER(addr, .TIMEOUT))):
|
||||
|
||||
@@ -117,6 +117,13 @@ public enum ChatCommand {
|
||||
case receiveFile(fileId: Int64, encrypted: Bool, inline: Bool?)
|
||||
case setFileToReceive(fileId: Int64, encrypted: Bool)
|
||||
case cancelFile(fileId: Int64)
|
||||
case startRemoteCtrl
|
||||
case registerRemoteCtrl(remoteCtrlOOB: RemoteCtrlOOB)
|
||||
case listRemoteCtrls
|
||||
case acceptRemoteCtrl(remoteCtrlId: Int64)
|
||||
case rejectRemoteCtrl(remoteCtrlId: Int64)
|
||||
case stopRemoteCtrl
|
||||
case deleteRemoteCtrl(remoteCtrlId: Int64)
|
||||
case showVersion
|
||||
case string(String)
|
||||
|
||||
@@ -255,6 +262,13 @@ public enum ChatCommand {
|
||||
return s
|
||||
case let .setFileToReceive(fileId, encrypted): return "/_set_file_to_receive \(fileId) encrypt=\(onOff(encrypted))"
|
||||
case let .cancelFile(fileId): return "/fcancel \(fileId)"
|
||||
case .startRemoteCtrl: return "/start remote ctrl"
|
||||
case let .registerRemoteCtrl(oob): return "/register remote ctrl \(oob.caFingerprint)"
|
||||
case let .acceptRemoteCtrl(rcId): return "/accept remote ctrl \(rcId)"
|
||||
case let .rejectRemoteCtrl(rcId): return "/reject remote ctrl \(rcId)"
|
||||
case .listRemoteCtrls: return "/list remote ctrls"
|
||||
case .stopRemoteCtrl: return "/stop remote ctrl"
|
||||
case let .deleteRemoteCtrl(rcId): return "/delete remote ctrl \(rcId)"
|
||||
case .showVersion: return "/version"
|
||||
case let .string(str): return str
|
||||
}
|
||||
@@ -367,6 +381,13 @@ public enum ChatCommand {
|
||||
case .receiveFile: return "receiveFile"
|
||||
case .setFileToReceive: return "setFileToReceive"
|
||||
case .cancelFile: return "cancelFile"
|
||||
case .startRemoteCtrl: return "startRemoteCtrl"
|
||||
case .registerRemoteCtrl: return "registerRemoteCtrl"
|
||||
case .listRemoteCtrls: return "listRemoteCtrls"
|
||||
case .acceptRemoteCtrl: return "acceptRemoteCtrl"
|
||||
case .rejectRemoteCtrl: return "rejectRemoteCtrl"
|
||||
case .stopRemoteCtrl: return "stopRemoteCtrl"
|
||||
case .deleteRemoteCtrl: return "deleteRemoteCtrl"
|
||||
case .showVersion: return "showVersion"
|
||||
case .string: return "console command"
|
||||
}
|
||||
@@ -563,6 +584,13 @@ public enum ChatResponse: Decodable, Error {
|
||||
case ntfMessages(user_: User?, connEntity: ConnectionEntity?, msgTs: Date?, ntfMessages: [NtfMsgInfo])
|
||||
case newContactConnection(user: UserRef, connection: PendingContactConnection)
|
||||
case contactConnectionDeleted(user: UserRef, connection: PendingContactConnection)
|
||||
case remoteCtrlList(remoteCtrls: [RemoteCtrlInfo])
|
||||
case remoteCtrlRegistered(remoteCtrlId: Int64)
|
||||
case remoteCtrlAnnounce(fingerprint: String)
|
||||
case remoteCtrlFound(remoteCtrl: RemoteCtrl)
|
||||
case remoteCtrlConnecting(remoteCtrlId: Int64, displayName: String)
|
||||
case remoteCtrlConnected(remoteCtrlId: Int64, displayName: String)
|
||||
case remoteCtrlStopped
|
||||
case versionInfo(versionInfo: CoreVersionInfo, chatMigrations: [UpMigration], agentMigrations: [UpMigration])
|
||||
case cmdOk(user: UserRef?)
|
||||
case chatCmdError(user_: UserRef?, chatError: ChatError)
|
||||
@@ -699,6 +727,13 @@ public enum ChatResponse: Decodable, Error {
|
||||
case .ntfMessages: return "ntfMessages"
|
||||
case .newContactConnection: return "newContactConnection"
|
||||
case .contactConnectionDeleted: return "contactConnectionDeleted"
|
||||
case .remoteCtrlList: return "remoteCtrlList"
|
||||
case .remoteCtrlRegistered: return "remoteCtrlRegistered"
|
||||
case .remoteCtrlAnnounce: return "remoteCtrlAnnounce"
|
||||
case .remoteCtrlFound: return "remoteCtrlFound"
|
||||
case .remoteCtrlConnecting: return "remoteCtrlConnecting"
|
||||
case .remoteCtrlConnected: return "remoteCtrlConnected"
|
||||
case .remoteCtrlStopped: return "remoteCtrlStopped"
|
||||
case .versionInfo: return "versionInfo"
|
||||
case .cmdOk: return "cmdOk"
|
||||
case .chatCmdError: return "chatCmdError"
|
||||
@@ -838,6 +873,13 @@ public enum ChatResponse: Decodable, Error {
|
||||
case let .ntfMessages(u, connEntity, msgTs, ntfMessages): return withUser(u, "connEntity: \(String(describing: connEntity))\nmsgTs: \(String(describing: msgTs))\nntfMessages: \(String(describing: ntfMessages))")
|
||||
case let .newContactConnection(u, connection): return withUser(u, String(describing: connection))
|
||||
case let .contactConnectionDeleted(u, connection): return withUser(u, String(describing: connection))
|
||||
case let .remoteCtrlList(remoteCtrls): return String(describing: remoteCtrls)
|
||||
case let .remoteCtrlRegistered(rcId): return "remote ctrl ID: \(rcId)"
|
||||
case let .remoteCtrlAnnounce(fingerprint): return "fingerprint: \(fingerprint)"
|
||||
case let .remoteCtrlFound(remoteCtrl): return "remote ctrl: \(String(describing: remoteCtrl))"
|
||||
case let .remoteCtrlConnecting(rcId, displayName): return "remote ctrl ID: \(rcId)\nhost displayName: \(displayName)"
|
||||
case let .remoteCtrlConnected(rcId, displayName): return "remote ctrl ID: \(rcId)\nhost displayName: \(displayName)"
|
||||
case .remoteCtrlStopped: return noDetails
|
||||
case let .versionInfo(versionInfo, chatMigrations, agentMigrations): return "\(String(describing: versionInfo))\n\nchat migrations: \(chatMigrations.map(\.upName))\n\nagent migrations: \(agentMigrations.map(\.upName))"
|
||||
case .cmdOk: return noDetails
|
||||
case let .chatCmdError(u, chatError): return withUser(u, String(describing: chatError))
|
||||
@@ -1461,6 +1503,23 @@ public enum NotificationPreviewMode: String, SelectableItem {
|
||||
public static var values: [NotificationPreviewMode] = [.message, .contact, .hidden]
|
||||
}
|
||||
|
||||
public struct RemoteCtrlOOB {
|
||||
public var caFingerprint: String
|
||||
}
|
||||
|
||||
public struct RemoteCtrlInfo: Decodable {
|
||||
public var remoteCtrlId: Int64
|
||||
public var displayName: String
|
||||
public var sessionActive: Bool
|
||||
}
|
||||
|
||||
public struct RemoteCtrl: Decodable {
|
||||
var remoteCtrlId: Int64
|
||||
var displayName: String
|
||||
var fingerprint: String
|
||||
var accepted: Bool?
|
||||
}
|
||||
|
||||
public struct CoreVersionInfo: Decodable {
|
||||
public var version: String
|
||||
public var simplexmqVersion: String
|
||||
@@ -1488,6 +1547,7 @@ public enum ChatError: Decodable {
|
||||
case errorAgent(agentError: AgentErrorType)
|
||||
case errorStore(storeError: StoreError)
|
||||
case errorDatabase(databaseError: DatabaseError)
|
||||
case errorRemoteCtrl(remoteCtrlError: RemoteCtrlError)
|
||||
case invalidJSON(json: String)
|
||||
}
|
||||
|
||||
@@ -1739,3 +1799,15 @@ public enum ArchiveError: Decodable {
|
||||
case `import`(chatError: ChatError)
|
||||
case importFile(file: String, chatError: ChatError)
|
||||
}
|
||||
|
||||
public enum RemoteCtrlError: Decodable {
|
||||
case missing(remoteCtrlId: Int64)
|
||||
case inactive
|
||||
case busy
|
||||
case timeout
|
||||
case disconnected(remoteCtrlId: Int64, reason: String)
|
||||
case connectionLost(remoteCtrlId: Int64, reason: String)
|
||||
case certificateExpired(remoteCtrlId: Int64)
|
||||
case certificateUntrusted(remoteCtrlId: Int64)
|
||||
case badFingerprint
|
||||
}
|
||||
|
||||
+39
-57
@@ -1938,8 +1938,8 @@ sealed class CC {
|
||||
class StartRemoteHost(val remoteHostId: Long): CC()
|
||||
class StopRemoteHost(val remoteHostId: Long): CC()
|
||||
class DeleteRemoteHost(val remoteHostId: Long): CC()
|
||||
class RegisterRemoteCtrl(val remoteCtrlOOB: RemoteCtrlOOB): CC()
|
||||
class StartRemoteCtrl(): CC()
|
||||
class RegisterRemoteCtrl(val remoteCtrlOOB: RemoteCtrlOOB): CC()
|
||||
class ListRemoteCtrls(): CC()
|
||||
class AcceptRemoteCtrl(val remoteCtrlId: Long): CC()
|
||||
class RejectRemoteCtrl(val remoteCtrlId: Long): CC()
|
||||
@@ -2167,8 +2167,8 @@ sealed class CC {
|
||||
is StartRemoteHost -> "startRemoteHost"
|
||||
is StopRemoteHost -> "stopRemoteHost"
|
||||
is DeleteRemoteHost -> "deleteRemoteHost"
|
||||
is RegisterRemoteCtrl -> "registerRemoteCtrl"
|
||||
is StartRemoteCtrl -> "startRemoteCtrl"
|
||||
is RegisterRemoteCtrl -> "registerRemoteCtrl"
|
||||
is ListRemoteCtrls -> "listRemoteCtrls"
|
||||
is AcceptRemoteCtrl -> "acceptRemoteCtrl"
|
||||
is RejectRemoteCtrl -> "rejectRemoteCtrl"
|
||||
@@ -3483,30 +3483,24 @@ sealed class CR {
|
||||
@Serializable @SerialName("callEnded") class CallEnded(val user: UserRef, val contact: Contact): CR()
|
||||
@Serializable @SerialName("newContactConnection") class NewContactConnection(val user: UserRef, val connection: PendingContactConnection): CR()
|
||||
@Serializable @SerialName("contactConnectionDeleted") class ContactConnectionDeleted(val user: UserRef, val connection: PendingContactConnection): CR()
|
||||
// remote events (desktop)
|
||||
@Serializable @SerialName("remoteHostCreated") class RemoteHostCreated(val remoteHostId: Long, val oobData: RemoteCtrlOOB): CR()
|
||||
@Serializable @SerialName("remoteHostList") class RemoteHostList(val remoteHosts: List<RemoteHostInfo>): CR()
|
||||
@Serializable @SerialName("remoteHostConnected") class RemoteHostConnected(val remoteHostId: Long): CR()
|
||||
@Serializable @SerialName("remoteHostStopped") class RemoteHostStopped(val remoteHostId: Long): CR()
|
||||
// remote events (mobile)
|
||||
@Serializable @SerialName("remoteCtrlList") class RemoteCtrlList(val remoteCtrls: List<RemoteCtrlInfo>): CR()
|
||||
@Serializable @SerialName("remoteCtrlRegistered") class RemoteCtrlRegistered(val remoteCtrlId: Long): CR()
|
||||
@Serializable @SerialName("remoteCtrlAnnounce") class RemoteCtrlAnnounce(val fingerprint: String): CR()
|
||||
@Serializable @SerialName("remoteCtrlFound") class RemoteCtrlFound(val remoteCtrl: RemoteCtrl): CR()
|
||||
@Serializable @SerialName("remoteCtrlConnecting") class RemoteCtrlConnecting(val remoteCtrlId: Long, val displayName: String): CR()
|
||||
@Serializable @SerialName("remoteCtrlConnected") class RemoteCtrlConnected(val remoteCtrlId: Long, val displayName: String): CR()
|
||||
@Serializable @SerialName("remoteCtrlStopped") class RemoteCtrlStopped(): CR()
|
||||
@Serializable @SerialName("versionInfo") class VersionInfo(val versionInfo: CoreVersionInfo, val chatMigrations: List<UpMigration>, val agentMigrations: List<UpMigration>): CR()
|
||||
@Serializable @SerialName("cmdOk") class CmdOk(val user: UserRef?): CR()
|
||||
@Serializable @SerialName("chatCmdError") class ChatCmdError(val user_: UserRef?, val chatError: ChatError): CR()
|
||||
@Serializable @SerialName("chatError") class ChatRespError(val user_: UserRef?, val chatError: ChatError): CR()
|
||||
@Serializable @SerialName("archiveImported") class ArchiveImported(val archiveErrors: List<ArchiveError>): CR()
|
||||
// remote events (desktop)
|
||||
@Serializable @SerialName("remoteHostCreated") class RemoteHostCreated(val remoteHostId: Long, val oobData: RemoteCtrlOOB): CR()
|
||||
@Serializable @SerialName("remoteHostList") class RemoteHostList(val remoteHosts: List<RemoteHostInfo>): CR()
|
||||
@Serializable @SerialName("remoteHostStarted") class RemoteHostStarted(val remoteHostId: Long): CR()
|
||||
@Serializable @SerialName("remoteHostConnected") class RemoteHostConnected(val remoteHostId: Long): CR()
|
||||
@Serializable @SerialName("remoteHostStopped") class RemoteHostStopped(val remoteHostId: Long): CR()
|
||||
@Serializable @SerialName("remoteHostDeleted") class RemoteHostDeleted(val remoteHostId: Long): CR()
|
||||
// remote events (mobile)
|
||||
@Serializable @SerialName("remoteCtrlList") class RemoteCtrlList(val remoteCtrls: List<RemoteCtrlInfo>): CR()
|
||||
@Serializable @SerialName("remoteCtrlRegistered") class RemoteCtrlRegistered(val remoteCtrlId: Long): CR()
|
||||
@Serializable @SerialName("remoteCtrlStarted") class RemoteCtrlStarted(): CR()
|
||||
@Serializable @SerialName("remoteCtrlAnnounce") class RemoteCtrlAnnounce(val fingerprint: String): CR()
|
||||
@Serializable @SerialName("remoteCtrlFound") class RemoteCtrlFound(val remoteCtrl: RemoteCtrl): CR()
|
||||
@Serializable @SerialName("remoteCtrlAccepted") class RemoteCtrlAccepted(val remoteCtrlId: Long): CR()
|
||||
@Serializable @SerialName("remoteCtrlRejected") class RemoteCtrlRejected(val remoteCtrlId: Long): CR()
|
||||
@Serializable @SerialName("remoteCtrlConnecting") class RemoteCtrlConnecting(val remoteCtrlId: Long, val displayName: String): CR()
|
||||
@Serializable @SerialName("remoteCtrlConnected") class RemoteCtrlConnected(val remoteCtrlId: Long, val displayName: String): CR()
|
||||
@Serializable @SerialName("remoteCtrlStopped") class RemoteCtrlStopped(): CR()
|
||||
@Serializable @SerialName("remoteCtrlDeleted") class RemoteCtrlDeleted(val remoteCtrlId: Long): CR()
|
||||
// general
|
||||
@Serializable class Response(val type: String, val json: String): CR()
|
||||
@Serializable class Invalid(val str: String): CR()
|
||||
@@ -3632,28 +3626,22 @@ sealed class CR {
|
||||
is CallEnded -> "callEnded"
|
||||
is NewContactConnection -> "newContactConnection"
|
||||
is ContactConnectionDeleted -> "contactConnectionDeleted"
|
||||
is RemoteHostCreated -> "remoteHostCreated"
|
||||
is RemoteHostList -> "remoteHostList"
|
||||
is RemoteHostConnected -> "remoteHostConnected"
|
||||
is RemoteHostStopped -> "remoteHostStopped"
|
||||
is RemoteCtrlList -> "remoteCtrlList"
|
||||
is RemoteCtrlRegistered -> "remoteCtrlRegistered"
|
||||
is RemoteCtrlAnnounce -> "remoteCtrlAnnounce"
|
||||
is RemoteCtrlFound -> "remoteCtrlFound"
|
||||
is RemoteCtrlConnecting -> "remoteCtrlConnecting"
|
||||
is RemoteCtrlConnected -> "remoteCtrlConnected"
|
||||
is RemoteCtrlStopped -> "remoteCtrlStopped"
|
||||
is VersionInfo -> "versionInfo"
|
||||
is CmdOk -> "cmdOk"
|
||||
is ChatCmdError -> "chatCmdError"
|
||||
is ChatRespError -> "chatError"
|
||||
is ArchiveImported -> "archiveImported"
|
||||
is RemoteHostCreated -> "remoteHostCreated"
|
||||
is RemoteHostList -> "remoteHostList"
|
||||
is RemoteHostStarted -> "remoteHostStarted"
|
||||
is RemoteHostConnected -> "remoteHostConnected"
|
||||
is RemoteHostStopped -> "remoteHostStopped"
|
||||
is RemoteHostDeleted -> "remoteHostDeleted"
|
||||
is RemoteCtrlList -> "remoteCtrlList"
|
||||
is RemoteCtrlRegistered -> "remoteCtrlRegistered"
|
||||
is RemoteCtrlStarted -> "remoteCtrlStarted"
|
||||
is RemoteCtrlAnnounce -> "remoteCtrlAnnounce"
|
||||
is RemoteCtrlFound -> "remoteCtrlFound"
|
||||
is RemoteCtrlAccepted -> "remoteCtrlAccepted"
|
||||
is RemoteCtrlRejected -> "remoteCtrlRejected"
|
||||
is RemoteCtrlConnecting -> "remoteCtrlConnecting"
|
||||
is RemoteCtrlConnected -> "remoteCtrlConnected"
|
||||
is RemoteCtrlStopped -> "remoteCtrlStopped"
|
||||
is RemoteCtrlDeleted -> "remoteCtrlDeleted"
|
||||
is Response -> "* $type"
|
||||
is Invalid -> "* invalid json"
|
||||
}
|
||||
@@ -3779,6 +3767,17 @@ sealed class CR {
|
||||
is CallEnded -> withUser(user, "contact: ${contact.id}")
|
||||
is NewContactConnection -> withUser(user, json.encodeToString(connection))
|
||||
is ContactConnectionDeleted -> withUser(user, json.encodeToString(connection))
|
||||
is RemoteHostCreated -> "remote host ID: $remoteHostId\noobData ${json.encodeToString(oobData)}"
|
||||
is RemoteHostList -> "remote hosts: ${json.encodeToString(remoteHosts)}"
|
||||
is RemoteHostConnected -> "remote host ID: $remoteHostId"
|
||||
is RemoteHostStopped -> "remote host ID: $remoteHostId"
|
||||
is RemoteCtrlList -> json.encodeToString(remoteCtrls)
|
||||
is RemoteCtrlRegistered -> "remote ctrl ID: $remoteCtrlId"
|
||||
is RemoteCtrlAnnounce -> "fingerprint: $fingerprint"
|
||||
is RemoteCtrlFound -> "remote ctrl: ${json.encodeToString(remoteCtrl)}"
|
||||
is RemoteCtrlConnecting -> "remote ctrl ID: $remoteCtrlId\nhost displayName: $displayName"
|
||||
is RemoteCtrlConnected -> "remote ctrl ID: $remoteCtrlId\nhost displayName: $displayName"
|
||||
is RemoteCtrlStopped -> ""
|
||||
is VersionInfo -> "version ${json.encodeToString(versionInfo)}\n\n" +
|
||||
"chat migrations: ${json.encodeToString(chatMigrations.map { it.upName })}\n\n" +
|
||||
"agent migrations: ${json.encodeToString(agentMigrations.map { it.upName })}"
|
||||
@@ -3786,23 +3785,6 @@ sealed class CR {
|
||||
is ChatCmdError -> withUser(user_, chatError.string)
|
||||
is ChatRespError -> withUser(user_, chatError.string)
|
||||
is ArchiveImported -> "${archiveErrors.map { it.string } }"
|
||||
is RemoteHostCreated -> "remote host ID: $remoteHostId\noobData ${json.encodeToString(oobData)}"
|
||||
is RemoteHostList -> "remote hosts: ${json.encodeToString(remoteHosts)}"
|
||||
is RemoteHostStarted -> "remote host $remoteHostId"
|
||||
is RemoteHostConnected -> "remote host ID: $remoteHostId"
|
||||
is RemoteHostStopped -> "remote host ID: $remoteHostId"
|
||||
is RemoteHostDeleted -> "remote host ID: $remoteHostId"
|
||||
is RemoteCtrlList -> json.encodeToString(remoteCtrls)
|
||||
is RemoteCtrlRegistered -> "remote ctrl ID: $remoteCtrlId"
|
||||
is RemoteCtrlStarted -> ""
|
||||
is RemoteCtrlAnnounce -> "fingerprint: $fingerprint"
|
||||
is RemoteCtrlFound -> "remote ctrl: ${json.encodeToString(remoteCtrl)}"
|
||||
is RemoteCtrlAccepted -> "remote ctrl ID: $remoteCtrlId"
|
||||
is RemoteCtrlRejected -> "remote ctrl ID: $remoteCtrlId"
|
||||
is RemoteCtrlConnecting -> "remote ctrl ID: $remoteCtrlId\nhost displayName: $displayName"
|
||||
is RemoteCtrlConnected -> "remote ctrl ID: $remoteCtrlId\nhost displayName: $displayName"
|
||||
is RemoteCtrlStopped -> ""
|
||||
is RemoteCtrlDeleted -> "remote ctrl ID: $remoteCtrlId"
|
||||
is Response -> json
|
||||
is Invalid -> str
|
||||
}
|
||||
@@ -3948,16 +3930,16 @@ sealed class ChatError {
|
||||
is ChatErrorAgent -> "agent ${agentError.string}"
|
||||
is ChatErrorStore -> "store ${storeError.string}"
|
||||
is ChatErrorDatabase -> "database ${databaseError.string}"
|
||||
is ChatErrorRemoteCtrl -> "remoteCtrl ${remoteCtrlError.string}"
|
||||
is ChatErrorRemoteHost -> "remoteHost ${remoteHostError.string}"
|
||||
is ChatErrorRemoteCtrl -> "remoteCtrl ${remoteCtrlError.string}"
|
||||
is ChatErrorInvalidJSON -> "invalid json ${json}"
|
||||
}
|
||||
@Serializable @SerialName("error") class ChatErrorChat(val errorType: ChatErrorType): ChatError()
|
||||
@Serializable @SerialName("errorAgent") class ChatErrorAgent(val agentError: AgentErrorType): ChatError()
|
||||
@Serializable @SerialName("errorStore") class ChatErrorStore(val storeError: StoreError): ChatError()
|
||||
@Serializable @SerialName("errorDatabase") class ChatErrorDatabase(val databaseError: DatabaseError): ChatError()
|
||||
@Serializable @SerialName("errorRemoteCtrl") class ChatErrorRemoteCtrl(val remoteCtrlError: RemoteCtrlError): ChatError()
|
||||
@Serializable @SerialName("errorRemoteHost") class ChatErrorRemoteHost(val remoteHostError: RemoteHostError): ChatError()
|
||||
@Serializable @SerialName("errorRemoteCtrl") class ChatErrorRemoteCtrl(val remoteCtrlError: RemoteCtrlError): ChatError()
|
||||
@Serializable @SerialName("invalidJSON") class ChatErrorInvalidJSON(val json: String): ChatError()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user