2024-09-10 22:37:48 -03:00
|
|
|
package sdk
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/nbd-wtf/go-nostr"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (sys *System) SearchUsers(ctx context.Context, query string) []ProfileMetadata {
|
|
|
|
limit := 10
|
2024-10-06 15:53:33 -03:00
|
|
|
profiles := make([]ProfileMetadata, 0, limit*len(sys.UserSearchRelays.URLs))
|
2024-09-10 22:37:48 -03:00
|
|
|
|
2025-03-10 02:54:34 -03:00
|
|
|
for ie := range sys.Pool.FetchMany(ctx, sys.UserSearchRelays.URLs, nostr.Filter{
|
|
|
|
Search: query,
|
|
|
|
Limit: limit,
|
2024-09-26 21:08:40 -03:00
|
|
|
}, nostr.WithLabel("search")) {
|
2024-09-10 22:37:48 -03:00
|
|
|
m, _ := ParseMetadata(ie.Event)
|
|
|
|
profiles = append(profiles, m)
|
|
|
|
}
|
|
|
|
|
|
|
|
return profiles
|
|
|
|
}
|