(Subscribers.Messages)
- UpdateAsSeen - Mark message action as seen
- MarkAll - Marks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed.
- MarkAllAs - Mark a subscriber messages as seen, read, unseen or unread
Mark message action as seen
package main
import(
"context"
novugo "github.com/novuhq/novu-go"
"github.com/novuhq/novu-go/models/components"
"github.com/novuhq/novu-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Subscribers.Messages.UpdateAsSeen(ctx, operations.SubscribersV1ControllerMarkActionAsSeenRequest{
MessageID: "<id>",
Type: "<value>",
SubscriberID: "<id>",
MarkMessageActionAsSeenDto: components.MarkMessageActionAsSeenDto{
Status: components.MarkMessageActionAsSeenDtoStatusPending,
},
})
if err != nil {
log.Fatal(err)
}
if res.MessageResponseDto != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.SubscribersV1ControllerMarkActionAsSeenRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersV1ControllerMarkActionAsSeenResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 414 | application/json |
apierrors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.ErrorDto | 500 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Marks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed.
package main
import(
"context"
novugo "github.com/novuhq/novu-go"
"github.com/novuhq/novu-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Subscribers.Messages.MarkAll(ctx, "<id>", components.MarkAllMessageAsRequestDto{
MarkAs: components.MarkAsSeen,
}, nil)
if err != nil {
log.Fatal(err)
}
if res.Number != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
markAllMessageAsRequestDto |
components.MarkAllMessageAsRequestDto | ✔️ | N/A |
idempotencyKey |
*string | ➖ | A header for idempotency purposes |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersV1ControllerMarkAllUnreadAsReadResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 414 | application/json |
apierrors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.ErrorDto | 500 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Mark a subscriber messages as seen, read, unseen or unread
package main
import(
"context"
novugo "github.com/novuhq/novu-go"
"github.com/novuhq/novu-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Subscribers.Messages.MarkAllAs(ctx, "<id>", components.MessageMarkAsRequestDto{
MessageID: components.CreateMessageIDStr(
"<id>",
),
MarkAs: components.MessageMarkAsRequestDtoMarkAsUnread,
}, nil)
if err != nil {
log.Fatal(err)
}
if res.MessageResponseDtos != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
messageMarkAsRequestDto |
components.MessageMarkAsRequestDto | ✔️ | N/A |
idempotencyKey |
*string | ➖ | A header for idempotency purposes |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersV1ControllerMarkMessagesAsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 414 | application/json |
apierrors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.ErrorDto | 500 | application/json |
apierrors.APIError | 4XX, 5XX | */* |