twitter

package
v0.0.0-...-bc11ca3 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const URL = "https://api.twitter.com/1.1/"

Variables

This section is empty.

Functions

func GetJSON

func GetJSON(response *http.Response, dest interface{}) error

Types

type Media

type Media struct {
	Url      string
	Type     string
	AltText  *string
	Duration time.Duration
}

type Mention

type Mention struct {
	User
	StartIndex int `json:"start"`
	EndIndex   int `json:"end"`
	Visible    bool
}

type RateLimit

type RateLimit struct {
	Ceiling    *int
	Remaining  *int
	NextWindow *time.Time
}

func (RateLimit) String

func (r RateLimit) String() string

type Subscription

type Subscription struct {
	Id string `json:"user_id"`
}

type Tweet

type Tweet struct {
	Id                string
	FullText          string
	VisibleText       string
	VisibleTextOffset int
	ParentTweetId     string
	Type              TweetType
	Mentions          []Mention
	User              User
	Media             []Media
	FallbackMedia     []Media
	QuoteTweet        *Tweet
}

func (*Tweet) UnmarshalJSON

func (t *Tweet) UnmarshalJSON(bytes []byte) error

type TweetType

type TweetType int
const (
	SimpleTweet TweetType = iota
	QuoteTweet
	Retweet
)

type Twitter

type Twitter interface {
	GetWebhooks(ctx context.Context) ([]Webhook, structured_error.StructuredError)
	CreateWebhook(ctx context.Context, url string) (Webhook, structured_error.StructuredError)
	DeleteWebhook(ctx context.Context, webhookID string) structured_error.StructuredError
	GetSubscriptions(ctx context.Context) ([]Subscription, structured_error.StructuredError)
	DeleteSubscription(ctx context.Context, subscriptionID string) structured_error.StructuredError
	AddSubscription(ctx context.Context) structured_error.StructuredError
	GetTweetRaw(ctx context.Context, tweetID string) (*http.Response, structured_error.StructuredError)
	GetTweet(ctx context.Context, tweetID string) (*Tweet, structured_error.StructuredError)
	TweetReply(ctx context.Context, parentTweet *Tweet, message string) (*Tweet, structured_error.StructuredError)
	UserTimeline(ctx context.Context, screenName string, tweetID string) ([]*Tweet, structured_error.StructuredError)
}

func NewTwitter

func NewTwitter(consumerKey string, consumerSecret string, accessToken string, accessTokenSecret string, bearerToken string) Twitter

type User

type User struct {
	Id       string `json:"id_str"`
	Username string `json:"screen_name"`
	Display  string `json:"name"`
}

type Webhook

type Webhook struct {
	Id    string `json:"id"`
	Url   string `json:"url"`
	Valid bool   `json:"valid"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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