Skip to content

Commit

Permalink
fix: typo in webhook.EventTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgacsal committed Oct 1, 2024
1 parent 70c112d commit d1dcef5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions openmeter/notification/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func (i SendMessageInput) Validate() error {
}

type RegisterEventTypesInputs struct {
EvenTypes []EventType
EventTypes []EventType
AllowUpdate bool
}

Expand Down Expand Up @@ -271,7 +271,7 @@ const (
type Config struct {
SvixConfig

RegisterEvenTypes []EventType
RegisterEventTypes []EventType
RegistrationTimeout time.Duration
SkipRegistrationOnError bool

Expand All @@ -283,8 +283,8 @@ func New(config Config) (Handler, error) {
return nil, errors.New("logger is required")
}

if config.RegisterEvenTypes == nil {
config.RegisterEvenTypes = NotificationEventTypes
if config.RegisterEventTypes == nil {
config.RegisterEventTypes = NotificationEventTypes
}

if config.RegistrationTimeout == 0 {
Expand All @@ -296,12 +296,12 @@ func New(config Config) (Handler, error) {
return nil, fmt.Errorf("failed to initialize Svix webhook handler: %w", err)
}

if len(config.RegisterEvenTypes) > 0 {
if len(config.RegisterEventTypes) > 0 {
ctx, cancel := context.WithTimeout(context.Background(), config.RegistrationTimeout)
defer cancel()

err = handler.RegisterEventTypes(ctx, RegisterEventTypesInputs{
EvenTypes: config.RegisterEvenTypes,
EventTypes: config.RegisterEventTypes,
})
if err != nil {
if config.SkipRegistrationOnError {
Expand Down
2 changes: 1 addition & 1 deletion test/notification/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type WebhookTestSuite struct {

func (s *WebhookTestSuite) Setup(ctx context.Context, t *testing.T) {
err := s.Env.NotificationWebhook().RegisterEventTypes(ctx, notificationwebhook.RegisterEventTypesInputs{
EvenTypes: notificationwebhook.NotificationEventTypes,
EventTypes: notificationwebhook.NotificationEventTypes,
})
assert.NoError(t, err, "Registering event types must not fail")
}
Expand Down

0 comments on commit d1dcef5

Please sign in to comment.