transport

package
v0.1.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

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