workspaces

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package workspaces is a thin HTTP client for the cloud ledger workspace + journal endpoints (workspace-scoped /v1/workspaces surface, with the org-scoped /v1/orgs/{orgId}/workspaces read views). It backs the bitwave workspace + journal commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL       string
	OrgId         string
	TokenResolver func() (string, error)
	HTTPClient    *http.Client
}

Client wraps the cloud ledger workspace + journal HTTP endpoints.

func New

func New(baseURL, orgId string, tokenResolver func() (string, error)) *Client

New returns a Client with a 30s default timeout.

func (*Client) CreateJournal

func (c *Client) CreateJournal(workspaceId string, req CreateJournalRequest) (string, error)

CreateJournal creates a journal and returns its id.

func (*Client) CreateWorkspace

func (c *Client) CreateWorkspace(req CreateWorkspaceRequest) (CreateWorkspaceResult, error)

CreateWorkspace creates a new workspace and returns its id and URL.

func (*Client) GetWorkspace added in v0.3.0

func (c *Client) GetWorkspace(workspaceId string) (Workspace, error)

GetWorkspace fetches a single workspace by id via GET /v1/workspaces/{id}.

func (*Client) ListJournals

func (c *Client) ListJournals(workspaceId string) ([]Journal, error)

ListJournals returns the journals in a workspace.

func (*Client) ListWorkspaces

func (c *Client) ListWorkspaces() ([]Workspace, error)

ListWorkspaces returns all workspaces in the active org.

type CreateJournalRequest

type CreateJournalRequest struct {
	Id          string `json:"id,omitempty"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

CreateJournalRequest is the body for POST journals.

type CreateWorkspaceRequest

type CreateWorkspaceRequest struct {
	Name         string `json:"name"`
	BaseCurrency string `json:"baseCurrency"`
	OrgId        string `json:"orgId,omitempty"`
	// NotifyEmail, when set, asks the server to email the creator a link to
	// the new workspace. Omitted from the request when empty (e.g. agent
	// identities with no resolvable email).
	NotifyEmail string `json:"notifyEmail,omitempty"`
}

CreateWorkspaceRequest is the body for POST /v1/workspaces.

type CreateWorkspaceResult added in v0.3.0

type CreateWorkspaceResult struct {
	Id  string
	URL string
}

CreateWorkspaceResult is what CreateWorkspace returns: the new workspace id and its browser-facing URL. URL is empty on servers that predate the field.

type Journal

type Journal struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Journal is the minimal journal shape.

type Workspace

type Workspace struct {
	Id           string `json:"id"`
	OrgId        string `json:"orgId"`
	Name         string `json:"name"`
	BaseCurrency string `json:"baseCurrency"`
	// URL is the browser-facing workspace URL. Empty on older servers that
	// predate the field; callers must handle absence gracefully.
	URL string `json:"url"`
}

Workspace is the minimal shape used by the CLI.

Jump to

Keyboard shortcuts

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