Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(events): add events api #1065

Merged
merged 5 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions newrelic/events_service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package newrelic

import (
"context"
)

type EventsAPI interface {
Julien4218 marked this conversation as resolved.
Show resolved Hide resolved
CreateEvent(accountID int, event interface{}) error
CreateEventWithContext(ctx context.Context, accountID int, event interface{}) error
}

func NewEventsService(client *NewRelic) EventsAPI {
return &client.Events
}
18 changes: 18 additions & 0 deletions newrelic/events_service_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//go:build unit
// +build unit

package newrelic

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestShouldCreateEventsService(t *testing.T) {
t.Parallel()

client, _ := New(ConfigPersonalAPIKey(testAPIkey))
service := NewEventsService(client)
assert.Equal(t, service, &client.Events)
}
Loading