plugin

package
v0.0.0-...-41a8cc5 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: AGPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAuthToken

func AddAuthToken(ctx context.Context, req *http.Request) error

AddAuthToken adds the auth token from the context to an outgoing request

func GetAPIClient

func GetAPIClient(ctx context.Context) (*egapi.Client, error)

func Redirect

func Redirect(path string) (*plugin_protos.Response, error)

func WritePage

func WritePage(ctx context.Context, request *plugin_protos.Request, page Page) (*plugin_protos.Response, error)

Types

type Endpoint

type Endpoint func(ctx context.Context, request *plugin_protos.Request) (*plugin_protos.Response, error)

func AlwaysRedirect

func AlwaysRedirect(path string) Endpoint

type Error

type Error struct {
	Err         error
	ErrTitle    string
	Description string
}

func (Error) Error

func (e Error) Error() string
type MenuItem struct {
	Name  string
	Path  string
	Items []MenuItem
}

type Page

type Page interface {
	Title() string
	StreamTitle(*quicktemplate.Writer)
	WriteTitle(io.Writer)
	Body() string
	StreamBody(*quicktemplate.Writer)
	WriteBody(io.Writer)
}

type Plugin

type Plugin struct {
	plugin_protos.UnimplementedPluginServiceServer

	Name      string
	Extension string

	Endpoints map[string]map[string]Endpoint // map[path]map[method]Endpoint
	Menu      *plugin_protos.MenuItem
}

func (Plugin) HandleRequest

func (p Plugin) HandleRequest(ctx context.Context, request *plugin_protos.Request) (*plugin_protos.Response, error)

func (*Plugin) ListenAndServe

func (p *Plugin) ListenAndServe()

func (Plugin) Settings

Jump to

Keyboard shortcuts

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