forked from mirror/Riven
1
0
Fork 0

Update: add LorRankedV1, add Sett, re-add get_matchlist season param

users/mingwei/surf
Mingwei Samuel 2020-01-26 14:15:16 -08:00
parent cf23db7361
commit 0e200a80fb
3 changed files with 64 additions and 9 deletions

View File

@ -226,6 +226,8 @@ pub enum Champion {
#[strum(to_string="Sejuani", serialize="Sejuani")] Sejuani = 113,
/// Senna (`Senna`, 235).
#[strum(to_string="Senna", serialize="Senna")] Senna = 235,
/// Sett (`Sett`, 875).
#[strum(to_string="Sett", serialize="Sett")] Sett = 875,
/// Shaco (`Shaco`, 35).
#[strum(to_string="Shaco", serialize="Shaco")] Shaco = 35,
/// Shen (`Shen`, 98).
@ -448,6 +450,7 @@ impl Champion {
Self::Ryze => "Ryze",
Self::Sejuani => "Sejuani",
Self::Senna => "Senna",
Self::Sett => "Sett",
Self::Shaco => "Shaco",
Self::Shen => "Shen",
Self::Shyvana => "Shyvana",

View File

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 8de91254196abf157d29b578bfe2d3d49b29ba8a
// Version 66d2fb48666dc3be590d1860a2a57a53ffd70d0c
//! Automatically generated endpoint handles.
@ -58,6 +58,13 @@ impl RiotApi {
pub fn lol_status_v3(&self) -> LolStatusV3 {
LolStatusV3 { base: self }
}
/// Handle for LorRankedV1 endpoints. This method is automatically generated.
///
/// <a href="https://developer.riotgames.com/api-methods/#lor-ranked-v1">Official API Reference</a>
#[inline]
pub fn lor_ranked_v1(&self) -> LorRankedV1 {
LorRankedV1 { base: self }
}
/// Handle for MatchV4 endpoints. This method is automatically generated.
///
/// <a href="https://developer.riotgames.com/api-methods/#match-v4">Official API Reference</a>
@ -337,6 +344,27 @@ impl<'a> LolStatusV3<'a> {
}
/// LorRankedV1 endpoints. This struct is automatically generated.
///
/// <a href="https://developer.riotgames.com/api-methods/#lor-ranked-v1">Official API Reference</a>
pub struct LorRankedV1<'a> {
base: &'a RiotApi,
}
impl<'a> LorRankedV1<'a> {
/// Get the players in Master tier.
///
/// <a href="https://developer.riotgames.com/api-methods/#lor-ranked-v1/GET_getLeaderboards">Official API Reference</a>
/// # Parameters
/// * `region` - Region to query.
pub fn get_leaderboards(&self, region: Region)
-> impl Future<Output = Result<lor_ranked_v1::Leaderboard>> + 'a
{
let path_string = "/lor/ranked/v1/leaderboards".to_owned();
self.base.get::<lor_ranked_v1::Leaderboard>("lor-ranked-v1.getLeaderboards", region.into(), path_string, None)
}
}
/// MatchV4 endpoints. This struct is automatically generated.
///
/// <a href="https://developer.riotgames.com/api-methods/#match-v4">Official API Reference</a>
@ -398,11 +426,12 @@ impl<'a> MatchV4<'a> {
/// * `encryptedAccountId` - The account ID.
/// * `champion` (optional) - Set of champion IDs for filtering the matchlist.
/// * `queue` (optional) - Set of queue IDs for filtering the matchlist.
/// * `season` (optional) - Set of season IDs for filtering the matchlist.
/// * `endTime` (optional) - The end time to use for filtering matchlist specified as epoch milliseconds. If beginTime is specified, but not endTime, then endTime defaults to the the current unix timestamp in milliseconds (the maximum time range limitation is not observed in this specific case). If endTime is specified, but not beginTime, then beginTime defaults to the start of the account's match history returning a 400 due to the maximum time range limitation. If both are specified, then endTime should be greater than beginTime. The maximum time range allowed is one week, otherwise a 400 error code is returned.
/// * `beginTime` (optional) - The begin time to use for filtering matchlist specified as epoch milliseconds. If beginTime is specified, but not endTime, then endTime defaults to the the current unix timestamp in milliseconds (the maximum time range limitation is not observed in this specific case). If endTime is specified, but not beginTime, then beginTime defaults to the start of the account's match history returning a 400 due to the maximum time range limitation. If both are specified, then endTime should be greater than beginTime. The maximum time range allowed is one week, otherwise a 400 error code is returned.
/// * `endIndex` (optional) - The end index to use for filtering matchlist. If beginIndex is specified, but not endIndex, then endIndex defaults to beginIndex+100. If endIndex is specified, but not beginIndex, then beginIndex defaults to 0. If both are specified, then endIndex must be greater than beginIndex. The maximum range allowed is 100, otherwise a 400 error code is returned.
/// * `beginIndex` (optional) - The begin index to use for filtering matchlist. If beginIndex is specified, but not endIndex, then endIndex defaults to beginIndex+100. If endIndex is specified, but not beginIndex, then beginIndex defaults to 0. If both are specified, then endIndex must be greater than beginIndex. The maximum range allowed is 100, otherwise a 400 error code is returned.
pub fn get_matchlist(&self, region: Region, encrypted_account_id: &str, begin_time: Option<i64>, begin_index: Option<i32>, champion: Option<std::vec::Vec<crate::consts::Champion>>, end_time: Option<i64>, end_index: Option<i32>, queue: Option<std::vec::Vec<crate::consts::Queue>>)
pub fn get_matchlist(&self, region: Region, encrypted_account_id: &str, begin_time: Option<i64>, begin_index: Option<i32>, champion: Option<std::vec::Vec<crate::consts::Champion>>, end_time: Option<i64>, end_index: Option<i32>, queue: Option<std::vec::Vec<crate::consts::Queue>>, season: Option<std::vec::Vec<crate::consts::Season>>)
-> impl Future<Output = Result<Option<match_v4::Matchlist>>> + 'a
{
let mut query_params = Serializer::new(String::new());
@ -412,6 +441,7 @@ impl<'a> MatchV4<'a> {
if let Some(end_time) = end_time { query_params.append_pair("endTime", &*end_time.to_string()); };
if let Some(end_index) = end_index { query_params.append_pair("endIndex", &*end_index.to_string()); };
if let Some(queue) = queue { query_params.extend_pairs(queue.iter().map(|w| ("queue", Into::<u16>::into(*w).to_string()))); };
if let Some(season) = season { query_params.extend_pairs(season.iter().map(|w| ("season", Into::<u8>::into(*w).to_string()))); };
let query_string = query_params.finish();
let path_string = format!("/lol/match/v4/matchlists/by-account/{}", encrypted_account_id);
self.base.get_optional::<match_v4::Matchlist>("match-v4.getMatchlist", region.into(), path_string, Some(query_string))

View File

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 8de91254196abf157d29b578bfe2d3d49b29ba8a
// Version 66d2fb48666dc3be590d1860a2a57a53ffd70d0c
//! Automatically generated data transfer structs.
@ -148,12 +148,12 @@ pub mod league_v4 {
pub hot_streak: bool,
#[serde(rename = "miniSeries")]
pub mini_series: Option<MiniSeries>,
/// Winning team on Summoners Rift. First placement in Teamfight Tactics.
/// Winning team on Summoners Rift.
#[serde(rename = "wins")]
pub wins: i32,
#[serde(rename = "veteran")]
pub veteran: bool,
/// Losing team on Summoners Rift. Second through eighth placement in Teamfight Tactics.
/// Losing team on Summoners Rift.
#[serde(rename = "losses")]
pub losses: i32,
#[serde(rename = "freshBlood")]
@ -162,7 +162,7 @@ pub mod league_v4 {
pub inactive: bool,
#[serde(rename = "rank")]
pub rank: crate::consts::Division,
/// Player's summonerId (Encrypted)
/// Player's encrypted summonerId.
#[serde(rename = "summonerId")]
pub summoner_id: String,
#[serde(rename = "leaguePoints")]
@ -193,12 +193,12 @@ pub mod league_v4 {
pub hot_streak: bool,
#[serde(rename = "miniSeries")]
pub mini_series: Option<MiniSeries>,
/// Winning team on Summoners Rift. First placement in Teamfight Tactics.
/// Winning team on Summoners Rift.
#[serde(rename = "wins")]
pub wins: i32,
#[serde(rename = "veteran")]
pub veteran: bool,
/// Losing team on Summoners Rift. Second through eighth placement in Teamfight Tactics.
/// Losing team on Summoners Rift.
#[serde(rename = "losses")]
pub losses: i32,
#[serde(rename = "rank")]
@ -211,7 +211,7 @@ pub mod league_v4 {
pub fresh_blood: bool,
#[serde(rename = "tier")]
pub tier: crate::consts::Tier,
/// Player's summonerId (Encrypted)
/// Player's encrypted summonerId.
#[serde(rename = "summonerId")]
pub summoner_id: String,
#[serde(rename = "leaguePoints")]
@ -297,6 +297,28 @@ pub mod lol_status_v3 {
}
}
/// LorRankedV1 data objects. This module is automatically generated.
#[allow(dead_code)]
pub mod lor_ranked_v1 {
/// Leaderboard data object. This struct is automatically generated.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Leaderboard {
/// A list of players in Master tier.
#[serde(rename = "players")]
pub players: std::vec::Vec<Player>,
}
/// Player data object. This struct is automatically generated.
#[derive(Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Player {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "rank")]
pub rank: i32,
}
}
/// MatchV4 data objects. This module is automatically generated.
#[allow(dead_code)]
pub mod match_v4 {