mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
2950 lines
103 KiB
Go
2950 lines
103 KiB
Go
/*
|
|
Hanzo Cloud API
|
|
|
|
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
|
|
API version: v1
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package hanzoai
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
"os"
|
|
)
|
|
|
|
// BooksAPIService BooksAPI service
|
|
type BooksAPIService service
|
|
|
|
type BooksAPIGetBooksAccountsRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\"; anything else reads the live one.
|
|
func (r BooksAPIGetBooksAccountsRequest) Sandbox(sandbox string) BooksAPIGetBooksAccountsRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksAccountsRequest) Execute() ([]BooksAccount, *http.Response, error) {
|
|
return r.ApiService.GetBooksAccountsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksAccounts Returns the org's chart of accounts — the seeded fixed chart every posting key in the ledger refers to.
|
|
|
|
Returns the org's chart of accounts — the seeded fixed chart every
|
|
posting key in the ledger refers to.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksAccountsRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksAccounts(ctx context.Context) BooksAPIGetBooksAccountsRequest {
|
|
return BooksAPIGetBooksAccountsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return []BooksAccount
|
|
func (a *BooksAPIService) GetBooksAccountsExecute(r BooksAPIGetBooksAccountsRequest) ([]BooksAccount, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue []BooksAccount
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksAccounts")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/accounts"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksBankTransactionsRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
limit *int64
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\".
|
|
func (r BooksAPIGetBooksBankTransactionsRequest) Sandbox(sandbox string) BooksAPIGetBooksBankTransactionsRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
// Limit caps how many rows come back; 500 when absent or not positive.
|
|
func (r BooksAPIGetBooksBankTransactionsRequest) Limit(limit int64) BooksAPIGetBooksBankTransactionsRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksBankTransactionsRequest) Execute() ([]BooksBankTxnRow, *http.Response, error) {
|
|
return r.ApiService.GetBooksBankTransactionsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksBankTransactions 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksBankTransactionsRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksBankTransactions(ctx context.Context) BooksAPIGetBooksBankTransactionsRequest {
|
|
return BooksAPIGetBooksBankTransactionsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return []BooksBankTxnRow
|
|
func (a *BooksAPIService) GetBooksBankTransactionsExecute(r BooksAPIGetBooksBankTransactionsRequest) ([]BooksBankTxnRow, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue []BooksBankTxnRow
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksBankTransactions")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/bank/transactions"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksBankUnreconciledRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\"; anything else reads the live one.
|
|
func (r BooksAPIGetBooksBankUnreconciledRequest) Sandbox(sandbox string) BooksAPIGetBooksBankUnreconciledRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksBankUnreconciledRequest) Execute() (*BooksUnreconciledOut, *http.Response, error) {
|
|
return r.ApiService.GetBooksBankUnreconciledExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksBankUnreconciled 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksBankUnreconciledRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksBankUnreconciled(ctx context.Context) BooksAPIGetBooksBankUnreconciledRequest {
|
|
return BooksAPIGetBooksBankUnreconciledRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksUnreconciledOut
|
|
func (a *BooksAPIService) GetBooksBankUnreconciledExecute(r BooksAPIGetBooksBankUnreconciledRequest) (*BooksUnreconciledOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksUnreconciledOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksBankUnreconciled")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/bank/unreconciled"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksExportRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
from *string
|
|
to *string
|
|
format *string
|
|
limit *int64
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\".
|
|
func (r BooksAPIGetBooksExportRequest) Sandbox(sandbox string) BooksAPIGetBooksExportRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
// From is the RFC3339 start of the window, exclusive. Empty means all time.
|
|
func (r BooksAPIGetBooksExportRequest) From(from string) BooksAPIGetBooksExportRequest {
|
|
r.from = &from
|
|
return r
|
|
}
|
|
|
|
// To is the RFC3339 end of the window, inclusive. Empty means up to now.
|
|
func (r BooksAPIGetBooksExportRequest) To(to string) BooksAPIGetBooksExportRequest {
|
|
r.to = &to
|
|
return r
|
|
}
|
|
|
|
// Format is the export encoding. Only \"json\" is supported; empty means json.
|
|
func (r BooksAPIGetBooksExportRequest) Format(format string) BooksAPIGetBooksExportRequest {
|
|
r.format = &format
|
|
return r
|
|
}
|
|
|
|
// Limit caps the GL detail rows included as the audit trail; 5000 when absent or not positive.
|
|
func (r BooksAPIGetBooksExportRequest) Limit(limit int64) BooksAPIGetBooksExportRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksExportRequest) Execute() (*BooksFinancialPackage, *http.Response, error) {
|
|
return r.ApiService.GetBooksExportExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksExport 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksExportRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksExport(ctx context.Context) BooksAPIGetBooksExportRequest {
|
|
return BooksAPIGetBooksExportRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksFinancialPackage
|
|
func (a *BooksAPIService) GetBooksExportExecute(r BooksAPIGetBooksExportRequest) (*BooksFinancialPackage, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksFinancialPackage
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksExport")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/export"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
if r.from != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "form", "")
|
|
}
|
|
if r.to != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "to", r.to, "form", "")
|
|
}
|
|
if r.format != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "format", r.format, "form", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksGlRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
limit *int64
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\".
|
|
func (r BooksAPIGetBooksGlRequest) Sandbox(sandbox string) BooksAPIGetBooksGlRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
// Limit caps how many rows come back; 500 when absent or not positive.
|
|
func (r BooksAPIGetBooksGlRequest) Limit(limit int64) BooksAPIGetBooksGlRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksGlRequest) Execute() ([]BooksGLRow, *http.Response, error) {
|
|
return r.ApiService.GetBooksGlExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksGl Returns the org's most recent GL Entry rows, newest first.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksGlRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksGl(ctx context.Context) BooksAPIGetBooksGlRequest {
|
|
return BooksAPIGetBooksGlRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return []BooksGLRow
|
|
func (a *BooksAPIService) GetBooksGlExecute(r BooksAPIGetBooksGlRequest) ([]BooksGLRow, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue []BooksGLRow
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksGl")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/gl"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksInboxRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\"; anything else reads the live one.
|
|
func (r BooksAPIGetBooksInboxRequest) Sandbox(sandbox string) BooksAPIGetBooksInboxRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksInboxRequest) Execute() (*BooksInboxOut, *http.Response, error) {
|
|
return r.ApiService.GetBooksInboxExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksInbox 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksInboxRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksInbox(ctx context.Context) BooksAPIGetBooksInboxRequest {
|
|
return BooksAPIGetBooksInboxRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksInboxOut
|
|
func (a *BooksAPIService) GetBooksInboxExecute(r BooksAPIGetBooksInboxRequest) (*BooksInboxOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksInboxOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksInbox")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/inbox"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksMetricsRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
from *string
|
|
to *string
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\".
|
|
func (r BooksAPIGetBooksMetricsRequest) Sandbox(sandbox string) BooksAPIGetBooksMetricsRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
// From is the RFC3339 start of the window, exclusive. Empty means all time.
|
|
func (r BooksAPIGetBooksMetricsRequest) From(from string) BooksAPIGetBooksMetricsRequest {
|
|
r.from = &from
|
|
return r
|
|
}
|
|
|
|
// To is the RFC3339 end of the window, inclusive. Empty means up to now.
|
|
func (r BooksAPIGetBooksMetricsRequest) To(to string) BooksAPIGetBooksMetricsRequest {
|
|
r.to = &to
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksMetricsRequest) Execute() (*BooksMetricsResponse, *http.Response, error) {
|
|
return r.ApiService.GetBooksMetricsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksMetrics 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksMetricsRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksMetrics(ctx context.Context) BooksAPIGetBooksMetricsRequest {
|
|
return BooksAPIGetBooksMetricsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksMetricsResponse
|
|
func (a *BooksAPIService) GetBooksMetricsExecute(r BooksAPIGetBooksMetricsRequest) (*BooksMetricsResponse, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksMetricsResponse
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksMetrics")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/metrics"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
if r.from != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "form", "")
|
|
}
|
|
if r.to != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "to", r.to, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksPnlRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
from *string
|
|
to *string
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\".
|
|
func (r BooksAPIGetBooksPnlRequest) Sandbox(sandbox string) BooksAPIGetBooksPnlRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
// From is the RFC3339 start of the window, exclusive. Empty means all time.
|
|
func (r BooksAPIGetBooksPnlRequest) From(from string) BooksAPIGetBooksPnlRequest {
|
|
r.from = &from
|
|
return r
|
|
}
|
|
|
|
// To is the RFC3339 end of the window, inclusive. Empty means up to now.
|
|
func (r BooksAPIGetBooksPnlRequest) To(to string) BooksAPIGetBooksPnlRequest {
|
|
r.to = &to
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksPnlRequest) Execute() (*BooksPnL, *http.Response, error) {
|
|
return r.ApiService.GetBooksPnlExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksPnl 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksPnlRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksPnl(ctx context.Context) BooksAPIGetBooksPnlRequest {
|
|
return BooksAPIGetBooksPnlRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksPnL
|
|
func (a *BooksAPIService) GetBooksPnlExecute(r BooksAPIGetBooksPnlRequest) (*BooksPnL, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksPnL
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksPnl")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/pnl"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
if r.from != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "form", "")
|
|
}
|
|
if r.to != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "to", r.to, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksPositionRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
to *string
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\".
|
|
func (r BooksAPIGetBooksPositionRequest) Sandbox(sandbox string) BooksAPIGetBooksPositionRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
// To is the RFC3339 instant the statement is struck as of. Empty means all time.
|
|
func (r BooksAPIGetBooksPositionRequest) To(to string) BooksAPIGetBooksPositionRequest {
|
|
r.to = &to
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksPositionRequest) Execute() (*BooksBalanceSheet, *http.Response, error) {
|
|
return r.ApiService.GetBooksPositionExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksPosition Returns the org's Balance Sheet as of `to` (empty = all time), with the Assets == Liabilities + Equity equation proof.
|
|
|
|
Returns the org's Balance Sheet as of `to` (empty = all time), with the
|
|
Assets == Liabilities + Equity equation proof.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksPositionRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksPosition(ctx context.Context) BooksAPIGetBooksPositionRequest {
|
|
return BooksAPIGetBooksPositionRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksBalanceSheet
|
|
func (a *BooksAPIService) GetBooksPositionExecute(r BooksAPIGetBooksPositionRequest) (*BooksBalanceSheet, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksBalanceSheet
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksPosition")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/position"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
if r.to != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "to", r.to, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksQuestionsRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\"; anything else reads the live one.
|
|
func (r BooksAPIGetBooksQuestionsRequest) Sandbox(sandbox string) BooksAPIGetBooksQuestionsRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksQuestionsRequest) Execute() (*BooksQuestionsResponse, *http.Response, error) {
|
|
return r.ApiService.GetBooksQuestionsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksQuestions 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksQuestionsRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksQuestions(ctx context.Context) BooksAPIGetBooksQuestionsRequest {
|
|
return BooksAPIGetBooksQuestionsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksQuestionsResponse
|
|
func (a *BooksAPIService) GetBooksQuestionsExecute(r BooksAPIGetBooksQuestionsRequest) (*BooksQuestionsResponse, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksQuestionsResponse
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksQuestions")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/questions"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksRulesRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\"; anything else reads the live one.
|
|
func (r BooksAPIGetBooksRulesRequest) Sandbox(sandbox string) BooksAPIGetBooksRulesRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksRulesRequest) Execute() (*BooksRulesOut, *http.Response, error) {
|
|
return r.ApiService.GetBooksRulesExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksRules Returns the org's auto-categorization rules, highest priority first.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksRulesRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksRules(ctx context.Context) BooksAPIGetBooksRulesRequest {
|
|
return BooksAPIGetBooksRulesRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksRulesOut
|
|
func (a *BooksAPIService) GetBooksRulesExecute(r BooksAPIGetBooksRulesRequest) (*BooksRulesOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksRulesOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksRules")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/rules"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksTransactionsRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
from *string
|
|
to *string
|
|
category *string
|
|
vendor *string
|
|
limit *int64
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\".
|
|
func (r BooksAPIGetBooksTransactionsRequest) Sandbox(sandbox string) BooksAPIGetBooksTransactionsRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
// From is the RFC3339 start of the posting-time window, inclusive.
|
|
func (r BooksAPIGetBooksTransactionsRequest) From(from string) BooksAPIGetBooksTransactionsRequest {
|
|
r.from = &from
|
|
return r
|
|
}
|
|
|
|
// To is the RFC3339 end of the posting-time window, inclusive.
|
|
func (r BooksAPIGetBooksTransactionsRequest) To(to string) BooksAPIGetBooksTransactionsRequest {
|
|
r.to = &to
|
|
return r
|
|
}
|
|
|
|
// Category filters to one COA account, named by number (\"5300\") or by category slug (\"software\").
|
|
func (r BooksAPIGetBooksTransactionsRequest) Category(category string) BooksAPIGetBooksTransactionsRequest {
|
|
r.category = &category
|
|
return r
|
|
}
|
|
|
|
// Vendor filters to rows whose vendor or description contains this text, case-insensitively.
|
|
func (r BooksAPIGetBooksTransactionsRequest) Vendor(vendor string) BooksAPIGetBooksTransactionsRequest {
|
|
r.vendor = &vendor
|
|
return r
|
|
}
|
|
|
|
// Limit caps how many rows come back; 200 when absent or not positive.
|
|
func (r BooksAPIGetBooksTransactionsRequest) Limit(limit int64) BooksAPIGetBooksTransactionsRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksTransactionsRequest) Execute() (*BooksTransactionsOut, *http.Response, error) {
|
|
return r.ApiService.GetBooksTransactionsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksTransactions 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksTransactionsRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksTransactions(ctx context.Context) BooksAPIGetBooksTransactionsRequest {
|
|
return BooksAPIGetBooksTransactionsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksTransactionsOut
|
|
func (a *BooksAPIService) GetBooksTransactionsExecute(r BooksAPIGetBooksTransactionsRequest) (*BooksTransactionsOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksTransactionsOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksTransactions")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/transactions"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
if r.from != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "form", "")
|
|
}
|
|
if r.to != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "to", r.to, "form", "")
|
|
}
|
|
if r.category != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "category", r.category, "form", "")
|
|
}
|
|
if r.vendor != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "vendor", r.vendor, "form", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksTrialRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
from *string
|
|
to *string
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\".
|
|
func (r BooksAPIGetBooksTrialRequest) Sandbox(sandbox string) BooksAPIGetBooksTrialRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
// From is the RFC3339 start of the window, exclusive. Empty means all time.
|
|
func (r BooksAPIGetBooksTrialRequest) From(from string) BooksAPIGetBooksTrialRequest {
|
|
r.from = &from
|
|
return r
|
|
}
|
|
|
|
// To is the RFC3339 end of the window, inclusive. Empty means up to now.
|
|
func (r BooksAPIGetBooksTrialRequest) To(to string) BooksAPIGetBooksTrialRequest {
|
|
r.to = &to
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksTrialRequest) Execute() (*BooksTrialBalance, *http.Response, error) {
|
|
return r.ApiService.GetBooksTrialExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksTrial 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksTrialRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksTrial(ctx context.Context) BooksAPIGetBooksTrialRequest {
|
|
return BooksAPIGetBooksTrialRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksTrialBalance
|
|
func (a *BooksAPIService) GetBooksTrialExecute(r BooksAPIGetBooksTrialRequest) (*BooksTrialBalance, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksTrialBalance
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksTrial")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/trial"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
if r.from != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "form", "")
|
|
}
|
|
if r.to != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "to", r.to, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIGetBooksVendorsRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
sandbox *string
|
|
}
|
|
|
|
// Sandbox reads the org's SANDBOX ledger when it is exactly \"true\"; anything else reads the live one.
|
|
func (r BooksAPIGetBooksVendorsRequest) Sandbox(sandbox string) BooksAPIGetBooksVendorsRequest {
|
|
r.sandbox = &sandbox
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIGetBooksVendorsRequest) Execute() (*BooksVendorsOut, *http.Response, error) {
|
|
return r.ApiService.GetBooksVendorsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetBooksVendors 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIGetBooksVendorsRequest
|
|
*/
|
|
func (a *BooksAPIService) GetBooksVendors(ctx context.Context) BooksAPIGetBooksVendorsRequest {
|
|
return BooksAPIGetBooksVendorsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksVendorsOut
|
|
func (a *BooksAPIService) GetBooksVendorsExecute(r BooksAPIGetBooksVendorsRequest) (*BooksVendorsOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksVendorsOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.GetBooksVendors")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/vendors"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.sandbox != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox", r.sandbox, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIPostBooksAskRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
booksAskRequest *BooksAskRequest
|
|
}
|
|
|
|
func (r BooksAPIPostBooksAskRequest) BooksAskRequest(booksAskRequest BooksAskRequest) BooksAPIPostBooksAskRequest {
|
|
r.booksAskRequest = &booksAskRequest
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIPostBooksAskRequest) Execute() (*BooksAskResponse, *http.Response, error) {
|
|
return r.ApiService.PostBooksAskExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostBooksAsk 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIPostBooksAskRequest
|
|
*/
|
|
func (a *BooksAPIService) PostBooksAsk(ctx context.Context) BooksAPIPostBooksAskRequest {
|
|
return BooksAPIPostBooksAskRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksAskResponse
|
|
func (a *BooksAPIService) PostBooksAskExecute(r BooksAPIPostBooksAskRequest) (*BooksAskResponse, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksAskResponse
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.PostBooksAsk")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/ask"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.booksAskRequest == nil {
|
|
return localVarReturnValue, nil, reportError("booksAskRequest is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.booksAskRequest
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIPostBooksBankImportRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
body *os.File
|
|
}
|
|
|
|
func (r BooksAPIPostBooksBankImportRequest) Body(body *os.File) BooksAPIPostBooksBankImportRequest {
|
|
r.body = body
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIPostBooksBankImportRequest) Execute() (*BankTally, *http.Response, error) {
|
|
return r.ApiService.PostBooksBankImportExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostBooksBankImport Import a bank statement file into your books
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIPostBooksBankImportRequest
|
|
*/
|
|
func (a *BooksAPIService) PostBooksBankImport(ctx context.Context) BooksAPIPostBooksBankImportRequest {
|
|
return BooksAPIPostBooksBankImportRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BankTally
|
|
func (a *BooksAPIService) PostBooksBankImportExecute(r BooksAPIPostBooksBankImportRequest) (*BankTally, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BankTally
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.PostBooksBankImport")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/bank/import"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/octet-stream"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.body
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIPostBooksBankSyncRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
}
|
|
|
|
func (r BooksAPIPostBooksBankSyncRequest) Execute() (*BooksBankTally, *http.Response, error) {
|
|
return r.ApiService.PostBooksBankSyncExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostBooksBankSync 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIPostBooksBankSyncRequest
|
|
*/
|
|
func (a *BooksAPIService) PostBooksBankSync(ctx context.Context) BooksAPIPostBooksBankSyncRequest {
|
|
return BooksAPIPostBooksBankSyncRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksBankTally
|
|
func (a *BooksAPIService) PostBooksBankSyncExecute(r BooksAPIPostBooksBankSyncRequest) (*BooksBankTally, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksBankTally
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.PostBooksBankSync")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/bank/sync"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIPostBooksInboxRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
body *os.File
|
|
}
|
|
|
|
func (r BooksAPIPostBooksInboxRequest) Body(body *os.File) BooksAPIPostBooksInboxRequest {
|
|
r.body = body
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIPostBooksInboxRequest) Execute() (*InboxItem, *http.Response, error) {
|
|
return r.ApiService.PostBooksInboxExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostBooksInbox Queue a document for later scanning
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIPostBooksInboxRequest
|
|
*/
|
|
func (a *BooksAPIService) PostBooksInbox(ctx context.Context) BooksAPIPostBooksInboxRequest {
|
|
return BooksAPIPostBooksInboxRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return InboxItem
|
|
func (a *BooksAPIService) PostBooksInboxExecute(r BooksAPIPostBooksInboxRequest) (*InboxItem, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *InboxItem
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.PostBooksInbox")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/inbox"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/octet-stream"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.body
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIPostBooksRulesRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
booksRule *BooksRule
|
|
}
|
|
|
|
func (r BooksAPIPostBooksRulesRequest) BooksRule(booksRule BooksRule) BooksAPIPostBooksRulesRequest {
|
|
r.booksRule = &booksRule
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIPostBooksRulesRequest) Execute() (*BooksRule, *http.Response, error) {
|
|
return r.ApiService.PostBooksRulesExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostBooksRules Creates or updates one auto-categorization rule, keyed by its pattern — writing a pattern that already exists REPLACES that row's category and priority.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIPostBooksRulesRequest
|
|
*/
|
|
func (a *BooksAPIService) PostBooksRules(ctx context.Context) BooksAPIPostBooksRulesRequest {
|
|
return BooksAPIPostBooksRulesRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksRule
|
|
func (a *BooksAPIService) PostBooksRulesExecute(r BooksAPIPostBooksRulesRequest) (*BooksRule, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksRule
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.PostBooksRules")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/rules"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.booksRule == nil {
|
|
return localVarReturnValue, nil, reportError("booksRule is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.booksRule
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIPostBooksScanRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
body *os.File
|
|
}
|
|
|
|
func (r BooksAPIPostBooksScanRequest) Body(body *os.File) BooksAPIPostBooksScanRequest {
|
|
r.body = body
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIPostBooksScanRequest) Execute() (*ScanDraft, *http.Response, error) {
|
|
return r.ApiService.PostBooksScanExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostBooksScan Scan a receipt or invoice into a proposed voucher
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIPostBooksScanRequest
|
|
*/
|
|
func (a *BooksAPIService) PostBooksScan(ctx context.Context) BooksAPIPostBooksScanRequest {
|
|
return BooksAPIPostBooksScanRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return ScanDraft
|
|
func (a *BooksAPIService) PostBooksScanExecute(r BooksAPIPostBooksScanRequest) (*ScanDraft, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *ScanDraft
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.PostBooksScan")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/scan"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/octet-stream"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.body
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIPostBooksScanBookRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
booksBookRequest *BooksBookRequest
|
|
}
|
|
|
|
func (r BooksAPIPostBooksScanBookRequest) BooksBookRequest(booksBookRequest BooksBookRequest) BooksAPIPostBooksScanBookRequest {
|
|
r.booksBookRequest = &booksBookRequest
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIPostBooksScanBookRequest) Execute() (*BooksBookResponse, *http.Response, error) {
|
|
return r.ApiService.PostBooksScanBookExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostBooksScanBook Posts a reviewed scanned bill to the ledger.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIPostBooksScanBookRequest
|
|
*/
|
|
func (a *BooksAPIService) PostBooksScanBook(ctx context.Context) BooksAPIPostBooksScanBookRequest {
|
|
return BooksAPIPostBooksScanBookRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksBookResponse
|
|
func (a *BooksAPIService) PostBooksScanBookExecute(r BooksAPIPostBooksScanBookRequest) (*BooksBookResponse, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksBookResponse
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.PostBooksScanBook")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/scan/book"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.booksBookRequest == nil {
|
|
return localVarReturnValue, nil, reportError("booksBookRequest is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.booksBookRequest
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIPostBooksSyncRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
}
|
|
|
|
func (r BooksAPIPostBooksSyncRequest) Execute() (*BooksSyncTally, *http.Response, error) {
|
|
return r.ApiService.PostBooksSyncExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostBooksSync Ingests the caller's OWN org from commerce into BOTH ledgers (live and sandbox) and reports how many new vouchers posted to each.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIPostBooksSyncRequest
|
|
*/
|
|
func (a *BooksAPIService) PostBooksSync(ctx context.Context) BooksAPIPostBooksSyncRequest {
|
|
return BooksAPIPostBooksSyncRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksSyncTally
|
|
func (a *BooksAPIService) PostBooksSyncExecute(r BooksAPIPostBooksSyncRequest) (*BooksSyncTally, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksSyncTally
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.PostBooksSync")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/sync"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type BooksAPIPostBooksVendorsRequest struct {
|
|
ctx context.Context
|
|
ApiService *BooksAPIService
|
|
booksVendorRow *BooksVendorRow
|
|
}
|
|
|
|
func (r BooksAPIPostBooksVendorsRequest) BooksVendorRow(booksVendorRow BooksVendorRow) BooksAPIPostBooksVendorsRequest {
|
|
r.booksVendorRow = &booksVendorRow
|
|
return r
|
|
}
|
|
|
|
func (r BooksAPIPostBooksVendorsRequest) Execute() (*BooksVendorRow, *http.Response, error) {
|
|
return r.ApiService.PostBooksVendorsExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostBooksVendors 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.
|
|
|
|
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.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return BooksAPIPostBooksVendorsRequest
|
|
*/
|
|
func (a *BooksAPIService) PostBooksVendors(ctx context.Context) BooksAPIPostBooksVendorsRequest {
|
|
return BooksAPIPostBooksVendorsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return BooksVendorRow
|
|
func (a *BooksAPIService) PostBooksVendorsExecute(r BooksAPIPostBooksVendorsRequest) (*BooksVendorRow, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *BooksVendorRow
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BooksAPIService.PostBooksVendors")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/books/vendors"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.booksVendorRow == nil {
|
|
return localVarReturnValue, nil, reportError("booksVendorRow is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.booksVendorRow
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|