Documentation
¶
Overview ¶
Package httprest is a generic HTTP/REST connector that lets an LLM call any JSON API without writing a custom connector. One instance wraps a single API base URL and auth scheme; operations cover the five standard HTTP verbs (GET, POST, PUT, PATCH, DELETE).
File layout:
- connector.go — Meta, Configs, per-op Input structs, Operations, thin handlers
- service.go — URL assembly, header building, query-string parsing
- repo.go — outbound HTTP I/O via http.NewRequestWithContext
Index ¶
Constants ¶
const Key = "httprest"
Key is the connector definition slug used in the registry and in MCP tool IDs (conn:{instance_id}/get, conn:{instance_id}/post, …).
Variables ¶
This section is empty.
Functions ¶
func Operations ¶
Operations returns the five LLM-callable HTTP verbs exposed by this connector. GET is read-only; POST/PUT/PATCH/DELETE are destructive.
Types ¶
type Configs ¶
type Configs struct {
BaseURL string `wick:"url;required;desc=Base URL of the target API. Example: https://api.example.com/v1"`
AuthHeader string `wick:"desc=Header name used for authentication. Example: Authorization or X-API-Key. Leave empty to skip auth."`
AuthValue string `wick:"secret;desc=Value for the auth header. Example: Bearer mytoken or myapikey123"`
TimeoutSecs int `wick:"desc=Per-request timeout in seconds. Default: 30"`
}
Configs is the per-instance credential and endpoint set. Every field is reflected by entity.StructToConfigs into the admin form and MCP schema.
type DeleteInput ¶
type DeleteInput struct {
Path string `wick:"required;desc=Path relative to BaseURL. Example: /users/42"`
}
DeleteInput is the argument schema for the DELETE operation.
type GetInput ¶
type GetInput struct {
Path string `wick:"required;desc=Path relative to BaseURL. Example: /users/42 or /repos/owner/name"`
Query string `wick:"desc=Query string or JSON object. Example: page=1&limit=10 or {\"state\":\"open\"}"`
}
GetInput is the argument schema for the GET operation.
type PatchInput ¶
type PatchInput struct {
Path string `wick:"required;desc=Path relative to BaseURL. Example: /users/42"`
Body string `wick:"textarea;desc=Partial update body as JSON."`
ContentType string `wick:"desc=Content-Type header override. Default: application/json"`
}
PatchInput is the argument schema for the PATCH operation.
type PostInput ¶
type PostInput struct {
Path string `wick:"required;desc=Path relative to BaseURL. Example: /users"`
Body string `wick:"textarea;desc=Request body. JSON is sent as application/json; plain text as text/plain."`
ContentType string `wick:"desc=Content-Type header override. Default: application/json"`
}
PostInput is the argument schema for the POST operation.
type PutInput ¶
type PutInput struct {
Path string `wick:"required;desc=Path relative to BaseURL. Example: /users/42"`
Body string `wick:"textarea;desc=Replacement body as JSON."`
ContentType string `wick:"desc=Content-Type header override. Default: application/json"`
}
PutInput is the argument schema for the PUT operation.