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 ¶
- type Client
- func (c *Client) CreateJournal(workspaceId string, req CreateJournalRequest) (string, error)
- func (c *Client) CreateWorkspace(req CreateWorkspaceRequest) (CreateWorkspaceResult, error)
- func (c *Client) GetWorkspace(workspaceId string) (Workspace, error)
- func (c *Client) ListJournals(workspaceId string) ([]Journal, error)
- func (c *Client) ListWorkspaces() ([]Workspace, error)
- type CreateJournalRequest
- type CreateWorkspaceRequest
- type CreateWorkspaceResult
- type Journal
- type Workspace
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 (*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
GetWorkspace fetches a single workspace by id via GET /v1/workspaces/{id}.
func (*Client) ListJournals ¶
ListJournals returns the journals in a workspace.
func (*Client) ListWorkspaces ¶
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
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.