forked from mirror/Riven
1
0
Fork 0

Regen for tournament-v5 endpoints, new `match-v5.ObjectivesDto.horde` field

`horde`: https://github.com/RiotGames/developer-relations/issues/829
v/2.x.x
Mingwei Samuel 2023-10-13 09:56:46 -07:00
parent c4a9993ac2
commit 2661acf5e9
3 changed files with 323 additions and 8 deletions

View File

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version e4a5ce3f63911af22ef752e7f5844f4cc4086f0b
// Version 5b5ceda174ed782d6e9a60f743e888822c710be1
//! Automatically generated endpoint handles.
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
@ -242,6 +242,15 @@ impl RiotApi {
pub fn tournament_v4(&self) -> TournamentV4 {
TournamentV4 { base: self }
}
/// Returns a handle for accessing [TournamentV5](crate::endpoints::TournamentV5) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-v5" target="_blank">`tournament-v5`</a>
///
/// Note: this method is automatically generated.
#[inline]
pub fn tournament_v5(&self) -> TournamentV5 {
TournamentV5 { base: self }
}
/// Returns a handle for accessing [ValContentV1](crate::endpoints::ValContentV1) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#val-content-v1" target="_blank">`val-content-v1`</a>
@ -1519,15 +1528,17 @@ impl<'a> TftLeagueV1<'a> {
/// Get the challenger league.
/// # Parameters
/// * `route` - Route to query.
/// * `queue` (optional, in query) - Defaults to RANKED_TFT.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getChallengerLeague" target="_blank">`tft-league-v1.getChallengerLeague`</a>
///
/// Note: this method is automatically generated.
pub fn get_challenger_league(&self, route: PlatformRoute)
pub fn get_challenger_league(&self, route: PlatformRoute, queue: Option<&str>)
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, "/tft/league/v1/challenger");
let request = if let Some(queue) = queue { request.query(&[ ("queue", queue) ]) } else { request };
let future = self.base.execute_val::<tft_league_v1::LeagueList>("tft-league-v1.getChallengerLeague", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tft-league-v1.getChallengerLeague"));
@ -1558,17 +1569,19 @@ impl<'a> TftLeagueV1<'a> {
/// * `route` - Route to query.
/// * `tier` (required, in path)
/// * `division` (required, in path)
/// * `queue` (optional, in query) - Defaults to RANKED_TFT.
/// * `page` (optional, in query) - Defaults to 1. Starts with page 1.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getLeagueEntries" target="_blank">`tft-league-v1.getLeagueEntries`</a>
///
/// Note: this method is automatically generated.
pub fn get_league_entries(&self, route: PlatformRoute, tier: crate::consts::Tier, division: &str, page: Option<i32>)
pub fn get_league_entries(&self, route: PlatformRoute, tier: crate::consts::Tier, division: &str, page: Option<i32>, queue: Option<&str>)
-> impl Future<Output = Result<Vec<tft_league_v1::LeagueEntry>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/tft/league/v1/entries/{}/{}", tier, division));
let request = if let Some(page) = page { request.query(&[ ("page", page) ]) } else { request };
let request = if let Some(queue) = queue { request.query(&[ ("queue", queue) ]) } else { request };
let future = self.base.execute_val::<Vec<tft_league_v1::LeagueEntry>>("tft-league-v1.getLeagueEntries", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tft-league-v1.getLeagueEntries"));
@ -1578,15 +1591,17 @@ impl<'a> TftLeagueV1<'a> {
/// Get the grandmaster league.
/// # Parameters
/// * `route` - Route to query.
/// * `queue` (optional, in query) - Defaults to RANKED_TFT.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getGrandmasterLeague" target="_blank">`tft-league-v1.getGrandmasterLeague`</a>
///
/// Note: this method is automatically generated.
pub fn get_grandmaster_league(&self, route: PlatformRoute)
pub fn get_grandmaster_league(&self, route: PlatformRoute, queue: Option<&str>)
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, "/tft/league/v1/grandmaster");
let request = if let Some(queue) = queue { request.query(&[ ("queue", queue) ]) } else { request };
let future = self.base.execute_val::<tft_league_v1::LeagueList>("tft-league-v1.getGrandmasterLeague", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tft-league-v1.getGrandmasterLeague"));
@ -1615,15 +1630,17 @@ impl<'a> TftLeagueV1<'a> {
/// Get the master league.
/// # Parameters
/// * `route` - Route to query.
/// * `queue` (optional, in query) - Defaults to RANKED_TFT.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tft-league-v1/GET_getMasterLeague" target="_blank">`tft-league-v1.getMasterLeague`</a>
///
/// Note: this method is automatically generated.
pub fn get_master_league(&self, route: PlatformRoute)
pub fn get_master_league(&self, route: PlatformRoute, queue: Option<&str>)
-> impl Future<Output = Result<tft_league_v1::LeagueList>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, "/tft/league/v1/master");
let request = if let Some(queue) = queue { request.query(&[ ("queue", queue) ]) } else { request };
let future = self.base.execute_val::<tft_league_v1::LeagueList>("tft-league-v1.getMasterLeague", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tft-league-v1.getMasterLeague"));
@ -2187,6 +2204,139 @@ impl<'a> TournamentV4<'a> {
}
/// TournamentV5 endpoints handle, accessed by calling [`tournament_v5()`](crate::RiotApi::tournament_v5) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-v5" target="_blank">`tournament-v5`</a>
///
/// Note: this struct is automatically generated.
#[repr(transparent)]
pub struct TournamentV5<'a> {
base: &'a RiotApi,
}
impl<'a> TournamentV5<'a> {
/// Create a tournament code for the given tournament.
/// # Parameters
/// * `route` - Route to query.
/// * `tournament_id` (required, in query) - The tournament ID
/// * `count` (optional, in query) - The number of codes to create (max 1000)
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/POST_createTournamentCode" target="_blank">`tournament-v5.createTournamentCode`</a>
///
/// Note: this method is automatically generated.
pub fn create_tournament_code(&self, route: RegionalRoute, body: &tournament_v5::TournamentCodeParametersV5, tournament_id: i64, count: Option<i32>)
-> impl Future<Output = Result<Vec<String>>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v5/codes");
let request = request.query(&[ ("tournamentId", tournament_id) ]);
let request = if let Some(count) = count { request.query(&[ ("count", count) ]) } else { request };
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<Vec<String>>("tournament-v5.createTournamentCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.createTournamentCode"));
future
}
/// Returns the tournament code DTO associated with a tournament code string.
/// # Parameters
/// * `route` - Route to query.
/// * `tournament_code` (required, in path) - The tournament code string.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/GET_getTournamentCode" target="_blank">`tournament-v5.getTournamentCode`</a>
///
/// Note: this method is automatically generated.
pub fn get_tournament_code(&self, route: RegionalRoute, tournament_code: &str)
-> impl Future<Output = Result<tournament_v5::TournamentCodeV5>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v5/codes/{}", tournament_code));
let future = self.base.execute_val::<tournament_v5::TournamentCodeV5>("tournament-v5.getTournamentCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.getTournamentCode"));
future
}
/// Update the pick type, map, spectator type, or allowed puuids for a code.
/// # Parameters
/// * `route` - Route to query.
/// * `tournament_code` (required, in path) - The tournament code to update
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/PUT_updateCode" target="_blank">`tournament-v5.updateCode`</a>
///
/// Note: this method is automatically generated.
pub fn update_code(&self, route: RegionalRoute, body: &tournament_v5::TournamentCodeUpdateParametersV5, tournament_code: &str)
-> impl Future<Output = Result<()>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::PUT, route_str, &format!("/lol/tournament/v5/codes/{}", tournament_code));
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute("tournament-v5.updateCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.updateCode"));
future
}
/// Gets a list of lobby events by tournament code.
/// # Parameters
/// * `route` - Route to query.
/// * `tournament_code` (required, in path) - The short code to look up lobby events for
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/GET_getLobbyEventsByCode" target="_blank">`tournament-v5.getLobbyEventsByCode`</a>
///
/// Note: this method is automatically generated.
pub fn get_lobby_events_by_code(&self, route: RegionalRoute, tournament_code: &str)
-> impl Future<Output = Result<tournament_v5::LobbyEventV5Wrapper>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v5/lobby-events/by-code/{}", tournament_code));
let future = self.base.execute_val::<tournament_v5::LobbyEventV5Wrapper>("tournament-v5.getLobbyEventsByCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.getLobbyEventsByCode"));
future
}
/// Creates a tournament provider and returns its ID.
/// ## Implementation Notes
/// Providers will need to call this endpoint first to register their callback URL and their API key with the tournament system before any other tournament provider endpoints will work.
/// # Parameters
/// * `route` - Route to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/POST_registerProviderData" target="_blank">`tournament-v5.registerProviderData`</a>
///
/// Note: this method is automatically generated.
pub fn register_provider_data(&self, route: RegionalRoute, body: &tournament_v5::ProviderRegistrationParametersV5)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v5/providers");
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<i32>("tournament-v5.registerProviderData", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.registerProviderData"));
future
}
/// Creates a tournament and returns its ID.
/// # Parameters
/// * `route` - Route to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v5/POST_registerTournament" target="_blank">`tournament-v5.registerTournament`</a>
///
/// Note: this method is automatically generated.
pub fn register_tournament(&self, route: RegionalRoute, body: &tournament_v5::TournamentRegistrationParametersV5)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v5/tournaments");
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<i32>("tournament-v5.registerTournament", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v5.registerTournament"));
future
}
}
/// ValContentV1 endpoints handle, accessed by calling [`val_content_v1()`](crate::RiotApi::val_content_v1) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#val-content-v1" target="_blank">`val-content-v1`</a>

View File

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version e4a5ce3f63911af22ef752e7f5844f4cc4086f0b
// Version 5b5ceda174ed782d6e9a60f743e888822c710be1
//! Metadata about the Riot API and Riven.
//!
@ -15,7 +15,7 @@
/// Metadata for endpoints. Each tuple corresponds to one endpoint and contains
/// the HTTP [`Method`](reqwest::Method), `str` path, and the method's `str` ID.
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 88] = [
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 94] = [
(reqwest::Method::GET, "/riot/account/v1/accounts/by-puuid/{puuid}", "account-v1.getByPuuid"),
(reqwest::Method::GET, "/riot/account/v1/accounts/by-riot-id/{gameName}/{tagLine}", "account-v1.getByRiotId"),
(reqwest::Method::GET, "/riot/account/v1/accounts/me", "account-v1.getByAccessToken"),
@ -98,6 +98,12 @@ pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 88] = [
(reqwest::Method::GET, "/lol/tournament/v4/lobby-events/by-code/{tournamentCode}", "tournament-v4.getLobbyEventsByCode"),
(reqwest::Method::POST, "/lol/tournament/v4/providers", "tournament-v4.registerProviderData"),
(reqwest::Method::POST, "/lol/tournament/v4/tournaments", "tournament-v4.registerTournament"),
(reqwest::Method::POST, "/lol/tournament/v5/codes", "tournament-v5.createTournamentCode"),
(reqwest::Method::GET, "/lol/tournament/v5/codes/{tournamentCode}", "tournament-v5.getTournamentCode"),
(reqwest::Method::PUT, "/lol/tournament/v5/codes/{tournamentCode}", "tournament-v5.updateCode"),
(reqwest::Method::GET, "/lol/tournament/v5/lobby-events/by-code/{tournamentCode}", "tournament-v5.getLobbyEventsByCode"),
(reqwest::Method::POST, "/lol/tournament/v5/providers", "tournament-v5.registerProviderData"),
(reqwest::Method::POST, "/lol/tournament/v5/tournaments", "tournament-v5.registerTournament"),
(reqwest::Method::GET, "/val/content/v1/contents", "val-content-v1.getContent"),
(reqwest::Method::GET, "/val/match/v1/matches/{matchId}", "val-match-v1.getMatch"),
(reqwest::Method::GET, "/val/match/v1/matchlists/by-puuid/{puuid}", "val-match-v1.getMatchlist"),

View File

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version e4a5ce3f63911af22ef752e7f5844f4cc4086f0b
// Version 5b5ceda174ed782d6e9a60f743e888822c710be1
#![allow(missing_docs)]
@ -1413,6 +1413,9 @@ pub mod match_v5 {
pub rift_herald: Objective,
#[serde(rename = "tower")]
pub tower: Objective,
#[serde(rename = "horde")]
#[serde(skip_serializing_if = "Option::is_none")]
pub horde: Option<Objective>,
}
/// Objective data object.
#[derive(Clone, Debug)]
@ -3255,6 +3258,162 @@ pub mod tournament_v4 {
}
}
/// Data structs used by [`TournamentV5`](crate::endpoints::TournamentV5).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod tournament_v5 {
/// TournamentCodeParametersV5 data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCodeParametersV5 {
/// Optional list of encrypted puuids in order to validate the players eligible to join the lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and teamTwo. We may add the ability to enforce at the team level in the future.
#[serde(rename = "allowedParticipants")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_participants: Option<std::vec::Vec<String>>,
/// Optional string that may contain any data in any format, if specified at all. Used to denote any custom information about the game.
#[serde(rename = "metadata")]
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<String>,
/// The team size of the game. Valid values are 1-5.
#[serde(rename = "teamSize")]
pub team_size: i32,
/// The pick type of the game.<br>
/// (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT)
#[serde(rename = "pickType")]
pub pick_type: String,
/// The map type of the game.<br>
/// (Legal values: SUMMONERS_RIFT, HOWLING_ABYSS)
#[serde(rename = "mapType")]
pub map_type: String,
/// The spectator type of the game.<br>
/// (Legal values: NONE, LOBBYONLY, ALL)
#[serde(rename = "spectatorType")]
pub spectator_type: String,
/// Checks if allowed participants are enough to make full teams.
#[serde(rename = "enoughPlayers")]
pub enough_players: bool,
}
/// TournamentCodeV5 data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCodeV5 {
/// The tournament code.
#[serde(rename = "code")]
pub code: String,
/// The spectator mode for the tournament code game.
#[serde(rename = "spectators")]
pub spectators: String,
/// The lobby name for the tournament code game.
#[serde(rename = "lobbyName")]
pub lobby_name: String,
/// The metadata for tournament code.
#[serde(rename = "metaData")]
pub meta_data: String,
/// The password for the tournament code game.
#[serde(rename = "password")]
pub password: String,
/// The team size for the tournament code game.
#[serde(rename = "teamSize")]
pub team_size: i32,
/// The provider's ID.
#[serde(rename = "providerId")]
pub provider_id: i32,
/// The pick mode for tournament code game.
#[serde(rename = "pickType")]
pub pick_type: String,
/// The tournament's ID.
#[serde(rename = "tournamentId")]
pub tournament_id: i32,
/// The tournament code's ID.
#[serde(rename = "id")]
pub id: i32,
/// The tournament code's region.<br>
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR, KR)
#[serde(rename = "region")]
pub region: String,
/// The game map for the tournament code game
#[serde(rename = "map")]
pub map: String,
/// The puuids of the participants (Encrypted)
#[serde(rename = "participants")]
pub participants: std::vec::Vec<String>,
}
/// TournamentCodeUpdateParametersV5 data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCodeUpdateParametersV5 {
/// Optional list of encrypted puuids in order to validate the players eligible to join the lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and teamTwo. We may add the ability to enforce at the team level in the future.
#[serde(rename = "allowedParticipants")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_participants: Option<std::vec::Vec<String>>,
/// The pick type<br>
/// (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT)
#[serde(rename = "pickType")]
pub pick_type: String,
/// The map type<br>
/// (Legal values: SUMMONERS_RIFT, HOWLING_ABYSS)
#[serde(rename = "mapType")]
pub map_type: String,
/// The spectator type<br>
/// (Legal values: NONE, LOBBYONLY, ALL)
#[serde(rename = "spectatorType")]
pub spectator_type: String,
}
/// LobbyEventV5Wrapper data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LobbyEventV5Wrapper {
#[serde(rename = "eventList")]
pub event_list: std::vec::Vec<LobbyEventV5>,
}
/// LobbyEventV5 data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LobbyEventV5 {
/// Timestamp from the event
#[serde(rename = "timestamp")]
pub timestamp: String,
/// The type of event that was triggered
#[serde(rename = "eventType")]
pub event_type: String,
/// The puuid that triggered the event (Encrypted)
#[serde(rename = "puuid")]
pub puuid: String,
}
/// ProviderRegistrationParametersV5 data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct ProviderRegistrationParametersV5 {
/// The region in which the provider will be running tournaments.<br>
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR, KR)
#[serde(rename = "region")]
pub region: String,
/// The provider's callback URL to which tournament game results in this region should be posted. The URL must be well-formed, use the http or https protocol, and use the default port for the protocol (http URLs must use port 80, https URLs must use port 443).
#[serde(rename = "url")]
pub url: String,
}
/// TournamentRegistrationParametersV5 data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentRegistrationParametersV5 {
/// The provider ID to specify the regional registered provider data to associate this tournament.
#[serde(rename = "providerId")]
pub provider_id: i32,
/// The optional name of the tournament.
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
}
/// Data structs used by [`ValContentV1`](crate::endpoints::ValContentV1).
///
/// Note: this module is automatically generated.