Files
zeekay 1df3ddf6bd Regenerate against the document the deployment answers for
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.
2026-09-05 18:55:38 -07:00

239 lines
17 KiB
Swift

//
// LeaderboardAPI.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
open class LeaderboardAPI {
/**
Leaderboard ranks AI usage over a window, either the users of the caller's own org or organizations against each other, and always reports the caller's own standing even when it falls outside the returned page.
- parameter scope: (query) Scope picks the board: \"personal\" (default) ranks the caller among their own org's users, \"org\" is that same org board named for an admin, \"global\" ranks organizations against each other. (optional)
- parameter metric: (query) Metric is the value ranked: tokens (default), requests, or cost. (optional)
- parameter period: (query) Period is the window ranked: day, week, month (default) or all. (optional)
- parameter limit: (query) Limit caps the rows returned, clamped to 100. Defaults to 10, which is also what a non-positive or unparseable value takes. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: LeaderboardView
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getLeaderboard(scope: String? = nil, metric: String? = nil, period: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> LeaderboardView {
return try await getLeaderboardWithRequestBuilder(scope: scope, metric: metric, period: period, limit: limit, apiConfiguration: apiConfiguration).execute().body
}
/**
Leaderboard ranks AI usage over a window, either the users of the caller's own org or organizations against each other, and always reports the caller's own standing even when it falls outside the returned page.
- GET /v1/leaderboard
- Leaderboard ranks AI usage over a window, either the users of the caller's own org or organizations against each other, and always reports the caller's own standing even when it falls outside the returned page. Identities are private by default: a caller sees themselves, plus the peers or orgs that opted into public listing, and only an admin sees their own org's members named. Cross-org spend is restricted to platform admins. When the warehouse is not connected the board answers empty with available=false rather than a fabricated rank.
- Bearer Token:
- type: http
- name: bearer
- parameter scope: (query) Scope picks the board: \"personal\" (default) ranks the caller among their own org's users, \"org\" is that same org board named for an admin, \"global\" ranks organizations against each other. (optional)
- parameter metric: (query) Metric is the value ranked: tokens (default), requests, or cost. (optional)
- parameter period: (query) Period is the window ranked: day, week, month (default) or all. (optional)
- parameter limit: (query) Limit caps the rows returned, clamped to 100. Defaults to 10, which is also what a non-positive or unparseable value takes. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<LeaderboardView>
*/
open class func getLeaderboardWithRequestBuilder(scope: String? = nil, metric: String? = nil, period: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<LeaderboardView> {
let localVariablePath = "/v1/leaderboard"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"scope": (wrappedValue: scope?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"metric": (wrappedValue: metric?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"period": (wrappedValue: period?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"limit": (wrappedValue: limit?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<LeaderboardView>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Activity returns the per-day usage series for ONE authorized subject — the points a contribution heatmap and a timeline are drawn from, gap-filled so every day in the range is present.
- parameter subject: (query) Subject is what the series is about: \&quot;user\&quot; (default), \&quot;org\&quot; or \&quot;project\&quot;. (optional)
- parameter id: (query) ID names the subject within what the caller is entitled to see. Omitted (or \&quot;me\&quot;) it is the caller themselves, or their own org. Another user requires org admin and must belong to the caller&#39;s org; another org requires a SuperAdmin. (optional)
- parameter from: (query) From is the first day of the range, \&quot;2006-01-02\&quot;. Defaults to 90 days back. (optional)
- parameter to: (query) To is the last day of the range, \&quot;2006-01-02\&quot;. Defaults to today; the span is clamped to 366 days. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: ActivityView
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getLeaderboardActivity(subject: String? = nil, id: String? = nil, from: String? = nil, to: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> ActivityView {
return try await getLeaderboardActivityWithRequestBuilder(subject: subject, id: id, from: from, to: to, apiConfiguration: apiConfiguration).execute().body
}
/**
Activity returns the per-day usage series for ONE authorized subject — the points a contribution heatmap and a timeline are drawn from, gap-filled so every day in the range is present.
- GET /v1/leaderboard/activity
- Activity returns the per-day usage series for ONE authorized subject — the points a contribution heatmap and a timeline are drawn from, gap-filled so every day in the range is present. Authorization is resolved server-side from the validated principal, so a caller can never widen the subject past what they are entitled to: a non-admin reads only themselves and their own org. subject=project answers empty with a note, because the usage ledger records no project column yet. When the warehouse is not connected the series answers empty with available=false rather than fabricated days.
- Bearer Token:
- type: http
- name: bearer
- parameter subject: (query) Subject is what the series is about: \&quot;user\&quot; (default), \&quot;org\&quot; or \&quot;project\&quot;. (optional)
- parameter id: (query) ID names the subject within what the caller is entitled to see. Omitted (or \&quot;me\&quot;) it is the caller themselves, or their own org. Another user requires org admin and must belong to the caller&#39;s org; another org requires a SuperAdmin. (optional)
- parameter from: (query) From is the first day of the range, \&quot;2006-01-02\&quot;. Defaults to 90 days back. (optional)
- parameter to: (query) To is the last day of the range, \&quot;2006-01-02\&quot;. Defaults to today; the span is clamped to 366 days. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<ActivityView>
*/
open class func getLeaderboardActivityWithRequestBuilder(subject: String? = nil, id: String? = nil, from: String? = nil, to: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<ActivityView> {
let localVariablePath = "/v1/leaderboard/activity"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"subject": (wrappedValue: subject?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"id": (wrappedValue: id?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"from": (wrappedValue: from?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"to": (wrappedValue: to?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<ActivityView>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the caller's own public-listing preference and their org's, each with whether the caller may change it.
- parameter apiConfiguration: The configuration for the http request.
- returns: OptinView
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getLeaderboardOptin(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> OptinView {
return try await getLeaderboardOptinWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the caller's own public-listing preference and their org's, each with whether the caller may change it.
- GET /v1/leaderboard/optin
- Returns the caller's own public-listing preference and their org's, each with whether the caller may change it. Public listing is opt-in and private by default, so a fresh caller reads listed=false for both.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<OptinView>
*/
open class func getLeaderboardOptinWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<OptinView> {
let localVariablePath = "/v1/leaderboard/optin"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<OptinView>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Sets the CALLER's own public-listing preference on the leaderboard.
- parameter userOptinReq: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: UserOptinView
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func putLeaderboardOptin(userOptinReq: UserOptinReq, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> UserOptinView {
return try await putLeaderboardOptinWithRequestBuilder(userOptinReq: userOptinReq, apiConfiguration: apiConfiguration).execute().body
}
/**
Sets the CALLER's own public-listing preference on the leaderboard.
- PUT /v1/leaderboard/optin
- Sets the CALLER's own public-listing preference on the leaderboard. Self only: the row written is keyed by the caller's validated ledger identity, so this can never edit another member's visibility whatever the request says. A caller opting in with no handle is given their username, so a listed row never renders as \"Anonymous\" to its own owner.
- Bearer Token:
- type: http
- name: bearer
- parameter userOptinReq: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<UserOptinView>
*/
open class func putLeaderboardOptinWithRequestBuilder(userOptinReq: UserOptinReq, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<UserOptinView> {
let localVariablePath = "/v1/leaderboard/optin"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: userOptinReq, codableHelper: apiConfiguration.codableHelper)
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
let localVariableNillableHeaders: [String: (any Sendable)?] = [
"Content-Type": "application/json",
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<UserOptinView>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Sets the ORG's listing on the cross-org global board.
- parameter orgOptinReq: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: OrgOptinView
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func putLeaderboardOptinOrg(orgOptinReq: OrgOptinReq, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> OrgOptinView {
return try await putLeaderboardOptinOrgWithRequestBuilder(orgOptinReq: orgOptinReq, apiConfiguration: apiConfiguration).execute().body
}
/**
Sets the ORG's listing on the cross-org global board.
- PUT /v1/leaderboard/optin/org
- Sets the ORG's listing on the cross-org global board. Only an admin of the caller's own org — an org admin or a platform SuperAdmin — may change it, and the org written is the caller's validated tenant, never a value from the request. Listing consents to publishing the org's usage VOLUME; cross-org spend stays restricted to platform admins regardless.
- Bearer Token:
- type: http
- name: bearer
- parameter orgOptinReq: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<OrgOptinView>
*/
open class func putLeaderboardOptinOrgWithRequestBuilder(orgOptinReq: OrgOptinReq, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<OrgOptinView> {
let localVariablePath = "/v1/leaderboard/optin/org"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: orgOptinReq, codableHelper: apiConfiguration.codableHelper)
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
let localVariableNillableHeaders: [String: (any Sendable)?] = [
"Content-Type": "application/json",
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<OrgOptinView>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
}