Skip to content

Latest commit

 

History

History
124 lines (93 loc) · 8.29 KB

README.md

File metadata and controls

124 lines (93 loc) · 8.29 KB

NovuNotifications

(Subscribers.Notifications)

Overview

Available Operations

  • Feed - Get in-app notification feed for a particular subscriber
  • UnseenCount - Get the unseen in-app notifications count for subscribers feed

Feed

Get in-app notification feed for a particular subscriber

Example Usage

package main

import(
	"context"
	novugo "github.com/novuhq/novu-go"
	"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.Notifications.Feed(ctx, operations.SubscribersV1ControllerGetNotificationsFeedRequest{
        SubscriberID: "<id>",
        Payload: novugo.String("btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30="),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.FeedResponseDto != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.SubscribersV1ControllerGetNotificationsFeedRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.SubscribersV1ControllerGetNotificationsFeedResponse, error

Errors

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 */*

UnseenCount

Get the unseen in-app notifications count for subscribers feed

Example Usage

package main

import(
	"context"
	novugo "github.com/novuhq/novu-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := novugo.New(
        novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
    )

    res, err := s.Subscribers.Notifications.UnseenCount(ctx, "<id>", nil, nil, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.UnseenCountResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
subscriberID string ✔️ N/A
seen *bool Indicates whether to count seen notifications.
limit *float64 The maximum number of notifications to return.
idempotencyKey *string A header for idempotency purposes
opts []operations.Option The options for this request.

Response

*operations.SubscribersV1ControllerGetUnseenCountResponse, error

Errors

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 */*