Skip to content

Latest commit

 

History

History
116 lines (85 loc) · 6.32 KB

README.md

File metadata and controls

116 lines (85 loc) · 6.32 KB

Notifications

(Notifications)

Overview

Available Operations

  • List - Get notifications
  • Get - Get notification

List

Get notifications

Example Usage

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.Notifications.List(ctx, operations.NotificationsControllerListNotificationsRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.ActivitiesResponseDto != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.NotificationsControllerListNotificationsResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorDto 400, 404, 409 application/json
apierrors.ValidationErrorDto 422 application/json
apierrors.APIError 4XX, 5XX */*

Get

Get notification

Example Usage

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.Notifications.Get(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.ActivityNotificationResponseDto != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
notificationID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.NotificationsControllerGetNotificationResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorDto 400, 404, 409 application/json
apierrors.ValidationErrorDto 422 application/json
apierrors.APIError 4XX, 5XX */*