https://github.com/sivchari/gotwtr
gotwtr provides Twitter v2 API
https://github.com/sivchari/gotwtr
go golang twitter twitter-api twitter-client
Last synced: 18 days ago
JSON representation
gotwtr provides Twitter v2 API
- Host: GitHub
- URL: https://github.com/sivchari/gotwtr
- Owner: sivchari
- License: mit
- Created: 2021-09-21T08:33:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-22T08:41:51.000Z (over 1 year ago)
- Last Synced: 2025-03-28T13:44:26.133Z (about 1 month ago)
- Topics: go, golang, twitter, twitter-api, twitter-client
- Language: Go
- Homepage: https://developer.twitter.com/en/docs/twitter-api/tools-and-libraries/v2
- Size: 251 KB
- Stars: 80
- Watchers: 6
- Forks: 13
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# gotwtr
[](https://pkg.go.dev/github.com/sivchari/gotwtr)
[](https://github.com/sivchari/gotwtr/actions/workflows/lint.yml)
[](https://github.com/sivchari/gotwtr/actions/workflows/test.yml)gotwtr is a Go client library for the Twitter v2 API.
## Note
We covers only Twitter v2 API supported by OAuth 2.0 Bearer Token.
We will had worked on it, when new one is be handled OAuth 2.0.
## Installation
```console
go get github.com/sivchari/gotwtr
```## Documentation
Please see [GoDoc](https://pkg.go.dev/github.com/sivchari/gotwtr)
## Example
### Tweet lookup
```go
package mainimport (
"context"
"fmt""github.com/sivchari/gotwtr"
)func main() {
client := gotwtr.New("YOUR_TWITTER_BEARER_TOKEN")
// look up multiple tweets
ts, err := client.RetrieveMultipleTweets(context.Background(), []string{"id", "id2"})
if err != nil {
panic(err)
}
for _, t := range ts.Tweets {
fmt.Println(t)
}// look up single tweet
t, err := client.RetrieveSingleTweet(context.Background(), "id")
if err != nil {
panic(err)
}
fmt.Println(t.Tweet)
}
```If you wanna more example, please see examples dir.
These are covered all code gotwtr provides Twitter v2 API interface.
## Contributing
We are welcome to contribute to this project.
Fork and make a Pull Request, or create an Issue if you see any problem or any enhancement, feature request.