A simple Go wrapper for Twitter API v2 ✨ 🍰 ✨

Installation
# Go Modules
require github.com/sns-sdks/go-twitter
Usage
App with OAuth 2.0
Construct a new client with bearer token, then use the api.
cli := twitter.NewBearerClient("your bearer token")
u, err := cli.Tweets.LookupByID("tweet id", twitter.TweetOpts{})
fmt.Println(u, err)
OAuth 2.0 has released with beta.
So you can do OAuth2.0 with twitter. More see the Example for OAuth2.0
Authentication
Some apis need OAuth 1.0a User context, You can use initial a client with user access token.
app := twitter.NewAuthorizationAPP(
twitter.AuthorizationAPP{
ConsumerKey: "consumer key",
ConsumerSecret: "consumer secret",
AccessTokenKey: "user access token key",
AccessTokenSecret: "user access toke secret",
})
cli := app.GetUserClient()
bu, err := cli.Users.GetBlocking(uid, twitter.UserBlockingOpts{})
fmt.Println(bu, err)
Or you can handle authentication contact with twitter. See the Example for OAuth 1.0a
Features
Tweets:
- Tweets lookup
- Manage Tweets
- Timelines
- search Tweets
- Tweet counts
- Retweets
- Likes
- Hide replies
Users:
- Users lookup
- Follows
- Blocks
- Mutes
Spaces:
Lists:
- List lookup
- Manage lists
- List Tweets lookup
- List members
- List follows
- Pinned Lists
Compliance:
Direct Message:
- Direct Messages lookup
- Manage Direct Messages