Files
zeekay 0c2f028a8c Generate the Swift client, which this copy did not carry
The forge tree held the package scaffolding and none of the generated sources —
2,435 files of APIs, Models and Infrastructure, including BaseAPI, were simply
absent, so anything depending on this copy had a package that compiled to
nothing usable.

Generated from the current API document rather than reconciled with the other
copy: a client is a function of the spec, so regenerating answers "which history
wins" without anyone having to choose. .spec-lock records which document, so the
next reader can tell.
2026-08-23 10:04:41 -07:00

92 lines
5.6 KiB
Swift

//
// ReferralAPI.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
open class ReferralAPI {
/**
Returns the caller's referral code, share link and the referrals they have made.
- parameter apiConfiguration: The configuration for the http request.
- returns: MyReferrals
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getReferral(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> MyReferrals {
return try await getReferralWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the caller's referral code, share link and the referrals they have made.
- GET /v1/referral
- Returns the caller's referral code, share link and the referrals they have made. The code is a stable, deterministic function of the org, so the link in this response is the same one every time. Each row carries the referee and the status of that attribution. IT IS A PURE READ. It advances no referral, grants nothing and deposits nothing — a GET reports state, it never changes it. Qualification is the admin sweep's job (POST /v1/admin/referral/sweep). The one row this handler can write is the caller's OWN code-directory entry (EnsureCode), which materialises a value deriveCode already computes deterministically from the org id so the code has an O(1) reverse lookup; it carries no money, no referral state and no other tenant.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<MyReferrals>
*/
open class func getReferralWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<MyReferrals> {
let localVariablePath = "/v1/referral"
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<MyReferrals>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Records that the caller's org signed up through a referral code.
- parameter claimRequest: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: ClaimView
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postReferralClaim(claimRequest: ClaimRequest, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> ClaimView {
return try await postReferralClaimWithRequestBuilder(claimRequest: claimRequest, apiConfiguration: apiConfiguration).execute().body
}
/**
Records that the caller's org signed up through a referral code.
- POST /v1/referral/claim
- Records that the caller's org signed up through a referral code. The REFEREE is the validated caller, never a client field, and the referrer is resolved from the code — so a caller can only ever attach THEMSELVES to someone else's code. Referring yourself is 400 and an unknown code is 404. It is idempotent and first-touch: an org can be referred once, ever. A repeat call returns the referral already on file with created=false and 200, where the first call answers 201. Recording a referral grants nothing, and neither does anything downstream of it: the edge later advances to qualified when the referee makes metered spend (POST /v1/admin/referral/sweep), and that is the end of it. No credit is ever issued from this package.
- Bearer Token:
- type: http
- name: bearer
- parameter claimRequest: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<ClaimView>
*/
open class func postReferralClaimWithRequestBuilder(claimRequest: ClaimRequest, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<ClaimView> {
let localVariablePath = "/v1/referral/claim"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: claimRequest, 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<ClaimView>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
}