twitter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotFoundErrorType = "https://api.twitter.com/2/problems/resource-not-found"
)

Variables

This section is empty.

Functions

func NewScorer

func NewScorer(junoCfg config.Config) profilesscore.Scorer

NewScorer returns a new Scorer instance

Types

type Authorizer

type Authorizer struct {
	Token string
}

Authorizer implements twitter.Authorizer to authorize Twitter requests

func NewAuthorizer

func NewAuthorizer(token string) *Authorizer

NewAuthorizer implements a new Authorizer instance

func (*Authorizer) Add

func (a *Authorizer) Add(req *http.Request)

Add implements twitter.Authorizer

type Config

type Config struct {
	Token string `yaml:"token"`
}

func ParseConfig

func ParseConfig(bz []byte) (*Config, error)

type ScoreDetails

type ScoreDetails struct {
	CreatedAt      time.Time `json:"created_at"`
	FollowersCount uint64    `json:"followers_count"`
	FollowingCount uint64    `json:"following_count"`
	TweetsCount    uint64    `json:"tweets_count"`
	Verified       bool      `json:"verified"`
}

func NewScoreDetails

func NewScoreDetails(createdAt time.Time, followersCount, followingCount, tweetsCount uint64, verified bool) *ScoreDetails

func (*ScoreDetails) GetScore

func (d *ScoreDetails) GetScore() (score uint64)

GetScore implements types.ProfileScoreDetails

type Scorer

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

Scorer represents a scorers.Scorer instance to score profiles based on their Twitter statistics

func (*Scorer) GetRateLimit

func (s *Scorer) GetRateLimit() *profilesscore.ScoreRateLimit

GetRateLimit implements Scorer

func (*Scorer) GetScoreDetails

func (s *Scorer) GetScoreDetails(_ string, application string, username string) (types.ProfileScoreDetails, error)

GetScoreDetails implements Scorer

func (*Scorer) GetUser

func (s *Scorer) GetUser(username string) (*twitter.UserObj, error)

GetUser returns the Twitter id of the user having the given username

Jump to

Keyboard shortcuts

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