func (ri *CredentialsIterator) Previous(ctx context.Context, items *[]Credential) 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([]Credential, len(ri.Items))
	copy(cpy, ri.Items)
	*items = cpy
	if len(ri.Items) == 0 {
		return false
	}
	return true
}
Previous retrieves the previous page of items from the api. Returns false when there
no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
the error if any
package mailgun
import (
	"context"
	"fmt"
	"strconv"
)
type Credential struct {
	CreatedAt RFC2822Time `json:"created_at"`
	Login     string      `json:"login"`
	Password  string      `json:"password"`
}
type credentialsListResponse struct {
	TotalCount int          `json:"total_count"`
	Items      []Credential `json:"items"`
}
var ErrEmptyParam = fmt.Errorf("empty or illegal parameter")
func (mg *MailgunImpl) ListCredentials(opts *ListOptions) *CredentialsIterator {
	var limit int
	if opts != nil {
		limit = opts.Limit
	}
	if limit == 0 {
		limit = 100
	}
	return &CredentialsIterator{
		mg:                      mg,
		url:                     generateCredentialsUrl(mg, ""),
		credentialsListResponse: credentialsListResponse{TotalCount: -1},
		limit:                   limit,
	}
}
type CredentialsIterator struct {
	credentialsListResponse
	limit  int
	mg     Mailgun
	offset int
	url    string
	err    error
}
func (ri *CredentialsIterator) Err() error {
	return ri.err
}
func (ri *CredentialsIterator) Offset() int {
	return ri.offset
}
func (ri *CredentialsIterator) Next(ctx context.Context, items *[]Credential) bool {
	if ri.err != nil {
		return false
	}
	ri.err = ri.fetch(ctx, ri.offset, ri.limit)
	if ri.err != nil {
		return false
	}
	cpy := make([]Credential, 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 *CredentialsIterator) First(ctx context.Context, items *[]Credential) bool {
	if ri.err != nil {
		return false
	}
	ri.err = ri.fetch(ctx, 0, ri.limit)
	if ri.err != nil {
		return false
	}
	cpy := make([]Credential, len(ri.Items))
	copy(cpy, ri.Items)
	*items = cpy
	ri.offset = len(ri.Items)
	return true
}
func (ri *CredentialsIterator) Last(ctx context.Context, items *[]Credential) 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([]Credential, len(ri.Items))
	copy(cpy, ri.Items)
	*items = cpy
	return true
}