Struct Pixiv

Source
pub struct Pixiv { /* private fields */ }
Expand description

Used to authenticate to the Pixiv servers and construct Pixiv requests through methods creating PixivRequestBuilder.

Implementations§

Source§

impl Pixiv

Source

pub fn new(client: &Client) -> Pixiv

Creates a new Pixiv struct.

Source

pub fn login(&mut self, username: &str, password: &str) -> Result<(), AuthError>

This is required to use all the other functions this library provides. Requires a valid username and password.

Source

pub fn refresh_auth(&mut self) -> Result<(), AuthError>

Refreshes the authentication. You should use this when your access token is close to expiring.

Source

pub fn access_token(&self) -> &String

Get the access token.

Source

pub fn access_token_mut(&mut self) -> &mut String

Get a mutable reference to the access token.

Source

pub fn refresh_token(&self) -> &String

Get the refresh token.

Source

pub fn refresh_token_mut(&mut self) -> &mut String

Get a mutable reference to the refresh token.

Source

pub fn bad_words(&self) -> PixivRequestBuilder<'_>

Used to build a request to retrive bad_words.json.

§Request Transforms

None

Source

pub fn work(&self, illust_id: usize) -> PixivRequestBuilder<'_>

Used to build a request to retrieve information of a work.

§Request Transforms
  • image_sizes (default: px_128x128,small,medium,large,px_480mw)
  • include_stats (default: true)
Source

pub fn user(&self, user_id: usize) -> PixivRequestBuilder<'_>

Used to build a request to retrieve information of a user.

§Request Transforms
  • profile_image_sizes (default: px_170x170,px_50x50)
  • image_sizes (default: px_128x128,small,medium,large,px_480mw)
  • include_stats (default: true)
Source

pub fn feed(&self) -> PixivRequestBuilder<'_>

Used to build a request to retrieve your account’s feed.

§Request Transforms
  • show_r18 (default: true)
  • max_id
Source

pub fn favorite_works(&self) -> PixivRequestBuilder<'_>

Used to build a request to retrieve works favorited on your account.

§Request Transforms
  • page (default: 1)
  • per_page (default: 50)
  • publicity (default: public)
  • image_sizes (default: px_128x128,small,medium,large,px_480mw)
Source

pub fn favorite_work_add(&self, work_id: usize) -> PixivRequestBuilder<'_>

Used to build a request to favorite a work on your account.

§Request Transforms
  • publicity (default: public)
Source

pub fn favorite_works_remove<B, I>( &self, work_ids: I, ) -> PixivRequestBuilder<'_>
where B: Borrow<usize>, I: IntoIterator<Item = B>,

Used to build a request to remove favorited works on your account.

§Request Transforms
  • publicity (default: public)
Source

pub fn following_works(&self) -> PixivRequestBuilder<'_>

Used to build a request to retrieve newest works from whoever you follow on your account.

§Request Transforms
  • page (default: 1)
  • per_page (default: 30)
  • image_sizes (default: px_128x128,small,medium,large,px_480mw)
  • include_stats (default: true)
  • include_sanity_level (default: true)
Source

pub fn following(&self) -> PixivRequestBuilder<'_>

Used to build a request to retrieve users you follow.

§Request Transforms
  • page (default: 1)
  • per_page (default: 30)
  • image_sizes (default: px_128x128,small,medium,large,px_480mw)
  • include_stats (default: true)
  • include_sanity_level (default: true)
Source

pub fn following_add(&self, user_id: usize) -> PixivRequestBuilder<'_>

Used to build a request to follow a user on your account.

§Request Transforms
  • publicity (default: public)
Source

pub fn following_remove<B, I>(&self, user_ids: I) -> PixivRequestBuilder<'_>
where B: Borrow<usize>, I: IntoIterator<Item = B>,

Used to build a request to unfollow users on your account.

§Request Transforms
  • publicity (default: public)
Source

pub fn user_works(&self, user_id: usize) -> PixivRequestBuilder<'_>

Used to build a request to retrive a list of works submitted by a user.

§Request Transforms
  • page (default: 1)
  • per_page (default: 30)
  • image_sizes (default: px_128x128,small,medium,large,px_480mw)
  • include_stats (default: true)
  • include_sanity_level (default: true)
Source

pub fn user_favorite_works(&self, user_id: usize) -> PixivRequestBuilder<'_>

Used to build a request to retrive a list of works favorited by a user.

§Request Transforms
  • page (default: 1)
  • per_page (default: 30)
  • image_sizes (default: px_128x128,small,medium,large,px_480mw)
  • include_sanity_level (default: true)
Source

pub fn user_feed(&self, user_id: usize) -> PixivRequestBuilder<'_>

Used to build a request to retrive a user’s feed.

§Request Transforms
  • show_r18 (default: true)
Source

pub fn user_following(&self, user_id: usize) -> PixivRequestBuilder<'_>

Used to build a request to retrieve users a user follows.

§Request Transforms
  • page (default: 1)
  • per_page (default: 30)
  • max_id
Source

pub fn ranking(&self, ranking_type: RankingType) -> PixivRequestBuilder<'_>

Used to build a request to retrieve a list of ranking posts.

§Request Transforms
  • ranking_mode (default: RankingMode::Daily)
  • page (default: 1)
  • per_page (default: 50)
  • include_stats (default: true)
  • include_sanity_level (default: true)
  • image_sizes (default: px_128x128,small,medium,large,px_480mw)
  • profile_image_sizes (default: px_170x170,px_50x50)
Source

pub fn search_works<'a, V>(&'a self, query: V) -> PixivRequestBuilder<'a>
where Cow<'a, str>: From<V>,

Used to build a request to search for posts on a query.

§Request Transforms
  • page (default: 1)
  • per_page (default: 30)
  • date
  • search_mode (default: SearchMode::Text)
  • search_period (default: SearchPeriod::All)
  • search_order (default: desc)
  • search_sort (default: date)
  • search_types (default: illustration,manga,ugoira)
  • include_stats (default: true)
  • include_sanity_level (default: true)
  • image_sizes (default: px_128x128,small,medium,large,px_480mw)
Source

pub fn latest_works(&self) -> PixivRequestBuilder<'_>

Used to build a request to retrieve the latest submitted works by everyone.

§Request Transforms
  • page (default: 1)
  • per_page (default: 50)
  • date
  • include_stats (default: true)
  • include_sanity_level (default: true)
  • image_sizes (default: px_128x128,small,medium,large,px_480mw)
  • profile_image_sizes (default: px_170x170,px_50x50)
Source

pub fn execute(&self, request: PixivRequest) -> Result<Response, Error>

Executes a given PixivRequest.

Trait Implementations§

Source§

impl Clone for Pixiv

Source§

fn clone(&self) -> Pixiv

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Pixiv

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Pixiv

§

impl !RefUnwindSafe for Pixiv

§

impl Send for Pixiv

§

impl Sync for Pixiv

§

impl Unpin for Pixiv

§

impl !UnwindSafe for Pixiv

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Err = <U as TryFrom<T>>::Err

Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Err>

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T