[][src]Crate twitter_stream

Twitter Stream

A library for listening on Twitter Streaming API.

Usage

Add this to your Cargo.toml:

[dependencies]
futures = "0.3"
tokio = { version = "0.2", features = ["macros"] }
twitter-stream = "=0.10.0-alpha.6"

Overview

Here is a basic example that prints public mentions to @Twitter in JSON format:

use futures::prelude::*;
use twitter_stream::{Token, TwitterStream};

let token = Token::new("consumer_key", "consumer_secret", "access_key", "access_secret");

TwitterStream::track("@Twitter", &token)
    .try_flatten_stream()
    .try_for_each(|json| {
        println!("{}", json);
        future::ok(())
    })
    .await
    .unwrap();

Re-exports

pub use crate::builder::Builder;
pub use crate::error::Error;

Modules

builder

Builder type for TwitterStream.

error

Error type

hyperfeature="hyper"

Type aliases for use with hyper crate's HTTP client.

service

A trait alias for Service.

Structs

Credentials

The "credentials" pair defined in RFC 5849 section 1.1.

FutureTwitterStream

A future returned by constructor methods which resolves to a TwitterStream.

Token

An OAuth token used to authenticate to Twitter.

TwitterStream

A listener for Twitter Streaming API, yielding JSON strings returned from the API.