apis

package
v0.0.0-...-750dbe4 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrTypeRouteNotFound api.ErrorType = "ROUTE_NOT_FOUND"
)
View Source
const ErrTypeUnknownError api.ErrorType = "UNKNOWN_ERROR"

Variables

This section is empty.

Functions

func Body

func Body[T types.Body](c echo.Context) (T, error)

func InstallHandlers

func InstallHandlers(app core.App, g Group)

func InstallMusicHandlers

func InstallMusicHandlers(app core.App, group Group)

func RawBody

func RawBody[T types.Body](rawJson string) (T, error)

func RouteNotFound

func RouteNotFound() *api.Error

func Server

func Server(app core.App) (*echo.Echo, error)

Types

type Album

type Album struct {
	Slug string
	Name string

	Tracks []Track
}

type Group

type Group interface {
	Register(handlers ...Handler)
}

type Handler

type Handler struct {
	Name        string
	Method      string
	Path        string
	DataType    any
	BodyType    types.Body
	IsMultiForm bool
	Errors      []api.ErrorType
	HandlerFunc echo.HandlerFunc
	Middlewares []echo.MiddlewareFunc
}

type PostAlbum

type PostAlbum struct {
	Id string `json:"id"`
}

type PostAlbumBody

type PostAlbumBody struct {
	Name   string `json:"name"`
	Artist string `json:"artist"`
}

func (PostAlbumBody) Schema

func (PostAlbumBody) Schema() jio.Schema

type Track

type Track struct {
	AlbumSlug string
	Slug      string
	Title     string
}

Jump to

Keyboard shortcuts

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