diff --git a/riven/src/consts/val_queue.rs b/riven/src/consts/val_queue.rs new file mode 100644 index 0000000..be027b6 --- /dev/null +++ b/riven/src/consts/val_queue.rs @@ -0,0 +1,36 @@ +#![cfg_attr(rustfmt, rustfmt_skip)] +/////////////////////////////////////////////// +// // +// ! // +// This file is automatically generated! // +// Do not directly edit! // +// // +/////////////////////////////////////////////// + +use strum_macros::{ EnumString, EnumVariantNames, IntoStaticStr }; + +/// Valorant queue string IDs. +#[non_exhaustive] +#[derive(Debug, Clone)] +#[derive(Eq, PartialEq, Hash)] +#[derive(EnumString, EnumVariantNames, IntoStaticStr)] +#[repr(u8)] +pub enum ValQueue { + /// Catch-all variant for new, unknown queue IDs. + #[strum(default)] + UNKNOWN(String), + + COMPETITIVE = "competitive", + UNRATED = "unrated", + SPIKE_RUSH = "spikerush", + TOURNAMENT_MODE = "tournamentmode", + DEATHMATCH = "deathmatch", + /// One-for-all + REPLICATION = "onefa", + ESCALATION = "ggteam", + TEAM_DEATHMATCH = "hurm", + PEARL = "newmap", + SWIFTPLAY = "swiftplay", +} + +serde_strum_unknown!(ValQueue); diff --git a/riven/srcgen/consts/val_queue.rs.dt b/riven/srcgen/consts/val_queue.rs.dt new file mode 100644 index 0000000..cd25a32 --- /dev/null +++ b/riven/srcgen/consts/val_queue.rs.dt @@ -0,0 +1,32 @@ +{{ + const dotUtils = require('./dotUtils.js'); + const valQueues = require('./.valQueues.json'); +}}{{= dotUtils.preamble() }} + +use strum_macros::{ EnumString, EnumVariantNames, IntoStaticStr }; + +/// Valorant queue string IDs. +#[non_exhaustive] +#[derive(Debug, Clone)] +#[derive(Eq, PartialEq, Hash)] +#[derive(EnumString, EnumVariantNames, IntoStaticStr)] +#[repr(u8)] +pub enum ValQueue { + /// Catch-all variant for new, unknown queue IDs. + #[strum(default)] + UNKNOWN(String), + +{{ + for (const e of valQueues) { + const desc = e['x-desc'] ? e['x-desc'].split('\n') : []; +}} +{{~ desc :line }} + /// {{= line }} +{{~}} + {{= e['x-name'] }} = {{= JSON.stringify(e['x-value']) }}, +{{ + } +}} +} + +serde_strum_unknown!(ValQueue); diff --git a/riven/tests/tests_val_match_latam_na_br.rs b/riven/tests/tests_val_match_latam_na_br.rs index 4a38926..4f23128 100644 --- a/riven/tests/tests_val_match_latam_na_br.rs +++ b/riven/tests/tests_val_match_latam_na_br.rs @@ -1,6 +1,6 @@ mod testutils; -use riven::consts::*; -use testutils::{riven_test, val_content_ranked, val_match_v1_get, val_match_v1_latest}; +use riven::{consts::*, models::val_match_v1::MatchlistEntry}; +use testutils::{riot_api, riven_test, val_content_ranked, val_match_v1_get, val_match_v1_latest}; const ROUTE: ValPlatformRoute = ValPlatformRoute::NA; @@ -23,3 +23,21 @@ async fn val_content_ranked_test() -> Result<(), String> { async fn val_match_v1_latest_test() -> Result<(), String> { val_match_v1_latest(ROUTE).await } + +#[riven_test] +async fn val_match_v1_get_matchlist_theuscon() -> Result<(), String> { + let account = riot_api() + .account_v1() + .get_by_riot_id(RegionalRoute::AMERICAS, "Theusçon", "8119") + .await + .map_err(|e| format!("Failed to get account: {}", e))? + .ok_or_else(|| "Account not found!".to_owned())?; + + let matchlist = riot_api() + .val_match_v1() + .get_matchlist(ROUTE, &account.puuid) + .await + .map_err(|e| format!("Failed to get matchlist: {}", e))?; + + val_match_v1_get(ROUTE, matchlist.history.into_iter().map(|entry| entry.match_id)).await +}