Skip to content

phasewalk1/nasa-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nasa-rs

The nasa-rs crate provides synchronous client wrappers for Nasa's Open APIs. See below for a list of supported APIs. If the client has not been implemented yet, feel free to open a PR! Check out prelude.rs for client implementation details.

Example Usage

Using Parameter Types with query

nasa-rs exposes parameter types for each supported API, which allows for easy query building and execution with the query function:

Using the APOD API

use nasa_rs::clients::{Apod, ApodParams};
use nasa_rs::prelude::{Client, *};

fn main() {
    // Create a client for the APOD endpoint
    let client = Client::<Apod>::default();
    // The 'parameter type' for APOD
    let params = ApodParams::Date("2024-01-01");
    // Query the API
    let response = client.query(&params).unwrap();
}
Using the query_with Function to Inject Parameters

For more granular control, nasa-rs exposes the query_with function, which accepts any type that implements QueryValues type (see the trait definition for more details).

!warning! - not yet implemented

// ...
let client = Client::<Apod>::default();
let response = client.query_with(
    vec![ ("date", "2024-01-01") ]
)

Supported APIs

About

Client wrappers for NASA's open APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages