pub struct MindatClient { /* private fields */ }Expand description
Client for interacting with the Mindat API.
Implementations§
Source§impl MindatClient
impl MindatClient
Sourcepub fn new(token: impl Into<String>) -> Self
pub fn new(token: impl Into<String>) -> Self
Create a new client with the given API token.
§Example
use mindat_rs::MindatClient;
let client = MindatClient::new("your-api-token");Sourcepub fn anonymous() -> Self
pub fn anonymous() -> Self
Create a new client without authentication. Some endpoints (like minerals_ima) work without authentication.
Sourcepub fn builder() -> MindatClientBuilder
pub fn builder() -> MindatClientBuilder
Create a new client builder for more configuration options.
Sourcepub async fn countries(&self) -> Result<PaginatedResponse<Country>>
pub async fn countries(&self) -> Result<PaginatedResponse<Country>>
List all countries.
§Example
use mindat_rs::MindatClient;
let client = MindatClient::new("your-token");
let countries = client.countries().await?;
for country in countries.results {
println!("{}: {}", country.iso, country.text);
}Sourcepub async fn countries_page(
&self,
page: i32,
) -> Result<PaginatedResponse<Country>>
pub async fn countries_page( &self, page: i32, ) -> Result<PaginatedResponse<Country>>
List countries with pagination.
Sourcepub async fn geomaterials(
&self,
query: GeomaterialsQuery,
) -> Result<PaginatedResponse<Geomaterial>>
pub async fn geomaterials( &self, query: GeomaterialsQuery, ) -> Result<PaginatedResponse<Geomaterial>>
List geomaterials with optional filters.
§Example
use mindat_rs::{MindatClient, GeomaterialsQuery};
let client = MindatClient::new("your-token");
// Get IMA-approved minerals containing copper
let query = GeomaterialsQuery::new()
.ima_approved(true)
.with_elements("Cu")
.page_size(50);
let minerals = client.geomaterials(query).await?;
for mineral in minerals.results {
println!("{}: {:?}", mineral.id, mineral.name);
}Sourcepub async fn geomaterial(&self, id: i32) -> Result<Geomaterial>
pub async fn geomaterial(&self, id: i32) -> Result<Geomaterial>
Get a specific geomaterial by ID.
Sourcepub async fn geomaterial_varieties(&self, id: i32) -> Result<Geomaterial>
pub async fn geomaterial_varieties(&self, id: i32) -> Result<Geomaterial>
Get varieties of a specific geomaterial.
Sourcepub async fn geomaterials_search(
&self,
q: &str,
size: Option<i32>,
) -> Result<Vec<Value>>
pub async fn geomaterials_search( &self, q: &str, size: Option<i32>, ) -> Result<Vec<Value>>
Search for geomaterials.
Sourcepub async fn localities(
&self,
query: LocalitiesQuery,
) -> Result<CursorPaginatedResponse<Locality>>
pub async fn localities( &self, query: LocalitiesQuery, ) -> Result<CursorPaginatedResponse<Locality>>
List localities with optional filters.
§Example
use mindat_rs::{MindatClient, LocalitiesQuery};
let client = MindatClient::new("your-token");
// Get localities in Brazil
let query = LocalitiesQuery::new().country("Brazil");
let localities = client.localities(query).await?;
for loc in localities.results {
println!("{}: {:?}", loc.id, loc.txt);
}Sourcepub async fn locality_ages(
&self,
page: Option<i32>,
) -> Result<PaginatedResponse<LocalityAge>>
pub async fn locality_ages( &self, page: Option<i32>, ) -> Result<PaginatedResponse<LocalityAge>>
List locality ages.
Sourcepub async fn locality_age(&self, age_id: i32) -> Result<LocalityAge>
pub async fn locality_age(&self, age_id: i32) -> Result<LocalityAge>
Get a specific locality age by ID.
Sourcepub async fn locality_statuses(
&self,
page: Option<i32>,
) -> Result<PaginatedResponse<LocalityStatus>>
pub async fn locality_statuses( &self, page: Option<i32>, ) -> Result<PaginatedResponse<LocalityStatus>>
List locality statuses.
Sourcepub async fn locality_status(&self, ls_id: i32) -> Result<LocalityStatus>
pub async fn locality_status(&self, ls_id: i32) -> Result<LocalityStatus>
Get a specific locality status by ID.
Sourcepub async fn locality_types(
&self,
page: Option<i32>,
) -> Result<PaginatedResponse<LocalityType>>
pub async fn locality_types( &self, page: Option<i32>, ) -> Result<PaginatedResponse<LocalityType>>
List locality types.
Sourcepub async fn locality_type(&self, lt_id: i32) -> Result<LocalityType>
pub async fn locality_type(&self, lt_id: i32) -> Result<LocalityType>
Get a specific locality type by ID.
Sourcepub async fn geo_regions(
&self,
page: Option<i32>,
) -> Result<PaginatedResponse<Value>>
pub async fn geo_regions( &self, page: Option<i32>, ) -> Result<PaginatedResponse<Value>>
List geographic regions.
Sourcepub async fn minerals_ima(
&self,
query: ImaMineralsQuery,
) -> Result<PaginatedResponse<ImaMaterial>>
pub async fn minerals_ima( &self, query: ImaMineralsQuery, ) -> Result<PaginatedResponse<ImaMaterial>>
List IMA-approved minerals.
§Example
use mindat_rs::{MindatClient, ImaMineralsQuery};
let client = MindatClient::anonymous(); // No auth required
let query = ImaMineralsQuery::new().page_size(100);
let minerals = client.minerals_ima(query).await?;
for mineral in minerals.results {
println!("{}: {:?}", mineral.id, mineral.name);
}Sourcepub async fn mineral_ima(&self, id: i32) -> Result<Geomaterial>
pub async fn mineral_ima(&self, id: i32) -> Result<Geomaterial>
Get a specific IMA mineral by ID.
Sourcepub async fn dana8_groups(&self) -> Result<Value>
pub async fn dana8_groups(&self) -> Result<Value>
Get Dana 8th edition classification groups.
Sourcepub async fn dana8_subgroups(&self) -> Result<Value>
pub async fn dana8_subgroups(&self) -> Result<Value>
Get Dana 8th edition classification subgroups.
Sourcepub async fn dana8(&self, id: i32) -> Result<Value>
pub async fn dana8(&self, id: i32) -> Result<Value>
Get a specific Dana 8th edition classification.
Sourcepub async fn strunz10_classes(&self) -> Result<Value>
pub async fn strunz10_classes(&self) -> Result<Value>
Get Nickel-Strunz 10th edition classification classes.
Sourcepub async fn strunz10_subclasses(&self) -> Result<Value>
pub async fn strunz10_subclasses(&self) -> Result<Value>
Get Nickel-Strunz 10th edition classification subclasses.
Sourcepub async fn strunz10_families(&self) -> Result<Value>
pub async fn strunz10_families(&self) -> Result<Value>
Get Nickel-Strunz 10th edition classification families.
Sourcepub async fn strunz10(&self, id: i32) -> Result<Value>
pub async fn strunz10(&self, id: i32) -> Result<Value>
Get a specific Nickel-Strunz 10th edition classification.
Sourcepub async fn photocount(&self) -> Result<Value>
pub async fn photocount(&self) -> Result<Value>
Get photo count statistics.
Trait Implementations§
Source§impl Clone for MindatClient
impl Clone for MindatClient
Source§fn clone(&self) -> MindatClient
fn clone(&self) -> MindatClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more