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 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 (*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) Update ¶
func (r *Registry) Update(spec *AppBotSpec)
Update atomically replaces an App Bot spec in the registry.
Click to show internal directories.
Click to hide internal directories.