api

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternal = errors.New("internal server error")
)

Functions

func DiscardRequest added in v0.16.0

func DiscardRequest(r *http.Request)

func NewOpenApiDefinitionHandler

func NewOpenApiDefinitionHandler(baseURL string) (http.HandlerFunc, error)

func RegisterGithubWebhookHandler added in v0.16.0

func RegisterGithubWebhookHandler(router chi.Router, secretKey []byte, ws *service.WebhookService)

RegisterGithubWebhookHandler registers the handler with a github.com/go-chi/chi/v5.Router.

func RegisterGitlabWebhookHandler added in v0.16.0

func RegisterGitlabWebhookHandler(router chi.Router, token string, ws *service.WebhookService)

RegisterGitlabWebhookHandler registers the handler with a github.com/go-chi/chi/v5.Router.

func RegisterHealthRoute added in v0.12.0

func RegisterHealthRoute(router chi.Router)

func RegisterOpenAPIDefinitionRoute

func RegisterOpenAPIDefinitionRoute(baseURL string, router chi.Router) error

Types

type APIServer added in v0.16.0

type APIServer struct {
	Clock         clock.Clock
	TaskService   *service.TaskService
	WorkerService *service.WorkerService
}

APIServer provides the implementation of the OpenAPI endpoints.

func RegisterAPIServer added in v0.16.0

func RegisterAPIServer(options *NewAPIServerOptions) (http.Handler, *APIServer)

RegisterAPIServer registers the OpenAPI implementation with the router.

func (*APIServer) GetRunV1 added in v0.18.0

GetRunV1 implements openapi.ServerInterface.

func (*APIServer) GetTaskV1 added in v0.16.0

GetTaskV1 implements openapi.ServerInterface.

func (*APIServer) GetWorkV1 added in v0.16.0

func (*APIServer) ListTaskRecentTaskResultsV1 added in v0.20.0

ListTaskRecentTaskResultsV1 lists recent run results of a task by repository.

func (*APIServer) ListTaskResultsV1 added in v0.18.0

ListTaskResultsV1 implements openapi.ServerInterface.

func (*APIServer) ListTasksV1 added in v0.16.0

ListTasksV1 implements openapi.ServerInterface.

func (*APIServer) ReportWorkV1 added in v0.16.0

func (*APIServer) Stop added in v0.29.0

func (a *APIServer) Stop(ctx context.Context, checkInterval time.Duration) error

Stop gracefully stops the API server.

type GithubWebhookHandler added in v0.16.0

type GithubWebhookHandler struct {
	SecretKey      []byte
	WebhookService *service.WebhookService
}

GithubWebhookHandler handles webhooks sent by GitHub.

func (*GithubWebhookHandler) HandleWebhook added in v0.16.0

func (h *GithubWebhookHandler) HandleWebhook(w http.ResponseWriter, r *http.Request)

HandleWebhook parses and validates a webhook sent by GitHub. If the webhook is valid, it sends the webhook on for processing.

type GitlabWebhookHandler added in v0.16.0

type GitlabWebhookHandler struct {
	SecretToken    string
	WebhookService *service.WebhookService
}

GitlabWebhookHandler handles webhooks sent by GitLab.

func (*GitlabWebhookHandler) HandleWebhook added in v0.16.0

func (gh *GitlabWebhookHandler) HandleWebhook(w http.ResponseWriter, r *http.Request)

HandleWebhook parses and validates a webhook sent by GitLab. If the webhook is valid, it sends the webhook on for processing. A webhook is considered valid if: * The secret token from the request matches the configured secret token. * The HTTP method is POST.

type NewAPIServerOptions added in v0.16.0

type NewAPIServerOptions struct {
	ApiKey        string
	Clock         clock.Clock
	Router        chi.Router
	TaskService   *service.TaskService
	WorkerService *service.WorkerService
}

NewAPIServerOptions are passed to RegisterAPIServer.

Directories

Path Synopsis
Package openapi provides primitives to interact with the openapi HTTP API.
Package openapi provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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