[][src]Crate usgs_eros_client

An API client for USGS EROS M2M

Example

Cargo.toml:

[dependencies]
usgs-eros-client = "^1.0"
tokio = {version = "^0.2", features = ["macros"]}

Basic functionality:

use usgs_eros_client::{Client, Result};
use usgs_eros_client::types::Credentials;
use usgs_eros_client::endpoints::DatasetRequestBuilder;

#[tokio::main]
async fn main() -> Result<()> {
   let credentials = Credentials::from_env()?;
   let client = Client::new(&credentials).await?;
   let dataset = client.dataset()
       .name("gls_all").call().await?;
   println!("Dataset response: {:?}", dataset);
   Ok(())
}

For implemented API endpoints, see the methods implemented on the Client

Modules

endpoints

API endpoint implementation

types

Types needed for working with the API, as described in API documentation

Structs

Client

USGS EROS M2M API client. This is the main interaction point with the API. The instantiation needs valid user credentials that are used to initiate a session and get an API token. The token is automatically freed when the Client goes out of scope.

Enums

Error

Error type of this crate

Constants

ENVVAR_PASS

Defines the environment variable for the USGS password

ENVVAR_USER

Defines the environment variable for the USGS username

USGS_API_URL

Defines the USGS EROS M2M API url to use

Type Definitions

Result

Result type of this crate