botapi

package
v0.0.0-...-8ff35f7 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package botapi implements core Bot API handlers.

Handlers related to RBE are in the "rbe" package for now.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotAPIServer

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

BotAPIServer implements core Bot API handlers.

Handlers are implement in individual Go files. They are all installed into the server router in main.go.

func NewBotAPIServer

func NewBotAPIServer(cfg *cfg.Provider, project string) *BotAPIServer

NewBotAPIServer constructs a new BotAPIServer.

func (*BotAPIServer) BotCode

func (srv *BotAPIServer) BotCode(c *router.Context)

BotCode serves the bot archive blob or an HTTP redirect to it.

Used to bootstrap bots and by the self-updating bots.

Uses optional "Version" route parameter. Its value is either a concrete bot archive digest to fetch, or an empty string (in which case the handler will serve a redirect to the current stable bot version).

Attempts are made to utilize GAE's edge cache by setting the corresponding headers.

func (*BotAPIServer) Claim

Claim implements the handler that claims pending tasks.

TODO: Doc, implement.

func (*BotAPIServer) Event

Event implements the handler that collect events from the bot.

TODO: Doc, implement.

func (*BotAPIServer) Handshake

Handshake implements the bot handshake handler.

TODO: Doc, implement.

func (*BotAPIServer) IDToken

IDToken mints ID tokens to be used inside the task.

TODO: Doc, implement.

func (*BotAPIServer) OAuthToken

func (srv *BotAPIServer) OAuthToken(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)

OAuthToken mints OAuth tokens to be used inside the task.

TODO: Doc, implement.

func (*BotAPIServer) Poll

Poll implements the handler that tell the bot what to do next.

TODO: Doc, implement.

func (*BotAPIServer) TaskError

TaskError implements the handler that collects internal task errors.

Uses optional "TaskID" route parameter with the task being worked on by the bot.

TODO: Doc, implement.

func (*BotAPIServer) TaskUpdate

func (srv *BotAPIServer) TaskUpdate(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)

TaskUpdate implements handler that collects task state updates.

Uses optional "TaskID" route parameter with the task being worked on by the bot.

TODO: Doc, implement.

type UnimplementedRequest

type UnimplementedRequest struct{}

UnimplementedRequest is used as a placeholder in unimplemented handlers.

func (*UnimplementedRequest) ExtractDebugRequest

func (r *UnimplementedRequest) ExtractDebugRequest() any

func (*UnimplementedRequest) ExtractSession

func (r *UnimplementedRequest) ExtractSession() []byte

Jump to

Keyboard shortcuts

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