peasy-document 0.2.0

Rust client for PeasyDocument — document format tools, glossary, and guides API
Documentation

peasy-document

crates.io docs.rs License: MIT

Async Rust client for the PeasyFormats API — convert between Markdown, HTML, CSV, JSON, and YAML document formats. Built with reqwest, serde, and tokio.

Built from PeasyFormats, a free online document conversion toolkit with tools for converting, formatting, and validating Markdown, HTML, CSV, JSON, and YAML files.

Try the interactive tools at peasyformats.comDocument Tools, Document Glossary, Document Guides

Install

[dependencies]
peasy-document = "0.2.0"
tokio = { version = "1", features = ["full"] }

Or via cargo:

cargo add peasy-document

Quick Start

use peasy_document::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    // List available document tools
    let tools = client.list_tools(&Default::default()).await?;
    for tool in &tools.results {
        println!("{}: {}", tool.name, tool.description);
    }

    Ok(())
}

API Client

The client wraps the PeasyFormats REST API with strongly-typed Rust structs using serde deserialization.

use peasy_document::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    // Or with a custom base URL:
    // let client = Client::with_base_url("https://custom.example.com");

    // List tools with filters
    let opts = peasy_document::ListOptions {
        page: Some(1),
        limit: Some(10),
        search: Some("markdown".into()),
        ..Default::default()
    };
    let tools = client.list_tools(&opts).await?;

    // Get a specific tool
    let tool = client.get_tool("markdown-to-html").await?;
    println!("{}: {}", tool.name, tool.description);

    // Search across all content
    let results = client.search("markdown", Some(20)).await?;
    println!("Found {} tools", results.results.tools.len());

    // Browse the glossary
    let glossary = client.list_glossary(&peasy_document::ListOptions {
        search: Some("csv".into()),
        ..Default::default()
    }).await?;
    for term in &glossary.results {
        println!("{}: {}", term.term, term.definition);
    }

    // Discover guides
    let guides = client.list_guides(&peasy_document::ListGuidesOptions {
        category: Some("document".into()),
        ..Default::default()
    }).await?;
    for guide in &guides.results {
        println!("{} ({})", guide.title, guide.audience_level);
    }

    // List format conversions
    let conversions = client.list_conversions(&peasy_document::ListConversionsOptions {
        source: Some("json".into()),
        ..Default::default()
    }).await?;

    Ok(())
}

Available Methods

Method Description
list_tools(&opts) List tools (paginated, filterable)
get_tool(slug) Get tool by slug
list_categories(&opts) List tool categories
list_formats(&opts) List file formats
get_format(slug) Get format by slug
list_conversions(&opts) List format conversions
list_glossary(&opts) List glossary terms
get_glossary_term(slug) Get glossary term
list_guides(&opts) List guides
get_guide(slug) Get guide by slug
list_use_cases(&opts) List use cases
search(query, limit) Search across all content
list_sites() List Peasy sites
openapi_spec() Get OpenAPI specification

Full API documentation at peasyformats.com/developers/. OpenAPI 3.1.0 spec: peasyformats.com/api/openapi.json.

Learn More

Also Available

Language Package Install
Python peasy-document pip install "peasy-document[all]"
TypeScript peasy-document npm install peasy-document
Go peasy-document-go go get github.com/peasytools/peasy-document-go
Ruby peasy-document gem install peasy-document

Peasy Developer Tools

Part of the Peasy Tools open-source developer ecosystem.

Package PyPI npm crates.io Description
peasy-pdf PyPI npm crate PDF merge, split, rotate, compress — peasypdf.com
peasy-image PyPI npm crate Image resize, crop, convert, compress — peasyimage.com
peasy-audio PyPI npm crate Audio trim, merge, convert, normalize — peasyaudio.com
peasy-video PyPI npm crate Video trim, resize, thumbnails, GIF — peasyvideo.com
peasy-css PyPI npm crate CSS minify, format, analyze — peasycss.com
peasy-compress PyPI npm crate ZIP, TAR, gzip compression — peasytools.com
peasy-document PyPI npm crate Markdown, HTML, CSV, JSON conversion — peasyformats.com
peasytext PyPI npm crate Text case conversion, slugify, word count — peasytext.com

License

MIT