api

package
v0.0.0-...-f8334dc Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package api contains Giesela's outward-facing API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachEventID

func AttachEventID(result *client.InvokeResult, eventID *sentry.EventID)

AttachEventID attaches a Sentry event's id to an invoke result. If the event id is nil, this function is a noop. The event id is stored in the keyword argument "event_id".

func CallResult

func CallResult(res *wamp.Result) client.InvokeResult

func CheckUser

func CheckUser(api *API, handler client.InvocationHandler, permissions ...rbac.Permission) client.InvocationHandler

func ErrorResultTrace

func ErrorResultTrace(res *client.InvokeResult, trace string)

func InternalErrorResult

func InternalErrorResult(args ...interface{}) client.InvokeResult

InternalErrorResult creates an invoke result representing an internal error.

func InvalidArgumentResult

func InvalidArgumentResult(args ...interface{}) client.InvokeResult

func ResultFromError

func ResultFromError(err error) client.InvokeResult

ResultFromError creates an invoke result from an error. Passing a nil error will cause the function to panic. If the error is not recognised, an internal error result is created and the error is reported to Sentry.

func WAMPErrorResult

func WAMPErrorResult(err *wamp.Error) client.InvokeResult

WAMPErrorResult creates an invoke result representing a WAMP error.

func WithUserInfo

func WithUserInfo(ctx context.Context, user *UserInfo) context.Context

Types

type API

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

type UserInfo

type UserInfo struct {
	UserID  string
	GuildID string
}

func UserInfoFromContext

func UserInfoFromContext(ctx context.Context) (*UserInfo, bool)

func UserInfoFromContextMust

func UserInfoFromContextMust(ctx context.Context) *UserInfo

func (UserInfo) String

func (u UserInfo) String() string

Jump to

Keyboard shortcuts

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