Skip to main content

FlightRadarClient

Struct FlightRadarClient 

Source
pub struct FlightRadarClient { /* private fields */ }
Expand description

Main structure for storing API internal data

Implementations§

Source§

impl FlightRadarClient

Source

pub fn new(api_key: String) -> Self

Creates a new instance of the client.

§Arguments
  • api_key - Your Flightradar24 API key.
Source

pub fn update_base_url(&mut self, base_url: String)

Source

pub fn check_live_parameters(query_in: &FullLiveFlightQuery) -> bool

Check to ensure one API query is provided for endpoint

§Arguments
  • query_in - FullLiveFlightQuery to check
§Returns

A bool based on check

Source

pub fn check_historic_parameters(query_in: &FullLiveFlightQuery) -> bool

Source

pub fn query_endpoint(&self, url: String) -> Result<String, FlightRadarError>

Issue the GET command to API Endpoint

§Arguments
  • url - API URL to send GET request to
§Returns

A String on success and FlightRadarError on failure.

Source

pub fn get_airline_by_icao( &self, icao: &str, ) -> Result<Airline, FlightRadarError>

Fetches airline information by ICAO.

§Arguments
  • icao - The identifier for the airline.
§Returns

A Airline struct on success or a FlightRadarError on failure.

Source

pub fn get_airport_by_code( &self, code: &str, ) -> Result<Airport, FlightRadarError>

Fetches airport information by code.

§Arguments
  • code - The identifier for the airport.
§Returns

A Airport struct on success or a FlightRadarError on failure.

Source

pub fn get_airport_lite_by_code( &self, code: &str, ) -> Result<AirportLite, FlightRadarError>

Fetches airport information by code.

§Arguments
  • code - The identifier for the airport.
§Returns

A Airport struct on success or a FlightRadarError on failure.

Source

pub fn get_live_flight( &self, other_queries: Option<&FullLiveFlightQuery>, ) -> Result<FullLiveFlightResponse, FlightRadarError>

Fetches live flight information by location (or other parameters).

§Arguments
  • other_queries - Optional parameters to narrow down data
§Returns

A FullLiveFlightResponse struct on success or a FlightRadarError on failure.

Source

pub fn get_live_flight_light( &self, other_queries: Option<&FullLiveFlightQuery>, ) -> Result<LightLiveFlightResponse, FlightRadarError>

Fetches light live flight information by location (or other parameters).

§Arguments
  • other_queries - Optional parameters to narrow down data
§Returns

A LightLiveFlightResponse struct on success or a FlightRadarError on failure.

Source

pub fn get_historic_flight( &self, timestamp: &u64, other_queries: Option<&FullLiveFlightQuery>, ) -> Result<FullLiveFlightResponse, FlightRadarError>

Fetches historic flight information by timestamp (or other parameters).

§Arguments
  • timestamp - Timestamp to gather information from
  • other_queries - Optional parameters to narrow down data
§Returns

A FullLiveFlightResponse struct on success or a FlightRadarError on failure.

Source

pub fn get_historic_flight_light( &self, timestamp: &u64, other_queries: Option<&FullLiveFlightQuery>, ) -> Result<LightLiveFlightResponse, FlightRadarError>

Fetches light historic flight information by timestamp (or other parameters).

§Arguments
  • timestamp - Timestamp to gather information from
  • other_queries - Optional parameters to narrow down data
§Returns

A LightLiveFlightResponse struct on success or a FlightRadarError on failure.

Source

pub fn get_flight_tracks_by_id( &self, flight_id: &str, ) -> Result<Vec<Flight>, FlightRadarError>

Fetches flight information by flight ID.

§Arguments
  • flight_id - The identifier for the flight.
§Returns

A Flight struct on success or a FlightRadarError on failure.

Source

pub fn get_api_usage( &self, period: &str, ) -> Result<ApiUsageResponse, FlightRadarError>

Fetches API usage details over period

§Arguments
  • period - Backwards time to gather usage (Allowed: 24h | 7d | 30d | 1y)
§Returns

A ApiUsageResponse struct on success or a FlightRadarError on failure.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more