api

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseURL added in v1.6.0

func BaseURL() string

BaseURL returns the configured api_url, or the API's default base URL.

func CommandError added in v1.4.0

func CommandError(err error) error

CommandError gives an API error from a raw call the exit code and hints the generated commands give theirs; other errors pass through.

func CompletionRequest added in v1.3.0

func CompletionRequest() client.ClientWithResponsesInterface

CompletionRequest returns an API client for shell completion: it uses the static token or an already stored OAuth sign-in, and never starts an interactive login.

func Request

Request returns the API client for a command run. Without a static token it signs in through OAuth, opening the browser when needed.

func UserAgent added in v1.6.0

func UserAgent() string

UserAgent is the User-Agent header value of every API request.

Types

type Error added in v1.4.0

type Error struct {
	Method string
	Path   string
	Status int
	Body   []byte
}

func (*Error) Error added in v1.4.0

func (e *Error) Error() string

type RawClient added in v1.4.0

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

RawClient calls API paths directly, configured like the typed client, so hand-written commands don't depend on generated method names.

func NewRawClient added in v1.4.0

func NewRawClient(server string, doer client.HttpRequestDoer) *RawClient

NewRawClient has no authentication (tests).

func Raw added in v1.4.0

func Raw() *RawClient

Raw ignores --dry-run: hand-written commands look up the website, account or order with it before the request --dry-run prints, so those lookups are sent. Under --dry-run they use a token or a stored sign-in but never start a login, so a dry run without credentials fails at once instead of waiting on a browser.

func (*RawClient) JSON added in v1.4.0

func (r *RawClient) JSON(ctx context.Context, method, path string, query url.Values, body any, out any) error

JSON decodes a 2xx response into out (may be nil); other statuses are *Error.

Jump to

Keyboard shortcuts

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