api

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 0 Imported by: 0 modules, 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 api holds the JSON bodies of badil's HTTP API, shared by the server and its clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeployRequest

type DeployRequest struct {
	Service        string `json:"service"`
	HeadRef        string `json:"head_ref"`
	CommitSha      string `json:"commit_sha"`
	PRAuthor       string `json:"pr_author"`
	PRURL          string `json:"pr_url"`
	PRNumber       string `json:"pr_number"`
	WorkflowRunURL string `json:"workflow_run_url"`
}

DeployRequest is the body of POST /v1/deploy. All fields are required; the server stamps timestamp from time.Now() so retries don't drift.

type DeployResponse

type DeployResponse struct {
	PreviewSlug     string   `json:"preview_slug"`
	GitOpsCommitURL string   `json:"gitops_commit_url"`
	Warnings        []string `json:"warnings,omitempty"`
}

DeployResponse is the success body. Warnings is populated when the values write succeeded but the comment fan-out had partial failures.

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse is the failure body for every non-2xx response.

type PRJSON

type PRJSON struct {
	Repo   string `json:"repo"`
	Number int    `json:"number"`
	URL    string `json:"url"`
}

PRJSON is a pull request: owner/repo, number and URL, from the pr-url of the entry.

type PinnedJSON

type PinnedJSON struct {
	SHA    string `json:"sha"`
	PR     PRJSON `json:"pr"`
	Author string `json:"author"`
}

PinnedJSON is the pin of a pinned entry: its commit and the PR that pinned it.

type PreviewEntryJSON

type PreviewEntryJSON struct {
	Name     string      `json:"name"`
	Kind     string      `json:"kind"`
	Pinned   *PinnedJSON `json:"pinned,omitempty"`
	Branch   string      `json:"branch,omitempty"`
	URL      string      `json:"url,omitempty"`
	Status   string      `json:"status"`
	Revision string      `json:"revision,omitempty"`
	StatusAt string      `json:"statusAt,omitempty"`
}

PreviewEntryJSON is a service or dependency entry of a preview.

type PreviewJSON

type PreviewJSON struct {
	Slug      string             `json:"slug"`
	CreatedAt string             `json:"createdAt,omitempty"`
	UpdatedAt string             `json:"updatedAt,omitempty"`
	ExpiresAt string             `json:"expiresAt,omitempty"`
	Services  []PreviewEntryJSON `json:"services"`
}

PreviewJSON is a preview in the read API: its file in the gitops clone and its status in memory. CreatedAt and UpdatedAt are the oldest created-at and the newest updated-at of its pinned entries, and ExpiresAt is UpdatedAt plus the in-server sweep's TTL; each is omitted when unknown.

type PreviewList

type PreviewList struct {
	Previews []PreviewJSON `json:"previews"`
}

PreviewList is the body of GET /v1/previews.

type StatusEvent

type StatusEvent struct {
	APIVersion string `json:"apiVersion"`
	Preview    string `json:"preview"`
	Service    string `json:"service"`
	Revision   string `json:"revision"`
	Status     string `json:"status"`
	At         string `json:"at"`
}

StatusEvent is the body of POST /webhooks/status: the status a renderer reports for one service of a preview, at a revision.

type SyncRequest

type SyncRequest struct {
	Slug *string `json:"slug"`
}

SyncRequest is the optional body of POST /v1/sync. Without a slug, every preview is synced.

type SyncResponse

type SyncResponse struct {
	Synced    []string `json:"synced"`
	Unchanged int      `json:"unchanged"`
	Failed    []string `json:"failed"`
}

SyncResponse is the success body of POST /v1/sync: the slugs rewritten, the number of previews left unchanged and the slugs that failed.

type WaitEntryJSON

type WaitEntryJSON struct {
	Name     string `json:"name"`
	Kind     string `json:"kind"`
	Status   string `json:"status"`
	Revision string `json:"revision,omitempty"`
	Ready    bool   `json:"ready"`
	URL      string `json:"url,omitempty"`
}

WaitEntryJSON is an entry of a wait set: its latest status ("unknown" when none) and revision, whether it is ready, and its URL.

type WaitResponse

type WaitResponse struct {
	State    string            `json:"state"`
	Reason   string            `json:"reason,omitempty"`
	Slug     string            `json:"slug,omitempty"`
	SHA      string            `json:"sha,omitempty"`
	Services []WaitEntryJSON   `json:"services"`
	URLs     map[string]string `json:"urls"`
}

WaitResponse is the body of a wait's answer: its state, the reason of a failed, refused or skipped state, the preview and the SHA waited for when known, and the wait set's entries with the URLs of those that have one.

Jump to

Keyboard shortcuts

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