api

package
v0.0.0-...-f4be871 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageTypeInfo    = "info"
	MessageTypeWarning = "warning"
	MessageTypeError   = "error"
)
View Source
const (
	SlugBuildFailed          = "build-failed"
	SlugGetBuildStatusFailed = "get-build-status-failed"
	SlugBuildStatusNotFound  = "build-status-not-found"
	SlugJSONDecodeFailed     = "json-decode-failed"
	SlugTypeError            = "type-error"
)

Variables

View Source
var APIPath = &serviceEndpointPath{}

Functions

This section is empty.

Types

type Message

type Message struct {
	Type    string `json:"type"` // info, warning, error
	Slug    string `json:"slug"`
	Title   string `json:"title"`
	Message string `json:"message"`
}

func (Message) ToMap

func (m Message) ToMap() map[string]interface{}

convert a Message to map[string]interface{}

type RESTApiV1

type RESTApiV1 struct {
	// contains filtered or unexported fields
}

func NewRESTApiV1

func NewRESTApiV1(opts RESTApiV1Options) *RESTApiV1

func (*RESTApiV1) Build

func (a *RESTApiV1) Build(resp http.ResponseWriter, req *http.Request)

Build is the handler for the /api/v1/build endpoint

func (*RESTApiV1) GetAllAPIs

func (a *RESTApiV1) GetAllAPIs() []string

func (*RESTApiV1) IndexPage

func (a *RESTApiV1) IndexPage(resp http.ResponseWriter, _ *http.Request)

IndexPage implements GET /

func (*RESTApiV1) Serve

func (a *RESTApiV1) Serve(addr, originAllowed string) error

func (*RESTApiV1) Shutdown

func (a *RESTApiV1) Shutdown() error

Shutdown stops the API server

func (*RESTApiV1) Status

func (a *RESTApiV1) Status(resp http.ResponseWriter, req *http.Request)

Status is the handler for the /api/v1/status/{image_id} endpoint

type RESTApiV1Options

type RESTApiV1Options struct {
	ProductionMode bool
	Logger         *zap.Logger
	Builder        *builder.Builder
}

Jump to

Keyboard shortcuts

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