Repository: mailgun/mailgun-go (go)

Issue:
Add support for the 'enabled' parameter in the ListIPs API call
In the `ListIPS` [function](https://github.com/mailgun/mailgun-go/blob/master/ips.go#L22) only the `dedicated` parameter is supported. According to the [List IPs](https://documentation.mailgun.com/docs/mailgun/api-reference/openapi-final/tag/IPs/#tag/IPs/operation/GET-v3-ips) API documentation, there is another parameter, `enabled`, which is available.

Please add support for the `enabled` parameter in the ListIPs call.

Pull request:
adding enabled parameter support to ListIPs
Closes #400 

Patch:
diff --git a/examples/examples.go b/examples/examples.go
index bac559d..585ab58 100644
--- a/examples/examples.go
+++ b/examples/examples.go
@@ -487,8 +487,9 @@ func ListIPS(domain, apiKey string) ([]mtypes.IPAddress, error) {
 	ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
 	defer cancel()
 
-	// Pass 'true' to only return dedicated ips
-	return mg.ListIPS(ctx, true)
+	// Pass 'true' as the first parameter to only return dedicated ips,
+	// pass 'true' as the second parameter to only return enabled ips.
+	return mg.ListIPS(ctx, true, true)
 }
 
 func GetTagLimits(domain, apiKey string) (mtypes.TagLimits, error) {
diff --git a/ips.go b/ips.go
index e159c34..c13eee1 100644
--- a/ips.go
+++ b/ips.go
@@ -7,12 +7,15 @@ import (
 )
 
 // ListIPS returns a list of IPs assigned to your account
-func (mg *Client) ListIPS(ctx context.Context, dedicated bool) ([]mtypes.IPAddress, error) {
+func (mg *Client) ListIPS(ctx context.Context, dedicated, enabled bool) ([]mtypes.IPAddress, error) {
 	r := newHTTPRequest(generateApiUrl(mg, 3, ipsEndpoint))
 	r.setClient(mg.HTTPClient())
 	if dedicated {
 		r.addParameter("dedicated", "true")
 	}
+	if enabled {
+		r.addParameter("enabled", "true")
+	}
 	r.setBasicAuth(basicAuthUser, mg.APIKey())
 
 	var resp mtypes.IPAddressListResponse
@@ -53,7 +56,7 @@ func (mg *Client) ListDomainIPS(ctx context.Context, domain string) ([]mtypes.IP
 	return result, nil
 }
 
-// Assign a dedicated IP to the domain specified.
+// AddDomainIP Assign a dedicated IP to the domain specified.
 func (mg *Client) AddDomainIP(ctx context.Context, domain, ip string) error {
 	r := newHTTPRequest(generateApiUrl(mg, 3, domainsEndpoint) + "/" + domain + "/ips")
 	r.setClient(mg.HTTPClient())
@@ -65,7 +68,7 @@ func (mg *Client) AddDomainIP(ctx context.Context, domain, ip string) error {
 	return err
 }
 
-// Unassign an IP from the domain specified.
+// DeleteDomainIP Unassign an IP from the domain specified.
 func (mg *Client) DeleteDomainIP(ctx context.Context, domain, ip string) error {
 	r := newHTTPRequest(generateApiUrl(mg, 3, domainsEndpoint) + "/" + domain + "/ips/" + ip)
 	r.setClient(mg.HTTPClient())
diff --git a/mailgun.go b/mailgun.go
index 78c9cdf..c1723ea 100644
--- a/mailgun.go
+++ b/mailgun.go
@@ -216,7 +216,7 @@ type Mailgun interface {
 	ListEvents(domain string, opts *ListEventOptions) *EventIterator
 	PollEvents(domain string, opts *ListEventOptions) *EventPoller
 
-	ListIPS(ctx context.Context, dedicated bool) ([]mtypes.IPAddress, error)
+	ListIPS(ctx context.Context, dedicated, enabled bool) ([]mtypes.IPAddress, error)
 	GetIP(ctx context.Context, ip string) (mtypes.IPAddress, error)
 	ListDomainIPS(ctx context.Context, domain string) ([]mtypes.IPAddress, error)
 	AddDomainIP(ctx context.Context, domain, ip string) error


Test patch:
diff --git a/ips_test.go b/ips_test.go
index 23c207e..1cfc4ec 100644
--- a/ips_test.go
+++ b/ips_test.go
@@ -15,7 +15,7 @@ func TestListIPS(t *testing.T) {
 	require.NoError(t, err)
 
 	ctx := context.Background()
-	list, err := mg.ListIPS(ctx, false)
+	list, err := mg.ListIPS(ctx, false, false)
 	require.NoError(t, err)
 	require.Len(t, list, 2)