Struct NadeoClient

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

Main client for nadeo services

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, NadeoError>

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>, NadeoError>

Get a list of zones Read more
Source§

async fn get_zone_tree(&self) -> Result<&ZoneTree, NadeoError>

Get the zone tree – cached!
Source§

async fn get_user_zones<T: Into<String> + Clone>( &self, player_ids: &[T], ) -> Result<HashMap<String, PlayerZone>, NadeoError>

Get players’ zone details Read more
Source§

impl LiveApiClient for NadeoClient

Source§

async fn push_rec_position_req( &'static self, map_uid: &str, score: i64, ) -> 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, NadeoError>

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, NadeoError>

Source§

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

Personal_Best LB Read more
Source§

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

Source§

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

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, NadeoError>

Source§

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

Surround on the Personal_Best group Read more
Source§

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

Source§

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

Source§

async fn get_club_activities( &self, club_id: i32, length: u32, offset: u32, active: bool, ) -> Result<ClubActivityList, NadeoError>

Source§

async fn get_club_info(&self, club_id: i32) -> Result<ClubInfo, NadeoError>

Source§

async fn get_club_campaign_by_id( &self, club_id: i32, campaign_id: i32, ) -> Result<ClubCampaignById, NadeoError>

Source§

async fn get_club_campaigns( &self, length: u32, offset: u32, name: Option<&str>, ) -> Result<ClubCampaignList, NadeoError>

Source§

async fn get_club_rooms( &self, length: u32, offset: u32, name: Option<&str>, ) -> Result<ClubRoomList, NadeoError>

Source§

async fn get_club_room_by_id( &self, club_id: i32, activity_id: i32, ) -> Result<ClubRoom, NadeoError>

Source§

async fn edit_club_room_by_id( &self, club_id: i32, activity_id: i32, body: &ClubRoom_Room_ForEdit, ) -> Result<ClubRoom, NadeoError>

Source§

async fn create_club_room( &self, club_id: i32, body: &ClubRoom_Room_ForEdit, ) -> Result<ClubRoom, NadeoError>

Source§

async fn get_club_activity_list( &self, club_id: i32, length: u32, offset: u32, active: Option<bool>, ) -> Result<ActivityList, NadeoError>

Source§

async fn edit_club_activity( &self, club_id: i32, activity_id: i32, public: Option<bool>, active: Option<bool>, ) -> Result<Value, NadeoError>

Source§

async fn get_clubs( &self, length: u32, offset: u32, name: Option<&str>, ) -> Result<ClubList, NadeoError>

Source§

async fn get_clubs_mine( &self, length: u32, offset: u32, ) -> Result<ClubList, NadeoError>

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 Get the auth token for the given audience (used to construct the header)

Source§

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

Get the auth token for the given audience (used to construct the header)

Source§

async fn get_client(&self) -> &Client

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, ) -> Result<String, TryLockError>

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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,