#api-client #api-bindings #api #usgs

usgs-eros-client

USGS EROS M2M API客户端

1个不稳定版本

0.5.0 2020年10月19日

#569 in 科学

MIT许可

67KB
1K SLoC

Usgs EROS M2M API客户端

一个符合Rust语法的API,用于使用USGS EROS M2M数据搜索和检索接口。

用法

Cargo.toml

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

基本功能

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(())
}

由: S&T Norway 制作


lib.rs:

USGS EROS M2M的API客户端

示例

Cargo.toml

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

基本功能

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(())
}

有关实现的API端点,请参阅Client上实现的方法

依赖关系

~4–9MB
~195K SLoC