Closed andersfylling closed 2 years ago
Introduce a new way to do update calls instead of the builder. Dealing with default values/partial json, pointers are now used for each field allowing disgord to identify if a field was populated or not, regardless of it being a default value.
https://stackoverflow.com/questions/48021945/how-to-handle-patch-request-with-unset-value-in-golang
This is also a bit of an experiment to see what the end result looks like.
func NullStr(s string) *string { return &s }
// before msg, err := client.Channel(23).Message(24642).UpdateBuilder(). SetContent("hello world"). SetFlags(disgord.MessageFlagSupressEmbeds). Execute() // after msg, err := client.Channel(23).Message(24642).Update(&UpdateMessage{ Content: NullStr("hello world"), Flags: &disgord.MessageFlagSupressEmbeds, })
// before channel, err := client.Channel(23).UpdateBuilder(). SetTitle("new channel name"). Execute() // after channel, err := client.Channel(23).Update(&UpdateChannel{ Title: NullStr("new channel name"), })
yes. The previous functionality marked deprecated will be removed.
GetAuditLogs will not have backwards compatibility.
Description
Introduce a new way to do update calls instead of the builder. Dealing with default values/partial json, pointers are now used for each field allowing disgord to identify if a field was populated or not, regardless of it being a default value.
https://stackoverflow.com/questions/48021945/how-to-handle-patch-request-with-unset-value-in-golang
This is also a bit of an experiment to see what the end result looks like.
example
Breaking Change
yes. The previous functionality marked deprecated will be removed.
GetAuditLogs will not have backwards compatibility.
Checklist: