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.
81 lines
4.0 KiB
Swift
81 lines
4.0 KiB
Swift
//
|
|
// LeaderboardView.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct LeaderboardView: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Available is false when the usage warehouse is not connected or its rollup is not ready. Rows is then empty because nothing could be read — not because nobody used anything. Show that difference; never render an unavailable board as a real one. */
|
|
public var available: Bool?
|
|
/** End is the EXCLUSIVE upper bound of the window, \"2006-01-02\" — the day after the last one counted. A board through today reports tomorrow's date here. */
|
|
public var end: String?
|
|
/** Metric echoes the value ranked: tokens|requests|cost. */
|
|
public var metric: String?
|
|
/** Period is the window's canonical label: day|week|month|all. The server resolves aliases (7d, 30d, today, …) to these, so this may differ from what was sent. */
|
|
public var period: String?
|
|
/** Rows are the ranked subjects, best first, at most the requested limit of them. Always a list, never null: an empty one means nothing was read, not an error. */
|
|
public var rows: [LeaderboardRow]?
|
|
/** Scope echoes the board that was served: personal|org|global. */
|
|
public var scope: String?
|
|
/** Self is the caller's own standing, reported even when they fall outside Rows. Absent when the caller's ledger identity cannot be resolved, or when the query behind it failed — never faked to keep the shape tidy. */
|
|
public var _self: SelfRank?
|
|
/** Source names the table these numbers were aggregated from (the derived daily rollup, hanzo.usage_rollup_daily), so an operator can tell exactly what was read. */
|
|
public var source: String?
|
|
/** Start is the first day counted, \"2006-01-02\" inclusive. Empty for period=all, which has no lower bound at all. */
|
|
public var start: String?
|
|
/** Subject is what the rows stand for — \"user\" on a personal or org board, \"org\" on the global one. It tells a client whether Handle names a person or a company. */
|
|
public var subject: String?
|
|
/** Total is how many subjects were ranked in the window — the org's active users, or the active/opted-in orgs on the global board. It is the universe the ranks are out of, so it is normally larger than len(rows). */
|
|
public var total: Int64?
|
|
|
|
public init(available: Bool? = nil, end: String? = nil, metric: String? = nil, period: String? = nil, rows: [LeaderboardRow]? = nil, scope: String? = nil, _self: SelfRank? = nil, source: String? = nil, start: String? = nil, subject: String? = nil, total: Int64? = nil) {
|
|
self.available = available
|
|
self.end = end
|
|
self.metric = metric
|
|
self.period = period
|
|
self.rows = rows
|
|
self.scope = scope
|
|
self._self = _self
|
|
self.source = source
|
|
self.start = start
|
|
self.subject = subject
|
|
self.total = total
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case available
|
|
case end
|
|
case metric
|
|
case period
|
|
case rows
|
|
case scope
|
|
case _self = "self"
|
|
case source
|
|
case start
|
|
case subject
|
|
case total
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(available, forKey: .available)
|
|
try container.encodeIfPresent(end, forKey: .end)
|
|
try container.encodeIfPresent(metric, forKey: .metric)
|
|
try container.encodeIfPresent(period, forKey: .period)
|
|
try container.encodeIfPresent(rows, forKey: .rows)
|
|
try container.encodeIfPresent(scope, forKey: .scope)
|
|
try container.encodeIfPresent(_self, forKey: ._self)
|
|
try container.encodeIfPresent(source, forKey: .source)
|
|
try container.encodeIfPresent(start, forKey: .start)
|
|
try container.encodeIfPresent(subject, forKey: .subject)
|
|
try container.encodeIfPresent(total, forKey: .total)
|
|
}
|
|
}
|
|
|