pub struct Builder<'a, T = Token> { /* private fields */ }Expand description
A builder for TwitterStream.
See the builder module documentation for details.
Implementations§
Source§impl<'a, C, A> Builder<'a, Token<C, A>>
impl<'a, C, A> Builder<'a, Token<C, A>>
Sourcepub fn listen(&self) -> FutureTwitterStream
Available on crate feature hyper only.
pub fn listen(&self) -> FutureTwitterStream
hyper only.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.
Sourcepub fn listen_with_client<S, B>(
&self,
client: S,
) -> FutureTwitterStream<S::Future> ⓘ
pub fn listen_with_client<S, B>( &self, client: S, ) -> FutureTwitterStream<S::Future> ⓘ
Same as listen except that it uses client to make HTTP request
to the endpoint.
client must be able to handle the https scheme.
§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.
§Example
use tower::ServiceExt;
let stream = twitter_stream::Builder::new(token)
.listen_with_client(client.ready_and().await?)
.await
.unwrap();Source§impl<'a, C, A> Builder<'a, Token<C, A>>
impl<'a, C, A> Builder<'a, Token<C, A>>
Sourcepub fn endpoint(
&mut self,
endpoint: impl Into<Option<(RequestMethod, Uri)>>,
) -> &mut Self
pub fn endpoint( &mut self, endpoint: impl Into<Option<(RequestMethod, Uri)>>, ) -> &mut Self
Set the API endpoint URI to be connected.
This overrides the default behavior of automatically determining the endpoint to use.
Sourcepub fn token(&mut self, token: Token<C, A>) -> &mut Self
pub fn token(&mut self, token: Token<C, A>) -> &mut Self
Reset the token to be used to log into Twitter.
Sourcepub fn stall_warnings(&mut self, stall_warnings: bool) -> &mut Self
pub fn stall_warnings(&mut self, stall_warnings: bool) -> &mut Self
Set whether to receive messages when in danger of being disconnected.
See the Twitter Developer Documentation for more information.
Sourcepub fn filter_level(
&mut self,
filter_level: impl Into<Option<FilterLevel>>,
) -> &mut Self
pub fn filter_level( &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.
Sourcepub fn language(&mut self, language: impl Into<Cow<'a, str>>) -> &mut Self
pub fn language(&mut self, language: impl Into<Cow<'a, str>>) -> &mut Self
Set a comma-separated language identifiers to receive Tweets written in the specified languages only.
Setting an empty string will unset this parameter.
See the Twitter Developer Documentation for more information.
Sourcepub fn follow(&mut self, follow: impl Into<Cow<'a, [u64]>>) -> &mut Self
pub fn follow(&mut self, follow: impl Into<Cow<'a, [u64]>>) -> &mut Self
Set a list of user IDs to receive Tweets from the specified users.
Setting an empty slice will unset this parameter.
See the Twitter Developer Documentation for more information.
Sourcepub fn track(&mut self, track: impl Into<Cow<'a, str>>) -> &mut Self
pub fn track(&mut self, track: impl Into<Cow<'a, str>>) -> &mut Self
A comma separated list of phrases to filter Tweets by.
Setting an empty string will unset this parameter.
See the Twitter Developer Documentation for more information.
Sourcepub fn locations(
&mut self,
locations: impl Into<Cow<'a, [BoundingBox]>>,
) -> &mut Self
pub fn locations( &mut self, locations: impl Into<Cow<'a, [BoundingBox]>>, ) -> &mut Self
Set a list of bounding boxes to filter Tweets by.
Setting an empty slice will unset this parameter.
See BoundingBox and
the Twitter Developer Documentation for more information.