client

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package client provides an HTTP client for communicating with the AgentsAegis dashboard API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client communicates with the AgentsAegis dashboard API.

func New

func New(baseURL, apiToken string) *Client

New creates a new dashboard API client.

func (*Client) FetchConfig

func (c *Client) FetchConfig(ctx context.Context) (*OrgConfig, error)

FetchConfig fetches the org trap configuration from the dashboard API. This also validates the token (same endpoint).

func (*Client) FetchPersonalStats

func (c *Client) FetchPersonalStats(ctx context.Context) (*PersonalStats, error)

FetchPersonalStats retrieves the developer's personal trap statistics.

func (*Client) ReportEvent

func (c *Client) ReportEvent(ctx context.Context, event *TrapEvent) error

ReportEvent sends a trap event to the dashboard API.

func (*Client) ValidateToken

func (c *Client) ValidateToken(ctx context.Context) error

ValidateToken checks if the API token is valid.

type OrgConfig

type OrgConfig struct {
	TrapFrequency  int      `json:"trap_frequency"`
	MaxTrapsPerDay int      `json:"max_traps_per_day"`
	TrapCategories []string `json:"trap_categories"`
	Difficulty     string   `json:"difficulty"`
}

OrgConfig holds the trap configuration fetched from the dashboard.

type PersonalStats

type PersonalStats struct {
	CatchRate   string           `json:"catch_rate"`
	TotalTraps  int              `json:"total_traps"`
	Caught      int              `json:"caught"`
	Missed      int              `json:"missed"`
	RecentTraps []RecentTrapInfo `json:"recent_traps"`
}

PersonalStats holds a developer's personal trap statistics.

type RecentTrapInfo

type RecentTrapInfo struct {
	Category string `json:"category"`
	Result   string `json:"result"`
	Date     string `json:"date"`
}

RecentTrapInfo holds summary info about a single trap event.

type TrapEvent

type TrapEvent struct {
	TrapTemplateID  string `json:"trap_template_id"`
	TrapCategory    string `json:"trap_category"`
	TrapSeverity    string `json:"trap_severity"`
	TrapCommand     string `json:"trap_command"`
	OriginalCommand string `json:"original_command"`
	Result          string `json:"result"`
	ResponseTimeMs  int    `json:"response_time_ms"`
	SessionID       string `json:"session_id"`
}

TrapEvent represents a trap result to report to the dashboard.

Jump to

Keyboard shortcuts

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