Documentation
¶
Overview ¶
Package client is the document plane's remote adapter: a document.Port implemented over the sheet API, so a frontend that can edit a local file can edit a document on a server without knowing the difference.
Its whole job is fidelity. Every refusal the embedded port returns as a sentinel, this one reconstructs from the response's RFC 9457 problem type, so the conformance suite can assert identical behaviour against both. A transport fault — unreachable server, unintelligible answer — is document.ErrUnavailable, which is never a statement about the document itself.
Reconstructing the document plane's errors from the wire: an entity tag becomes a revision, a body becomes a verified snapshot, and an RFC 9457 problem becomes the same sentinel the embedded port would have returned.
The client's transport mechanics: building one request, performing it, and reading its bounded body. The http.Response never escapes this file, so no caller can leak a connection by forgetting to close one.
Index ¶
- type BaseURL
- type Client
- func (c Client) Apply(ctx context.Context, doc document.DocPath, batch tsvsheet.Edits, ...) (document.Applied, error)
- func (c Client) Delete(ctx context.Context, doc document.DocPath, expect tsvsheet.RevisionHex) error
- func (c Client) Get(ctx context.Context, doc document.DocPath) (document.Snapshot, error)
- func (c Client) Put(ctx context.Context, doc document.DocPath, body []byte, expect document.Expect) (document.Snapshot, document.Created, error)
- type Doer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a document.Port over the sheet API.
func New ¶
New builds a client against base. A nil doer uses http.DefaultClient. The engine limits bound the local fold that verifies each accepted batch.
func NewWithLimits ¶
NewWithLimits builds a client whose local verification fold is bounded by the given limits, which should match the server's so the two agree about what a batch may do.
func (Client) Apply ¶
func (c Client) Apply( ctx context.Context, doc document.DocPath, batch tsvsheet.Edits, expect tsvsheet.RevisionHex, ) (document.Applied, error)
Apply folds an edits batch over the document at the expected revision.
func (Client) Delete ¶
func (c Client) Delete(ctx context.Context, doc document.DocPath, expect tsvsheet.RevisionHex) error
Delete removes the document at the expected revision.