speedrun_api/types/
leaderboards.rs1use std::collections::HashMap;
2
3use serde::Deserialize;
4
5use crate::api::{
6 categories::CategoryId, games::GameId, levels::LevelId, platforms::PlatformId,
7 regions::RegionId, variables::VariableId,
8};
9
10use super::{common::TimingMethod, Link, Run};
11
12#[derive(Debug, Clone, PartialEq, Deserialize)]
13#[serde(rename_all = "kebab-case")]
14pub struct Leaderboard<'a> {
15 pub weblink: String,
16 pub game: GameId<'a>,
17 pub category: CategoryId<'a>,
18 #[serde(default)]
19 pub level: Option<LevelId<'a>>,
20 #[serde(default)]
21 pub platform: Option<PlatformId<'a>>,
22 #[serde(default)]
23 pub region: Option<RegionId<'a>>,
24 #[serde(default)]
25 pub emulators: Option<bool>,
26 pub video_only: bool,
27 #[serde(default)]
28 pub timing: Option<TimingMethod>,
29 #[serde(default)]
30 pub values: HashMap<VariableId<'a>, String>,
31 pub runs: Vec<RankedRun<'a>>,
32 pub links: Vec<Link>,
33}
34
35#[derive(Debug, Clone, PartialEq, Deserialize)]
36#[serde(rename_all = "kebab-case")]
37pub struct RankedRun<'a> {
38 pub place: i64,
39 pub run: Run<'a>,
40}