nadeo_api_rs::live

Trait LiveApiClient

Source
pub trait LiveApiClient: NadeoApiClient {
    // Required method
    async fn push_rec_position_req(
        &'static self,
        map_uid: &str,
        score: i32,
    ) -> Receiver<ScoreToPos>;

    // Provided methods
    async fn get_monthly_campaign(
        &self,
        ty: MonthlyCampaignType,
        length: u32,
        offset: u32,
    ) -> Result<MonthlyCampaign_List, Box<dyn Error>> { ... }
    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>> { ... }
    async fn get_map_leaderboard(
        &self,
        map_uid: &str,
        only_world: bool,
        length: u32,
        offset: u32,
    ) -> Result<MapGroupLeaderboard, Box<dyn Error>> { ... }
    async fn get_lb_positions_by_time(
        &self,
        uid_scores: &[(&str, NonZero<u32>)],
    ) -> Result<Vec<RecordsByTime>, Box<dyn Error>> { ... }
    async fn get_lb_positions_by_time_group(
        &self,
        uid_scores: &[(&str, NonZero<u32>)],
        group_uid: &str,
    ) -> Result<Vec<RecordsByTime>, Box<dyn Error>> { ... }
    async fn get_lb_position_by_time_batched(
        &'static self,
        map_uid: &str,
        score: NonZero<u32>,
    ) -> Result<ScoreToPos, RecvError> { ... }
    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>> { ... }
    async fn get_pb_surround(
        &self,
        map_uid: &str,
        lower: i32,
        upper: i32,
        score: u32,
        only_world: bool,
    ) -> Result<RecordsSurround, Box<dyn Error>> { ... }
    async fn get_map_info(
        &self,
        map_uid: &str,
    ) -> Result<Option<MapInfo>, Box<dyn Error>> { ... }
    async fn get_map_info_multiple(
        &self,
        map_uids: &[&str],
    ) -> Result<MapInfos, Box<dyn Error>> { ... }
}
Expand description

API calls for the Live API

Required Methods§

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

Provided Methods§

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

https://webservices.openplanet.dev/live/leaderboards/top

calls api/token/leaderboard/group/{groupUid}/map/{mapUid}/top

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

https://webservices.openplanet.dev/live/leaderboards/top

calls api/token/leaderboard/group/Personal_Best/map/{mapUid}/top

Source

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

https://webservices.openplanet.dev/live/leaderboards/position

Note: different groups are supported by the API but not this method.

Warning: duplicate uids with different scores is not supported by the API.

calls api/token/leaderboard/group/map?scores[{mapUid}]={score}

Source

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

https://webservices.openplanet.dev/live/leaderboards/position

When using a different groupUid, make sure you’re only referencing currently open leaderboards. Maps with closed leaderboards will not be included in the response.

Warning: duplicate uids with different scores is not supported by the API.

calls api/token/leaderboard/group/map?scores[{mapUid}]={score}

Source

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

https://webservices.openplanet.dev/live/leaderboards/position

Uses get_lb_positions_by_time with an async batching system to get the position on the leaderboard for a given score.

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

https://webservices.openplanet.dev/live/leaderboards/surround

calls api/token/leaderboard/group/{groupUid}/map/{mapUid}/surround/{lower}/{upper}?score={score}&onlyWorld={onlyWorld}

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

https://webservices.openplanet.dev/live/leaderboards/surround

calls api/token/leaderboard/group/Personal_Best/map/{mapUid}/surround/{lower}/{upper}?score={score}

Source

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

https://webservices.openplanet.dev/live/maps/info

calls api/token/map/{mapUid}

Returns None if the map isn’t uploaded

Source

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

https://webservices.openplanet.dev/live/maps/info-multiple

calls api/token/map/get-multiple?mapUidList={mapUidList}

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§