Documentation ¶
Index ¶
- Constants
- type Hub
- func (h *Hub) Channel(ctx context.Context, channelID string) (*farcasterapi.Channel, error)
- func (h *Hub) ChannelExists(ctx context.Context, channelID string) (bool, error)
- func (h *Hub) ChannelFIDs(ctx context.Context, channelID string, _ chan int) ([]uint64, error)
- func (h *Hub) DirectMessage(ctx context.Context, content string, to uint64) error
- func (h *Hub) FID() uint64
- func (h *Hub) FindChannel(ctx context.Context, query string, adminFid uint64) ([]*farcasterapi.Channel, error)
- func (h *Hub) GetCast(ctx context.Context, fid uint64, hash string) (*farcasterapi.APIMessage, error)
- func (h *Hub) LastMentions(ctx context.Context, timestamp uint64) ([]*farcasterapi.APIMessage, uint64, error)
- func (h *Hub) Publish(ctx context.Context, content string, mentionFIDs []uint64, embeds ...string) error
- func (h *Hub) RecastsFIDs(ctx context.Context, msg *farcasterapi.APIMessage) ([]uint64, error)
- func (h *Hub) Reply(ctx context.Context, targetMsg *farcasterapi.APIMessage, content string, ...) error
- func (h *Hub) SetFarcasterUser(fid uint64, signerPrivKey string) error
- func (h *Hub) SignersFromFID(fid uint64) ([]string, error)
- func (h *Hub) Stop() error
- func (h *Hub) UserDataByFID(ctx context.Context, fid uint64) (*farcasterapi.Userdata, error)
- func (h *Hub) UserDataByVerificationAddress(ctx context.Context, address []string) ([]*farcasterapi.Userdata, error)
- func (h *Hub) UserFollowers(ctx context.Context, fid uint64) ([]uint64, error)
- func (h *Hub) WebhookHandler(_ []byte) error
Constants ¶
const ( // endpoints ENDPOINT_CAST_BY_MENTION = "castsByMention?fid=%d" ENDPOINT_CAST_RECASTS = "reactionsByCast?target_fid=%d&reaction_type=2&target_hash=%s" ENDPOINT_GET_CAST = "castById?fid=%d&hash=%s" ENDPOINT_SUBMIT_MESSAGE = "submitMessage" ENDPOINT_USERDATA = "userDataByFid?fid=%d" ENDPOINT_CUSTODY_ADDRESS = "userNameProofsByFid?fid=%d" ENDPOINT_USER_FOLLOWERs = "linksByTargetFid?target_fid=%d" ENDPOINT_VERIFICATIONS = "verificationsByFid?fid=%d" ENDPOINT_IDREGISTRY_BY_ADDRESS = "onChainIdRegistryEventByAddress?address=%s" // message types MESSAGE_TYPE_CAST_ADD = "MESSAGE_TYPE_CAST_ADD" MESSAGE_TYPE_USERPROOF = "USERNAME_TYPE_FNAME" MESSAGE_TYPE_VERIFICATION = "MESSAGE_TYPE_VERIFICATION_ADD_ETH_ADDRESS" MESSAGE_TYPE_LINK = "MESSAGE_TYPE_LINK_ADD" MESSAGE_TYPE_USERDATA_ADD = "MESSAGE_TYPE_USER_DATA_ADD" MESSAGE_TYPE_REACTION_ADD = "MESSAGE_TYPE_REACTION_ADD" MESSAGE_TYPE_RECAST = "REACTION_TYPE_RECAST" // user data types USERDATA_TYPE_USERNAME = "USER_DATA_TYPE_USERNAME" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub struct implements the farcasterapi.API interface and represents the API of a Farcaster Hub.
func NewHubAPI ¶
Init initializes the API Hub with the given arguments. apiKeys must be a slice of strings with an even number of elements, where each pair of elements is a header and a key.
func (*Hub) ChannelExists ¶
ChannelExists method is not supported by the Hub API. It returns an error.
func (*Hub) ChannelFIDs ¶
ChannelFIDs method is not supported by the Hub API. It returns an error.
func (*Hub) DirectMessage ¶
DirectMessage method sends a direct message to the user with the given fid. If something goes wrong, it returns an error.
func (*Hub) FindChannel ¶
func (h *Hub) FindChannel(ctx context.Context, query string, adminFid uint64) ([]*farcasterapi.Channel, error)
ListChannels method is not supported by the Hub API. It returns an error.
func (*Hub) GetCast ¶
func (h *Hub) GetCast(ctx context.Context, fid uint64, hash string) (*farcasterapi.APIMessage, error)
func (*Hub) LastMentions ¶
func (h *Hub) LastMentions(ctx context.Context, timestamp uint64) ([]*farcasterapi.APIMessage, uint64, error)
LastMentions method returns the last mentions of the bot since the given timestamp. It returns the messages, the last timestamp and an error.
func (*Hub) RecastsFIDs ¶
func (h *Hub) RecastsFIDs(ctx context.Context, msg *farcasterapi.APIMessage) ([]uint64, error)
RecastsFIDs method returns the fids of the users that recast the message with the given fid and hash. It returns the fids in a slice of uint64 and an error if something goes wrong.
func (*Hub) Reply ¶
func (h *Hub) Reply(ctx context.Context, targetMsg *farcasterapi.APIMessage, content string, mentionFIDs []uint64, embeds ...string, ) error
Reply method sends a reply to the given targetFid and targetHash with the given content.
func (*Hub) SetFarcasterUser ¶
SetFarcasterUser sets the farcaster user with the given fid and signer privateKey in hex.
func (*Hub) SignersFromFID ¶
SignersFromFID method returns the signers for the given FID. It returns a slice of signers and an error. Hub does not implement this method.
func (*Hub) UserDataByFID ¶
UserDataByFID method returns the user data for the given FID. It includes the username, the custody address, the verification addresses and the signers.
func (*Hub) UserDataByVerificationAddress ¶
func (h *Hub) UserDataByVerificationAddress(ctx context.Context, address []string) ([]*farcasterapi.Userdata, error)
UserDataByVerificationAddress method returns the user data for the given verification addresses. It returns a slice of user data and an error. Hub does not implement this method.
func (*Hub) UserFollowers ¶
UserFollowers method returns the FIDs of the followers of the user with the given id. If something goes wrong, it returns an error.
func (*Hub) WebhookHandler ¶
WebhookHandler method handles the incoming webhooks. Hub does not implement this method.