api

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 8 Imported by: 0 modules, 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

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Detail     string
}

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	BaseURL    string
	Auth       TokenSource
	HTTPClient *http.Client
}

func NewClient

func NewClient(baseURL, token string) *Client

func NewClientWithAuth added in v1.6.0

func NewClientWithAuth(baseURL string, auth TokenSource) *Client

func (*Client) Delete

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

func (*Client) Get

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

func (*Client) Patch

func (c *Client) Patch(path string, body interface{}) (json.RawMessage, error)

func (*Client) Post

func (c *Client) Post(path string, body interface{}) (json.RawMessage, error)

func (*Client) Put

func (c *Client) Put(path string, body interface{}) (json.RawMessage, error)

type StaticToken added in v1.6.0

type StaticToken string

StaticToken is a TokenSource for API tokens, which cannot be refreshed.

func (StaticToken) Refresh added in v1.6.0

func (t StaticToken) Refresh(string) (string, error)

func (StaticToken) Token added in v1.6.0

func (t StaticToken) Token() (string, error)

type TokenSource added in v1.6.0

type TokenSource interface {
	Token() (string, error)
	Refresh(stale string) (string, error)
}

TokenSource supplies the bearer token. Refresh is called once when the API answers 401 to a request sent with `stale`.

Jump to

Keyboard shortcuts

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