api

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const HintRunAuthLogin = "Run: gumroad auth login — or set GUMROAD_ACCESS_TOKEN"

Variables

View Source
var (
	ErrNotAuthenticated = errors.New("not authenticated")
	ErrAccessDenied     = errors.New("access denied")
	ErrResourceNotFound = errors.New("resource not found")
)

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Hint       string
}

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) GetHint

func (e *APIError) GetHint() string

func (*APIError) Is

func (e *APIError) Is(target error) bool

type Client

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

func NewClient

func NewClient(token, version string, debug bool) *Client

func NewClientWithContext

func NewClientWithContext(ctx context.Context, token, version string, debug bool) *Client

func (*Client) Delete

func (c *Client) Delete(path string, params url.Values) (json.RawMessage, error)

func (*Client) Get

func (c *Client) Get(path string, params url.Values) (json.RawMessage, error)

func (*Client) Post

func (c *Client) Post(path string, params url.Values) (json.RawMessage, error)

func (*Client) PostJSON added in v0.2.0

func (c *Client) PostJSON(path string, payload any) (json.RawMessage, error)

func (*Client) PostJSONWithContext added in v0.2.0

func (c *Client) PostJSONWithContext(ctx context.Context, path string, payload any) (json.RawMessage, error)

func (*Client) PostWithContext added in v0.2.0

func (c *Client) PostWithContext(ctx context.Context, path string, params url.Values) (json.RawMessage, error)

PostWithContext runs a POST under ctx instead of the client's baked-in context. Use this when a single call needs its own independent lifetime — e.g. best-effort cleanup that must still run after the original request context has been canceled.

func (*Client) Put

func (c *Client) Put(path string, params url.Values) (json.RawMessage, error)

func (*Client) PutJSON added in v0.2.0

func (c *Client) PutJSON(path string, payload any) (json.RawMessage, error)

func (*Client) SetDebugWriter

func (c *Client) SetDebugWriter(w io.Writer)

type HintedError

type HintedError interface {
	error
	GetHint() string
}

HintedError is implemented by errors that carry an actionable recovery suggestion.

type JSONInt

type JSONInt int

JSONInt is a Gumroad API compatibility shim for integer fields that may arrive as 1, 1.0, null, or be omitted.

Keep this type at the JSON decode boundary only. It exists to shield the CLI from upstream schema inconsistencies and should be easy to delete if the API becomes consistently typed.

func (*JSONInt) UnmarshalJSON

func (n *JSONInt) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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