Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelCreator ¶
type ChannelCreator interface {
CreateChannel(ctx context.Context, guildID, name string) (string, error)
InviteUserToChannel(ctx context.Context, channelID, userID string) error
GetOwnerUserID(ctx context.Context) (string, error)
SetChannelTopic(ctx context.Context, channelID, topic string) error
}
ChannelCreator can create channels on the chat platform.
type ChannelEnsurer ¶
type ChannelEnsurer interface {
EnsureChannel(ctx context.Context, dirPath string) (string, error)
CreateChannel(ctx context.Context, name, authorID string) (string, error)
}
ChannelEnsurer resolves a directory path to a channel ID, creating the channel if it does not yet exist.
func NewChannelService ¶
func NewChannelService(store db.Store, creator ChannelCreator, guildID string, platform types.Platform) ChannelEnsurer
NewChannelService creates a new ChannelEnsurer.
type ChannelLister ¶ added in v0.1.15
ChannelLister can list channels from the database.
type MessageSender ¶ added in v0.1.15
MessageSender can send messages to channels or threads.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server exposes a lightweight HTTP API for task CRUD operations.
func NewServer ¶
func NewServer(sched scheduler.Scheduler, channels ChannelEnsurer, threads ThreadEnsurer, store ChannelLister, messages MessageSender, logger *slog.Logger) *Server
NewServer creates a new API server. The channels, threads, store, and messages parameters may be nil if those features are not configured.
type ThreadCreator ¶ added in v0.1.11
type ThreadCreator interface {
CreateThread(ctx context.Context, channelID, name, mentionUserID, message string) (string, error)
DeleteThread(ctx context.Context, threadID string) error
}
ThreadCreator can create and delete threads on the chat platform.
type ThreadEnsurer ¶ added in v0.1.11
type ThreadEnsurer interface {
CreateThread(ctx context.Context, channelID, name, authorID, message string) (string, error)
DeleteThread(ctx context.Context, threadID string) error
}
ThreadEnsurer manages threads on the chat platform and the DB.
func NewThreadService ¶ added in v0.1.11
func NewThreadService(store db.Store, creator ThreadCreator, platform types.Platform) ThreadEnsurer
NewThreadService creates a new ThreadEnsurer.