Documentation
¶
Overview ¶
Package api provides the API client for the search server Per AI.md PART 36: Admin API methods
Index ¶
- Variables
- type AutodiscoverResponse
- type BuildInfo
- type Client
- func (c *Client) AdminAddOrgMember(orgname, username, role string) error
- func (c *Client) AdminCreateOrg(orgname, displayName, description string) (interface{}, error)
- func (c *Client) AdminCreateToken(name, expires, scopes string) (interface{}, error)
- func (c *Client) AdminCreateUser(username, email, role string) (interface{}, error)
- func (c *Client) AdminDeleteOrg(orgname string) error
- func (c *Client) AdminDeleteUser(username string) error
- func (c *Client) AdminDisableUser2FA(username string) error
- func (c *Client) AdminGetConfig(key string) (interface{}, error)
- func (c *Client) AdminGetOrg(orgname string) (interface{}, error)
- func (c *Client) AdminGetStatsOverview() (interface{}, error)
- func (c *Client) AdminGetStatsPerformance() (interface{}, error)
- func (c *Client) AdminGetStatsStorage() (interface{}, error)
- func (c *Client) AdminGetStatsUsers() (interface{}, error)
- func (c *Client) AdminGetTokenInfo(tokenID string) (interface{}, error)
- func (c *Client) AdminGetUser(username string) (interface{}, error)
- func (c *Client) AdminInviteServerAdmin(username, email string) error
- func (c *Client) AdminListConfig(category string) (interface{}, error)
- func (c *Client) AdminListOrgMembers(orgname, role string) (interface{}, error)
- func (c *Client) AdminListOrgs(limit, offset int) (interface{}, error)
- func (c *Client) AdminListServerAdmins() (interface{}, error)
- func (c *Client) AdminListTokens(limit int, user string) (interface{}, error)
- func (c *Client) AdminListUsers(limit, offset int, status string) (interface{}, error)
- func (c *Client) AdminRemoveOrgMember(orgname, username string) error
- func (c *Client) AdminRemoveServerAdmin(username string) error
- func (c *Client) AdminResetConfig(key string) error
- func (c *Client) AdminResetServerAdminPassword(username string) error
- func (c *Client) AdminResetUserPassword(username string) error
- func (c *Client) AdminRevokeToken(tokenID string) error
- func (c *Client) AdminSetConfig(key, value string, reload bool) error
- func (c *Client) AdminSuspendUser(username string) error
- func (c *Client) AdminUnsuspendUser(username string) error
- func (c *Client) Autodiscover() (*AutodiscoverResponse, error)
- func (c *Client) GetClusterNodes() []string
- func (c *Client) GetVersion() (string, error)
- func (c *Client) Health() (*HealthResponse, error)
- func (c *Client) Search(query string, page, perPage int) (*SearchResponse, error)
- func (c *Client) SetClusterNodes(nodes []string)
- func (c *Client) SetUserContext(ctx string)
- type ClusterInfo
- type HealthResponse
- type HealthStats
- type NodeInfo
- type SearchPagination
- type SearchResponse
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
var ProjectName = "search"
ProjectName is set at build time - used for User-Agent
var Version = "dev"
Version is set at build time
Functions ¶
This section is empty.
Types ¶
type AutodiscoverResponse ¶
type AutodiscoverResponse struct {
Server struct {
Name string `json:"name"`
Version string `json:"version"`
URL string `json:"url"`
Features struct {
Auth bool `json:"auth"`
Search bool `json:"search"`
Register bool `json:"register"`
} `json:"features"`
} `json:"server"`
Cluster struct {
Primary string `json:"primary"`
Nodes []string `json:"nodes"`
} `json:"cluster"`
API struct {
Version string `json:"version"`
BasePath string `json:"base_path"`
} `json:"api"`
}
AutodiscoverResponse represents /api/autodiscover response Per AI.md PART 36 line 38077-38157: Autodiscover endpoint
type Client ¶
type Client struct {
BaseURL string
Token string
UserContext string // Per AI.md PART 36: --user flag for user/org context
ClusterNodes []string // Per AI.md PART 36: cluster nodes for failover
HTTPClient *http.Client
// contains filtered or unexported fields
}
Client is the API client for the search server Per AI.md PART 36 line 42791-42818: Cluster failover support
func (*Client) AdminAddOrgMember ¶
AdminAddOrgMember adds a member to organization
func (*Client) AdminCreateOrg ¶
AdminCreateOrg creates a new organization
func (*Client) AdminCreateToken ¶
AdminCreateToken creates a new API token
func (*Client) AdminCreateUser ¶
AdminCreateUser creates a new user
func (*Client) AdminDeleteOrg ¶
AdminDeleteOrg deletes an organization
func (*Client) AdminDeleteUser ¶
AdminDeleteUser deletes a user
func (*Client) AdminDisableUser2FA ¶
AdminDisableUser2FA disables 2FA for user
func (*Client) AdminGetConfig ¶
AdminGetConfig gets configuration value
func (*Client) AdminGetOrg ¶
AdminGetOrg gets organization details
func (*Client) AdminGetStatsOverview ¶
AdminGetStatsOverview gets general server statistics
func (*Client) AdminGetStatsPerformance ¶
AdminGetStatsPerformance gets performance metrics
func (*Client) AdminGetStatsStorage ¶
AdminGetStatsStorage gets storage usage statistics
func (*Client) AdminGetStatsUsers ¶
AdminGetStatsUsers gets user statistics
func (*Client) AdminGetTokenInfo ¶
AdminGetTokenInfo gets token details
func (*Client) AdminGetUser ¶
AdminGetUser gets user details
func (*Client) AdminInviteServerAdmin ¶
AdminInviteServerAdmin invites a new server admin
func (*Client) AdminListConfig ¶
AdminListConfig lists all configuration keys
func (*Client) AdminListOrgMembers ¶
AdminListOrgMembers lists organization members
func (*Client) AdminListOrgs ¶
AdminListOrgs lists all organizations
func (*Client) AdminListServerAdmins ¶
AdminListServerAdmins lists all server admins
func (*Client) AdminListTokens ¶
AdminListTokens lists all tokens
func (*Client) AdminListUsers ¶
AdminListUsers lists all users
func (*Client) AdminRemoveOrgMember ¶
AdminRemoveOrgMember removes a member from organization
func (*Client) AdminRemoveServerAdmin ¶
AdminRemoveServerAdmin removes a server admin
func (*Client) AdminResetConfig ¶
AdminResetConfig resets configuration to default
func (*Client) AdminResetServerAdminPassword ¶
AdminResetServerAdminPassword sends password reset to admin
func (*Client) AdminResetUserPassword ¶
AdminResetUserPassword sends password reset email
func (*Client) AdminRevokeToken ¶
AdminRevokeToken revokes a token
func (*Client) AdminSetConfig ¶
AdminSetConfig sets configuration value
func (*Client) AdminSuspendUser ¶
AdminSuspendUser suspends a user
func (*Client) AdminUnsuspendUser ¶
AdminUnsuspendUser unsuspends a user
func (*Client) Autodiscover ¶
func (c *Client) Autodiscover() (*AutodiscoverResponse, error)
Autodiscover fetches server settings from /api/autodiscover Per AI.md PART 36 line 38077-38157: Non-versioned autodiscover endpoint
func (*Client) GetClusterNodes ¶
GetClusterNodes returns current cluster nodes
func (*Client) GetVersion ¶
GetVersion returns server version info
func (*Client) Health ¶
func (c *Client) Health() (*HealthResponse, error)
Health checks server health
func (*Client) Search ¶
func (c *Client) Search(query string, page, perPage int) (*SearchResponse, error)
Search performs a search query
func (*Client) SetClusterNodes ¶
SetClusterNodes sets the cluster nodes for failover Per AI.md PART 36 line 42791-42818: Cluster failover
func (*Client) SetUserContext ¶
SetUserContext sets the user or org context for API requests Per AI.md PART 36 line 41490-41498: --user flag for user/org context @name = force user context +name = force org context name = auto-detect
type ClusterInfo ¶
type ClusterInfo struct {
Enabled bool `json:"enabled"`
Status string `json:"status"`
Nodes int `json:"nodes"`
}
ClusterInfo represents cluster information
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
Version string `json:"version,omitempty"`
GoVersion string `json:"go_version,omitempty"`
Mode string `json:"mode,omitempty"`
Uptime string `json:"uptime,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
Build *BuildInfo `json:"build,omitempty"`
Node *NodeInfo `json:"node,omitempty"`
Cluster *ClusterInfo `json:"cluster,omitempty"`
Features map[string]bool `json:"features,omitempty"`
Checks map[string]string `json:"checks,omitempty"`
Stats *HealthStats `json:"stats,omitempty"`
PendingRestart bool `json:"pending_restart,omitempty"`
RestartReason []string `json:"restart_reason,omitempty"`
}
HealthResponse represents health check response
type HealthStats ¶
type HealthStats struct {
RequestsTotal int64 `json:"requests_total"`
Requests24h int64 `json:"requests_24h"`
ActiveConnections int `json:"active_connections"`
}
HealthStats represents health statistics
type SearchPagination ¶
type SearchPagination struct {
Page int `json:"page"`
Limit int `json:"limit"`
Total int `json:"total"`
Pages int `json:"pages"`
}
SearchPagination represents pagination info per AI.md PART 14
type SearchResponse ¶
type SearchResponse struct {
Query string `json:"query"`
Category string `json:"category"`
Results []SearchResult `json:"results"`
Pagination SearchPagination `json:"pagination"`
SearchTime float64 `json:"search_time_ms"`
Engines []string `json:"engines_used"`
}
SearchResponse represents the API search response per AI.md PART 14
type SearchResult ¶
type SearchResult struct {
Title string `json:"title"`
URL string `json:"url"`
Description string `json:"description"`
Engine string `json:"engine"`
Score float64 `json:"score"`
Category string `json:"category"`
Thumbnail string `json:"thumbnail,omitempty"`
Domain string `json:"domain,omitempty"`
}
SearchResult represents a search result