api

package
v0.0.0-...-769c1bd Latest Latest
Warning

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

Go to latest
Published: May 31, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(g Group, path string, handler func(context.Context) error)

func DeleteID

func DeleteID[I any](g Group, path string, handler func(context.Context, I) error)

func DeleteIn

func DeleteIn[I any](g Group, path string, handler func(context.Context, I) error)

func Get

func Get[O any](g Group, path string, handler func(context.Context) (O, error))

func GetID

func GetID[I, O any](g Group, path string, handler func(context.Context, I) (O, error))

func GetIn

func GetIn[I any, O any](g Group, path string, handler func(context.Context, I) (O, error))

func GetInOut

func GetInOut[I any, O any](g Group, path string, handler func(context.Context, I) (O, error))

func List

func List[I, O any](g Group, path string, handler func(context.Context, I) (O, error))

func New

func New(ctx context.Context, addr string, db db.DB, dev bool) error

func NewAPI

func NewAPI(m *http.ServeMux, db db.DB, dev bool) huma.API

func Post

func Post[O any](g Group, path string, handler func(context.Context) (O, error))

func PostBody

func PostBody[I, O any](g Group, path string, handler func(context.Context, I) (O, error))

func PostCookie

func PostCookie[I any](g Group, path string, handler func(context.Context, I) (http.Cookie, error))

func Put

func Put[B, O any](g Group, path string, handler func(context.Context, B) (O, error))

func PutID

func PutID[I, B, O any](g Group, path string, handler func(context.Context, I, B) (O, error))

Types

type ContactListIn

type ContactListIn struct {
	Limit  int `query:"limit"`
	Offset int `query:"offset"`
}

type ContactListOut

type ContactListOut struct {
	Contacts []q.Contact `json:"contacts"`
}

type ContactUpdateIn

type ContactUpdateIn struct {
	Email string             `json:"email"`
	Info  models.ContactInfo `json:"info"`
	Name  string             `json:"name"`
	Phone string             `json:"phone"`
}

type GetHealthOut

type GetHealthOut struct {
	ContentType string `header:"Content-Type"`
	Body        []byte `example:"ok"`
}

type Group

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

func NewGroup

func NewGroup(a huma.API, prefix string) Group

type InBody

type InBody[B any] struct {
	Body *B
}

type InBodyID

type InBodyID[B any, I any] struct {
	Body *B
	ID   I `path:"id"`
}

type InID

type InID[I any] struct {
	ID I `path:"id"`
}

type OutBody

type OutBody[B any] struct {
	Body *B
}

type OutCookie

type OutCookie struct {
	SetCookie http.Cookie `header:"Set-Cookie"`
}

type SessionGetIn

type SessionGetIn struct {
	Session http.Cookie `cookie:"session"`
}

type SessionGetOut

type SessionGetOut struct {
	Body    q.UserGetOut
	Session http.Cookie `cookie:"session"`
	Status  int
}

type UserCreateIn

type UserCreateIn struct {
	Email    string `json:"email" format:"email"`
	Password string `json:"password" minLength:"8"`
}

Jump to

Keyboard shortcuts

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