Twitter API v2 library.
```rust use twapiv2::api::{get2tweetsid, BearerAuthentication};
async fn main() { let bearercode = std::env::var("BEARERCODE").unwrap(); let auth = BearerAuthentication::new(bearercode); let tweetid = std::env::var("TWEETID").unwrap(); let res = get2tweetsid::Api::open(&tweetid) .execute(&auth) .await; if let Some((val, ratelimit)) = res { println!("{:?}", val); } } ```
```rust use twapiv2::api::{get2tweetsid, BearerAuthentication}; use twapi_v2::oauth10a::OAuthAuthentication;
async fn main() { let auth = OAuthAuthentication::new( std::env::var("CONSUMERKEY").unwrapordefault(), std::env::var("CONSUMERSECRET").unwrapordefault(), std::env::var("ACCESSKEY").unwrapordefault(), std::env::var("ACCESSSECRET").unwrapordefault(), ); let tweetid = std::env::var("TWEETID").unwrap(); let res = get2tweetsid::Api::open(&tweetid) .execute(&auth) .await; if let Some((val, rate_limit)) = res { println!("{:?}", val); } } ```
cd examples/oauth-web
API_KEY_CODE=XXXX API_SECRET_CODE=XXXX cargo run
http://localhost:3000/
cd examples/streaming
BEARER_CODE=XXXXX cargo run