Skip to content

Latest commit

 

History

History
114 lines (83 loc) · 4.51 KB

README.md

File metadata and controls

114 lines (83 loc) · 4.51 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_API_KEY")),
    )

    res, err := s.Notifications.Stats.Get(ctx)
    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.
opts []operations.Option The options for this request.

Response

*operations.NotificationsControllerGetActivityStatsResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorDto 400, 404, 409 application/json
apierrors.ValidationErrorDto 422 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_API_KEY")),
    )

    res, err := s.Notifications.Stats.GetGraph(ctx, 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
opts []operations.Option The options for this request.

Response

*operations.NotificationsControllerGetActivityGraphStatsResponse, error

Errors

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