https://github.com/trivernis/hydrus-ptr-client
https://github.com/trivernis/hydrus-ptr-client
api-wrapper hydrus ptr rust
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/trivernis/hydrus-ptr-client
- Owner: Trivernis
- License: apache-2.0
- Created: 2022-03-08T10:07:43.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-08T10:14:18.000Z (almost 4 years ago)
- Last Synced: 2025-08-23T05:37:36.799Z (6 months ago)
- Topics: api-wrapper, hydrus, ptr, rust
- Language: Rust
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hydrus PTR Client [](https://docs.rs/hydrus-ptr-client) [](https://crates.io/crates/hydrus-ptr-client)
A rust http client for the hydrus PTR. Completeness is not guaranteed.
## Usage
## Fetching metadata and retrieving updates
```rust
use hydrus_ptr_client::Client;
#[tokio::main]
async fn main() {
let client = Client::builder().accept_invalid_certs(true).build().unwrap();
// list of all update files since id = 0
let metadata = client.get_metadata(0).await.unwrap();
let first_update_file = metadata.update_hashes().swap_remove(0);
let update = client.get_update(first_update_file).await.unwrap();
println!("Got update {:?}", update);
}
```
## Streaming updates
```rust
use hydrus_ptr_client::Client;
use futures_util::StreamExt;
#[tokio::main]
async fn main() {
let client = Client::builder().accept_invalid_certs(true).build().unwrap();
// streams all update since id = 0
let mut update_stream = client.stream_updates(0).await.unwrap();
while let Some(result) = update_stream.next().await {
match result {
Ok(update) => println!("We got an update {:?}", update),
Err(e) => println!("Oh no, an error occurred {}", e),
}
break;
}
}
```
## License
Apache-2.0