rest

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(v any) (provider.Provider, error)

New creates a new provider.

Types

type Spec

type Spec struct {
	BaseURL      string                `json:"base_url,omitempty"      yaml:"base_url,omitempty"`
	Endpoint     string                `json:"endpoint"                yaml:"endpoint"`
	Method       string                `json:"method"                  yaml:"method"`
	Headers      map[string]string     `json:"headers,omitempty"       yaml:"headers,omitempty"`
	PathParams   provider.ParameterSet `json:"path_params,omitempty"   yaml:"path_params,omitempty"`
	QueryParams  provider.ParameterSet `json:"query_params,omitempty"  yaml:"query_params,omitempty"`
	HeaderParams provider.ParameterSet `json:"header_params,omitempty" yaml:"header_params,omitempty"`
	BodyParams   provider.ParameterSet `json:"body_params,omitempty"   yaml:"body_params,omitempty"`
	RawBody      bool                  `json:"raw_body,omitempty"      yaml:"raw_body,omitempty"`
	Body         []form.Field          `json:"body,omitempty"          yaml:"body,omitempty"`
	PrintStatus  bool                  `json:"print_status,omitempty"  yaml:"print_status,omitempty"`
}

Spec describes the provider.

func (*Spec) Configure added in v0.5.0

func (s *Spec) Configure(cmd *cobra.Command)

Configure wires up the command's positional arguments, flags, and run behavior.

Path parameters are positional (and substituted into the endpoint); query, header, and body-field parameters are flags. When RawBody is set, the request body comes from a --body flag (inline JSON or @file) instead of body fields.

func (*Spec) Execute added in v0.8.0

func (s *Spec) Execute(ctx context.Context, in provider.Inputs) (*provider.Result, error)

Execute assigns the interactively-collected values, performs the request, and returns a structured result for display.

func (*Spec) Preview added in v0.9.0

func (s *Spec) Preview(ctx context.Context, in provider.Inputs) (*provider.RequestPreview, error)

Preview describes exactly what the request will send, without performing it. It assigns the collected inputs the same way Execute does, then reports the resolved method, URL, headers, and body, plus the headless CLI arguments that reproduce the request.

func (*Spec) Sections added in v0.8.0

func (s *Spec) Sections() []provider.Section

Sections describes the request's inputs for interactive entry: path, query, and header parameters, plus a body section (discrete fields, flat body params, or a single raw-text block depending on how the command is defined).

func (*Spec) Summary added in v0.8.0

func (s *Spec) Summary() string

Summary describes the request in one line, e.g. "GET /pets/{id}".

func (*Spec) Type

func (s *Spec) Type() string

Type returns the type.

func (*Spec) Validate

func (s *Spec) Validate() error

Validate validates the provider.

Jump to

Keyboard shortcuts

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