twapi-v2 0.5.9

Twitter v2 library.
Documentation

twapi-v2-rs

Twitter API v2 library.

Documentation

  • Request builder
  • Retrive rate limit from response headers
  • Convenience setted parameter methods
  • Optional retriable and timeout and logging
  • Optional OAuth with web example
  • Streaming example
  • Experimental type support.

Features

default

  • reqwest/default-tls

rustls-tls

  • reqwest/rustls-tls

retry

  • Retriable
  • Timeout
  • Logging

oauth

  • Twitter OAuth

Changes

CHANGELOG.md

Test status

TEST.md

Examples

API

use twapi_v2::api::get_2_tweets_id;

#[tokio::main]
async fn main() {
    let bearer_code = std::env::var("BEARER_CODE").unwrap();
    let tweet_id = std::env::var("TWEET_ID").unwrap();
    let res = get_2_tweets_id::Api::open(&bearer_code, &tweet_id)
        .execute()
        .await;
    if let Some((val, rate_limit)) = res {
        println!("{:?}", val);
    }
}

Twitter OAuth Web

cd examples/oauth-web
API_KEY_CODE=XXXX API_SECRET_CODE=XXXX cargo run

http://localhost:3000/

Streaming

cd examples/streaming
BEARER_CODE=XXXXX cargo run