dodo

package
v1.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2026 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLicenseKey       = errors.New("license key is invalid")
	ErrLicenseNotFound         = errors.New("license key not found")
	ErrActivationLimitExceeded = errors.New("license activation limit exceeded")
	ErrInstanceNotFound        = errors.New("license activation instance not found")
	ErrRateLimitExceeded       = errors.New("rate limit exceeded")
)

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
}

func (*APIError) Error

func (e *APIError) Error() string

type ActivateRequest

type ActivateRequest struct {
	LicenseKey string `json:"license_key"`
	Name       string `json:"name,omitempty"`
}

type ActivateResponse

type ActivateResponse struct {
	ID         string     `json:"id,omitempty"`
	InstanceID string     `json:"instance_id,omitempty"`
	ExpiresAt  *time.Time `json:"expires_at,omitempty"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ...OptFunc) *Client

func (*Client) Activate

func (c *Client) Activate(ctx context.Context, req ActivateRequest) (*ActivateResponse, error)

func (*Client) BaseURL

func (c *Client) BaseURL() string

func (*Client) Deactivate

func (c *Client) Deactivate(ctx context.Context, req DeactivateRequest) (*DeactivateResponse, error)

func (*Client) Validate

func (c *Client) Validate(ctx context.Context, req ValidateRequest) (*ValidateResponse, error)

type DeactivateRequest

type DeactivateRequest struct {
	LicenseKey           string `json:"license_key"`
	LicenseKeyInstanceID string `json:"license_key_instance_id,omitempty"`
	InstanceID           string `json:"instance_id,omitempty"`
}

type DeactivateResponse

type DeactivateResponse struct {
	Success bool `json:"success"`
}

type OptFunc

type OptFunc func(*Client)

func WithBaseURL

func WithBaseURL(baseURL string) OptFunc

func WithEnvironment

func WithEnvironment(env string) OptFunc

WithEnvironment sets the Dodo Payments environment ("test_mode" or "live_mode").

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) OptFunc

func WithUserAgent

func WithUserAgent(userAgent string) OptFunc

type ValidateRequest

type ValidateRequest struct {
	LicenseKey           string `json:"license_key"`
	LicenseKeyInstanceID string `json:"license_key_instance_id,omitempty"`
}

type ValidateResponse

type ValidateResponse struct {
	Valid      bool       `json:"valid"`
	Status     string     `json:"status,omitempty"`
	ExpiresAt  *time.Time `json:"expires_at,omitempty"`
	InstanceID string     `json:"instance_id,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL