Files
zeekay 87d088ed73 Regenerate against the current cloud document
The lock sat at 574d1f1d while the product moved on. The team surface
stopped at rooms — no messages path, no way to open one — so anything
built on this client had to reach past it with its own HTTP calls, which
is the duplication a generated client exists to prevent.
2026-09-01 02:21:56 -07:00

2012 lines
132 KiB
Swift

//
// BillingAPI.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
open class BillingAPI {
/**
End a subscription
- parameter id: (path)
- parameter subscriptionRef: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: Subscription
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func cancelSubscription(id: String, subscriptionRef: SubscriptionRef, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Subscription {
return try await cancelSubscriptionWithRequestBuilder(id: id, subscriptionRef: subscriptionRef, apiConfiguration: apiConfiguration).execute().body
}
/**
End a subscription
- POST /v1/billing/subscriptions/{id}/cancel
- Ends a subscription. It cancels at the END OF THE PAID PERIOD by default, because a customer who cancels has already paid for the period they are in and taking it away is taking money for nothing. `atPeriodEnd: false` ends it at once, which is the caller asking for that. A subscription from another org is not found rather than refused, so an id cannot be probed for existence. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path)
- parameter subscriptionRef: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Subscription>
*/
open class func cancelSubscriptionWithRequestBuilder(id: String, subscriptionRef: SubscriptionRef, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Subscription> {
var localVariablePath = "/v1/billing/subscriptions/{id}/cancel"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil)
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: subscriptionRef, 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<Subscription>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Collect an issued invoice from credits, balance, then card
- parameter id: (path) ID is the invoice id.
- parameter apiConfiguration: The configuration for the http request.
- returns: Collected
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func collectInvoice(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Collected {
return try await collectInvoiceWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Collect an issued invoice from credits, balance, then card
- POST /v1/billing/invoices/{id}/collect
- Collects an issued invoice: credit grants first, then prepaid balance, then the card on file — the same waterfall the dunning workflow runs. A DECLINE IS NOT AN ERROR. It answers with paid=false, a reason, and the invoice still open, because a declined collection is a normal business outcome that must remain retryable — and because sealing it as a failure would wedge dunning behind a replayed decline. Only a successful collection is sealed, so a retry of a paid invoice replays the receipt instead of charging again. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the invoice id.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Collected>
*/
open class func collectInvoiceWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Collected> {
var localVariablePath = "/v1/billing/invoices/{id}/collect"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, 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<Collected>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Removes one of the caller's spend caps and answers 204.
- parameter id: (path) ID is the cap to remove, from the 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 deleteBillingAlertsById(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await deleteBillingAlertsByIdWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Removes one of the caller's spend caps and answers 204.
- DELETE /v1/billing/alerts/{id}
- Removes one of the caller's spend caps and answers 204. Removing a cap RAISES what the org may spend, so it takes the same authority setting one does. The caps that remain still bind: this drops one, never the whole policy.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the cap to remove, from the path.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func deleteBillingAlertsByIdWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
var localVariablePath = "/v1/billing/alerts/{id}"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, 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: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Removes one card or account the caller has saved.
- parameter id: (path) ID is the saved method to detach, from the path.
- parameter apiConfiguration: The configuration for the http request.
- returns: Detachment
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func deleteBillingMethodsById(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Detachment {
return try await deleteBillingMethodsByIdWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Removes one card or account the caller has saved.
- DELETE /v1/billing/methods/{id}
- Removes one card or account the caller has saved. It detaches only the CALLER'S own — the wallet this request bills from, resolved server-side — so an id belonging to another customer of the same org is not something this operation can reach. A platform or service caller detaches on the subject's behalf, and that authority is decided HERE, where the credential is, and travels as a value: authority decided twice is authority that eventually disagrees with itself. The card is vaulted at the processor, so what goes is our token for it.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the saved method to detach, from the path.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Detachment>
*/
open class func deleteBillingMethodsByIdWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Detachment> {
var localVariablePath = "/v1/billing/methods/{id}"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, 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<Detachment>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
DetachPortalMethod is DetachMethod at the address a hosted checkout addresses it by.
- parameter id: (path) ID is the saved method to detach, from the path.
- parameter apiConfiguration: The configuration for the http request.
- returns: Detachment
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func deleteBillingPortalMethodsById(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Detachment {
return try await deleteBillingPortalMethodsByIdWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
DetachPortalMethod is DetachMethod at the address a hosted checkout addresses it by.
- DELETE /v1/billing/portal/methods/{id}
- DetachPortalMethod is DetachMethod at the address a hosted checkout addresses it by. One set of rows, two spellings: a card detached at either is gone from both, because there is one store behind them.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the saved method to detach, from the path.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Detachment>
*/
open class func deleteBillingPortalMethodsByIdWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Detachment> {
var localVariablePath = "/v1/billing/portal/methods/{id}"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, 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<Detachment>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Answers the caller's billing accounts: the org itself, its currency, when it was opened, and the caller's own standing in it.
- parameter apiConfiguration: The configuration for the http request.
- returns: [BillingAccount]
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingAccounts(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> [BillingAccount] {
return try await getBillingAccountsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Answers the caller's billing accounts: the org itself, its currency, when it was opened, and the caller's own standing in it.
- GET /v1/billing/accounts
- Answers the caller's billing accounts: the org itself, its currency, when it was opened, and the caller's own standing in it. The standing is the caller's, resolved from the validated principal here and sent to the store rather than looked up there — the membership roster is IAM's and commerce keeps none, so a callee that answered \"what role is this\" would be inventing it. An anonymous read gets the account with no role rather than an implied membership. Scoped to the caller's own org, which is the whole tenancy story: there is no org field on the wire and none on the input. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<[BillingAccount]>
*/
open class func getBillingAccountsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<[BillingAccount]> {
let localVariablePath = "/v1/billing/accounts"
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<[BillingAccount]>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Answers one billing account's roster.
- parameter id: (path) ID is the billing account id, which for this store is the org&#39;s own id.
- parameter apiConfiguration: The configuration for the http request.
- returns: [Holder]
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingAccountsByIdMembers(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> [Holder] {
return try await getBillingAccountsByIdMembersWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Answers one billing account's roster.
- GET /v1/billing/accounts/{id}/members
- Answers one billing account's roster. commerce stores no roster — that is IAM's — so the only member it can name is the caller, and that is what comes back. What it does enforce is that the account named in the path is the caller's own: a foreign id is 403, not an empty list, because \"no members\" and \"not your account\" are different answers. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the billing account id, which for this store is the org&#39;s own id.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<[Holder]>
*/
open class func getBillingAccountsByIdMembersWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<[Holder]> {
var localVariablePath = "/v1/billing/accounts/{id}/members"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, 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<[Holder]>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Lists this org's spend caps: the ceiling, its scope, whether it enforces, and how much of it has been spent this period.
- parameter apiConfiguration: The configuration for the http request.
- returns: [Alert]
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingAlerts(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> [Alert] {
return try await getBillingAlertsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Lists this org's spend caps: the ceiling, its scope, whether it enforces, and how much of it has been spent this period.
- GET /v1/billing/alerts
- Lists this org's spend caps: the ceiling, its scope, whether it enforces, and how much of it has been spent this period. `periodSpentCents`, `over` and `warn` are ABSENT rather than zero when the spend could not be read, because \"nothing spent\" and \"spend unknown\" are different answers and a customer acting on the first when the second is true would be reading a ceiling that is not there. The policy row is reported either way. The period is the UTC calendar month and `resetsAt` is when the count starts again, so a surface can say \"resets on\" without a second call. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<[Alert]>
*/
open class func getBillingAlertsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<[Alert]> {
let localVariablePath = "/v1/billing/alerts"
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<[Alert]>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Answers whether one proposed spend fits inside this org's caps.
- parameter project: (query) Project narrows the verdict to one project&#39;s caps. Empty is the org-wide row. (optional)
- parameter service: (query) Service narrows it to one service&#39;s caps. Empty is every service. (optional)
- parameter amount: (query) Amount is the proposed spend in cents. (optional)
- parameter pv: (query) PV is \&quot;1\&quot; when the caller ESTABLISHED the project rather than merely carrying a claim of one. An unproven project may not deny traffic. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: CapVerdict
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingAlertsAuthorize(project: String? = nil, service: String? = nil, amount: String? = nil, pv: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CapVerdict {
return try await getBillingAlertsAuthorizeWithRequestBuilder(project: project, service: service, amount: amount, pv: pv, apiConfiguration: apiConfiguration).execute().body
}
/**
Answers whether one proposed spend fits inside this org's caps.
- GET /v1/billing/alerts/authorize
- Answers whether one proposed spend fits inside this org's caps. It is the per-request verdict the metering edge consumes before every priced call, and its caller is a SERVICE rather than a person: a service token plus the gateway-pinned org, with no user behind it. So this admits that principal where the CRUD beside it does not. Every covering row is evaluated, most-restrictive-wins, and the tightest one is what `capCents`, `spentCents` and `reason` describe. Soft rows never deny; nor does a project-scoped enforcing row whose project axis the caller could not establish — `pv=1` is how a caller states that it did, and an unproven claim must not be able to refuse traffic. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter project: (query) Project narrows the verdict to one project&#39;s caps. Empty is the org-wide row. (optional)
- parameter service: (query) Service narrows it to one service&#39;s caps. Empty is every service. (optional)
- parameter amount: (query) Amount is the proposed spend in cents. (optional)
- parameter pv: (query) PV is \&quot;1\&quot; when the caller ESTABLISHED the project rather than merely carrying a claim of one. An unproven project may not deny traffic. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CapVerdict>
*/
open class func getBillingAlertsAuthorizeWithRequestBuilder(project: String? = nil, service: String? = nil, amount: String? = nil, pv: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CapVerdict> {
let localVariablePath = "/v1/billing/alerts/authorize"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"project": (wrappedValue: project?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"service": (wrappedValue: service?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"amount": (wrappedValue: amount?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pv": (wrappedValue: pv?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<CapVerdict>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Prepaid credit the caller's org can still spend
- 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 getBillingBalance(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await getBillingBalanceWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Prepaid credit the caller's org can still spend
- GET /v1/billing/balance
- Answers the spendable prepaid balance of the wallet this caller bills from — the same wallet the AI prepaid gate reads before admitting a paid request, the edge meter debits, and a top-up credits. The wallet is an ADDRESS, not an org: `account` echoes the key resolved within the ledger — the org's shared pool for a tenant org, a personal account for a member of the shared signup org. The echo is the point. A browser could only GUESS its own payer by decoding its own token, and a guess that disagrees with the server is how money lands in an account the gate never reads. `balance`, `holds` and `available` are whole USD cents, ROUNDED from the ledger's exact 18-decimal value. On the co-resident ledger `holds` is 0 and `available` equals `balance`: the gate's reservations live in its own pod and are never posted, so the settled balance IS the spendable one. The ledger is the caller's own org, taken from the VALIDATED IAM owner claim and never from a client header. No validated principal is 401 — with one exception, the trusted in-process service token the AI gate itself presents, which reads the gateway-pinned org and nothing it could name. A balance that cannot be READ is 502, never 0: unknown is not broke.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func getBillingBalanceWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
let localVariablePath = "/v1/billing/balance"
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)
}
/**
Answers what the caller can spend right now, one entry per currency.
- parameter apiConfiguration: The configuration for the http request.
- returns: CreditBalance
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingCreditBalance(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CreditBalance {
return try await getBillingCreditBalanceWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Answers what the caller can spend right now, one entry per currency.
- GET /v1/billing/credit-balance
- Answers what the caller can spend right now, one entry per currency. Only ACTIVE grants count: a voided, exhausted or lapsed grant contributes nothing, which is why this number can be smaller than the grant list suggests and why the two reads exist separately. It is credit, not prepaid balance — /v1/billing/balance is the wallet, and the two are added by the gate, never by a reader. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CreditBalance>
*/
open class func getBillingCreditBalanceWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CreditBalance> {
let localVariablePath = "/v1/billing/credit-balance"
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<CreditBalance>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Answers that same spendable credit split by grant tag, with the earliest expiry under each and the total across all of them.
- 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 getBillingCreditBalanceBreakdown(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> JSONValue {
return try await getBillingCreditBalanceBreakdownWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Answers that same spendable credit split by grant tag, with the earliest expiry under each and the total across all of them.
- GET /v1/billing/credit-balance/breakdown
- Answers that same spendable credit split by grant tag, with the earliest expiry under each and the total across all of them. The split is the point: it is how trial credit is told apart from bought credit, which is what a surface asks before it decides whether to spend any. An unregistered address answers 404 and a caller reads that as \"no credit\", so this being served is the difference between a customer with a trial grant being offered their trial and being told they have none. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<JSONValue>
*/
open class func getBillingCreditBalanceBreakdownWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<JSONValue> {
let localVariablePath = "/v1/billing/credit-balance/breakdown"
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<JSONValue>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Lists the caller's credit grants — every one of them, spent and lapsed and voided included.
- parameter apiConfiguration: The configuration for the http request.
- returns: CreditGrants
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingCredits(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CreditGrants {
return try await getBillingCreditsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Lists the caller's credit grants — every one of them, spent and lapsed and voided included.
- GET /v1/billing/credits
- Lists the caller's credit grants — every one of them, spent and lapsed and voided included. That is deliberate and it is what makes the list useful: a grant list is a LEDGER, and one that hid its spent rows could not be reconciled against a burn-down. What is spendable right now is the sibling read, /v1/billing/ credit-balance, and the two are different questions. Scoped to the caller's own wallet, resolved server-side. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CreditGrants>
*/
open class func getBillingCreditsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CreditGrants> {
let localVariablePath = "/v1/billing/credits"
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<CreditGrants>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Reads one of the caller's own deposit intents back — pending, confirming, or succeeded.
- parameter id: (path) ID is the deposit intent id.
- parameter apiConfiguration: The configuration for the http request.
- returns: CryptoDeposit
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingCryptoDepositById(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CryptoDeposit {
return try await getBillingCryptoDepositByIdWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Reads one of the caller's own deposit intents back — pending, confirming, or succeeded.
- GET /v1/billing/crypto/deposit/{id}
- Reads one of the caller's own deposit intents back — pending, confirming, or succeeded. An intent belonging to another payer answers 404, exactly as an id that names nothing, so a guessed id cannot confirm that somebody else's deposit exists. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the deposit intent id.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CryptoDeposit>
*/
open class func getBillingCryptoDepositByIdWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CryptoDeposit> {
var localVariablePath = "/v1/billing/crypto/deposit/{id}"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, 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<CryptoDeposit>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Answers which chains and tokens the crypto rail accepts — what an asset picker renders.
- parameter apiConfiguration: The configuration for the http request.
- returns: CryptoOptions
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingCryptoOptions(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CryptoOptions {
return try await getBillingCryptoOptionsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Answers which chains and tokens the crypto rail accepts — what an asset picker renders.
- GET /v1/billing/crypto/options
- Answers which chains and tokens the crypto rail accepts — what an asset picker renders. It is the intersection of two live facts rather than a configured list: an asset appears only if something is WATCHING it and the custody processor supports it. An address nobody watches credits nobody, so offering one would take a customer's money and lose it. A rail with nothing armed answers 503, not an empty menu — \"no rail\" and \"no assets\" are different, and only one of them means try again later. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CryptoOptions>
*/
open class func getBillingCryptoOptionsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CryptoOptions> {
let localVariablePath = "/v1/billing/crypto/options"
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<CryptoOptions>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Lists the caller's invoices, newest first, with the count beside them.
- parameter apiConfiguration: The configuration for the http request.
- returns: Invoices
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingInvoices(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Invoices {
return try await getBillingInvoicesWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Lists the caller's invoices, newest first, with the count beside them.
- GET /v1/billing/invoices
- Lists the caller's invoices, newest first, with the count beside them. It is scoped to the caller's own billing subject — the wallet this request bills from, resolved server-side — so a query cannot widen it to another customer of the same org. An org with no invoices is an empty list, not a refusal. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Invoices>
*/
open class func getBillingInvoicesWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Invoices> {
let localVariablePath = "/v1/billing/invoices"
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<Invoices>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Download one invoice as a PDF
- parameter id: (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 getBillingInvoicesByIdPdf(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await getBillingInvoicesByIdPdfWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Download one invoice as a PDF
- GET /v1/billing/invoices/{id}/pdf
- Answers the invoice as an attachment — `application/pdf` under a Content-Disposition naming the invoice number — rather than as a JSON value, which is why this one route is untyped where its five siblings are typed: a PDF is bytes with a filename, and the two headers are the whole contract. The render is a PURE function of the invoice: one page, no timestamps and no random ids, so the same invoice renders the same bytes however often it is asked for and a retry after a dropped connection costs a re-render and nothing else. The invoice is read from the caller's own org, taken from the VALIDATED IAM owner claim and never from a client header, and the lookup is scoped at the storage layer — so an id belonging to another customer resolves to nothing and answers 404 rather than being found and then refused.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func getBillingInvoicesByIdPdfWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
var localVariablePath = "/v1/billing/invoices/{id}/pdf"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, 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)
}
/**
Answers the org's own postings inside `range=`, each as a signed entry: a DEPOSIT CREDITS the wallet (positive, account `credits:<org>`) and every other posting DEBITS it (negative, account `usage:<org>`), described by its notes or its tags.
- parameter range: (query) Range is the window: 24h, 7d, 30d or 90d. Anything else — including absent — is 30d, so a typo silently widens the window to a month rather than failing. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: [FinanceLedgerEntry]
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingLedger(range: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> [FinanceLedgerEntry] {
return try await getBillingLedgerWithRequestBuilder(range: range, apiConfiguration: apiConfiguration).execute().body
}
/**
Answers the org's own postings inside `range=`, each as a signed entry: a DEPOSIT CREDITS the wallet (positive, account `credits:<org>`) and every other posting DEBITS it (negative, account `usage:<org>`), described by its notes or its tags.
- GET /v1/billing/ledger
- Answers the org's own postings inside `range=`, each as a signed entry: a DEPOSIT CREDITS the wallet (positive, account `credits:<org>`) and every other posting DEBITS it (negative, account `usage:<org>`), described by its notes or its tags. The sign is the posting's own meaning, read through ONE vocabulary shared with the ledger that wrote it — a reader with its own spelling for `deposit` rendered a customer's grant as a charge. This is the closest projection of the truth. The org's double-entry postings are the source of record — balanced, only ever appended, one file per org — and this lane is that list, wider than either half of it: the deposits are the grants /v1/billing/credits lists and the debits are the spend /v1/billing/usage rolls up. It answers 503 where this deployment runs no ledger, rather than reporting an empty wallet. A row whose timestamp will not parse is KEPT rather than dropped — a malformed date must show up in a money list, not vanish from it. `balanceCents` is omitted: these are MOVEMENTS, and the standing balance is /v1/billing/balance. Cents are ROUNDED from the ledger's exact 18-decimal USD. Scoped to the caller's own org, where the org's ledger file is the tenant boundary; 401 without a validated principal.
- Bearer Token:
- type: http
- name: bearer
- responseHeaders: [Cache-Control(String)]
- parameter range: (query) Range is the window: 24h, 7d, 30d or 90d. Anything else — including absent — is 30d, so a typo silently widens the window to a month rather than failing. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<[FinanceLedgerEntry]>
*/
open class func getBillingLedgerWithRequestBuilder(range: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<[FinanceLedgerEntry]> {
let localVariablePath = "/v1/billing/ledger"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"range": (wrappedValue: range?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<[FinanceLedgerEntry]>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Cards and accounts on file for the caller
- 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 getBillingMethods(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await getBillingMethodsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Cards and accounts on file for the caller
- GET /v1/billing/methods
- Answers every payment method the caller has saved, newest first. A saved method is a card or account VAULTED at the processor: what is stored here is the processor's token for it plus the last four digits and the expiry a customer recognises it by, never a card number. The list is the caller's OWN — the wallet this request bills from, resolved server-side — so a query cannot widen it to another customer of the same org. `/v1/billing/portal/methods` answers the same list under the name a hosted checkout addresses it by. One set of rows, two spellings; a card added at either is present at both. A store that cannot be read answers an EMPTY LIST rather than a failure: the saved-cards panel renders empty instead of breaking the page around it.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func getBillingMethodsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
let localVariablePath = "/v1/billing/methods"
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)
}
/**
Answers the org's outbound payouts, newest first — amount, destination, status, and the failure reason where one applies.
- parameter apiConfiguration: The configuration for the http request.
- returns: [Payout]
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingPayouts(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> [Payout] {
return try await getBillingPayoutsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Answers the org's outbound payouts, newest first — amount, destination, status, and the failure reason where one applies.
- GET /v1/billing/payouts
- Answers the org's outbound payouts, newest first — amount, destination, status, and the failure reason where one applies. A payout is ORG-scoped rather than subject-scoped, so there is nothing to pin beyond the tenant the caller already is, and no query can widen it. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<[Payout]>
*/
open class func getBillingPayoutsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<[Payout]> {
let localVariablePath = "/v1/billing/payouts"
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<[Payout]>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
The plan catalog, priced with whatever offer is in force
- 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 getBillingPlans(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await getBillingPlansWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
The plan catalog, priced with whatever offer is in force
- GET /v1/billing/plans
- Answers every plan on sale — its price, what it includes, and the limits it carries — optionally narrowed to one `?category=`. The prices are what the CHECKOUT will charge: any active promotion is applied before they leave the store, so a reader never applies a discount a second time and a quote can never disagree with the sale. It is the public catalog and needs no tenant: this is what anyone may buy.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func getBillingPlansWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
let localVariablePath = "/v1/billing/plans"
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)
}
/**
Cards and accounts on file for the caller
- 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 getBillingPortalMethods(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await getBillingPortalMethodsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Cards and accounts on file for the caller
- GET /v1/billing/portal/methods
- Answers every payment method the caller has saved, newest first. A saved method is a card or account VAULTED at the processor: what is stored here is the processor's token for it plus the last four digits and the expiry a customer recognises it by, never a card number. The list is the caller's OWN — the wallet this request bills from, resolved server-side — so a query cannot widen it to another customer of the same org. `/v1/billing/portal/methods` answers the same list under the name a hosted checkout addresses it by. One set of rows, two spellings; a card added at either is present at both. A store that cannot be read answers an EMPTY LIST rather than a failure: the saved-cards panel renders empty instead of breaking the page around it.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func getBillingPortalMethodsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
let localVariablePath = "/v1/billing/portal/methods"
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)
}
/**
Reads the caller's auto-reload rule: top the balance up by `amountCents` whenever it falls below `thresholdCents`, charging the card on file off-session.
- parameter apiConfiguration: The configuration for the http request.
- returns: AutoRecharge
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingRecharge(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> AutoRecharge {
return try await getBillingRechargeWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Reads the caller's auto-reload rule: top the balance up by `amountCents` whenever it falls below `thresholdCents`, charging the card on file off-session.
- GET /v1/billing/recharge
- Reads the caller's auto-reload rule: top the balance up by `amountCents` whenever it falls below `thresholdCents`, charging the card on file off-session. It is the same setting every prepaid AI account calls auto-reload. An org that has never set one reads as disabled with zeroes rather than as an error — \"no rule\" answers the question — and `stored` is how a caller tells never-configured from deliberately-off. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<AutoRecharge>
*/
open class func getBillingRechargeWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<AutoRecharge> {
let localVariablePath = "/v1/billing/recharge"
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<AutoRecharge>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Answers the PUBLIC half of this org's processor configuration — the ids a browser needs to tokenize a card, and the environment it must tokenize against.
- parameter apiConfiguration: The configuration for the http request.
- returns: PaymentConfig
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingSettings(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> PaymentConfig {
return try await getBillingSettingsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Answers the PUBLIC half of this org's processor configuration — the ids a browser needs to tokenize a card, and the environment it must tokenize against.
- GET /v1/billing/settings
- Answers the PUBLIC half of this org's processor configuration — the ids a browser needs to tokenize a card, and the environment it must tokenize against. It carries no secret: an application id is published to every checkout page by design. What matters is that it names the SAME processor account the charge will be made on, because a card vaulted against one account and charged against another is a card that saves and then cannot be used. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<PaymentConfig>
*/
open class func getBillingSettingsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<PaymentConfig> {
let localVariablePath = "/v1/billing/settings"
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<PaymentConfig>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Lists the plans the caller holds, with the count beside them.
- parameter apiConfiguration: The configuration for the http request.
- returns: Subscriptions
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingSubscriptions(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Subscriptions {
return try await getBillingSubscriptionsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Lists the plans the caller holds, with the count beside them.
- GET /v1/billing/subscriptions
- Lists the plans the caller holds, with the count beside them. It is scoped to the caller's own org, so a query cannot widen it to another customer's. An org on nothing is an empty list, not a refusal — being on no plan is an answer. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Subscriptions>
*/
open class func getBillingSubscriptionsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Subscriptions> {
let localVariablePath = "/v1/billing/subscriptions"
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<Subscriptions>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Answers which tier the caller is on, what it allows, and what is left to spend.
- parameter apiConfiguration: The configuration for the http request.
- returns: Tier
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingTier(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Tier {
return try await getBillingTierWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Answers which tier the caller is on, what it allows, and what is left to spend.
- GET /v1/billing/tier
- Answers which tier the caller is on, what it allows, and what is left to spend. `effectiveAvailable` is the ONLY figure to compare against zero. The others are its parts — prepaid money, granted credits and the daily term are three sources of one spend, not three balances to add up a second time. A tier that cannot be READ is an error, never Free. The router in front of the models maps any non-2xx to Free, so answering Free from a question nobody could answer would pin every paying customer to the most restrictive row with nothing anywhere to find. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Tier>
*/
open class func getBillingTierWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Tier> {
let localVariablePath = "/v1/billing/tier"
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<Tier>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Answers one page of the caller's own ledger, newest first: what moved, how much, when, and what it was tagged with.
- parameter currency: (query) Currency filters to one currency. Empty reads every currency. (optional)
- parameter limit: (query) Limit is the page size; absent or non-positive takes the default 100. (optional)
- parameter offset: (query) Offset is how far into the history the page starts. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: Transactions
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingTransactions(currency: String? = nil, limit: String? = nil, offset: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Transactions {
return try await getBillingTransactionsWithRequestBuilder(currency: currency, limit: limit, offset: offset, apiConfiguration: apiConfiguration).execute().body
}
/**
Answers one page of the caller's own ledger, newest first: what moved, how much, when, and what it was tagged with.
- GET /v1/billing/transactions
- Answers one page of the caller's own ledger, newest first: what moved, how much, when, and what it was tagged with. `count` is the size of the WHOLE history rather than of the page, which is how a reader knows there is more to ask for, and `user` echoes the wallet the page was read for — the same subject the spend gate debits, so a customer can see which account answered rather than guessing from their own token. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter currency: (query) Currency filters to one currency. Empty reads every currency. (optional)
- parameter limit: (query) Limit is the page size; absent or non-positive takes the default 100. (optional)
- parameter offset: (query) Offset is how far into the history the page starts. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Transactions>
*/
open class func getBillingTransactionsWithRequestBuilder(currency: String? = nil, limit: String? = nil, offset: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Transactions> {
let localVariablePath = "/v1/billing/transactions"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"currency": (wrappedValue: currency?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"limit": (wrappedValue: limit?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"offset": (wrappedValue: offset?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<Transactions>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Reads one ledger entry by its id.
- parameter id: (path)
- parameter apiConfiguration: The configuration for the http request.
- returns: Transaction
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingTransactionsById(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Transaction {
return try await getBillingTransactionsByIdWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Reads one ledger entry by its id.
- GET /v1/billing/transactions/{id}
- Reads one ledger entry by its id. It is the MEMBER of the collection beside it rather than a second way to ask — the same rows GET /v1/billing/transactions lists, addressed one at a time. A top-up receipt is read here, because a receipt IS a ledger entry: the id this takes is the `transactionId` a top-up hands back. The read is narrower than the list: commerce's core loads the row and refuses anything that is not a deposit, so a row that exists but is not a top-up answers 404. That asymmetry is stated rather than closed, because widening a money read to make two shapes match is not a change worth making for symmetry. The books are the caller's own and cannot be named, so a guessed id misses rather than reaching another tenant's ledger. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Transaction>
*/
open class func getBillingTransactionsByIdWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Transaction> {
var localVariablePath = "/v1/billing/transactions/{id}"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, 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<Transaction>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Every billed call the caller's org made, attributed to a product
- 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 getBillingUsage(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await getBillingUsageWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Every billed call the caller's org made, attributed to a product
- GET /v1/billing/usage
- Answers one row per BILLED call against the caller's org — transaction id, amount, timestamp and the metered unit. This is the raw charged ledger, not a rollup. Each row is stamped with a canonical `metadata.product` derived from what the meter persisted: `agent` becomes agents, `provisioning` becomes the provisioned kind, a token-metered row becomes inference, anything else keeps its metering surface. The ledger has no product field of its own, so this read is where that dimension is made real — from the SAME charged rows, never a second meter. A row that already carries its own product WINS, so the derivation stops the day the meter records one. `product=<id>` filters to one product server-side. `groupBy=product` reduces to `{product,requests,amountCents}` rollups instead of rows. `amount` is whole USD cents, ROUNDED; `decimal` beside it is the SAME debit exact, as an 18-decimal USD string. Sum `decimal`. A page of sub-cent token calls totals correctly there and totals ZERO in `amount` — that difference is real money. Scoped to the caller's own org's books, where the org's ledger file IS the tenant boundary; no client-supplied subject is ever forwarded. 401 without a validated principal. The co-resident read returns the 2000 most recent debits, newest first; `start` and `end` narrow the window only on the split-deploy upstream.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func getBillingUsageWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
let localVariablePath = "/v1/billing/usage"
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)
}
/**
Answers per-account totals for the linked provider accounts the gateway ROUTED this caller's traffic through — requests, prompt and completion tokens, recorded cost — plus their honest sum.
- parameter apiConfiguration: The configuration for the http request.
- returns: Accounts
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingUsageAccounts(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Accounts {
return try await getBillingUsageAccountsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Answers per-account totals for the linked provider accounts the gateway ROUTED this caller's traffic through — requests, prompt and completion tokens, recorded cost — plus their honest sum.
- GET /v1/billing/usage/accounts
- Answers per-account totals for the linked provider accounts the gateway ROUTED this caller's traffic through — requests, prompt and completion tokens, recorded cost — plus their honest sum. This is the one read in the billing namespace scoped to the PERSON, not the org. Rows are keyed on (validated org, validated user), so a caller sees the accounts THEY linked and never a colleague's, even inside one org — everything else under /v1/billing is org-wide. Neither key is ever read from the request body or the query. It is a ROUTING counter, not the money ledger. `costCents` is 0 for an account billed by its own subscription, where the plan pays the provider directly, so these totals do not reconcile against what the org was charged. /v1/billing/usage is the charged ledger. 401 without a validated principal. Where the linked-account plane is not resident the answer is an honest 501 — never an empty breakdown, which would read as no usage.
- Bearer Token:
- type: http
- name: bearer
- responseHeaders: [Cache-Control(String)]
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Accounts>
*/
open class func getBillingUsageAccountsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Accounts> {
let localVariablePath = "/v1/billing/usage/accounts"
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<Accounts>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Answers the caller's month: what their plan includes, what has been consumed against it, and the wallet beside it.
- parameter apiConfiguration: The configuration for the http request.
- returns: Rollup
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingUsageRollup(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Rollup {
return try await getBillingUsageRollupWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Answers the caller's month: what their plan includes, what has been consumed against it, and the wallet beside it.
- GET /v1/billing/usage/rollup
- Answers the caller's month: what their plan includes, what has been consumed against it, and the wallet beside it. The two blocks are SEPARATE monies and are never added. One is usage a plan granted; the other is prepaid credit bought with a card. Their sum is not a number anyone holds, and a reader that formed it would be inventing a balance. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Rollup>
*/
open class func getBillingUsageRollupWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Rollup> {
let localVariablePath = "/v1/billing/usage/rollup"
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<Rollup>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Answers where to send a wire top-up: the receiving bank details, with the caller's own payment reference.
- parameter apiConfiguration: The configuration for the http request.
- returns: WireInstructions
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBillingWire(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> WireInstructions {
return try await getBillingWireWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Answers where to send a wire top-up: the receiving bank details, with the caller's own payment reference.
- GET /v1/billing/wire
- Answers where to send a wire top-up: the receiving bank details, with the caller's own payment reference. The account is the SERVING BRAND'S — resolved from the host the customer is paying on, so paying on one brand never shows another's bank — and the reference carries the caller's billing key, which is how an arriving wire names who it credits. Nothing mints here; a receipt is settled by an operator once the bank confirms it. It is all-or-nothing: no configured account is 503 rather than a partial form, because nobody can wire to three fields out of five. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<WireInstructions>
*/
open class func getBillingWireWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<WireInstructions> {
let localVariablePath = "/v1/billing/wire"
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<WireInstructions>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Read one invoice
- parameter id: (path) ID is the invoice id.
- parameter apiConfiguration: The configuration for the http request.
- returns: Invoice
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getInvoice(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Invoice {
return try await getInvoiceWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Read one invoice
- GET /v1/billing/invoices/{id}
- Reads one invoice out of the caller's org. The org scopes the read by construction — the store is namespaced to it — so an id belonging to another tenant is not found rather than found and then filtered. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the invoice id.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Invoice>
*/
open class func getInvoiceWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Invoice> {
var localVariablePath = "/v1/billing/invoices/{id}"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, 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<Invoice>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Issue a draft invoice, making it collectible
- parameter id: (path) ID is the invoice id.
- parameter apiConfiguration: The configuration for the http request.
- returns: Invoice
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func issueInvoice(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Invoice {
return try await issueInvoiceWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Issue a draft invoice, making it collectible
- POST /v1/billing/invoices/{id}/issue
- Issues a draft invoice: moves it to OPEN, assigns its number, and makes it collectible. Only a draft can be issued. An invoice already open, paid or void is refused with the state machine's own reason rather than being silently re-issued, which would mint a second number for one debt. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the invoice id.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Invoice>
*/
open class func issueInvoiceWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Invoice> {
var localVariablePath = "/v1/billing/invoices/{id}/issue"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, 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<Invoice>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Changes one spend cap: raise or lower the ceiling, flip enforcement, retune the rate limit.
- parameter id: (path)
- parameter alertPatch: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: Alert
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func patchBillingAlertsById(id: String, alertPatch: AlertPatch, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Alert {
return try await patchBillingAlertsByIdWithRequestBuilder(id: id, alertPatch: alertPatch, apiConfiguration: apiConfiguration).execute().body
}
/**
Changes one spend cap: raise or lower the ceiling, flip enforcement, retune the rate limit.
- PATCH /v1/billing/alerts/{id}
- Changes one spend cap: raise or lower the ceiling, flip enforcement, retune the rate limit. Only the fields the body carries move. Every mutable field is optional, and an absent one is PRESERVED rather than reset — so a change that flips enforcement cannot silently wipe the threshold it enforces. A cap belonging to another org is a 404, not a 403: a guessed id must not become an oracle for what anyone else holds. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path)
- parameter alertPatch: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Alert>
*/
open class func patchBillingAlertsByIdWithRequestBuilder(id: String, alertPatch: AlertPatch, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Alert> {
var localVariablePath = "/v1/billing/alerts/{id}"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil)
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: alertPatch, 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<Alert>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Opens a spend cap on the caller's own org.
- parameter alertSpec: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: Alert
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBillingAlerts(alertSpec: AlertSpec, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Alert {
return try await postBillingAlertsWithRequestBuilder(alertSpec: alertSpec, apiConfiguration: apiConfiguration).execute().body
}
/**
Opens a spend cap on the caller's own org.
- POST /v1/billing/alerts
- Opens a spend cap on the caller's own org. At least one limit must mean something: a threshold above zero (a spend cap) or a requests-per-minute above zero (a rate limit). A row that bounds neither is refused rather than stored, because a ceiling nothing measures against is a ceiling a customer believes in and does not have. The cap is keyed on the caller's own billing subject, resolved server-side — the SAME key the verdict looks it up under, which is what makes enforcement bind rather than merely record. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter alertSpec: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Alert>
*/
open class func postBillingAlertsWithRequestBuilder(alertSpec: AlertSpec, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Alert> {
let localVariablePath = "/v1/billing/alerts"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: alertSpec, 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<Alert>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Issues a deposit address the caller can send crypto to, on the asset they ask for.
- parameter cryptoAsset: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: CryptoDeposit
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBillingCryptoDeposit(cryptoAsset: CryptoAsset, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> CryptoDeposit {
return try await postBillingCryptoDepositWithRequestBuilder(cryptoAsset: cryptoAsset, apiConfiguration: apiConfiguration).execute().body
}
/**
Issues a deposit address the caller can send crypto to, on the asset they ask for.
- POST /v1/billing/crypto/deposit
- Issues a deposit address the caller can send crypto to, on the asset they ask for. The address credits the CALLER'S own wallet and nobody else's: the payer is the validated principal, never a body value. Asking again reuses the caller's open intent rather than minting a second address, so a refresh cannot spray key generations — and a payer who sent to the address they saw earlier is still credited. No balance moves here. The chain watcher credits on real confirmations, so what comes back is an address and a status, not a receipt. An asset this rail cannot mint on is 400 — ask for another. A rail that is shut for that asset is 503 — nothing sent now can be credited. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter cryptoAsset: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<CryptoDeposit>
*/
open class func postBillingCryptoDepositWithRequestBuilder(cryptoAsset: CryptoAsset, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<CryptoDeposit> {
let localVariablePath = "/v1/billing/crypto/deposit"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: cryptoAsset, 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<CryptoDeposit>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Save a card or account for the caller
- 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 postBillingMethods(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await postBillingMethodsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Save a card or account for the caller
- POST /v1/billing/methods
- Vaults the instrument at the processor and stores the row. A saved method is a card or account VAULTED at the processor: what is stored here is the processor's token for it plus the last four digits and the expiry a customer recognises it by, never a card number. The list is the caller's OWN — the wallet this request bills from, resolved server-side — so a query cannot widen it to another customer of the same org. `/v1/billing/portal/methods` answers the same list under the name a hosted checkout addresses it by. One set of rows, two spellings; a card added at either is present at both. Saving a card ALREADY on file answers with the row that already holds it rather than stacking a duplicate — 200 for that, 201 for a genuinely new row, so a client can tell which happened. A card the processor declines is 402 and nothing is stored.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func postBillingMethodsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
let localVariablePath = "/v1/billing/methods"
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)
}
/**
Moves this org between sandbox money and real money.
- parameter modeIn: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: Mode
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBillingMode(modeIn: ModeIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Mode {
return try await postBillingModeWithRequestBuilder(modeIn: modeIn, apiConfiguration: apiConfiguration).execute().body
}
/**
Moves this org between sandbox money and real money.
- POST /v1/billing/mode
- Moves this org between sandbox money and real money. It decides whether a charge hits a real card, so it is the one posture change that is not self-service: the platform bar, never an org owner, because an org that could put itself in test mode could take priced work for free. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter modeIn: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Mode>
*/
open class func postBillingModeWithRequestBuilder(modeIn: ModeIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Mode> {
let localVariablePath = "/v1/billing/mode"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: modeIn, 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<Mode>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Save a card or account for the caller
- 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 postBillingPortalMethods(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await postBillingPortalMethodsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Save a card or account for the caller
- POST /v1/billing/portal/methods
- Vaults the instrument at the processor and stores the row. A saved method is a card or account VAULTED at the processor: what is stored here is the processor's token for it plus the last four digits and the expiry a customer recognises it by, never a card number. The list is the caller's OWN — the wallet this request bills from, resolved server-side — so a query cannot widen it to another customer of the same org. `/v1/billing/portal/methods` answers the same list under the name a hosted checkout addresses it by. One set of rows, two spellings; a card added at either is present at both. Saving a card ALREADY on file answers with the row that already holds it rather than stacking a duplicate — 200 for that, 201 for a genuinely new row, so a client can tell which happened. A card the processor declines is 402 and nothing is stored.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func postBillingPortalMethodsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
let localVariablePath = "/v1/billing/portal/methods"
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)
}
/**
Sweeps every org's auto-recharge and answers what it did.
- parameter apiConfiguration: The configuration for the http request.
- returns: Recharge
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBillingRechargeRunAll(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Recharge {
return try await postBillingRechargeRunAllWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Sweeps every org's auto-recharge and answers what it did.
- POST /v1/billing/recharge/run-all
- Sweeps every org's auto-recharge and answers what it did. PLATFORM AUTHORITY ONLY. It charges saved cards across every tenant, so an org owner reaching it could sweep-charge the estate; a caller without it is refused before anything is charged. The answer explains a sweep that charged nobody as readily as one that charged: it names how many orgs were considered and how many needed charging, with a row each.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Recharge>
*/
open class func postBillingRechargeRunAllWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Recharge> {
let localVariablePath = "/v1/billing/recharge/run-all"
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<Recharge>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Buy a plan with a card
- 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 postBillingSubscribeCard(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await postBillingSubscribeCardWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Buy a plan with a card
- POST /v1/billing/subscribe/card
- Vaults the card (or reuses one already on file), charges the plan's FIRST period at the catalog price, and opens the subscription — one act, all of it server-side. There is NO AMOUNT in the request. `level` picks which of the plan's published prices to buy at — an index, never a number — so what the card is charged is decided by the catalog and underpaying cannot be expressed. A fresh sale answers 201 with the receipt. An identical retry answers 200 with the FIRST sale's body, byte for byte, so a client cannot read a replay as a second subscription having been opened. A caller already on a paid plan is 409 rather than charged again.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func postBillingSubscribeCardWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
let localVariablePath = "/v1/billing/subscribe/card"
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)
}
/**
Charges a card the caller already saved and credits the balance.
- parameter topupIn: (body)
- parameter xIdempotencyKey: (header) (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: Charged
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBillingTopup(topupIn: TopupIn, xIdempotencyKey: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Charged {
return try await postBillingTopupWithRequestBuilder(topupIn: topupIn, xIdempotencyKey: xIdempotencyKey, apiConfiguration: apiConfiguration).execute().body
}
/**
Charges a card the caller already saved and credits the balance.
- POST /v1/billing/topup
- Charges a card the caller already saved and credits the balance. Same receipt and the same retry safety as the token endpoint; the only difference is which card, so a caller topping up from a saved method never re-enters one.
- Bearer Token:
- type: http
- name: bearer
- parameter topupIn: (body)
- parameter xIdempotencyKey: (header) (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Charged>
*/
open class func postBillingTopupWithRequestBuilder(topupIn: TopupIn, xIdempotencyKey: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Charged> {
let localVariablePath = "/v1/billing/topup"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: topupIn, codableHelper: apiConfiguration.codableHelper)
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
let localVariableNillableHeaders: [String: (any Sendable)?] = [
"Content-Type": "application/json",
"X-Idempotency-Key": xIdempotencyKey?.asParameter(codableHelper: apiConfiguration.codableHelper),
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<Charged>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Charges a single-use card token and credits the caller's balance.
- parameter topupIn: (body)
- parameter xIdempotencyKey: (header) (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: Charged
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBillingTopupToken(topupIn: TopupIn, xIdempotencyKey: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Charged {
return try await postBillingTopupTokenWithRequestBuilder(topupIn: topupIn, xIdempotencyKey: xIdempotencyKey, apiConfiguration: apiConfiguration).execute().body
}
/**
Charges a single-use card token and credits the caller's balance.
- POST /v1/billing/topup/token
- Charges a single-use card token and credits the caller's balance. The token comes from the payment form and is vaulted as part of the charge, so no card number reaches this service and none is stored here. The receipt names the ledger entry, the new balance, and the PROCESSOR's own reference — which is the only field that proves money moved at the gateway rather than only in our ledger. Retry-safe on X-Idempotency-Key: the same key settles one charge and returns the first receipt.
- Bearer Token:
- type: http
- name: bearer
- parameter topupIn: (body)
- parameter xIdempotencyKey: (header) (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Charged>
*/
open class func postBillingTopupTokenWithRequestBuilder(topupIn: TopupIn, xIdempotencyKey: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Charged> {
let localVariablePath = "/v1/billing/topup/token"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: topupIn, codableHelper: apiConfiguration.codableHelper)
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
let localVariableNillableHeaders: [String: (any Sendable)?] = [
"Content-Type": "application/json",
"X-Idempotency-Key": xIdempotencyKey?.asParameter(codableHelper: apiConfiguration.codableHelper),
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<Charged>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Sets the caller's auto-reload rule, and answers with the rule as stored.
- parameter autoRechargeEdit: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: AutoRecharge
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func putBillingRecharge(autoRechargeEdit: AutoRechargeEdit, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> AutoRecharge {
return try await putBillingRechargeWithRequestBuilder(autoRechargeEdit: autoRechargeEdit, apiConfiguration: apiConfiguration).execute().body
}
/**
Sets the caller's auto-reload rule, and answers with the rule as stored.
- PUT /v1/billing/recharge
- Sets the caller's auto-reload rule, and answers with the rule as stored. ENABLING REQUIRES A CARD ON FILE (400), because the sweep charges off-session: a rule naming no chargeable method is a promise the schedule cannot keep. A non-positive amount and a negative threshold are refused the same way, each naming the field that was wrong. The rule is the caller's OWN. The org comes from the validated principal and the body names none, so there is no field a write could be steered through onto another tenant's schedule. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter autoRechargeEdit: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<AutoRecharge>
*/
open class func putBillingRechargeWithRequestBuilder(autoRechargeEdit: AutoRechargeEdit, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<AutoRecharge> {
let localVariablePath = "/v1/billing/recharge"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: autoRechargeEdit, 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<AutoRecharge>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Raise a draft invoice against a customer
- parameter raiseIn: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: Invoice
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func raiseInvoice(raiseIn: RaiseIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Invoice {
return try await raiseInvoiceWithRequestBuilder(raiseIn: raiseIn, apiConfiguration: apiConfiguration).execute().body
}
/**
Raise a draft invoice against a customer
- POST /v1/billing/invoices
- Raises a DRAFT invoice against a customer in the caller's own org. The invoice is not collectible yet: a draft exists so it can be read and corrected, and issueInvoice is the separate act that turns it into a demand for payment. The subtotal and amount due are computed from the lines, so there is no total to send and none to get wrong. The billing org is the caller's, taken from the validated principal, so an invoice can only ever be raised on the caller's own books. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter raiseIn: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Invoice>
*/
open class func raiseInvoiceWithRequestBuilder(raiseIn: RaiseIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Invoice> {
let localVariablePath = "/v1/billing/invoices"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: raiseIn, 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<Invoice>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Put a canceled subscription back on its plan
- parameter id: (path)
- parameter subscriptionRef: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: Subscription
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func reactivateSubscription(id: String, subscriptionRef: SubscriptionRef, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Subscription {
return try await reactivateSubscriptionWithRequestBuilder(id: id, subscriptionRef: subscriptionRef, apiConfiguration: apiConfiguration).execute().body
}
/**
Put a canceled subscription back on its plan
- POST /v1/billing/subscriptions/{id}/reactivate
- Puts a canceled subscription back on its plan. What asks for this is usually a recovered payment method or a support tool rather than a browser, which is most of the argument for it having an address at all. The engine decides whether the move is legal; a row it will not reactivate comes back with its own reason. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path)
- parameter subscriptionRef: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Subscription>
*/
open class func reactivateSubscriptionWithRequestBuilder(id: String, subscriptionRef: SubscriptionRef, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Subscription> {
var localVariablePath = "/v1/billing/subscriptions/{id}/reactivate"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil)
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: subscriptionRef, 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<Subscription>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Void a draft or issued invoice
- parameter id: (path) ID is the invoice id.
- parameter apiConfiguration: The configuration for the http request.
- returns: Invoice
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func voidInvoice(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Invoice {
return try await voidInvoiceWithRequestBuilder(id: id, apiConfiguration: apiConfiguration).execute().body
}
/**
Void a draft or issued invoice
- POST /v1/billing/invoices/{id}/void
- Voids a draft or issued invoice — the cancel. A paid invoice cannot be voided: money has moved, and the correction for that is a refund, not an erasure. The state machine refuses it and that refusal is the answer. A named handler, not a closure, so zipdoc can lift this prose into the registry.
- Bearer Token:
- type: http
- name: bearer
- parameter id: (path) ID is the invoice id.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Invoice>
*/
open class func voidInvoiceWithRequestBuilder(id: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Invoice> {
var localVariablePath = "/v1/billing/invoices/{id}/void"
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, 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<Invoice>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
}