1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! [](https://developer.twitter.com/en/docs/twitter-api)
//!
//! Supports all of the Twitter v2 API endpoints, but many remain fairly untested
//! due to the complexity of the API and time restraints. PRs and Issues are very welcome!
//! As this repo currently has limited documentation, please check out the amazing [Twitter API v2
//! Docs](https://developer.twitter.com/en/docs/api-reference-index#twitter-api-v2) for information.
//!
//! # Features
//!
//! * **oauth2**: Included by default. See the examples for how to use.
//! * **native-tls**: Use `native-tls` as TLS backend (default)
//! * **rustls-tls**: Use `rustls` as TLS backend
//!
//! # Example
//!
//! ```
//! use twitter_v2::TwitterApi;
//! use twitter_v2::authorization::{Oauth2Token, BearerToken};
//! use twitter_v2::query::{TweetField, UserField};
//! # use time::macros::datetime;
//!
//! # #[tokio::main]
//! # async fn main() -> twitter_v2::Result<()> {
//! let auth = BearerToken::new(std::env::var("APP_BEARER_TOKEN").unwrap());
//! let tweet = TwitterApi::new(auth)
//! .get_tweet(1261326399320715264)
//! .tweet_fields([TweetField::AuthorId, TweetField::CreatedAt])
//! .send()
//! .await?
//! .into_data()
//! .expect("this tweet should exist");
//! assert_eq!(tweet.id, 1261326399320715264);
//! assert_eq!(tweet.author_id.unwrap(), 2244994945);
//! assert_eq!(tweet.created_at.unwrap(), datetime!(2020-05-15 16:03:42 UTC));
//!
//! # let stored_oauth2_token = std::fs::read_to_string("./.oauth2_token.json").unwrap();
//! let auth: Oauth2Token = serde_json::from_str(&stored_oauth2_token)?;
//! let my_followers = TwitterApi::new(auth)
//! .with_user_ctx()
//! .await?
//! .get_my_followers()
//! .user_fields([UserField::Username])
//! .max_results(20)
//! .send()
//! .await?
//! .into_data();
//! # Ok(())
//! # }
//! ```
compile_error!;
pub extern crate oauth2;
pub use ;