Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
func RegisterRoutes(router *swagger.RouteGroup, handler *Handler)
RegisterRoutes wires the onboarding endpoints onto a swagger route group. The route group is expected to already carry the user auth middleware.
Types ¶
type ErrorDetail ¶
ErrorDetail is a minimal error envelope. Kept local to the module so the onboarding API does not depend on internal server types.
type ExtractData ¶
type ExtractData struct {
URLs []string `json:"urls"`
Tokens []TokenCandidate `json:"tokens"`
}
ExtractData is the inner payload returned by the extractor. It is a flat list of detected URLs and tokens — provider matching, if any, is done on the client side after the user picks values.
type ExtractRequest ¶
type ExtractRequest struct {
Input string `json:"input"`
}
ExtractRequest is the body for POST /api/v1/onboarding/extract.
type ExtractResponse ¶
type ExtractResponse struct {
Success bool `json:"success"`
Data *ExtractData `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}
ExtractResponse mirrors the rest of the v1 envelope shape used elsewhere.
type Extractor ¶
type Extractor interface {
Extract(ctx context.Context, input string) (data ExtractData, err error)
}
Extractor is the contract handlers depend on. v1 ships a pure rule-based implementation; future variants (LLM-assisted, model-based) can satisfy the same contract without changing the handler or wire format.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves the onboarding extraction endpoint.
func NewHandler ¶
NewHandler creates a new onboarding handler. The extractor is injected so tests and future variants (LLM-assisted, model-based) can swap in a different implementation without touching the route.
type RuleExtractor ¶
type RuleExtractor struct{}
RuleExtractor implements Extractor with pure regex matching. No LLM, no network calls, no vendor-specific assumptions.
func NewRuleExtractor ¶
func NewRuleExtractor() *RuleExtractor
NewRuleExtractor builds a new RuleExtractor. The signature accepts a dependency placeholder (any) for future-proofing — the v1 implementation has no dependencies.
func (*RuleExtractor) Extract ¶
func (e *RuleExtractor) Extract(_ context.Context, input string) (ExtractData, error)
Extract scans the input text for URLs and possible API tokens. It is deliberately vendor-agnostic: no scoring, no provider matching, no warnings. The caller decides what to do with the raw signals.
type TokenCandidate ¶
type TokenCandidate struct {
Value string `json:"value"`
Preview string `json:"preview"`
Source string `json:"source"` // bearer | x-api-key | env:NAME | json:api_key | key_prefix
}
TokenCandidate is a possible API token found in the input. The extractor stays vendor-agnostic — it just reports what it saw and where it came from. The user picks which one (if any) to use.