Documentation
¶
Index ¶
- func FormatAgentError(operation string, statusCode int, errMsg string, apiResponse string) (string, error)
- func FormatError(err error) string
- func FormatOutput(data interface{}, format OutputFormat) (string, error)
- func FormatSuccess(message string, data interface{}) (string, error)
- func ToJSON(data interface{}) (string, error)
- func ToTable(data interface{}) (string, error)
- func ToYAML(data interface{}) (string, error)
- func WrapForAgent(data interface{}, meta *Metadata) (string, error)
- type AgentEnvelope
- type AgentError
- type Metadata
- type OutputFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAgentError ¶ added in v0.14.0
func FormatAgentError(operation string, statusCode int, errMsg string, apiResponse string) (string, error)
FormatAgentError formats a structured error for agent mode.
func FormatOutput ¶
func FormatOutput(data interface{}, format OutputFormat) (string, error)
FormatOutput formats the output based on the specified format
func FormatSuccess ¶
FormatSuccess formats a success message with optional data
func WrapForAgent ¶ added in v0.14.0
WrapForAgent wraps data in an AgentEnvelope and formats as JSON.
Types ¶
type AgentEnvelope ¶ added in v0.14.0
type AgentEnvelope struct {
Status string `json:"status"`
Data interface{} `json:"data"`
Metadata *Metadata `json:"metadata,omitempty"`
}
AgentEnvelope wraps API responses with metadata for agent consumption.
type AgentError ¶ added in v0.14.0
type AgentError struct {
Status string `json:"status"`
ErrorCode int `json:"error_code,omitempty"`
Message string `json:"error_message"`
Operation string `json:"operation"`
Suggestions []string `json:"suggestions,omitempty"`
APIResponse string `json:"api_response,omitempty"`
}
AgentError is a structured error response for agent mode.
type Metadata ¶ added in v0.14.0
type Metadata struct {
Count *int `json:"count,omitempty"`
Truncated bool `json:"truncated,omitempty"`
NextAction string `json:"next_action,omitempty"`
Command string `json:"command"`
Warnings []string `json:"warnings,omitempty"`
}
Metadata contains structured information about the response.
type OutputFormat ¶
type OutputFormat string
OutputFormat represents the output format type
const ( // FormatJSON outputs in JSON format FormatJSON OutputFormat = "json" // FormatTable outputs in table format FormatTable OutputFormat = "table" // FormatYAML outputs in YAML format FormatYAML OutputFormat = "yaml" )
Click to show internal directories.
Click to hide internal directories.