Files
Memoh/internal/channel/directory.go
T
BBQ 5a35ef34ac feat: channel gateway implementation and multi-bot refactor
- Refactor channel manager with support for Sender/Receiver interfaces and hot-swappable adapters.
- Implement identity routing and pre-authentication logic for inbound messages.
- Update database schema to support bot pre-auth keys and extended channel session metadata.
- Add Telegram and Feishu channel configuration and adapter enhancements.
- Update Swagger documentation and internal handlers for channel management.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 14:41:54 +08:00

33 lines
1.2 KiB
Go

package channel
import "context"
type DirectoryEntryKind string
const (
DirectoryEntryUser DirectoryEntryKind = "user"
DirectoryEntryGroup DirectoryEntryKind = "group"
)
type DirectoryEntry struct {
Kind DirectoryEntryKind `json:"kind"`
ID string `json:"id"`
Name string `json:"name,omitempty"`
Handle string `json:"handle,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
type DirectoryQuery struct {
Query string `json:"query,omitempty"`
Limit int `json:"limit,omitempty"`
Kind DirectoryEntryKind `json:"kind,omitempty"`
}
type ChannelDirectoryAdapter interface {
ListPeers(ctx context.Context, cfg ChannelConfig, query DirectoryQuery) ([]DirectoryEntry, error)
ListGroups(ctx context.Context, cfg ChannelConfig, query DirectoryQuery) ([]DirectoryEntry, error)
ListGroupMembers(ctx context.Context, cfg ChannelConfig, groupID string, query DirectoryQuery) ([]DirectoryEntry, error)
ResolveTarget(ctx context.Context, cfg ChannelConfig, input string, kind DirectoryEntryKind) (DirectoryEntry, error)
}