Documentation
¶
Index ¶
- type Client
- func (f *Client) CreateTask(_ context.Context, task vaultapi.Task, _ vaultapi.CreateOptions) (*vaultapi.Task, error)
- func (f *Client) LastPatchFields() map[string]any
- func (f *Client) ListTasks(_ context.Context, _ vaultapi.Filter) ([]vaultapi.Task, error)
- func (f *Client) ListTasksCallCount() int
- func (f *Client) PatchTask(_ context.Context, id string, fields map[string]any) (*vaultapi.Task, error)
- func (f *Client) PatchTaskWithBody(_ context.Context, id string, fields map[string]any, body string) (*vaultapi.Task, error)
- func (f *Client) PatchTaskWithBodyCallCount() int
- func (f *Client) PutBody(_ context.Context, id string, body string) error
- func (f *Client) ReadTask(_ context.Context, id string) (*vaultapi.Task, error)
- func (f *Client) ReadTaskAt(ctx context.Context, id string, _ string) (*vaultapi.Task, error)
- func (f *Client) ReadTaskCallCount() int
- func (f *Client) ReaddressTask(_ context.Context, id string, next string, previous string) (*vaultapi.Task, error)
- func (f *Client) Seed(files map[string][]byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Dir string
// Only restricts the listing to these vault-relative paths when non-empty.
// Specs use it to model an index that sees a narrower set than the whole dir.
Only []string
// ListErr makes the listing fail, for specs that assert an error path.
ListErr error
// ReadErrOn makes a read of the named task fail, for specs that model a
// transient failure the caller must not mistake for absence.
ReadErrOn map[string]error
// PatchErr makes every typed write fail, for specs that assert the caller
// swallows a write error.
PatchErr error
// RejectPatchFields models vault-api's PATCH allowlist: a write naming any of
// these keys fails whole, exactly as fieldRefusal refuses it. Left nil, every
// key is accepted, which is the behaviour the other specs were written against.
RejectPatchFields map[string]bool
// contains filtered or unexported fields
}
Client serves vaultapi.Client from a directory of markdown files.
func (*Client) CreateTask ¶
func (f *Client) CreateTask( _ context.Context, task vaultapi.Task, _ vaultapi.CreateOptions, ) (*vaultapi.Task, error)
CreateTask writes a new task file named after the title.
func (*Client) LastPatchFields ¶ added in v0.33.6
LastPatchFields reports the field map of the most recent typed write, so a spec can assert on what the caller sent rather than inferring it from the file.
func (*Client) ListTasksCallCount ¶
ListTasksCallCount reports how many listings were issued.
func (*Client) PatchTask ¶
func (f *Client) PatchTask( _ context.Context, id string, fields map[string]any, ) (*vaultapi.Task, error)
PatchTask replaces the named frontmatter fields.
func (*Client) PatchTaskWithBody ¶
func (f *Client) PatchTaskWithBody( _ context.Context, id string, fields map[string]any, body string, ) (*vaultapi.Task, error)
PatchTaskWithBody replaces the named fields and the body in one write.
func (*Client) PatchTaskWithBodyCallCount ¶
PatchTaskWithBodyCallCount reports how many typed writes were issued.
func (*Client) ReadTaskAt ¶ added in v0.33.3
ReadTaskAt returns the task addressed by identifier or title.
The in-memory vault has no commits, so the committed view and the working tree are the same state here; a spec that needs them to differ stubs the client instead of using this one.
func (*Client) ReadTaskCallCount ¶
ReadTaskCallCount reports how many single-task reads were issued.