Struct kuon::SearchTweets[][src]

pub struct SearchTweets<'a, Q> { /* fields omitted */ }

Example

let api = kuon::TwitterAPI::new_using_env().await?;
let res = api.search_tweets().q("rust").count(100).send().await?;
for tweet in res.statuses {
    println!("{}", tweet.text);
}

Standard search API

Returns a collection of relevant Tweets matching a specified query.

Please note that Twitter’s search service and, by extension, the Search API is not meant to be an exhaustive source of Tweets. Not all Tweets will be indexed or made available via the search interface.

To learn how to use Twitter Search effectively, please see the Standard search operators page for a list of available filter operators. Also, see the Working with Timelines page to learn best practices for navigating results by since_id and max_id.

Q.A.
Requires authentication?Yes
Rate limited?Yes
Requests / 15-min window (user auth)180
Requests / 15-min window (app auth)450

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets

Implementations

impl<'a> SearchTweets<'a, ()>[src]

pub fn q<Q>(self, q: Q) -> SearchTweets<'a, Q> where
    Q: ToString
[src]

(required) A UTF-8, URL-encoded search query of 500 characters maximum, including operators. Queries may additionally be limited by complexity.

impl<'a, Q> SearchTweets<'a, Q>[src]

pub fn geocode(&mut self, geocode: impl Into<String>) -> &mut Self[src]

Returns tweets by users located within a given radius of the given latitude/longitude. The location is preferentially taking from the Geotagging API, but will fall back to their Twitter profile. The parameter value is specified by “ latitude,longitude,radius “, where radius units must be specified as either “ mi “ (miles) or “ km “ (kilometers). Note that you cannot use the near operator via the API to geocode arbitrary locations; however you can use this geocode parameter to search near geocodes directly. A maximum of 1,000 distinct “sub-regions” will be considered when using the radius modifier.

pub fn lang(&mut self, lang: impl Into<String>) -> &mut Self[src]

Restricts tweets to the given language, given by an ISO 639-1 code. Language detection is best-effort.

pub fn locale(&mut self, locale: impl Into<String>) -> &mut Self[src]

Specify the language of the query you are sending (only ja is currently effective). This is intended for language-specific consumers and the default should work in the majority of cases.

pub fn result_type(&mut self, result_type: impl Into<String>) -> &mut Self[src]

Optional. Specifies what type of search results you would prefer to receive. The current default is “mixed.” Valid values include:

  • mixed : Include both popular and real time results in the response.
  • recent : return only the most recent results in the response
  • popular : return only the most popular results in the response.

pub fn count(&mut self, count: u64) -> &mut Self[src]

The number of tweets to return per page, up to a maximum of 100. Defaults to 15. This was formerly the “rpp” parameter in the old Search API.

pub fn until(&mut self, until: impl Into<String>) -> &mut Self[src]

Returns tweets created before the given date. Date should be formatted as YYYY-MM-DD. Keep in mind that the search index has a 7-day limit. In other words, no tweets will be found for a date older than one week.

pub fn since_id(&mut self, since_id: u64) -> &mut Self[src]

Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available.

pub fn max_id(&mut self, max_id: u64) -> &mut Self[src]

Returns results with an ID less than (that is, older than) or equal to the specified ID.

pub fn include_entities(
    &mut self,
    include_entities: impl Into<bool>
) -> &mut Self
[src]

The entities node will not be included when set to false.

impl<'a, Q> SearchTweets<'a, Q> where
    Q: ToString
[src]

pub async fn send(&self) -> Result<SearchResult, Error>[src]

Trait Implementations

impl<'a, Q: Clone> Clone for SearchTweets<'a, Q>[src]

fn clone(&self) -> SearchTweets<'a, Q>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a, Q: Debug> Debug for SearchTweets<'a, Q>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a, Q> !RefUnwindSafe for SearchTweets<'a, Q>

impl<'a, Q> Send for SearchTweets<'a, Q> where
    Q: Send

impl<'a, Q> Sync for SearchTweets<'a, Q> where
    Q: Sync

impl<'a, Q> Unpin for SearchTweets<'a, Q> where
    Q: Unpin

impl<'a, Q> !UnwindSafe for SearchTweets<'a, Q>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.