Skip to content

Commit

Permalink
feat: add SuperModeType
Browse files Browse the repository at this point in the history
  • Loading branch information
tomMoulard committed Apr 30, 2024
1 parent cecce08 commit f643b51
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
13 changes: 7 additions & 6 deletions pkg/channel/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ type ListGroupChannelRequest struct {
PublicMode string
// SuperMod&e specifies which type of group channels to retrieve. Acceptable
// values are the following:
// - all (default): All types of group channels including Supergroup channels
// are returned.
// - super: Only Supergroup channels are returned.
// - nonsuper: Group channels excluding Supergroup channels are returned.
// - SuperModeAll (default): All types of group channels including Supergroup
// channels are returned.
// - SuperModeSuper: Only Supergroup channels are returned.
// - SuperModeNonSuper: Group channels excluding Supergroup channels are
// returned.
// Optional.
SuperMode string
SuperMode SuperMode
// CreatedAfter restricts the search scope to only retrieve group channels
// which have been created after the specified time, in Unix milliseconds
// format.
Expand Down Expand Up @@ -255,7 +256,7 @@ func listChannelRequestToMap(lcr ListGroupChannelRequest) map[string]string {
}

if lcr.SuperMode != "" {
m["super_mode"] = lcr.SuperMode
m["super_mode"] = string(lcr.SuperMode)
}

if lcr.CreatedAfter != nil {
Expand Down
8 changes: 5 additions & 3 deletions pkg/channel/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ const (
PublicModeNonPublic string = "private"
)

type SuperMode string

const (
SuperModeAll string = "all"
SuperModeSuper string = "super"
SuperModeNonSuper string = "nonsuper"
SuperModeAll SuperMode = "all"
SuperModeSuper SuperMode = "super"
SuperModeNonSuper SuperMode = "nonsuper"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/user/joined_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type GetGroupChannelCountRequest struct {
// SuperMode restricts the search scope to either Supergroup channels or
// non-Supergroup channels or both. Acceptable values are all, super, and
// nonsuper. If not specified, the default value is all.
SuperMode string `json:"super_mode,omitempty"`
SuperMode SuperMode `json:"super_mode,omitempty"`
}

type GetGroupChannelCountResponse struct {
Expand Down
8 changes: 5 additions & 3 deletions pkg/user/types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package user

type SuperMode string

const (
SuperModeAll string = "all"
SuperModeSuper string = "super"
SuperModeNonSuper string = "nonsuper"
SuperModeAll SuperMode = "all"
SuperModeSuper SuperMode = "super"
SuperModeNonSuper SuperMode = "nonsuper"
)
2 changes: 1 addition & 1 deletion pkg/user/unread_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type GetUnreadMessagesCountRequest struct {
// SuperMode restricts the search scope to either Supergroup channels or
// non-Supergroup channels or both. Acceptable values are all, super, and
// nonsuper. If not specified, the default value is all.
SuperMode string `json:"super_mode,omitempty"`
SuperMode SuperMode `json:"super_mode,omitempty"`
}

type GetUnreadMessagesCountResponse struct {
Expand Down

0 comments on commit f643b51

Please sign in to comment.