dehashed-rs

Crates.iodehashed-rs
lib.rsdehashed-rs
version0.5.0
sourcesrc
created_at2023-08-03 00:31:58.678643
updated_at2024-04-02 12:24:59.451735
descriptionA rust library for the dehashed API
homepage
repositoryhttps://github.com/myOmikron/dehashed-rs
max_upload_size
id933269
size82,927
(myOmikron)

documentation

README

dehashed-rs

LICENSE dependency status ci status Docs

This is an SDK for the dehashed api.

Usage

use dehashed_rs::*;

let email = "test@example.com".to_string();
let api_key = "<api_key>".to_string();

// Create an api instance
let api = DehashedApi::new(email, api_key).unwrap();

// Query for the domain example.com
if let Ok(res) = api
    .search(Query::Domain(SearchType::Simple("example.com".to_string())))
    .await
{
    println!("{res:?}");
}

or if you enable the tokio feature, you can utilize the scheduler to abstract away the need to manage get past the rate limit:

use dehashed_rs::*;
use tokio::sync::oneshot;

let email = "test@example.com".to_string();
let api_key = "<api_key>".to_string();

// Create an api instance
let api = DehashedApi::new(email, api_key).unwrap();
// Create the scheduler
let scheduler = api.start_scheduler();

let tx = scheduler.retrieve_sender();

let (ret_tx, ret_rx) = oneshot::channel();

// Schedule a query for the email "test@example.com"
tx.send(ScheduledRequest::new(
    Query::Email(SearchType::Simple("test@example.com".to_string())),
    ret_tx, 
))
.await
.unwrap();

// Retrieve the result
if let Ok(res) = ret_rx.await {
    println!("{res:?}");
}

If you need type definitions for utoipa, there available under the feature flag utoipa.

Note

This is not an official API

Commit count: 25

cargo fmt