(Topics.Subscribers)
Check if a subscriber belongs to a certain topic
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.Topics.Subscribers.Check(ctx, "<id>", "<value>")
if err != nil {
log.Fatal(err)
}
if res.TopicSubscriberDto != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
externalSubscriberID |
string | ✔️ | The external subscriber id |
topicKey |
string | ✔️ | The topic key |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.TopicsControllerGetTopicSubscriberResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 400, 404, 409 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Remove subscribers from a topic
package main
import(
"context"
"os"
novugo "github.com/novuhq/novu-go"
"github.com/novuhq/novu-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity(os.Getenv("NOVU_API_KEY")),
)
res, err := s.Topics.Subscribers.Remove(ctx, "<value>", components.RemoveSubscribersRequestDto{
Subscribers: []string{
"<value>",
"<value>",
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
topicKey |
string | ✔️ | The topic key |
removeSubscribersRequestDto |
components.RemoveSubscribersRequestDto | ✔️ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.TopicsControllerRemoveSubscribersResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 400, 404, 409 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |