Documentation
¶
Overview ¶
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
Index ¶
Constants ¶
View Source
const ( EventMessageNew = "message.new" EventPresenceUpdate = "presence.update" )
Event type constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelStore ¶
type ChannelStore interface {
CreateChannel(name string, public bool, memberIDs []int64, channelType string) (int64, error)
GetChannelByID(id int64) (*Channel, error)
GetChannelByName(name string) (*Channel, error)
ListChannelsForUser(userID int64) ([]ChannelWithMembership, error)
ListAllChannelsWithMembership(userID int64) ([]ChannelWithMembership, error)
AddChannelMember(channelID, userID int64) error
ChannelMemberUsernames(channelID int64) ([]string, error)
IsChannelMember(channelID, userID int64) (bool, error)
ListDMsForUser(userID int64) ([]DMInfo, error)
ListAllDMs() ([]AllDMInfo, error)
OpenDM(userID, otherUserID int64, otherUsername string) (string, bool, error)
}
type ChannelWithMembership ¶
type EventBus ¶ added in v0.4.0
type EventBus interface {
Publish(event Event)
Subscribe(eventTypes ...string) Subscription
}
EventBus is an in-process pub/sub system for domain events.
func NewEventBus ¶ added in v0.4.0
func NewEventBus() EventBus
NewEventBus creates a new in-process event bus.
type MessageEvent ¶ added in v0.4.0
type MessageEvent struct {
ChannelName string
ChannelType string // "channel" or "dm"
From string
MessageID int64
SentAt time.Time
Mentions []string
ThreadID *int64
}
MessageEvent is the payload for EventMessageNew.
type MessageStore ¶
type MessageStore interface {
SendMessage(channelID, userID int64, body string, threadID *int64, mentionUserIDs []int64) (int64, error)
GetMessages(channelID int64, before *int64, after *int64, limit int, threadID *int64) ([]Message, error)
GetUnreadMessages(userID int64, channelID *int64, mentionsOnly bool, threadID *int64) ([]Message, error)
GetUnreadCounts(userID int64) ([]UnreadCount, error)
MarkRead(userID, channelID int64, messageID *int64) error
}
type RoleStore ¶
type RoleStore interface {
CreateRole(name string) error
DeleteRole(name string) error
ListRoles() ([]Role, error)
GrantPermission(role, permission string) error
RevokePermission(role, permission string) error
GetRolePermissions(role string) ([]string, error)
GetUserPermissions(username string) ([]string, error)
HasPermission(username, permission string) (bool, error)
SetUserRole(username, role string) error
SetUserType(username, userType string) error
}
type SettingsStore ¶
type Store ¶
type Store interface {
UserStore
ChannelStore
MessageStore
RoleStore
SettingsStore
Close() error
}
Store is the composite interface for convenient wiring.
type Subscription ¶ added in v0.4.0
type Subscription interface {
Events() <-chan Event
Close()
}
Subscription receives events from the bus.
type UnreadCount ¶
Click to show internal directories.
Click to hide internal directories.