nadeo_api_rs::auth

Struct NadeoClient

Source
pub struct NadeoClient {
    pub user_agent: UserAgentDetails,
    pub max_concurrent_requests: usize,
    /* private fields */
}

Fields§

§user_agent: UserAgentDetails§max_concurrent_requests: usize

Implementations§

Source§

impl NadeoClient

Source

pub fn get_authz_header_for_auth(&self) -> String

Source

pub async fn create( credentials: NadeoCredentials, user_agent: UserAgentDetails, max_concurrent_requests: usize, ) -> Result<Self, Box<dyn Error>>

Source

pub fn with_oauth(self, oauth: OAuthCredentials) -> Option<Self>

Source

pub async fn ensure_tokens_valid(&self)

Source

pub async fn calc_avg_req_per_sec(&self) -> f64

Source

pub async fn get_cached_avg_req_per_sec(&self) -> f64

Source

pub async fn get_nb_reqs(&self) -> usize

Source

pub fn get_batcher(&self) -> &BatcherLbPosByTime

Trait Implementations§

Source§

impl CoreApiClient for NadeoClient

Source§

async fn get_zones(&self) -> Result<Vec<Zone>, Box<dyn Error>>

Get a list of zones Read more
Source§

async fn get_zone_tree(&self) -> Result<&ZoneTree, Box<dyn Error>>

Get the zone tree – cached!
Source§

async fn get_user_zones<T: Into<String> + Clone>( &self, player_ids: &[T], ) -> Result<HashMap<String, PlayerZone>, Box<dyn Error + Send + Sync>>

Get players’ zone details Read more
Source§

impl LiveApiClient for NadeoClient

Source§

async fn push_rec_position_req( &'static self, map_uid: &str, score: i32, ) -> Receiver<ScoreToPos>

Internal method supporting get_lb_position_by_time_batched
Source§

async fn get_monthly_campaign( &self, ty: MonthlyCampaignType, length: u32, offset: u32, ) -> Result<MonthlyCampaign_List, Box<dyn Error>>

Get TOTDs / Royal maps
Source§

async fn get_map_group_leaderboard( &self, group_uid: &str, map_uid: &str, only_world: bool, length: u32, offset: u32, ) -> Result<MapGroupLeaderboard, Box<dyn Error>>

Source§

async fn get_map_leaderboard( &self, map_uid: &str, only_world: bool, length: u32, offset: u32, ) -> Result<MapGroupLeaderboard, Box<dyn Error>>

Personal_Best LB Read more
Source§

async fn get_lb_positions_by_time( &self, uid_scores: &[(&str, NonZero<u32>)], ) -> Result<Vec<RecordsByTime>, Box<dyn Error>>

Source§

async fn get_lb_positions_by_time_group( &self, uid_scores: &[(&str, NonZero<u32>)], group_uid: &str, ) -> Result<Vec<RecordsByTime>, Box<dyn Error>>

Source§

async fn get_lb_position_by_time_batched( &'static self, map_uid: &str, score: NonZero<u32>, ) -> Result<ScoreToPos, RecvError>

Source§

async fn get_group_surround( &self, group_uid: &str, map_uid: &str, lower: i32, upper: i32, score: u32, only_world: bool, ) -> Result<RecordsSurround, Box<dyn Error>>

Source§

async fn get_pb_surround( &self, map_uid: &str, lower: i32, upper: i32, score: u32, only_world: bool, ) -> Result<RecordsSurround, Box<dyn Error>>

Surround on the Personal_Best group Read more
Source§

async fn get_map_info( &self, map_uid: &str, ) -> Result<Option<MapInfo>, Box<dyn Error>>

Source§

async fn get_map_info_multiple( &self, map_uids: &[&str], ) -> Result<MapInfos, Box<dyn Error>>

Source§

impl MeetApiClient for NadeoClient

Source§

impl NadeoApiClient for NadeoClient

Source§

fn get_auth_token( &self, audience: NadeoAudience, ) -> Result<String, TryLockError>

prefer aget_auth_token

Source§

async fn get_client(&self) -> &Client

Source§

async fn aget_auth_token(&self, audience: NadeoAudience) -> String

Source§

async fn rate_limit(&self) -> SemaphorePermit<'_>

Source§

async fn get_file_size(&self, url: &str) -> Result<u64, RqError>

Source§

fn get_auth_header(&self, audience: NadeoAudience) -> String

Source§

async fn aget_auth_header(&self, audience: NadeoAudience) -> String

Source§

async fn get_auth_header_value(&self, audience: NadeoAudience) -> HeaderValue

Source§

async fn oauth_get<'a>( &self, path: &str, token: &OAuthToken, _permit: &SemaphorePermit<'a>, ) -> RequestBuilder

Source§

async fn core_get(&self, path: &str) -> (RequestBuilder, SemaphorePermit<'_>)

Source§

async fn run_core_get(&self, path: &str) -> Result<Value, RqError>

Source§

async fn core_post_bytes( &self, path: &str, body: &[u8], ) -> (RequestBuilder, SemaphorePermit<'_>)

Source§

async fn run_core_post_bytes( &self, path: &str, body: &[u8], ) -> Result<Value, RqError>

Source§

async fn core_post( &self, path: &str, body: &Value, ) -> (RequestBuilder, SemaphorePermit<'_>)

Source§

async fn run_core_post( &self, path: &str, body: &Value, ) -> Result<Value, RqError>

Source§

async fn live_get(&self, path: &str) -> (RequestBuilder, SemaphorePermit<'_>)

Source§

async fn run_live_get(&self, path: &str) -> Result<Value, RqError>

Source§

async fn live_post_bytes( &self, path: &str, body: &[u8], ) -> (RequestBuilder, SemaphorePermit<'_>)

Source§

async fn run_live_post_bytes( &self, path: &str, body: &[u8], ) -> Result<Value, RqError>

Source§

async fn live_post( &self, path: &str, body: &Value, ) -> (RequestBuilder, SemaphorePermit<'_>)

Source§

async fn run_live_post( &self, path: &str, body: &Value, ) -> Result<Value, RqError>

Source§

async fn meet_get(&self, path: &str) -> (RequestBuilder, SemaphorePermit<'_>)

Source§

async fn run_meet_get(&self, path: &str) -> Result<Value, RqError>

Source§

async fn meet_post_bytes( &self, path: &str, body: &[u8], ) -> (RequestBuilder, SemaphorePermit<'_>)

Source§

async fn run_meet_post_bytes( &self, path: &str, body: &[u8], ) -> Result<Value, RqError>

Source§

async fn meet_post( &self, path: &str, body: &Value, ) -> (RequestBuilder, SemaphorePermit<'_>)

Source§

async fn run_meet_post( &self, path: &str, body: &Value, ) -> Result<Value, RqError>

Source§

impl OAuthApiClient for NadeoClient

Source§

async fn get_oauth_token(&self) -> Result<OAuthToken, String>

For adding API requests, use get_oauth_permit_and_token.
Source§

async fn get_oauth_permit_and_token( &self, ) -> Result<(OAuthToken, SemaphorePermit<'_>), String>

Source§

async fn get_display_names<T>( &self, account_ids: &[T], ) -> Result<HashMap<String, String>, String>
where T: Into<String> + Clone,

Get Display Names for a list of Uuids Read more

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
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T