Documentation
¶
Overview ¶
Package restish is the public Go API for embedding Restish in custom CLIs.
The stock restish binary is built from cmd/restish. Embedders can construct a CLI directly, register organization-specific auth handlers, content types, encodings, link parsers, OpenAPI loaders, and formatters, then call Run with their own argv.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIConfig ¶
APIConfig holds one registered API's base URL, spec source, profiles, and generated-command options.
type AuthConfig ¶
type AuthConfig = config.AuthConfig
AuthConfig holds one configured auth handler type and its parameters.
type AuthContext ¶
type AuthContext = auth.AuthContext
AuthContext is passed to custom auth handlers during request authentication.
type AuthHandler ¶
AuthHandler is implemented by custom authentication schemes.
type CLI ¶
type CLI = internalcli.CLI
CLI is an embeddable Restish runtime.
The zero value is not intended for use; call New so standard content types, loaders, formatters, paths, and I/O streams are initialized.
func New ¶
func New() *CLI
New returns a CLI wired to the real OS stdin/stdout/stderr and the default Restish registries. Customize it with SetCommandName, SetCommandDescription, SetVersion, SetSignalHandling, SetDefaultConfig, AddAuthHandler, AddContentType, AddEncoding, AddLinkParser, AddLoader, and AddFormatter before calling Run.
type ContentType ¶
type ContentType = content.ContentType
ContentType describes one request/response body encoder and decoder.
type Link ¶
type Link = hypermedia.Link
Link is a normalized hypermedia link returned by custom link parsers.
type LinkParser ¶
type LinkParser = hypermedia.Parser
LinkParser extracts hypermedia links from response headers or bodies.
type LoadOptions ¶
type LoadOptions = spec.LoadOptions
LoadOptions carries source metadata for custom spec loaders.
type ProfileConfig ¶
type ProfileConfig = config.ProfileConfig
ProfileConfig holds one API profile's headers, query parameters, auth, and TLS settings.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
restish
command
|
|
|
restish-bulk
command
|
|
|
restish-csv
command
|
|
|
restish-docgen
command
|
|
|
restish-mcp
command
|
|
|
restish-pkcs11
command
|
|
|
internal
|
|
|
cache
Package cache provides a size-bounded, LRU-evicting disk cache that implements the httpcache.Cache interface.
|
Package cache provides a size-bounded, LRU-evicting disk cache that implements the httpcache.Cache interface. |
|
content
Package content provides a registry of content types and encodings for marshalling/unmarshalling request and response bodies, and for transparent decompression of compressed responses.
|
Package content provides a registry of content types and encodings for marshalling/unmarshalling request and response bodies, and for transparent decompression of compressed responses. |
|
filter
Package filter applies shorthand or jq expressions to a response value.
|
Package filter applies shorthand or jq expressions to a response value. |
|
hypermedia
Package hypermedia provides parsers that extract typed links from HTTP responses in various hypermedia formats (Link headers, HAL, TSJ, JSON:API, Siren).
|
Package hypermedia provides parsers that extract typed links from HTTP responses in various hypermedia formats (Link headers, HAL, TSJ, JSON:API, Siren). |
|
input
Package input builds HTTP request bodies from CLI arguments and/or stdin.
|
Package input builds HTTP request bodies from CLI arguments and/or stdin. |
|
plugin
Package plugin handles discovery, manifest loading, and caching of Restish out-of-process plugins.
|
Package plugin handles discovery, manifest loading, and caching of Restish out-of-process plugins. |
|
secrets
Package secrets centralizes the small allow-lists Restish uses to recognize credential-bearing names at trust boundaries.
|
Package secrets centralizes the small allow-lists Restish uses to recognize credential-bearing names at trust boundaries. |
|
spec
Package spec handles API specification discovery, loading, and caching.
|
Package spec handles API specification discovery, loading, and caching. |
|
Package plugin provides the public contract for writing Restish out-of-process plugins.
|
Package plugin provides the public contract for writing Restish out-of-process plugins. |
|
Package themes exposes the official Restish theme files bundled with each release.
|
Package themes exposes the official Restish theme files bundled with each release. |