httpclient

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAPIURL = errors.New("API URL is required (set ADAPTO_CLI_API_URL or --api-url)")

ErrNoAPIURL is returned when no Management API base URL has been configured.

View Source
var ErrSessionExpired = errors.New("session expired — run 'adapto auth login' to sign in again")

ErrSessionExpired is returned when a 401 could not be recovered by refreshing.

Functions

func New

New creates a ClientWithResponses that injects Bearer token and X-Tenant-ID headers.

func NewHTTPClient added in v0.1.4

func NewHTTPClient(cfg config.Config) *http.Client

NewHTTPClient returns the http.Client used for Management API calls: verbose request/response dumping when enabled, plus a one-shot token refresh on 401.

Routes that the generated OpenAPI client does not cover yet are issued by hand against this client so they behave like every other API call. It must not be used for uploads to S3 presigned URLs: those carry their own credentials in the query string, and the verbose transport would dump the entire request body.

func SetAPIHeaders added in v0.1.4

func SetAPIHeaders(req *http.Request, cfg config.Config)

SetAPIHeaders applies the headers every Management API request carries.

These identify the caller to the Adapto API and must never be copied onto a presigned S3 PUT: the signature does not cover them and S3 answers with an opaque 403.

Types

This section is empty.

Jump to

Keyboard shortcuts

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