go-novu
go-novu copied to clipboard
SubscriberApi.UpdatePreferences: Broken method
According to API Reference for UpdatePreferences
method, channel
field should be object, not array
Moreover, this endpoint supports partial update, which means that only enabled
or only channel
may be set
But if we set only enabled
, and set it to false
as follow:
opts := &novu.UpdateSubscriberPreferencesOptions{
Enabled: false,
}
request will fail, because omitempty
tag in struct treat false
as empty field, and omit it from request
Furthermore, data
field in response of this endpoint is a single object, not array, which results in unmarshalling error, making UpdatePreferences
method completely useless in current package version