[−][src]Struct twitter_stream::Builder
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]
C: Borrow<str>,
A: Borrow<str>,
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]
&self,
client: S
) -> FutureTwitterStream<S::Future> where
S: Service<Request<ReqB>, Response = Response<ResB>>,
ReqB: Default + From<Vec<u8>>,
ResB: Body,
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]
&mut self,
filter_level: impl Into<Option<FilterLevel>>
) -> &mut Self
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]
&mut self,
locations: impl Into<Option<&'a [((f64, f64), (f64, f64))]>>
) -> &mut Self
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
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Builder<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T> Send for Builder<'a, T> where
T: Send,
T: Send,
impl<'a, T> Sync for Builder<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Unpin for Builder<'a, T> where
T: Unpin,
T: Unpin,
impl<'a, T> UnwindSafe for Builder<'a, T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,