fctools

package
v0.0.0-...-3b95945 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const FARCASTER_EPOCH int64 = 1609459200

Variables

This section is empty.

Functions

func CreateMessage

func CreateMessage(messageData *pb.MessageData, signerPrivate []byte, signerPublic []byte) *pb.Message

func GetFidByFname

func GetFidByFname(fname string) (uint64, error)

func Marshal

func Marshal(msg proto.Message, opts MarshalOptions) ([]byte, error)

func ProcessCastBody

func ProcessCastBody(text string) (string, []uint32, []uint64, []*pb.Embed, string)

Types

type Cast

type Cast struct {
	Message *pb.Message
	Replies []Hash
}

func (*Cast) Fid

func (c *Cast) Fid() string

func (*Cast) Hash

func (c *Cast) Hash() string

func (Cast) Json

func (c Cast) Json(hexHashes bool, realTimestamps bool) ([]byte, error)

func (*Cast) String

func (c *Cast) String() string

func (*Cast) Text

func (c *Cast) Text() string

type CastGroup

type CastGroup struct {
	Head     Hash
	Messages map[Hash]*Cast
	Fnames   map[uint64]string
	Ordered  []Hash
}

func NewCastGroup

func NewCastGroup() *CastGroup

func (*CastGroup) AppendCast

func (grp *CastGroup) AppendCast(hub *FarcasterHub, castId *pb.CastId) *CastGroup

func (*CastGroup) CollectFnames

func (grp *CastGroup) CollectFnames(hub *FarcasterHub) *CastGroup

func (*CastGroup) FromCast

func (grp *CastGroup) FromCast(hub *FarcasterHub, castId *pb.CastId, expandTree bool) *CastGroup

func (*CastGroup) FromCastFidHash

func (grp *CastGroup) FromCastFidHash(hub *FarcasterHub, fid uint64, hash string, expandTree bool) *CastGroup

Populates a CastGroup with all casts in a thread that a CastId participates. Head is set to the top cast of the thread.

func (*CastGroup) FromCastIds

func (grp *CastGroup) FromCastIds(hub *FarcasterHub, castIds []*pb.CastId) *CastGroup

Populates a CastGroup with recent likes from an Fid. Head is set to nil.

func (*CastGroup) FromFid

func (grp *CastGroup) FromFid(hub *FarcasterHub, fid uint64, count uint32) *CastGroup

Populates a CastGroup with recent casts from an Fid. Head is set to nil.

func (*CastGroup) JsonList

func (grp *CastGroup) JsonList(hexHashes bool, realTimestamps bool) ([]byte, error)

func (*CastGroup) JsonThread

func (grp *CastGroup) JsonThread(hexHashes bool, realTimestamps bool) ([]byte, error)

JsonThread returns a JSON string. "casts" is a map hash->message "head" contains the hash of the first message in the thread. replies[casts[x]["hash"]] contains the hashes of the replies to casts[x] You can follow the thread by checking

func (grp *CastGroup) Links() []string

type FarcasterHub

type FarcasterHub struct {
	// contains filtered or unexported fields
}

func NewFarcasterHub

func NewFarcasterHub() *FarcasterHub

func (FarcasterHub) Close

func (h FarcasterHub) Close()

func (FarcasterHub) GetCast

func (hub FarcasterHub) GetCast(fid uint64, hash []byte) (*pb.Message, error)

func (FarcasterHub) GetCastReplies

func (hub FarcasterHub) GetCastReplies(fid uint64, hash []byte) (*pb.MessagesResponse, error)

func (FarcasterHub) GetCastsByFid

func (hub FarcasterHub) GetCastsByFid(fid uint64, pageSize uint32) ([]*pb.Message, error)

func (FarcasterHub) GetFidByUsername

func (hub FarcasterHub) GetFidByUsername(username string) (uint64, error)

func (FarcasterHub) GetReactionsByFid

func (hub FarcasterHub) GetReactionsByFid(fid uint64, reaction string, pageSize uint32) ([]*pb.Message, error)

func (FarcasterHub) GetUserData

func (hub FarcasterHub) GetUserData(fid uint64, user_data_type string) (*pb.Message, error)

func (FarcasterHub) GetUserDataStr

func (hub FarcasterHub) GetUserDataStr(fid uint64, user_data_type string) (string, error)

func (FarcasterHub) GetUsernameProofsByFid

func (hub FarcasterHub) GetUsernameProofsByFid(fid uint64) ([]string, error)

func (FarcasterHub) HubInfo

func (hub FarcasterHub) HubInfo() ([]byte, error)

func (FarcasterHub) PrxGetCast

func (hub FarcasterHub) PrxGetCast(fid uint64, hash []byte) (*pb.Message, error)

func (FarcasterHub) PrxGetFidByUsername

func (hub FarcasterHub) PrxGetFidByUsername(username string) (uint64, error)

func (FarcasterHub) PrxGetUserDataStr

func (hub FarcasterHub) PrxGetUserDataStr(fid uint64, user_data_type string) (string, error)

func (FarcasterHub) SubmitMessage

func (hub FarcasterHub) SubmitMessage(message *pb.Message) (*pb.Message, error)

func (FarcasterHub) SubmitMessageData

func (hub FarcasterHub) SubmitMessageData(messageData *pb.MessageData, signerPrivate, signerPublic []byte) (*pb.Message, error)

type Hash

type Hash [20]byte

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (Hash) IsZero

func (h Hash) IsZero() bool

func (Hash) String

func (h Hash) String() string

type MarshalOptions

type MarshalOptions struct {
	Bytes2Hash     bool
	Timestamp2Date bool
}

type Reaction

type Reaction struct {
	Message *pb.Message
}

func (*Reaction) Json

func (reaction *Reaction) Json(hexHashes bool, realTimestamps bool) ([]byte, error)

func (*Reaction) String

func (reaction *Reaction) String() string

type Reactions

type Reactions struct {
	Messages []*Reaction
	Fnames   map[uint64]string
}

func NewReactions

func NewReactions() *Reactions

func (*Reactions) CastIds

func (reactions *Reactions) CastIds() []*pb.CastId

func (*Reactions) CollectFnames

func (reactions *Reactions) CollectFnames(hub *FarcasterHub) *Reactions

func (*Reactions) FromFid

func (reactions *Reactions) FromFid(hub *FarcasterHub, fid uint64, reactionType string, count uint32) *Reactions

Populates a CastGroup with recent likes from an Fid. Head is set to nil.

func (*Reactions) JsonList

func (reactions *Reactions) JsonList(hexHashes bool, realTimestamps bool) ([]byte, error)

type User

type User struct {
	Fid      uint64
	UserData map[string]*pb.Message
}

func NewUser

func NewUser() *User

func (*User) FetchUserData

func (u *User) FetchUserData(hub *FarcasterHub, types []string) *User

hub == nil --> Create new hub connection types == nil --> Fetch all USER_DATA_TYPE_*

func (*User) FromFid

func (u *User) FromFid(fid uint64) *User

func (*User) FromFname

func (u *User) FromFname(hub *FarcasterHub, fname string) *User

func (*User) Json

func (u *User) Json(userDataType string, hexHashes bool, realTimestamps bool) ([]byte, error)

func (*User) String

func (u *User) String() string

func (*User) Value

func (u *User) Value(t string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL