Documentation
¶
Overview ¶
Package zazu is the Go SDK for the Zazu API.
Response bodies are returned as-is from the API — snake_case keys, no struct mapping. The same shape ships across every Zazu SDK (Ruby, TypeScript, Python, Go, ...) so the cassette contract is one-to-one.
Index ¶
- Constants
- type AccountListParams
- type AccountsService
- func (s *AccountsService) Get(ctx context.Context, id string) (*Response, error)
- func (s *AccountsService) GetTransaction(ctx context.Context, accountID, transactionID string) (*Response, error)
- func (s *AccountsService) List(ctx context.Context, params AccountListParams) (*Page, error)
- func (s *AccountsService) ListTransactions(ctx context.Context, accountID string, params TransactionListParams) (*Page, error)
- type Attributes
- type BeneficiariesService
- type CheckoutSessionsService
- type Client
- type ConfigurationError
- type ConnectionError
- type CustomerListParams
- type CustomersService
- func (s *CustomersService) Create(ctx context.Context, attributes Attributes) (*Response, error)
- func (s *CustomersService) Delete(ctx context.Context, id string) (*Response, error)
- func (s *CustomersService) Get(ctx context.Context, id string) (*Response, error)
- func (s *CustomersService) List(ctx context.Context, params CustomerListParams) (*Page, error)
- func (s *CustomersService) Update(ctx context.Context, id string, attributes Attributes) (*Response, error)
- type EntityService
- type Error
- type InvoiceListParams
- type InvoicesService
- func (s *InvoicesService) Cancel(ctx context.Context, id string) (*Response, error)
- func (s *InvoicesService) Create(ctx context.Context, attributes Attributes) (*Response, error)
- func (s *InvoicesService) CreatePaymentLink(ctx context.Context, invoiceID, accountID string) (*Response, error)
- func (s *InvoicesService) CreditNote(ctx context.Context, id string) (*Response, error)
- func (s *InvoicesService) Delete(ctx context.Context, id string) (*Response, error)
- func (s *InvoicesService) Get(ctx context.Context, id string) (*Response, error)
- func (s *InvoicesService) List(ctx context.Context, params InvoiceListParams) (*Page, error)
- func (s *InvoicesService) MarkAsPaid(ctx context.Context, id string) (*Response, error)
- func (s *InvoicesService) Send(ctx context.Context, id string) (*Response, error)
- func (s *InvoicesService) Update(ctx context.Context, id string, attributes Attributes) (*Response, error)
- type ListParams
- type Option
- type Page
- type PaymentLinkListParams
- type PaymentLinksService
- func (s *PaymentLinksService) Cancel(ctx context.Context, id string) (*Response, error)
- func (s *PaymentLinksService) Create(ctx context.Context, attributes Attributes) (*Response, error)
- func (s *PaymentLinksService) Get(ctx context.Context, id string) (*Response, error)
- func (s *PaymentLinksService) List(ctx context.Context, params PaymentLinkListParams) (*Page, error)
- type Response
- type TransactionListParams
- type TransferDraftsService
- type WebhookEndpointsService
- func (s *WebhookEndpointsService) Create(ctx context.Context, attributes Attributes) (*Response, error)
- func (s *WebhookEndpointsService) Delete(ctx context.Context, id string) (*Response, error)
- func (s *WebhookEndpointsService) Disable(ctx context.Context, id string) (*Response, error)
- func (s *WebhookEndpointsService) Enable(ctx context.Context, id string) (*Response, error)
- func (s *WebhookEndpointsService) Get(ctx context.Context, id string) (*Response, error)
- func (s *WebhookEndpointsService) List(ctx context.Context, params ListParams) (*Page, error)
- func (s *WebhookEndpointsService) RegenerateSecret(ctx context.Context, id string) (*Response, error)
- func (s *WebhookEndpointsService) Test(ctx context.Context, id string) (*Response, error)
- func (s *WebhookEndpointsService) Update(ctx context.Context, id string, attributes Attributes) (*Response, error)
Constants ¶
const MaxPerPage = 100
MaxPerPage is the API's hard page-size cap.
const (
// Version is the SDK version, sent in the User-Agent header.
Version = "0.1.0"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountListParams ¶
type AccountListParams struct {
ListParams
Status string
CurrencyCode string
}
AccountListParams filters GET /api/accounts.
type AccountsService ¶
type AccountsService struct {
// contains filtered or unexported fields
}
AccountsService — accounts and their transactions.
func (*AccountsService) GetTransaction ¶
func (s *AccountsService) GetTransaction(ctx context.Context, accountID, transactionID string) (*Response, error)
GetTransaction calls GET /api/accounts/:account_id/transactions/:id.
func (*AccountsService) List ¶
func (s *AccountsService) List(ctx context.Context, params AccountListParams) (*Page, error)
List calls GET /api/accounts.
func (*AccountsService) ListTransactions ¶
func (s *AccountsService) ListTransactions(ctx context.Context, accountID string, params TransactionListParams) (*Page, error)
ListTransactions calls GET /api/accounts/:account_id/transactions.
type Attributes ¶
Attributes is a request body for create/update calls — snake_case keys, exactly what the API accepts (see the per-endpoint docs).
type BeneficiariesService ¶
type BeneficiariesService struct {
// contains filtered or unexported fields
}
BeneficiariesService — read-only directory of saved transfer recipients. Each beneficiary embeds its bank accounts; the one flagged `default` is used when a transfer names only the beneficiary_id. Beneficiaries are created and managed in the Zazu dashboard.
func (*BeneficiariesService) List ¶
func (s *BeneficiariesService) List(ctx context.Context, params ListParams) (*Page, error)
List calls GET /api/beneficiaries.
type CheckoutSessionsService ¶
type CheckoutSessionsService struct {
// contains filtered or unexported fields
}
CheckoutSessionsService — one-off hosted checkout sessions. No list, update, or delete; sessions are created and inspected by id.
func (*CheckoutSessionsService) Create ¶
func (s *CheckoutSessionsService) Create(ctx context.Context, attributes Attributes) (*Response, error)
Create calls POST /api/checkout_sessions. Required attributes: account_id, amount, success_url.
type Client ¶
type Client struct {
Accounts *AccountsService
Beneficiaries *BeneficiariesService
CheckoutSessions *CheckoutSessionsService
Customers *CustomersService
Entity *EntityService
Invoices *InvoicesService
PaymentLinks *PaymentLinksService
TransferDrafts *TransferDraftsService
WebhookEndpoints *WebhookEndpointsService
// contains filtered or unexported fields
}
Client is the SDK entry point. Resources hang off it as fields.
client, err := zazu.New(zazu.WithAPIKey("sk_live_..."))
page, err := client.Accounts.List(ctx, zazu.ListParams{})
type ConfigurationError ¶
type ConfigurationError struct{ Message string }
ConfigurationError is returned by New when the client can't be built.
func (*ConfigurationError) Error ¶
func (e *ConfigurationError) Error() string
type ConnectionError ¶
type ConnectionError struct{ Message string }
ConnectionError wraps transport-level failures (timeouts, DNS, refused).
func (*ConnectionError) Error ¶
func (e *ConnectionError) Error() string
type CustomerListParams ¶
type CustomerListParams struct {
ListParams
Query string // matches company name, person name, email
}
CustomerListParams filters GET /api/customers.
type CustomersService ¶
type CustomersService struct {
// contains filtered or unexported fields
}
CustomersService — individuals or businesses the entity invoices.
func (*CustomersService) Create ¶
func (s *CustomersService) Create(ctx context.Context, attributes Attributes) (*Response, error)
Create calls POST /api/customers.
func (*CustomersService) List ¶
func (s *CustomersService) List(ctx context.Context, params CustomerListParams) (*Page, error)
List calls GET /api/customers.
func (*CustomersService) Update ¶
func (s *CustomersService) Update(ctx context.Context, id string, attributes Attributes) (*Response, error)
Update calls PATCH /api/customers/:id.
type EntityService ¶
type EntityService struct {
// contains filtered or unexported fields
}
EntityService — the current entity (the tenant the API key belongs to).
type Error ¶
type Error struct {
Status int
Kind string // authentication, forbidden, not_found, validation, rate_limit, server, api
Type string // the API's error.type field
Message string
Param string
RequestID string
RetryAfter int // seconds; only set for rate_limit
Body map[string]any
}
Error is the API error envelope, mirroring the other Zazu SDKs' hierarchy: { "error": { "type": ..., "message": ..., "param": ... } }. Match on Kind (or use errors.As with the sentinel helpers) instead of subclassing.
type InvoiceListParams ¶
type InvoiceListParams struct {
ListParams
Status string
CustomerID string
}
InvoiceListParams filters GET /api/invoices.
type InvoicesService ¶
type InvoicesService struct {
// contains filtered or unexported fields
}
InvoicesService — invoices and their lifecycle actions.
func (*InvoicesService) Create ¶
func (s *InvoicesService) Create(ctx context.Context, attributes Attributes) (*Response, error)
Create calls POST /api/invoices.
func (*InvoicesService) CreatePaymentLink ¶
func (s *InvoicesService) CreatePaymentLink(ctx context.Context, invoiceID, accountID string) (*Response, error)
CreatePaymentLink calls POST /api/invoices/:invoice_id/payment_link.
func (*InvoicesService) CreditNote ¶
CreditNote calls POST /api/invoices/:id/credit_note.
func (*InvoicesService) List ¶
func (s *InvoicesService) List(ctx context.Context, params InvoiceListParams) (*Page, error)
List calls GET /api/invoices.
func (*InvoicesService) MarkAsPaid ¶
MarkAsPaid calls POST /api/invoices/:id/mark_as_paid.
func (*InvoicesService) Update ¶
func (s *InvoicesService) Update(ctx context.Context, id string, attributes Attributes) (*Response, error)
Update calls PATCH /api/invoices/:id.
type ListParams ¶
ListParams are the shared cursor-pagination inputs. Limit 0 means MaxPerPage.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithAPIKey ¶
WithAPIKey sets the API key (default: the ZAZU_API_KEY env var).
func WithAPIVersion ¶
WithAPIVersion pins the Zazu-Version request header (default: ZAZU_API_VERSION).
func WithBaseURL ¶
WithBaseURL sets the API base URL (default: ZAZU_BASE_URL or https://zazu.ma).
func WithHTTPClient ¶
WithHTTPClient swaps the underlying *http.Client (default: 30s timeout).
type Page ¶
type Page struct {
Data []map[string]any
HasMore bool
NextCursor string
Response *Response
// contains filtered or unexported fields
}
Page is one page of a cursor-paginated list endpoint: { "data": [...], "has_more": bool, "next_cursor": string|null }.
type PaymentLinkListParams ¶
type PaymentLinkListParams struct {
ListParams
Status string
LinkType string
}
PaymentLinkListParams filters GET /api/payment_links.
type PaymentLinksService ¶
type PaymentLinksService struct {
// contains filtered or unexported fields
}
PaymentLinksService — standalone payment links (not attached to an invoice).
func (*PaymentLinksService) Create ¶
func (s *PaymentLinksService) Create(ctx context.Context, attributes Attributes) (*Response, error)
Create calls POST /api/payment_links.
func (*PaymentLinksService) List ¶
func (s *PaymentLinksService) List(ctx context.Context, params PaymentLinkListParams) (*Page, error)
List calls GET /api/payment_links.
type TransactionListParams ¶
type TransactionListParams struct {
ListParams
Operation string
PostedAfter string // ISO-8601
PostedBefore string // ISO-8601
}
TransactionListParams filters GET /api/accounts/:id/transactions.
type TransferDraftsService ¶
type TransferDraftsService struct {
// contains filtered or unexported fields
}
TransferDraftsService — API-initiated transfers. Creating a draft routes it into the workspace's in-app approval flow; the API never executes a transfer itself. Poll Get (status: requested → processing → completed / failed) or subscribe to the `transfer.executed` webhook.
func (*TransferDraftsService) Create ¶
func (s *TransferDraftsService) Create(ctx context.Context, attributes Attributes) (*Response, error)
Create calls POST /api/transfer_drafts. Required: account_id, amount, and exactly one of beneficiary_id (external transfer) or destination_account_id (own-account move).
type WebhookEndpointsService ¶
type WebhookEndpointsService struct {
// contains filtered or unexported fields
}
WebhookEndpointsService — webhook endpoint management.
func (*WebhookEndpointsService) Create ¶
func (s *WebhookEndpointsService) Create(ctx context.Context, attributes Attributes) (*Response, error)
Create calls POST /api/webhook_endpoints.
func (*WebhookEndpointsService) List ¶
func (s *WebhookEndpointsService) List(ctx context.Context, params ListParams) (*Page, error)
List calls GET /api/webhook_endpoints.
func (*WebhookEndpointsService) RegenerateSecret ¶
func (s *WebhookEndpointsService) RegenerateSecret(ctx context.Context, id string) (*Response, error)
RegenerateSecret calls POST /api/webhook_endpoints/:id/regenerate_secret.
func (*WebhookEndpointsService) Update ¶
func (s *WebhookEndpointsService) Update(ctx context.Context, id string, attributes Attributes) (*Response, error)
Update calls PATCH /api/webhook_endpoints/:id.