twitter

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound        = errors.New("twitter user not found")
	ErrDuplicateTipAddress = errors.New("duplicate tip address")
	ErrDuplicateNonce      = errors.New("duplicate nonce")
)

Functions

This section is empty.

Types

type Record

type Record struct {
	Id uint64

	Username      string
	Name          string
	ProfilePicUrl string
	VerifiedType  userpb.TwitterUser_VerifiedType
	FollowerCount uint32

	TipAddress string

	LastUpdatedAt time.Time
	CreatedAt     time.Time
}

func (*Record) Clone

func (r *Record) Clone() Record

func (*Record) CopyTo

func (r *Record) CopyTo(dst *Record)

func (*Record) Validate

func (r *Record) Validate() error

type Store

type Store interface {
	// SaveUser saves a Twitter user's information
	SaveUser(ctx context.Context, record *Record) error

	// GetUserByUsername gets a Twitter user's information by the username
	GetUserByUsername(ctx context.Context, username string) (*Record, error)

	// GetUserByTipAddress gets a Twitter user's information by the tip address
	GetUserByTipAddress(ctx context.Context, tipAddress string) (*Record, error)

	// GetStaleUsers gets user that have their last updated timestamp older than minAge
	GetStaleUsers(ctx context.Context, minAge time.Duration, limit int) ([]*Record, error)

	// MarkTweetAsProcessed marks a tweet as being processed
	MarkTweetAsProcessed(ctx context.Context, tweetId string) error

	// IsTweetProcessed returns whether a tweet is processed
	IsTweetProcessed(ctx context.Context, tweetId string) (bool, error)

	// MarkNonceAsUsed marks a registration nonce as being used and assigned
	// to the provided tweet.
	MarkNonceAsUsed(ctx context.Context, tweetId string, nonce uuid.UUID) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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