widetorah 0.1.0

Rust SDK for WideTorah -- Tanakh, Talmud, Mishnah, Rashi commentary, parashot, and Jewish encyclopedia via the widetorah.com API.
Documentation
# widetorah

[![crates.io](https://img.shields.io/crates/v/widetorah)](https://crates.io/crates/widetorah)
[![docs.rs](https://docs.rs/widetorah/badge.svg)](https://docs.rs/widetorah)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

Async Rust SDK for the [WideTorah](https://widetorah.com) API. Access all 24 books of the Tanakh, 54 weekly parashot, Talmud tractates and daf pages, Mishnah chapters, Rashi commentary, Jewish holidays, biblical figures, topics, and Hebrew/Aramaic glossary terms.

Built on [widetorah.com](https://widetorah.com) -- a comprehensive Jewish scripture encyclopedia covering Torah, Nevi'im, Ketuvim, Talmud Bavli (63 tractates across 6 sedarim), and rabbinic commentary for scholars and developers.

## Install

```toml
[dependencies]
widetorah = "0.1"
tokio = { version = "1", features = ["full"] }
```

Or via the command line:

```bash
cargo add widetorah tokio --features tokio/full
```

## Quick Start

```rust
use widetorah::Client;

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

    // List all 24 books of the Tanakh
    let books = client.list_books().await?;
    println!("Total books: {:?}", books.count);

    // Get Genesis 1:1 in JPS-1917 translation
    let verse = client.get_verse("genesis", 1, 1, "jps-1917").await?;
    for v in &verse.results {
        println!("{}: {}", v.reference.as_deref().unwrap_or(""), v.text.as_deref().unwrap_or(""));
    }

    // Search across Torah verses
    let results = client.search("covenant").await?;
    println!("Found {:?} results for 'covenant'", results.count);

    Ok(())
}
```

## What You Can Do

### Tanakh Books and Verses

The Tanakh contains 24 books organized into three sections: Torah (Pentateuch, 5 books), Nevi'im (Prophets, 8 books), and Ketuvim (Writings, 11 books). Translations include JPS-1917, Koren, and Masoretic Hebrew text.

```rust
// List all books
let books = client.list_books().await?;

// Get a specific book
let genesis = client.get_book("genesis").await?;

// Get a verse with Hebrew parallel text
let verse = client.get_verse("psalms", 23, 1, "jps-1917").await?;
```

### Parashot (Weekly Torah Portions)

The Torah is divided into 54 parashot (weekly portions) read in synagogues throughout the year. Each parashah spans a defined range of chapters and verses, following the annual reading cycle.

```rust
// List all 54 parashot
let parashot = client.list_parashot().await?;

// Get a specific parashah
let bereshit = client.get_parashah("bereshit").await?;
```

### Talmud and Mishnah

The Babylonian Talmud comprises 63 tractates organized into 6 sedarim (orders): Zeraim, Moed, Nashim, Nezikin, Kodashim, and Tohorot. Each tractate is divided into daf (folio) pages with recto (a) and verso (b) sides.

```rust
// List tractates
let tractates = client.list_tractates().await?;

// Get a Talmud daf -- Berakhot 2a
let daf = client.get_talmud_daf("berakhot", 2, "a").await?;

// List Mishnah chapters
let mishnah = client.list_mishnah(Some("berakhot")).await?;
```

### Rashi Commentary and Biblical Figures

Rabbi Shlomo Yitzchaki (Rashi, 1040-1105) wrote the most widely studied Torah commentary. Biblical figures span the patriarchs (Abraham, Isaac, Jacob), prophets (Moses, Elijah, Isaiah), kings (David, Solomon), and judges.

```rust
// List Rashi commentaries for Genesis
let rashi = client.list_rashi(Some("genesis")).await?;

// List biblical figures
let figures = client.list_figures().await?;
let moses = client.get_figure("moses").await?;
```

### Holidays, Topics, and Glossary

Jewish holidays include biblical (Shabbat, Pesach, Sukkot), rabbinic (Hanukkah, Purim), and modern (Yom HaShoah, Yom HaAtzmaut). The glossary defines Hebrew and Aramaic terms with transliterations.

```rust
let holidays = client.list_holidays().await?;
let topics = client.list_topics().await?;
let glossary = client.list_glossary().await?;
```

## API Methods

| Method | Description |
|--------|-------------|
| `list_books()` | List all 24 books of the Tanakh |
| `get_book(slug)` | Get book details |
| `list_translations()` | List available translations |
| `list_chapters(book)` | List chapters |
| `get_verse(book, chapter, verse, translation)` | Get a specific verse |
| `search(query)` | Search Torah verses |
| `list_parashot()` | List 54 weekly Torah portions |
| `get_parashah(slug)` | Get parashah details |
| `list_tractates()` | List Talmud tractates |
| `get_talmud_daf(tractate, daf, side)` | Get a Talmud daf page |
| `list_mishnah(tractate)` | List Mishnah chapters |
| `list_rashi(book)` | List Rashi commentaries |
| `list_holidays()` | List Jewish holidays |
| `list_figures()` | List biblical figures |
| `get_figure(slug)` | Get figure details |
| `list_topics()` | List thematic topics |
| `list_glossary()` | List Hebrew/Aramaic glossary |

All methods are async and return `Result<T, WideTorahError>`.

## Custom Base URL

```rust
let client = Client::with_base_url("http://localhost:8000/api/v1/torah");
```

## WideHoly Scripture Platform

Part of the [WideHoly](https://wideholy.com) multi-religion scripture platform.

| Site | Domain | Focus |
|------|--------|-------|
| WideBible | [widebible.com]https://widebible.com | 66 books, 4 translations, cross-references, study tools |
| WideQuran | [widequran.com]https://widequran.com | 114 surahs, hadith, tafsir, Quranic people |
| **WideTorah** | [widetorah.com]https://widetorah.com | **Tanakh, Talmud, Mishnah, Rashi, parashot** |
| WideGita | [widegita.com]https://widegita.com | Bhagavad Gita, Upanishads, Yoga Sutras, deities |
| WideSutra | [widesutra.com]https://widesutra.com | Tipitaka, Pali Canon, Buddhist concepts |
| WideHoly | [wideholy.com]https://wideholy.com | Cross-religion hub, comparison, calendar |

## Also Available

| Platform | Package | Install |
|----------|---------|---------|
| **Rust** | [widetorah]https://crates.io/crates/widetorah | `cargo add widetorah` |
| Python | [widetorah]https://pypi.org/project/widetorah/ | `pip install widetorah` |
| TypeScript | [widetorah]https://www.npmjs.com/package/widetorah | `npm install widetorah` |

## License

MIT