Files
TradarrV2/backend/internal/indices/search.go
Blomios 5cb45138df feat(indices): add authenticated OpenFIGI search
Add the bounded OpenFIGI v3 adapter, authenticated search route, and server-side configuration.

Refs #3

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-20 22:31:35 +01:00

26 lines
647 B
Go

package indices
import (
"context"
"errors"
"strings"
"unicode/utf8"
)
type Index struct {
Name string `json:"name"`
Symbol string `json:"symbol"`
FIGI string `json:"figi"`
}
type IndexSearcher interface {
Search(context.Context, string, int) ([]Index, error)
}
var ErrRateLimited = errors.New("index search rate limited")
var ErrUnavailable = errors.New("index search unavailable")
var ErrInvalidQuery = errors.New("invalid index search query")
func ValidQuery(query string, limit int) bool {
return utf8.ValidString(query) && strings.TrimSpace(query) != "" && utf8.RuneCountInString(query) <= 100 && limit >= 1 && limit <= 20
}