wardapi

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 (
	CodeUnauthorized     Code = "unauthorized"
	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"
	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.

type LandState

type LandState string

LandState is the state of a land.

const (
	LandQueued   LandState = "queued"
	LandChecking LandState = "checking"
	LandLanding  LandState = "landing"
	LandLanded   LandState = "landed"
	LandFailed   LandState = "failed"
)

func (LandState) Ended

func (s LandState) Ended() bool

Ended reports whether the land has ended.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL