api

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMustAuth = &types.ErrHTTP{
	Code:    http.StatusUnauthorized,
	Message: "unauthorized request, must authenticate",
}

Functions

func IsConflict

func IsConflict(err error) bool

func IsHTTPCode

func IsHTTPCode(err error, code int) bool

func Watch

func Watch[T client.Object](r Context, list client.ObjectList) (<-chan T, error)

Types

type Context

type Context struct {
	http.ResponseWriter
	*http.Request
	GPTClient  *gptscript.GPTScript
	Storage    storage.Client
	User       user.Info
	APIBaseURL string
}

func (*Context) Accepts

func (r *Context) Accepts(contentType string) bool

func (*Context) AuthProviderID

func (r *Context) AuthProviderID() uint

func (*Context) Body

func (r *Context) Body() ([]byte, error)

func (*Context) Create

func (r *Context) Create(obj client.Object) error

func (*Context) Delete

func (r *Context) Delete(obj client.Object) error

func (*Context) Flush

func (r *Context) Flush()

func (*Context) Get

func (r *Context) Get(obj client.Object, name string) error

func (*Context) IsStreamRequested

func (r *Context) IsStreamRequested() bool

func (*Context) List

func (r *Context) List(obj client.ObjectList, opts ...client.ListOption) error

func (*Context) Namespace

func (r *Context) Namespace() string

func (*Context) Read

func (r *Context) Read(obj any) error

func (*Context) Update

func (r *Context) Update(obj client.Object) error

func (*Context) UserID

func (r *Context) UserID() uint

func (*Context) UserIsAdmin

func (r *Context) UserIsAdmin() bool

func (*Context) UserIsAuthenticated

func (r *Context) UserIsAuthenticated() bool

func (*Context) Write

func (r *Context) Write(obj any) error

func (*Context) WriteCreated added in v0.2.0

func (r *Context) WriteCreated(obj any) error

func (*Context) WriteDataEvent

func (r *Context) WriteDataEvent(obj any) error

func (*Context) WriteEvents

func (r *Context) WriteEvents(events <-chan types.Progress) error

type EventClose added in v0.2.0

type EventClose struct{}

type HandlerFunc

type HandlerFunc func(Context) error

type Middleware

type Middleware func(HandlerFunc) HandlerFunc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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