go-novu icon indicating copy to clipboard operation
go-novu copied to clipboard

SubscriberApi.UpdatePreferences: Broken method

Open Catzilla opened this issue 6 months ago • 0 comments

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

Catzilla avatar Aug 21 '24 01:08 Catzilla