pub struct Client { /* private fields */ }Expand description
A handle on one mdcast-server. Cheap to clone — the underlying
reqwest::Client is a shared connection pool.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn check(&self, bundle: &AssetBundle) -> Result<Vec<Digest>>
pub async fn check(&self, bundle: &AssetBundle) -> Result<Vec<Digest>>
Which of the bundle’s assets the server does not hold yet. An empty
result means a render with this bundle will not stall on a 409.
Never fetches a digest-only entry’s bytes — only its stored digest.
Sourcepub async fn upload(
&self,
bundle: &AssetBundle,
digests: &[Digest],
) -> Result<()>
pub async fn upload( &self, bundle: &AssetBundle, digests: &[Digest], ) -> Result<()>
Upload the named digests from bundle. A digest nothing in the bundle
hashes to is Error::UnknownDigest — the request is never sent
half-formed.
Source§impl Client
impl Client
Sourcepub fn builder(base_url: impl Into<String>) -> ClientBuilder
pub fn builder(base_url: impl Into<String>) -> ClientBuilder
Start building a client for the server at base_url
(http://mdcast.internal:8080, with or without a trailing slash).
Sourcepub async fn render(
&self,
request: RenderMarkdownRequest,
bundle: &AssetBundle,
) -> Result<Artifact>
pub async fn render( &self, request: RenderMarkdownRequest, bundle: &AssetBundle, ) -> Result<Artifact>
Render markdown, negotiating any assets the server is missing.
request.assets is filled from bundle when the caller left it empty,
and verified against it otherwise.
Sourcepub async fn render_template(
&self,
request: RenderTemplateRequest,
bundle: &AssetBundle,
) -> Result<Artifact>
pub async fn render_template( &self, request: RenderTemplateRequest, bundle: &AssetBundle, ) -> Result<Artifact>
Render a typst template over structured data — same negotiation, same single retry.
Sourcepub async fn capabilities(&self) -> Result<CapabilitiesResponse>
pub async fn capabilities(&self) -> Result<CapabilitiesResponse>
What this server can actually render right now — targets, template
formats, and its upload size ceiling. Unauthenticated server-side
(GET /v1/capabilities sits outside the bearer gate), so this is
useful for feature-gating a UI before a render is ever attempted.