api

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package api exposes stable HTTP API contracts shared by the Looper CLI and daemon.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope[T any] struct {
	OK        bool   `json:"ok"`
	Data      *T     `json:"data,omitempty"`
	Error     *Error `json:"error,omitempty"`
	RequestID string `json:"requestId"`
}

func Failure

func Failure(requestID string, code ErrorCode, message string, details any) Envelope[any]

func Success

func Success[T any](requestID string, data T) Envelope[T]

type Error

type Error struct {
	Code    ErrorCode `json:"code"`
	Message string    `json:"message"`
	Details any       `json:"details,omitempty"`
}

type ErrorCode

type ErrorCode string
const (
	ErrorCodeActiveRunNotFound          ErrorCode = "ACTIVE_RUN_NOT_FOUND"
	ErrorCodeAgentNotConfigured         ErrorCode = "AGENT_NOT_CONFIGURED"
	ErrorCodeAuthMisconfigured          ErrorCode = "AUTH_MISCONFIGURED"
	ErrorCodeConfigConflict             ErrorCode = "CONFIG_CONFLICT"
	ErrorCodeInternalError              ErrorCode = "INTERNAL_ERROR"
	ErrorCodeLoopConflict               ErrorCode = "LOOP_CONFLICT"
	ErrorCodeLoopNotFound               ErrorCode = "LOOP_NOT_FOUND"
	ErrorCodeMethodNotAllowed           ErrorCode = "METHOD_NOT_ALLOWED"
	ErrorCodeProjectAmbiguous           ErrorCode = "PROJECT_AMBIGUOUS"
	ErrorCodeProjectIDConflict          ErrorCode = "PROJECT_ID_CONFLICT"
	ErrorCodeProjectNotFound            ErrorCode = "PROJECT_NOT_FOUND"
	ErrorCodeProjectsUnavailable        ErrorCode = "PROJECTS_UNAVAILABLE"
	ErrorCodePRNotFound                 ErrorCode = "PR_NOT_FOUND"
	ErrorCodePullRequestNotFound        ErrorCode = "PULL_REQUEST_NOT_FOUND"
	ErrorCodePullRequestProjectMismatch ErrorCode = "PULL_REQUEST_PROJECT_MISMATCH"
	ErrorCodeRouteNotFound              ErrorCode = "ROUTE_NOT_FOUND"
	ErrorCodeRequestTooLarge            ErrorCode = "REQUEST_TOO_LARGE"
	ErrorCodeRunNotFound                ErrorCode = "RUN_NOT_FOUND"
	ErrorCodeRuntimeControlUnavailable  ErrorCode = "RUNTIME_CONTROL_UNAVAILABLE"
	ErrorCodeServiceUnavailable         ErrorCode = "SERVICE_UNAVAILABLE"
	ErrorCodeUnauthorized               ErrorCode = "UNAUTHORIZED"
	ErrorCodeValidationFailed           ErrorCode = "VALIDATION_FAILED"
)

func AllErrorCodes

func AllErrorCodes() []ErrorCode

func (ErrorCode) Status

func (c ErrorCode) Status() int

func (ErrorCode) String

func (c ErrorCode) String() string

Jump to

Keyboard shortcuts

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