api

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Code       string `json:"code"`
	Message    string `json:"message"`
}

APIError represents an API error.

func (*APIError) Error

func (e *APIError) Error() string

type Account

type Account struct {
	ID               string  `json:"id"`
	Description      string  `json:"description"`
	Reference        string  `json:"reference"` // IBAN
	Product          string  `json:"product"`
	Currency         string  `json:"currency"`
	CurrentBalance   float64 `json:"currentBalance"`
	AvailableBalance float64 `json:"availableBalance"`
	Deprecated       bool    `json:"deprecated"`
}

Account represents a Ponto account.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the Ponto API client.

func NewClientFromContext

func NewClientFromContext(ctx context.Context) (*Client, error)

NewClientFromContext creates a client from context.

func (*Client) CreateSync

func (c *Client) CreateSync(ctx context.Context, accountID, subtype string) (*Synchronization, error)

CreateSync creates a new synchronization.

func (*Client) GetAccount

func (c *Client) GetAccount(ctx context.Context, id string) (*Account, error)

GetAccount returns a single account.

func (*Client) GetFinancialInstitution

func (c *Client) GetFinancialInstitution(ctx context.Context, id string) (*FinancialInstitution, error)

GetFinancialInstitution returns a single financial institution.

func (*Client) GetOrganization

func (c *Client) GetOrganization(ctx context.Context) (*Organization, error)

GetOrganization returns the organization info.

func (*Client) GetSync

func (c *Client) GetSync(ctx context.Context, id string) (*Synchronization, error)

GetSync returns a synchronization status.

func (*Client) GetTransaction

func (c *Client) GetTransaction(ctx context.Context, accountID, transactionID string) (*Transaction, error)

GetTransaction returns a single transaction.

func (*Client) ListAccounts

func (c *Client) ListAccounts(ctx context.Context) ([]Account, error)

ListAccounts returns all accounts.

func (*Client) ListFinancialInstitutions

func (c *Client) ListFinancialInstitutions(ctx context.Context) ([]FinancialInstitution, error)

ListFinancialInstitutions returns all financial institutions.

func (*Client) ListPendingTransactions

func (c *Client) ListPendingTransactions(ctx context.Context, accountID string) ([]PendingTransaction, error)

ListPendingTransactions returns pending transactions for an account.

func (*Client) ListSyncs

func (c *Client) ListSyncs(ctx context.Context, accountID string, limit int) ([]Synchronization, error)

ListSyncs returns recent synchronizations for an account.

func (*Client) ListTransactions

func (c *Client) ListTransactions(ctx context.Context, accountID string, opts TransactionListOptions) ([]Transaction, error)

ListTransactions returns transactions for an account.

func (*Client) WaitForSync

func (c *Client) WaitForSync(ctx context.Context, id string) (*Synchronization, error)

WaitForSync waits for a sync to complete.

type DataWrapper

type DataWrapper[T any] struct {
	Data T `json:"data"`
}

DataWrapper wraps a single resource.

type FinancialInstitution

type FinancialInstitution struct {
	ID              string `json:"id"`
	Name            string `json:"name"`
	Country         string `json:"country"`
	Status          string `json:"status"`
	MaintenanceFrom string `json:"maintenanceFrom,omitempty"`
	MaintenanceTo   string `json:"maintenanceTo,omitempty"`
}

FinancialInstitution represents a bank.

type Links struct {
	First string `json:"first,omitempty"`
	Last  string `json:"last,omitempty"`
	Prev  string `json:"prev,omitempty"`
	Next  string `json:"next,omitempty"`
}

Links for pagination.

type ListMeta

type ListMeta struct {
	Paging *Paging `json:"paging,omitempty"`
}

ListMeta contains pagination metadata.

type ListWrapper

type ListWrapper[T any] struct {
	Data  []T       `json:"data"`
	Links *Links    `json:"links,omitempty"`
	Meta  *ListMeta `json:"meta,omitempty"`
}

ListWrapper wraps a list of resources.

type Organization

type Organization struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Organization represents the user's organization.

type Paging

type Paging struct {
	Before string `json:"before,omitempty"`
	After  string `json:"after,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

Paging contains cursor info.

type PendingTransaction

type PendingTransaction struct {
	ID              string  `json:"id"`
	Amount          float64 `json:"amount"`
	Currency        string  `json:"currency"`
	Description     string  `json:"description"`
	CounterpartName string  `json:"counterpartName"`
	CounterpartRef  string  `json:"counterpartReference"`
	RemittanceInfo  string  `json:"remittanceInformation"`
	ValueDate       string  `json:"valueDate"`
}

PendingTransaction represents a pending transaction.

type Resource

type Resource struct {
	ID         string         `json:"id"`
	Type       string         `json:"type"`
	Attributes map[string]any `json:"attributes"`
}

Resource represents a JSON:API resource.

type RetryTransport

type RetryTransport struct {
	Base      http.RoundTripper
	NoRetry   bool
	BaseDelay time.Duration
}

RetryTransport wraps an http.RoundTripper with retry logic.

func NewRetryTransport

func NewRetryTransport(base http.RoundTripper, noRetry bool) *RetryTransport

NewRetryTransport creates a RetryTransport with defaults.

func (*RetryTransport) RoundTrip

func (t *RetryTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper with retry logic.

type Synchronization

type Synchronization struct {
	ID        string `json:"id"`
	Subtype   string `json:"subtype"`
	Status    string `json:"status"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
	Errors    []struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"errors,omitempty"`
}

Synchronization represents a sync operation.

type Transaction

type Transaction struct {
	ID                  string  `json:"id"`
	Amount              float64 `json:"amount"`
	Currency            string  `json:"currency"`
	Description         string  `json:"description"`
	CounterpartName     string  `json:"counterpartName"`
	CounterpartRef      string  `json:"counterpartReference"`
	RemittanceInfo      string  `json:"remittanceInformation"`
	RemittanceInfoType  string  `json:"remittanceInformationType"`
	EndToEndID          string  `json:"endToEndId"`
	InternalRef         string  `json:"internalReference"`
	BankTransactionCode string  `json:"bankTransactionCode"`
	ExecutionDate       string  `json:"executionDate"`
	ValueDate           string  `json:"valueDate"`
}

Transaction represents a Ponto transaction.

type TransactionListOptions

type TransactionListOptions struct {
	Since string
	Until string
	Limit int
}

TransactionListOptions for filtering transactions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL