Documentation ¶
Index ¶
- Constants
- func CovertFarcasterTimeToTimestamp(timestamp int64) int64
- func HubEventTypeStrings() []string
- func MessageTypeStrings() []string
- func ReactionTypeStrings() []string
- func UserDataTypeStrings() []string
- func UsernameProofTypeStrings() []string
- type CastAddBody
- type CastID
- type CastRemoveBody
- type Client
- type ClientOption
- type Embed
- type EventResponse
- type FidResponse
- type HubEvent
- type HubEventType
- type LinkBody
- type MergeMessageBody
- type MergeOnChainEventBody
- type MergeUserNameProofBody
- type Message
- type MessageData
- type MessageResponse
- type MessageType
- type Profile
- type ProofResponse
- type PruneMessageBody
- type ReactionBody
- type ReactionType
- type RevokeMessageBody
- type UserDataBody
- type UserDataType
- type UserNameProof
- type UsernameProofType
- type VerificationAddEthAddressBody
- type VerificationRemoveBody
Constants ¶
const ( EndpointMainnet = "https://nemes.farcaster.xyz:2281" // Public Instances https://www.thehubble.xyz/intro/hubble.html DefaultTimeout = 5 * time.Second )
const FarcasterEpoch = 1609459200 // January 1, 2021 UTC https://github.com/farcasterxyz/hub-monorepo/blob/77ff79ed804104956eb153247c22c00099c7b122/packages/core/src/time.ts#L4
Variables ¶
This section is empty.
Functions ¶
func CovertFarcasterTimeToTimestamp ¶
CovertFarcasterTimeToTimestamp Converts a Farcaster seconds timestamp to a Unix milliseconds timestamp.
func HubEventTypeStrings ¶
func HubEventTypeStrings() []string
HubEventTypeStrings returns a slice of all String values of the enum
func MessageTypeStrings ¶
func MessageTypeStrings() []string
MessageTypeStrings returns a slice of all String values of the enum
func ReactionTypeStrings ¶
func ReactionTypeStrings() []string
ReactionTypeStrings returns a slice of all String values of the enum
func UserDataTypeStrings ¶
func UserDataTypeStrings() []string
UserDataTypeStrings returns a slice of all String values of the enum
func UsernameProofTypeStrings ¶
func UsernameProofTypeStrings() []string
UsernameProofTypeStrings returns a slice of all String values of the enum
Types ¶
type CastAddBody ¶
type CastAddBody struct { EmbedsDeprecated []string `json:"embedsDeprecated"` Mentions []uint64 `json:"mentions"` MentionsUsernames []string `json:"mentionsUsernames"` ParentCastID *CastID `json:"parentCastId,omitempty"` ParentCast *Message `json:"parentCast,omitempty"` ParentURL string `json:"parentUrl,omitempty"` Text string `json:"text"` MentionsPositions []int32 `json:"mentionsPositions"` Embeds []Embed `json:"embeds"` }
type CastRemoveBody ¶
type CastRemoveBody struct {
TargetHash string `json:"targeHash"`
}
type Client ¶
type Client interface { GetCastsByFid(ctx context.Context, fid *int64, reverse bool, pageSize *int, pageToken string) (*MessageResponse, error) GetCastByFidAndHash(ctx context.Context, fid *int64, hash string) (*Message, error) GetVerificationsByFid(ctx context.Context, fid *int64, pageToken string) (*MessageResponse, error) GetUserNameProofsByFid(ctx context.Context, fid *int64) (*ProofResponse, error) GetUserDataByFid(ctx context.Context, fid *int64, pageToken string) (*MessageResponse, error) GetUserDataByFidAndType(ctx context.Context, fid *int64, userDataType string) (*Message, error) GetEvents(ctx context.Context, fromEventID *int64) (*EventResponse, error) GetFids(ctx context.Context, reverse bool, pageSize *int) (*FidResponse, error) GetReactionsByFid(ctx context.Context, fid *int64, reverse bool, pageSize *int, pageToken, reactionType string) (*MessageResponse, error) GetReaction(ctx context.Context, fid, targetFid *int64, targetHash, reactionType string) (*Message, error) }
type ClientOption ¶
type ClientOption func(client *client) error
type EventResponse ¶
type FidResponse ¶
type HubEvent ¶
type HubEvent struct { Type string `json:"type"` ID uint64 `json:"id"` MergeMessageBody *MergeMessageBody `json:"mergeMessageBody,omitempty"` PruneMessageBody *PruneMessageBody `json:"pruneMessageBody,omitempty"` RevokeMessageBody *RevokeMessageBody `json:"revokeMessageBody,omitempty"` MergeUserNameProofBody *MergeUserNameProofBody `json:"mergeUserNameProofBody,omitempty"` MergeOnChainEventBody *MergeOnChainEventBody `json:"mergeOnChainEventBody,omitempty"` }
type HubEventType ¶
type HubEventType int
const ( HubEventTypeNone HubEventType = 0 // Invalid default value HubEventTypeMergeMessage HubEventType = 1 // A message was merged into the Hub HubEventTypePruneMessage HubEventType = 2 // A message was pruned because a limit was exceeded HubEventTypeRevokeMessage HubEventType = 3 // A message was revoked by a user HubEventTypeMergeUsernameProof HubEventType = 6 HubEventTypeMergeOnChainEvent HubEventType = 9 )
func HubEventTypeString ¶
func HubEventTypeString(s string) (HubEventType, error)
HubEventTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func HubEventTypeValues ¶
func HubEventTypeValues() []HubEventType
HubEventTypeValues returns all values of the enum
func (HubEventType) IsAHubEventType ¶
func (i HubEventType) IsAHubEventType() bool
IsAHubEventType returns "true" if the value is listed in the enum definition. "false" otherwise
func (HubEventType) String ¶
func (i HubEventType) String() string
func (HubEventType) Values ¶
func (HubEventType) Values() []string
type MergeMessageBody ¶
type MergeOnChainEventBody ¶
type MergeOnChainEventBody struct{}
type MergeUserNameProofBody ¶
type MergeUserNameProofBody struct { UserNameProof UserNameProof `json:"usernameProof"` DeletedUserNameProof UserNameProof `json:"deletedUsernameProof"` UsernameProofMessage Message `json:"usernameProofMessage"` DeletedUsernameProofMessage Message `json:"deletedUsernameProofMessage"` }
type MessageData ¶
type MessageData struct { Type string `json:"type"` Fid uint64 `json:"fid"` Profile *model.Profile `json:"profile,omitempty"` Timestamp uint32 `json:"timestamp"` Network string `json:"network"` CastAddBody *CastAddBody `json:"castAddBody,omitempty"` CastRemoveBody *CastRemoveBody `json:"castRemoveBody,omitempty"` UserDataBody *UserDataBody `json:"userDataBody,omitempty"` ReactionBody *ReactionBody `json:"reactionBody,omitempty"` LinkBody *LinkBody `json:"linkBody,omitempty"` VerificationAddEthAddressBody *VerificationAddEthAddressBody `json:"verificationAddEthAddressBody,omitempty"` VerificationRemoveBody *VerificationRemoveBody `json:"verificationRemoveBody,omitempty"` UserNameProof *UserNameProof `json:"userNameProof,omitempty"` }
type MessageResponse ¶
type MessageType ¶
type MessageType int
const ( MessageTypeNone MessageType = 0 // Invalid default value MessageTypeCastAdd MessageType = 1 // Add a new Cast MessageTypeCastRemove MessageType = 2 // Remove an existing Cast MessageTypeReactionAdd MessageType = 3 // Add a Reaction to a Cast MessageTypeReactionRemove MessageType = 4 // Remove a Reaction from a Cast MessageTypeLinkAdd MessageType = 5 // Add a Link to a target MessageTypeLinkRemove MessageType = 6 // Remove a Link from a target MessageTypeVerificationAddEthAddress MessageType = 7 // Add a Verification of an Ethereum Address MessageTypeVerificationRemove MessageType = 8 // Remove a Verification MessageTypeUserDataAdd MessageType = 11 // Add metadata about a user MessageTypeUsernameProof MessageType = 12 // Add or replace a username proof )
func MessageTypeString ¶
func MessageTypeString(s string) (MessageType, error)
MessageTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func MessageTypeValues ¶
func MessageTypeValues() []MessageType
MessageTypeValues returns all values of the enum
func (MessageType) IsAMessageType ¶
func (i MessageType) IsAMessageType() bool
IsAMessageType returns "true" if the value is listed in the enum definition. "false" otherwise
func (MessageType) String ¶
func (i MessageType) String() string
func (MessageType) Values ¶
func (MessageType) Values() []string
type ProofResponse ¶
type ProofResponse struct {
Proofs []UserNameProof `json:"proofs"`
}
type PruneMessageBody ¶
type PruneMessageBody struct {
Message Message `json:"message"`
}
type ReactionBody ¶
type ReactionType ¶
type ReactionType int
const ( ReactionTypeNone ReactionType = 0 // Invalid default value ReactionTypeLike ReactionType = 1 // Like the target cast ReactionTypeRecast ReactionType = 2 // Share target cast to the user's audience )
func ReactionTypeString ¶
func ReactionTypeString(s string) (ReactionType, error)
ReactionTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func ReactionTypeValues ¶
func ReactionTypeValues() []ReactionType
ReactionTypeValues returns all values of the enum
func (ReactionType) IsAReactionType ¶
func (i ReactionType) IsAReactionType() bool
IsAReactionType returns "true" if the value is listed in the enum definition. "false" otherwise
func (ReactionType) String ¶
func (i ReactionType) String() string
func (ReactionType) Values ¶
func (ReactionType) Values() []string
type RevokeMessageBody ¶
type RevokeMessageBody struct {
Message Message `json:"message"`
}
type UserDataBody ¶
type UserDataType ¶
type UserDataType int
const ( UserDataTypeNone UserDataType = 0 // Invalid default value UserDataTypePfp UserDataType = 1 // Profile Picture for the user UserDataTypeDisplay UserDataType = 2 // Display Name for the user UserDataTypeBio UserDataType = 3 // Bio for the user UserDataTypeURL UserDataType = 5 // URL of the user UserDataTypeUsername UserDataType = 6 // Preferred Farcaster Name for the user )
func UserDataTypeString ¶
func UserDataTypeString(s string) (UserDataType, error)
UserDataTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func UserDataTypeValues ¶
func UserDataTypeValues() []UserDataType
UserDataTypeValues returns all values of the enum
func (UserDataType) IsAUserDataType ¶
func (i UserDataType) IsAUserDataType() bool
IsAUserDataType returns "true" if the value is listed in the enum definition. "false" otherwise
func (UserDataType) String ¶
func (i UserDataType) String() string
func (UserDataType) Values ¶
func (UserDataType) Values() []string
type UserNameProof ¶
type UsernameProofType ¶
type UsernameProofType int
const ( UsernameTypeNone UsernameProofType = 0 UsernameTypeFname UsernameProofType = 1 UsernameTypeEnsL1 UsernameProofType = 2 )
func UsernameProofTypeString ¶
func UsernameProofTypeString(s string) (UsernameProofType, error)
UsernameProofTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func UsernameProofTypeValues ¶
func UsernameProofTypeValues() []UsernameProofType
UsernameProofTypeValues returns all values of the enum
func (UsernameProofType) IsAUsernameProofType ¶
func (i UsernameProofType) IsAUsernameProofType() bool
IsAUsernameProofType returns "true" if the value is listed in the enum definition. "false" otherwise
func (UsernameProofType) String ¶
func (i UsernameProofType) String() string
func (UsernameProofType) Values ¶
func (UsernameProofType) Values() []string
type VerificationRemoveBody ¶
type VerificationRemoveBody struct {
Address string `json:"address"`
}