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

DE-1392 Remove deprecated GetStats #372

Merged
merged 4 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion events.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/mailgun/mailgun-go/v4/events"
)

// ListEventOptions{} modifies the behavior of ListEvents()
// ListEventOptions modifies the behavior of ListEvents()
type ListEventOptions struct {
// Limits the results to a specific start and end time
Begin, End time.Time
Expand Down
11 changes: 0 additions & 11 deletions examples/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,17 +572,6 @@ func ListRoutes(domain, apiKey string) ([]mailgun.Route, error) {
return result, nil
}

func GetStats(domain, apiKey string) ([]mailgun.Stats, error) {
mg := mailgun.NewMailgun(domain, apiKey)

ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel()

return mg.GetStats(ctx, []string{"accepted", "delivered", "failed"}, &mailgun.GetStatOptions{
Duration: "1m",
})
}

func ListTags(domain, apiKey string) ([]mailgun.Tag, error) {
mg := mailgun.NewMailgun(domain, apiKey)
it := mg.ListTags(nil)
Expand Down
5 changes: 1 addition & 4 deletions mailgun.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,13 @@ var CaptureCurlOutput = false
var RedactCurlAuth = false

const (
// Base Url the library uses to contact mailgun. Use SetAPIBase() to override
// APIBase - base URL the library uses to contact mailgun. Use SetAPIBase() to override
APIBase = "https://api.mailgun.net/v3"
APIBaseUS = APIBase
APIBaseEU = "https://api.eu.mailgun.net/v3"
messagesEndpoint = "messages"
mimeMessagesEndpoint = "messages.mime"
bouncesEndpoint = "bounces"
statsTotalEndpoint = "stats/total"
metricsEndpoint = "analytics/metrics"
domainsEndpoint = "domains"
tagsEndpoint = "tags"
Expand Down Expand Up @@ -151,8 +150,6 @@ type Mailgun interface {

ListMetrics(opts MetricsOptions) (*MetricsIterator, error)

// Deprecated: Use ListMetrics instead.
GetStats(ctx context.Context, events []string, opts *GetStatOptions) ([]Stats, error)
GetTag(ctx context.Context, tag string) (Tag, error)
DeleteTag(ctx context.Context, tag string) error
ListTags(*ListTagOptions) *TagIterator
Expand Down
2 changes: 2 additions & 0 deletions messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type MimeMessage struct {
body io.ReadCloser
}

// TODO(v5): return from Send()
type sendMessageResponse struct {
Message string `json:"message"`
Id string `json:"id"`
Expand Down Expand Up @@ -596,6 +597,7 @@ func (m *CommonMessage) Headers() map[string]string {
// ErrInvalidMessage is returned by `Send()` when the `mailgun.CommonMessage` struct is incomplete
var ErrInvalidMessage = errors.New("message not valid")

// TODO(v5): rename to Message?
type SendableMessage interface {
Domain() string
To() []string
Expand Down
2 changes: 0 additions & 2 deletions mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type mockServer struct {
complaints []Complaint
bounces []Bounce
credentials []Credential
stats []Stats
tags []Tag
subaccountList []Subaccount
webhooks WebHooksListResponse
Expand Down Expand Up @@ -136,7 +135,6 @@ func NewMockServer() MockServer {
ms.addComplaintsRoutes(r)
ms.addBouncesRoutes(r)
ms.addCredentialsRoutes(r)
ms.addStatsRoutes(r)
ms.addTagsRoutes(r)
ms.addSubaccountRoutes(r)
})
Expand Down
65 changes: 0 additions & 65 deletions mock_stats.go

This file was deleted.

112 changes: 0 additions & 112 deletions stats.go

This file was deleted.

25 changes: 0 additions & 25 deletions stats_test.go

This file was deleted.

Loading