Files
zeekay 1df3ddf6bd Regenerate against the document the deployment answers for
The projection these were generated from predated the compute migration, so
they described /v1/visor — which the API serves at zero paths now.

No /v1/visor path survives here.
2026-09-05 18:55:38 -07:00

1125 lines
78 KiB
Swift

//
// BooksAPI.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
open class BooksAPI {
/**
Returns the org's chart of accounts — the seeded fixed chart every posting key in the ledger refers to.
- parameter sandbox: (query) Sandbox reads the org's SANDBOX ledger when it is exactly \"true\"; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: [Account]
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksAccounts(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> [Account] {
return try await getBooksAccountsWithRequestBuilder(sandbox: sandbox, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's chart of accounts — the seeded fixed chart every posting key in the ledger refers to.
- GET /v1/books/accounts
- Returns the org's chart of accounts — the seeded fixed chart every posting key in the ledger refers to.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org's SANDBOX ledger when it is exactly \"true\"; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<[Account]>
*/
open class func getBooksAccountsWithRequestBuilder(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<[Account]> {
let localVariablePath = "/v1/books/accounts"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<[Account]>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the org's normalized bank transactions, newest first — every row the import and connector paths have ingested, with its amount in exact cents, its direction, and whether it has been matched to a voucher yet.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter limit: (query) Limit caps how many rows come back; 500 when absent or not positive. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: [BankTxnRow]
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksBankTransactions(sandbox: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> [BankTxnRow] {
return try await getBooksBankTransactionsWithRequestBuilder(sandbox: sandbox, limit: limit, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's normalized bank transactions, newest first — every row the import and connector paths have ingested, with its amount in exact cents, its direction, and whether it has been matched to a voucher yet.
- GET /v1/books/bank/transactions
- Returns the org's normalized bank transactions, newest first — every row the import and connector paths have ingested, with its amount in exact cents, its direction, and whether it has been matched to a voucher yet.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter limit: (query) Limit caps how many rows come back; 500 when absent or not positive. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<[BankTxnRow]>
*/
open class func getBooksBankTransactionsWithRequestBuilder(sandbox: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<[BankTxnRow]> {
let localVariablePath = "/v1/books/bank/transactions"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"limit": (wrappedValue: limit?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<[BankTxnRow]>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the org's unmatched bank inflows and their open clarifying questions — the queue a human answers so an unexplained deposit is never guessed into revenue.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: UnreconciledOut
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksBankUnreconciled(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> UnreconciledOut {
return try await getBooksBankUnreconciledWithRequestBuilder(sandbox: sandbox, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's unmatched bank inflows and their open clarifying questions — the queue a human answers so an unexplained deposit is never guessed into revenue.
- GET /v1/books/bank/unreconciled
- Returns the org's unmatched bank inflows and their open clarifying questions — the queue a human answers so an unexplained deposit is never guessed into revenue.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<UnreconciledOut>
*/
open class func getBooksBankUnreconciledWithRequestBuilder(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<UnreconciledOut> {
let localVariablePath = "/v1/books/bank/unreconciled"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<UnreconciledOut>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the complete financial package for the caller's org over (from, to]: the trial balance, the P&L, the balance sheet, and the GL detail behind them — the four statements a tax preparer or an investor asks for, assembled from the one ledger in a single read so they cannot disagree with each other.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter from: (query) From is the RFC3339 start of the window, exclusive. Empty means all time. (optional)
- parameter to: (query) To is the RFC3339 end of the window, inclusive. Empty means up to now. (optional)
- parameter format: (query) Format is the export encoding. Only \&quot;json\&quot; is supported; empty means json. (optional)
- parameter limit: (query) Limit caps the GL detail rows included as the audit trail; 5000 when absent or not positive. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: FinancialPackage
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksExport(sandbox: String? = nil, from: String? = nil, to: String? = nil, format: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> FinancialPackage {
return try await getBooksExportWithRequestBuilder(sandbox: sandbox, from: from, to: to, format: format, limit: limit, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the complete financial package for the caller's org over (from, to]: the trial balance, the P&L, the balance sheet, and the GL detail behind them — the four statements a tax preparer or an investor asks for, assembled from the one ledger in a single read so they cannot disagree with each other.
- GET /v1/books/export
- Returns the complete financial package for the caller's org over (from, to]: the trial balance, the P&L, the balance sheet, and the GL detail behind them — the four statements a tax preparer or an investor asks for, assembled from the one ledger in a single read so they cannot disagree with each other.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter from: (query) From is the RFC3339 start of the window, exclusive. Empty means all time. (optional)
- parameter to: (query) To is the RFC3339 end of the window, inclusive. Empty means up to now. (optional)
- parameter format: (query) Format is the export encoding. Only \&quot;json\&quot; is supported; empty means json. (optional)
- parameter limit: (query) Limit caps the GL detail rows included as the audit trail; 5000 when absent or not positive. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<FinancialPackage>
*/
open class func getBooksExportWithRequestBuilder(sandbox: String? = nil, from: String? = nil, to: String? = nil, format: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<FinancialPackage> {
let localVariablePath = "/v1/books/export"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"from": (wrappedValue: from?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"to": (wrappedValue: to?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"format": (wrappedValue: format?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"limit": (wrappedValue: limit?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<FinancialPackage>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
ListGL returns the org's most recent GL Entry rows, newest first.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter limit: (query) Limit caps how many rows come back; 500 when absent or not positive. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: [GLRow]
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksGl(sandbox: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> [GLRow] {
return try await getBooksGlWithRequestBuilder(sandbox: sandbox, limit: limit, apiConfiguration: apiConfiguration).execute().body
}
/**
ListGL returns the org's most recent GL Entry rows, newest first.
- GET /v1/books/gl
- ListGL returns the org's most recent GL Entry rows, newest first. This is the raw double-entry detail behind every statement: one row per leg, with its debit, credit, posting time and the source that booked it.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter limit: (query) Limit caps how many rows come back; 500 when absent or not positive. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<[GLRow]>
*/
open class func getBooksGlWithRequestBuilder(sandbox: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<[GLRow]> {
let localVariablePath = "/v1/books/gl"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"limit": (wrappedValue: limit?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<[GLRow]>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the org's open document queue — everything uploaded but not yet booked, newest first, each with its extracted summary and the confidence the scanner resolved its category at.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: InboxOut
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksInbox(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> InboxOut {
return try await getBooksInboxWithRequestBuilder(sandbox: sandbox, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's open document queue — everything uploaded but not yet booked, newest first, each with its extracted summary and the confidence the scanner resolved its category at.
- GET /v1/books/inbox
- Returns the org's open document queue — everything uploaded but not yet booked, newest first, each with its extracted summary and the confidence the scanner resolved its category at. A booked document drops out of the queue.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<InboxOut>
*/
open class func getBooksInboxWithRequestBuilder(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<InboxOut> {
let localVariablePath = "/v1/books/inbox"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<InboxOut>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Metrics returns the org's deterministic SaaS-metrics snapshot over an optional (from, to] window — MRR, ARR, revenue, COGS, burn, gross margin, net income, cash, deferred revenue, monthly burn and runway — as raw int64-cent figures AND the same figures already formatted.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter from: (query) From is the RFC3339 start of the window, exclusive. Empty means all time. (optional)
- parameter to: (query) To is the RFC3339 end of the window, inclusive. Empty means up to now. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: MetricsResponse
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksMetrics(sandbox: String? = nil, from: String? = nil, to: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> MetricsResponse {
return try await getBooksMetricsWithRequestBuilder(sandbox: sandbox, from: from, to: to, apiConfiguration: apiConfiguration).execute().body
}
/**
Metrics returns the org's deterministic SaaS-metrics snapshot over an optional (from, to] window — MRR, ARR, revenue, COGS, burn, gross margin, net income, cash, deferred revenue, monthly burn and runway — as raw int64-cent figures AND the same figures already formatted.
- GET /v1/books/metrics
- Metrics returns the org's deterministic SaaS-metrics snapshot over an optional (from, to] window — MRR, ARR, revenue, COGS, burn, gross margin, net income, cash, deferred revenue, monthly burn and runway — as raw int64-cent figures AND the same figures already formatted. Every number is the ledger, aggregated the one way the books define it, never a guess; it is the grounded read the unified /v1/ask advisor replays.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter from: (query) From is the RFC3339 start of the window, exclusive. Empty means all time. (optional)
- parameter to: (query) To is the RFC3339 end of the window, inclusive. Empty means up to now. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<MetricsResponse>
*/
open class func getBooksMetricsWithRequestBuilder(sandbox: String? = nil, from: String? = nil, to: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<MetricsResponse> {
let localVariablePath = "/v1/books/metrics"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"from": (wrappedValue: from?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"to": (wrappedValue: to?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<MetricsResponse>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the org's accrual-basis Profit & Loss over an optional (from, to] window of RFC3339 posting times: recognized revenue, matched cost, and the net.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter from: (query) From is the RFC3339 start of the window, exclusive. Empty means all time. (optional)
- parameter to: (query) To is the RFC3339 end of the window, inclusive. Empty means up to now. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: PnL
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksPnl(sandbox: String? = nil, from: String? = nil, to: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> PnL {
return try await getBooksPnlWithRequestBuilder(sandbox: sandbox, from: from, to: to, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's accrual-basis Profit & Loss over an optional (from, to] window of RFC3339 posting times: recognized revenue, matched cost, and the net.
- GET /v1/books/pnl
- Returns the org's accrual-basis Profit & Loss over an optional (from, to] window of RFC3339 posting times: recognized revenue, matched cost, and the net.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter from: (query) From is the RFC3339 start of the window, exclusive. Empty means all time. (optional)
- parameter to: (query) To is the RFC3339 end of the window, inclusive. Empty means up to now. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<PnL>
*/
open class func getBooksPnlWithRequestBuilder(sandbox: String? = nil, from: String? = nil, to: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<PnL> {
let localVariablePath = "/v1/books/pnl"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"from": (wrappedValue: from?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"to": (wrappedValue: to?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<PnL>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the org's Balance Sheet as of `to` (empty = all time), with the Assets == Liabilities + Equity equation proof.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter to: (query) To is the RFC3339 instant the statement is struck as of. Empty means all time. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: BalanceSheet
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksPosition(sandbox: String? = nil, to: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> BalanceSheet {
return try await getBooksPositionWithRequestBuilder(sandbox: sandbox, to: to, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's Balance Sheet as of `to` (empty = all time), with the Assets == Liabilities + Equity equation proof.
- GET /v1/books/position
- Returns the org's Balance Sheet as of `to` (empty = all time), with the Assets == Liabilities + Equity equation proof.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter to: (query) To is the RFC3339 instant the statement is struck as of. Empty means all time. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<BalanceSheet>
*/
open class func getBooksPositionWithRequestBuilder(sandbox: String? = nil, to: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<BalanceSheet> {
let localVariablePath = "/v1/books/position"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"to": (wrappedValue: to?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<BalanceSheet>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the clarifying questions the caller's own recent GL raises — the unusual postings a founder should look at (outliers, reversals, round-offs, uncosted revenue, an overdrawn wallet), sharpest first.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: QuestionsResponse
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksQuestions(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> QuestionsResponse {
return try await getBooksQuestionsWithRequestBuilder(sandbox: sandbox, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the clarifying questions the caller's own recent GL raises — the unusual postings a founder should look at (outliers, reversals, round-offs, uncosted revenue, an overdrawn wallet), sharpest first.
- GET /v1/books/questions
- Returns the clarifying questions the caller's own recent GL raises — the unusual postings a founder should look at (outliers, reversals, round-offs, uncosted revenue, an overdrawn wallet), sharpest first. An empty list means the books look clean; the detector is deterministic over the ledger and invents nothing.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<QuestionsResponse>
*/
open class func getBooksQuestionsWithRequestBuilder(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<QuestionsResponse> {
let localVariablePath = "/v1/books/questions"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<QuestionsResponse>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the org's auto-categorization rules, highest priority first.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RulesOut
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksRules(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> RulesOut {
return try await getBooksRulesWithRequestBuilder(sandbox: sandbox, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's auto-categorization rules, highest priority first.
- GET /v1/books/rules
- Returns the org's auto-categorization rules, highest priority first. A rule is a standing instruction — \"anything whose merchant contains X books to category Y\" — and it overrides a vendor's default category, so this is the list that decides how a future bill classifies itself.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<RulesOut>
*/
open class func getBooksRulesWithRequestBuilder(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<RulesOut> {
let localVariablePath = "/v1/books/rules"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<RulesOut>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the org's booked ledger as a single-line register, newest first: one row per voucher, with its date, description, vendor, category, source and amount in exact cents.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter from: (query) From is the RFC3339 start of the posting-time window, inclusive. (optional)
- parameter to: (query) To is the RFC3339 end of the posting-time window, inclusive. (optional)
- parameter category: (query) Category filters to one COA account, named by number (\&quot;5300\&quot;) or by category slug (\&quot;software\&quot;). (optional)
- parameter vendor: (query) Vendor filters to rows whose vendor or description contains this text, case-insensitively. (optional)
- parameter limit: (query) Limit caps how many rows come back; 200 when absent or not positive. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: TransactionsOut
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksTransactions(sandbox: String? = nil, from: String? = nil, to: String? = nil, category: String? = nil, vendor: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> TransactionsOut {
return try await getBooksTransactionsWithRequestBuilder(sandbox: sandbox, from: from, to: to, category: category, vendor: vendor, limit: limit, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's booked ledger as a single-line register, newest first: one row per voucher, with its date, description, vendor, category, source and amount in exact cents.
- GET /v1/books/transactions
- Returns the org's booked ledger as a single-line register, newest first: one row per voucher, with its date, description, vendor, category, source and amount in exact cents. It is the double-entry ledger projected to the register a human reads, filterable by posting-time window, category and vendor. Strictly read-only — it restates the books, it never moves them.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter from: (query) From is the RFC3339 start of the posting-time window, inclusive. (optional)
- parameter to: (query) To is the RFC3339 end of the posting-time window, inclusive. (optional)
- parameter category: (query) Category filters to one COA account, named by number (\&quot;5300\&quot;) or by category slug (\&quot;software\&quot;). (optional)
- parameter vendor: (query) Vendor filters to rows whose vendor or description contains this text, case-insensitively. (optional)
- parameter limit: (query) Limit caps how many rows come back; 200 when absent or not positive. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<TransactionsOut>
*/
open class func getBooksTransactionsWithRequestBuilder(sandbox: String? = nil, from: String? = nil, to: String? = nil, category: String? = nil, vendor: String? = nil, limit: Int64? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<TransactionsOut> {
let localVariablePath = "/v1/books/transactions"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"from": (wrappedValue: from?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"to": (wrappedValue: to?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"category": (wrappedValue: category?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"vendor": (wrappedValue: vendor?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"limit": (wrappedValue: limit?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<TransactionsOut>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the org's trial balance over an optional [from, to] window of RFC3339 posting times, including the opening/closing columns and the TotalDebit == TotalCredit proof that the books balance.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter from: (query) From is the RFC3339 start of the window, exclusive. Empty means all time. (optional)
- parameter to: (query) To is the RFC3339 end of the window, inclusive. Empty means up to now. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: TrialBalance
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksTrial(sandbox: String? = nil, from: String? = nil, to: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> TrialBalance {
return try await getBooksTrialWithRequestBuilder(sandbox: sandbox, from: from, to: to, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's trial balance over an optional [from, to] window of RFC3339 posting times, including the opening/closing columns and the TotalDebit == TotalCredit proof that the books balance.
- GET /v1/books/trial
- Returns the org's trial balance over an optional [from, to] window of RFC3339 posting times, including the opening/closing columns and the TotalDebit == TotalCredit proof that the books balance.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;. (optional)
- parameter from: (query) From is the RFC3339 start of the window, exclusive. Empty means all time. (optional)
- parameter to: (query) To is the RFC3339 end of the window, inclusive. Empty means up to now. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<TrialBalance>
*/
open class func getBooksTrialWithRequestBuilder(sandbox: String? = nil, from: String? = nil, to: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<TrialBalance> {
let localVariablePath = "/v1/books/trial"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"from": (wrappedValue: from?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"to": (wrappedValue: to?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<TrialBalance>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Returns the org's vendor book: each canonical vendor, the alias spellings a receipt may print it under, and the expense account new bills from it default to.
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: VendorsOut
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getBooksVendors(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> VendorsOut {
return try await getBooksVendorsWithRequestBuilder(sandbox: sandbox, apiConfiguration: apiConfiguration).execute().body
}
/**
Returns the org's vendor book: each canonical vendor, the alias spellings a receipt may print it under, and the expense account new bills from it default to.
- GET /v1/books/vendors
- Returns the org's vendor book: each canonical vendor, the alias spellings a receipt may print it under, and the expense account new bills from it default to. A vendor here is what makes a scanned bill self-classify instead of asking again.
- Bearer Token:
- type: http
- name: bearer
- parameter sandbox: (query) Sandbox reads the org&#39;s SANDBOX ledger when it is exactly \&quot;true\&quot;; anything else reads the live one. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<VendorsOut>
*/
open class func getBooksVendorsWithRequestBuilder(sandbox: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<VendorsOut> {
let localVariablePath = "/v1/books/vendors"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sandbox": (wrappedValue: sandbox?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [
:
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<VendorsOut>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Answers a plain-language question about the caller's own books — \"what is my MRR?\", \"how long is my runway?\" — with figures taken from their ledger, never a guessed number.
- parameter askRequest: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: AskResponse
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBooksAsk(askRequest: AskRequest, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> AskResponse {
return try await postBooksAskWithRequestBuilder(askRequest: askRequest, apiConfiguration: apiConfiguration).execute().body
}
/**
Answers a plain-language question about the caller's own books — \"what is my MRR?\", \"how long is my runway?\" — with figures taken from their ledger, never a guessed number.
- POST /v1/books/ask
- Answers a plain-language question about the caller's own books — \"what is my MRR?\", \"how long is my runway?\" — with figures taken from their ledger, never a guessed number. A deterministic keyword router picks the intent and reads the real metrics, and those figures, followups and report sources are computed BEFORE any model call and are never altered by one: the optional narration client only rephrases the sentence, and it degrades silently to the templated answer when no AI plane is wired. It is strictly read-only — it restates the books, it never posts to them.
- Bearer Token:
- type: http
- name: bearer
- parameter askRequest: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<AskResponse>
*/
open class func postBooksAskWithRequestBuilder(askRequest: AskRequest, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<AskResponse> {
let localVariablePath = "/v1/books/ask"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: askRequest, 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<AskResponse>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Finish connecting a bank account (not yet available)
- 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 postBooksBankExchange(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await postBooksBankExchangeWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Finish connecting a bank account (not yet available)
- POST /v1/books/bank/exchange
- ANSWERS 501 UNCONDITIONALLY. It is the intended second hop of the bank-linking handshake — trade the provider's short-lived public token for the durable access credential and seal that credential into KMS — and nothing on the HTTP path reaches an implementation today. The durable bank credential is the reason this hop exists: it is meant to be sealed server-side and never handed back to the caller. Since the route never succeeds, no credential is stored by it and no bank is connected through it. Documented as refusing rather than declared with a success body, for the same reason as the first hop: it has never sent one, and stating a shape it has never produced would put a return type in every SDK for a call that always fails. A caller with no principal gets 401 before the 501.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func postBooksBankExchangeWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
let localVariablePath = "/v1/books/bank/exchange"
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)
}
/**
Import a bank statement file into your books
- parameter body: (body) (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: BankTally
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBooksBankImport(body: URL? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> BankTally {
return try await postBooksBankImportWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body
}
/**
Import a bank statement file into your books
- POST /v1/books/bank/import
- Takes a bank statement as RAW BYTES — the file exactly as downloaded, OFX, QFX or CSV, not wrapped in JSON — parses every row, books it against the caller org's own ledger, and answers the tally: how many rows were seen, how many vouchers posted, how many inflows reconciled, how many raised a question, how many were own-account transfers, and how many were skipped. RE-IMPORTING THE SAME STATEMENT DOES NOT DOUBLE-BOOK. Every row goes through the same posting choke point every other source uses, keyed idempotently, so an overlapping statement — the usual case, since exports overlap at the month boundary — lands its new rows and counts the rest as skipped. Skipped is the number to read on a second import. It is READ-ONLY against the bank: this ingests, it never sends money. Scoped to the caller's own org from the validated principal, and refused without one; `sandbox=true` writes the org's sandbox ledger instead of its real books. An empty body is a 400, and a file the parser cannot read is a 400 carrying the parser's reason rather than a partial import. On a deployment whose import parser is not built, this answers 501 rather than mishandling the file.
- Bearer Token:
- type: http
- name: bearer
- parameter body: (body) (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<BankTally>
*/
open class func postBooksBankImportWithRequestBuilder(body: URL? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<BankTally> {
let localVariablePath = "/v1/books/bank/import"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = ["body": body]
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
let localVariableNillableHeaders: [String: (any Sendable)?] = [
"Content-Type": "application/octet-stream",
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<BankTally>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Pulls every connected bank (Plaid/Teller) for the caller's org, maps each fetched transaction to a posting and books it idempotently, then advances that connector's cursor so the next sync resumes where this one stopped.
- parameter apiConfiguration: The configuration for the http request.
- returns: BankTally
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBooksBankSync(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> BankTally {
return try await postBooksBankSyncWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Pulls every connected bank (Plaid/Teller) for the caller's org, maps each fetched transaction to a posting and books it idempotently, then advances that connector's cursor so the next sync resumes where this one stopped.
- POST /v1/books/bank/sync
- Pulls every connected bank (Plaid/Teller) for the caller's org, maps each fetched transaction to a posting and books it idempotently, then advances that connector's cursor so the next sync resumes where this one stopped. One connector's outage is skipped rather than failing the whole sync. It reports the batch: how many transactions were seen, how many vouchers posted, how many inflows reconciled against the processor clearing account, how many raised a question, how many were own-account transfers, and how many were already-processed no-ops. It is READ-ONLY against the bank — it ingests, it never sends money.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<BankTally>
*/
open class func postBooksBankSyncWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<BankTally> {
let localVariablePath = "/v1/books/bank/sync"
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<BankTally>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Begin connecting a bank account (not yet available)
- 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 postBooksBankToken(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) {
return try await postBooksBankTokenWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Begin connecting a bank account (not yet available)
- POST /v1/books/bank/token
- ANSWERS 501 UNCONDITIONALLY. It is the intended first hop of the bank-linking handshake — mint the short-lived session token a browser hands to the provider's link widget — and nothing on the HTTP path reaches an implementation today. The connectors behind it are written and tested; only the wiring is missing, so an org cannot connect a bank through the API at all. Until that lands, bank data reaches the books by statement import. It is documented as refusing rather than declared with a success body precisely because it has never sent one. A response schema here would be invention: every generated SDK would carry a return type for a call that has only ever failed. A caller with no principal gets 401 before the 501.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Void>
*/
open class func postBooksBankTokenWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Void> {
let localVariablePath = "/v1/books/bank/token"
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)
}
/**
Queue a document for later scanning
- parameter body: (body) (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: InboxItem
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBooksInbox(body: URL? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> InboxItem {
return try await postBooksInboxWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body
}
/**
Queue a document for later scanning
- POST /v1/books/inbox
- Takes a document as RAW BYTES and queues it in the caller org's inbox as `unsorted`, answering the queued item. It is the drop box: get the paperwork in now, read it later. It EXTRACTS NOTHING and calls no model — that is what separates it from the scan. Nothing is proposed and nothing is posted; the item simply waits to be scanned, and a booked document leaves the queue. IDEMPOTENT BY CONTENT: the item's id is the file hash, so re-uploading the same bytes answers the existing item rather than adding a duplicate row — and it is the same id a scan of those bytes uses, which is how the two routes address one document. Scoped to the caller's own org from the validated principal and refused without one; `sandbox=true` targets the sandbox ledger, and `filename` is recorded for display. An empty or oversized upload is a 400.
- Bearer Token:
- type: http
- name: bearer
- parameter body: (body) (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<InboxItem>
*/
open class func postBooksInboxWithRequestBuilder(body: URL? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<InboxItem> {
let localVariablePath = "/v1/books/inbox"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = ["body": body]
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
let localVariableNillableHeaders: [String: (any Sendable)?] = [
"Content-Type": "application/octet-stream",
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<InboxItem>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Creates or updates one auto-categorization rule, keyed by its pattern — writing a pattern that already exists REPLACES that row's category and priority.
- parameter rule: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: Rule
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBooksRules(rule: Rule, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Rule {
return try await postBooksRulesWithRequestBuilder(rule: rule, apiConfiguration: apiConfiguration).execute().body
}
/**
Creates or updates one auto-categorization rule, keyed by its pattern — writing a pattern that already exists REPLACES that row's category and priority.
- POST /v1/books/rules
- Creates or updates one auto-categorization rule, keyed by its pattern — writing a pattern that already exists REPLACES that row's category and priority. The category is normalized to a real COA expense account, and anything unrecognized becomes 5900 Uncategorized rather than a guessed real account. It answers the row exactly as stored, so the caller sees the normalization. A rule overrides a vendor's default category, so this is the standing instruction that decides how a future bill classifies.
- Bearer Token:
- type: http
- name: bearer
- parameter rule: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Rule>
*/
open class func postBooksRulesWithRequestBuilder(rule: Rule, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Rule> {
let localVariablePath = "/v1/books/rules"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: rule, 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<Rule>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Scan a receipt or invoice into a proposed voucher
- parameter body: (body) (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: ScanDraft
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBooksScan(body: URL? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> ScanDraft {
return try await postBooksScanWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body
}
/**
Scan a receipt or invoice into a proposed voucher
- POST /v1/books/scan
- Takes a receipt or invoice as RAW BYTES — a PDF, an image or plain text, uploaded under its own content type, not wrapped in JSON — extracts what the document says, resolves the vendor's expense category, and answers a DRAFT carrying a balanced voucher proposed for it. NOTHING IS POSTED. That split is the whole design: the model only ever produces a structured reading of the document, the voucher is assembled deterministically in Go from that reading, and the ledger is written only by the separate book call a human confirms. So a misread scan can propose a wrong draft; it cannot move money. Amounts are exact integer cents end to end — the extraction returns cents, never a decimal — so no rounding enters the ledger. The draft's id is the FILE HASH, and that is what makes booking idempotent: re-scanning the same bytes addresses the same draft rather than queuing a second one. A row is written to the org's document inbox as a side effect, moving it from unsorted to draft. Scoped to the caller's own org from the validated principal and refused without one; `sandbox=true` targets the sandbox ledger, and `filename` is recorded for the inbox. An empty or oversized upload is a 400, and a deployment with no scanner model answers 501.
- Bearer Token:
- type: http
- name: bearer
- parameter body: (body) (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<ScanDraft>
*/
open class func postBooksScanWithRequestBuilder(body: URL? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<ScanDraft> {
let localVariablePath = "/v1/books/scan"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = ["body": body]
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
let localVariableNillableHeaders: [String: (any Sendable)?] = [
"Content-Type": "application/octet-stream",
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<ScanDraft>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Posts a reviewed scanned bill to the ledger.
- parameter bookRequest: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: BookResponse
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBooksScanBook(bookRequest: BookRequest, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> BookResponse {
return try await postBooksScanBookWithRequestBuilder(bookRequest: bookRequest, apiConfiguration: apiConfiguration).execute().body
}
/**
Posts a reviewed scanned bill to the ledger.
- POST /v1/books/scan/book
- Posts a reviewed scanned bill to the ledger. It is the scanner's ONLY write: the voucher goes through the same post() choke point every other source uses, so it is checked to balance (Σdebit == Σcredit) and is idempotent by (scan, scanId) — re-booking the same scan answers posted=false and writes nothing. A bill whose economic identity (vendor, total, issue date) already posted under a DIFFERENT scan is refused 409 unless override is set, which is what stops the same receipt re-scanned into a new file hash from double-booking. An unbalanced voucher is refused 400.
- Bearer Token:
- type: http
- name: bearer
- parameter bookRequest: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<BookResponse>
*/
open class func postBooksScanBookWithRequestBuilder(bookRequest: BookRequest, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<BookResponse> {
let localVariablePath = "/v1/books/scan/book"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: bookRequest, 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<BookResponse>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Sync ingests the caller's OWN org from commerce into BOTH ledgers (live and sandbox) and reports how many new vouchers posted to each.
- parameter apiConfiguration: The configuration for the http request.
- returns: SyncTally
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBooksSync(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> SyncTally {
return try await postBooksSyncWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Sync ingests the caller's OWN org from commerce into BOTH ledgers (live and sandbox) and reports how many new vouchers posted to each.
- POST /v1/books/sync
- Sync ingests the caller's OWN org from commerce into BOTH ledgers (live and sandbox) and reports how many new vouchers posted to each. It is idempotent — money that has already been booked posts nothing on a repeat — and it is read-only against commerce: it never mints a deposit, a credit or a payout, only the accounting twin of money that already moved.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<SyncTally>
*/
open class func postBooksSyncWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<SyncTally> {
let localVariablePath = "/v1/books/sync"
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<SyncTally>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Creates or updates one vendor in the org's vendor book, keyed by its canonical name — writing a canonical name that already exists REPLACES that row's aliases and default category.
- parameter vendorRow: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: VendorRow
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postBooksVendors(vendorRow: VendorRow, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> VendorRow {
return try await postBooksVendorsWithRequestBuilder(vendorRow: vendorRow, apiConfiguration: apiConfiguration).execute().body
}
/**
Creates or updates one vendor in the org's vendor book, keyed by its canonical name — writing a canonical name that already exists REPLACES that row's aliases and default category.
- POST /v1/books/vendors
- Creates or updates one vendor in the org's vendor book, keyed by its canonical name — writing a canonical name that already exists REPLACES that row's aliases and default category. A category given as a slug (\"software\") is normalized to its real COA expense account, and anything unrecognized becomes 5900 Uncategorized rather than a guessed real account. It answers the row exactly as stored, so the caller sees the normalization. Recording a vendor is what makes future bills from it self-classify instead of asking again.
- Bearer Token:
- type: http
- name: bearer
- parameter vendorRow: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<VendorRow>
*/
open class func postBooksVendorsWithRequestBuilder(vendorRow: VendorRow, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<VendorRow> {
let localVariablePath = "/v1/books/vendors"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: vendorRow, 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<VendorRow>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
}