api

package
v0.0.0-...-d87ebdb Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithHostAddr

func WithHostAddr(addr string) func(*Api)

WithHostAddr applies a IP:Port pair to the API on which it will start to listen

func WithMiddleware

func WithMiddleware(m ...mux.MiddlewareFunc) func(*Api)

Middleware

func WithStorage

func WithStorage(store asset.Store) func(*Api)

WithStorage applies a custom storage path to the API under which uploaded image and gifs will be stored

Types

type Api

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

func New

func New(matrixSvc matrixsvc.Service, opts ...func(*Api)) *Api

New returns a new Api instance. If no address is provided the API will listen on its default address "127.0.0.1:8080"

func (*Api) HandleAsset

func (a *Api) HandleAsset(w http.ResponseWriter, r *http.Request)

func (*Api) HandleAssetList

func (a *Api) HandleAssetList(w http.ResponseWriter, r *http.Request)

func (*Api) HandleDraw

func (a *Api) HandleDraw(w http.ResponseWriter, r *http.Request)

func (*Api) HandleUpdates

func (a *Api) HandleUpdates(w http.ResponseWriter, r *http.Request)

func (*Api) HandleUpload

func (a *Api) HandleUpload(w http.ResponseWriter, r *http.Request)

HandleUpload concerns request which upload either: - an image with the dimensions of 16x16 and are .png - a gif with the dimensions of 16x16 if either the dimensions don't match or the file extensions get violated the endpoint returns a http.StatusBadRequest

func (*Api) ListenAndServe

func (a *Api) ListenAndServe() error

ListenAndServer start the Api-Server on the given address

type Middleware

type Middleware = http.Handler

Jump to

Keyboard shortcuts

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