(Subscribers.Preferences)
- List - Get subscriber preferences
- RetrieveByLevel - Get subscriber preferences by level
Get subscriber preferences
package main
import(
"context"
"os"
novugo "github.com/novuhq/novu-go"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity(os.Getenv("NOVU_API_KEY")),
)
res, err := s.Subscribers.Preferences.List(ctx, "<id>", nil)
if err != nil {
log.Fatal(err)
}
if res.UpdateSubscriberPreferenceResponseDtos != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
includeInactiveChannels |
*bool | ➖ | A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersControllerListSubscriberPreferencesResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 400, 404, 409 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get subscriber preferences by level
package main
import(
"context"
"os"
novugo "github.com/novuhq/novu-go"
"github.com/novuhq/novu-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity(os.Getenv("NOVU_API_KEY")),
)
res, err := s.Subscribers.Preferences.RetrieveByLevel(ctx, operations.ParameterTemplate, "<id>", nil)
if err != nil {
log.Fatal(err)
}
if res.GetSubscriberPreferencesResponseDtos != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
preferenceLevel |
operations.Parameter | ✔️ | the preferences level to be retrieved (template / global) |
subscriberID |
string | ✔️ | N/A |
includeInactiveChannels |
*bool | ➖ | A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersControllerGetSubscriberPreferenceByLevelResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 400, 404, 409 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |