func (mg *MailgunImpl) GetUnsubscribe(ctx context.Context, address string) (Unsubscribe, error) {
	r := newHTTPRequest(generateApiUrlWithTarget(mg, unsubscribesEndpoint, address))
	r.setClient(mg.Client())
	r.setBasicAuth(basicAuthUser, mg.APIKey())
	envelope := Unsubscribe{}
	err := getResponseFromJSON(ctx, r, &envelope)
	return envelope, err
}
Retreives a single unsubscribe record. Can be used to check if a given address is present in the list of unsubscribed users.
package mailgun
import (
	"context"
	"strconv"
)
type Unsubscribe struct {
	CreatedAt RFC2822Time `json:"created_at"`
	Tags      []string    `json:"tags"`
	ID        string      `json:"id"`
	Address   string      `json:"address"`
}
type unsubscribesResponse struct {
	Paging Paging        `json:"paging"`
	Items  []Unsubscribe `json:"items"`
}
func (mg *MailgunImpl) ListUnsubscribes(opts *ListOptions) *UnsubscribesIterator {
	r := newHTTPRequest(generateApiUrl(mg, unsubscribesEndpoint))
	r.setClient(mg.Client())
	r.setBasicAuth(basicAuthUser, mg.APIKey())
	if opts != nil {
		if opts.Limit != 0 {
			r.addParameter("limit", strconv.Itoa(opts.Limit))
		}
	}
	url, err := r.generateUrlWithParameters()
	return &UnsubscribesIterator{
		mg:                   mg,
		unsubscribesResponse: unsubscribesResponse{Paging: Paging{Next: url, First: url}},
		err:                  err,
	}
}
type UnsubscribesIterator struct {
	unsubscribesResponse
	mg  Mailgun
	err error
}
func (ci *UnsubscribesIterator) Err() error {
	return ci.err
}
func (ci *UnsubscribesIterator) Next(ctx context.Context, items *[]Unsubscribe) bool {
	if ci.err != nil {
		return false
	}
	ci.err = ci.fetch(ctx, ci.Paging.Next)
	if ci.err != nil {
		return false
	}
	cpy := make([]Unsubscribe, len(ci.Items))
	copy(cpy, ci.Items)
	*items = cpy
	if len(ci.Items) == 0 {
		return false
	}
	return true
}
func (ci *UnsubscribesIterator) First(ctx context.Context, items *[]Unsubscribe) bool {
	if ci.err != nil {
		return false
	}
	ci.err = ci.fetch(ctx, ci.Paging.First)
	if ci.err != nil {
		return false
	}
	cpy := make([]Unsubscribe, len(ci.Items))
	copy(cpy, ci.Items)
	*items = cpy
	return true
}
func (ci *UnsubscribesIterator) Last(ctx context.Context, items *[]Unsubscribe) bool {
	if ci.err != nil {
		return false
	}
	ci.err = ci.fetch(ctx, ci.Paging.Last)
	if ci.err != nil {
		return false
	}
	cpy := make([]Unsubscribe, len(ci.Items))
	copy(cpy, ci.Items)
	*items = cpy
	return true
}
func (ci *UnsubscribesIterator) Previous(ctx context.Context, items *[]Unsubscribe) bool {
	if ci.err != nil {
		return false
	}
	if ci.Paging.Previous == "" {
		return false
	}
	ci.err = ci.fetch(ctx, ci.Paging.Previous)
	if ci.err != nil {
		return false
	}
	cpy := make([]Unsubscribe, len(ci.Items))
	copy(cpy, ci.Items)
	*items = cpy
	if len(ci.Items) == 0 {
		return false
	}
	return true
}
func (ci *UnsubscribesIterator) fetch(ctx context.Context, url string) error {
	r := newHTTPRequest(url)
	r.setClient(ci.mg.Client())
	r.setBasicAuth(basicAuthUser, ci.mg.APIKey())
	return getResponseFromJSON(ctx, r, &ci.unsubscribesResponse)
}