api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caller

type Caller struct {
	// APIKey is the legacy "pk_xxx:sk_xxx" form, retained for tests and
	// callers that want to inspect a single string. New code should rely
	// on PublicKey/SecretKey/BearerToken instead.
	APIKey string

	PublicKey   string
	SecretKey   string
	BearerToken string

	BaseURL string
	// contains filtered or unexported fields
}

Caller makes raw HTTP requests to the API for endpoints where the SDK does not decode response bodies. It carries the active profile so it can transparently refresh OAuth tokens on 401 responses.

For api-key profiles the Caller stores the public/secret key pair and emits dual headers (X-PromptVM-Public-Key + X-PromptVM-Secret-Key) on each request. For OAuth profiles only BearerToken is set, sent as Authorization: Bearer <token>.

func NewFromContext

func NewFromContext(cmd *cobra.Command) (*Caller, error)

NewFromContext creates a Caller from CLI flags, environment, and the active config profile.

Credential resolution mirrors internal/client.ResolveCredentials so the SDK and the raw HTTP path always agree on which key set to use.

func (*Caller) Delete

func (c *Caller) Delete(path string, result interface{}) error

Delete performs a DELETE request.

func (*Caller) Get

func (c *Caller) Get(path string, result interface{}) error

Get performs a GET request and decodes JSON into result.

func (*Caller) Patch

func (c *Caller) Patch(path string, body interface{}, result interface{}) error

Patch performs a PATCH request with a JSON body.

func (*Caller) Post

func (c *Caller) Post(path string, body interface{}, result interface{}) error

Post performs a POST request with a JSON body.

Jump to

Keyboard shortcuts

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