Struct rs621::client::Client [−][src]
pub struct Client { /* fields omitted */ }
Expand description
Client struct.
Implementations
Create a new client with the specified value for the User-Agent header. The API requires a non-empty User-Agent header for all requests, preferably including your E621 username and the name of your project.
Create a new client with the specified User-Agent header and proxy. The API requires a non-empty User-Agent header for all requests, preferably including your E621 username and the name of your project.
Login to the server with the provided username and API key. All subsequent requests will be sent with the given credentials.
Remove any login information previously set with Client::login.
pub fn get_posts<'a, I, J, T>(&'a self, ids: I) -> PostStream<'a, J, T> where
T: Borrow<u64> + Unpin,
J: Iterator<Item = T> + Unpin,
I: IntoIterator<Item = T, IntoIter = J> + Unpin,
pub fn get_posts<'a, I, J, T>(&'a self, ids: I) -> PostStream<'a, J, T> where
T: Borrow<u64> + Unpin,
J: Iterator<Item = T> + Unpin,
I: IntoIterator<Item = T, IntoIter = J> + Unpin,
Returns posts with the given IDs. Note that the order is NOT preserved!
use futures::prelude::*; let client = Client::new("https://e926.net", "MyProject/1.0 (by username on e621)")?; let mut post_stream = client.get_posts(&[8595, 535, 2105, 1470]); while let Some(post) = post_stream.next().await { println!("Post #{}", post?.id); }
Returns a Stream over all the posts matching the search query.
use futures::prelude::*; let client = Client::new("https://e926.net", "MyProject/1.0 (by username on e621)")?; let mut post_stream = client.post_search(&["fluffy", "rating:s"][..]).take(3); while let Some(post) = post_stream.next().await { assert_eq!(post?.rating, PostRating::Safe); }
pub fn post_search_from_page<'a, T: Into<Query>>(
&'a self,
tags: T,
page: SearchPage
) -> PostSearchStream<'a>
pub fn post_search_from_page<'a, T: Into<Query>>(
&'a self,
tags: T,
page: SearchPage
) -> PostSearchStream<'a>
Returns a Stream over all the posts matching the search query, starting from the given page.
use rs621::post::SearchPage; let client = Client::new("https://e926.net", "MyProject/1.0 (by username on e621)")?; let mut post_stream = client .post_search_from_page(&["fluffy", "rating:s"][..], SearchPage::BeforePost(123456)) .take(3); while let Some(post) = post_stream.next().await { let post = post?; assert!(post.id < 123456); assert_eq!(post.rating, PostRating::Safe); }
Performs a pool search.
use futures::prelude::*; let client = Client::new("https://e926.net", "MyProject/1.0 (by username on e621)")?; let mut pool_stream = client.pool_search(PoolSearch::new().name_matches("foo")); while let Some(pool) = pool_stream.next().await { assert!(pool?.name.contains("foo")); }
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client