pub struct AppClient { /* private fields */ }Expand description
App API client for interacting with Pixiv App API
Implementations§
Source§impl AppClient
impl AppClient
Sourcepub fn new(http_client: HttpClient) -> Self
pub fn new(http_client: HttpClient) -> Self
Create new App API client instance
Sourcepub fn set_base_url(&mut self, url: String)
pub fn set_base_url(&mut self, url: String)
Set API base URL
Sourcepub async fn illust_detail(&self, illust_id: u64) -> Result<IllustDetail>
pub async fn illust_detail(&self, illust_id: u64) -> Result<IllustDetail>
Sourcepub async fn illust_ranking(
&self,
mode: RankingMode,
filter: Filter,
date: Option<&str>,
offset: Option<u32>,
) -> Result<RankingResponse>
pub async fn illust_ranking( &self, mode: RankingMode, filter: Filter, date: Option<&str>, offset: Option<u32>, ) -> Result<RankingResponse>
Get illustration ranking
§Arguments
mode- Ranking modefilter- Filterdate- 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?;Sourcepub async fn illust_recommended(
&self,
content_type: ContentType,
include_ranking_label: bool,
filter: Filter,
max_bookmark_id_for_recommend: Option<u64>,
min_bookmark_id_for_recent_illust: Option<u64>,
offset: Option<u32>,
include_ranking_illusts: Option<bool>,
bookmark_illust_ids: Option<Vec<u64>>,
viewed: Option<Vec<String>>,
) -> Result<RecommendedResponse>
pub async fn illust_recommended( &self, content_type: ContentType, include_ranking_label: bool, filter: Filter, max_bookmark_id_for_recommend: Option<u64>, min_bookmark_id_for_recent_illust: Option<u64>, offset: Option<u32>, include_ranking_illusts: Option<bool>, bookmark_illust_ids: Option<Vec<u64>>, viewed: Option<Vec<String>>, ) -> Result<RecommendedResponse>
Get recommended illustrations
§Arguments
content_type- Content typeinclude_ranking_label- Whether to include ranking labelfilter- Filtermax_bookmark_id_for_recommend- Maximum bookmark ID for recommendationmin_bookmark_id_for_recent_illust- Minimum bookmark ID for recent illustrationsoffset- Offsetinclude_ranking_illusts- Whether to include ranking illustrationsbookmark_illust_ids- List of bookmarked illustration IDsviewed- 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?;Sourcepub 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>
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 keywordsearch_target- Search targetsort- Sort methodduration- Search durationstart_date- Start date (format: YYYY-MM-DD)end_date- End date (format: YYYY-MM-DD)filter- Filtersearch_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?;Sourcepub async fn illust_follow(
&self,
restrict: FollowRestrict,
offset: Option<u32>,
) -> Result<IllustFollowResponse>
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?;Sourcepub async fn illust_comments(
&self,
illust_id: u64,
offset: Option<u32>,
include_total_comments: Option<bool>,
) -> Result<CommentsResponse>
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 IDoffset- Offsetinclude_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?;Sourcepub async fn user_following(
&self,
user_id: u64,
restrict: FollowRestrict,
offset: Option<u32>,
) -> Result<UserFollowingResponse>
pub async fn user_following( &self, user_id: u64, restrict: FollowRestrict, offset: Option<u32>, ) -> Result<UserFollowingResponse>
Sourcepub async fn user_follower(
&self,
user_id: u64,
filter: Filter,
offset: Option<u32>,
) -> Result<UserFollowerResponse>
pub async fn user_follower( &self, user_id: u64, filter: Filter, offset: Option<u32>, ) -> Result<UserFollowerResponse>
Sourcepub async fn user_mypixiv(
&self,
user_id: u64,
offset: Option<u32>,
) -> Result<UserMypixivResponse>
pub async fn user_mypixiv( &self, user_id: u64, offset: Option<u32>, ) -> Result<UserMypixivResponse>
Sourcepub async fn illust_bookmark_add(
&self,
illust_id: u64,
restrict: FollowRestrict,
tags: Option<Vec<String>>,
) -> Result<IllustBookmarkResponse>
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 IDrestrict- 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?;Sourcepub async fn illust_bookmark_delete(
&self,
illust_id: u64,
) -> Result<IllustBookmarkResponse>
pub async fn illust_bookmark_delete( &self, illust_id: u64, ) -> Result<IllustBookmarkResponse>
Sourcepub async fn ugoira_metadata(
&self,
illust_id: u64,
) -> Result<UgoiraMetadataResponse>
pub async fn ugoira_metadata( &self, illust_id: u64, ) -> Result<UgoiraMetadataResponse>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppClient
impl !RefUnwindSafe for AppClient
impl Send for AppClient
impl Sync for AppClient
impl Unpin for AppClient
impl !UnwindSafe for AppClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more