app_bot

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AppBotTokenPrefix is the token prefix for App Bots.
	AppBotTokenPrefix = "app_"
	// AppBotUIDPrefix is the UID prefix for App Bots.
	AppBotUIDPrefix = "app_"
	// AppBotUIDSuffix is the UID suffix for App Bots.
	AppBotUIDSuffix = "_bot"
)
View Source
const (
	StatusDraft       = 0
	StatusPublished   = 1
	StatusUnpublished = 2
)

Status values for App Bot.

Variables

View Source
var ErrIDAlreadyInUse = errors.New("id already in use")

ErrIDAlreadyInUse is returned when the bot ID/UID conflicts with an existing record.

View Source
var ErrTokenRotationConflict = errors.New("token rotation conflict")

rotateAppBotToken atomically updates token with optimistic lock (WHERE token=oldToken). Returns ErrTokenRotationConflict if another rotation beat us.

Functions

This section is empty.

Types

type AppBot

type AppBot struct {
	log.Log
	// contains filtered or unexported fields
}

AppBot is the App Bot management module.

func NewAppBot

func NewAppBot(ctx *config.Context) *AppBot

NewAppBot creates the App Bot module.

func (*AppBot) Route

func (ab *AppBot) Route(r *wkhttp.WKHttp)

Route registers all App Bot management routes.

type AppBotSpec

type AppBotSpec struct {
	ID          string
	UID         string
	DisplayName string
	Description string
	Avatar      string
	Scope       string
	SpaceID     string
	Token       string
	CreatedBy   string
}

AppBotSpec is the in-memory representation of a published App Bot.

type Registry

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

Registry is an in-memory store for published App Bots.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new Registry.

func (*Registry) Add

func (r *Registry) Add(spec *AppBotSpec)

Add adds or updates an App Bot in the registry.

func (*Registry) FindByID

func (r *Registry) FindByID(id string) *AppBotSpec

FindByID looks up an App Bot by ID.

func (*Registry) FindByUID

func (r *Registry) FindByUID(uid string) *AppBotSpec

FindByUID looks up an App Bot by UID.

func (*Registry) Remove

func (r *Registry) Remove(id, uid string)

Remove removes an App Bot from the registry.

func (*Registry) Update

func (r *Registry) Update(spec *AppBotSpec)

Update atomically replaces an App Bot spec in the registry.

Jump to

Keyboard shortcuts

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