workspaceshare

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: 13 Imported by: 0

Documentation

Overview

Package workspaceshare is the bitwave HTTP client for the cloud ledger workspace share-and-adopt endpoints:

  • POST /v1/workspaces:share (multipart, unauthenticated)
  • POST /v1/workspaces/{id}:accept (JSON, bearer-authenticated)

The share path is intentionally unauthenticated — bitwave in local mode has no org context to attach. The recipient email is the gate, and an out-of-band magic-link mailer is expected to deliver the viewer URL to the recipient.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptResponse

type AcceptResponse struct {
	WorkspaceId   string `json:"workspaceId"`
	WorkflowId    string `json:"workflowId"`
	WorkflowRunId string `json:"workflowRunId"`
}

AcceptResponse is the JSON body the cloud ledger returns from /v1/workspaces/{id}:accept.

type Client

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

Client wraps both share + adopt calls. Upload is anonymous; Adopt threads a bearer token through TokenResolver.

func New

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

New constructs a client. Pass a TokenResolver only if you intend to call Adopt — Upload skips the Authorization header regardless.

func (*Client) Adopt

func (c *Client) Adopt(ctx context.Context, workspaceId, newName string) (*AcceptResponse, error)

Adopt accepts a shared workspace. Authentication is required — the recipient must be logged in as the principal that received the magic link.

func (*Client) UploadAndShare

func (c *Client) UploadAndShare(ctx context.Context, workspaceDir, recipientEmail, message string) (*UploadResponse, error)

UploadAndShare zips the workspace directory and posts it as multipart form data. The server validates + stashes the zip + writes a PENDING workspace row; the returned URL is what the agent emails to the recipient (today it's informational only — the public viewer is a follow-up).

Only `.bitwave.toml`, `accounts.ledger`, `prices.ledger`, `*.journal`, and `*.ledger` are included. Wallet/credential files are refused at the server allowlist gate too, but the client filters them first so a misnamed file doesn't blow the upload.

type UploadResponse

type UploadResponse struct {
	WorkspaceId    string `json:"workspaceId"`
	RecipientId    string `json:"recipientId"`
	EmailDelivered bool   `json:"emailDelivered"`
}

UploadResponse is the JSON body the cloud ledger returns from /v1/workspaces:share. The server blocks on the share workflow before responding, so the CLI sees the final delivery status — the resolved recipient and whether the invite email was sent — rather than just a workflow handle.

Jump to

Keyboard shortcuts

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