Documentation
¶
Overview ¶
Package wardapi holds the wire types of the ward HTTP API that a caller and the server share: the land request, the land view and the error body with its codes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckStatus ¶
type CheckStatus string
CheckStatus is the state of one check for one tree.
const ( CheckPending CheckStatus = "pending" CheckPass CheckStatus = "pass" CheckFail CheckStatus = "fail" CheckFlaky CheckStatus = "flaky" )
type Code ¶
type Code string
Code is the code of an error. It is the same text in an error body and in the error of a failed land.
const ( CodeForbidden Code = "forbidden" CodeNotFound Code = "not_found" CodeInvalidBody Code = "invalid_body" CodeMethodNotAllowed Code = "method_not_allowed" CodeInternal Code = "internal_error" CodeLandConflict Code = "land_conflict" CodeLandInvalid Code = "land_invalid" CodeRefNotAllowed Code = "ref_not_allowed" CodeRequiredMissing Code = "required_check_missing" CodeLandIDInUse Code = "land_id_in_use" CodeLandTimeout Code = "land_timeout" CodeLeaseLost Code = "lease_lost" CodeCheckFailed Code = "check_failed" CodeLandStale Code = "land_stale" )
type Error ¶
type Error struct {
Code Code `json:"code"`
Message string `json:"message"`
Details map[string]any `json:"details"`
}
Error is the error of a response and the error of a land that failed.
type ErrorBody ¶
type ErrorBody struct {
Error Error `json:"error"`
}
ErrorBody is the body of every error response.
type Land ¶
type Land struct {
ID string `json:"id"`
Repo string `json:"repo"`
Ref string `json:"ref"`
Branch string `json:"branch"`
State LandState `json:"state"`
Tree string `json:"tree"`
Checks []LandCheck `json:"checks"`
Tip string `json:"tip"`
Generation int64 `json:"generation"`
FastForward bool `json:"fast_forward"`
Commits []api.LandedCommit `json:"commits"`
BranchDeleted bool `json:"branch_deleted"`
Error *Error `json:"error"`
}
Land is the view of a land that the API answers.
type LandCheck ¶
type LandCheck struct {
Name string `json:"name"`
State CheckStatus `json:"state"`
}
LandCheck is one required check of a land and its status.
type LandRequest ¶
type LandRequest struct {
ID string `json:"id,omitempty"`
Repo string `json:"repo"`
Ref string `json:"ref"`
Branch string `json:"branch"`
// Base is the commit that the branch was built on: the merge base of the branch and the ref, which the caller finds
// with git from its own history.
Base string `json:"base,omitempty"`
DeleteBranch bool `json:"delete_branch"`
}
LandRequest is the body of POST /v1/lands.