Skip to content

Commit e56980a

Browse files
feat: Enhance channel data structure with missing attributes in the response
1 parent 283a6f6 commit e56980a

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

channel.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ type Channel struct {
9494

9595
ExtraData map[string]interface{} `json:"-"`
9696

97+
WatcherCount int `json:"watcher_count"`
98+
Watchers []*User `json:"watchers"`
99+
100+
PushPreferences *ChannelPushPreferences `json:"push_preferences"`
101+
Hidden bool `json:"hidden"`
102+
97103
client *Client
98104
}
99105

query.go

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,29 @@ type queryChannelResponse struct {
100100
}
101101

102102
type queryChannelResponseData struct {
103-
Channel *Channel `json:"channel"`
104-
Messages []*Message `json:"messages"`
105-
Read []*ChannelRead `json:"read"`
106-
Members []*ChannelMember `json:"members"`
107-
PendingMessages []*Message `json:"pending_messages"`
108-
PinnedMessages []*Message `json:"pinned_messages"`
103+
Channel *Channel `json:"channel"`
104+
Messages []*Message `json:"messages"`
105+
Read []*ChannelRead `json:"read"`
106+
Members []*ChannelMember `json:"members"`
107+
PendingMessages []*Message `json:"pending_messages"`
108+
PinnedMessages []*Message `json:"pinned_messages"`
109+
Hidden bool `json:"hidden"`
110+
PushPreferences *ChannelPushPreferences `json:"push_preferences"`
111+
WatcherCount int `json:"watcher_count"`
112+
Watchers []*User `json:"watchers"`
109113
}
110114

111115
type QueryChannelsResponse struct {
112116
Channels []*Channel
113117
Response
114118
}
115119

120+
type ChannelPushPreferences struct {
121+
ChatLevel string `json:"chat_level"`
122+
CallLevel string `json:"call_level"`
123+
DisabledUntil *time.Time `json:"disabled_until"`
124+
}
125+
116126
// QueryChannels returns list of channels with members and messages, that match QueryOption.
117127
// If any number of SortOption are set, result will be sorted by field and direction in oder of sort options.
118128
func (c *Client) QueryChannels(ctx context.Context, q *QueryOption, sort ...*SortOption) (*QueryChannelsResponse, error) {
@@ -139,6 +149,10 @@ func (c *Client) QueryChannels(ctx context.Context, q *QueryOption, sort ...*Sor
139149
result[i].Messages = data.Messages
140150
result[i].PendingMessages = data.PendingMessages
141151
result[i].PinnedMessages = data.PinnedMessages
152+
result[i].Hidden = data.Hidden
153+
result[i].PushPreferences = data.PushPreferences
154+
result[i].WatcherCount = data.WatcherCount
155+
result[i].Watchers = data.Watchers
142156
result[i].Read = data.Read
143157
result[i].client = c
144158
}

0 commit comments

Comments
 (0)