diff --git a/pkg/channel/list.go b/pkg/channel/list.go index 7ce5c3a..95192b0 100644 --- a/pkg/channel/list.go +++ b/pkg/channel/list.go @@ -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. @@ -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 { diff --git a/pkg/channel/types.go b/pkg/channel/types.go index 857516c..bed9c6a 100644 --- a/pkg/channel/types.go +++ b/pkg/channel/types.go @@ -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 ( diff --git a/pkg/user/joined_channel.go b/pkg/user/joined_channel.go index 3cea705..c7c5612 100644 --- a/pkg/user/joined_channel.go +++ b/pkg/user/joined_channel.go @@ -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 { diff --git a/pkg/user/types.go b/pkg/user/types.go index 8f3cf97..a38a6f8 100644 --- a/pkg/user/types.go +++ b/pkg/user/types.go @@ -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" ) diff --git a/pkg/user/unread_messages.go b/pkg/user/unread_messages.go index 470ac97..c6b3643 100644 --- a/pkg/user/unread_messages.go +++ b/pkg/user/unread_messages.go @@ -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 {