Documentation ¶
Overview ¶
Package botapi implements core Bot API handlers.
Handlers related to RBE are in the "rbe" package for now.
Index ¶
- type BotAPIServer
- func (srv *BotAPIServer) BotCode(c *router.Context)
- func (srv *BotAPIServer) Claim(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
- func (srv *BotAPIServer) Event(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
- func (srv *BotAPIServer) Handshake(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
- func (srv *BotAPIServer) IDToken(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
- func (srv *BotAPIServer) OAuthToken(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
- func (srv *BotAPIServer) Poll(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
- func (srv *BotAPIServer) TaskError(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
- func (srv *BotAPIServer) TaskUpdate(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
- type UnimplementedRequest
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 ¶
func (srv *BotAPIServer) Claim(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
Claim implements the handler that claims pending tasks.
TODO: Doc, implement.
func (*BotAPIServer) Event ¶
func (srv *BotAPIServer) Event(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
Event implements the handler that collect events from the bot.
TODO: Doc, implement.
func (*BotAPIServer) Handshake ¶
func (srv *BotAPIServer) Handshake(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
Handshake implements the bot handshake handler.
TODO: Doc, implement.
func (*BotAPIServer) IDToken ¶
func (srv *BotAPIServer) IDToken(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
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 ¶
func (srv *BotAPIServer) Poll(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
Poll implements the handler that tell the bot what to do next.
TODO: Doc, implement.
func (*BotAPIServer) TaskError ¶
func (srv *BotAPIServer) TaskError(ctx context.Context, body *UnimplementedRequest, r *botsrv.Request) (botsrv.Response, error)
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) ExtractDimensions ¶
func (r *UnimplementedRequest) ExtractDimensions() map[string][]string
func (*UnimplementedRequest) ExtractPollToken ¶
func (r *UnimplementedRequest) ExtractPollToken() []byte
func (*UnimplementedRequest) ExtractSessionToken ¶
func (r *UnimplementedRequest) ExtractSessionToken() []byte