pub struct AstroEventRequest<A = ProvidedArgument, B = ProvidedArgument, C = ProvidedArgument> { /* private fields */ }
Expand description
Astronomy API requests. Astro Event API request.
Request is validated at compile time when supplied to the client.
Example:
use libtad_rs::{
ServiceClient,
service::astronomy::AstroEventRequest,
models::{
astronomy::AstronomyObjectType,
time::DateTime,
},
};
let client = ServiceClient::new("access_key".into(), "secret_key".into());
let request = AstroEventRequest::new()
.with_object(AstronomyObjectType::Sun)
.with_placeid("3")
.set_startdt(DateTime::from("2021-08-18"));
let response = client.get_astro_events(&request);
Implementations§
Source§impl AstroEventRequest
impl AstroEventRequest
Sourcepub fn new() -> AstroEventRequest<RequiredArgument, RequiredArgument, RequiredArgument>
pub fn new() -> AstroEventRequest<RequiredArgument, RequiredArgument, RequiredArgument>
Start building a new request.
Source§impl<A, B, C> AstroEventRequest<A, B, C>
impl<A, B, C> AstroEventRequest<A, B, C>
Sourcepub fn set_object(
self,
object: Vec<AstronomyObjectType>,
) -> AstroEventRequest<ProvidedArgument, B, C>
pub fn set_object( self, object: Vec<AstronomyObjectType>, ) -> AstroEventRequest<ProvidedArgument, B, C>
Set a list of objects for the request.
Sourcepub fn with_object(
self,
object: AstronomyObjectType,
) -> AstroEventRequest<ProvidedArgument, B, C>
pub fn with_object( self, object: AstronomyObjectType, ) -> AstroEventRequest<ProvidedArgument, B, C>
Add an object to the request.
Sourcepub fn set_placeid(
self,
placeid: Vec<impl Into<String>>,
) -> AstroEventRequest<A, ProvidedArgument, C>
pub fn set_placeid( self, placeid: Vec<impl Into<String>>, ) -> AstroEventRequest<A, ProvidedArgument, C>
Set a list of placeids for the request.
Sourcepub fn with_placeid(
self,
placeid: impl Into<String>,
) -> AstroEventRequest<A, ProvidedArgument, C>
pub fn with_placeid( self, placeid: impl Into<String>, ) -> AstroEventRequest<A, ProvidedArgument, C>
Add a placeid to the request.
Sourcepub fn set_startdt(
self,
startdt: DateTime,
) -> AstroEventRequest<A, B, ProvidedArgument>
pub fn set_startdt( self, startdt: DateTime, ) -> AstroEventRequest<A, B, ProvidedArgument>
Set the start date for the request.
Sourcepub fn with_type(self, event_type: AstronomyEventClass) -> Self
pub fn with_type(self, event_type: AstronomyEventClass) -> Self
Add an event type to the request.
Sourcepub fn set_geo(self, enable: bool) -> Self
pub fn set_geo(self, enable: bool) -> Self
Toggle whether to return longitude and latitude for the geo object.
Sourcepub fn set_isotime(self, enable: bool) -> Self
pub fn set_isotime(self, enable: bool) -> Self
Toggle whether to add time stamps in local time to all events.
Sourcepub fn set_lang(self, lang: impl Into<String>) -> Self
pub fn set_lang(self, lang: impl Into<String>) -> Self
Set the request language for the request.
Sourcepub fn set_radius(self, radius: i32) -> Self
pub fn set_radius(self, radius: i32) -> Self
Set search radius for translating coordinates to locations.
Sourcepub fn set_utctime(self, enable: bool) -> Self
pub fn set_utctime(self, enable: bool) -> Self
Toggle whether to add time stamps in RequiredArgumentTC to all events.
Trait Implementations§
Auto Trait Implementations§
impl<A, B, C> Freeze for AstroEventRequest<A, B, C>
impl<A, B, C> RefUnwindSafe for AstroEventRequest<A, B, C>
impl<A, B, C> Send for AstroEventRequest<A, B, C>
impl<A, B, C> Sync for AstroEventRequest<A, B, C>
impl<A, B, C> Unpin for AstroEventRequest<A, B, C>
impl<A, B, C> UnwindSafe for AstroEventRequest<A, B, C>
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