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.
350 lines
20 KiB
Swift
350 lines
20 KiB
Swift
//
|
||
// FlagAPI.swift
|
||
//
|
||
// Generated by openapi-generator
|
||
// https://openapi-generator.tech
|
||
//
|
||
|
||
import Foundation
|
||
|
||
open class FlagAPI {
|
||
|
||
/**
|
||
Removes one flag definition by key and records the deletion in the change log.
|
||
|
||
- parameter key: (path) Key is the flag key to act on, from the path.
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: DeletedOut
|
||
*/
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||
open class func deleteFlagDefsByKey(key: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> DeletedOut {
|
||
return try await deleteFlagDefsByKeyWithRequestBuilder(key: key, apiConfiguration: apiConfiguration).execute().body
|
||
}
|
||
|
||
/**
|
||
Removes one flag definition by key and records the deletion in the change log.
|
||
- DELETE /v1/flag/defs/{key}
|
||
- Removes one flag definition by key and records the deletion in the change log. A key the caller's store does not hold is a 404.
|
||
- Bearer Token:
|
||
- type: http
|
||
- name: bearer
|
||
- parameter key: (path) Key is the flag key to act on, from the path.
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: RequestBuilder<DeletedOut>
|
||
*/
|
||
open class func deleteFlagDefsByKeyWithRequestBuilder(key: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<DeletedOut> {
|
||
var localVariablePath = "/v1/flag/defs/{key}"
|
||
let keyPreEscape = "\(APIHelper.mapValueToPathItem(key))"
|
||
let keyPostEscape = keyPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||
localVariablePath = localVariablePath.replacingOccurrences(of: "{key}", with: keyPostEscape, options: .literal, range: nil)
|
||
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<DeletedOut>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
||
|
||
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
||
}
|
||
|
||
/**
|
||
Returns the caller's flag change log newest-first: every create, update and delete, with the actor and the time.
|
||
|
||
- parameter limit: (query) Limit caps the rows returned. 1–500; anything else takes the default 100. (optional)
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: ActivityOut
|
||
*/
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||
open class func getFlagActivity(limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> ActivityOut {
|
||
return try await getFlagActivityWithRequestBuilder(limit: limit, apiConfiguration: apiConfiguration).execute().body
|
||
}
|
||
|
||
/**
|
||
Returns the caller's flag change log newest-first: every create, update and delete, with the actor and the time.
|
||
- GET /v1/flag/activity
|
||
- Returns the caller's flag change log newest-first: every create, update and delete, with the actor and the time.
|
||
- Bearer Token:
|
||
- type: http
|
||
- name: bearer
|
||
- parameter limit: (query) Limit caps the rows returned. 1–500; anything else takes the default 100. (optional)
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: RequestBuilder<ActivityOut>
|
||
*/
|
||
open class func getFlagActivityWithRequestBuilder(limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<ActivityOut> {
|
||
let localVariablePath = "/v1/flag/activity"
|
||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||
let localVariableParameters: [String: any Sendable]? = nil
|
||
|
||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||
"limit": (wrappedValue: limit?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
|
||
])
|
||
|
||
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||
:
|
||
]
|
||
|
||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||
|
||
let localVariableRequestBuilder: RequestBuilder<ActivityOut>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
||
|
||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
||
}
|
||
|
||
/**
|
||
Returns every flag definition in the caller's (org, project) store, by key, with its version and who last changed it.
|
||
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: DefsOut
|
||
*/
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||
open class func getFlagDefs(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> DefsOut {
|
||
return try await getFlagDefsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
||
}
|
||
|
||
/**
|
||
Returns every flag definition in the caller's (org, project) store, by key, with its version and who last changed it.
|
||
- GET /v1/flag/defs
|
||
- Returns every flag definition in the caller's (org, project) store, by key, with its version and who last changed it.
|
||
- Bearer Token:
|
||
- type: http
|
||
- name: bearer
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: RequestBuilder<DefsOut>
|
||
*/
|
||
open class func getFlagDefsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<DefsOut> {
|
||
let localVariablePath = "/v1/flag/defs"
|
||
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<DefsOut>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
||
|
||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
||
}
|
||
|
||
/**
|
||
Returns one flag definition by key, or 404 when the caller's store has none under that key.
|
||
|
||
- parameter key: (path) Key is the flag key to act on, from the path.
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: DefRow
|
||
*/
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||
open class func getFlagDefsByKey(key: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> DefRow {
|
||
return try await getFlagDefsByKeyWithRequestBuilder(key: key, apiConfiguration: apiConfiguration).execute().body
|
||
}
|
||
|
||
/**
|
||
Returns one flag definition by key, or 404 when the caller's store has none under that key.
|
||
- GET /v1/flag/defs/{key}
|
||
- Returns one flag definition by key, or 404 when the caller's store has none under that key.
|
||
- Bearer Token:
|
||
- type: http
|
||
- name: bearer
|
||
- parameter key: (path) Key is the flag key to act on, from the path.
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: RequestBuilder<DefRow>
|
||
*/
|
||
open class func getFlagDefsByKeyWithRequestBuilder(key: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<DefRow> {
|
||
var localVariablePath = "/v1/flag/defs/{key}"
|
||
let keyPreEscape = "\(APIHelper.mapValueToPathItem(key))"
|
||
let keyPostEscape = keyPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||
localVariablePath = localVariablePath.replacingOccurrences(of: "{key}", with: keyPostEscape, options: .literal, range: nil)
|
||
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<DefRow>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
||
|
||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
||
}
|
||
|
||
/**
|
||
Health reports that the flag engine is serving.
|
||
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: HealthOut
|
||
*/
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||
open class func getFlagHealth(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> HealthOut {
|
||
return try await getFlagHealthWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
||
}
|
||
|
||
/**
|
||
Health reports that the flag engine is serving.
|
||
- GET /v1/flag/health
|
||
- Health reports that the flag engine is serving. It is not gated: liveness must be probe-able without a token.
|
||
- Bearer Token:
|
||
- type: http
|
||
- name: bearer
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: RequestBuilder<HealthOut>
|
||
*/
|
||
open class func getFlagHealthWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<HealthOut> {
|
||
let localVariablePath = "/v1/flag/health"
|
||
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<HealthOut>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
||
|
||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
||
}
|
||
|
||
/**
|
||
Evaluate runs the caller's flag definitions for one identity and returns the flag verdict: which flags are on (or which variant), their payloads, and whether any definition failed to compute.
|
||
|
||
- parameter evaluateIn: (body)
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: JSONValue
|
||
*/
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||
open class func postFlag(evaluateIn: EvaluateIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> JSONValue {
|
||
return try await postFlagWithRequestBuilder(evaluateIn: evaluateIn, apiConfiguration: apiConfiguration).execute().body
|
||
}
|
||
|
||
/**
|
||
Evaluate runs the caller's flag definitions for one identity and returns the flag verdict: which flags are on (or which variant), their payloads, and whether any definition failed to compute.
|
||
- POST /v1/flag
|
||
- Evaluate runs the caller's flag definitions for one identity and returns the flag verdict: which flags are on (or which variant), their payloads, and whether any definition failed to compute. Evaluation is in-process over the caller's own (org, project) definitions — no network hop, no shared KV — so a tenant can only ever evaluate its own flags.
|
||
- Bearer Token:
|
||
- type: http
|
||
- name: bearer
|
||
- parameter evaluateIn: (body)
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: RequestBuilder<JSONValue>
|
||
*/
|
||
open class func postFlagWithRequestBuilder(evaluateIn: EvaluateIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<JSONValue> {
|
||
let localVariablePath = "/v1/flag"
|
||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: evaluateIn, 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<JSONValue>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
||
|
||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
||
}
|
||
|
||
/**
|
||
Evaluate runs the caller's flag definitions for one identity and returns the flag verdict: which flags are on (or which variant), their payloads, and whether any definition failed to compute.
|
||
|
||
- parameter evaluateIn: (body)
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: JSONValue
|
||
*/
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||
open class func postFlagDecide(evaluateIn: EvaluateIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> JSONValue {
|
||
return try await postFlagDecideWithRequestBuilder(evaluateIn: evaluateIn, apiConfiguration: apiConfiguration).execute().body
|
||
}
|
||
|
||
/**
|
||
Evaluate runs the caller's flag definitions for one identity and returns the flag verdict: which flags are on (or which variant), their payloads, and whether any definition failed to compute.
|
||
- POST /v1/flag/decide
|
||
- Evaluate runs the caller's flag definitions for one identity and returns the flag verdict: which flags are on (or which variant), their payloads, and whether any definition failed to compute. Evaluation is in-process over the caller's own (org, project) definitions — no network hop, no shared KV — so a tenant can only ever evaluate its own flags.
|
||
- Bearer Token:
|
||
- type: http
|
||
- name: bearer
|
||
- parameter evaluateIn: (body)
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: RequestBuilder<JSONValue>
|
||
*/
|
||
open class func postFlagDecideWithRequestBuilder(evaluateIn: EvaluateIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<JSONValue> {
|
||
let localVariablePath = "/v1/flag/decide"
|
||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: evaluateIn, 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<JSONValue>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
||
|
||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
||
}
|
||
|
||
/**
|
||
Creates or replaces the flag definition at the path's key and returns the stored row.
|
||
|
||
- parameter key: (path) Key is the flag key to write, from the path.
|
||
- parameter body: (body)
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: DefRow
|
||
*/
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||
open class func putFlagDefsByKey(key: String, body: JSONValue, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> DefRow {
|
||
return try await putFlagDefsByKeyWithRequestBuilder(key: key, body: body, apiConfiguration: apiConfiguration).execute().body
|
||
}
|
||
|
||
/**
|
||
Creates or replaces the flag definition at the path's key and returns the stored row.
|
||
- PUT /v1/flag/defs/{key}
|
||
- Creates or replaces the flag definition at the path's key and returns the stored row. The BODY IS THE DEFINITION DOCUMENT — the flag-definition JSON object the evaluator consumes — and it is stored verbatim except that its \"key\" is forced to the key in the URL, so a document can never be filed under a name other than the one it was addressed by. Every write bumps the version and appends to the change log under the caller's identity.
|
||
- Bearer Token:
|
||
- type: http
|
||
- name: bearer
|
||
- parameter key: (path) Key is the flag key to write, from the path.
|
||
- parameter body: (body)
|
||
- parameter apiConfiguration: The configuration for the http request.
|
||
- returns: RequestBuilder<DefRow>
|
||
*/
|
||
open class func putFlagDefsByKeyWithRequestBuilder(key: String, body: JSONValue, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<DefRow> {
|
||
var localVariablePath = "/v1/flag/defs/{key}"
|
||
let keyPreEscape = "\(APIHelper.mapValueToPathItem(key))"
|
||
let keyPostEscape = keyPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||
localVariablePath = localVariablePath.replacingOccurrences(of: "{key}", with: keyPostEscape, options: .literal, range: nil)
|
||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, 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<DefRow>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
||
|
||
return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
||
}
|
||
}
|