api

package
v0.0.0-...-b146d40 Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API represents a Rest API instance of a ALoLStats instance

func NewAPI

func NewAPI(cfg config.API, prefix string) (*API, error)

NewAPI creates a new Rest API instance

func NewAPICustom

func NewAPICustom(cfg config.API, prefix string, router router) (*API, error)

NewAPICustom creates a new Rest API instance with a custom router

func (*API) AttachModuleDelete

func (a *API) AttachModuleDelete(path string, f func(http.ResponseWriter, *http.Request))

AttachModuleDelete registers a new DELETE handler for the API

func (*API) AttachModuleGet

func (a *API) AttachModuleGet(path string, f func(http.ResponseWriter, *http.Request))

AttachModuleGet registers a new GET handler for the API

func (*API) AttachModulePost

func (a *API) AttachModulePost(path string, f func(http.ResponseWriter, *http.Request))

AttachModulePost registers a new POST handler for the API

func (*API) AttachModulePut

func (a *API) AttachModulePut(path string, f func(http.ResponseWriter, *http.Request))

AttachModulePut registers a new PUT handler for the API

func (*API) Init

func (a *API) Init() error

Init the API instance

func (*API) Run

func (a *API) Run(ctx context.Context) error

Run the REST API (blocking)

Jump to

Keyboard shortcuts

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