bookclerk_plugin_source_libro::guest
Guest-process helpers for the external Libro.fm source plugin.
These APIs do not open the library DB — the host seals credentials and
upserts scan rows via bookclerk_plugin_host::ExternalSource. Conversions
between storefront types and the typed ABI live in bookclerk_storefront::abi.
| Item | Kind | Summary |
|---|---|---|
guest_login |
function | Login against Libro.fm and return account metadata + credential JSON. |
guest_login_rpc |
function | RPC login: build LoginOptions from typed params and return the ABI result. |
guest_scan_page |
function | RPC scan: one page of one account's full pass (the host upserts books). |
guest_fetch_title |
function | Download one title into cache_dir using host-injected credentials. |
guest_fetch_title_rpc |
function | RPC fetch: return the typed plain fetch result. |
resolve_base_url |
function | Resolve API base URL (tests may override). |
resolve_container |
function | Resolve download container from the plugin settings document. |
source_id |
function | Source id returned in describe(); must match crate::source::ID. |
pub async fn guest_login(
base_url: &str,
opts: LoginOptions,
) -> Result<(String, String, Option<String>, bool, Value)>
Login against Libro.fm and return account metadata + credential JSON.
Does not write to encrypted_secrets — the host seals credentials.
Returns an error when the operation fails.
pub async fn guest_login_rpc(base_url: &str, params: LoginParams) -> Result<LoginResult>
RPC login: build LoginOptions from typed params and return the ABI result.
Returns an error when the operation fails.
pub async fn guest_scan_page(
base_url: &str,
params: &ScanParams,
scan_state: Option<&DatabaseBinding>,
) -> Result<ScanPage, PluginError>
RPC scan: one page of one account's full pass (the host upserts books).
Libro.fm has no delta API, so every pass fetches the whole library. With
the SCAN_STATE database, ScanDelta sends the host only titles that
are new or changed since the last pass, and the product ids that
disappeared; without it every pass is full and ends complete. The SDK's
scan_page helper pages the store's numbered library pages into scan
replies.
base_url- Libro.fm API base URL.params- The pass's account, credential, cursor and sync token.scan_state- TheSCAN_STATEdatabase, when granted.
Returns invalid_cursor for a cursor or sync token this plugin cannot
use, the database's error when scan state cannot be kept, and
internal when the credential is missing or invalid or the page request
fails.
pub async fn guest_fetch_title(
base_url: &str,
credentials: &Value,
title_id: &str,
cache_dir: &Path,
container: LibroContainer,
) -> Result<PlainFetch>
Download one title into cache_dir using host-injected credentials.
Returns an error when the operation fails.
pub async fn guest_fetch_title_rpc(
base_url: &str,
params: &FetchTitleParams,
container: LibroContainer,
) -> Result<PlainFetch>
RPC fetch: return the typed plain fetch result.
Returns an error when the operation fails.
pub fn resolve_base_url(source_config: &Value) -> String
Resolve API base URL (tests may override).
pub fn resolve_container(source_config: &Value) -> LibroContainer
Resolve download container from the plugin settings document.
pub fn source_id() -> &'static str
Source id returned in describe(); must match crate::source::ID.
Generated from crates/bookclerk-plugins/optional/source-libro at main · View as Markdown