mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
433 lines
28 KiB
Swift
433 lines
28 KiB
Swift
//
|
|
// AccountAPI.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
open class AccountAPI {
|
|
|
|
/**
|
|
Revokes the caller's own API key of the requested class.
|
|
|
|
- parameter type: (query) Type is the key class to act on: \"secret\" (sk-, session-equivalent, belongs on a server) or \"publishable\" (pk-, org-identifying, safe in a browser bundle). Omitted means secret, which is what every existing caller means. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RevokedKey
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func deleteAccountKeys(type: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> RevokedKey {
|
|
return try await deleteAccountKeysWithRequestBuilder(type: type, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Revokes the caller's own API key of the requested class.
|
|
- DELETE /v1/account/keys
|
|
- Revokes the caller's own API key of the requested class. The class is the same field mint takes — `?type=publishable`, defaulting to secret — so revoking the key that ships in a browser bundle does not sign its holder out of their own API: the other key keeps working. Revoking is how a key is replaced when it does not need replacing; minting the same class again rotates it in one step. IAM drops the credential immediately, but the gateway caches keys for a few minutes, so a request that beat the cache expiry may still be served. For callers written against the older shape, the class is also accepted in a JSON request body, read only when `?type=` is absent.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter type: (query) Type is the key class to act on: \"secret\" (sk-, session-equivalent, belongs on a server) or \"publishable\" (pk-, org-identifying, safe in a browser bundle). Omitted means secret, which is what every existing caller means. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<RevokedKey>
|
|
*/
|
|
open class func deleteAccountKeysWithRequestBuilder(type: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<RevokedKey> {
|
|
let localVariablePath = "/v1/account/keys"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"type": (wrappedValue: type?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
|
|
])
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<RevokedKey>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Returns the signed-in caller's own appearance preference — text size, density and accent — read from their IAM account so it is the same on every device and every Hanzo surface.
|
|
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: Appearance
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getAccountAppearance(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Appearance {
|
|
return try await getAccountAppearanceWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Returns the signed-in caller's own appearance preference — text size, density and accent — read from their IAM account so it is the same on every device and every Hanzo surface.
|
|
- GET /v1/account/appearance
|
|
- Returns the signed-in caller's own appearance preference — text size, density and accent — read from their IAM account so it is the same on every device and every Hanzo surface. An unset preference is an empty object. A transient IAM read failure reports the empty preference rather than a 5xx, so a surface applies its published default and never error-toasts on load — the same fail-soft the key read uses.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<Appearance>
|
|
*/
|
|
open class func getAccountAppearanceWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Appearance> {
|
|
let localVariablePath = "/v1/account/appearance"
|
|
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<Appearance>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Fetch a profile photo
|
|
|
|
- parameter org: (path)
|
|
- parameter user: (path)
|
|
- parameter digest: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: Void
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getAccountAvatarByOrgByUserByDigest(org: String, user: String, digest: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
|
|
return try await getAccountAvatarByOrgByUserByDigestWithRequestBuilder(org: org, user: user, digest: digest, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Fetch a profile photo
|
|
- GET /v1/account/avatar/{org}/{user}/{digest}
|
|
- Streams a profile photo's raw BYTES. This is the address stored on the user's IAM record and rendered directly by an `<img>`, so it takes no credentials — the 64-hex content digest in the path is the capability, and it can only be produced by someone who already has the image. The Content-Type is derived from the stored bytes and the response carries nosniff, so only a real raster image is ever served and only under its true type. Anything else — a miss, a malformed path, an object that is not an image — is one 404, and a hit caches for a year because the address is the content.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter org: (path)
|
|
- parameter user: (path)
|
|
- parameter digest: (path)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func getAccountAvatarByOrgByUserByDigestWithRequestBuilder(org: String, user: String, digest: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
|
|
var localVariablePath = "/v1/account/avatar/{org}/{user}/{digest}"
|
|
let orgPreEscape = "\(APIHelper.mapValueToPathItem(org))"
|
|
let orgPostEscape = orgPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{org}", with: orgPostEscape, options: .literal, range: nil)
|
|
let userPreEscape = "\(APIHelper.mapValueToPathItem(user))"
|
|
let userPostEscape = userPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{user}", with: userPostEscape, options: .literal, range: nil)
|
|
let digestPreEscape = "\(APIHelper.mapValueToPathItem(digest))"
|
|
let digestPostEscape = digestPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{digest}", with: digestPostEscape, 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<Void>.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
IssueCSRFToken mints the anti-forgery token a browser echoes as X-CSRF-Token on every change it asks for.
|
|
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: CsrfResp
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getAccountCsrf(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CsrfResp {
|
|
return try await getAccountCsrfWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
IssueCSRFToken mints the anti-forgery token a browser echoes as X-CSRF-Token on every change it asks for.
|
|
- GET /v1/account/csrf
|
|
- IssueCSRFToken mints the anti-forgery token a browser echoes as X-CSRF-Token on every change it asks for. The token is bound to the caller's validated identity and expires, so one minted for one identity cannot authorize a change as another. It is answered no-store, so it is never cached by a shared proxy. This is the same-origin endpoint the embedded console reads — the Same-Origin Policy is what stops a cross-site page from reading the response and forging a change.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<CsrfResp>
|
|
*/
|
|
open class func getAccountCsrfWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CsrfResp> {
|
|
let localVariablePath = "/v1/account/csrf"
|
|
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<CsrfResp>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Reports whether one of this brand's shared embedded apps (cms, erp, help) may be framed by the caller and is actually running, so a console module can choose between the embed and the provision panel.
|
|
|
|
- parameter app: (query) App is the embedded app to report on: cms (Content Studio), erp or help. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: EmbedStatusResp
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getAccountEmbed(app: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> EmbedStatusResp {
|
|
return try await getAccountEmbedWithRequestBuilder(app: app, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Reports whether one of this brand's shared embedded apps (cms, erp, help) may be framed by the caller and is actually running, so a console module can choose between the embed and the provision panel.
|
|
- GET /v1/account/embed
|
|
- Reports whether one of this brand's shared embedded apps (cms, erp, help) may be framed by the caller and is actually running, so a console module can choose between the embed and the provision panel. It answers two questions the browser cannot answer for itself. ENTITLEMENT is server-authoritative: each app is a single shared per-BRAND instance, so only a member of the owning brand org — or a SuperAdmin — is given the embed URL; every other caller gets phase \"not-entitled\" and no URL. REACHABILITY is a probe of that origin, which a cross-origin page cannot read for itself. The probed host is always <app>.<this deployment's own brand domain>: no part of it comes from the request, so this can never be steered into probing an arbitrary origin.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter app: (query) App is the embedded app to report on: cms (Content Studio), erp or help. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<EmbedStatusResp>
|
|
*/
|
|
open class func getAccountEmbedWithRequestBuilder(app: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<EmbedStatusResp> {
|
|
let localVariablePath = "/v1/account/embed"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"app": (wrappedValue: app?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
|
|
])
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<EmbedStatusResp>.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 API keys — every type they hold, read AUTHORITATIVELY from IAM rather than from the session claim, which lags a key minted moments ago.
|
|
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: ApiKeyList
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getAccountKeys(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> ApiKeyList {
|
|
return try await getAccountKeysWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Returns the caller's own API keys — every type they hold, read AUTHORITATIVELY from IAM rather than from the session claim, which lags a key minted moments ago.
|
|
- GET /v1/account/keys
|
|
- Returns the caller's own API keys — every type they hold, read AUTHORITATIVELY from IAM rather than from the session claim, which lags a key minted moments ago. No secret material comes back: a secret key is represented by its prefix, and only a publishable key (public by construction) carries its full value. A transient IAM read failure reports an empty set rather than a 5xx, so the page shows the honest empty state and never a fabricated key.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<ApiKeyList>
|
|
*/
|
|
open class func getAccountKeysWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<ApiKeyList> {
|
|
let localVariablePath = "/v1/account/keys"
|
|
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<ApiKeyList>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Stores the caller's appearance preference on their IAM account, preserving every other field of the row.
|
|
|
|
- parameter appearance: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: Appearance
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postAccountAppearance(appearance: Appearance, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Appearance {
|
|
return try await postAccountAppearanceWithRequestBuilder(appearance: appearance, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Stores the caller's appearance preference on their IAM account, preserving every other field of the row.
|
|
- POST /v1/account/appearance
|
|
- Stores the caller's appearance preference on their IAM account, preserving every other field of the row. The accent is validated as a real colour token before it is stored; an unset or invalid axis is dropped rather than stored.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter appearance: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<Appearance>
|
|
*/
|
|
open class func postAccountAppearanceWithRequestBuilder(appearance: Appearance, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Appearance> {
|
|
let localVariablePath = "/v1/account/appearance"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: appearance, 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<Appearance>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Set your profile photo
|
|
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: Void
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postAccountAvatar(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
|
|
return try await postAccountAvatarWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Set your profile photo
|
|
- POST /v1/account/avatar
|
|
- Stores one image as the signed-in user's profile photo and answers the URL it is served from, which is also written to the user's IAM record — so every surface that already renders `avatar` picks it up with no further call. The body is a multipart form with a `file` part. The format is decided by the BYTES, never the filename or the part's Content-Type: png, jpeg, gif and webp are accepted and everything else is refused with 415, so an SVG cannot be stored as a picture and later served as a program. Over 8 MiB is 413; empty is 400. The photo is addressed by the sha256 of its bytes, so setting a new one yields a new URL rather than a stale cache of the old face. The caller is taken from the validated identity ONLY — there is no way to name a different subject — so this always sets your own photo, and a caller with no organization yet is refused.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func postAccountAvatarWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
|
|
let localVariablePath = "/v1/account/avatar"
|
|
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<Void>.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Creates — or rotates — the caller's API key of the requested type and returns it ONCE.
|
|
|
|
- parameter keyTypeIn: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: MintedKey
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postAccountKeys(keyTypeIn: KeyTypeIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> MintedKey {
|
|
return try await postAccountKeysWithRequestBuilder(keyTypeIn: keyTypeIn, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Creates — or rotates — the caller's API key of the requested type and returns it ONCE.
|
|
- POST /v1/account/keys
|
|
- Creates — or rotates — the caller's API key of the requested type and returns it ONCE. A real IAM failure surfaces as 502, never a fabricated key. Rotating is what creating means here: a user holds one key per type, so the endpoint is idempotent by (caller, type) and the superseded credential stops working. Two live secrets for one user would make \"revoke my key\" a lie.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter keyTypeIn: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<MintedKey>
|
|
*/
|
|
open class func postAccountKeysWithRequestBuilder(keyTypeIn: KeyTypeIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<MintedKey> {
|
|
let localVariablePath = "/v1/account/keys"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: keyTypeIn, 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<MintedKey>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Onboard creates the caller's organization.
|
|
|
|
- parameter onboardReq: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: OnboardResp
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func postAccountOrgs(onboardReq: OnboardReq, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> OnboardResp {
|
|
return try await postAccountOrgsWithRequestBuilder(onboardReq: onboardReq, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Onboard creates the caller's organization.
|
|
- POST /v1/account/orgs
|
|
- Onboard creates the caller's organization. Two flows, keyed on whether the caller already has a home org (mirrors app/onboard/route.ts): - FIRST-RUN (no home org): create + MOVE the user in as admin, so their next JWT carries the new owner and the cloud scopes everything to it. This is the path a fresh OAuth sign-up takes, from the sign-up application's org. - ADDITIONAL (owner set): create the org but do NOT move the user — a move changes their IAM owner (stripping a SuperAdmin's status + orphaning their current org). They reach the new org via the OrgSwitcher, which re-scopes X-Org-Id without touching IAM membership. A personal-org request from someone who already has an org is meaningless → 409.
|
|
- Bearer Token:
|
|
- type: http
|
|
- name: bearer
|
|
- parameter onboardReq: (body)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<OnboardResp>
|
|
*/
|
|
open class func postAccountOrgsWithRequestBuilder(onboardReq: OnboardReq, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<OnboardResp> {
|
|
let localVariablePath = "/v1/account/orgs"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: onboardReq, 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<OnboardResp>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
|
|
}
|
|
}
|