Skip to main content

FichubClient

Struct FichubClient 

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

A client for the FicHub REST API.

Implementations§

Source§

impl FichubClient

Source

pub fn new(config: Arc<BotConfig>) -> Result<Self>

Build a new client from a config.

Source

pub fn with_client(config: Arc<BotConfig>, http: Client) -> Self

Build a client with a custom reqwest::Client (used in tests with a mock).

Source

pub fn http(&self) -> &Client

Access the underlying reqwest::Client (shared with intent/LLM callers).

Source

pub async fn fetch_export(&self, url: &str) -> Result<ExportResponse>

GET /api/epub?q=<url> — export metadata + download URLs.

Source

pub async fn lazy_convert( &self, url: &str, format: &str, ) -> Result<ConvertResponse>

GET /api/epub/convert?q=<url>&format=mobi|pdf|azw3 — lazy conversion.

Source

pub async fn fetch_meta(&self, url: &str) -> Result<ExportResponse>

GET /api/meta?q=<url> — metadata only (no download URLs).

Source

pub async fn recommendations( &self, url: &str, n: i32, ) -> Result<RecommendationsResponse>

GET /api/recommendations?q=&n= — similar works to a seed URL.

Source

pub async fn personal_recommendations( &self, token: &str, ) -> Result<PersonalRecommendationsResponse>

GET /api/recommendations/personal — personalized recs (auth).

Source

pub async fn strategies(&self) -> Result<Value>

GET /api/recommendations/strategies — list available strategies.

Source

pub async fn search(&self, params: &SearchParams) -> Result<SearchResponse>

GET /api/search?q=&page=&per_page= — advanced search.

Source

pub async fn ask(&self, q: &str) -> Result<AskResponse>

POST /api/search/ask — LLM-assisted natural-language search.

GET /api/search/body?q=&page=&per_page= — full-text body search.

Source

pub async fn feed(&self, token: &str, page: i64) -> Result<FeedResponse>

GET /api/v1/feed?page= — new chapters from followed works (auth).

Source

pub async fn add_bookmark(&self, token: &str, url_id: &str) -> Result<Value>

POST /api/bookmarks — bookmark a fic (auth).

Source

pub async fn remove_bookmark(&self, token: &str, work_id: i64) -> Result<Value>

DELETE /api/bookmarks/{work_id} — remove a bookmark (auth).

Source

pub async fn rate(&self, token: &str, url_id: &str, stars: i32) -> Result<Value>

POST /api/ratings — rate a fic (auth).

Source

pub async fn add_block(&self, token: &str, url_id: &str) -> Result<Value>

POST /api/blocks — block/hide a fic from recommendations (auth).

Source

pub async fn remove_block(&self, token: &str, url_id: &str) -> Result<Value>

DELETE /api/blocks/{url_id} — unblock a fic (auth).

Source

pub async fn kudos(&self, work_id: i64) -> Result<Value>

GET /api/kudos/{work_id} — kudos counts for a work.

Source

pub async fn list_requests( &self, status: &str, page: i64, ) -> Result<RequestsResponse>

GET /api/requests?status=&page= — list requests.

Source

pub async fn create_request( &self, token: &str, title: &str, body: &str, ) -> Result<Value>

POST /api/requests — create a request (auth).

Source

pub async fn consensus(&self) -> Result<ConsensusResponse>

GET /api/roadmap/consensus — public leaderboard + controversy.

Source

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

POST /api/auth/login — exchange username/password for a JWT.

Source

pub async fn me(&self, token: &str) -> Result<MeResponse>

GET /api/auth/me — verify a token, get the current user.

Source

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.

Source

pub async fn forum_categories( &self, token: &str, ) -> Result<ForumCategoriesResponse>

GET /api/forum/categories — visible categories + topic counts (auth).

Source

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.

Source

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).

Source

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).

Source

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).

Source

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).

Source

pub async fn forum_follow( &self, token: &str, topic_id: i64, ) -> Result<ForumFollowState>

POST /api/forum/topics/{id}/follow — toggle follow (auth).

Source

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).

Source

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.

GET /api/forum/search?q=&category= — FTS over topics + posts (auth).

Source

pub async fn forum_moderation_status( &self, token: &str, ) -> Result<ForumModerationStatus>

GET /api/forum/moderation/status — my points + eligibility (auth).

Source

pub async fn forum_moderation_queue( &self, token: &str, ) -> Result<ForumModerationQueue>

GET /api/forum/moderation/queue — posts needing moderation (auth).

Source

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).

Source

pub async fn forum_metamod_queue( &self, token: &str, ) -> Result<ForumMetamodQueue>

GET /api/forum/metamod/queue — anonymized actions to rate (auth).

Source

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

Source§

fn clone(&self) -> FichubClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for FichubClient

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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