#times

hebcal

A hebcal.com REST API Client

1 unstable release

0.1.0 Oct 12, 2020

#61 in #times

MIT/Apache

18KB
292 lines

hebcal-rs: hebcal.com client for Shabbat times

Rust

hebcal-rs is a client library in Rust for requesting Shabbat times from the API at http://www.hebcal.com.

Cargo

hebcal = "0.1"

Example

use anyhow::Result;
use hebcal::{
    shabbat::Transliteration,
    HebCal,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let hebcal = HebCal::default();
    let shabbat = hebcal
        .shabbat()
        .transliteration(Transliteration::Ashkenazic)
        .zip("94706")
        .havdalah(20u16)
        .send()
        .await?;
    println!("{:#?}", shabbat);
    Ok(())
}

lib.rs:

HebCal: hebcal.com REST API client

HebCal is an API client for several of the RESTful APIs offered at https://www.hebcal.com/home/developer-apis

Shabbat API

The Shabbat times API returns location specific Shabbat times and details.

use hebcal::{
    shabbat::{Leyning, Transliteration},
    HebCal, Result,
};

async fn f() -> Result<(), Box<dyn std::error::Error>> {
    let hebcal = HebCal::default();
    let shabbat = hebcal
     .shabbat()
     .transliteration(Transliteration::Ashkenazic)
     .zip("94706")
     .leyning(Leyning::Off)
     .send()
     .await?;
    
    // do stuff with `shabbat`

    Ok(())
}

Dependencies

~5–10MB
~183K SLoC