admincmd

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchGetDecoded

func FetchGetDecoded[T any](opts cmdutil.Options, spinnerMessage, path string, params url.Values) (T, error)

FetchGetDecoded fetches a GET endpoint and decodes the response without rendering it. Use it when chaining requests where only the data is needed.

func FetchPostJSON

func FetchPostJSON(opts cmdutil.Options, spinnerMessage, path string, payload any) (json.RawMessage, error)

FetchPostJSON posts a JSON payload and returns the raw response without rendering it. Use this when the caller needs to keep transport-level failures distinguishable from post-success render/decode errors (e.g. so only the POST failure gets a "request failed" wrapper).

func NewAPIClient

func NewAPIClient(opts cmdutil.Options, token string) *adminapi.Client

func ResolveMutationToken added in v0.12.0

func ResolveMutationToken(opts cmdutil.Options) (adminconfig.TokenInfo, error)

ResolveMutationToken resolves the token policy used by mutating admin commands.

func Run

func Run(opts cmdutil.Options, spinnerMessage string, run ClientRunner, render func(json.RawMessage) error) error

func RunDecoded

func RunDecoded[T any](opts cmdutil.Options, spinnerMessage string, run ClientRunner, render func(T) error) error

func RunGet

func RunGet(opts cmdutil.Options, spinnerMessage, path string, params url.Values, render func(json.RawMessage) error) error

func RunGetDecoded

func RunGetDecoded[T any](opts cmdutil.Options, spinnerMessage, path string, params url.Values, render func(T) error) error

func RunPostJSONDecoded

func RunPostJSONDecoded[T any](opts cmdutil.Options, spinnerMessage, path string, payload any, render func(T) error) error

func WriteActorBanner added in v0.12.0

func WriteActorBanner(opts cmdutil.Options, info adminconfig.TokenInfo) error

WriteActorBanner prints the stored admin actor banner for mutating commands.

Types

type ClientRunner

type ClientRunner func(*adminapi.Client) (json.RawMessage, error)

Jump to

Keyboard shortcuts

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