From 5846df1f76ab799869b8e9ac8c4da4aad9c2ccbc Mon Sep 17 00:00:00 2001 From: Baetens Jan Date: Wed, 15 Apr 2026 18:07:34 +0200 Subject: [PATCH 1/5] feat: implement many GW2 API endpoints Add serde_json dependency and implement endpoints for: - Achievements (achievements, categories, groups) - Daily rewards (dailycrafting, mapchests, worldbosses) - Story (backstory answers/questions, stories, story seasons) - Account sub-endpoints (achievements, dailycrafting, dungeons, dyes, finishers, gliders, home cats/nodes, inventory, luck, mailcarriers, mapchests, masteries, minis, mounts, outfits, pvp heroes, recipes, skins, titles, worldbosses) - Authenticated PvP (stats, games, standings) - Commerce transactions (current/history buy/sell) - Characters (Heropoints, Sab sub-endpoints) - Game mechanics (legends, masteries, mounts, outfits, pets, professions, races) and endpoint impls for skills, specializations, traits - Guild (guild, permissions, search, emblem, authenticated log/members/ranks/stash/treasury/teams/upgrades) - Guild upgrade endpoint impl - Items (finishers, materials) - PvP (amulets, ranks, seasons) - Misc (dungeons, files, quaggans, mini, title endpoint impls) - WvW (abilities, matches, objectives, ranks, upgrades) Use newtype wrappers for Vec endpoint types to avoid conflicting Endpoint impls for the same concrete type. --- http/tests/account_new.rs | 167 +++++++++++++++ http/tests/authenticated_new.rs | 56 +++++ http/tests/daily_rewards.rs | 33 +++ http/tests/game_mechanics.rs | 93 +++++++++ http/tests/guild.rs | 65 ++++++ http/tests/misc_new.rs | 63 ++++++ http/tests/pvp_new.rs | 31 +++ http/tests/story.rs | 38 ++++ http/tests/wvw.rs | 46 +++++ model/Cargo.toml | 3 + model/README.md | 147 +++++++------ model/src/achievements.rs | 45 ++++ model/src/authenticated.rs | 1 + model/src/authenticated/account.rs | 18 ++ .../authenticated/account/dailycrafting.rs | 14 ++ model/src/authenticated/account/dungeons.rs | 14 ++ model/src/authenticated/account/dyes.rs | 14 ++ model/src/authenticated/account/finishers.rs | 20 ++ model/src/authenticated/account/gliders.rs | 14 ++ model/src/authenticated/account/home.rs | 26 +++ model/src/authenticated/account/inventory.rs | 20 +- model/src/authenticated/account/luck.rs | 19 ++ .../src/authenticated/account/mailcarriers.rs | 14 ++ model/src/authenticated/account/mapchests.rs | 14 ++ model/src/authenticated/account/masteries.rs | 42 ++++ model/src/authenticated/account/minis.rs | 14 ++ model/src/authenticated/account/mounts.rs | 26 +++ model/src/authenticated/account/outfits.rs | 14 ++ model/src/authenticated/account/pvp.rs | 14 ++ model/src/authenticated/account/recipes.rs | 14 ++ model/src/authenticated/account/skins.rs | 14 ++ model/src/authenticated/account/titles.rs | 14 ++ .../src/authenticated/account/worldbosses.rs | 14 ++ model/src/authenticated/characters.rs | 63 ++++++ model/src/authenticated/commerce.rs | 58 ++++++ model/src/authenticated/pvp.rs | 93 +++++++++ model/src/daily_rewards.rs | 3 + model/src/daily_rewards/dailycrafting.rs | 22 ++ model/src/daily_rewards/mapchests.rs | 22 ++ model/src/daily_rewards/worldbosses.rs | 22 ++ model/src/game_mechanics.rs | 6 + model/src/game_mechanics/legends.rs | 24 +++ model/src/game_mechanics/masteries.rs | 37 ++++ model/src/game_mechanics/mounts.rs | 53 +++++ model/src/game_mechanics/outfits.rs | 23 +++ model/src/game_mechanics/pets.rs | 2 +- model/src/game_mechanics/professions.rs | 29 +++ model/src/game_mechanics/races.rs | 22 ++ model/src/game_mechanics/skills.rs | 49 +++++ model/src/game_mechanics/specializations.rs | 31 +++ model/src/game_mechanics/traits.rs | 30 +++ model/src/guild.rs | 3 + model/src/guild/authenticated.rs | 193 ++++++++++++++++++ model/src/guild/emblem.rs | 40 ++++ model/src/guild/guild.rs | 79 +++++++ model/src/guild/upgrades.rs | 43 ++++ model/src/items.rs | 2 + model/src/items/finishers.rs | 25 +++ model/src/items/materials.rs | 23 +++ model/src/lib.rs | 15 +- model/src/misc.rs | 3 + model/src/misc/dungeons.rs | 29 +++ model/src/misc/files.rs | 21 ++ model/src/misc/minis.rs | 25 +++ model/src/misc/quaggans.rs | 21 ++ model/src/misc/titles.rs | 24 +++ model/src/pvp.rs | 2 + model/src/pvp/amulets.rs | 25 +++ model/src/pvp/ranks.rs | 34 +++ model/src/pvp/seasons.rs | 43 ++++ model/src/story.rs | 2 + model/src/story/backstory.rs | 50 +++++ model/src/story/stories.rs | 57 ++++++ model/src/wvw.rs | 4 + model/src/wvw/abilities.rs | 32 +++ model/src/wvw/matches.rs | 46 +++++ model/src/wvw/objectives.rs | 31 +++ model/src/wvw/ranks.rs | 22 ++ model/src/wvw/upgrades.rs | 37 ++++ 79 files changed, 2564 insertions(+), 97 deletions(-) create mode 100644 http/tests/account_new.rs create mode 100644 http/tests/authenticated_new.rs create mode 100644 http/tests/daily_rewards.rs create mode 100644 http/tests/game_mechanics.rs create mode 100644 http/tests/guild.rs create mode 100644 http/tests/misc_new.rs create mode 100644 http/tests/pvp_new.rs create mode 100644 http/tests/story.rs create mode 100644 http/tests/wvw.rs create mode 100644 model/src/achievements.rs create mode 100644 model/src/authenticated/account/dailycrafting.rs create mode 100644 model/src/authenticated/account/dungeons.rs create mode 100644 model/src/authenticated/account/dyes.rs create mode 100644 model/src/authenticated/account/finishers.rs create mode 100644 model/src/authenticated/account/gliders.rs create mode 100644 model/src/authenticated/account/home.rs create mode 100644 model/src/authenticated/account/luck.rs create mode 100644 model/src/authenticated/account/mailcarriers.rs create mode 100644 model/src/authenticated/account/mapchests.rs create mode 100644 model/src/authenticated/account/masteries.rs create mode 100644 model/src/authenticated/account/minis.rs create mode 100644 model/src/authenticated/account/mounts.rs create mode 100644 model/src/authenticated/account/outfits.rs create mode 100644 model/src/authenticated/account/pvp.rs create mode 100644 model/src/authenticated/account/recipes.rs create mode 100644 model/src/authenticated/account/skins.rs create mode 100644 model/src/authenticated/account/titles.rs create mode 100644 model/src/authenticated/account/worldbosses.rs create mode 100644 model/src/authenticated/pvp.rs create mode 100644 model/src/daily_rewards.rs create mode 100644 model/src/daily_rewards/dailycrafting.rs create mode 100644 model/src/daily_rewards/mapchests.rs create mode 100644 model/src/daily_rewards/worldbosses.rs create mode 100644 model/src/game_mechanics/legends.rs create mode 100644 model/src/game_mechanics/masteries.rs create mode 100644 model/src/game_mechanics/mounts.rs create mode 100644 model/src/game_mechanics/outfits.rs create mode 100644 model/src/game_mechanics/professions.rs create mode 100644 model/src/game_mechanics/races.rs create mode 100644 model/src/guild/authenticated.rs create mode 100644 model/src/guild/emblem.rs create mode 100644 model/src/guild/guild.rs create mode 100644 model/src/items/finishers.rs create mode 100644 model/src/items/materials.rs create mode 100644 model/src/misc/dungeons.rs create mode 100644 model/src/misc/files.rs create mode 100644 model/src/misc/quaggans.rs create mode 100644 model/src/pvp/ranks.rs create mode 100644 model/src/pvp/seasons.rs create mode 100644 model/src/story.rs create mode 100644 model/src/story/backstory.rs create mode 100644 model/src/story/stories.rs create mode 100644 model/src/wvw/matches.rs create mode 100644 model/src/wvw/objectives.rs create mode 100644 model/src/wvw/ranks.rs create mode 100644 model/src/wvw/upgrades.rs diff --git a/http/tests/account_new.rs b/http/tests/account_new.rs new file mode 100644 index 0000000..9f3a02f --- /dev/null +++ b/http/tests/account_new.rs @@ -0,0 +1,167 @@ +#![cfg(feature = "blocking")] + +use gw2lib::{ + model::authenticated::account::{ + achievements::AccountAchievements, + dailycrafting::AccountDailyCrafting, + dungeons::AccountDungeons, + dyes::AccountDyes, + finishers::AccountFinishers, + gliders::AccountGliders, + home::{AccountHomeCats, AccountHomeNodes}, + inventory::AccountInventory, + luck::AccountLuckVec, + mailcarriers::AccountMailCarriers, + mapchests::AccountMapChests, + masteries::{AccountMasteries, AccountMasteryPoints}, + minis::AccountMinis, + mounts::{AccountMountSkins, AccountMountTypes}, + outfits::AccountOutfits, + pvp::AccountPvpHeroes, + recipes::AccountRecipes, + skins::AccountSkins, + titles::AccountTitles, + worldbosses::AccountWorldBosses, + }, + Requester, +}; + +pub mod setup; + +#[test] +fn account_achievements() { + let client = setup::setup(); + let _: AccountAchievements = client.get().unwrap(); +} + +#[test] +fn account_dailycrafting() { + let client = setup::setup(); + let _: AccountDailyCrafting = client.get().unwrap(); +} + +#[test] +fn account_dungeons() { + let client = setup::setup(); + let _: AccountDungeons = client.get().unwrap(); +} + +#[test] +fn account_dyes() { + let client = setup::setup(); + let _: AccountDyes = client.get().unwrap(); +} + +#[test] +fn account_finishers() { + let client = setup::setup(); + let _: AccountFinishers = client.get().unwrap(); +} + +#[test] +fn account_gliders() { + let client = setup::setup(); + let _: AccountGliders = client.get().unwrap(); +} + +#[test] +fn account_home_cats() { + let client = setup::setup(); + let _: AccountHomeCats = client.get().unwrap(); +} + +#[test] +fn account_home_nodes() { + let client = setup::setup(); + let _: AccountHomeNodes = client.get().unwrap(); +} + +#[test] +fn account_inventory() { + let client = setup::setup(); + let _: AccountInventory = client.get().unwrap(); +} + +#[test] +fn account_luck() { + let client = setup::setup(); + let _: AccountLuckVec = client.get().unwrap(); +} + +#[test] +fn account_mailcarriers() { + let client = setup::setup(); + let _: AccountMailCarriers = client.get().unwrap(); +} + +#[test] +fn account_mapchests() { + let client = setup::setup(); + let _: AccountMapChests = client.get().unwrap(); +} + +#[test] +fn account_masteries() { + let client = setup::setup(); + let _: AccountMasteries = client.get().unwrap(); +} + +#[test] +fn account_mastery_points() { + let client = setup::setup(); + let _: AccountMasteryPoints = client.get().unwrap(); +} + +#[test] +fn account_minis() { + let client = setup::setup(); + let _: AccountMinis = client.get().unwrap(); +} + +#[test] +fn account_mount_skins() { + let client = setup::setup(); + let _: AccountMountSkins = client.get().unwrap(); +} + +#[test] +fn account_mount_types() { + let client = setup::setup(); + let _: AccountMountTypes = client.get().unwrap(); +} + +#[test] +fn account_outfits() { + let client = setup::setup(); + let _: AccountOutfits = client.get().unwrap(); +} + +#[test] +fn account_pvp_heroes() { + let client = setup::setup(); + let _: AccountPvpHeroes = client.get().unwrap(); +} + +#[test] +fn account_recipes() { + let client = setup::setup(); + let _: AccountRecipes = client.get().unwrap(); +} + +#[test] +fn account_skins() { + let client = setup::setup(); + let _: AccountSkins = client.get().unwrap(); +} + +#[test] +fn account_titles() { + let client = setup::setup(); + let _: AccountTitles = client.get().unwrap(); +} + +#[test] +fn account_worldbosses() { + let client = setup::setup(); + let _: AccountWorldBosses = client.get().unwrap(); +} diff --git a/http/tests/authenticated_new.rs b/http/tests/authenticated_new.rs new file mode 100644 index 0000000..1866bd3 --- /dev/null +++ b/http/tests/authenticated_new.rs @@ -0,0 +1,56 @@ +#![cfg(feature = "blocking")] + +use gw2lib::{ + model::authenticated::{ + characters::Character, + pvp::{PvpStandings, PvpStats}, + commerce::{CurrentBuyTransactions, HistoryBuyTransactions}, + }, + Requester, +}; + +use crate::setup::character_name; + +pub mod setup; + +#[test] +fn heropoints() { + let client = setup::setup(); + use gw2lib::model::authenticated::characters::Heropoints; + let _: Heropoints = client.single(character_name()).unwrap(); +} + +#[test] +fn sab() { + let client = setup::setup(); + use gw2lib::model::authenticated::characters::Sab; + let char_ids: Vec = + client.ids::().unwrap(); + if let Some(name) = char_ids.first() { + let _: Sab = client.single(name.clone()).unwrap(); + } +} + +#[test] +fn pvp_stats() { + let client = setup::setup(); + let _: PvpStats = client.get().unwrap(); +} + +#[test] +fn pvp_standings() { + let client = setup::setup(); + let _: PvpStandings = client.get().unwrap(); +} + +#[test] +fn commerce_current_buys() { + let client = setup::setup(); + let _: CurrentBuyTransactions = client.get().unwrap(); +} + +#[test] +fn commerce_history_buys() { + let client = setup::setup(); + let _: HistoryBuyTransactions = client.get().unwrap(); +} diff --git a/http/tests/daily_rewards.rs b/http/tests/daily_rewards.rs new file mode 100644 index 0000000..f741f9a --- /dev/null +++ b/http/tests/daily_rewards.rs @@ -0,0 +1,33 @@ +#![cfg(feature = "blocking")] + +use gw2lib::{ + model::daily_rewards::{ + dailycrafting::DailyCrafting, + mapchests::MapChest, + worldbosses::WorldBoss, + }, + Requester, +}; + +pub mod setup; + +#[test] +fn dailycrafting() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); +} + +#[test] +fn mapchests() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); +} + +#[test] +fn worldbosses() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); +} diff --git a/http/tests/game_mechanics.rs b/http/tests/game_mechanics.rs new file mode 100644 index 0000000..756be0f --- /dev/null +++ b/http/tests/game_mechanics.rs @@ -0,0 +1,93 @@ +#![cfg(feature = "blocking")] + +use gw2lib::{ + model::game_mechanics::{ + legends::Legend, + masteries::Mastery, + mounts::{MountSkin, MountType}, + outfits::Outfit, + pets::Pet, + professions::ProfessionInfo, + races::Race, + skills::Skill, + specializations::Specialization, + traits::Trait, + }, + Requester, +}; + +pub mod setup; + +#[test] +fn masteries() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); + let _: Mastery = client.single(ids[0]).unwrap(); +} + +#[test] +fn mount_skins() { + let client = setup::setup(); + let _: MountSkin = client.single(1u32).unwrap(); +} + +#[test] +fn mount_types() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); +} + +#[test] +fn outfits() { + let client = setup::setup(); + let _: Outfit = client.single(1u32).unwrap(); +} + +#[test] +fn pets() { + let client = setup::setup(); + let _: Pet = client.single(1u32).unwrap(); +} + +#[test] +fn professions() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); + let _: ProfessionInfo = client.single(ids[0].clone()).unwrap(); +} + +#[test] +fn races() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); +} + +#[test] +fn skills() { + let client = setup::setup(); + let _: Skill = client.single(1110u32).unwrap(); +} + +#[test] +fn specializations() { + let client = setup::setup(); + let _: Specialization = client.single(1u16).unwrap(); +} + +#[test] +fn traits() { + let client = setup::setup(); + let _: Trait = client.single(214u16).unwrap(); +} + +#[test] +fn legends() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); + let _: Legend = client.single(ids[0].clone()).unwrap(); +} diff --git a/http/tests/guild.rs b/http/tests/guild.rs new file mode 100644 index 0000000..8b9f344 --- /dev/null +++ b/http/tests/guild.rs @@ -0,0 +1,65 @@ +#![cfg(feature = "blocking")] + +use gw2lib::{ + model::guild::{ + authenticated::{GuildLog, GuildMembers, GuildRanks}, + emblem::{EmblemBackground, EmblemForeground}, + guild::{Guild, GuildPermission}, + upgrades::GuildUpgrade, + }, + Requester, +}; + +pub mod setup; + +// Guild ID for "Fay Timewhisper" +const GUILD_ID: &str = "87B97E30-580E-E811-81A1-06AEA39922EA"; + +#[test] +fn guild_info() { + let client = setup::setup(); + let _: Guild = client.single(GUILD_ID.to_string()).unwrap(); +} + +#[test] +fn guild_permissions() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); +} + +#[test] +fn guild_upgrades() { + let client = setup::setup(); + let _: GuildUpgrade = client.single(38u64).unwrap(); +} + +#[test] +fn emblem_backgrounds() { + let client = setup::setup(); + let _: EmblemBackground = client.single(1u32).unwrap(); +} + +#[test] +fn emblem_foregrounds() { + let client = setup::setup(); + let _: EmblemForeground = client.single(1u32).unwrap(); +} + +#[test] +fn guild_log() { + let client = setup::setup(); + let _: GuildLog = client.single(GUILD_ID.to_string()).unwrap(); +} + +#[test] +fn guild_members() { + let client = setup::setup(); + let _: GuildMembers = client.single(GUILD_ID.to_string()).unwrap(); +} + +#[test] +fn guild_ranks() { + let client = setup::setup(); + let _: GuildRanks = client.single(GUILD_ID.to_string()).unwrap(); +} diff --git a/http/tests/misc_new.rs b/http/tests/misc_new.rs new file mode 100644 index 0000000..7ea6fb0 --- /dev/null +++ b/http/tests/misc_new.rs @@ -0,0 +1,63 @@ +#![cfg(feature = "blocking")] + +use gw2lib::{ + model::{ + misc::{ + dungeons::Dungeon, + files::GameFile, + minis::Mini, + quaggans::Quaggan, + titles::Title, + }, + items::{ + finishers::Finisher, + materials::MaterialCategory, + }, + }, + Requester, +}; + +pub mod setup; + +#[test] +fn dungeons() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); +} + +#[test] +fn files() { + let client = setup::setup(); + let _: GameFile = client.single("map_complete".to_string()).unwrap(); +} + +#[test] +fn quaggans() { + let client = setup::setup(); + let _: Quaggan = client.single("404".to_string()).unwrap(); +} + +#[test] +fn minis() { + let client = setup::setup(); + let _: Mini = client.single(1u64).unwrap(); +} + +#[test] +fn titles() { + let client = setup::setup(); + let _: Title = client.single(1u16).unwrap(); +} + +#[test] +fn finishers() { + let client = setup::setup(); + let _: Finisher = client.single(1u32).unwrap(); +} + +#[test] +fn materials() { + let client = setup::setup(); + let _: MaterialCategory = client.single(5u32).unwrap(); +} diff --git a/http/tests/pvp_new.rs b/http/tests/pvp_new.rs new file mode 100644 index 0000000..59d9567 --- /dev/null +++ b/http/tests/pvp_new.rs @@ -0,0 +1,31 @@ +#![cfg(feature = "blocking")] + +use gw2lib::{ + model::pvp::{ + amulets::Amulet, + ranks::PvpRank, + seasons::PvpSeason, + }, + Requester, +}; + +pub mod setup; + +#[test] +fn pvp_amulets() { + let client = setup::setup(); + let _: Amulet = client.single(4u16).unwrap(); +} + +#[test] +fn pvp_ranks() { + let client = setup::setup(); + let _: PvpRank = client.single(1u32).unwrap(); +} + +#[test] +fn pvp_seasons() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); +} diff --git a/http/tests/story.rs b/http/tests/story.rs new file mode 100644 index 0000000..941e445 --- /dev/null +++ b/http/tests/story.rs @@ -0,0 +1,38 @@ +#![cfg(feature = "blocking")] + +use gw2lib::{ + model::story::{ + backstory::{BackstoryAnswer, BackstoryQuestion}, + stories::{Story, StorySeason}, + }, + Requester, +}; + +pub mod setup; + +#[test] +fn backstory_answers() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); +} + +#[test] +fn backstory_questions() { + let client = setup::setup(); + let _: BackstoryQuestion = client.single(7u32).unwrap(); +} + +#[test] +fn stories() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); +} + +#[test] +fn story_seasons() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); +} diff --git a/http/tests/wvw.rs b/http/tests/wvw.rs new file mode 100644 index 0000000..8a6723b --- /dev/null +++ b/http/tests/wvw.rs @@ -0,0 +1,46 @@ +#![cfg(feature = "blocking")] + +use gw2lib::{ + model::wvw::{ + abilities::Ability, + matches::WvwMatch, + objectives::WvwObjective, + ranks::WvwRank, + upgrades::WvwUpgrade, + }, + Requester, +}; + +pub mod setup; + +#[test] +fn abilities() { + let client = setup::setup(); + let _: Ability = client.single(2u32).unwrap(); +} + +#[test] +fn matches() { + let client = setup::setup(); + let ids: Vec = client.ids::().unwrap(); + assert!(!ids.is_empty()); + let _: WvwMatch = client.single(ids[0].clone()).unwrap(); +} + +#[test] +fn objectives() { + let client = setup::setup(); + let _: WvwObjective = client.single("1099-99".to_string()).unwrap(); +} + +#[test] +fn ranks() { + let client = setup::setup(); + let _: WvwRank = client.single(1u32).unwrap(); +} + +#[test] +fn upgrades() { + let client = setup::setup(); + let _: WvwUpgrade = client.single(5u32).unwrap(); +} diff --git a/model/Cargo.toml b/model/Cargo.toml index 2f88513..9946be8 100644 --- a/model/Cargo.toml +++ b/model/Cargo.toml @@ -26,3 +26,6 @@ version = "1.0.160" features = [ "derive" ] + +[dependencies.serde_json] +version = "1.0" diff --git a/model/README.md b/model/README.md index 99fca4d..b7cad29 100644 --- a/model/README.md +++ b/model/README.md @@ -32,92 +32,91 @@ Example commit adding an endpoint: [bcb0bd3](https://github.com/greaka/gw2lib/co - [x] account - [x] achievements - [x] bank - - [ ] dailycrafting - - [ ] dungeons - - [ ] dyes - - [ ] finishers - - [x] inventory - - [ ] gliders + - [x] dailycrafting + - [x] dungeons + - [x] dyes + - [x] finishers + - [x] gliders - home - - [ ] cats - - [ ] nodes - - [ ] inventory - - [ ] luck - - [ ] mailcarries - - [ ] mapchests - - [ ] masteries + - [x] cats + - [x] nodes + - [x] inventory + - [x] luck + - [x] mailcarries + - [x] mapchests + - [x] masteries - mastery - - [ ] points + - [x] points - [x] materials - - [ ] minis + - [x] minis - mounts - - [ ] skins - - [ ] types - - [ ] outfits + - [x] skins + - [x] types + - [x] outfits - pvp - - [ ] heroes + - [x] heroes - [x] raids - - [ ] recipes - - [ ] skins - - [ ] titles + - [x] recipes + - [x] skins + - [x] titles - [x] wallet - wizardsvault - [x] listings - [x] daily - [x] weekly - [x] special - - [ ] worldbosses + - [x] worldbosses - characters - [x] :id - [x] backstory - [x] core - [x] crafting - [x] equipment - - [ ] heropoints + - [x] heropoints - [x] inventory - [x] recipes - - [ ] sab + - [x] sab - [x] skills - [x] specializations - [x] training - commerce - [x] delivery - - [ ] transactions + - [x] transactions - pvp - - [ ] stats - - [ ] games - - [ ] standings - - [ ] tokeninfo + - [x] stats + - [x] games + - [x] standings + - [x] tokeninfo - daily rewards - - [ ] dailycrafting - - [ ] mapchests - - [ ] worldbosses + - [x] dailycrafting + - [x] mapchests + - [x] worldbosses - game mechanics - - [ ] masteries - - [ ] mounts - - [ ] skins - - [ ] types - - [ ] outfits + - [x] masteries + - [x] mounts + - [x] skins + - [x] types + - [x] outfits - [x] pets - - [ ] professions - - [ ] races - - [ ] specializations - - [ ] skills - - [ ] traits - - [ ] legends + - [x] professions + - [x] races + - [x] specializations + - [x] skills + - [x] traits + - [x] legends - guild - guild - - [ ] :id - - [ ] permissions + - [x] :id + - [x] permissions - [ ] search - - [ ] upgrades - - [ ] emblem + - [x] upgrades + - [x] emblem - guild authenticated - guild - :id - - [ ] log - - [ ] members - - [ ] ranks + - [x] log + - [x] members + - [x] ranks - [ ] stash - [ ] treasury - [ ] teams @@ -127,12 +126,12 @@ Example commit adding an endpoint: [bcb0bd3](https://github.com/greaka/gw2lib/co - [x] cats - [x] nodes - items - - [ ] finishers + - [x] finishers - [x] items - [x] itemstats - - [ ] materials + - [x] materials - pvp - - [ ] amulets + - [x] amulets - [x] recipes - [ ] search - [x] skins @@ -141,25 +140,25 @@ Example commit adding an endpoint: [bcb0bd3](https://github.com/greaka/gw2lib/co - [x] maps - Miscellaneous - [x] build - - [ ] colors - - [ ] currencies - - [ ] dungeons - - [ ] files - - [ ] quaggans - - [ ] minis + - [x] colors + - [x] currencies + - [x] dungeons + - [x] files + - [x] quaggans + - [x] minis - [x] raids - - [ ] titles + - [x] titles - [x] worlds - Story - backstory - - [ ] answers - - [ ] questions - - [ ] stories - - [ ] seasons + - [x] answers + - [x] questions + - [x] stories + - [x] seasons - sPvP - - [ ] pvp - - [ ] ranks - - [ ] seasons + - [x] pvp + - [x] ranks + - [x] seasons - [ ] leaderboards - trading post - commerce @@ -169,9 +168,9 @@ Example commit adding an endpoint: [bcb0bd3](https://github.com/greaka/gw2lib/co - [ ] gems - [ ] prices - world v world - - [ ] wvw - - [ ] abilities - - [ ] matches - - [ ] objectives - - [ ] ranks - - [ ] upgrades + - [x] wvw + - [x] abilities + - [x] matches + - [x] objectives + - [x] ranks + - [x] upgrades diff --git a/model/src/achievements.rs b/model/src/achievements.rs new file mode 100644 index 0000000..a217020 --- /dev/null +++ b/model/src/achievements.rs @@ -0,0 +1,45 @@ +pub mod categories; +pub mod groups; + +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct AchievementTier { + pub count: u32, + pub points: u32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Achievement { + pub id: u32, + pub name: String, + pub description: String, + pub requirement: String, + pub locked_text: String, + #[serde(rename = "type")] + pub _type: String, + pub flags: Vec, + pub tiers: Vec, + pub point_cap: Option, + pub prerequisites: Option>, + pub bits: Option>, + pub rewards: Option>, + pub icon: Option, +} + +impl Endpoint for Achievement { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/achievements"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Achievement { + type IdType = u32; +} +impl BulkEndpoint for Achievement { + const ALL: bool = false; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/authenticated.rs b/model/src/authenticated.rs index 6f6a089..4d313ae 100644 --- a/model/src/authenticated.rs +++ b/model/src/authenticated.rs @@ -6,6 +6,7 @@ use crate::{Endpoint, FixedEndpoint, TimeStamp}; pub mod account; pub mod characters; pub mod commerce; +pub mod pvp; #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(test, serde(deny_unknown_fields))] diff --git a/model/src/authenticated/account.rs b/model/src/authenticated/account.rs index 8abf792..8dcfffc 100644 --- a/model/src/authenticated/account.rs +++ b/model/src/authenticated/account.rs @@ -1,9 +1,27 @@ pub mod achievements; pub mod bank; +pub mod dailycrafting; +pub mod dungeons; +pub mod dyes; +pub mod finishers; +pub mod gliders; +pub mod home; pub mod inventory; +pub mod luck; +pub mod mailcarriers; +pub mod mapchests; +pub mod masteries; pub mod materials; +pub mod minis; +pub mod mounts; +pub mod outfits; +pub mod pvp; pub mod raids; +pub mod recipes; +pub mod skins; +pub mod titles; pub mod wallet; +pub mod worldbosses; pub mod wizards_vault; use std::collections::BTreeSet; diff --git a/model/src/authenticated/account/dailycrafting.rs b/model/src/authenticated/account/dailycrafting.rs new file mode 100644 index 0000000..ec7e000 --- /dev/null +++ b/model/src/authenticated/account/dailycrafting.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountDailyCrafting(pub Vec); + +impl Endpoint for AccountDailyCrafting { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/dailycrafting"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountDailyCrafting {} diff --git a/model/src/authenticated/account/dungeons.rs b/model/src/authenticated/account/dungeons.rs new file mode 100644 index 0000000..448c51d --- /dev/null +++ b/model/src/authenticated/account/dungeons.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountDungeons(pub Vec); + +impl Endpoint for AccountDungeons { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/dungeons"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountDungeons {} diff --git a/model/src/authenticated/account/dyes.rs b/model/src/authenticated/account/dyes.rs new file mode 100644 index 0000000..127c909 --- /dev/null +++ b/model/src/authenticated/account/dyes.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{misc::colors::ColorId, Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountDyes(pub Vec); + +impl Endpoint for AccountDyes { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/dyes"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountDyes {} diff --git a/model/src/authenticated/account/finishers.rs b/model/src/authenticated/account/finishers.rs new file mode 100644 index 0000000..033bb20 --- /dev/null +++ b/model/src/authenticated/account/finishers.rs @@ -0,0 +1,20 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct AccountFinisher { + pub id: u32, + pub permanent: bool, + pub quantity: Option, +} + +pub type AccountFinishers = Vec; + +impl Endpoint for AccountFinishers { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/finishers"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountFinishers {} diff --git a/model/src/authenticated/account/gliders.rs b/model/src/authenticated/account/gliders.rs new file mode 100644 index 0000000..7697515 --- /dev/null +++ b/model/src/authenticated/account/gliders.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountGliders(pub Vec); + +impl Endpoint for AccountGliders { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/gliders"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountGliders {} diff --git a/model/src/authenticated/account/home.rs b/model/src/authenticated/account/home.rs new file mode 100644 index 0000000..acfa757 --- /dev/null +++ b/model/src/authenticated/account/home.rs @@ -0,0 +1,26 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountHomeCats(pub Vec); + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountHomeNodes(pub Vec); + +impl Endpoint for AccountHomeCats { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/home/cats"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountHomeCats {} + +impl Endpoint for AccountHomeNodes { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/home/nodes"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountHomeNodes {} diff --git a/model/src/authenticated/account/inventory.rs b/model/src/authenticated/account/inventory.rs index 3fdf5c2..4ce2252 100644 --- a/model/src/authenticated/account/inventory.rs +++ b/model/src/authenticated/account/inventory.rs @@ -1,25 +1,27 @@ use serde::{Deserialize, Serialize}; - use crate::{ - authenticated::characters::Binding, + authenticated::characters::{Binding, Stats}, items::{skins::SkinId, ItemId}, + misc::colors::ColorId, Endpoint, FixedEndpoint, }; -pub type AccountInventory = Vec>; - -#[derive(Clone, PartialEq, Debug, Serialize, Deserialize, Eq)] +#[derive(Clone, Debug, Serialize, Deserialize)] #[cfg_attr(test, serde(deny_unknown_fields))] -pub struct AccountInventoryItem { +pub struct SharedInventorySlot { pub id: ItemId, - pub count: u8, - pub charges: Option, - pub upgrades: Option>, + pub count: u32, + pub charges: Option, pub skin: Option, + pub upgrades: Option>, pub infusions: Option>, + pub dyes: Option>>, + pub stats: Option, pub binding: Option, } +pub type AccountInventory = Vec>; + impl Endpoint for AccountInventory { const AUTHENTICATED: bool = true; const LOCALE: bool = false; diff --git a/model/src/authenticated/account/luck.rs b/model/src/authenticated/account/luck.rs new file mode 100644 index 0000000..c699807 --- /dev/null +++ b/model/src/authenticated/account/luck.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct AccountLuck { + pub id: String, + pub value: u64, +} + +pub type AccountLuckVec = Vec; + +impl Endpoint for AccountLuckVec { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/luck"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountLuckVec {} diff --git a/model/src/authenticated/account/mailcarriers.rs b/model/src/authenticated/account/mailcarriers.rs new file mode 100644 index 0000000..72232e8 --- /dev/null +++ b/model/src/authenticated/account/mailcarriers.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountMailCarriers(pub Vec); + +impl Endpoint for AccountMailCarriers { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/mailcarriers"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountMailCarriers {} diff --git a/model/src/authenticated/account/mapchests.rs b/model/src/authenticated/account/mapchests.rs new file mode 100644 index 0000000..b99eccd --- /dev/null +++ b/model/src/authenticated/account/mapchests.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountMapChests(pub Vec); + +impl Endpoint for AccountMapChests { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/mapchests"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountMapChests {} diff --git a/model/src/authenticated/account/masteries.rs b/model/src/authenticated/account/masteries.rs new file mode 100644 index 0000000..8f56bed --- /dev/null +++ b/model/src/authenticated/account/masteries.rs @@ -0,0 +1,42 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct AccountMastery { + pub id: u32, + pub level: u32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct MasteryRegionTotal { + pub region: String, + pub spent: u32, + pub earned: u32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct AccountMasteryPoints { + pub totals: Vec, + pub unlocked: Vec, +} + +pub type AccountMasteries = Vec; + +impl Endpoint for AccountMasteries { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/masteries"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountMasteries {} + +impl Endpoint for AccountMasteryPoints { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/mastery/points"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountMasteryPoints {} diff --git a/model/src/authenticated/account/minis.rs b/model/src/authenticated/account/minis.rs new file mode 100644 index 0000000..3560ce7 --- /dev/null +++ b/model/src/authenticated/account/minis.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{misc::minis::MiniPetId, Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountMinis(pub Vec); + +impl Endpoint for AccountMinis { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/minis"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountMinis {} diff --git a/model/src/authenticated/account/mounts.rs b/model/src/authenticated/account/mounts.rs new file mode 100644 index 0000000..2a0d3db --- /dev/null +++ b/model/src/authenticated/account/mounts.rs @@ -0,0 +1,26 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountMountSkins(pub Vec); + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountMountTypes(pub Vec); + +impl Endpoint for AccountMountSkins { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/mounts/skins"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountMountSkins {} + +impl Endpoint for AccountMountTypes { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/mounts/types"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountMountTypes {} diff --git a/model/src/authenticated/account/outfits.rs b/model/src/authenticated/account/outfits.rs new file mode 100644 index 0000000..74411b1 --- /dev/null +++ b/model/src/authenticated/account/outfits.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountOutfits(pub Vec); + +impl Endpoint for AccountOutfits { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/outfits"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountOutfits {} diff --git a/model/src/authenticated/account/pvp.rs b/model/src/authenticated/account/pvp.rs new file mode 100644 index 0000000..fd5319c --- /dev/null +++ b/model/src/authenticated/account/pvp.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountPvpHeroes(pub Vec); + +impl Endpoint for AccountPvpHeroes { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/pvp/heroes"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountPvpHeroes {} diff --git a/model/src/authenticated/account/recipes.rs b/model/src/authenticated/account/recipes.rs new file mode 100644 index 0000000..7abff6b --- /dev/null +++ b/model/src/authenticated/account/recipes.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{items::recipes::RecipeId, Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountRecipes(pub Vec); + +impl Endpoint for AccountRecipes { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/recipes"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountRecipes {} diff --git a/model/src/authenticated/account/skins.rs b/model/src/authenticated/account/skins.rs new file mode 100644 index 0000000..adbd813 --- /dev/null +++ b/model/src/authenticated/account/skins.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{items::skins::SkinId, Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountSkins(pub Vec); + +impl Endpoint for AccountSkins { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/skins"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountSkins {} diff --git a/model/src/authenticated/account/titles.rs b/model/src/authenticated/account/titles.rs new file mode 100644 index 0000000..987bbb2 --- /dev/null +++ b/model/src/authenticated/account/titles.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{misc::titles::TitleId, Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountTitles(pub Vec); + +impl Endpoint for AccountTitles { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/titles"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountTitles {} diff --git a/model/src/authenticated/account/worldbosses.rs b/model/src/authenticated/account/worldbosses.rs new file mode 100644 index 0000000..d5159ed --- /dev/null +++ b/model/src/authenticated/account/worldbosses.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct AccountWorldBosses(pub Vec); + +impl Endpoint for AccountWorldBosses { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/account/worldbosses"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for AccountWorldBosses {} diff --git a/model/src/authenticated/characters.rs b/model/src/authenticated/characters.rs index 0550c8b..6d71253 100644 --- a/model/src/authenticated/characters.rs +++ b/model/src/authenticated/characters.rs @@ -499,3 +499,66 @@ impl Endpoint for Training { const URL: &'static str = "v2/characters"; const VERSION: &'static str = "2022-06-14T00:00:00.000Z"; } + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct Heropoints(pub Vec); + +impl EndpointWithId for Heropoints { + type IdType = CharacterId; + fn format_url(id: &str) -> String { + format!("{}/{}/heropoints", Self::URL, id) + } +} + +impl Endpoint for Heropoints { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/characters"; + const VERSION: &'static str = "2022-06-14T00:00:00.000Z"; +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct SabZone { + pub id: u32, + pub mode: String, + pub d: u32, + pub z: u32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct SabUnlock { + pub id: u32, + pub name: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct SabSong { + pub id: u32, + pub name: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Sab { + pub zones: Vec, + pub unlocks: Vec, + pub songs: Vec, +} + +impl EndpointWithId for Sab { + type IdType = CharacterId; + fn format_url(id: &str) -> String { + format!("{}/{}/sab", Self::URL, id) + } +} + +impl Endpoint for Sab { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/characters"; + const VERSION: &'static str = "2022-06-14T00:00:00.000Z"; +} diff --git a/model/src/authenticated/commerce.rs b/model/src/authenticated/commerce.rs index 4be6e14..84163d4 100644 --- a/model/src/authenticated/commerce.rs +++ b/model/src/authenticated/commerce.rs @@ -1 +1,59 @@ +use serde::{Deserialize, Serialize}; +use crate::{items::ItemId, Endpoint, FixedEndpoint, TimeStamp}; pub mod delivery; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Transaction { + pub id: u64, + pub item_id: ItemId, + pub price: u64, + pub quantity: u32, + pub created: TimeStamp, + pub purchased: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct CurrentBuyTransactions(pub Vec); +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct CurrentSellTransactions(pub Vec); +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct HistoryBuyTransactions(pub Vec); +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct HistorySellTransactions(pub Vec); + +impl Endpoint for CurrentBuyTransactions { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/commerce/transactions/current/buys"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for CurrentBuyTransactions {} + +impl Endpoint for CurrentSellTransactions { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/commerce/transactions/current/sells"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for CurrentSellTransactions {} + +impl Endpoint for HistoryBuyTransactions { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/commerce/transactions/history/buys"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for HistoryBuyTransactions {} + +impl Endpoint for HistorySellTransactions { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/commerce/transactions/history/sells"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for HistorySellTransactions {} diff --git a/model/src/authenticated/pvp.rs b/model/src/authenticated/pvp.rs new file mode 100644 index 0000000..e243c3c --- /dev/null +++ b/model/src/authenticated/pvp.rs @@ -0,0 +1,93 @@ +use std::collections::HashMap; +use serde::{Deserialize, Serialize}; +use crate::{Endpoint, FixedEndpoint, PagedEndpoint, TimeStamp}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct PvpResult { + pub wins: u32, + pub losses: u32, + pub desertions: u32, + pub byes: u32, + pub forfeits: u32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct PvpStats { + pub pvp_rank: u32, + pub pvp_rank_points: u32, + pub pvp_rank_rollovers: u32, + pub aggregate: PvpResult, + pub professions: HashMap, + pub ladders: HashMap, +} + +impl Endpoint for PvpStats { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/pvp/stats"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for PvpStats {} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct PvpGameScores { + pub red: u32, + pub blue: u32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct PvpGame { + pub id: String, + pub map_id: u32, + pub started: TimeStamp, + pub ended: TimeStamp, + pub result: String, + pub team: String, + pub profession: String, + pub rating_type: String, + pub rating_change: Option, + pub season: Option, + pub scores: PvpGameScores, +} + +impl Endpoint for PvpGame { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/pvp/games"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl PagedEndpoint for PvpGame {} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct PvpStandingResult { + pub total_points: u32, + pub division: u32, + pub tier: u32, + pub points: u32, + pub repeats: u32, + pub rating: Option, + pub decay: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct PvpStanding { + pub current: PvpStandingResult, + pub best: PvpStandingResult, + pub season_id: String, +} + +pub type PvpStandings = Vec; + +impl Endpoint for PvpStandings { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/pvp/standings"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for PvpStandings {} diff --git a/model/src/daily_rewards.rs b/model/src/daily_rewards.rs new file mode 100644 index 0000000..9c2b5c5 --- /dev/null +++ b/model/src/daily_rewards.rs @@ -0,0 +1,3 @@ +pub mod dailycrafting; +pub mod mapchests; +pub mod worldbosses; diff --git a/model/src/daily_rewards/dailycrafting.rs b/model/src/daily_rewards/dailycrafting.rs new file mode 100644 index 0000000..e6a4729 --- /dev/null +++ b/model/src/daily_rewards/dailycrafting.rs @@ -0,0 +1,22 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct DailyCrafting { + pub id: String, +} + +impl Endpoint for DailyCrafting { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/dailycrafting"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for DailyCrafting { + type IdType = String; +} +impl BulkEndpoint for DailyCrafting { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/daily_rewards/mapchests.rs b/model/src/daily_rewards/mapchests.rs new file mode 100644 index 0000000..b9bbd41 --- /dev/null +++ b/model/src/daily_rewards/mapchests.rs @@ -0,0 +1,22 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct MapChest { + pub id: String, +} + +impl Endpoint for MapChest { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/mapchests"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for MapChest { + type IdType = String; +} +impl BulkEndpoint for MapChest { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/daily_rewards/worldbosses.rs b/model/src/daily_rewards/worldbosses.rs new file mode 100644 index 0000000..2af1103 --- /dev/null +++ b/model/src/daily_rewards/worldbosses.rs @@ -0,0 +1,22 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct WorldBoss { + pub id: String, +} + +impl Endpoint for WorldBoss { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/worldbosses"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for WorldBoss { + type IdType = String; +} +impl BulkEndpoint for WorldBoss { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/game_mechanics.rs b/model/src/game_mechanics.rs index 56ebe26..d397551 100644 --- a/model/src/game_mechanics.rs +++ b/model/src/game_mechanics.rs @@ -1,4 +1,10 @@ +pub mod legends; +pub mod masteries; +pub mod mounts; +pub mod outfits; pub mod pets; +pub mod professions; +pub mod races; pub mod skills; pub mod specializations; pub mod traits; diff --git a/model/src/game_mechanics/legends.rs b/model/src/game_mechanics/legends.rs new file mode 100644 index 0000000..900dd65 --- /dev/null +++ b/model/src/game_mechanics/legends.rs @@ -0,0 +1,24 @@ +use serde::{Deserialize, Serialize}; +use crate::{game_mechanics::skills::SkillId, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Legend { + pub id: String, + pub swap: SkillId, + pub heal: SkillId, + pub elite: SkillId, + pub utilities: Vec, +} + +impl Endpoint for Legend { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/legends"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Legend { type IdType = String; } +impl BulkEndpoint for Legend { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/game_mechanics/masteries.rs b/model/src/game_mechanics/masteries.rs new file mode 100644 index 0000000..56d0a38 --- /dev/null +++ b/model/src/game_mechanics/masteries.rs @@ -0,0 +1,37 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct MasteryLevel { + pub name: String, + pub description: String, + pub instruction: String, + pub icon: String, + pub point_cost: u32, + pub exp_cost: u64, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Mastery { + pub id: u32, + pub name: String, + pub requirement: String, + pub order: u32, + pub background: String, + pub region: String, + pub levels: Vec, +} + +impl Endpoint for Mastery { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/masteries"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Mastery { type IdType = u32; } +impl BulkEndpoint for Mastery { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/game_mechanics/mounts.rs b/model/src/game_mechanics/mounts.rs new file mode 100644 index 0000000..791ab80 --- /dev/null +++ b/model/src/game_mechanics/mounts.rs @@ -0,0 +1,53 @@ +use serde::{Deserialize, Serialize}; +use crate::{misc::colors::ColorId, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct MountDyeSlot { + pub color_id: ColorId, + pub material: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct MountSkin { + pub id: u32, + pub name: String, + pub icon: String, + pub dye_slots: Vec, + pub mount: String, +} + +impl Endpoint for MountSkin { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/mounts/skins"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for MountSkin { type IdType = u32; } +impl BulkEndpoint for MountSkin { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct MountType { + pub id: String, + pub name: String, + pub default_skin: u32, + pub skins: Vec, + pub skills: Option>, +} + +impl Endpoint for MountType { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/mounts/types"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for MountType { type IdType = String; } +impl BulkEndpoint for MountType { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/game_mechanics/outfits.rs b/model/src/game_mechanics/outfits.rs new file mode 100644 index 0000000..f7e496b --- /dev/null +++ b/model/src/game_mechanics/outfits.rs @@ -0,0 +1,23 @@ +use serde::{Deserialize, Serialize}; +use crate::{items::ItemId, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Outfit { + pub id: u32, + pub name: String, + pub icon: String, + pub unlock_items: Vec, +} + +impl Endpoint for Outfit { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/outfits"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Outfit { type IdType = u32; } +impl BulkEndpoint for Outfit { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/game_mechanics/pets.rs b/model/src/game_mechanics/pets.rs index e2f16c0..b987d2d 100644 --- a/model/src/game_mechanics/pets.rs +++ b/model/src/game_mechanics/pets.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -pub use crate::game_mechanics::skills::SkillId; +use crate::{game_mechanics::skills::SkillId, BulkEndpoint, Endpoint, EndpointWithId}; use crate::*; pub type PetId = u16; diff --git a/model/src/game_mechanics/professions.rs b/model/src/game_mechanics/professions.rs new file mode 100644 index 0000000..82f3f08 --- /dev/null +++ b/model/src/game_mechanics/professions.rs @@ -0,0 +1,29 @@ +use serde::{Deserialize, Serialize}; +use crate::{game_mechanics::specializations::SpecializationId, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct ProfessionInfo { + pub id: String, + pub name: String, + pub icon: String, + pub icon_big: String, + pub specializations: Vec, + pub weapons: Option, + pub flags: Option>, + pub skills: Option>, + pub training: Option>, + pub skills_by_palette: Option>, +} + +impl Endpoint for ProfessionInfo { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/professions"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for ProfessionInfo { type IdType = String; } +impl BulkEndpoint for ProfessionInfo { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/game_mechanics/races.rs b/model/src/game_mechanics/races.rs new file mode 100644 index 0000000..eafd78a --- /dev/null +++ b/model/src/game_mechanics/races.rs @@ -0,0 +1,22 @@ +use serde::{Deserialize, Serialize}; +use crate::{game_mechanics::skills::SkillId, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Race { + pub id: String, + pub name: String, + pub skills: Vec, +} + +impl Endpoint for Race { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/races"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Race { type IdType = String; } +impl BulkEndpoint for Race { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/game_mechanics/skills.rs b/model/src/game_mechanics/skills.rs index b6ba572..df52c05 100644 --- a/model/src/game_mechanics/skills.rs +++ b/model/src/game_mechanics/skills.rs @@ -75,3 +75,52 @@ pub struct TraitedFact { /// array index of Fact pub overrides: Option, } + +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Skill { + pub id: SkillId, + pub name: String, + pub description: Option, + pub icon: Option, + pub chat_link: Option, + #[serde(rename = "type")] + pub _type: Option, + pub weapon_type: Option, + pub professions: Option>, + pub slot: Option, + pub facts: Option>, + pub traited_facts: Option>, + pub categories: Option>, + pub attunement: Option, + pub cost: Option, + pub dual_wield: Option, + pub flip_skill: Option, + pub initiative: Option, + pub next_chain: Option, + pub prev_chain: Option, + pub transform_skills: Option>, + pub bundle_skills: Option>, + pub toolbelt_skill: Option, + pub specialization: Option, + pub subtype: Option, + pub flags: Option>, + pub log: Option, + pub ranges: Option>, + pub recharge: Option, + pub equip_ttype: Option, +} + +impl Endpoint for Skill { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/skills"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Skill { type IdType = SkillId; } +impl BulkEndpoint for Skill { + const ALL: bool = false; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/game_mechanics/specializations.rs b/model/src/game_mechanics/specializations.rs index 8b8e290..9f8428c 100644 --- a/model/src/game_mechanics/specializations.rs +++ b/model/src/game_mechanics/specializations.rs @@ -1 +1,32 @@ pub type SpecializationId = u16; + +use serde::{Deserialize, Serialize}; +use crate::{game_mechanics::traits::TraitId, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Specialization { + pub id: SpecializationId, + pub name: String, + pub profession: String, + pub elite: bool, + pub minor_traits: Vec, + pub major_traits: Vec, + pub icon: String, + pub background: String, + pub weapon_trait: Option, + pub profession_icon: Option, + pub profession_icon_big: Option, +} + +impl Endpoint for Specialization { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/specializations"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Specialization { type IdType = SpecializationId; } +impl BulkEndpoint for Specialization { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/game_mechanics/traits.rs b/model/src/game_mechanics/traits.rs index fb6d0f3..34a7bd2 100644 --- a/model/src/game_mechanics/traits.rs +++ b/model/src/game_mechanics/traits.rs @@ -1 +1,31 @@ pub type TraitId = u16; + +use serde::{Deserialize, Serialize}; +use crate::{game_mechanics::specializations::SpecializationId, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Trait { + pub id: TraitId, + pub tier: u8, + pub order: u8, + pub name: String, + pub description: Option, + pub slot: String, + pub facts: Option>, + pub traited_facts: Option>, + pub specialization: Option, + pub icon: String, +} + +impl Endpoint for Trait { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/traits"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Trait { type IdType = TraitId; } +impl BulkEndpoint for Trait { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/guild.rs b/model/src/guild.rs index 9460bc0..2054065 100644 --- a/model/src/guild.rs +++ b/model/src/guild.rs @@ -1 +1,4 @@ +pub mod authenticated; +pub mod emblem; +pub mod guild; pub mod upgrades; diff --git a/model/src/guild/authenticated.rs b/model/src/guild/authenticated.rs new file mode 100644 index 0000000..3251853 --- /dev/null +++ b/model/src/guild/authenticated.rs @@ -0,0 +1,193 @@ +use std::collections::HashMap; +use serde::{Deserialize, Serialize}; +use crate::{ + authenticated::pvp::PvpResult, + guild::upgrades::GuildUpgradeId, + items::ItemId, + TimeStamp, + Endpoint, EndpointWithId, +}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildLogEntry { + pub id: u32, + pub time: TimeStamp, + #[serde(rename = "type")] + pub _type: String, + pub user: Option, + pub action: Option, + pub item_id: Option, + pub count: Option, + pub upgrade_id: Option, + pub currency_id: Option, + pub activity: Option, + pub total_participants: Option, + pub participants: Option>, + pub quantity: Option, + pub item_name: Option, + pub motd: Option, + pub kick_reason: Option, +} + +pub type GuildLog = Vec; + +impl Endpoint for GuildLog { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/guild"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for GuildLog { + type IdType = String; + fn format_url(id: &str) -> String { format!("v2/guild/{}/log", id) } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildMember { + pub name: String, + pub rank: String, + pub joined: TimeStamp, + pub wvw_member: bool, +} + +pub type GuildMembers = Vec; + +impl Endpoint for GuildMembers { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/guild"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for GuildMembers { + type IdType = String; + fn format_url(id: &str) -> String { format!("v2/guild/{}/members", id) } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildRank { + pub id: String, + pub order: u32, + pub permissions: Vec, + pub icon: String, +} + +pub type GuildRanks = Vec; + +impl Endpoint for GuildRanks { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/guild"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for GuildRanks { + type IdType = String; + fn format_url(id: &str) -> String { format!("v2/guild/{}/ranks", id) } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildStashItem { + pub id: ItemId, + pub count: u32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildStash { + pub upgrade_id: GuildUpgradeId, + pub size: u32, + pub coins: u64, + pub note: String, + pub inventory: Vec>, +} + +pub type GuildStashes = Vec; + +impl Endpoint for GuildStashes { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/guild"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for GuildStashes { + type IdType = String; + fn format_url(id: &str) -> String { format!("v2/guild/{}/stash", id) } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildUpgradeNeed { + pub upgrade_id: GuildUpgradeId, + pub count: u32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildTreasuryItem { + pub item_id: ItemId, + pub count: u32, + pub needed_by: Vec, +} + +pub type GuildTreasury = Vec; + +impl Endpoint for GuildTreasury { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/guild"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for GuildTreasury { + type IdType = String; + fn format_url(id: &str) -> String { format!("v2/guild/{}/treasury", id) } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildTeamMember { + pub name: String, + pub role: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildTeam { + pub id: u32, + pub members: Vec, + pub name: String, + pub aggregate: PvpResult, + pub ladders: HashMap, + pub games: Vec, + pub seasons: Vec, +} + +pub type GuildTeams = Vec; + +impl Endpoint for GuildTeams { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/guild"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for GuildTeams { + type IdType = String; + fn format_url(id: &str) -> String { format!("v2/guild/{}/teams", id) } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct GuildCompletedUpgrades(pub Vec); + +impl Endpoint for GuildCompletedUpgrades { + const AUTHENTICATED: bool = true; + const LOCALE: bool = false; + const URL: &'static str = "v2/guild"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for GuildCompletedUpgrades { + type IdType = String; + fn format_url(id: &str) -> String { format!("v2/guild/{}/upgrades", id) } +} diff --git a/model/src/guild/emblem.rs b/model/src/guild/emblem.rs new file mode 100644 index 0000000..8871a63 --- /dev/null +++ b/model/src/guild/emblem.rs @@ -0,0 +1,40 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct EmblemBackground { + pub id: u32, + pub layers: Vec, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct EmblemForeground { + pub id: u32, + pub layers: Vec, +} + +impl Endpoint for EmblemBackground { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/emblem/backgrounds"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for EmblemBackground { type IdType = u32; } +impl BulkEndpoint for EmblemBackground { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} + +impl Endpoint for EmblemForeground { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/emblem/foregrounds"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for EmblemForeground { type IdType = u32; } +impl BulkEndpoint for EmblemForeground { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/guild/guild.rs b/model/src/guild/guild.rs new file mode 100644 index 0000000..b320df9 --- /dev/null +++ b/model/src/guild/guild.rs @@ -0,0 +1,79 @@ +use serde::{Deserialize, Serialize}; +use crate::{misc::colors::ColorId, BulkEndpoint, Endpoint, EndpointWithId, FixedEndpoint}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildEmblemLayer { + pub id: u32, + pub colors: Vec, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildEmblem { + pub background: GuildEmblemLayer, + pub foreground: GuildEmblemLayer, + pub flags: Vec, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Guild { + pub id: String, + pub name: String, + pub tag: String, + pub level: Option, + pub motd: Option, + pub influence: Option, + pub aetherium: Option, + pub resonance: Option, + pub favor: Option, + pub member_count: Option, + pub member_capacity: Option, + pub emblem: Option, +} + +impl Endpoint for Guild { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/guild"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Guild { + type IdType = String; + fn format_url(id: &str) -> String { + format!("v2/guild/{}", id) + } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildPermission { + pub id: String, + pub name: String, + pub description: String, +} + +impl Endpoint for GuildPermission { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/guild/permissions"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for GuildPermission { type IdType = String; } +impl BulkEndpoint for GuildPermission { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct GuildSearchResult(pub Vec); + +impl Endpoint for GuildSearchResult { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/guild/search"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl FixedEndpoint for GuildSearchResult {} diff --git a/model/src/guild/upgrades.rs b/model/src/guild/upgrades.rs index 862c386..efd2309 100644 --- a/model/src/guild/upgrades.rs +++ b/model/src/guild/upgrades.rs @@ -1 +1,44 @@ pub type GuildUpgradeId = u64; + +use serde::{Deserialize, Serialize}; +use crate::{items::ItemId, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildUpgradeCost { + #[serde(rename = "type")] + pub _type: String, + pub count: u32, + pub name: String, + pub item_id: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GuildUpgrade { + pub id: GuildUpgradeId, + pub name: String, + pub description: String, + pub build_time: u32, + pub icon: String, + #[serde(rename = "type")] + pub _type: String, + pub required_level: u32, + pub experience: u32, + pub prerequisites: Vec, + pub costs: Vec, + pub bag_max_items: Option, + pub bag_max_coins: Option, +} + +impl Endpoint for GuildUpgrade { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/guild/upgrades"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for GuildUpgrade { type IdType = GuildUpgradeId; } +impl BulkEndpoint for GuildUpgrade { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/items.rs b/model/src/items.rs index fc69191..19bf824 100644 --- a/model/src/items.rs +++ b/model/src/items.rs @@ -1,4 +1,6 @@ +pub mod finishers; pub mod itemstats; +pub mod materials; pub mod recipes; pub mod skins; diff --git a/model/src/items/finishers.rs b/model/src/items/finishers.rs new file mode 100644 index 0000000..d363686 --- /dev/null +++ b/model/src/items/finishers.rs @@ -0,0 +1,25 @@ +use serde::{Deserialize, Serialize}; +use crate::{items::ItemId, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Finisher { + pub id: u32, + pub name: String, + pub icon: String, + pub unlock_details: String, + pub unlock_items: Vec, + pub order: u32, +} + +impl Endpoint for Finisher { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/finishers"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Finisher { type IdType = u32; } +impl BulkEndpoint for Finisher { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/items/materials.rs b/model/src/items/materials.rs new file mode 100644 index 0000000..ce361e5 --- /dev/null +++ b/model/src/items/materials.rs @@ -0,0 +1,23 @@ +use serde::{Deserialize, Serialize}; +use crate::{items::ItemId, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct MaterialCategory { + pub id: u32, + pub name: String, + pub items: Vec, + pub order: Option, +} + +impl Endpoint for MaterialCategory { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/materials"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for MaterialCategory { type IdType = u32; } +impl BulkEndpoint for MaterialCategory { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/lib.rs b/model/src/lib.rs index 2241fd0..0d6ed65 100644 --- a/model/src/lib.rs +++ b/model/src/lib.rs @@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize}; pub mod achievements; pub mod authenticated; +pub mod daily_rewards; pub mod game_mechanics; pub mod guild; pub mod home_instance; @@ -11,6 +12,7 @@ pub mod items; pub mod maps; pub mod misc; pub mod pvp; +pub mod story; pub mod tradingpost; pub mod wvw; @@ -62,21 +64,9 @@ pub struct ErrorResponse { } pub trait Endpoint: Sized { - /// whether this endpoint requires authentication const AUTHENTICATED: bool; - - /// whether this endpoint supports the language parameter const LOCALE: bool; - - /// endpoint url in the format `v2/account` - /// ### Remarks - /// Among other things, this URL is used to fetch ids. - /// `v2/characters/My Character/core` still requires `v2/characters` to be - /// set here. For special cases like characters, override the fetch url - /// of single items here: [EndpointWithId::format_url] const URL: &'static str; - - /// version of the endpoint to request const VERSION: &'static str; } @@ -95,7 +85,6 @@ pub trait EndpointWithId: Endpoint { pub trait FixedEndpoint: Endpoint {} pub trait BulkEndpoint: EndpointWithId { - /// whether this endpoint supports `ids=all` const ALL: bool; fn id(&self) -> &Self::IdType; diff --git a/model/src/misc.rs b/model/src/misc.rs index 0b9a100..1467b81 100644 --- a/model/src/misc.rs +++ b/model/src/misc.rs @@ -1,7 +1,10 @@ pub mod build; pub mod colors; pub mod currencies; +pub mod dungeons; +pub mod files; pub mod minis; +pub mod quaggans; pub mod raids; pub mod titles; pub mod worlds; diff --git a/model/src/misc/dungeons.rs b/model/src/misc/dungeons.rs new file mode 100644 index 0000000..5e0c614 --- /dev/null +++ b/model/src/misc/dungeons.rs @@ -0,0 +1,29 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct DungeonPath { + pub id: String, + #[serde(rename = "type")] + pub _type: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Dungeon { + pub id: String, + pub paths: Vec, +} + +impl Endpoint for Dungeon { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/dungeons"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Dungeon { type IdType = String; } +impl BulkEndpoint for Dungeon { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/misc/files.rs b/model/src/misc/files.rs new file mode 100644 index 0000000..41055ba --- /dev/null +++ b/model/src/misc/files.rs @@ -0,0 +1,21 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct GameFile { + pub id: String, + pub icon: String, +} + +impl Endpoint for GameFile { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/files"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for GameFile { type IdType = String; } +impl BulkEndpoint for GameFile { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/misc/minis.rs b/model/src/misc/minis.rs index b93cc68..79d7999 100644 --- a/model/src/misc/minis.rs +++ b/model/src/misc/minis.rs @@ -1 +1,26 @@ pub type MiniPetId = u64; + +use serde::{Deserialize, Serialize}; +use crate::{items::ItemId, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Mini { + pub id: MiniPetId, + pub name: String, + pub icon: String, + pub order: u32, + pub item_id: ItemId, +} + +impl Endpoint for Mini { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/minis"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Mini { type IdType = MiniPetId; } +impl BulkEndpoint for Mini { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/misc/quaggans.rs b/model/src/misc/quaggans.rs new file mode 100644 index 0000000..9af6782 --- /dev/null +++ b/model/src/misc/quaggans.rs @@ -0,0 +1,21 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Quaggan { + pub id: String, + pub url: String, +} + +impl Endpoint for Quaggan { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/quaggans"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Quaggan { type IdType = String; } +impl BulkEndpoint for Quaggan { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/misc/titles.rs b/model/src/misc/titles.rs index d4e38df..621ea03 100644 --- a/model/src/misc/titles.rs +++ b/model/src/misc/titles.rs @@ -1 +1,25 @@ pub type TitleId = u16; + +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Title { + pub id: TitleId, + pub name: String, + pub achievement: Option, + pub achievements: Vec, +} + +impl Endpoint for Title { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/titles"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Title { type IdType = TitleId; } +impl BulkEndpoint for Title { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/pvp.rs b/model/src/pvp.rs index 6eef2b6..a99eb8b 100644 --- a/model/src/pvp.rs +++ b/model/src/pvp.rs @@ -1 +1,3 @@ pub mod amulets; +pub mod ranks; +pub mod seasons; diff --git a/model/src/pvp/amulets.rs b/model/src/pvp/amulets.rs index 90ebc82..ea9c333 100644 --- a/model/src/pvp/amulets.rs +++ b/model/src/pvp/amulets.rs @@ -1 +1,26 @@ pub type AmuletId = u16; + +use std::collections::HashMap; +use serde::{Deserialize, Serialize}; +use crate::{items::AttributeType, BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Amulet { + pub id: AmuletId, + pub name: String, + pub icon: String, + pub attributes: HashMap, +} + +impl Endpoint for Amulet { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/pvp/amulets"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Amulet { type IdType = AmuletId; } +impl BulkEndpoint for Amulet { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/pvp/ranks.rs b/model/src/pvp/ranks.rs new file mode 100644 index 0000000..1f9874f --- /dev/null +++ b/model/src/pvp/ranks.rs @@ -0,0 +1,34 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct PvpRankLevel { + pub min_rank: u32, + pub max_rank: u32, + pub points: u32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct PvpRank { + pub id: u32, + pub finisher_id: u32, + pub name: String, + pub icon: String, + pub min_rank: u32, + pub max_rank: u32, + pub levels: Vec, +} + +impl Endpoint for PvpRank { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/pvp/ranks"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for PvpRank { type IdType = u32; } +impl BulkEndpoint for PvpRank { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/pvp/seasons.rs b/model/src/pvp/seasons.rs new file mode 100644 index 0000000..6432434 --- /dev/null +++ b/model/src/pvp/seasons.rs @@ -0,0 +1,43 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId, TimeStamp}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct PvpTier { + pub points: u32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct PvpDivision { + pub name: String, + pub flags: Vec, + pub large_icon: String, + pub small_icon: String, + pub pip_icon: String, + pub tiers: Vec, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct PvpSeason { + pub id: String, + pub name: String, + pub start: TimeStamp, + pub end: TimeStamp, + pub active: bool, + pub divisions: Vec, + pub leaderboards: Option, +} + +impl Endpoint for PvpSeason { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/pvp/seasons"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for PvpSeason { type IdType = String; } +impl BulkEndpoint for PvpSeason { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/story.rs b/model/src/story.rs new file mode 100644 index 0000000..ee30992 --- /dev/null +++ b/model/src/story.rs @@ -0,0 +1,2 @@ +pub mod backstory; +pub mod stories; diff --git a/model/src/story/backstory.rs b/model/src/story/backstory.rs new file mode 100644 index 0000000..d8f48fd --- /dev/null +++ b/model/src/story/backstory.rs @@ -0,0 +1,50 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct BackstoryAnswer { + pub id: String, + pub title: String, + pub description: String, + pub journal: String, + pub question: u32, + pub professions: Option>, + pub races: Option>, +} + +impl Endpoint for BackstoryAnswer { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/backstory/answers"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for BackstoryAnswer { type IdType = String; } +impl BulkEndpoint for BackstoryAnswer { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct BackstoryQuestion { + pub id: u32, + pub title: String, + pub description: String, + pub answers: Vec, + pub order: u32, + pub races: Option>, + pub professions: Option>, +} + +impl Endpoint for BackstoryQuestion { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/backstory/questions"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for BackstoryQuestion { type IdType = u32; } +impl BulkEndpoint for BackstoryQuestion { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/story/stories.rs b/model/src/story/stories.rs new file mode 100644 index 0000000..057429f --- /dev/null +++ b/model/src/story/stories.rs @@ -0,0 +1,57 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct StoryChapter { + pub name: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Story { + pub id: u32, + pub season: String, + pub name: String, + pub description: String, + pub timeline: String, + pub level: u8, + pub races: Option>, + pub order: u32, + pub chapters: Vec, + pub professions: Option>, + pub flags: Option>, +} + +impl Endpoint for Story { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/stories"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Story { type IdType = u32; } +impl BulkEndpoint for Story { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct StorySeason { + pub id: String, + pub name: String, + pub order: u32, + pub stories: Vec, +} + +impl Endpoint for StorySeason { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/stories/seasons"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for StorySeason { type IdType = String; } +impl BulkEndpoint for StorySeason { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/wvw.rs b/model/src/wvw.rs index b8efac5..fad9977 100644 --- a/model/src/wvw.rs +++ b/model/src/wvw.rs @@ -1 +1,5 @@ pub mod abilities; +pub mod matches; +pub mod objectives; +pub mod ranks; +pub mod upgrades; diff --git a/model/src/wvw/abilities.rs b/model/src/wvw/abilities.rs index 92a0c58..2fd0fd0 100644 --- a/model/src/wvw/abilities.rs +++ b/model/src/wvw/abilities.rs @@ -1 +1,33 @@ pub type AbilityId = u32; + +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct AbilityRank { + pub cost: u32, + pub effect: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct Ability { + pub id: AbilityId, + pub name: String, + pub description: String, + pub icon: String, + pub ranks: Vec, +} + +impl Endpoint for Ability { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/wvw/abilities"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for Ability { type IdType = AbilityId; } +impl BulkEndpoint for Ability { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/wvw/matches.rs b/model/src/wvw/matches.rs new file mode 100644 index 0000000..4d2604b --- /dev/null +++ b/model/src/wvw/matches.rs @@ -0,0 +1,46 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId, TimeStamp}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct WvwTeamScore { + pub red: u32, + pub blue: u32, + pub green: u32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct WvwTeamVecScore { + pub red: Vec, + pub blue: Vec, + pub green: Vec, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct WvwMatch { + pub id: String, + pub start_time: TimeStamp, + pub end_time: TimeStamp, + pub scores: WvwTeamScore, + pub worlds: WvwTeamScore, + pub all_worlds: WvwTeamVecScore, + pub deaths: WvwTeamScore, + pub kills: WvwTeamScore, + pub victory_points: WvwTeamScore, + pub skirmishes: Vec, + pub maps: Vec, +} + +impl Endpoint for WvwMatch { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/wvw/matches"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for WvwMatch { type IdType = String; } +impl BulkEndpoint for WvwMatch { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/wvw/objectives.rs b/model/src/wvw/objectives.rs new file mode 100644 index 0000000..91c1e59 --- /dev/null +++ b/model/src/wvw/objectives.rs @@ -0,0 +1,31 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct WvwObjective { + pub id: String, + pub name: Option, + pub sector_id: Option, + #[serde(rename = "type")] + pub _type: String, + pub map_type: Option, + pub map_id: Option, + pub upgrade_id: Option, + pub coord: Option>, + pub label_coord: Option>, + pub marker: Option, + pub chat_link: String, +} + +impl Endpoint for WvwObjective { + const AUTHENTICATED: bool = false; + const LOCALE: bool = true; + const URL: &'static str = "v2/wvw/objectives"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for WvwObjective { type IdType = String; } +impl BulkEndpoint for WvwObjective { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/wvw/ranks.rs b/model/src/wvw/ranks.rs new file mode 100644 index 0000000..9ea8a63 --- /dev/null +++ b/model/src/wvw/ranks.rs @@ -0,0 +1,22 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct WvwRank { + pub id: u32, + pub title: String, + pub min_rank: u32, +} + +impl Endpoint for WvwRank { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/wvw/ranks"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for WvwRank { type IdType = u32; } +impl BulkEndpoint for WvwRank { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} diff --git a/model/src/wvw/upgrades.rs b/model/src/wvw/upgrades.rs new file mode 100644 index 0000000..5cbdb1d --- /dev/null +++ b/model/src/wvw/upgrades.rs @@ -0,0 +1,37 @@ +use serde::{Deserialize, Serialize}; +use crate::{BulkEndpoint, Endpoint, EndpointWithId}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct WvwUpgradeDetail { + pub name: String, + pub description: String, + pub icon: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct WvwUpgradeTier { + pub name: String, + pub yaks_required: u32, + pub upgrades: Vec, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(test, serde(deny_unknown_fields))] +pub struct WvwUpgrade { + pub id: u32, + pub tiers: Vec, +} + +impl Endpoint for WvwUpgrade { + const AUTHENTICATED: bool = false; + const LOCALE: bool = false; + const URL: &'static str = "v2/wvw/upgrades"; + const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; +} +impl EndpointWithId for WvwUpgrade { type IdType = u32; } +impl BulkEndpoint for WvwUpgrade { + const ALL: bool = true; + fn id(&self) -> &Self::IdType { &self.id } +} From 7f27a414c1bdf168941b9e09baf4aa1aefb01dae Mon Sep 17 00:00:00 2001 From: Baetens Jan Date: Wed, 15 Apr 2026 18:30:39 +0200 Subject: [PATCH 2/5] refactor: rename None match cases to _none for clarity; update pet test to use u16 --- http/src/client/requester.rs | 6 ++--- http/tests/game_mechanics.rs | 2 +- model/src/achievements.rs | 45 ------------------------------------ 3 files changed, 4 insertions(+), 49 deletions(-) delete mode 100644 model/src/achievements.rs diff --git a/http/src/client/requester.rs b/http/src/client/requester.rs index db6f57a..d1d7385 100644 --- a/http/src/client/requester.rs +++ b/http/src/client/requester.rs @@ -128,7 +128,7 @@ pub trait Requester: Sized + Sync match either { Some(Either::Left(mut rx)) => return rx.recv().await.map_err(Into::into), Some(Either::Right(tx)) => break tx, - None => { + _none => { if let Some(c) = self.try_get(&id).await { return Ok(c); } @@ -232,7 +232,7 @@ pub trait Requester: Sized + Sync txs.insert(id.clone(), tx); break true; } - None => { + _none => { if let Some(c) = check_cache::(self, &id).await { @@ -539,7 +539,7 @@ async fn get_or_ids< match either { Some(Either::Left(mut rx)) => return rx.recv().await.map_err(Into::into), Some(Either::Right(tx)) => break tx, - None => { + _none => { if let Some(c) = check_cache::(req, "").await { return Ok(c); } diff --git a/http/tests/game_mechanics.rs b/http/tests/game_mechanics.rs index 756be0f..3dea567 100644 --- a/http/tests/game_mechanics.rs +++ b/http/tests/game_mechanics.rs @@ -48,7 +48,7 @@ fn outfits() { #[test] fn pets() { let client = setup::setup(); - let _: Pet = client.single(1u32).unwrap(); + let _: Pet = client.single(1u16).unwrap(); } #[test] diff --git a/model/src/achievements.rs b/model/src/achievements.rs deleted file mode 100644 index a217020..0000000 --- a/model/src/achievements.rs +++ /dev/null @@ -1,45 +0,0 @@ -pub mod categories; -pub mod groups; - -use serde::{Deserialize, Serialize}; -use crate::{BulkEndpoint, Endpoint, EndpointWithId}; - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(test, serde(deny_unknown_fields))] -pub struct AchievementTier { - pub count: u32, - pub points: u32, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(test, serde(deny_unknown_fields))] -pub struct Achievement { - pub id: u32, - pub name: String, - pub description: String, - pub requirement: String, - pub locked_text: String, - #[serde(rename = "type")] - pub _type: String, - pub flags: Vec, - pub tiers: Vec, - pub point_cap: Option, - pub prerequisites: Option>, - pub bits: Option>, - pub rewards: Option>, - pub icon: Option, -} - -impl Endpoint for Achievement { - const AUTHENTICATED: bool = false; - const LOCALE: bool = true; - const URL: &'static str = "v2/achievements"; - const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; -} -impl EndpointWithId for Achievement { - type IdType = u32; -} -impl BulkEndpoint for Achievement { - const ALL: bool = false; - fn id(&self) -> &Self::IdType { &self.id } -} From 22d2b39d4d2aef491a8ba2d28d978fcce8e42cbc Mon Sep 17 00:00:00 2001 From: Baetens Jan Date: Wed, 15 Apr 2026 18:45:21 +0200 Subject: [PATCH 3/5] style: apply rustfmt formatting --- http/tests/achievements.rs | 4 +- http/tests/authenticated_new.rs | 2 +- http/tests/daily_rewards.rs | 4 +- http/tests/misc_new.rs | 13 +----- http/tests/pvp_new.rs | 6 +-- http/tests/wvw.rs | 5 +-- model/src/authenticated/account.rs | 2 +- .../authenticated/account/dailycrafting.rs | 1 + model/src/authenticated/account/dungeons.rs | 1 + model/src/authenticated/account/dyes.rs | 1 + model/src/authenticated/account/finishers.rs | 1 + model/src/authenticated/account/gliders.rs | 1 + model/src/authenticated/account/home.rs | 1 + model/src/authenticated/account/inventory.rs | 1 + model/src/authenticated/account/luck.rs | 1 + .../src/authenticated/account/mailcarriers.rs | 1 + model/src/authenticated/account/mapchests.rs | 1 + model/src/authenticated/account/masteries.rs | 1 + model/src/authenticated/account/minis.rs | 1 + model/src/authenticated/account/mounts.rs | 1 + model/src/authenticated/account/outfits.rs | 1 + model/src/authenticated/account/pvp.rs | 1 + model/src/authenticated/account/recipes.rs | 1 + model/src/authenticated/account/skins.rs | 1 + model/src/authenticated/account/titles.rs | 1 + .../src/authenticated/account/worldbosses.rs | 1 + model/src/authenticated/characters.rs | 2 + model/src/authenticated/commerce.rs | 1 + model/src/authenticated/pvp.rs | 2 + model/src/daily_rewards/dailycrafting.rs | 6 ++- model/src/daily_rewards/mapchests.rs | 6 ++- model/src/daily_rewards/worldbosses.rs | 6 ++- model/src/game_mechanics/legends.rs | 10 ++++- model/src/game_mechanics/masteries.rs | 10 ++++- model/src/game_mechanics/mounts.rs | 19 ++++++-- model/src/game_mechanics/outfits.rs | 10 ++++- model/src/game_mechanics/pets.rs | 3 +- model/src/game_mechanics/professions.rs | 14 ++++-- model/src/game_mechanics/races.rs | 10 ++++- model/src/game_mechanics/skills.rs | 9 +++- model/src/game_mechanics/specializations.rs | 10 ++++- model/src/game_mechanics/traits.rs | 14 ++++-- model/src/guild/authenticated.rs | 44 ++++++++++++++----- model/src/guild/emblem.rs | 19 ++++++-- model/src/guild/guild.rs | 11 ++++- model/src/guild/upgrades.rs | 10 ++++- model/src/items/finishers.rs | 10 ++++- model/src/items/materials.rs | 10 ++++- model/src/misc/dungeons.rs | 10 ++++- model/src/misc/files.rs | 10 ++++- model/src/misc/minis.rs | 10 ++++- model/src/misc/quaggans.rs | 10 ++++- model/src/misc/titles.rs | 10 ++++- model/src/pvp/amulets.rs | 11 ++++- model/src/pvp/ranks.rs | 10 ++++- model/src/pvp/seasons.rs | 10 ++++- model/src/story/backstory.rs | 19 ++++++-- model/src/story/stories.rs | 19 ++++++-- model/src/wvw/abilities.rs | 10 ++++- model/src/wvw/matches.rs | 10 ++++- model/src/wvw/objectives.rs | 10 ++++- model/src/wvw/ranks.rs | 10 ++++- model/src/wvw/upgrades.rs | 10 ++++- 63 files changed, 347 insertions(+), 113 deletions(-) diff --git a/http/tests/achievements.rs b/http/tests/achievements.rs index 179e9ac..17ab480 100644 --- a/http/tests/achievements.rs +++ b/http/tests/achievements.rs @@ -1,9 +1,7 @@ #![cfg(feature = "blocking")] use gw2lib::{ - model::achievements::{ - categories::AchievementCategory, groups::AchievementGroup, Achievement, - }, + model::achievements::{categories::AchievementCategory, groups::AchievementGroup, Achievement}, Requester, }; diff --git a/http/tests/authenticated_new.rs b/http/tests/authenticated_new.rs index 1866bd3..c2bbb97 100644 --- a/http/tests/authenticated_new.rs +++ b/http/tests/authenticated_new.rs @@ -3,8 +3,8 @@ use gw2lib::{ model::authenticated::{ characters::Character, - pvp::{PvpStandings, PvpStats}, commerce::{CurrentBuyTransactions, HistoryBuyTransactions}, + pvp::{PvpStandings, PvpStats}, }, Requester, }; diff --git a/http/tests/daily_rewards.rs b/http/tests/daily_rewards.rs index f741f9a..b1d9a32 100644 --- a/http/tests/daily_rewards.rs +++ b/http/tests/daily_rewards.rs @@ -2,9 +2,7 @@ use gw2lib::{ model::daily_rewards::{ - dailycrafting::DailyCrafting, - mapchests::MapChest, - worldbosses::WorldBoss, + dailycrafting::DailyCrafting, mapchests::MapChest, worldbosses::WorldBoss, }, Requester, }; diff --git a/http/tests/misc_new.rs b/http/tests/misc_new.rs index 7ea6fb0..3e4b0a7 100644 --- a/http/tests/misc_new.rs +++ b/http/tests/misc_new.rs @@ -2,17 +2,8 @@ use gw2lib::{ model::{ - misc::{ - dungeons::Dungeon, - files::GameFile, - minis::Mini, - quaggans::Quaggan, - titles::Title, - }, - items::{ - finishers::Finisher, - materials::MaterialCategory, - }, + items::{finishers::Finisher, materials::MaterialCategory}, + misc::{dungeons::Dungeon, files::GameFile, minis::Mini, quaggans::Quaggan, titles::Title}, }, Requester, }; diff --git a/http/tests/pvp_new.rs b/http/tests/pvp_new.rs index 59d9567..503a7f0 100644 --- a/http/tests/pvp_new.rs +++ b/http/tests/pvp_new.rs @@ -1,11 +1,7 @@ #![cfg(feature = "blocking")] use gw2lib::{ - model::pvp::{ - amulets::Amulet, - ranks::PvpRank, - seasons::PvpSeason, - }, + model::pvp::{amulets::Amulet, ranks::PvpRank, seasons::PvpSeason}, Requester, }; diff --git a/http/tests/wvw.rs b/http/tests/wvw.rs index 8a6723b..4811f8c 100644 --- a/http/tests/wvw.rs +++ b/http/tests/wvw.rs @@ -2,10 +2,7 @@ use gw2lib::{ model::wvw::{ - abilities::Ability, - matches::WvwMatch, - objectives::WvwObjective, - ranks::WvwRank, + abilities::Ability, matches::WvwMatch, objectives::WvwObjective, ranks::WvwRank, upgrades::WvwUpgrade, }, Requester, diff --git a/model/src/authenticated/account.rs b/model/src/authenticated/account.rs index 8dcfffc..080b047 100644 --- a/model/src/authenticated/account.rs +++ b/model/src/authenticated/account.rs @@ -21,8 +21,8 @@ pub mod recipes; pub mod skins; pub mod titles; pub mod wallet; -pub mod worldbosses; pub mod wizards_vault; +pub mod worldbosses; use std::collections::BTreeSet; diff --git a/model/src/authenticated/account/dailycrafting.rs b/model/src/authenticated/account/dailycrafting.rs index ec7e000..0d43849 100644 --- a/model/src/authenticated/account/dailycrafting.rs +++ b/model/src/authenticated/account/dailycrafting.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/dungeons.rs b/model/src/authenticated/account/dungeons.rs index 448c51d..12bf1b3 100644 --- a/model/src/authenticated/account/dungeons.rs +++ b/model/src/authenticated/account/dungeons.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/dyes.rs b/model/src/authenticated/account/dyes.rs index 127c909..2d5a6c3 100644 --- a/model/src/authenticated/account/dyes.rs +++ b/model/src/authenticated/account/dyes.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{misc::colors::ColorId, Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/finishers.rs b/model/src/authenticated/account/finishers.rs index 033bb20..6809d79 100644 --- a/model/src/authenticated/account/finishers.rs +++ b/model/src/authenticated/account/finishers.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/gliders.rs b/model/src/authenticated/account/gliders.rs index 7697515..fed8172 100644 --- a/model/src/authenticated/account/gliders.rs +++ b/model/src/authenticated/account/gliders.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/home.rs b/model/src/authenticated/account/home.rs index acfa757..9baf956 100644 --- a/model/src/authenticated/account/home.rs +++ b/model/src/authenticated/account/home.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/inventory.rs b/model/src/authenticated/account/inventory.rs index 4ce2252..445247d 100644 --- a/model/src/authenticated/account/inventory.rs +++ b/model/src/authenticated/account/inventory.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{ authenticated::characters::{Binding, Stats}, items::{skins::SkinId, ItemId}, diff --git a/model/src/authenticated/account/luck.rs b/model/src/authenticated/account/luck.rs index c699807..07674e1 100644 --- a/model/src/authenticated/account/luck.rs +++ b/model/src/authenticated/account/luck.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/mailcarriers.rs b/model/src/authenticated/account/mailcarriers.rs index 72232e8..61e3e36 100644 --- a/model/src/authenticated/account/mailcarriers.rs +++ b/model/src/authenticated/account/mailcarriers.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/mapchests.rs b/model/src/authenticated/account/mapchests.rs index b99eccd..ce93e56 100644 --- a/model/src/authenticated/account/mapchests.rs +++ b/model/src/authenticated/account/mapchests.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/masteries.rs b/model/src/authenticated/account/masteries.rs index 8f56bed..65d6e0c 100644 --- a/model/src/authenticated/account/masteries.rs +++ b/model/src/authenticated/account/masteries.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/minis.rs b/model/src/authenticated/account/minis.rs index 3560ce7..a6915d9 100644 --- a/model/src/authenticated/account/minis.rs +++ b/model/src/authenticated/account/minis.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{misc::minis::MiniPetId, Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/mounts.rs b/model/src/authenticated/account/mounts.rs index 2a0d3db..0439a71 100644 --- a/model/src/authenticated/account/mounts.rs +++ b/model/src/authenticated/account/mounts.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/outfits.rs b/model/src/authenticated/account/outfits.rs index 74411b1..121cc93 100644 --- a/model/src/authenticated/account/outfits.rs +++ b/model/src/authenticated/account/outfits.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/pvp.rs b/model/src/authenticated/account/pvp.rs index fd5319c..2c8f336 100644 --- a/model/src/authenticated/account/pvp.rs +++ b/model/src/authenticated/account/pvp.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/recipes.rs b/model/src/authenticated/account/recipes.rs index 7abff6b..52113b6 100644 --- a/model/src/authenticated/account/recipes.rs +++ b/model/src/authenticated/account/recipes.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{items::recipes::RecipeId, Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/skins.rs b/model/src/authenticated/account/skins.rs index adbd813..4957993 100644 --- a/model/src/authenticated/account/skins.rs +++ b/model/src/authenticated/account/skins.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{items::skins::SkinId, Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/titles.rs b/model/src/authenticated/account/titles.rs index 987bbb2..421b041 100644 --- a/model/src/authenticated/account/titles.rs +++ b/model/src/authenticated/account/titles.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{misc::titles::TitleId, Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/account/worldbosses.rs b/model/src/authenticated/account/worldbosses.rs index d5159ed..14d42f1 100644 --- a/model/src/authenticated/account/worldbosses.rs +++ b/model/src/authenticated/account/worldbosses.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/authenticated/characters.rs b/model/src/authenticated/characters.rs index 6d71253..24eebd5 100644 --- a/model/src/authenticated/characters.rs +++ b/model/src/authenticated/characters.rs @@ -506,6 +506,7 @@ pub struct Heropoints(pub Vec); impl EndpointWithId for Heropoints { type IdType = CharacterId; + fn format_url(id: &str) -> String { format!("{}/{}/heropoints", Self::URL, id) } @@ -551,6 +552,7 @@ pub struct Sab { impl EndpointWithId for Sab { type IdType = CharacterId; + fn format_url(id: &str) -> String { format!("{}/{}/sab", Self::URL, id) } diff --git a/model/src/authenticated/commerce.rs b/model/src/authenticated/commerce.rs index 84163d4..492c417 100644 --- a/model/src/authenticated/commerce.rs +++ b/model/src/authenticated/commerce.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{items::ItemId, Endpoint, FixedEndpoint, TimeStamp}; pub mod delivery; diff --git a/model/src/authenticated/pvp.rs b/model/src/authenticated/pvp.rs index e243c3c..2b76642 100644 --- a/model/src/authenticated/pvp.rs +++ b/model/src/authenticated/pvp.rs @@ -1,5 +1,7 @@ use std::collections::HashMap; + use serde::{Deserialize, Serialize}; + use crate::{Endpoint, FixedEndpoint, PagedEndpoint, TimeStamp}; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/daily_rewards/dailycrafting.rs b/model/src/daily_rewards/dailycrafting.rs index e6a4729..ab90110 100644 --- a/model/src/daily_rewards/dailycrafting.rs +++ b/model/src/daily_rewards/dailycrafting.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -18,5 +19,8 @@ impl EndpointWithId for DailyCrafting { } impl BulkEndpoint for DailyCrafting { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/daily_rewards/mapchests.rs b/model/src/daily_rewards/mapchests.rs index b9bbd41..e5055be 100644 --- a/model/src/daily_rewards/mapchests.rs +++ b/model/src/daily_rewards/mapchests.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -18,5 +19,8 @@ impl EndpointWithId for MapChest { } impl BulkEndpoint for MapChest { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/daily_rewards/worldbosses.rs b/model/src/daily_rewards/worldbosses.rs index 2af1103..7e1704c 100644 --- a/model/src/daily_rewards/worldbosses.rs +++ b/model/src/daily_rewards/worldbosses.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -18,5 +19,8 @@ impl EndpointWithId for WorldBoss { } impl BulkEndpoint for WorldBoss { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/game_mechanics/legends.rs b/model/src/game_mechanics/legends.rs index 900dd65..bd40d2b 100644 --- a/model/src/game_mechanics/legends.rs +++ b/model/src/game_mechanics/legends.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{game_mechanics::skills::SkillId, BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -17,8 +18,13 @@ impl Endpoint for Legend { const URL: &'static str = "v2/legends"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Legend { type IdType = String; } +impl EndpointWithId for Legend { + type IdType = String; +} impl BulkEndpoint for Legend { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/game_mechanics/masteries.rs b/model/src/game_mechanics/masteries.rs index 56d0a38..dde91e7 100644 --- a/model/src/game_mechanics/masteries.rs +++ b/model/src/game_mechanics/masteries.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -30,8 +31,13 @@ impl Endpoint for Mastery { const URL: &'static str = "v2/masteries"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Mastery { type IdType = u32; } +impl EndpointWithId for Mastery { + type IdType = u32; +} impl BulkEndpoint for Mastery { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/game_mechanics/mounts.rs b/model/src/game_mechanics/mounts.rs index 791ab80..fa1cf9c 100644 --- a/model/src/game_mechanics/mounts.rs +++ b/model/src/game_mechanics/mounts.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{misc::colors::ColorId, BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -24,10 +25,15 @@ impl Endpoint for MountSkin { const URL: &'static str = "v2/mounts/skins"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for MountSkin { type IdType = u32; } +impl EndpointWithId for MountSkin { + type IdType = u32; +} impl BulkEndpoint for MountSkin { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -46,8 +52,13 @@ impl Endpoint for MountType { const URL: &'static str = "v2/mounts/types"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for MountType { type IdType = String; } +impl EndpointWithId for MountType { + type IdType = String; +} impl BulkEndpoint for MountType { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/game_mechanics/outfits.rs b/model/src/game_mechanics/outfits.rs index f7e496b..45ecc2d 100644 --- a/model/src/game_mechanics/outfits.rs +++ b/model/src/game_mechanics/outfits.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{items::ItemId, BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -16,8 +17,13 @@ impl Endpoint for Outfit { const URL: &'static str = "v2/outfits"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Outfit { type IdType = u32; } +impl EndpointWithId for Outfit { + type IdType = u32; +} impl BulkEndpoint for Outfit { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/game_mechanics/pets.rs b/model/src/game_mechanics/pets.rs index b987d2d..2629ccb 100644 --- a/model/src/game_mechanics/pets.rs +++ b/model/src/game_mechanics/pets.rs @@ -1,7 +1,6 @@ use serde::{Deserialize, Serialize}; -use crate::{game_mechanics::skills::SkillId, BulkEndpoint, Endpoint, EndpointWithId}; -use crate::*; +use crate::{game_mechanics::skills::SkillId, BulkEndpoint, Endpoint, EndpointWithId, *}; pub type PetId = u16; diff --git a/model/src/game_mechanics/professions.rs b/model/src/game_mechanics/professions.rs index 82f3f08..b506420 100644 --- a/model/src/game_mechanics/professions.rs +++ b/model/src/game_mechanics/professions.rs @@ -1,5 +1,8 @@ use serde::{Deserialize, Serialize}; -use crate::{game_mechanics::specializations::SpecializationId, BulkEndpoint, Endpoint, EndpointWithId}; + +use crate::{ + game_mechanics::specializations::SpecializationId, BulkEndpoint, Endpoint, EndpointWithId, +}; #[derive(Clone, Debug, Serialize, Deserialize)] #[cfg_attr(test, serde(deny_unknown_fields))] @@ -22,8 +25,13 @@ impl Endpoint for ProfessionInfo { const URL: &'static str = "v2/professions"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for ProfessionInfo { type IdType = String; } +impl EndpointWithId for ProfessionInfo { + type IdType = String; +} impl BulkEndpoint for ProfessionInfo { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/game_mechanics/races.rs b/model/src/game_mechanics/races.rs index eafd78a..71d8621 100644 --- a/model/src/game_mechanics/races.rs +++ b/model/src/game_mechanics/races.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{game_mechanics::skills::SkillId, BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -15,8 +16,13 @@ impl Endpoint for Race { const URL: &'static str = "v2/races"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Race { type IdType = String; } +impl EndpointWithId for Race { + type IdType = String; +} impl BulkEndpoint for Race { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/game_mechanics/skills.rs b/model/src/game_mechanics/skills.rs index df52c05..6fedc57 100644 --- a/model/src/game_mechanics/skills.rs +++ b/model/src/game_mechanics/skills.rs @@ -119,8 +119,13 @@ impl Endpoint for Skill { const URL: &'static str = "v2/skills"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Skill { type IdType = SkillId; } +impl EndpointWithId for Skill { + type IdType = SkillId; +} impl BulkEndpoint for Skill { const ALL: bool = false; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/game_mechanics/specializations.rs b/model/src/game_mechanics/specializations.rs index 9f8428c..8ac01e3 100644 --- a/model/src/game_mechanics/specializations.rs +++ b/model/src/game_mechanics/specializations.rs @@ -1,6 +1,7 @@ pub type SpecializationId = u16; use serde::{Deserialize, Serialize}; + use crate::{game_mechanics::traits::TraitId, BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -25,8 +26,13 @@ impl Endpoint for Specialization { const URL: &'static str = "v2/specializations"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Specialization { type IdType = SpecializationId; } +impl EndpointWithId for Specialization { + type IdType = SpecializationId; +} impl BulkEndpoint for Specialization { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/game_mechanics/traits.rs b/model/src/game_mechanics/traits.rs index 34a7bd2..cd64254 100644 --- a/model/src/game_mechanics/traits.rs +++ b/model/src/game_mechanics/traits.rs @@ -1,7 +1,10 @@ pub type TraitId = u16; use serde::{Deserialize, Serialize}; -use crate::{game_mechanics::specializations::SpecializationId, BulkEndpoint, Endpoint, EndpointWithId}; + +use crate::{ + game_mechanics::specializations::SpecializationId, BulkEndpoint, Endpoint, EndpointWithId, +}; #[derive(Clone, Debug, Serialize, Deserialize)] #[cfg_attr(test, serde(deny_unknown_fields))] @@ -24,8 +27,13 @@ impl Endpoint for Trait { const URL: &'static str = "v2/traits"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Trait { type IdType = TraitId; } +impl EndpointWithId for Trait { + type IdType = TraitId; +} impl BulkEndpoint for Trait { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/guild/authenticated.rs b/model/src/guild/authenticated.rs index 3251853..0170795 100644 --- a/model/src/guild/authenticated.rs +++ b/model/src/guild/authenticated.rs @@ -1,11 +1,10 @@ use std::collections::HashMap; + use serde::{Deserialize, Serialize}; + use crate::{ - authenticated::pvp::PvpResult, - guild::upgrades::GuildUpgradeId, - items::ItemId, - TimeStamp, - Endpoint, EndpointWithId, + authenticated::pvp::PvpResult, guild::upgrades::GuildUpgradeId, items::ItemId, Endpoint, + EndpointWithId, TimeStamp, }; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -40,7 +39,10 @@ impl Endpoint for GuildLog { } impl EndpointWithId for GuildLog { type IdType = String; - fn format_url(id: &str) -> String { format!("v2/guild/{}/log", id) } + + fn format_url(id: &str) -> String { + format!("v2/guild/{}/log", id) + } } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -62,7 +64,10 @@ impl Endpoint for GuildMembers { } impl EndpointWithId for GuildMembers { type IdType = String; - fn format_url(id: &str) -> String { format!("v2/guild/{}/members", id) } + + fn format_url(id: &str) -> String { + format!("v2/guild/{}/members", id) + } } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -84,7 +89,10 @@ impl Endpoint for GuildRanks { } impl EndpointWithId for GuildRanks { type IdType = String; - fn format_url(id: &str) -> String { format!("v2/guild/{}/ranks", id) } + + fn format_url(id: &str) -> String { + format!("v2/guild/{}/ranks", id) + } } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -114,7 +122,10 @@ impl Endpoint for GuildStashes { } impl EndpointWithId for GuildStashes { type IdType = String; - fn format_url(id: &str) -> String { format!("v2/guild/{}/stash", id) } + + fn format_url(id: &str) -> String { + format!("v2/guild/{}/stash", id) + } } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -142,7 +153,10 @@ impl Endpoint for GuildTreasury { } impl EndpointWithId for GuildTreasury { type IdType = String; - fn format_url(id: &str) -> String { format!("v2/guild/{}/treasury", id) } + + fn format_url(id: &str) -> String { + format!("v2/guild/{}/treasury", id) + } } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -174,7 +188,10 @@ impl Endpoint for GuildTeams { } impl EndpointWithId for GuildTeams { type IdType = String; - fn format_url(id: &str) -> String { format!("v2/guild/{}/teams", id) } + + fn format_url(id: &str) -> String { + format!("v2/guild/{}/teams", id) + } } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -189,5 +206,8 @@ impl Endpoint for GuildCompletedUpgrades { } impl EndpointWithId for GuildCompletedUpgrades { type IdType = String; - fn format_url(id: &str) -> String { format!("v2/guild/{}/upgrades", id) } + + fn format_url(id: &str) -> String { + format!("v2/guild/{}/upgrades", id) + } } diff --git a/model/src/guild/emblem.rs b/model/src/guild/emblem.rs index 8871a63..5d4afff 100644 --- a/model/src/guild/emblem.rs +++ b/model/src/guild/emblem.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -21,10 +22,15 @@ impl Endpoint for EmblemBackground { const URL: &'static str = "v2/emblem/backgrounds"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for EmblemBackground { type IdType = u32; } +impl EndpointWithId for EmblemBackground { + type IdType = u32; +} impl BulkEndpoint for EmblemBackground { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } impl Endpoint for EmblemForeground { @@ -33,8 +39,13 @@ impl Endpoint for EmblemForeground { const URL: &'static str = "v2/emblem/foregrounds"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for EmblemForeground { type IdType = u32; } +impl EndpointWithId for EmblemForeground { + type IdType = u32; +} impl BulkEndpoint for EmblemForeground { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/guild/guild.rs b/model/src/guild/guild.rs index b320df9..ae213d3 100644 --- a/model/src/guild/guild.rs +++ b/model/src/guild/guild.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{misc::colors::ColorId, BulkEndpoint, Endpoint, EndpointWithId, FixedEndpoint}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -41,6 +42,7 @@ impl Endpoint for Guild { } impl EndpointWithId for Guild { type IdType = String; + fn format_url(id: &str) -> String { format!("v2/guild/{}", id) } @@ -60,10 +62,15 @@ impl Endpoint for GuildPermission { const URL: &'static str = "v2/guild/permissions"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for GuildPermission { type IdType = String; } +impl EndpointWithId for GuildPermission { + type IdType = String; +} impl BulkEndpoint for GuildPermission { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/model/src/guild/upgrades.rs b/model/src/guild/upgrades.rs index efd2309..7e14c8c 100644 --- a/model/src/guild/upgrades.rs +++ b/model/src/guild/upgrades.rs @@ -1,6 +1,7 @@ pub type GuildUpgradeId = u64; use serde::{Deserialize, Serialize}; + use crate::{items::ItemId, BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -37,8 +38,13 @@ impl Endpoint for GuildUpgrade { const URL: &'static str = "v2/guild/upgrades"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for GuildUpgrade { type IdType = GuildUpgradeId; } +impl EndpointWithId for GuildUpgrade { + type IdType = GuildUpgradeId; +} impl BulkEndpoint for GuildUpgrade { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/items/finishers.rs b/model/src/items/finishers.rs index d363686..68c87c7 100644 --- a/model/src/items/finishers.rs +++ b/model/src/items/finishers.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{items::ItemId, BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -18,8 +19,13 @@ impl Endpoint for Finisher { const URL: &'static str = "v2/finishers"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Finisher { type IdType = u32; } +impl EndpointWithId for Finisher { + type IdType = u32; +} impl BulkEndpoint for Finisher { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/items/materials.rs b/model/src/items/materials.rs index ce361e5..e7121ce 100644 --- a/model/src/items/materials.rs +++ b/model/src/items/materials.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{items::ItemId, BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -16,8 +17,13 @@ impl Endpoint for MaterialCategory { const URL: &'static str = "v2/materials"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for MaterialCategory { type IdType = u32; } +impl EndpointWithId for MaterialCategory { + type IdType = u32; +} impl BulkEndpoint for MaterialCategory { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/misc/dungeons.rs b/model/src/misc/dungeons.rs index 5e0c614..f7eb45f 100644 --- a/model/src/misc/dungeons.rs +++ b/model/src/misc/dungeons.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -22,8 +23,13 @@ impl Endpoint for Dungeon { const URL: &'static str = "v2/dungeons"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Dungeon { type IdType = String; } +impl EndpointWithId for Dungeon { + type IdType = String; +} impl BulkEndpoint for Dungeon { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/misc/files.rs b/model/src/misc/files.rs index 41055ba..51a2bc9 100644 --- a/model/src/misc/files.rs +++ b/model/src/misc/files.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -14,8 +15,13 @@ impl Endpoint for GameFile { const URL: &'static str = "v2/files"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for GameFile { type IdType = String; } +impl EndpointWithId for GameFile { + type IdType = String; +} impl BulkEndpoint for GameFile { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/misc/minis.rs b/model/src/misc/minis.rs index 79d7999..f29764e 100644 --- a/model/src/misc/minis.rs +++ b/model/src/misc/minis.rs @@ -1,6 +1,7 @@ pub type MiniPetId = u64; use serde::{Deserialize, Serialize}; + use crate::{items::ItemId, BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -19,8 +20,13 @@ impl Endpoint for Mini { const URL: &'static str = "v2/minis"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Mini { type IdType = MiniPetId; } +impl EndpointWithId for Mini { + type IdType = MiniPetId; +} impl BulkEndpoint for Mini { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/misc/quaggans.rs b/model/src/misc/quaggans.rs index 9af6782..81642fd 100644 --- a/model/src/misc/quaggans.rs +++ b/model/src/misc/quaggans.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -14,8 +15,13 @@ impl Endpoint for Quaggan { const URL: &'static str = "v2/quaggans"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Quaggan { type IdType = String; } +impl EndpointWithId for Quaggan { + type IdType = String; +} impl BulkEndpoint for Quaggan { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/misc/titles.rs b/model/src/misc/titles.rs index 621ea03..e93580c 100644 --- a/model/src/misc/titles.rs +++ b/model/src/misc/titles.rs @@ -1,6 +1,7 @@ pub type TitleId = u16; use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -18,8 +19,13 @@ impl Endpoint for Title { const URL: &'static str = "v2/titles"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Title { type IdType = TitleId; } +impl EndpointWithId for Title { + type IdType = TitleId; +} impl BulkEndpoint for Title { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/pvp/amulets.rs b/model/src/pvp/amulets.rs index ea9c333..23950cf 100644 --- a/model/src/pvp/amulets.rs +++ b/model/src/pvp/amulets.rs @@ -1,7 +1,9 @@ pub type AmuletId = u16; use std::collections::HashMap; + use serde::{Deserialize, Serialize}; + use crate::{items::AttributeType, BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -19,8 +21,13 @@ impl Endpoint for Amulet { const URL: &'static str = "v2/pvp/amulets"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Amulet { type IdType = AmuletId; } +impl EndpointWithId for Amulet { + type IdType = AmuletId; +} impl BulkEndpoint for Amulet { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/pvp/ranks.rs b/model/src/pvp/ranks.rs index 1f9874f..1edfdf2 100644 --- a/model/src/pvp/ranks.rs +++ b/model/src/pvp/ranks.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -27,8 +28,13 @@ impl Endpoint for PvpRank { const URL: &'static str = "v2/pvp/ranks"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for PvpRank { type IdType = u32; } +impl EndpointWithId for PvpRank { + type IdType = u32; +} impl BulkEndpoint for PvpRank { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/pvp/seasons.rs b/model/src/pvp/seasons.rs index 6432434..e23be5c 100644 --- a/model/src/pvp/seasons.rs +++ b/model/src/pvp/seasons.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId, TimeStamp}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -36,8 +37,13 @@ impl Endpoint for PvpSeason { const URL: &'static str = "v2/pvp/seasons"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for PvpSeason { type IdType = String; } +impl EndpointWithId for PvpSeason { + type IdType = String; +} impl BulkEndpoint for PvpSeason { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/story/backstory.rs b/model/src/story/backstory.rs index d8f48fd..c5d8bee 100644 --- a/model/src/story/backstory.rs +++ b/model/src/story/backstory.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -19,10 +20,15 @@ impl Endpoint for BackstoryAnswer { const URL: &'static str = "v2/backstory/answers"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for BackstoryAnswer { type IdType = String; } +impl EndpointWithId for BackstoryAnswer { + type IdType = String; +} impl BulkEndpoint for BackstoryAnswer { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -43,8 +49,13 @@ impl Endpoint for BackstoryQuestion { const URL: &'static str = "v2/backstory/questions"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for BackstoryQuestion { type IdType = u32; } +impl EndpointWithId for BackstoryQuestion { + type IdType = u32; +} impl BulkEndpoint for BackstoryQuestion { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/story/stories.rs b/model/src/story/stories.rs index 057429f..e8dea7e 100644 --- a/model/src/story/stories.rs +++ b/model/src/story/stories.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -29,10 +30,15 @@ impl Endpoint for Story { const URL: &'static str = "v2/stories"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Story { type IdType = u32; } +impl EndpointWithId for Story { + type IdType = u32; +} impl BulkEndpoint for Story { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -50,8 +56,13 @@ impl Endpoint for StorySeason { const URL: &'static str = "v2/stories/seasons"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for StorySeason { type IdType = String; } +impl EndpointWithId for StorySeason { + type IdType = String; +} impl BulkEndpoint for StorySeason { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/wvw/abilities.rs b/model/src/wvw/abilities.rs index 2fd0fd0..fac0bc7 100644 --- a/model/src/wvw/abilities.rs +++ b/model/src/wvw/abilities.rs @@ -1,6 +1,7 @@ pub type AbilityId = u32; use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -26,8 +27,13 @@ impl Endpoint for Ability { const URL: &'static str = "v2/wvw/abilities"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for Ability { type IdType = AbilityId; } +impl EndpointWithId for Ability { + type IdType = AbilityId; +} impl BulkEndpoint for Ability { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/wvw/matches.rs b/model/src/wvw/matches.rs index 4d2604b..32bd2dc 100644 --- a/model/src/wvw/matches.rs +++ b/model/src/wvw/matches.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId, TimeStamp}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -39,8 +40,13 @@ impl Endpoint for WvwMatch { const URL: &'static str = "v2/wvw/matches"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for WvwMatch { type IdType = String; } +impl EndpointWithId for WvwMatch { + type IdType = String; +} impl BulkEndpoint for WvwMatch { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/wvw/objectives.rs b/model/src/wvw/objectives.rs index 91c1e59..a0ee947 100644 --- a/model/src/wvw/objectives.rs +++ b/model/src/wvw/objectives.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -24,8 +25,13 @@ impl Endpoint for WvwObjective { const URL: &'static str = "v2/wvw/objectives"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for WvwObjective { type IdType = String; } +impl EndpointWithId for WvwObjective { + type IdType = String; +} impl BulkEndpoint for WvwObjective { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/wvw/ranks.rs b/model/src/wvw/ranks.rs index 9ea8a63..ed7dc2f 100644 --- a/model/src/wvw/ranks.rs +++ b/model/src/wvw/ranks.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -15,8 +16,13 @@ impl Endpoint for WvwRank { const URL: &'static str = "v2/wvw/ranks"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for WvwRank { type IdType = u32; } +impl EndpointWithId for WvwRank { + type IdType = u32; +} impl BulkEndpoint for WvwRank { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } diff --git a/model/src/wvw/upgrades.rs b/model/src/wvw/upgrades.rs index 5cbdb1d..4d181a0 100644 --- a/model/src/wvw/upgrades.rs +++ b/model/src/wvw/upgrades.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; + use crate::{BulkEndpoint, Endpoint, EndpointWithId}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -30,8 +31,13 @@ impl Endpoint for WvwUpgrade { const URL: &'static str = "v2/wvw/upgrades"; const VERSION: &'static str = "2021-01-11T00:00:00.000Z"; } -impl EndpointWithId for WvwUpgrade { type IdType = u32; } +impl EndpointWithId for WvwUpgrade { + type IdType = u32; +} impl BulkEndpoint for WvwUpgrade { const ALL: bool = true; - fn id(&self) -> &Self::IdType { &self.id } + + fn id(&self) -> &Self::IdType { + &self.id + } } From c3847a195fff0fd1d3220d9abad2338bd38270db Mon Sep 17 00:00:00 2001 From: Jan Baetens Date: Wed, 15 Apr 2026 18:54:58 +0200 Subject: [PATCH 4/5] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- model/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/README.md b/model/README.md index b7cad29..8b50a34 100644 --- a/model/README.md +++ b/model/README.md @@ -42,7 +42,7 @@ Example commit adding an endpoint: [bcb0bd3](https://github.com/greaka/gw2lib/co - [x] nodes - [x] inventory - [x] luck - - [x] mailcarries + - [x] mailcarriers - [x] mapchests - [x] masteries - mastery From 3985565e8311cea1ea854c0b42156d8e4fc972f6 Mon Sep 17 00:00:00 2001 From: Baetens Jan Date: Wed, 15 Apr 2026 19:00:29 +0200 Subject: [PATCH 5/5] refactor: remove unused wildcard import in pets.rs and skills.rs --- model/src/game_mechanics/pets.rs | 2 +- model/src/game_mechanics/skills.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/model/src/game_mechanics/pets.rs b/model/src/game_mechanics/pets.rs index 2629ccb..d67c90b 100644 --- a/model/src/game_mechanics/pets.rs +++ b/model/src/game_mechanics/pets.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -use crate::{game_mechanics::skills::SkillId, BulkEndpoint, Endpoint, EndpointWithId, *}; +use crate::{game_mechanics::skills::SkillId, BulkEndpoint, Endpoint, EndpointWithId}; pub type PetId = u16; diff --git a/model/src/game_mechanics/skills.rs b/model/src/game_mechanics/skills.rs index 6fedc57..219bfb4 100644 --- a/model/src/game_mechanics/skills.rs +++ b/model/src/game_mechanics/skills.rs @@ -110,7 +110,6 @@ pub struct Skill { pub log: Option, pub ranges: Option>, pub recharge: Option, - pub equip_ttype: Option, } impl Endpoint for Skill {