Skip to content

Latest commit

 

History

History
120 lines (89 loc) · 5.77 KB

README.md

File metadata and controls

120 lines (89 loc) · 5.77 KB

Stats

(Notifications.Stats)

Overview

Available Operations

  • Get - Get notification statistics
  • GetGraph - Get notification graph statistics

Get

Get notification statistics

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_SECRET_KEY")),
    )

    res, err := s.Notifications.Stats.Get(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.ActivityStatsResponseDto != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
idempotencyKey *string A header for idempotency purposes
opts []operations.Option The options for this request.

Response

*operations.NotificationsControllerGetActivityStatsResponse, 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 */*

GetGraph

Get notification graph statistics

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_SECRET_KEY")),
    )

    res, err := s.Notifications.Stats.GetGraph(ctx, nil, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.ActivityGraphStatesResponses != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
days *float64 N/A
idempotencyKey *string A header for idempotency purposes
opts []operations.Option The options for this request.

Response

*operations.NotificationsControllerGetActivityGraphStatsResponse, 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 */*