Skip to content

Commit

Permalink
Allow setting bool properties of ChannelEdit to false
Browse files Browse the repository at this point in the history
Setting e.g. ChannelEdit.Archived = false is currently not possible
as go will treat a false as empty and will omit the property
from the JSON object.
  • Loading branch information
iokill committed Jun 18, 2022
1 parent e030c5f commit 7b5dee7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions structs.go
Expand Up @@ -360,7 +360,7 @@ func (c *Channel) IsThread() bool {
type ChannelEdit struct {
Name string `json:"name,omitempty"`
Topic string `json:"topic,omitempty"`
NSFW bool `json:"nsfw,omitempty"`
NSFW *bool `json:"nsfw,omitempty"`
Position int `json:"position"`
Bitrate int `json:"bitrate,omitempty"`
UserLimit int `json:"user_limit,omitempty"`
Expand All @@ -370,10 +370,10 @@ type ChannelEdit struct {

// NOTE: threads only

Archived bool `json:"archived,omitempty"`
AutoArchiveDuration int `json:"auto_archive_duration,omitempty"`
Locked bool `json:"locked,bool"`
Invitable bool `json:"invitable,omitempty"`
Archived *bool `json:"archived,omitempty"`
AutoArchiveDuration int `json:"auto_archive_duration,omitempty"`
Locked *bool `json:"locked,omitempty"`
Invitable *bool `json:"invitable,omitempty"`
}

// A ChannelFollow holds data returned after following a news channel
Expand Down

0 comments on commit 7b5dee7

Please sign in to comment.