mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-24 19:11:16 +00:00
* ci(swift): enforce shared kit dead-code coverage * chore(i18n): sync native source inventory * ci(swift): install pinned iOS scan tools
64 lines
1.7 KiB
Swift
64 lines
1.7 KiB
Swift
import Foundation
|
|
|
|
public struct OpenClawCanvasNavigateParams: Codable, Sendable, Equatable {
|
|
public var url: String
|
|
|
|
public init(url: String) {
|
|
self.url = url
|
|
}
|
|
}
|
|
|
|
public struct OpenClawCanvasPlacement: Codable, Sendable, Equatable {
|
|
public var x: Double?
|
|
public var y: Double?
|
|
public var width: Double?
|
|
public var height: Double?
|
|
}
|
|
|
|
public struct OpenClawCanvasPresentParams: Codable, Sendable, Equatable {
|
|
public var url: String?
|
|
public var placement: OpenClawCanvasPlacement?
|
|
|
|
public init(url: String? = nil, placement: OpenClawCanvasPlacement? = nil) {
|
|
self.url = url
|
|
self.placement = placement
|
|
}
|
|
}
|
|
|
|
public struct OpenClawCanvasEvalParams: Codable, Sendable, Equatable {
|
|
public var javaScript: String
|
|
|
|
public init(javaScript: String) {
|
|
self.javaScript = javaScript
|
|
}
|
|
}
|
|
|
|
public enum OpenClawCanvasSnapshotFormat: String, Codable, Sendable {
|
|
case png
|
|
case jpeg
|
|
|
|
public init(from decoder: Decoder) throws {
|
|
let c = try decoder.singleValueContainer()
|
|
let raw = try c.decode(String.self).trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
|
|
switch raw {
|
|
case "png":
|
|
self = .png
|
|
case "jpeg", "jpg":
|
|
self = .jpeg
|
|
default:
|
|
throw DecodingError.dataCorruptedError(in: c, debugDescription: "Invalid snapshot format: \(raw)")
|
|
}
|
|
}
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var c = encoder.singleValueContainer()
|
|
try c.encode(self.rawValue)
|
|
}
|
|
}
|
|
|
|
public struct OpenClawCanvasSnapshotParams: Codable, Sendable, Equatable {
|
|
public var maxWidth: Int?
|
|
public var quality: Double?
|
|
public var format: OpenClawCanvasSnapshotFormat?
|
|
}
|