Documentation
¶
Index ¶
Constants ¶
const (
Throttle = 200 * time.Millisecond
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FarcasterDiscover ¶
type FarcasterDiscover struct {
// contains filtered or unexported fields
}
FarcasterDiscover is a service to discover user profiles from the Farcaster API v2.
func NewFarcasterDiscover ¶
func NewFarcasterDiscover(db *mongo.MongoStorage, farcasterAPI farcasterapi.API) *FarcasterDiscover
NewFarcasterDiscover returns a new FarcasterDiscover instance. The instance is used to discover user profiles from the Farcaster API v2. And update the pending user profiles in the database.
func (*FarcasterDiscover) Addresses ¶
func (d *FarcasterDiscover) Addresses(fid uint64) ([]string, error)
func (*FarcasterDiscover) Run ¶
func (d *FarcasterDiscover) Run(ctx context.Context, indexNewUsers bool)
Run starts the discovery process to update user profiles that are pending in the database. This is a non blocking function that runs in the background.
func (*FarcasterDiscover) UserProfile ¶
func (d *FarcasterDiscover) UserProfile(fid uint64) (*UserProfile, error)
UserProfile returns the user profile from the Farcaster API v2.
type UserProfile ¶
type UserProfile struct {
Result struct {
User struct {
Fid uint64 `json:"fid"`
Username string `json:"username"`
DisplayName string `json:"displayName"`
Pfp struct {
Url string `json:"url"`
Verified bool `json:"verified"`
} `json:"pfp"`
Profile struct {
Bio struct {
Text string `json:"text"`
Mentions []string `json:"mentions"`
ChannelMentions []string `json:"channelMentions"`
} `json:"bio"`
Location struct {
PlaceId string `json:"placeId"`
Description string `json:"description"`
} `json:"location"`
} `json:"profile"`
FollowerCount int `json:"followerCount"`
FollowingCount int `json:"followingCount"`
ActiveOnFcNetwork bool `json:"activeOnFcNetwork"`
ViewerContext struct {
Following bool `json:"following"`
FollowedBy bool `json:"followedBy"`
CanSendDirectCasts bool `json:"canSendDirectCasts"`
HasUploadedInboxKeys bool `json:"hasUploadedInboxKeys"`
} `json:"viewerContext"`
} `json:"user"`
InviterIsReferrer bool `json:"inviterIsReferrer"`
CollectionsOwned []interface{} `json:"collectionsOwned"`
Extras struct {
Fid uint64 `json:"fid"`
CustodyAddress string `json:"custodyAddress"`
} `json:"extras"`
} `json:"result"`
}
UserProfile represents the user profile from the Farcaster API v2.
type VerificationResponse ¶
type VerificationResponse struct {
Result struct {
Verifications []struct {
FID int `json:"fid"`
Address string `json:"address"`
Timestamp int64 `json:"timestamp"`
Version string `json:"version"`
Protocol string `json:"protocol"`
} `json:"verifications"`
} `json:"result"`
}
VerificationResponse is the response from the Farcaster API v2 for the verifications endpoint.