mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
a246b79a4f
- Refactor channel adapters (feishu, telegram, local) with enhanced descriptor and config - Restructure channel manager, service, types, and outbound messaging - Simplify chat module by removing normalize.go and chat.go, consolidating into resolver and types - Update router channel handlers and tests - Sync swagger documentation
37 lines
1.5 KiB
Go
37 lines
1.5 KiB
Go
package channel
|
|
|
|
import "context"
|
|
|
|
// DirectoryEntryKind classifies a directory entry as a user or a group.
|
|
type DirectoryEntryKind string
|
|
|
|
const (
|
|
DirectoryEntryUser DirectoryEntryKind = "user"
|
|
DirectoryEntryGroup DirectoryEntryKind = "group"
|
|
)
|
|
|
|
// DirectoryEntry represents a single user or group discovered through the channel's directory.
|
|
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"`
|
|
}
|
|
|
|
// DirectoryQuery contains filters for directory listing operations.
|
|
type DirectoryQuery struct {
|
|
Query string `json:"query,omitempty"`
|
|
Limit int `json:"limit,omitempty"`
|
|
Kind DirectoryEntryKind `json:"kind,omitempty"`
|
|
}
|
|
|
|
// ChannelDirectoryAdapter provides contact and group lookup for a channel platform.
|
|
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)
|
|
}
|