func (mg *MailgunImpl) DeleteRoute(ctx context.Context, id string) error {
	r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id)
	r.setClient(mg.Client())
	r.setBasicAuth(basicAuthUser, mg.APIKey())
	_, err := makeDeleteRequest(ctx, r)
	return err
}
DeleteRoute removes the specified route from your domain's configuration.
To avoid ambiguity, Mailgun identifies the route by unique ID.
See the Route structure definition and the Mailgun API documentation for more details.
package mailgun
import (
	"context"
	"strconv"
)
type Route struct {
	Priority int `json:"priority,omitempty"`
	Description string `json:"description,omitempty"`
	Expression string `json:"expression,omitempty"`
	Actions []string `json:"actions,omitempty"`
	CreatedAt RFC2822Time `json:"created_at,omitempty"`
	Id string `json:"id,omitempty"`
}
type routesListResponse struct {
	TotalCount int     `json:"total_count"`
	Items      []Route `json:"items"`
}
type createRouteResp struct {
	Message string `json:"message"`
	Route   `json:"route"`
}
func (mg *MailgunImpl) ListRoutes(opts *ListOptions) *RoutesIterator {
	var limit int
	if opts != nil {
		limit = opts.Limit
	}
	if limit == 0 {
		limit = 100
	}
	return &RoutesIterator{
		mg:                 mg,
		url:                generatePublicApiUrl(mg, routesEndpoint),
		routesListResponse: routesListResponse{TotalCount: -1},
		limit:              limit,
	}
}
type RoutesIterator struct {
	routesListResponse
	limit  int
	mg     Mailgun
	offset int
	url    string
	err    error
}
func (ri *RoutesIterator) Err() error {
	return ri.err
}
func (ri *RoutesIterator) Offset() int {
	return ri.offset
}
func (ri *RoutesIterator) Next(ctx context.Context, items *[]Route) bool {
	if ri.err != nil {
		return false
	}
	ri.err = ri.fetch(ctx, ri.offset, ri.limit)
	if ri.err != nil {
		return false
	}
	cpy := make([]Route, len(ri.Items))
	copy(cpy, ri.Items)
	*items = cpy
	if len(ri.Items) == 0 {
		return false
	}
	ri.offset = ri.offset + len(ri.Items)
	return true
}
func (ri *RoutesIterator) First(ctx context.Context, items *[]Route) bool {
	if ri.err != nil {
		return false
	}
	ri.err = ri.fetch(ctx, 0, ri.limit)
	if ri.err != nil {
		return false
	}
	cpy := make([]Route, len(ri.Items))
	copy(cpy, ri.Items)
	*items = cpy
	ri.offset = len(ri.Items)
	return true
}
func (ri *RoutesIterator) Last(ctx context.Context, items *[]Route) bool {
	if ri.err != nil {
		return false
	}
	if ri.TotalCount == -1 {
		return false
	}
	ri.offset = ri.TotalCount - ri.limit
	if ri.offset < 0 {
		ri.offset = 0
	}
	ri.err = ri.fetch(ctx, ri.offset, ri.limit)
	if ri.err != nil {
		return false
	}
	cpy := make([]Route, len(ri.Items))
	copy(cpy, ri.Items)
	*items = cpy
	return true
}
func (ri *RoutesIterator) Previous(ctx context.Context, items *[]Route) bool {
	if ri.err != nil {
		return false
	}
	if ri.TotalCount == -1 {
		return false
	}
	ri.offset = ri.offset - (ri.limit * 2)
	if ri.offset < 0 {
		ri.offset = 0
	}
	ri.err = ri.fetch(ctx, ri.offset, ri.limit)
	if ri.err != nil {
		return false
	}
	cpy := make([]Route, len(ri.Items))
	copy(cpy, ri.Items)
	*items = cpy
	if len(ri.Items) == 0 {
		return false
	}
	return true
}
func (ri *RoutesIterator) fetch(ctx context.Context, skip, limit int) error {
	r := newHTTPRequest(ri.url)
	r.setBasicAuth(basicAuthUser, ri.mg.APIKey())
	r.setClient(ri.mg.Client())
	if skip != 0 {
		r.addParameter("skip", strconv.Itoa(skip))
	}
	if limit != 0 {
		r.addParameter("limit", strconv.Itoa(limit))
	}
	return getResponseFromJSON(ctx, r, &ri.routesListResponse)
}
func (mg *MailgunImpl) CreateRoute(ctx context.Context, prototype Route) (_ignored Route, err error) {
	r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint))
	r.setClient(mg.Client())
	r.setBasicAuth(basicAuthUser, mg.APIKey())
	p := newUrlEncodedPayload()
	p.addValue("priority", strconv.Itoa(prototype.Priority))
	p.addValue("description", prototype.Description)
	p.addValue("expression", prototype.Expression)
	for _, action := range prototype.Actions {
		p.addValue("action", action)
	}
	var resp createRouteResp
	if err = postResponseFromJSON(ctx, r, p, &resp); err != nil {
		return _ignored, err
	}
	return resp.Route, err
}