# boreholeio
A [Rust](https://www.rust-lang.org/) library for interacting with [borehole.io](https://borehole.io/), a subsurface data management, delivery and visualisation platform developed by [ALT](https://www.alt.lu/).
> [!CAUTION]
> This crate is not yet ready for general consumption. If you'd like more information or to get involved in the development, please get in touch.
## Getting Started
Rust developers can install the [boreholeio](https://crates.io/crates/boreholeio) crate using [Cargo](https://doc.rust-lang.org/cargo/index.html). From the command line, run `cargo install boreholeio` to install the crate directly, or add it to the dependencies section of the `Cargo.toml` for your project.
```toml
[dependencies]
boreholeio = "0.1.0"
```
This crate contains an API client and functionality to interact with data using [ndarray](https://docs.rs/ndarray/latest/ndarray/).
```rust
use boreholeio::client::{endpoints, BoreholeIoClient, BoreholeIoClientOptions};
use csv::Writer;
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// Connect to borehole.io.
let mut client = BoreholeIoClient::create(BoreholeIoClientOptions::default())?;
// Query all the boreholes filtered by site name. Specify that the `last_logged` field
// must be calculated additionally.
let boreholes = endpoints::borehole::list(
&mut client,
endpoints::borehole::Filters {
site: Some("Brockman BR1".into()),
..Default::default()
},
vec!["last_logged".to_string()],
)
.await?;
// Serialize the results to a CSV file.
let mut writer = Writer::from_path("./boreholes.csv")?;
for borehole in boreholes {
writer.serialize(borehole)?;
}
writer.flush()?;
Ok(())
}
```