pub struct NasaClient { /* private fields */ }Expand description
Client for NASA Open APIs (api.nasa.gov)
Provides access to:
- Astronomy Picture of the Day (APOD)
- Near Earth Objects (NEO) - asteroids
- Mars weather and rover photos
- Space weather events (DONKI)
§Example
ⓘ
use ruvector_data_framework::NasaClient;
let client = NasaClient::new(Some("YOUR_API_KEY".to_string()))?;
let apod = client.get_apod(None).await?;
let asteroids = client.search_neo("2024-01-01", "2024-01-07").await?;
let mars_photos = client.search_mars_photos(1000, Some("NAVCAM")).await?;Implementations§
Source§impl NasaClient
impl NasaClient
Sourcepub fn new(api_key: Option<String>) -> Result<Self>
pub fn new(api_key: Option<String>) -> Result<Self>
Create a new NASA client
§Arguments
api_key- Optional NASA API key (get from https://api.nasa.gov/) If None, uses “DEMO_KEY” (limited to 30 requests per hour)
Sourcepub async fn search_neo(
&self,
start_date: &str,
end_date: &str,
) -> Result<Vec<SemanticVector>>
pub async fn search_neo( &self, start_date: &str, end_date: &str, ) -> Result<Vec<SemanticVector>>
Sourcepub async fn get_mars_weather(&self) -> Result<Vec<SemanticVector>>
pub async fn get_mars_weather(&self) -> Result<Vec<SemanticVector>>
Sourcepub async fn search_mars_photos(
&self,
sol: u32,
camera: Option<&str>,
) -> Result<Vec<SemanticVector>>
pub async fn search_mars_photos( &self, sol: u32, camera: Option<&str>, ) -> Result<Vec<SemanticVector>>
Search Mars Rover photos
§Arguments
sol- Martian day (sol) numbercamera- Optional camera name (FHAZ, RHAZ, MAST, CHEMCAM, MAHLI, MARDI, NAVCAM, PANCAM, MINITES)
§Example
ⓘ
let photos = client.search_mars_photos(1000, Some("NAVCAM")).await?;
let all_cameras = client.search_mars_photos(1000, None).await?;Sourcepub async fn get_donki_events(
&self,
event_type: &str,
start_date: &str,
end_date: &str,
) -> Result<Vec<SemanticVector>>
pub async fn get_donki_events( &self, event_type: &str, start_date: &str, end_date: &str, ) -> Result<Vec<SemanticVector>>
Get space weather events from DONKI (Database Of Notifications, Knowledge, Information)
§Arguments
event_type- Event type: “CME” (Coronal Mass Ejection), “FLR” (Solar Flare), “SEP” (Solar Energetic Particle), etc.start_date- Start date in format “YYYY-MM-DD”end_date- End date in format “YYYY-MM-DD” (max 30 days)
§Example
ⓘ
let flares = client.get_donki_events("FLR", "2024-01-01", "2024-01-31").await?;
let cmes = client.get_donki_events("CME", "2024-01-01", "2024-01-31").await?;Auto Trait Implementations§
impl Freeze for NasaClient
impl !RefUnwindSafe for NasaClient
impl Send for NasaClient
impl Sync for NasaClient
impl Unpin for NasaClient
impl !UnwindSafe for NasaClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more