pub struct FichubClient { /* private fields */ }Expand description
A client for the FicHub REST API.
Implementations§
Source§impl FichubClient
impl FichubClient
Sourcepub fn with_client(config: Arc<BotConfig>, http: Client) -> Self
pub fn with_client(config: Arc<BotConfig>, http: Client) -> Self
Build a client with a custom reqwest::Client (used in tests with a mock).
Sourcepub fn http(&self) -> &Client
pub fn http(&self) -> &Client
Access the underlying reqwest::Client (shared with intent/LLM callers).
Sourcepub async fn fetch_export(&self, url: &str) -> Result<ExportResponse>
pub async fn fetch_export(&self, url: &str) -> Result<ExportResponse>
GET /api/epub?q=<url> — export metadata + download URLs.
Sourcepub async fn lazy_convert(
&self,
url: &str,
format: &str,
) -> Result<ConvertResponse>
pub async fn lazy_convert( &self, url: &str, format: &str, ) -> Result<ConvertResponse>
GET /api/epub/convert?q=<url>&format=mobi|pdf|azw3 — lazy conversion.
Sourcepub async fn fetch_meta(&self, url: &str) -> Result<ExportResponse>
pub async fn fetch_meta(&self, url: &str) -> Result<ExportResponse>
GET /api/meta?q=<url> — metadata only (no download URLs).
Sourcepub async fn recommendations(
&self,
url: &str,
n: i32,
) -> Result<RecommendationsResponse>
pub async fn recommendations( &self, url: &str, n: i32, ) -> Result<RecommendationsResponse>
GET /api/recommendations?q=&n= — similar works to a seed URL.
Sourcepub async fn personal_recommendations(
&self,
token: &str,
) -> Result<PersonalRecommendationsResponse>
pub async fn personal_recommendations( &self, token: &str, ) -> Result<PersonalRecommendationsResponse>
GET /api/recommendations/personal — personalized recs (auth).
Sourcepub async fn strategies(&self) -> Result<Value>
pub async fn strategies(&self) -> Result<Value>
GET /api/recommendations/strategies — list available strategies.
Sourcepub async fn search(&self, params: &SearchParams) -> Result<SearchResponse>
pub async fn search(&self, params: &SearchParams) -> Result<SearchResponse>
GET /api/search?q=&page=&per_page= — advanced search.
Sourcepub async fn ask(&self, q: &str) -> Result<AskResponse>
pub async fn ask(&self, q: &str) -> Result<AskResponse>
POST /api/search/ask — LLM-assisted natural-language search.
Sourcepub async fn body_search(
&self,
q: &str,
page: usize,
per_page: usize,
) -> Result<BodySearchResponse>
pub async fn body_search( &self, q: &str, page: usize, per_page: usize, ) -> Result<BodySearchResponse>
GET /api/search/body?q=&page=&per_page= — full-text body search.
Sourcepub async fn feed(&self, token: &str, page: i64) -> Result<FeedResponse>
pub async fn feed(&self, token: &str, page: i64) -> Result<FeedResponse>
GET /api/v1/feed?page= — new chapters from followed works (auth).
Sourcepub async fn add_bookmark(&self, token: &str, url_id: &str) -> Result<Value>
pub async fn add_bookmark(&self, token: &str, url_id: &str) -> Result<Value>
POST /api/bookmarks — bookmark a fic (auth).
Sourcepub async fn remove_bookmark(&self, token: &str, work_id: i64) -> Result<Value>
pub async fn remove_bookmark(&self, token: &str, work_id: i64) -> Result<Value>
DELETE /api/bookmarks/{work_id} — remove a bookmark (auth).
Sourcepub async fn rate(&self, token: &str, url_id: &str, stars: i32) -> Result<Value>
pub async fn rate(&self, token: &str, url_id: &str, stars: i32) -> Result<Value>
POST /api/ratings — rate a fic (auth).
Sourcepub async fn add_block(&self, token: &str, url_id: &str) -> Result<Value>
pub async fn add_block(&self, token: &str, url_id: &str) -> Result<Value>
POST /api/blocks — block/hide a fic from recommendations (auth).
Sourcepub async fn remove_block(&self, token: &str, url_id: &str) -> Result<Value>
pub async fn remove_block(&self, token: &str, url_id: &str) -> Result<Value>
DELETE /api/blocks/{url_id} — unblock a fic (auth).
Sourcepub async fn kudos(&self, work_id: i64) -> Result<Value>
pub async fn kudos(&self, work_id: i64) -> Result<Value>
GET /api/kudos/{work_id} — kudos counts for a work.
Sourcepub async fn list_requests(
&self,
status: &str,
page: i64,
) -> Result<RequestsResponse>
pub async fn list_requests( &self, status: &str, page: i64, ) -> Result<RequestsResponse>
GET /api/requests?status=&page= — list requests.
Sourcepub async fn create_request(
&self,
token: &str,
title: &str,
body: &str,
) -> Result<Value>
pub async fn create_request( &self, token: &str, title: &str, body: &str, ) -> Result<Value>
POST /api/requests — create a request (auth).
Sourcepub async fn consensus(&self) -> Result<ConsensusResponse>
pub async fn consensus(&self) -> Result<ConsensusResponse>
GET /api/roadmap/consensus — public leaderboard + controversy.
Sourcepub async fn login(
&self,
username: &str,
password: &str,
) -> Result<AuthResponse>
pub async fn login( &self, username: &str, password: &str, ) -> Result<AuthResponse>
POST /api/auth/login — exchange username/password for a JWT.
Sourcepub async fn me(&self, token: &str) -> Result<MeResponse>
pub async fn me(&self, token: &str) -> Result<MeResponse>
GET /api/auth/me — verify a token, get the current user.
Sourcepub async fn docs_ask(&self, q: &str, n: usize) -> Result<Vec<Value>>
pub async fn docs_ask(&self, q: &str, n: usize) -> Result<Vec<Value>>
GET /api/docs/ask?q=...&n=... — Ask-the-Docs RAG (grounded help).
Returns the top matching doc sections (with anchors) as JSON values.
Sourcepub async fn forum_categories(
&self,
token: &str,
) -> Result<ForumCategoriesResponse>
pub async fn forum_categories( &self, token: &str, ) -> Result<ForumCategoriesResponse>
GET /api/forum/categories — visible categories + topic counts (auth).
Sourcepub async fn forum_topics(
&self,
token: &str,
category: Option<&str>,
cursor: Option<i64>,
limit: u32,
) -> Result<ForumTopicList>
pub async fn forum_topics( &self, token: &str, category: Option<&str>, cursor: Option<i64>, limit: u32, ) -> Result<ForumTopicList>
GET /api/forum/topics?category=&cursor=&limit= — cursor-paginated
topic list for a category (auth). cursor is the last topic id seen
(from next_cursor); omit for the first page.
Sourcepub async fn forum_topic(
&self,
token: &str,
topic_id: i64,
after: Option<i64>,
) -> Result<ForumTopicDetail>
pub async fn forum_topic( &self, token: &str, topic_id: i64, after: Option<i64>, ) -> Result<ForumTopicDetail>
GET /api/forum/topics/{id}?after= — topic detail + posts (auth).
after is the last post id seen (from next_cursor); omit for the
first page (OP + newest posts, default limit 25).
Sourcepub async fn forum_topic_by_slug(
&self,
token: &str,
slug: &str,
) -> Result<ForumTopicDetail>
pub async fn forum_topic_by_slug( &self, token: &str, slug: &str, ) -> Result<ForumTopicDetail>
GET /api/forum/topics/by-slug/{slug} — topic detail resolved by the
canonical slug (same shape as forum_topic, auth).
Sourcepub async fn forum_create_topic(
&self,
token: &str,
title: &str,
category_slug: &str,
body: &str,
payload: Option<Value>,
) -> Result<ForumCreateTopicResponse>
pub async fn forum_create_topic( &self, token: &str, title: &str, category_slug: &str, body: &str, payload: Option<Value>, ) -> Result<ForumCreateTopicResponse>
POST /api/forum/topics — create a topic + OP post (auth).
Sourcepub async fn forum_reply(
&self,
token: &str,
topic_id: i64,
body: &str,
quote_of: Option<i64>,
) -> Result<ForumPostCreated>
pub async fn forum_reply( &self, token: &str, topic_id: i64, body: &str, quote_of: Option<i64>, ) -> Result<ForumPostCreated>
POST /api/forum/topics/{id}/posts — reply to a topic (auth).
Sourcepub async fn forum_follow(
&self,
token: &str,
topic_id: i64,
) -> Result<ForumFollowState>
pub async fn forum_follow( &self, token: &str, topic_id: i64, ) -> Result<ForumFollowState>
POST /api/forum/topics/{id}/follow — toggle follow (auth).
Sourcepub async fn forum_follow_state(
&self,
token: &str,
topic_id: i64,
) -> Result<ForumFollowState>
pub async fn forum_follow_state( &self, token: &str, topic_id: i64, ) -> Result<ForumFollowState>
GET /api/forum/topics/{id}/follow — my follow state + follower count (auth).
Sourcepub async fn forum_mark_read(
&self,
token: &str,
topic_id: i64,
last_read_post_id: Option<i64>,
) -> Result<ForumMarkRead>
pub async fn forum_mark_read( &self, token: &str, topic_id: i64, last_read_post_id: Option<i64>, ) -> Result<ForumMarkRead>
POST /api/forum/topics/{id}/read — mark a topic read (auth).
last_read_post_id defaults to the topic’s newest post when None.
Sourcepub async fn forum_search(
&self,
token: &str,
q: &str,
category: Option<&str>,
) -> Result<ForumSearchResponse>
pub async fn forum_search( &self, token: &str, q: &str, category: Option<&str>, ) -> Result<ForumSearchResponse>
GET /api/forum/search?q=&category= — FTS over topics + posts (auth).
Sourcepub async fn forum_moderation_status(
&self,
token: &str,
) -> Result<ForumModerationStatus>
pub async fn forum_moderation_status( &self, token: &str, ) -> Result<ForumModerationStatus>
GET /api/forum/moderation/status — my points + eligibility (auth).
Sourcepub async fn forum_moderation_queue(
&self,
token: &str,
) -> Result<ForumModerationQueue>
pub async fn forum_moderation_queue( &self, token: &str, ) -> Result<ForumModerationQueue>
GET /api/forum/moderation/queue — posts needing moderation (auth).
Sourcepub async fn forum_moderate(
&self,
token: &str,
post_id: i64,
reason: &str,
) -> Result<ForumModerateResponse>
pub async fn forum_moderate( &self, token: &str, post_id: i64, reason: &str, ) -> Result<ForumModerateResponse>
POST /api/forum/posts/{id}/moderate — spend 1 point on a post (auth).
Sourcepub async fn forum_metamod_queue(
&self,
token: &str,
) -> Result<ForumMetamodQueue>
pub async fn forum_metamod_queue( &self, token: &str, ) -> Result<ForumMetamodQueue>
GET /api/forum/metamod/queue — anonymized actions to rate (auth).
Sourcepub async fn forum_metamod_vote(
&self,
token: &str,
action_id: i64,
verdict: &str,
) -> Result<ForumMetamodVoteResponse>
pub async fn forum_metamod_vote( &self, token: &str, action_id: i64, verdict: &str, ) -> Result<ForumMetamodVoteResponse>
POST /api/forum/metamod/{action_id}/vote — rate a mod action (auth).
verdict is one of fair | unfair | unsure.
Trait Implementations§
Source§impl Clone for FichubClient
impl Clone for FichubClient
Source§fn clone(&self) -> FichubClient
fn clone(&self) -> FichubClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for FichubClient
impl !UnwindSafe for FichubClient
impl Freeze for FichubClient
impl Send for FichubClient
impl Sync for FichubClient
impl Unpin for FichubClient
impl UnsafeUnpin for FichubClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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