# README
twitter-go
twitter-go is a Go client library for accessing the Twitter API v2.
Usage
First we have to go to Twitter Developer platform and register to get hands on a bearer token to use on our requests to the API, since all endpoints require one.
Installing
import "github.com/vniche/twitter-go"
Construct a new Twitter client, then use the various services on the client to access different parts of the Twitter API. For example:
// Fetching an user by ID
import (
twitter "github.com/vniche/twitter-go"
)
client := twitter.WithBearerToken("mybearertoken123", nil)
// custom parameters for query
params := make(map[string][]string)
params["user.fields"] = []string{
"public_metrics",
}
// fetch user by id
user, err := client.LookupUserByID(userID, params)
if err != nil {
log.Panicf("unable to fetch user by id: %+v", err)
}
fmt.Printf("user: %+v\n", user)
Contributing
I would like to cover the entire Twitter API and contributions are of course always welcome. The calling pattern is pretty well established, so adding new methods is relatively straightforward.
TODO: Contribution doc.
License
This library is distributed under the MIT license found in the LICENSE file.
# Functions
No description provided by the author
NewChannel is a constructor for new channel.
No description provided by the author
ShutdownStream tries to close every managed channel and delete it from managed channels slice.
WithAPIKey returns a new instance of Twitter API v2 http client with api key and api key secret based authentication.
WithBearerToken returns a new instance of Twitter API v2 http client with bearer token (app-only) based authentication.
# Constants
No description provided by the author
No description provided by the author
StatusCode stands for the resp.Status code index.
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
Client stands for the TWitter API HTTP client.
Credentials stands for the Twitter API credentails.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Tweet represents a Twitter tweet.
No description provided by the author
User represents a Twitter user.
# Type aliases
No description provided by the author