transport

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 13 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

Overview

Package transport sends every request this CLI makes. It owns the three things a command should not have to: which token an operation takes, which address it goes to, and how a refusal reads.

Index

Constants

This section is empty.

Variables

View Source
var ErrRequestFailed = errors.New("request failed")

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Status  int
	Code    string
	Message string
	Meta    map[string]any
}

APIError is a refusal from a service. Callers branch on Code rather than matching prose: the wording changes, the code is contract.

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	Verbose bool
	Log     io.Writer
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config, tokens *auth.Manager, httpClient *http.Client) *Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, request *Request) (any, int, error)

type Request

type Request struct {
	Operation *spec.Operation

	// Path already has its {placeholders} substituted.
	Path string

	Query  url.Values
	Header http.Header
	Body   any
}

Jump to

Keyboard shortcuts

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