Documentation
¶
Overview ¶
Package hostapi wraps the plugin→host callbacks (host.http.do, host.auth.*).
The actual CGO callback into the host lives in the main package (it needs C types and cannot be shared across packages). The main package injects it here as HostCall at init time, keeping this package free of CGO so it can be reused and unit-tested with a plain Go function.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var HostCall func(method string, payload []byte) ([]byte, error)
HostCall is the plugin→host bridge, injected by the main package at init time (it wraps the CGO call into the host). It returns the host's raw JSON envelope bytes for the given method and payload.
Functions ¶
This section is empty.
Types ¶
type AuthEntry ¶
type AuthEntry struct {
AuthIndex string `json:"auth_index"`
Name string `json:"name"`
Provider string `json:"provider"`
Type string `json:"type"`
Label string `json:"label"`
Status string `json:"status"`
Email string `json:"email"`
}
AuthEntry is the subset of the host's HostAuthFileEntry the plugin needs to select its own credentials.
type AuthGetResult ¶
type AuthGetResult struct {
AuthIndex string `json:"auth_index"`
Name string `json:"name"`
Path string `json:"path"`
JSON json.RawMessage `json:"json"`
}
AuthGetResult carries the physical credential JSON resolved by auth index.
func AuthGet ¶
func AuthGet(authIndex string) (*AuthGetResult, error)
AuthGet fetches one credential's physical JSON by auth index.
type HTTPRequest ¶
type HTTPRequest struct {
HostCallbackID string `json:"host_callback_id,omitempty"`
Method string `json:"method,omitempty"`
URL string `json:"url,omitempty"`
Headers map[string][]string `json:"headers,omitempty"`
Body []byte `json:"body,omitempty"`
}
HTTPRequest mirrors the host's rpcHostHTTPRequest wire schema (internal/pluginhost/host_callbacks.go). The HostCallbackID binds the request to the auth-scoped transport opened by the host for this RPC.
type HTTPResponse ¶
type HTTPResponse struct {
StatusCode int `json:"StatusCode"`
Headers map[string][]string `json:"Headers"`
Body []byte `json:"Body"`
}
HTTPResponse mirrors pluginapi.HTTPResponse (PascalCase JSON, no tags).
func HTTPDo ¶
func HTTPDo(req HTTPRequest) (*HTTPResponse, error)
HTTPDo executes an HTTP request through the host transport (proxy, request logging) via the host.http.do callback and returns the response.