[][src]Struct twitter_stream::Builder

pub struct Builder<'a, T = Token> { /* fields omitted */ }

A builder for TwitterStream.

Example

use futures::prelude::*;
use twitter_stream::Token;

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

twitter_stream::Builder::sample(token)
    .listen()
    .try_flatten_stream()
    .try_for_each(|json| {
        println!("{}", json);
        future::ok(())
    })
    .await
    .unwrap();

Methods

impl<'a, C, A> Builder<'a, Token<C, A>> where
    C: Borrow<str>,
    A: Borrow<str>, 
[src]

pub fn filter(token: Token<C, A>) -> Self[src]

Create a builder for POST statuses/filter endpoint.

See the Twitter Developer Documentation for more information.

pub fn sample(token: Token<C, A>) -> Self[src]

Create a builder for GET statuses/sample endpoint.

See the Twitter Developer Documentation for more information.

pub fn custom(method: RequestMethod, endpoint: Uri, token: Token<C, A>) -> Self[src]

Constructs a builder for a Stream at a custom endpoint.

pub fn listen(&self) -> FutureTwitterStream[src]

Start listening on the Streaming API endpoint, returning a Future which resolves to a Stream yielding JSON messages from the API.

Panics

This will panic if the underlying HTTPS connector failed to initialize.

Important traits for FutureTwitterStream<F>
pub fn listen_with_client<S, ReqB, ResB>(
    &self,
    client: S
) -> FutureTwitterStream<S::Future> where
    S: Service<Request<ReqB>, Response = Response<ResB>>,
    ReqB: Default + From<Vec<u8>>,
    ResB: Body
[src]

Same as listen except that it uses client to make HTTP request to the endpoint.

Panics

This will call <S as Service>::call without checking for <S as Service>::poll_ready and may cause a panic if client is not ready to send an HTTP request yet.

impl<'a, C, A> Builder<'a, Token<C, A>>[src]

pub fn method(&mut self, method: RequestMethod) -> &mut Self[src]

Reset the HTTP request method to be used when connecting to the server.

pub fn endpoint(&mut self, endpoint: Uri) -> &mut Self[src]

Reset the API endpoint URI to be connected.

pub fn token(&mut self, token: Token<C, A>) -> &mut Self[src]

Reset the token to be used to log into Twitter.

pub fn stall_warnings(&mut self, stall_warnings: bool) -> &mut Self[src]

Set whether to receive messages when in danger of being disconnected.

See the Twitter Developer Documentation for more information.

pub fn filter_level(
    &mut self,
    filter_level: impl Into<Option<FilterLevel>>
) -> &mut Self
[src]

Set the minimum filter_level Tweet attribute to receive. The default is FilterLevel::None.

See the Twitter Developer Documentation for more information.

pub fn language(&mut self, language: impl Into<Option<&'a str>>) -> &mut Self[src]

Set a comma-separated language identifiers to receive Tweets written in the specified languages only.

See the Twitter Developer Documentation for more information.

pub fn follow(&mut self, follow: impl Into<Option<&'a [u64]>>) -> &mut Self[src]

Set a list of user IDs to receive Tweets from the specified users.

See the Twitter Developer Documentation for more information.

pub fn track(&mut self, track: impl Into<Option<&'a str>>) -> &mut Self[src]

A comma separated list of phrases to filter Tweets by.

See the Twitter Developer Documentation for more information.

pub fn locations(
    &mut self,
    locations: impl Into<Option<&'a [((f64, f64), (f64, f64))]>>
) -> &mut Self
[src]

Set a list of bounding boxes to filter Tweets by, specified by a pair of coordinates in the form of ((longitude, latitude), (longitude, latitude)) tuple.

See the Twitter Developer Documentation for more information.

pub fn count(&mut self, count: impl Into<Option<i32>>) -> &mut Self[src]

The count parameter. This parameter requires elevated access to use.

See the Twitter Developer Documentation for more information.

Trait Implementations

impl<'a, T: Clone> Clone for Builder<'a, T>[src]

impl<'a, T: Debug> Debug for Builder<'a, T>[src]

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for Builder<'a, T> where
    T: RefUnwindSafe

impl<'a, T> Send for Builder<'a, T> where
    T: Send

impl<'a, T> Sync for Builder<'a, T> where
    T: Sync

impl<'a, T> Unpin for Builder<'a, T> where
    T: Unpin

impl<'a, T> UnwindSafe for Builder<'a, T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,