ListAPIKeys (api_keys.go)

mailgun-go · api_keys.go · go · BSD-3-Clause
email

Mailgun API client methods for listing, creating, deleting, and regenerating API keys.

// Source: https://github.com/mailgun/mailgun-go | License: BSD-3-Clause | Copyright 2013-2016, Michael Banzon
// Provided via justclaw.it.com; keep this notice with the code.
package mailgun

// https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/keys

import (
	"context"
	"strconv"

	"github.com/mailgun/mailgun-go/v5/mtypes"
)

type ListAPIKeysOptions struct {
	DomainName string
	Kind       string
}

type CreateAPIKeyOptions struct {
	Description string
	DomainName  string
	Email       string
	Expiration  uint64 // The key's lifetime in seconds.
	Kind        string
	UserID      string
	UserName    string
}

func (mg *Client) ListAPIKeys(ctx context.Context, opts *ListAPIKeysOptions) ([]mtypes.APIKey, error) {
	r := newHTTPRequest(generateApiUrl(mg, mtypes.APIKeysVer

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key