[][src]Module twitter_stream::builder

A Builder type for TwitterStream.

The Streaming API has two different endpoints: POST statuses/filter and GET statuses/sample. Builder automatically determines which endpoint to use based on the specified parameters. Specifically, when any of follow, track and locations parameters is specified, filter will be used, and when none is specified, sample will be used.

filter yields public Tweets that match the filter predicates specified by the parameters, and sample yields "a small random sample" of all public Tweets.

Example

use futures::prelude::*;
use twitter_stream::{builder::BoundingBox, Token};

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

const TOKYO: &'static [BoundingBox] = &[BoundingBox::new(139.56, 35.53, 139.92, 35.82)];

// Prints geolocated English Tweets associated with Tokyo (the 23 special wards).
twitter_stream::Builder::new(token)
    .locations(TOKYO)
    .language("en")
    .listen()
    .try_flatten_stream()
    .try_for_each(|json| {
        println!("{}", json);
        future::ok(())
    })
    .await
    .unwrap();

Structs

BoundingBox

A BoundingBox is a rectangular area on the globe specified by coordinates of the southwest and northeast edges in decimal degrees.

Builder

A builder for TwitterStream.

RequestMethod

The Request Method (VERB)

Uri

The URI component of a request.

Enums

FilterLevel

Represents the filter_level parameter in API requests.