api

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api implements the New Expensify web API and device-session renewal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(options Options) (*Client, error)

New validates the destination before credentials can be sent to it.

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context) (config.Credentials, error)

Authenticate exchanges stored device credentials for a fresh session token.

func (*Client) Call

func (c *Client) Call(ctx context.Context, command string, params url.Values) (map[string]any, error)

Call sends one command. An expired session is renewed and replayed once. Transport errors and server errors are never retried, since writes may succeed before a connection is lost.

func (*Client) Credentials

func (c *Client) Credentials() config.Credentials

Credentials returns a snapshot of the current session, including renewals.

func (*Client) Read added in v0.3.0

func (c *Client) Read(ctx context.Context, command string, params url.Values) (map[string]any, error)

Read identifies commands routed through Expensify's API.read interface.

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, command string, params url.Values, field, filePath string) (map[string]any, error)

Upload sends a JPEG, PNG, or PDF receipt as streaming multipart data. A file is reopened on session renewal, and changes between attempts are rejected.

type Options

type Options struct {
	BaseURL         string
	HTTPClient      *http.Client
	Credentials     config.Credentials
	SaveCredentials func(config.Credentials) error
}

Options configures a client. SaveCredentials runs after successful renewal.

Jump to

Keyboard shortcuts

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