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
//! # pullcaps
//!
//! The `pullcaps` crate provides a convenient, opinionated, asynchronous client
//! for the [PushShift API](https://pushshift.io/).
//!
//! ## Getting all comments from a specific user.
//!
//! The following example shows a small script that gets all comments made
//! by a specific user.
//!
//! ```rust,no_run
//! use futures::StreamExt;
//! use pullcaps::{Client, Filter};
//!
//! # #[tokio::main]
//! # async fn main() {
//! let client = Client::new();
//! let filter = Filter::new().author("reddit");
//!
//! let mut comments = client.get_comments(filter).await;
//! while let Some(comment) = comments.next().await {
//! println!("text: {}", comment.body);
//! }
//! # }
//! ```
//!
//! **NOTE**: If you plan to perform multiple requests, it is best to create a [`Client`]
//! and reuse it.
//!
//! ## Getting posts in a given subreddit
//!
//! The following example shows how to get posts from a given subreddit - in particular
//! we utilize [`futures::StreamExt::take`] to limit ourselves to the five most recent posts
//! in the subreddit.
//!
//! ```rust,no_run
//! use futures::StreamExt;
//! use pullcaps::{Client, Filter};
//!
//! # #[tokio::main]
//! # async fn main() {
//! let client = Client::new();
//! let filter = Filter::new().subreddit("askreddit");
//!
//! let mut posts = client.get_posts(filter).await.take(5);
//! while let Some(post) = posts.next().await {
//! if let Some(text) = post.self_text {
//! println!("text: {}", text);
//! }
//! }
//! # }
//! ```
pub use Client;
pub use ;