api

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package api provides the HTTP client for communicating with the AgentSecrets API.

This package mirrors the Python SecretsCLI's api/client.py module. It handles all HTTP communication including authentication headers, endpoint resolution, and request/response handling.

Index

Constants

View Source
const DefaultBaseURL = "https://api.agentsecrets.theseventeen.co/api"

DefaultBaseURL is the SecretsCLI API endpoint

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL    string
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client handles all HTTP communication with the AgentSecrets API server.

func NewClient

func NewClient(tokenFunc func() string) *Client

NewClient creates a new API client with the default base URL.

func (*Client) Call

func (c *Client) Call(endpointKey, method string, data interface{}, urlParams map[string]string, queryParams map[string]string) (*http.Response, error)

Call makes an API request to the specified endpoint.

endpointKey uses dot notation like "auth.login" or "secrets.get". method is the HTTP method (GET, POST, PUT, DELETE). data is the request body (will be JSON-encoded), can be nil. urlParams are substituted into the endpoint path template. queryParams are added as ?key=value to the URL.

func (*Client) DecodeError

func (c *Client) DecodeError(resp *http.Response) error

DecodeError attempt to parse a JSON error message from the response body. It returns a formatted error including the status code and any message from the API.

Jump to

Keyboard shortcuts

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