Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
beanpuppy committed Jan 9, 2024
1 parent aa4e790 commit bfebc84
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 74 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "roux"
version = "2.2.10"
version = "2.2.11"
authors = ["Justin Duch <justin@duch.me>"]
edition = "2021"
license = "MIT"
Expand Down
38 changes: 19 additions & 19 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
//! To create an OAuth client with the reddit API, use the `Reddit` class.
//! ```no_run
//! use roux::Reddit;
//! #[cfg(not(feature = "blocking"))]
//! use tokio;
//! # #[cfg(not(feature = "blocking"))]
//! # use tokio;
//!
//! #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! #[maybe_async::maybe_async]
//! async fn main() {
//! # #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! # #[maybe_async::maybe_async]
//! # async fn main() {
//! let client = Reddit::new("USER_AGENT", "CLIENT_ID", "CLIENT_SECRET")
//! .username("USERNAME")
//! .password("PASSWORD")
//! .login()
//! .await;
//! let me = client.unwrap();
//! }
//! # }
//! ```
//!
//! It is important that you pick a good user agent. The ideal format is
Expand All @@ -34,12 +34,12 @@
//! ### Submit A Text Post
//! ```no_run
//! use roux::Reddit;
//! #[cfg(not(feature = "blocking"))]
//! use tokio;
//! # #[cfg(not(feature = "blocking"))]
//! # use tokio;
//!
//! #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! #[maybe_async::maybe_async]
//! async fn main() {
//! # #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! # #[maybe_async::maybe_async]
//! # async fn main() {
//! let client = Reddit::new("USER_AGENT", "CLIENT_ID", "CLIENT_SECRET")
//! .username("USERNAME")
//! .password("PASSWORD")
Expand All @@ -48,27 +48,27 @@
//! let me = client.unwrap();
//!
//! me.submit_text("TEXT_TITLE", "TEXT_BODY", "SUBREDDIT");
//! }
//! # }
//! ```
//!
//! ### Submit A Link Post
//! ```no_run
//! use roux::Reddit;
//! #[cfg(not(feature = "blocking"))]
//! use tokio;
//! # #[cfg(not(feature = "blocking"))]
//! # use tokio;
//!
//! #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! #[maybe_async::maybe_async]
//! async fn main() {
//! # #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! # #[maybe_async::maybe_async]
//! # async fn main() {
//! let client = Reddit::new("USER_AGENT", "CLIENT_ID", "CLIENT_SECRET")
//! .username("USERNAME")
//! .password("PASSWORD")
//! .login()
//! .await;
//! let me = client.unwrap();
//!
//! me.submit_link("LINK_TITLE", "LINK", "SUBREDDIT");
//! }
//! # me.submit_link("LINK_TITLE", "LINK", "SUBREDDIT");
//! # }
//! ```

use serde::Deserialize;
Expand Down
78 changes: 39 additions & 39 deletions src/models/subreddit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,64 @@
//! # Basic Usage
//! ```no_run
//! use roux::Subreddit;
//! #[cfg(not(feature = "blocking"))]
//! use tokio;
//! # #[cfg(not(feature = "blocking"))]
//! # use tokio;
//!
//! #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! #[maybe_async::maybe_async]
//! async fn main() {
//! let subreddit = Subreddit::new("rust");
//! // Now you are able to:
//! # #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! # #[maybe_async::maybe_async]
//! # async fn main() {
//! let subreddit = Subreddit::new("rust");
//! // Now you are able to:
//!
//! // Get moderators.
//! let moderators = subreddit.moderators().await;
//! // Get moderators.
//! let moderators = subreddit.moderators().await;
//!
//! // Get hot posts with limit = 25.
//! let hot = subreddit.hot(25, None).await;
//! // Get hot posts with limit = 25.
//! let hot = subreddit.hot(25, None).await;
//!
//! // Get rising posts with limit = 30.
//! let rising = subreddit.rising(30, None).await;
//! // Get rising posts with limit = 30.
//! let rising = subreddit.rising(30, None).await;
//!
//! // Get top posts with limit = 10.
//! let top = subreddit.top(10, None).await;
//! // Get top posts with limit = 10.
//! let top = subreddit.top(10, None).await;
//!
//! // Get latest comments.
//! // `depth` and `limit` are optional.
//! let latest_comments = subreddit.latest_comments(None, Some(25)).await;
//! // Get latest comments.
//! // `depth` and `limit` are optional.
//! let latest_comments = subreddit.latest_comments(None, Some(25)).await;
//!
//! // Get comments from a submission.
//! let article_id = &hot.unwrap().data.children.first().unwrap().data.id.clone();
//! let article_comments = subreddit.article_comments(article_id, None, Some(25));
//! }
//! // Get comments from a submission.
//! let article_id = &hot.unwrap().data.children.first().unwrap().data.id.clone();
//! let article_comments = subreddit.article_comments(article_id, None, Some(25));
//! # }
//! ```
//!
//! # Usage with feed options
//!
//! ```no_run
//! use roux::Subreddit;
//! use roux::util::{FeedOption, TimePeriod};
//! #[cfg(not(feature = "blocking"))]
//! use tokio;
//! # #[cfg(not(feature = "blocking"))]
//! # use tokio;
//!
//! #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! #[maybe_async::maybe_async]
//! async fn main() {
//! let subreddit = Subreddit::new("astolfo");
//! # #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! # #[maybe_async::maybe_async]
//! # async fn main() {
//! let subreddit = Subreddit::new("astolfo");
//!
//! // Gets top 10 posts from this month
//! let options = FeedOption::new().period(TimePeriod::ThisMonth);
//! let top = subreddit.top(25, Some(options)).await;
//! // Gets top 10 posts from this month
//! let options = FeedOption::new().period(TimePeriod::ThisMonth);
//! let top = subreddit.top(25, Some(options)).await;
//!
//! // Gets hot 10
//! let hot = subreddit.hot(25, None).await;
//! // Gets hot 10
//! let hot = subreddit.hot(25, None).await;
//!
//! // Get after param from `hot`
//! let after = hot.unwrap().data.after.unwrap();
//! let after_options = FeedOption::new().after(&after);
//! // Get after param from `hot`
//! let after = hot.unwrap().data.after.unwrap();
//! let after_options = FeedOption::new().after(&after);
//!
//! // Gets next 25
//! let next_hot = subreddit.hot(25, Some(after_options)).await;
//! }
//! // Gets next 25
//! let next_hot = subreddit.hot(25, Some(after_options)).await;
//! # }
//! ```
pub mod response;
extern crate serde_json;
Expand Down
28 changes: 14 additions & 14 deletions src/models/user/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
//! ```no_run
//! use roux::User;
//! use roux::util::FeedOption;
//! #[cfg(not(feature = "blocking"))]
//! use tokio;
//! # #[cfg(not(feature = "blocking"))]
//! # use tokio;
//!
//! #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! #[maybe_async::maybe_async]
//! async fn main() {
//! let user = User::new("kasuporo");
//! // Now you are able to:
//! # #[cfg_attr(not(feature = "blocking"), tokio::main)]
//! # #[maybe_async::maybe_async]
//! # async fn main() {
//! let user = User::new("kasuporo");
//! // Now you are able to:
//!
//! // Get overview
//! let overview = user.overview(None).await;
//! // Get overview
//! let overview = user.overview(None).await;
//!
//! // Get submitted posts.
//! let submitted = user.submitted(None).await;
//! // Get submitted posts.
//! let submitted = user.submitted(None).await;
//!
//! // Get comments.
//! let comments = user.comments(None).await;
//! }
//! // Get comments.
//! let comments = user.comments(None).await;
//! # }
//! ```

extern crate serde_json;
Expand Down

0 comments on commit bfebc84

Please sign in to comment.