35a0b2b715
- 27 base tools: channels, messaging, users, reactions, files, DMs - Team management: invite/remove users, get stats, list members - Slash commands: execute /remind, /poll, etc. - Webhook management: incoming and outgoing webhooks - System tools: server config, logs, bulk status updates - Channel admin: create, invite, leave, delete channels - Read-only mode for safe exploration - Dual token support (bot + PAT) for enhanced security - Apache 2.0 licensed
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package channel
|
|
|
|
import "github.com/mattermost/mattermost-server/v6/model"
|
|
|
|
func SlimChannel(c *model.Channel) map[string]interface{} {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
return map[string]interface{}{
|
|
"id": c.Id,
|
|
"name": c.Name,
|
|
"display_name": c.DisplayName,
|
|
"type": string(c.Type),
|
|
"team_id": c.TeamId,
|
|
}
|
|
}
|
|
|
|
func DetailedChannel(c *model.Channel, memberCount int64) map[string]interface{} {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
return map[string]interface{}{
|
|
"id": c.Id,
|
|
"name": c.Name,
|
|
"display_name": c.DisplayName,
|
|
"type": string(c.Type),
|
|
"team_id": c.TeamId,
|
|
"purpose": c.Purpose,
|
|
"header": c.Header,
|
|
"creator_id": c.CreatorId,
|
|
"create_at": c.CreateAt,
|
|
"member_count": memberCount,
|
|
}
|
|
}
|
|
|
|
func SlimChannelMember(m model.ChannelMember) map[string]interface{} {
|
|
return map[string]interface{}{
|
|
"user_id": m.UserId,
|
|
"channel_id": m.ChannelId,
|
|
"roles": m.Roles,
|
|
"last_viewed": m.LastViewedAt,
|
|
"msg_count": m.MsgCount,
|
|
"mention_count": m.MentionCount,
|
|
}
|
|
}
|