protocol: add generated bindings and conformance fixtures
This commit is contained in:
@@ -0,0 +1,664 @@
|
||||
// Code generated by tools/generate.py; DO NOT EDIT.
|
||||
import Foundation
|
||||
public typealias JSONObject = [String: String]
|
||||
public let schemaSHA256 = "36e4c8bac2eae674c1eba551c6ca8c64bf80fcc092ca63ec89a2c71c2bec86e1"
|
||||
public let currentWireVersion = "1"
|
||||
public let nMinus1WireVersion = "0"
|
||||
public let nMinus2WireVersion = "-1"
|
||||
|
||||
public struct AllocationPolicy: Codable, Equatable {
|
||||
public let minimumKbps: Int64
|
||||
public let targetKbps: Int64
|
||||
public let maximumKbps: Int64
|
||||
public let tier: String
|
||||
public let audience: String
|
||||
public let protocolValue: String
|
||||
public let protocolVersion: Int64
|
||||
public let grantTtlSeconds: Int64
|
||||
public let reservationLeaseSeconds: Int64
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case minimumKbps = "minimum_kbps"
|
||||
case targetKbps = "target_kbps"
|
||||
case maximumKbps = "maximum_kbps"
|
||||
case tier = "tier"
|
||||
case audience = "audience"
|
||||
case protocolValue = "protocol"
|
||||
case protocolVersion = "protocol_version"
|
||||
case grantTtlSeconds = "grant_ttl_seconds"
|
||||
case reservationLeaseSeconds = "reservation_lease_seconds"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
minimumKbps = try c.decode(Int64.self, forKey: .minimumKbps)
|
||||
targetKbps = try c.decode(Int64.self, forKey: .targetKbps)
|
||||
maximumKbps = try c.decode(Int64.self, forKey: .maximumKbps)
|
||||
tier = try c.decode(String.self, forKey: .tier)
|
||||
audience = try c.decode(String.self, forKey: .audience)
|
||||
protocolValue = try c.decode(String.self, forKey: .protocolValue)
|
||||
protocolVersion = try c.decode(Int64.self, forKey: .protocolVersion)
|
||||
grantTtlSeconds = try c.decode(Int64.self, forKey: .grantTtlSeconds)
|
||||
reservationLeaseSeconds = try c.decode(Int64.self, forKey: .reservationLeaseSeconds)
|
||||
}
|
||||
}
|
||||
|
||||
public struct AssignedDesktop: Codable, Equatable {
|
||||
public let assignmentId: String
|
||||
public let poolId: String
|
||||
public let name: String
|
||||
public let availability: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case assignmentId = "assignment_id"
|
||||
case poolId = "pool_id"
|
||||
case name = "name"
|
||||
case availability = "availability"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
assignmentId = try c.decode(String.self, forKey: .assignmentId)
|
||||
poolId = try c.decode(String.self, forKey: .poolId)
|
||||
name = try c.decode(String.self, forKey: .name)
|
||||
availability = try c.decode(String.self, forKey: .availability)
|
||||
}
|
||||
}
|
||||
|
||||
public struct BrokerSession: Codable, Equatable {
|
||||
public let id: String
|
||||
public let principalId: String
|
||||
public let poolId: String
|
||||
public let assignmentId: String?
|
||||
public let state: String
|
||||
public let policySnapshot: AllocationPolicy
|
||||
public let reconnectDeadline: String?
|
||||
public let outcome: String?
|
||||
public let failureCode: String?
|
||||
public let cleanupState: String
|
||||
public let idempotencyKey: String
|
||||
public let correlationId: String
|
||||
public let requestedAt: String
|
||||
public let endedAt: String?
|
||||
public let version: Int64
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id = "id"
|
||||
case principalId = "principal_id"
|
||||
case poolId = "pool_id"
|
||||
case assignmentId = "assignment_id"
|
||||
case state = "state"
|
||||
case policySnapshot = "policy_snapshot"
|
||||
case reconnectDeadline = "reconnect_deadline"
|
||||
case outcome = "outcome"
|
||||
case failureCode = "failure_code"
|
||||
case cleanupState = "cleanup_state"
|
||||
case idempotencyKey = "idempotency_key"
|
||||
case correlationId = "correlation_id"
|
||||
case requestedAt = "requested_at"
|
||||
case endedAt = "ended_at"
|
||||
case version = "version"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
id = try c.decode(String.self, forKey: .id)
|
||||
principalId = try c.decode(String.self, forKey: .principalId)
|
||||
poolId = try c.decode(String.self, forKey: .poolId)
|
||||
assignmentId = try c.decodeIfPresent(String.self, forKey: .assignmentId)
|
||||
state = try c.decode(String.self, forKey: .state)
|
||||
policySnapshot = try c.decode(AllocationPolicy.self, forKey: .policySnapshot)
|
||||
reconnectDeadline = try c.decodeIfPresent(String.self, forKey: .reconnectDeadline)
|
||||
outcome = try c.decodeIfPresent(String.self, forKey: .outcome)
|
||||
failureCode = try c.decodeIfPresent(String.self, forKey: .failureCode)
|
||||
cleanupState = try c.decode(String.self, forKey: .cleanupState)
|
||||
idempotencyKey = try c.decode(String.self, forKey: .idempotencyKey)
|
||||
correlationId = try c.decode(String.self, forKey: .correlationId)
|
||||
requestedAt = try c.decode(String.self, forKey: .requestedAt)
|
||||
endedAt = try c.decodeIfPresent(String.self, forKey: .endedAt)
|
||||
version = try c.decode(Int64.self, forKey: .version)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ClipboardText: Codable, Equatable {
|
||||
public let text: String
|
||||
public let encoding: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case text = "text"
|
||||
case encoding = "encoding"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
text = try c.decode(String.self, forKey: .text)
|
||||
encoding = try c.decode(String.self, forKey: .encoding)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ConnectionManifest: Codable, Equatable {
|
||||
public let version: String
|
||||
public let purpose: String
|
||||
public let sessionId: String
|
||||
public let reconnectSequence: Int64
|
||||
public let gateway: ManifestGateway
|
||||
public let tunnel: ManifestTunnel
|
||||
public let profile: ManifestProfile
|
||||
public let grant: GrantReference
|
||||
public let correlationId: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case version = "version"
|
||||
case purpose = "purpose"
|
||||
case sessionId = "session_id"
|
||||
case reconnectSequence = "reconnect_sequence"
|
||||
case gateway = "gateway"
|
||||
case tunnel = "tunnel"
|
||||
case profile = "profile"
|
||||
case grant = "grant"
|
||||
case correlationId = "correlation_id"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
version = try c.decode(String.self, forKey: .version)
|
||||
purpose = try c.decode(String.self, forKey: .purpose)
|
||||
sessionId = try c.decode(String.self, forKey: .sessionId)
|
||||
reconnectSequence = try c.decode(Int64.self, forKey: .reconnectSequence)
|
||||
gateway = try c.decode(ManifestGateway.self, forKey: .gateway)
|
||||
tunnel = try c.decode(ManifestTunnel.self, forKey: .tunnel)
|
||||
profile = try c.decode(ManifestProfile.self, forKey: .profile)
|
||||
grant = try c.decode(GrantReference.self, forKey: .grant)
|
||||
correlationId = try c.decode(String.self, forKey: .correlationId)
|
||||
}
|
||||
}
|
||||
|
||||
public struct DeviceChallenge: Codable, Equatable {
|
||||
public let deviceId: String
|
||||
public let serverId: String
|
||||
public let principalId: String
|
||||
public let challenge: String
|
||||
public let expiresAt: String
|
||||
public let algorithm: String
|
||||
public let signatureFormat: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case deviceId = "device_id"
|
||||
case serverId = "server_id"
|
||||
case principalId = "principal_id"
|
||||
case challenge = "challenge"
|
||||
case expiresAt = "expires_at"
|
||||
case algorithm = "algorithm"
|
||||
case signatureFormat = "signature_format"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
deviceId = try c.decode(String.self, forKey: .deviceId)
|
||||
serverId = try c.decode(String.self, forKey: .serverId)
|
||||
principalId = try c.decode(String.self, forKey: .principalId)
|
||||
challenge = try c.decode(String.self, forKey: .challenge)
|
||||
expiresAt = try c.decode(String.self, forKey: .expiresAt)
|
||||
algorithm = try c.decode(String.self, forKey: .algorithm)
|
||||
signatureFormat = try c.decode(String.self, forKey: .signatureFormat)
|
||||
}
|
||||
}
|
||||
|
||||
public struct DeviceProofRequest: Codable, Equatable {
|
||||
public let challenge: String
|
||||
public let signature: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case challenge = "challenge"
|
||||
case signature = "signature"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
challenge = try c.decode(String.self, forKey: .challenge)
|
||||
signature = try c.decode(String.self, forKey: .signature)
|
||||
}
|
||||
}
|
||||
|
||||
public struct DeviceRegistrationRequest: Codable, Equatable {
|
||||
public let name: String
|
||||
public let platform: String
|
||||
public let deviceSubject: String
|
||||
public let algorithm: String
|
||||
public let publicKey: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case name = "name"
|
||||
case platform = "platform"
|
||||
case deviceSubject = "device_subject"
|
||||
case algorithm = "algorithm"
|
||||
case publicKey = "public_key"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
name = try c.decode(String.self, forKey: .name)
|
||||
platform = try c.decode(String.self, forKey: .platform)
|
||||
deviceSubject = try c.decode(String.self, forKey: .deviceSubject)
|
||||
algorithm = try c.decode(String.self, forKey: .algorithm)
|
||||
publicKey = try c.decode(String.self, forKey: .publicKey)
|
||||
}
|
||||
}
|
||||
|
||||
public struct EntitledPool: Codable, Equatable {
|
||||
public let poolId: String
|
||||
public let name: String
|
||||
public let assignmentState: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case poolId = "pool_id"
|
||||
case name = "name"
|
||||
case assignmentState = "assignment_state"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
poolId = try c.decode(String.self, forKey: .poolId)
|
||||
name = try c.decode(String.self, forKey: .name)
|
||||
assignmentState = try c.decode(String.self, forKey: .assignmentState)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ErrorEnvelope: Codable, Equatable {
|
||||
public let status: Bool
|
||||
public let error: String
|
||||
public let code: String
|
||||
public let message: String
|
||||
public let resolution: String
|
||||
public let requestId: String
|
||||
public let violations: [FieldViolation]
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case status = "status"
|
||||
case error = "error"
|
||||
case code = "code"
|
||||
case message = "message"
|
||||
case resolution = "resolution"
|
||||
case requestId = "request_id"
|
||||
case violations = "violations"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
status = try c.decode(Bool.self, forKey: .status)
|
||||
error = try c.decode(String.self, forKey: .error)
|
||||
code = try c.decode(String.self, forKey: .code)
|
||||
message = try c.decode(String.self, forKey: .message)
|
||||
resolution = try c.decode(String.self, forKey: .resolution)
|
||||
requestId = try c.decode(String.self, forKey: .requestId)
|
||||
violations = try c.decode([FieldViolation].self, forKey: .violations)
|
||||
}
|
||||
}
|
||||
|
||||
public struct EventEnvelope: Codable, Equatable {
|
||||
public let eventId: String
|
||||
public let sequence: Int64
|
||||
public let type: String
|
||||
public let version: Int64
|
||||
public let resource: ResourceLink
|
||||
public let occurredAt: String
|
||||
public let correlationId: String
|
||||
public let payload: JSONObject
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case eventId = "event_id"
|
||||
case sequence = "sequence"
|
||||
case type = "type"
|
||||
case version = "version"
|
||||
case resource = "resource"
|
||||
case occurredAt = "occurred_at"
|
||||
case correlationId = "correlation_id"
|
||||
case payload = "payload"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
eventId = try c.decode(String.self, forKey: .eventId)
|
||||
sequence = try c.decode(Int64.self, forKey: .sequence)
|
||||
type = try c.decode(String.self, forKey: .type)
|
||||
version = try c.decode(Int64.self, forKey: .version)
|
||||
resource = try c.decode(ResourceLink.self, forKey: .resource)
|
||||
occurredAt = try c.decode(String.self, forKey: .occurredAt)
|
||||
correlationId = try c.decode(String.self, forKey: .correlationId)
|
||||
payload = try c.decode(JSONObject.self, forKey: .payload)
|
||||
}
|
||||
}
|
||||
|
||||
public struct EventResume: Codable, Equatable {
|
||||
public let cursor: String
|
||||
public let lastSequence: Int64
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case cursor = "cursor"
|
||||
case lastSequence = "last_sequence"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
cursor = try c.decode(String.self, forKey: .cursor)
|
||||
lastSequence = try c.decode(Int64.self, forKey: .lastSequence)
|
||||
}
|
||||
}
|
||||
|
||||
public struct FieldViolation: Codable, Equatable {
|
||||
public let field: String
|
||||
public let code: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case field = "field"
|
||||
case code = "code"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
field = try c.decode(String.self, forKey: .field)
|
||||
code = try c.decode(String.self, forKey: .code)
|
||||
}
|
||||
}
|
||||
|
||||
public struct GrantReference: Codable, Equatable {
|
||||
public let opaqueValue: String
|
||||
public let expiresAt: String
|
||||
public let audience: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case opaqueValue = "opaque_value"
|
||||
case expiresAt = "expires_at"
|
||||
case audience = "audience"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
opaqueValue = try c.decode(String.self, forKey: .opaqueValue)
|
||||
expiresAt = try c.decode(String.self, forKey: .expiresAt)
|
||||
audience = try c.decode(String.self, forKey: .audience)
|
||||
}
|
||||
}
|
||||
|
||||
public struct LoginRequest: Codable, Equatable {
|
||||
public let provider: String?
|
||||
public let username: String
|
||||
public let password: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case provider = "provider"
|
||||
case username = "username"
|
||||
case password = "password"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
provider = try c.decodeIfPresent(String.self, forKey: .provider)
|
||||
username = try c.decode(String.self, forKey: .username)
|
||||
password = try c.decode(String.self, forKey: .password)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ManifestBounds: Codable, Equatable {
|
||||
public let minimumKbps: Int64
|
||||
public let targetKbps: Int64
|
||||
public let maximumKbps: Int64
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case minimumKbps = "minimum_kbps"
|
||||
case targetKbps = "target_kbps"
|
||||
case maximumKbps = "maximum_kbps"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
minimumKbps = try c.decode(Int64.self, forKey: .minimumKbps)
|
||||
targetKbps = try c.decode(Int64.self, forKey: .targetKbps)
|
||||
maximumKbps = try c.decode(Int64.self, forKey: .maximumKbps)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ManifestGateway: Codable, Equatable {
|
||||
public let id: String
|
||||
public let addresses: [String]
|
||||
public let publicIdentity: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id = "id"
|
||||
case addresses = "addresses"
|
||||
case publicIdentity = "public_identity"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
id = try c.decode(String.self, forKey: .id)
|
||||
addresses = try c.decode([String].self, forKey: .addresses)
|
||||
publicIdentity = try c.decode(String.self, forKey: .publicIdentity)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ManifestProfile: Codable, Equatable {
|
||||
public let id: String
|
||||
public let bounds: ManifestBounds
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id = "id"
|
||||
case bounds = "bounds"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
id = try c.decode(String.self, forKey: .id)
|
||||
bounds = try c.decode(ManifestBounds.self, forKey: .bounds)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ManifestTunnel: Codable, Equatable {
|
||||
public let versions: [String]
|
||||
public let features: [String]
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case versions = "versions"
|
||||
case features = "features"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
versions = try c.decode([String].self, forKey: .versions)
|
||||
features = try c.decode([String].self, forKey: .features)
|
||||
}
|
||||
}
|
||||
|
||||
public struct NativeCredential: Codable, Equatable {
|
||||
public let deviceId: String?
|
||||
public let familyId: String
|
||||
public let accessToken: String
|
||||
public let refreshToken: String
|
||||
public let expiresAt: String
|
||||
public let refreshExpiresAt: String?
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case deviceId = "device_id"
|
||||
case familyId = "family_id"
|
||||
case accessToken = "access_token"
|
||||
case refreshToken = "refresh_token"
|
||||
case expiresAt = "expires_at"
|
||||
case refreshExpiresAt = "refresh_expires_at"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
deviceId = try c.decodeIfPresent(String.self, forKey: .deviceId)
|
||||
familyId = try c.decode(String.self, forKey: .familyId)
|
||||
accessToken = try c.decode(String.self, forKey: .accessToken)
|
||||
refreshToken = try c.decode(String.self, forKey: .refreshToken)
|
||||
expiresAt = try c.decode(String.self, forKey: .expiresAt)
|
||||
refreshExpiresAt = try c.decodeIfPresent(String.self, forKey: .refreshExpiresAt)
|
||||
}
|
||||
}
|
||||
|
||||
public struct PageInfo: Codable, Equatable {
|
||||
public let limit: Int64
|
||||
public let nextCursor: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case limit = "limit"
|
||||
case nextCursor = "next_cursor"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
limit = try c.decode(Int64.self, forKey: .limit)
|
||||
nextCursor = try c.decode(String.self, forKey: .nextCursor)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ReauthGrant: Codable, Equatable {
|
||||
public let token: String
|
||||
public let purpose: String
|
||||
public let expiresAt: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case token = "token"
|
||||
case purpose = "purpose"
|
||||
case expiresAt = "expires_at"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
token = try c.decode(String.self, forKey: .token)
|
||||
purpose = try c.decode(String.self, forKey: .purpose)
|
||||
expiresAt = try c.decode(String.self, forKey: .expiresAt)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ReauthRequest: Codable, Equatable {
|
||||
public let password: String
|
||||
public let purpose: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case password = "password"
|
||||
case purpose = "purpose"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
password = try c.decode(String.self, forKey: .password)
|
||||
purpose = try c.decode(String.self, forKey: .purpose)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ReconnectRequest: Codable, Equatable {
|
||||
public let clientDeviceId: String
|
||||
public let deviceKeyId: String
|
||||
public let expectedVersion: Int64
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case clientDeviceId = "client_device_id"
|
||||
case deviceKeyId = "device_key_id"
|
||||
case expectedVersion = "expected_version"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
clientDeviceId = try c.decode(String.self, forKey: .clientDeviceId)
|
||||
deviceKeyId = try c.decode(String.self, forKey: .deviceKeyId)
|
||||
expectedVersion = try c.decode(Int64.self, forKey: .expectedVersion)
|
||||
}
|
||||
}
|
||||
|
||||
public struct RefreshRequest: Codable, Equatable {
|
||||
public let familyId: String
|
||||
public let refreshToken: String
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case familyId = "family_id"
|
||||
case refreshToken = "refresh_token"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
familyId = try c.decode(String.self, forKey: .familyId)
|
||||
refreshToken = try c.decode(String.self, forKey: .refreshToken)
|
||||
}
|
||||
}
|
||||
|
||||
public struct Resource: Codable, Equatable {
|
||||
public let id: String
|
||||
public let kind: String
|
||||
public let name: String
|
||||
public let state: String
|
||||
public let assignmentState: String?
|
||||
public let version: Int64
|
||||
public let links: [ResourceLink]
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id = "id"
|
||||
case kind = "kind"
|
||||
case name = "name"
|
||||
case state = "state"
|
||||
case assignmentState = "assignment_state"
|
||||
case version = "version"
|
||||
case links = "links"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
id = try c.decode(String.self, forKey: .id)
|
||||
kind = try c.decode(String.self, forKey: .kind)
|
||||
name = try c.decode(String.self, forKey: .name)
|
||||
state = try c.decode(String.self, forKey: .state)
|
||||
assignmentState = try c.decodeIfPresent(String.self, forKey: .assignmentState)
|
||||
version = try c.decode(Int64.self, forKey: .version)
|
||||
links = try c.decode([ResourceLink].self, forKey: .links)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ResourceLink: Codable, Equatable {
|
||||
public let type: String
|
||||
public let id: String
|
||||
public let version: Int64
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case type = "type"
|
||||
case id = "id"
|
||||
case version = "version"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
type = try c.decode(String.self, forKey: .type)
|
||||
id = try c.decode(String.self, forKey: .id)
|
||||
version = try c.decode(Int64.self, forKey: .version)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ResourceList: Codable, Equatable {
|
||||
public let assignedDesktops: [AssignedDesktop]
|
||||
public let entitledPools: [EntitledPool]
|
||||
public let page: PageInfo
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case assignedDesktops = "assigned_desktops"
|
||||
case entitledPools = "entitled_pools"
|
||||
case page = "page"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
assignedDesktops = try c.decode([AssignedDesktop].self, forKey: .assignedDesktops)
|
||||
entitledPools = try c.decode([EntitledPool].self, forKey: .entitledPools)
|
||||
page = try c.decode(PageInfo.self, forKey: .page)
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionRequest: Codable, Equatable {
|
||||
public let clientDeviceId: String
|
||||
public let deviceKeyId: String
|
||||
public let poolId: String
|
||||
public let idempotencyKey: String
|
||||
public let policySnapshot: AllocationPolicy
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case clientDeviceId = "client_device_id"
|
||||
case deviceKeyId = "device_key_id"
|
||||
case poolId = "pool_id"
|
||||
case idempotencyKey = "idempotency_key"
|
||||
case policySnapshot = "policy_snapshot"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
clientDeviceId = try c.decode(String.self, forKey: .clientDeviceId)
|
||||
deviceKeyId = try c.decode(String.self, forKey: .deviceKeyId)
|
||||
poolId = try c.decode(String.self, forKey: .poolId)
|
||||
idempotencyKey = try c.decode(String.self, forKey: .idempotencyKey)
|
||||
policySnapshot = try c.decode(AllocationPolicy.self, forKey: .policySnapshot)
|
||||
}
|
||||
}
|
||||
|
||||
public struct VersionNegotiation: Codable, Equatable {
|
||||
public let supportedVersions: [String]
|
||||
public let features: [String]
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case supportedVersions = "supported_versions"
|
||||
case features = "features"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
supportedVersions = try c.decode([String].self, forKey: .supportedVersions)
|
||||
features = try c.decode([String].self, forKey: .features)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user