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>
This commit is contained in:
25
backend/internal/indices/search.go
Normal file
25
backend/internal/indices/search.go
Normal file
@ -0,0 +1,25 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user