mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The projection these were generated from predated the compute migration, so they described /v1/visor — which the API serves at zero paths now. No /v1/visor path survives here.
51 lines
2.8 KiB
Swift
51 lines
2.8 KiB
Swift
//
|
|
// PairingView.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct PairingView: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Channel is the transport the request arrived on — discord, slack, teams or telegram — and half of what approval names. The cap of three unapproved requests applies per (org, channel); while it is full no further code is minted until one is approved or expires. */
|
|
public var channel: String?
|
|
/** Code is the CAPABILITY that authorises the approval: eight characters from a 32-symbol uppercase alphabet (A-Z0-9 minus the confusables 0, O, 1 and I), minted with crypto/rand and also sent to the requester in chat. An org admin passes it with the channel to POST /v1/channel/pairing/approve, which CONSUMES it — the request row is deleted, so a code approves once — and which takes org admin as well as the code. It lives ONE HOUR from CreatedAt; expired requests are not listed here, and approving one is a 404. It is shown on this admin surface and NEVER logged. */
|
|
public var code: String?
|
|
/** CreatedAt is Unix SECONDS of FIRST contact: when the request was minted and the code sent. Expiry is measured from here and from nowhere else. */
|
|
public var createdAt: Int64?
|
|
/** LastSeen is Unix SECONDS of the MOST RECENT message from this sender while the request has been pending. It moves as they keep writing, which is how an admin tells a live request from an abandoned one — but it does not extend the hour and does not re-send the code, since one request sends exactly one chat reply. */
|
|
public var lastSeen: Int64?
|
|
/** Sender is the transport-native user id waiting for access — the same identity inbox messages carry. Approving mints a DM allow entry for exactly this value and nothing wider: pairing never grants group access. */
|
|
public var sender: String?
|
|
|
|
public init(channel: String? = nil, code: String? = nil, createdAt: Int64? = nil, lastSeen: Int64? = nil, sender: String? = nil) {
|
|
self.channel = channel
|
|
self.code = code
|
|
self.createdAt = createdAt
|
|
self.lastSeen = lastSeen
|
|
self.sender = sender
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case channel
|
|
case code
|
|
case createdAt
|
|
case lastSeen
|
|
case sender
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(channel, forKey: .channel)
|
|
try container.encodeIfPresent(code, forKey: .code)
|
|
try container.encodeIfPresent(createdAt, forKey: .createdAt)
|
|
try container.encodeIfPresent(lastSeen, forKey: .lastSeen)
|
|
try container.encodeIfPresent(sender, forKey: .sender)
|
|
}
|
|
}
|
|
|