notification

package
v1.0.0-beta.217 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2025 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestFeature2Name = "TestFeature2"
	TestFeature2Key  = "test-feature-2"

	TestFeature3Name = "TestFeature3"
	TestFeature3Key  = "test-feature-3"
)
View Source
const (
	TestMeterSlug   = "api-call"
	TestFeatureName = "API Requests"
	TestFeatureKey  = "api-call"
	TestFeatureID   = "api-call-id"
	TestSubjectKey  = "john-doe"
	TestSubjectID   = "john-doe-id"
	// TestWebhookURL is the target URL where the notifications are sent to.
	// Use the following URL to verify notifications events sent over webhook channel:
	// https://play.svix.com/view/e_eyihAQHBB5d6T9ck1iYevP825pg
	TestWebhookURL = "https://play.svix.com/in/e_eyihAQHBB5d6T9ck1iYevP825pg/"
	// TestSigningSecret used for verifying events sent to webhook.
	TestSigningSecret = "whsec_Fk5kgr5qTdPdQIDniFv+6K0WN2bUpdGjjGtaNeAx8N8="

	PostgresURLTemplate   = "postgres://postgres:postgres@%s:5432/postgres?sslmode=disable"
	SvixServerURLTemplate = "http://%s:8071"
)
View Source
const (
	DefaultSvixHost             = "127.0.0.1"
	DefaultSvixJWTSigningSecret = "" /* 231-byte string literal not displayed */
)

Variables

View Source
var (
	TestEntitlementCurrentUsagePeriod = timeutil.ClosedPeriod{
		From: time.Now().Add(-time.Hour),
		To:   time.Now().Add(24 * time.Hour),
	}
	TestEntitlementUsagePeriod = entitlement.NewUsagePeriodFromRecurrence(timeutil.Recurrence{
		Interval: timeutil.RecurrencePeriodDaily,
		Anchor:   TestEntitlementCurrentUsagePeriod.From,
	})
	TestEntitlementID = "test-entitlement-id"
)
View Source
var NewTestNamespace = NewTestULID

Functions

func NewBalanceThresholdPayload

func NewBalanceThresholdPayload() notification.EventPayload

func NewClickhouseClient

func NewClickhouseClient(addr string) (clickhousedriver.Conn, error)

func NewCreateChannelInput

func NewCreateChannelInput(namespace, name string) notification.CreateChannelInput

func NewCreateEventInput

func NewCreateEventInput(namespace string, t notification.EventType, ruleID string, payload notification.EventPayload) notification.CreateEventInput

func NewCreateRuleInput

func NewCreateRuleInput(namespace string, name string, channels ...string) notification.CreateRuleInput

func NewCreateWebhookInput

func NewCreateWebhookInput(namespace string, id *string, desc string) notificationwebhook.CreateWebhookInput

func NewEntitlementResetPayload

func NewEntitlementResetPayload() notification.EventPayload

func NewSvixAuthToken

func NewSvixAuthToken(signingSecret string) (string, error)

func NewTestULID

func NewTestULID(t *testing.T) string

Types

type BalanceNotificaiontHandlerTestSuite

type BalanceNotificaiontHandlerTestSuite struct {
	Env TestEnv
	// contains filtered or unexported fields
}

func (*BalanceNotificaiontHandlerTestSuite) TestFeatureFiltering

func (s *BalanceNotificaiontHandlerTestSuite) TestFeatureFiltering(ctx context.Context, t *testing.T)

func (*BalanceNotificaiontHandlerTestSuite) TestGrantingFlow

func (s *BalanceNotificaiontHandlerTestSuite) TestGrantingFlow(ctx context.Context, t *testing.T)

type BalanceSnapshotEventInput

type BalanceSnapshotEventInput struct {
	Feature   feature.Feature
	Value     snapshot.EntitlementValue
	Namespace string
}

type ChannelTestSuite

type ChannelTestSuite struct {
	Env TestEnv
}

func (*ChannelTestSuite) TestCreate

func (s *ChannelTestSuite) TestCreate(ctx context.Context, t *testing.T)

func (*ChannelTestSuite) TestDelete

func (s *ChannelTestSuite) TestDelete(ctx context.Context, t *testing.T)

func (*ChannelTestSuite) TestGet

func (s *ChannelTestSuite) TestGet(ctx context.Context, t *testing.T)

func (*ChannelTestSuite) TestList

func (s *ChannelTestSuite) TestList(ctx context.Context, t *testing.T)

func (*ChannelTestSuite) TestUpdate

func (s *ChannelTestSuite) TestUpdate(ctx context.Context, t *testing.T)

type EventTestSuite

type EventTestSuite struct {
	Env TestEnv
	// contains filtered or unexported fields
}

func (*EventTestSuite) Setup

func (s *EventTestSuite) Setup(ctx context.Context, t *testing.T)

func (*EventTestSuite) TestCreateEvent

func (s *EventTestSuite) TestCreateEvent(ctx context.Context, t *testing.T)

func (*EventTestSuite) TestGetEvent

func (s *EventTestSuite) TestGetEvent(ctx context.Context, t *testing.T)

func (*EventTestSuite) TestListDeliveryStatus

func (s *EventTestSuite) TestListDeliveryStatus(ctx context.Context, t *testing.T)

func (*EventTestSuite) TestListEvents

func (s *EventTestSuite) TestListEvents(ctx context.Context, t *testing.T)

func (*EventTestSuite) TestUpdateDeliveryStatus

func (s *EventTestSuite) TestUpdateDeliveryStatus(ctx context.Context, t *testing.T)

type RepositoryTestSuite

type RepositoryTestSuite struct {
	Env TestEnv
	// contains filtered or unexported fields
}

func (*RepositoryTestSuite) Setup

func (s *RepositoryTestSuite) Setup(ctx context.Context, t *testing.T)

func (*RepositoryTestSuite) TestFilterEventByFeature

func (s *RepositoryTestSuite) TestFilterEventByFeature(t *testing.T)

func (*RepositoryTestSuite) TestFilterEventBySubject

func (s *RepositoryTestSuite) TestFilterEventBySubject(t *testing.T)

type RuleTestSuite

type RuleTestSuite struct {
	Env TestEnv
	// contains filtered or unexported fields
}

func (*RuleTestSuite) Setup

func (s *RuleTestSuite) Setup(ctx context.Context, t *testing.T)

func (*RuleTestSuite) TestCreate

func (s *RuleTestSuite) TestCreate(ctx context.Context, t *testing.T)

func (*RuleTestSuite) TestDelete

func (s *RuleTestSuite) TestDelete(ctx context.Context, t *testing.T)

func (*RuleTestSuite) TestGet

func (s *RuleTestSuite) TestGet(ctx context.Context, t *testing.T)

func (*RuleTestSuite) TestList

func (s *RuleTestSuite) TestList(ctx context.Context, t *testing.T)

func (*RuleTestSuite) TestUpdate

func (s *RuleTestSuite) TestUpdate(ctx context.Context, t *testing.T)

type TestEnv

type TestEnv interface {
	NotificationRepo() notification.Repository
	Notification() notification.Service
	NotificationWebhook() notificationwebhook.Handler

	Feature() feature.FeatureConnector
	Meter() *meteradapter.TestAdapter

	Namespace() string

	Close() error
}

func NewTestEnv

func NewTestEnv(t *testing.T, ctx context.Context, namespace string) (TestEnv, error)

type WebhookTestSuite

type WebhookTestSuite struct {
	Env TestEnv
}

func (*WebhookTestSuite) Setup

func (s *WebhookTestSuite) Setup(ctx context.Context, t *testing.T)

func (*WebhookTestSuite) TestCreateWebhook

func (s *WebhookTestSuite) TestCreateWebhook(ctx context.Context, t *testing.T)

func (*WebhookTestSuite) TestDeleteWebhook

func (s *WebhookTestSuite) TestDeleteWebhook(ctx context.Context, t *testing.T)

func (*WebhookTestSuite) TestGetWebhook

func (s *WebhookTestSuite) TestGetWebhook(ctx context.Context, t *testing.T)

func (*WebhookTestSuite) TestListWebhook

func (s *WebhookTestSuite) TestListWebhook(ctx context.Context, t *testing.T)

func (*WebhookTestSuite) TestUpdateWebhook

func (s *WebhookTestSuite) TestUpdateWebhook(ctx context.Context, t *testing.T)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL