api

package
v0.0.0-...-7eb25be Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBody

func DecodeBody(w http.ResponseWriter, r *http.Request, v interface{}) error

func Int64FromString

func Int64FromString(w http.ResponseWriter, s string) int64

func UserID

func UserID(r *http.Request) int64

func WriteError

func WriteError(w http.ResponseWriter, code int, err error)

func WriteJSON

func WriteJSON(w http.ResponseWriter, code int, data interface{})

func WriteStatus

func WriteStatus(w http.ResponseWriter, code int)

Types

type API

type API struct {
	DB           *db.Queries
	JWTSecret    string
	DockerClient *client.Client
	// contains filtered or unexported fields
}

func New

func New(opts Options) *API

func (*API) Auth

func (api *API) Auth(next http.Handler) http.Handler

func (*API) HandleCreateEnvironment

func (api *API) HandleCreateEnvironment(w http.ResponseWriter, r *http.Request)

func (*API) HandleCreateProject

func (api *API) HandleCreateProject(w http.ResponseWriter, r *http.Request)

func (*API) HandleDeleteProject

func (api *API) HandleDeleteProject(w http.ResponseWriter, r *http.Request)

func (*API) HandleGetEnvironments

func (api *API) HandleGetEnvironments(w http.ResponseWriter, r *http.Request)

func (*API) HandleGetProjects

func (api *API) HandleGetProjects(w http.ResponseWriter, r *http.Request)

func (*API) HandleLogin

func (api *API) HandleLogin(w http.ResponseWriter, r *http.Request)

func (*API) HandleUpdateEnvironment

func (api *API) HandleUpdateEnvironment(w http.ResponseWriter, r *http.Request)

func (*API) HandleUpdateProject

func (api *API) HandleUpdateProject(w http.ResponseWriter, r *http.Request)

func (*API) Start

func (api *API) Start(addr string)

func (*API) User

func (api *API) User(w http.ResponseWriter, r *http.Request) *domain.User

type Options

type Options struct {
	Router         *chi.Mux
	AllowedOrigins []string
	DB             *db.Queries
	JWTSecret      string
	DockerClient   *client.Client
}

Jump to

Keyboard shortcuts

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