


























@@ -5,6 +5,21 @@ import Foundation
55public let GATEWAY_PROTOCOL_VERSION = 4
66public let GATEWAY_MIN_PROTOCOL_VERSION = 3
778+private struct GatewayAnyCodingKey: CodingKey, Hashable {
9+let stringValue: String
10+let intValue: Int?
11+12+init?(stringValue: String) {
13+self.stringValue = stringValue
14+self.intValue = nil
15+}
16+17+init?(intValue: Int) {
18+self.stringValue = String(intValue)
19+self.intValue = intValue
20+}
21+}
22+823public enum ErrorCode: String, Codable, Sendable {
924case notLinked = "NOT_LINKED"
1025case notPaired = "NOT_PAIRED"
@@ -579,6 +594,9 @@ public struct SendParams: Codable, Sendable {
579594public let agentid: String?
580595public let replytoid: String?
581596public let threadid: String?
597+public let forcedocument: Bool?
598+public let silent: Bool?
599+public let parsemode: String?
582600public let sessionkey: String?
583601public let idempotencykey: String
584602@@ -594,6 +612,9 @@ public struct SendParams: Codable, Sendable {
594612 agentid: String?,
595613 replytoid: String?,
596614 threadid: String?,
615+ forcedocument: Bool?,
616+ silent: Bool?,
617+ parsemode: String?,
597618 sessionkey: String?,
598619 idempotencykey: String)
599620{
@@ -608,6 +629,9 @@ public struct SendParams: Codable, Sendable {
608629self.agentid = agentid
609630self.replytoid = replytoid
610631self.threadid = threadid
632+self.forcedocument = forcedocument
633+self.silent = silent
634+self.parsemode = parsemode
611635self.sessionkey = sessionkey
612636self.idempotencykey = idempotencykey
613637}
@@ -624,6 +648,9 @@ public struct SendParams: Codable, Sendable {
624648case agentid = "agentId"
625649case replytoid = "replyToId"
626650case threadid = "threadId"
651+case forcedocument = "forceDocument"
652+case silent
653+case parsemode = "parseMode"
627654case sessionkey = "sessionKey"
628655case idempotencykey = "idempotencyKey"
629656}
@@ -5707,6 +5734,156 @@ public struct PluginControlUiDescriptor: Codable, Sendable {
57075734}
57085735}
570957365737+public struct PluginsSessionActionFailureResult: Codable, Sendable {
5738+public let ok: Bool
5739+public let error: String
5740+public let code: String?
5741+public let details: AnyCodable?
5742+5743+public init(
5744+ error: String,
5745+ code: String?,
5746+ details: AnyCodable?
5747+)
5748+{
5749+self.ok = false
5750+self.error = error
5751+self.code = code
5752+self.details = details
5753+}
5754+5755+private enum CodingKeys: String, CodingKey {
5756+case ok
5757+case error
5758+case code
5759+case details
5760+}
5761+5762+public init(from decoder: Decoder) throws {
5763+let rawContainer = try decoder.container(keyedBy: GatewayAnyCodingKey.self)
5764+let unexpectedKeys = rawContainer.allKeys
5765+.map(\.stringValue)
5766+.filter { !Set(["ok", "error", "code", "details"]).contains($0) }
5767+if !unexpectedKeys.isEmpty {
5768+throw DecodingError.dataCorrupted(
5769+.init(
5770+ codingPath: rawContainer.codingPath,
5771+ debugDescription: "Unexpected keys for PluginsSessionActionFailureResult: \(unexpectedKeys.sorted().joined(separator: ", "))"
5772+)
5773+)
5774+}
5775+let container = try decoder.container(keyedBy: CodingKeys.self)
5776+let decodedOk = try container.decode(Bool.self, forKey: .ok)
5777+guard decodedOk == false else {
5778+throw DecodingError.dataCorruptedError(
5779+ forKey: .ok,
5780+ in: container,
5781+ debugDescription: "Expected ok to equal false"
5782+)
5783+}
5784+self.ok = false
5785+self.error = try container.decode(String.self, forKey: .error)
5786+self.code = try container.decodeIfPresent(String.self, forKey: .code)
5787+self.details = try container.decodeIfPresent(AnyCodable.self, forKey: .details)
5788+}
5789+5790+public func encode(to encoder: Encoder) throws {
5791+var container = encoder.container(keyedBy: CodingKeys.self)
5792+try container.encode(false, forKey: .ok)
5793+try container.encode(error, forKey: .error)
5794+try container.encodeIfPresent(code, forKey: .code)
5795+try container.encodeIfPresent(details, forKey: .details)
5796+}
5797+}
5798+5799+public struct PluginsSessionActionParams: Codable, Sendable {
5800+public let pluginid: String
5801+public let actionid: String
5802+public let sessionkey: String?
5803+public let payload: AnyCodable?
5804+5805+public init(
5806+ pluginid: String,
5807+ actionid: String,
5808+ sessionkey: String?,
5809+ payload: AnyCodable?)
5810+{
5811+self.pluginid = pluginid
5812+self.actionid = actionid
5813+self.sessionkey = sessionkey
5814+self.payload = payload
5815+}
5816+5817+private enum CodingKeys: String, CodingKey {
5818+case pluginid = "pluginId"
5819+case actionid = "actionId"
5820+case sessionkey = "sessionKey"
5821+case payload
5822+}
5823+}
5824+5825+public struct PluginsSessionActionSuccessResult: Codable, Sendable {
5826+public let ok: Bool
5827+public let result: AnyCodable?
5828+public let continueagent: Bool?
5829+public let reply: AnyCodable?
5830+5831+public init(
5832+ result: AnyCodable?,
5833+ continueagent: Bool?,
5834+ reply: AnyCodable?
5835+)
5836+{
5837+self.ok = true
5838+self.result = result
5839+self.continueagent = continueagent
5840+self.reply = reply
5841+}
5842+5843+private enum CodingKeys: String, CodingKey {
5844+case ok
5845+case result
5846+case continueagent = "continueAgent"
5847+case reply
5848+}
5849+5850+public init(from decoder: Decoder) throws {
5851+let rawContainer = try decoder.container(keyedBy: GatewayAnyCodingKey.self)
5852+let unexpectedKeys = rawContainer.allKeys
5853+.map(\.stringValue)
5854+.filter { !Set(["ok", "result", "continueAgent", "reply"]).contains($0) }
5855+if !unexpectedKeys.isEmpty {
5856+throw DecodingError.dataCorrupted(
5857+.init(
5858+ codingPath: rawContainer.codingPath,
5859+ debugDescription: "Unexpected keys for PluginsSessionActionSuccessResult: \(unexpectedKeys.sorted().joined(separator: ", "))"
5860+)
5861+)
5862+}
5863+let container = try decoder.container(keyedBy: CodingKeys.self)
5864+let decodedOk = try container.decode(Bool.self, forKey: .ok)
5865+guard decodedOk == true else {
5866+throw DecodingError.dataCorruptedError(
5867+ forKey: .ok,
5868+ in: container,
5869+ debugDescription: "Expected ok to equal true"
5870+)
5871+}
5872+self.ok = true
5873+self.result = try container.decodeIfPresent(AnyCodable.self, forKey: .result)
5874+self.continueagent = try container.decodeIfPresent(Bool.self, forKey: .continueagent)
5875+self.reply = try container.decodeIfPresent(AnyCodable.self, forKey: .reply)
5876+}
5877+5878+public func encode(to encoder: Encoder) throws {
5879+var container = encoder.container(keyedBy: CodingKeys.self)
5880+try container.encode(true, forKey: .ok)
5881+try container.encodeIfPresent(result, forKey: .result)
5882+try container.encodeIfPresent(continueagent, forKey: .continueagent)
5883+try container.encodeIfPresent(reply, forKey: .reply)
5884+}
5885+}
5886+57105887public struct PluginsUiDescriptorsParams: Codable, Sendable {}
5711588857125889public struct PluginsUiDescriptorsResult: Codable, Sendable {
@@ -6157,6 +6334,37 @@ public struct ShutdownEvent: Codable, Sendable {
61576334}
61586335}
615963366337+public enum PluginsSessionActionResult: Codable, Sendable {
6338+case success(PluginsSessionActionSuccessResult)
6339+case failure(PluginsSessionActionFailureResult)
6340+6341+private enum CodingKeys: String, CodingKey {
6342+case discriminator = "ok"
6343+}
6344+6345+public init(from decoder: Decoder) throws {
6346+let container = try decoder.container(keyedBy: CodingKeys.self)
6347+let discriminator = try container.decode(Bool.self, forKey: .discriminator)
6348+switch discriminator {
6349+case true: self = try .success(PluginsSessionActionSuccessResult(from: decoder))
6350+case false: self = try .failure(PluginsSessionActionFailureResult(from: decoder))
6351+default:
6352+throw DecodingError.dataCorruptedError(
6353+ forKey: .discriminator,
6354+ in: container,
6355+ debugDescription: "Unknown PluginsSessionActionResult discriminator value"
6356+)
6357+}
6358+}
6359+6360+public func encode(to encoder: Encoder) throws {
6361+switch self {
6362+case .success(let value): try value.encode(to: encoder)
6363+case .failure(let value): try value.encode(to: encoder)
6364+}
6365+}
6366+}
6367+61606368public enum GatewayFrame: Codable, Sendable {
61616369case req(RequestFrame)
61626370case res(ResponseFrame)
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。