From a977545f893a7dcd72934fb618a51be427c92a85 Mon Sep 17 00:00:00 2001 From: Vilen Topchii <32271530+vtopc@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:54:53 +0200 Subject: [PATCH] fixes --- analytics.go | 5 ----- attachments_test.go | 3 ++- ips_test.go | 6 ++++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/analytics.go b/analytics.go index bbdc4ff..25d5271 100644 --- a/analytics.go +++ b/analytics.go @@ -2,7 +2,6 @@ package mailgun import ( "context" - "strings" "github.com/mailgun/errors" ) @@ -35,10 +34,6 @@ type MetricsPagination struct { // // https://documentation.mailgun.com/docs/mailgun/api-reference/openapi-final/tag/Metrics/ func (mg *MailgunImpl) ListMetrics(opts MetricsOptions) (*MetricsIterator, error) { - if !strings.HasSuffix(mg.APIBase(), "/v1") { - return nil, errors.New("only v1 API is supported") - } - if opts.Pagination.Limit == 0 { opts.Pagination.Limit = 10 } diff --git a/attachments_test.go b/attachments_test.go index 8e1de0a..55ffef5 100644 --- a/attachments_test.go +++ b/attachments_test.go @@ -27,7 +27,8 @@ func createAttachment(t *testing.T) string { func TestMultipleAttachments(t *testing.T) { mg := mailgun.NewMailgun(testKey) - mg.SetAPIBase(server.URL3()) + err := mg.SetAPIBase(server.URL3()) + require.NoError(t, err) var ctx = context.Background() diff --git a/ips_test.go b/ips_test.go index fa4fd03..79c3bd5 100644 --- a/ips_test.go +++ b/ips_test.go @@ -21,7 +21,8 @@ func TestMain(m *testing.M) { func TestListIPS(t *testing.T) { mg := mailgun.NewMailgun(testKey) - mg.SetAPIBase(server.URL3()) + err := mg.SetAPIBase(server.URL3()) + require.NoError(t, err) ctx := context.Background() list, err := mg.ListIPS(ctx, false) @@ -38,7 +39,8 @@ func TestListIPS(t *testing.T) { func TestDomainIPS(t *testing.T) { mg := mailgun.NewMailgun(testKey) - mg.SetAPIBase(server.URL3()) + err := mg.SetAPIBase(server.URL3()) + require.NoError(t, err) ctx := context.Background() err := mg.AddDomainIP(ctx, testDomain, "192.172.1.1")