Skip to main content

Crate wellfriend

Crate wellfriend 

Source
Expand description

The official async Rust SDK for the Wellfriend document API.

use wellfriend::Wellfriend;

let wf = Wellfriend::new();
wf.tools().compress_pdf("in.pdf", None).await?.save("out.pdf").await?;

§What is in the box

§Configuration

Wellfriend::new reads WELLFRIEND_API_KEY (and optionally WELLFRIEND_BASE_URL) from the environment. Use Wellfriend::builder to set the key, base URL, timeout, retries, wait limit or your own reqwest::Client.

§Cancellation

Every call is a future: dropping it cancels the request. Wrap a call in tokio::time::timeout to bound the whole call, including waiting for an operation.

Re-exports§

pub use generated::events::WebhookEventData;
pub use generated::models::*;
pub use generated::resources::*;
pub use generated::tools::*;

Modules§

generated
Code generated from the API document and the tool catalog.
types
Every model in one place: tool parameters (for example types::CompressPdfParams) and their choice enums, request and response types, the core resources and webhook payloads. The same items are also exported at the crate root.

Structs§

ApiError
An error response from the API.
DefinedWorkflow
A workflow defined from tool steps, reusable like a tool.
Document
A document stored in the workspace.
DocumentVersion
One immutable version of a document.
Download
A file download, streamed from the API. Nothing is buffered until you ask for it.
FileInput
A file to process: a local path, bytes in memory, an async reader, or a document that is already stored.
Operation
A document operation: one tool run on one or more document versions.
OperationFailure
Why an operation or workflow run failed.
OperationOutputs
The outputs of an operation.
Output
One output file of an operation.
Page
One page of a list.
Pipeline
Several tools run one after another on one file.
RequestOptions
Settings for one call, applied with with_options on any resource handle.
Step
One step of a pipeline: a tool and its parameters.
ToolEmbedSession
The fields of a TOOL embed session: one tool workspace in your page, charged like the API.
ToolInput
The input of a tool run: one file, or several for tools that read several (merge-pdf, image-to-pdf).
ToolParameters
Tool parameters as a JSON object. Every generated ...Params struct converts into it; use it directly for options this SDK version does not model yet.
ToolRequest
A tool call with every option: inputs, parameters and named assets.
ToolResult
The result of a finished tool run or pipeline.
ToolUsage
Request units and credits a tool run used, when the API reports them.
Tools
Access to the document tools. Get it with Wellfriend::tools.
VersionRef
A document version reference.
WebhookEvent
A verified webhook event (CloudEvents 1.0).
WebhookEventMeta
The wellfriend extension of every event.
WebhookVerifier
A webhook verifier with one or more secrets and a configurable tolerance.
Webhooks
Webhook helpers on the client. Get it with Wellfriend::webhooks.
Wellfriend
The Wellfriend API client.
WellfriendBuilder
Builds a Wellfriend client.
Workflow
A workflow definition.
WorkflowRun
One run of a workflow.
WorkflowStep
One step of a workflow run.

Enums§

Asset
A named asset file a tool reads (a watermark image, a signature image, a certificate).
Error
Every error this SDK returns.
OperationState
The state of a document operation.
OutputKind
Where an operation’s output went.
RunState
The state of a workflow run or step.
UploadCompletion
The answer to completing a resumable upload.
Value
Re-exported so callers can match on JSON values without adding serde_json themselves. Represents any valid JSON value.
WorkflowStatus
The status of a workflow definition.

Constants§

CHECKSUM_REQUIRED_ABOVE_BYTES
Above this size (50 MiB) a resumable upload must declare the file’s SHA-256.
DEFAULT_BASE_URL
The API base URL used when neither the builder nor WELLFRIEND_BASE_URL sets one.
MAX_PIPELINE_STEPS
The most steps one pipeline may have.
SINGLE_REQUEST_MAX_BYTES
The largest body one upload request may carry (100 MiB). Larger files use the resumable flow.
VERSION
This crate’s version, sent in the User-Agent header.
WEBHOOK_TOLERANCE
How far a delivery’s timestamp may be from now (5 minutes).

Traits§

WebhookHeaders
Request headers, from any HTTP framework.

Functions§

verify_webhook
Verifies a webhook delivery and returns the typed event.

Type Aliases§

Object
A JSON object, used where the API document does not describe a response in detail.
PageStream
Every item of a list, fetching the following pages as you consume it.
Result
The result type of every fallible call in this crate.