update tests from tournament_v4 to tournament_v5

This commit is contained in:
Mingwei Samuel 2023-10-17 22:57:10 -07:00
parent fb95601526
commit dc73fcbf46
5 changed files with 47 additions and 540 deletions

View file

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 5b5ceda174ed782d6e9a60f743e888822c710be1
// Version 95a5cf31a385d91b952e19190af5a828d2e60ed8
//! Automatically generated endpoint handles.
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
@ -215,15 +215,6 @@ impl RiotApi {
pub fn tft_summoner_v1(&self) -> TftSummonerV1 {
TftSummonerV1 { base: self }
}
/// Returns a handle for accessing [TournamentStubV4](crate::endpoints::TournamentStubV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v4" target="_blank">`tournament-stub-v4`</a>
///
/// Note: this method is automatically generated.
#[inline]
pub fn tournament_stub_v4(&self) -> TournamentStubV4 {
TournamentStubV4 { base: self }
}
/// Returns a handle for accessing [TournamentStubV5](crate::endpoints::TournamentStubV5) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v5" target="_blank">`tournament-stub-v5`</a>
@ -233,15 +224,6 @@ impl RiotApi {
pub fn tournament_stub_v5(&self) -> TournamentStubV5 {
TournamentStubV5 { base: self }
}
/// Returns a handle for accessing [TournamentV4](crate::endpoints::TournamentV4) endpoints.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-v4" target="_blank">`tournament-v4`</a>
///
/// Note: this method is automatically generated.
#[inline]
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>
@ -1864,100 +1846,6 @@ impl<'a> TftSummonerV1<'a> {
}
/// TournamentStubV4 endpoints handle, accessed by calling [`tournament_stub_v4()`](crate::RiotApi::tournament_stub_v4) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v4" target="_blank">`tournament-stub-v4`</a>
///
/// Note: this struct is automatically generated.
#[repr(transparent)]
pub struct TournamentStubV4<'a> {
base: &'a RiotApi,
}
impl<'a> TournamentStubV4<'a> {
/// Create a mock tournament code for the given tournament.
/// # Parameters
/// * `route` - Route to query.
/// * `count` (optional, in query) - The number of codes to create (max 1000)
/// * `tournament_id` (required, in query) - The tournament ID
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/POST_createTournamentCode" target="_blank">`tournament-stub-v4.createTournamentCode`</a>
///
/// Note: this method is automatically generated.
pub fn create_tournament_code(&self, route: RegionalRoute, body: &tournament_stub_v4::TournamentCodeParameters, 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-stub/v4/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-stub-v4.createTournamentCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-stub-v4.createTournamentCode"));
future
}
/// Gets a mock 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-stub-v4/GET_getLobbyEventsByCode" target="_blank">`tournament-stub-v4.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_stub_v4::LobbyEventWrapper>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament-stub/v4/lobby-events/by-code/{}", tournament_code));
let future = self.base.execute_val::<tournament_stub_v4::LobbyEventWrapper>("tournament-stub-v4.getLobbyEventsByCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-stub-v4.getLobbyEventsByCode"));
future
}
/// Creates a mock 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-stub-v4/POST_registerProviderData" target="_blank">`tournament-stub-v4.registerProviderData`</a>
///
/// Note: this method is automatically generated.
pub fn register_provider_data(&self, route: RegionalRoute, body: &tournament_stub_v4::ProviderRegistrationParameters)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v4/providers");
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<i32>("tournament-stub-v4.registerProviderData", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-stub-v4.registerProviderData"));
future
}
/// Creates a mock tournament and returns its ID.
/// # Parameters
/// * `route` - Route to query.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-stub-v4/POST_registerTournament" target="_blank">`tournament-stub-v4.registerTournament`</a>
///
/// Note: this method is automatically generated.
pub fn register_tournament(&self, route: RegionalRoute, body: &tournament_stub_v4::TournamentRegistrationParameters)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament-stub/v4/tournaments");
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<i32>("tournament-stub-v4.registerTournament", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-stub-v4.registerTournament"));
future
}
}
/// TournamentStubV5 endpoints handle, accessed by calling [`tournament_stub_v5()`](crate::RiotApi::tournament_stub_v5) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-stub-v5" target="_blank">`tournament-stub-v5`</a>
@ -2071,139 +1959,6 @@ impl<'a> TournamentStubV5<'a> {
}
/// TournamentV4 endpoints handle, accessed by calling [`tournament_v4()`](crate::RiotApi::tournament_v4) on a [`RiotApi`](crate::RiotApi) instance.
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/apis#tournament-v4" target="_blank">`tournament-v4`</a>
///
/// Note: this struct is automatically generated.
#[repr(transparent)]
pub struct TournamentV4<'a> {
base: &'a RiotApi,
}
impl<'a> TournamentV4<'a> {
/// Create a tournament code for the given tournament.
/// # Parameters
/// * `route` - Route to query.
/// * `count` (optional, in query) - The number of codes to create (max 1000)
/// * `tournament_id` (required, in query) - The tournament ID
/// # Riot Developer API Reference
/// <a href="https://developer.riotgames.com/api-methods/#tournament-v4/POST_createTournamentCode" target="_blank">`tournament-v4.createTournamentCode`</a>
///
/// Note: this method is automatically generated.
pub fn create_tournament_code(&self, route: RegionalRoute, body: &tournament_v4::TournamentCodeParameters, 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/v4/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-v4.createTournamentCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v4.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-v4/GET_getTournamentCode" target="_blank">`tournament-v4.getTournamentCode`</a>
///
/// Note: this method is automatically generated.
pub fn get_tournament_code(&self, route: RegionalRoute, tournament_code: &str)
-> impl Future<Output = Result<tournament_v4::TournamentCode>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v4/codes/{}", tournament_code));
let future = self.base.execute_val::<tournament_v4::TournamentCode>("tournament-v4.getTournamentCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v4.getTournamentCode"));
future
}
/// Update the pick type, map, spectator type, or allowed summoners 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-v4/PUT_updateCode" target="_blank">`tournament-v4.updateCode`</a>
///
/// Note: this method is automatically generated.
pub fn update_code(&self, route: RegionalRoute, body: &tournament_v4::TournamentCodeUpdateParameters, 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/v4/codes/{}", tournament_code));
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute("tournament-v4.updateCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v4.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-v4/GET_getLobbyEventsByCode" target="_blank">`tournament-v4.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_v4::LobbyEventWrapper>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::GET, route_str, &format!("/lol/tournament/v4/lobby-events/by-code/{}", tournament_code));
let future = self.base.execute_val::<tournament_v4::LobbyEventWrapper>("tournament-v4.getLobbyEventsByCode", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v4.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-v4/POST_registerProviderData" target="_blank">`tournament-v4.registerProviderData`</a>
///
/// Note: this method is automatically generated.
pub fn register_provider_data(&self, route: RegionalRoute, body: &tournament_v4::ProviderRegistrationParameters)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v4/providers");
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<i32>("tournament-v4.registerProviderData", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v4.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-v4/POST_registerTournament" target="_blank">`tournament-v4.registerTournament`</a>
///
/// Note: this method is automatically generated.
pub fn register_tournament(&self, route: RegionalRoute, body: &tournament_v4::TournamentRegistrationParameters)
-> impl Future<Output = Result<i32>> + 'a
{
let route_str = route.into();
let request = self.base.request(Method::POST, route_str, "/lol/tournament/v4/tournaments");
let request = request.body(serde_json::ser::to_vec(body).unwrap());
let future = self.base.execute_val::<i32>("tournament-v4.registerTournament", route_str, request);
#[cfg(feature = "tracing")]
let future = future.instrument(tracing::info_span!("tournament-v4.registerTournament"));
future
}
}
/// 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>

View file

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 5b5ceda174ed782d6e9a60f743e888822c710be1
// Version 95a5cf31a385d91b952e19190af5a828d2e60ed8
//! 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); 94] = [
pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 84] = [
(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"),
@ -83,21 +83,11 @@ pub static ALL_ENDPOINTS: [(reqwest::Method, &str, &str); 94] = [
(reqwest::Method::GET, "/tft/summoner/v1/summoners/by-puuid/{encryptedPUUID}", "tft-summoner-v1.getByPUUID"),
(reqwest::Method::GET, "/tft/summoner/v1/summoners/me", "tft-summoner-v1.getByAccessToken"),
(reqwest::Method::GET, "/tft/summoner/v1/summoners/{encryptedSummonerId}", "tft-summoner-v1.getBySummonerId"),
(reqwest::Method::POST, "/lol/tournament-stub/v4/codes", "tournament-stub-v4.createTournamentCode"),
(reqwest::Method::GET, "/lol/tournament-stub/v4/lobby-events/by-code/{tournamentCode}", "tournament-stub-v4.getLobbyEventsByCode"),
(reqwest::Method::POST, "/lol/tournament-stub/v4/providers", "tournament-stub-v4.registerProviderData"),
(reqwest::Method::POST, "/lol/tournament-stub/v4/tournaments", "tournament-stub-v4.registerTournament"),
(reqwest::Method::POST, "/lol/tournament-stub/v5/codes", "tournament-stub-v5.createTournamentCode"),
(reqwest::Method::GET, "/lol/tournament-stub/v5/codes/{tournamentCode}", "tournament-stub-v5.getTournamentCode"),
(reqwest::Method::GET, "/lol/tournament-stub/v5/lobby-events/by-code/{tournamentCode}", "tournament-stub-v5.getLobbyEventsByCode"),
(reqwest::Method::POST, "/lol/tournament-stub/v5/providers", "tournament-stub-v5.registerProviderData"),
(reqwest::Method::POST, "/lol/tournament-stub/v5/tournaments", "tournament-stub-v5.registerTournament"),
(reqwest::Method::POST, "/lol/tournament/v4/codes", "tournament-v4.createTournamentCode"),
(reqwest::Method::GET, "/lol/tournament/v4/codes/{tournamentCode}", "tournament-v4.getTournamentCode"),
(reqwest::Method::PUT, "/lol/tournament/v4/codes/{tournamentCode}", "tournament-v4.updateCode"),
(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"),

View file

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 5b5ceda174ed782d6e9a60f743e888822c710be1
// Version 95a5cf31a385d91b952e19190af5a828d2e60ed8
#![allow(missing_docs)]
@ -2886,91 +2886,6 @@ pub mod tft_summoner_v1 {
}
}
/// Data structs used by [`TournamentStubV4`](crate::endpoints::TournamentStubV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod tournament_stub_v4 {
/// TournamentCodeParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCodeParameters {
/// Optional list of encrypted summonerIds 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 = "allowedSummonerIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_summoner_ids: 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, TWISTED_TREELINE, 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,
}
/// LobbyEventWrapper data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LobbyEventWrapper {
#[serde(rename = "eventList")]
pub event_list: std::vec::Vec<LobbyEvent>,
}
/// LobbyEvent data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LobbyEvent {
/// The summonerId that triggered the event (Encrypted)
#[serde(rename = "summonerId")]
pub summoner_id: String,
/// The type of event that was triggered
#[serde(rename = "eventType")]
pub event_type: String,
/// Timestamp from the event
#[serde(rename = "timestamp")]
pub timestamp: String,
}
/// ProviderRegistrationParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct ProviderRegistrationParameters {
/// The region in which the provider will be running tournaments.<br>
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
#[serde(rename = "region")]
pub region: crate::consts::TournamentRegion,
/// 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,
}
/// TournamentRegistrationParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentRegistrationParameters {
/// 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 [`TournamentStubV5`](crate::endpoints::TournamentStubV5).
///
/// Note: this module is automatically generated.
@ -3105,159 +3020,6 @@ pub mod tournament_stub_v5 {
}
}
/// Data structs used by [`TournamentV4`](crate::endpoints::TournamentV4).
///
/// Note: this module is automatically generated.
#[allow(dead_code)]
pub mod tournament_v4 {
/// TournamentCodeParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCodeParameters {
/// Optional list of encrypted summonerIds 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 = "allowedSummonerIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_summoner_ids: 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, TWISTED_TREELINE, 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,
}
/// TournamentCode data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCode {
/// 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)
#[serde(rename = "region")]
pub region: String,
/// The game map for the tournament code game
#[serde(rename = "map")]
pub map: String,
/// The summonerIds of the participants (Encrypted)
#[serde(rename = "participants")]
pub participants: std::vec::Vec<String>,
}
/// TournamentCodeUpdateParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentCodeUpdateParameters {
/// Optional list of encrypted summonerIds 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 = "allowedSummonerIds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_summoner_ids: 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, TWISTED_TREELINE, 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,
}
/// LobbyEventWrapper data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LobbyEventWrapper {
#[serde(rename = "eventList")]
pub event_list: std::vec::Vec<LobbyEvent>,
}
/// LobbyEvent data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct LobbyEvent {
/// 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 summonerId that triggered the event (Encrypted)
#[serde(rename = "summonerId")]
pub summoner_id: String,
}
/// ProviderRegistrationParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct ProviderRegistrationParameters {
/// The region in which the provider will be running tournaments.<br>
/// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
#[serde(rename = "region")]
pub region: crate::consts::TournamentRegion,
/// 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,
}
/// TournamentRegistrationParameters data object.
#[derive(Clone, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "deny-unknown-fields", serde(deny_unknown_fields))]
pub struct TournamentRegistrationParameters {
/// 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 [`TournamentV5`](crate::endpoints::TournamentV5).
///
/// Note: this module is automatically generated.

View file

@ -8,7 +8,7 @@ use testutils::*;
use colored::*;
use riven::consts::*;
// use riven::models::tournament_stub_v4::*;
use riven::models::tournament_stub_v5::*;
const ROUTE: RegionalRoute = RegionalRoute::AMERICAS;
@ -22,52 +22,52 @@ static MATCHES: &[&str] = &[
async_tests! {
my_runner {
// TODO FAILING since 2022/11/28 https://github.com/MingweiSamuel/Riven/actions/runs/3571320200/jobs/6003088646
// // Champion Mastery tests.
// tournamentstub: async {
// let tsv4 = RIOT_API.tournament_stub_v4();
// let provider_id = tsv4.register_provider_data(ROUTE, &ProviderRegistrationParameters {
// region: PlatformRoute::NA1.as_region_str().to_owned(),
// url: "https://github.com/MingweiSamuel/Riven".to_owned(),
// })
// .await
// .map_err(|e| e.to_string())?;
// Champion Mastery tests.
tournamentstub: async {
let tsv4 = RIOT_API.tournament_stub_v5();
let provider_id = tsv4.register_provider_data(ROUTE, &ProviderRegistrationParametersV5 {
region: PlatformRoute::NA1.as_region_str().to_owned(),
url: "https://github.com/MingweiSamuel/Riven".to_owned(),
})
.await
.map_err(|e| e.to_string())?;
// println!("provider_id: {}", provider_id);
println!("provider_id: {}", provider_id);
// let tournament_id = tsv4.register_tournament(ROUTE, &TournamentRegistrationParameters {
// name: Some("Riven Tourney :)".to_owned()),
// provider_id,
// })
// .await
// .map_err(|e| e.to_string())?;
let tournament_id = tsv4.register_tournament(ROUTE, &TournamentRegistrationParametersV5 {
name: Some("Riven Tourney :)".to_owned()),
provider_id,
})
.await
.map_err(|e| e.to_string())?;
// println!("tournament_id: {}", tournament_id);
println!("tournament_id: {}", tournament_id);
// let codes_result = tsv4.create_tournament_code(ROUTE, &TournamentCodeParameters {
// map_type: "SUMMONERS_RIFT".to_owned(),
// metadata: Some("eW91IGZvdW5kIHRoZSBzZWNyZXQgbWVzc2FnZQ==".to_owned()),
// pick_type: "TOURNAMENT_DRAFT".to_owned(),
// spectator_type: "ALL".to_owned(),
// team_size: 5,
// allowed_summoner_ids: None,
// }, tournament_id as i64, Some(300))
// .await;
let codes_result = tsv4.create_tournament_code(ROUTE, &TournamentCodeParametersV5 {
map_type: "SUMMONERS_RIFT".to_owned(),
metadata: Some("eW91IGZvdW5kIHRoZSBzZWNyZXQgbWVzc2FnZQ==".to_owned()),
pick_type: "TOURNAMENT_DRAFT".to_owned(),
spectator_type: "ALL".to_owned(),
team_size: 5,
allowed_participants: None,
enough_players: false,
}, tournament_id as i64, Some(300))
.await;
// match codes_result {
// Ok(codes) => {
// rassert_eq!(300, codes.len());
// println!("codes: {}", codes.join(", "));
// Ok(())
// }
// Err(mut e) => {
// if let Some(response) = e.take_response() {
// eprintln!("{:?}", response.text().await);
// }
// Err(e.to_string())
// }
// }
// },
match codes_result {
Ok(codes) => {
rassert_eq!(300, codes.len());
println!("codes: {}", codes.join(", "));
Ok(())
}
Err(mut e) => {
if let Some(response) = e.take_response() {
eprintln!("{:?}", response.text().await);
}
Err(e.to_string())
}
}
},
match_v5_get: async {
match_v5_get(ROUTE, MATCHES).await

View file

@ -56,7 +56,7 @@ async_tests! {
},
// Make sure 403 is handled as expected.
tournament_forbidden: async {
let p = RIOT_API.tournament_v4().get_tournament_code(ROUTE.to_regional(), "INVALID_CODE");
let p = RIOT_API.tournament_v5().get_tournament_code(ROUTE.to_regional(), "INVALID_CODE");
let r = p.await;
rassert!(r.is_err());
rassert_eq!(Some(reqwest::StatusCode::FORBIDDEN), r.unwrap_err().status_code());