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.

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);
}

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

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

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

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.