api

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: MIT Imports: 5 Imported by: 2

README

Ulysses API Specs

Public RESTful API

Documentation

Index

Constants

View Source
const (
	Payment uint8 = iota
	PaymentCallback
	Server
)

API categories. Any package (no matter official or third party) except for main package must choose a category to register the API endpoints.

Variables

View Source
var (
	ErrBadMethod error = errors.New("api.RegisterApiEndpoint(): bad method")

	ErrInvalidCategory error = errors.New("api: invalid category is selected")

	ErrNotAllowDirectFuncReg error = errors.New("api.RegisterApiEndpoint(): no direct handler func registration is allowed")

	ErrRepeatGetPath  error = errors.New("api.RegisterApiEndpoint(): repeated path for GET method")
	ErrRepeatPostPath error = errors.New("api.RegisterApiEndpoint(): repeated path for POST method")
)

Functions

func CGET added in v0.0.6

func CGET(category uint8, relativePath string, handler *gin.HandlerFunc) error

CGET() stands for Categorized GET CGET(Payment, "dummy/test", f) will register f() as example.com/api/payment/dummy/test for GET method

func CPOST added in v0.0.6

func CPOST(category uint8, relativePath string, handler *gin.HandlerFunc) error

CPOST() stands for Categorized POST CPOST(Payment, "dummy/test", f) will register f() as example.com/api/payment/dummy/test for POST method

func FinalizeGinEngine added in v0.0.3

func FinalizeGinEngine(router *gin.Engine, pathPrefix string)

FinalizeGinEngine() binds all registered handlers to a gin.Engine. - pathPrefix should be in the format of aaa[/bbb[/ccc[/ddd]]] where [] encloses an optional portion

func GET added in v0.0.6

func GET(relativePath string, handler *gin.HandlerFunc) error

GET() is effectively like gin.Engine.GET(), but takes 1 handler function only security measure: only main package can call GET(). For module, refer to CGET()

func POST added in v0.0.6

func POST(relativePath string, handler *gin.HandlerFunc) error

POST() is effectively like gin.Engine.POST(), but takes 1 handler function only security measure: only main package can call POST(). For module, refer to CPOST()

Types

This section is empty.

Jump to

Keyboard shortcuts

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