Documentation
¶
Overview ¶
Package client is the Go client of the daemon's API, over its Unix socket.
Index ¶
- Constants
- Variables
- func Kickstart() string
- func UnixTransport(socket string) *http.Transport
- type Client
- func (c *Client) ActOnPlan(ctx context.Context, req api.PlanActRequest) (api.PlanResponse, error)
- func (c *Client) Action(ctx context.Context, u unit.Unit, action string, req api.ActionRequest) ([]string, error)
- func (c *Client) Actions(ctx context.Context) (api.ActionsResponse, error)
- func (c *Client) Ask(ctx context.Context, u unit.Unit, action string, req api.ActionRequest) (api.ActionResult, error)
- func (c *Client) Capture(ctx context.Context, req api.CaptureRequest) (api.EntryView, error)
- func (c *Client) Catalog(ctx context.Context) (api.CatalogResponse, error)
- func (c *Client) Counters(ctx context.Context, area string) (api.Counters, error)
- func (c *Client) CreateDraft(ctx context.Context, req api.DraftCreate) (api.Draft, error)
- func (c *Client) Digest(ctx context.Context, day string) (api.Digest, error)
- func (c *Client) Doctor(ctx context.Context, q api.DoctorQuery) (api.DoctorReport, error)
- func (c *Client) Draft(ctx context.Context, id int64) (api.Draft, error)
- func (c *Client) DraftDo(ctx context.Context, id int64, action string, req api.DraftAction) (api.Draft, error)
- func (c *Client) Drafts(ctx context.Context, states ...string) ([]api.Draft, error)
- func (c *Client) DryRunTurn(ctx context.Context, req api.DryRunTurnRequest) (api.DryRunTurn, error)
- func (c *Client) EndTurn(ctx context.Context, handle string, req api.TurnEndRequest) (api.TurnEnded, error)
- func (c *Client) EntriesSince(ctx context.Context, q EntryQuery, since api.Since) (api.EntriesPage, error)
- func (c *Client) Entry(ctx context.Context, id string) (api.EntryView, error)
- func (c *Client) EntryDo(ctx context.Context, id, verb string, req api.EntryRequest) (api.EntryResult, error)
- func (c *Client) EntryDrafts(ctx context.Context, entry string) ([]api.Draft, error)
- func (c *Client) Events(ctx context.Context, client string, since api.Since) (<-chan api.Change, error)
- func (c *Client) Explore(ctx context.Context, query string) (api.ExploreResult, error)
- func (c *Client) Facts(ctx context.Context, ref pr.Ref) (api.Facts, error)
- func (c *Client) GTD(ctx context.Context) (api.GTDCatalog, error)
- func (c *Client) Health(ctx context.Context) (api.Health, error)
- func (c *Client) Intake(ctx context.Context, seq int64, after int, wait time.Duration) (api.Intake, error)
- func (c *Client) IntakeCancel(ctx context.Context, seq int64) error
- func (c *Client) IntakeWithout(ctx context.Context, seq int64) error
- func (c *Client) Keys(ctx context.Context, surface string) (api.KeysResponse, error)
- func (c *Client) Meter(ctx context.Context) (api.MeterReport, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Plan(ctx context.Context, q api.PlanQuery) (api.PlanResponse, error)
- func (c *Client) Plugins(ctx context.Context) ([]api.Plugin, error)
- func (c *Client) Probe(ctx context.Context, req api.ProbeRequest) (api.ProbeResult, error)
- func (c *Client) Prompt(ctx context.Context, handle string, req api.PromptRequest) error
- func (c *Client) RecordGitAccess(ctx context.Context, r api.GitAccessRecord) error
- func (c *Client) ReportApp(ctx context.Context, st api.AppStatus) error
- func (c *Client) Review(ctx context.Context) (api.Review, error)
- func (c *Client) ReviewStepDone(ctx context.Context, step string) (api.Review, error)
- func (c *Client) Rows(ctx context.Context) ([]api.Row, error)
- func (c *Client) RowsSince(ctx context.Context, since api.Since) (api.RowsPage, error)
- func (c *Client) SessionStart(ctx context.Context, handle string, req api.SessionStartRequest) error
- func (c *Client) SetPause(ctx context.Context, req api.PauseRequest) error
- func (c *Client) StartTurn(ctx context.Context, handle string, req api.TurnStartRequest) (api.TurnText, error)
- func (c *Client) Stop(ctx context.Context, handle string, req api.StopRequest) (api.StopAnswer, error)
- func (c *Client) Timings(ctx context.Context, days int) (api.TimingsReport, error)
- func (c *Client) Trigger(ctx context.Context, job string) error
- func (c *Client) TurnAnswer(ctx context.Context, handle, arg string) (api.TurnText, error)
- func (c *Client) TurnBook(ctx context.Context, ref pr.Ref) (api.TurnBook, error)
- func (c *Client) TurnByHand(ctx context.Context, handle string, req api.ByHandRequest) (api.ByHandResult, error)
- type EntryQuery
Constants ¶
const ( // ReadTimeout outlasts the daemon's start-up reconcile, which holds // UserAPI for up to 30 seconds. ReadTimeout = 45 * time.Second )
Variables ¶
var DaemonLabel = brand.LaunchAgent()
DaemonLabel is the launchd label of the daemon's LaunchAgent.
var ErrDown = fmt.Errorf(brand.Name+"'s daemon is not running; start it with `%s` (installed by `"+brand.Command+" app install`), or run `"+brand.Command+" serve` in a terminal", Kickstart())
ErrDown is a daemon that does not listen on the socket.
Functions ¶
func UnixTransport ¶
UnixTransport sends every request to the daemon's Unix socket.
Types ¶
type Client ¶
type Client struct {
// Manager names the workspace manager of the agent session the client
// calls for, "" when unknown; it goes with every call that names a handle.
Manager string
// contains filtered or unexported fields
}
Client talks to the daemon over its Unix socket.
func (*Client) ActOnPlan ¶
func (c *Client) ActOnPlan(ctx context.Context, req api.PlanActRequest) (api.PlanResponse, error)
ActOnPlan acts on plan items and returns them as the action left them, with an error line per item it could not act on.
func (*Client) Action ¶
func (c *Client) Action(ctx context.Context, u unit.Unit, action string, req api.ActionRequest) ([]string, error)
Action returns the lines the action reported.
func (*Client) Ask ¶
func (c *Client) Ask(ctx context.Context, u unit.Unit, action string, req api.ActionRequest) (api.ActionResult, error)
Ask runs the action and returns the daemon's answer whole: the intake that accepted it, for a review, an address or a run.
func (*Client) CreateDraft ¶
CreateDraft holds a draft the user wrote in the Outbox, or approves it at once with req.Send.
func (*Client) Doctor ¶
func (c *Client) Doctor(ctx context.Context, q api.DoctorQuery) (api.DoctorReport, error)
Doctor runs doctor's checks that read the loop's state.
func (*Client) DraftDo ¶
func (c *Client) DraftDo(ctx context.Context, id int64, action string, req api.DraftAction) (api.Draft, error)
DraftDo runs action, one of api.DraftActions, on draft id.
func (*Client) Drafts ¶
Drafts are the drafts in states, newest first; no state lists the proposed and failed ones.
func (*Client) DryRunTurn ¶
func (c *Client) DryRunTurn(ctx context.Context, req api.DryRunTurnRequest) (api.DryRunTurn, error)
DryRunTurn has the daemon store the review turn of a profile try.
func (*Client) EntriesSince ¶
func (c *Client) EntriesSince(ctx context.Context, q EntryQuery, since api.Since) (api.EntriesPage, error)
EntriesSince is q's page since: every entry when since is zero or the daemon answers Full, else the entries changed after it and the ids that left the view.
func (*Client) EntryDo ¶
func (c *Client) EntryDo(ctx context.Context, id, verb string, req api.EntryRequest) (api.EntryResult, error)
EntryDo runs verb on entry id.
func (*Client) EntryDrafts ¶
EntryDrafts are the drafts made for entry in any state, newest first.
func (*Client) Events ¶
func (c *Client) Events(ctx context.Context, client string, since api.Since) (<-chan api.Change, error)
Events delivers each change the daemon publishes, those not yet received merged into one, and closes the channel when the stream ends, goes silent or ctx is done. A non-zero since resumes from there: the first change says what was missed. The daemon knows the subscriber by client.
func (*Client) Intake ¶
func (c *Client) Intake(ctx context.Context, seq int64, after int, wait time.Duration) (api.Intake, error)
Intake reads intake seq with its log lines past after, waiting up to wait for a new line or its end.
func (*Client) IntakeWithout ¶
IntakeWithout starts a waiting intake without the brief.
func (*Client) Plan ¶
Plan is the workflows' plan: with q.Trigger, what an evaluation of that trigger would decide now, changing nothing; without it, the stored plan.
func (*Client) Probe ¶
func (c *Client) Probe(ctx context.Context, req api.ProbeRequest) (api.ProbeResult, error)
Probe has the daemon send a probe turn; it waits on the loop like an action.
func (*Client) RecordGitAccess ¶
RecordGitAccess has the daemon keep a git access outcome this process saw.
func (*Client) ReviewStepDone ¶
ReviewStepDone marks step done in the current Review.
func (*Client) RowsSince ¶
RowsSince is the page of rows since: every row when since is zero or the daemon answers Full, else the rows changed after it and the units that left.
func (*Client) SessionStart ¶
func (*Client) StartTurn ¶
func (c *Client) StartTurn(ctx context.Context, handle string, req api.TurnStartRequest) (api.TurnText, error)
StartTurn starts the stored turn of a round on the handle's session and returns its instructions.
func (*Client) Stop ¶
func (c *Client) Stop(ctx context.Context, handle string, req api.StopRequest) (api.StopAnswer, error)
func (*Client) TurnAnswer ¶
TurnAnswer reads the newest answer to the caller's turn on the unit arg names: a pull request URL or "<provider>:<key>".
func (*Client) TurnByHand ¶
func (c *Client) TurnByHand(ctx context.Context, handle string, req api.ByHandRequest) (api.ByHandResult, error)
TurnByHand has the daemon run a turn the user asked for in the handle's session; it waits on the loop like an action.
type EntryQuery ¶
EntryQuery selects a view's entries; Contexts must all match, and the Inbox ignores Area.