execute

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxResponseBytes int64 = 1 << 20

Variables

This section is empty.

Functions

func CheckParams

func CheckParams(op *catalog.Operation, params map[string]string) error

func DraftRequest

func DraftRequest(ctx context.Context, base string, op *catalog.Operation, params map[string]string) (*http.Request, error)

The upstream request without credentials. Strict checks stay on the real call.

func IdempotencyFrom

func IdempotencyFrom(ctx context.Context) string

func InvokeResponse

func InvokeResponse(ctx context.Context, cfg Config, op *catalog.Operation, params map[string]string) (*http.Response, error)

func ReadBody

func ReadBody(resp *http.Response) (string, error)

func Sanitize

func Sanitize(req *http.Request) (method, rawURL string, headers map[string]string, body string)

func Unserializable

func Unserializable(p catalog.Param) string

Unserializable reports why a parameter cannot be placed on the request. An empty string means the call can send it.

func WithIdempotency

func WithIdempotency(ctx context.Context, key string) context.Context

func WithProjection

func WithProjection(ctx context.Context, p Projection) context.Context

WithProjection carries invoke-request fields. They override the client list when set.

Types

type Client

type Client struct {
	BaseURL         string
	HTTP            *http.Client
	RecordBody      bool
	Auth            map[string]string
	Creds           *auth.Resolver
	FollowPages     int
	FollowRedirects bool
	MaxBody         int64
	Fields          []string
	Limit           int
}

func (Client) InvokeHTTPResult

func (c Client) InvokeHTTPResult(ctx context.Context, op *catalog.Operation, params map[string]string) (result.HTTPResult, error)

func (Client) UpstreamBase

func (c Client) UpstreamBase() string

type Config

type Config struct {
	BaseURL         string
	Client          *http.Client
	RecordBody      bool
	Auth            map[string]string // secret by scheme name; never read from yaml
	Creds           *auth.Resolver
	MaxBody         int64
	Project         Projection
	FollowRedirects bool
}

type Projection

type Projection struct {
	Fields []string
	Offset int
	Limit  int
	// contains filtered or unexported fields
}

Projection names the response fields and the page to return. An empty Fields list leaves the body unchanged.

func ProjectionFrom

func ProjectionFrom(ctx context.Context) (Projection, bool)

ProjectionFrom reports fields set on the invoke request.

type View

type View struct {
	Applied   bool
	Truncated bool
	Page      *result.Page
}

View is set when a successful body was projected.

Jump to

Keyboard shortcuts

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