Documentation
¶
Overview ¶
Package service makes every request the Go doit sends to doit's service. It is written by hand against the wire contract that the Python client keeps.
A route's call is a method on Client that names its path and the Go type of its answer. The verb needs every field that type declares without omitempty. A Go release can reach a desk before the cluster rolls the matching service. So Get refuses an answer that lacks such a field, rather than drawing it empty, and names the field and the service's version.
Index ¶
Constants ¶
const NoAnswerExit = 4
NoAnswerExit is what a command exits with where no answer came, the one failure that the same command run later can outlast.
const Prefix = "/api/v1"
Prefix is where every route sits, the OpenAPI document among them. deploy/api.yaml names the paths the cluster routes to the service.
Variables ¶
This section is empty.
Functions ¶
func ExitCode ¶
ExitCode is what a command exits with for err: NoAnswerExit where no answer came, else 1.
func LaterSendCanStore ¶ added in v0.3.0
LaterSendCanStore is whether the same write sent later could be stored: no answer came, the login was refused, or the service broke. A refusal of the write itself is refused again however often it is sent.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is one authenticated client of the service at base.
func New ¶
func New(base string, source oauth2.TokenSource, chosenBy, repair string) *Client
New is a client of the service at base, sending source's token. chosenBy says where base came from, and repair what fixes a refused token.
func (*Client) Get ¶
Get reads the route at path into answer, refusing an answer that lacks a field answer's type declares without omitempty.
func (*Client) Post ¶ added in v0.3.0
func (c *Client) Post(ctx context.Context, path string, body any, repeatable bool, answer any) error
Post sends body to the route at path and reads the answer into answer, which may be nil. The service stores a repeatable write once by the key in its body, so it is sent again after a timeout, a reset or a busy answer. Any other write is sent again only where it never reached the service.
type MissingField ¶
type MissingField struct {
Where string
Route string
Field string
Version string
// VersionUnread is why the service's version could not be read, where it could not.
VersionUnread error
}
MissingField is an answer that lacks a field which the verb needs.
func (*MissingField) Error ¶
func (m *MissingField) Error() string