AppClient

Struct AppClient 

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

App API client for interacting with Pixiv App API

Implementations§

Source§

impl AppClient

Source

pub fn new(http_client: HttpClient) -> Self

Create new App API client instance

Source

pub fn set_base_url(&mut self, url: String)

Set API base URL

Source

pub fn base_url(&self) -> &str

Get API base URL

Source

pub async fn illust_detail(&self, illust_id: u64) -> Result<IllustDetail>

Get illustration details

§Arguments
  • illust_id - Illustration ID
§Returns

Returns illustration detail information

§Example
let client = AppClient::new(http_client);
let detail = client.illust_detail(12345678).await?;
Source

pub async fn illust_ranking( &self, mode: RankingMode, filter: Filter, date: Option<&str>, offset: Option<u32>, ) -> Result<RankingResponse>

Get illustration ranking

§Arguments
  • mode - Ranking mode
  • filter - Filter
  • date - Date (format: YYYY-MM-DD)
  • offset - Offset
§Returns

Returns ranking response

§Example
let client = AppClient::new(http_client);
let ranking = client.illust_ranking(
    RankingMode::Day,
    Filter::ForIOS,
    Some("2023-01-01"),
    Some(0)
).await?;

Get recommended illustrations

§Arguments
  • content_type - Content type
  • include_ranking_label - Whether to include ranking label
  • filter - Filter
  • max_bookmark_id_for_recommend - Maximum bookmark ID for recommendation
  • min_bookmark_id_for_recent_illust - Minimum bookmark ID for recent illustrations
  • offset - Offset
  • include_ranking_illusts - Whether to include ranking illustrations
  • bookmark_illust_ids - List of bookmarked illustration IDs
  • viewed - List of viewed illustration IDs
§Returns

Returns recommendation response

§Example
let client = AppClient::new(http_client);
let recommended = client.illust_recommended(
    ContentType::Illust,
    true,
    Filter::ForIOS,
    None,
    None,
    None,
    None,
    None,
    None
).await?;
Source

pub async fn search_illust( &self, word: &str, search_target: SearchTarget, sort: Sort, duration: Option<Duration>, start_date: Option<&str>, end_date: Option<&str>, filter: Filter, search_ai_type: Option<u32>, offset: Option<u32>, ) -> Result<SearchIllustResponse>

Search illustrations

§Arguments
  • word - Search keyword
  • search_target - Search target
  • sort - Sort method
  • duration - Search duration
  • start_date - Start date (format: YYYY-MM-DD)
  • end_date - End date (format: YYYY-MM-DD)
  • filter - Filter
  • search_ai_type - AI type (0: Filter AI-generated works, 1: Show AI-generated works)
  • offset - Offset
§Returns

Returns search response

§Example
let client = AppClient::new(http_client);
let search_result = client.search_illust(
    "original",
    SearchTarget::PartialMatchForTags,
    Sort::DateDesc,
    None,
    None,
    None,
    Filter::ForIOS,
    None,
    None
).await?;
Source

pub async fn illust_follow( &self, restrict: FollowRestrict, offset: Option<u32>, ) -> Result<IllustFollowResponse>

Get illustrations from followed users

§Arguments
  • restrict - Follow restriction (public/private)
  • offset - Offset
§Returns

Returns response with illustrations from followed users

§Example
let client = AppClient::new(http_client);
let follow_illusts = client.illust_follow(
    FollowRestrict::Public,
    Some(0)
).await?;
Source

pub async fn illust_comments( &self, illust_id: u64, offset: Option<u32>, include_total_comments: Option<bool>, ) -> Result<CommentsResponse>

Get illustration comments

§Arguments
  • illust_id - Illustration ID
  • offset - Offset
  • include_total_comments - Whether to include total comment count
§Returns

Returns comment response

§Example
let client = AppClient::new(http_client);
let comments = client.illust_comments(
    12345678,
    Some(0),
    Some(true)
).await?;
Source

pub async fn user_following( &self, user_id: u64, restrict: FollowRestrict, offset: Option<u32>, ) -> Result<UserFollowingResponse>

Get user following list

§Arguments
  • user_id - User ID
  • restrict - Follow restriction (public/private)
  • offset - Offset
§Returns

Returns user following response

§Example
let client = AppClient::new(http_client);
let following = client.user_following(
    12345678,
    FollowRestrict::Public,
    Some(0)
).await?;
Source

pub async fn user_follower( &self, user_id: u64, filter: Filter, offset: Option<u32>, ) -> Result<UserFollowerResponse>

Get user followers list

§Arguments
  • user_id - User ID
  • filter - Filter
  • offset - Offset
§Returns

Returns user followers response

§Example
let client = AppClient::new(http_client);
let followers = client.user_follower(
    12345678,
    Filter::ForIOS,
    Some(0)
).await?;
Source

pub async fn user_mypixiv( &self, user_id: u64, offset: Option<u32>, ) -> Result<UserMypixivResponse>

Get user mypixiv list

§Arguments
  • user_id - User ID
  • offset - Offset
§Returns

Returns user mypixiv response

§Example
let client = AppClient::new(http_client);
let mypixiv = client.user_mypixiv(
    12345678,
    Some(0)
).await?;
Source

pub async fn illust_bookmark_add( &self, illust_id: u64, restrict: FollowRestrict, tags: Option<Vec<String>>, ) -> Result<IllustBookmarkResponse>

Add illustration bookmark

§Arguments
  • illust_id - Illustration ID
  • restrict - Bookmark restriction (public/private)
  • tags - Tag list
§Returns

Returns bookmark response

§Example
let client = AppClient::new(http_client);
let result = client.illust_bookmark_add(
    12345678,
    FollowRestrict::Public,
    Some(vec!["tag1".to_string(), "tag2".to_string()])
).await?;
Source

pub async fn illust_bookmark_delete( &self, illust_id: u64, ) -> Result<IllustBookmarkResponse>

Delete illustration bookmark

§Arguments
  • illust_id - Illustration ID
§Returns

Returns bookmark response

§Example
let client = AppClient::new(http_client);
let result = client.illust_bookmark_delete(12345678).await?;
Source

pub async fn trending_tags_illust( &self, filter: Filter, ) -> Result<TrendingTagsResponse>

Get trending tags

§Arguments
  • filter - Filter
§Returns

Returns trending tags response

§Example
let client = AppClient::new(http_client);
let trending = client.trending_tags_illust(Filter::ForIOS).await?;
Source

pub async fn ugoira_metadata( &self, illust_id: u64, ) -> Result<UgoiraMetadataResponse>

Get Ugoira metadata

§Arguments
  • illust_id - Illustration ID
§Returns

Returns Ugoira metadata response

§Example
let client = AppClient::new(http_client);
let metadata = client.ugoira_metadata(12345678).await?;

Trait Implementations§

Source§

impl Clone for AppClient

Source§

fn clone(&self) -> AppClient

Returns a duplicate 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 AppClient

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more