From d35534c0795caeda46e57fc515b74eba701110a2 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Fri, 6 Dec 2019 18:00:04 +0100 Subject: initial commit --- src/api/professions.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/api/professions.rs (limited to 'src/api/professions.rs') diff --git a/src/api/professions.rs b/src/api/professions.rs new file mode 100644 index 0000000..2716a1a --- /dev/null +++ b/src/api/professions.rs @@ -0,0 +1,36 @@ +//! Struct definitions for the professions API endpoint. +//! +//! * [Example](https://api.guildwars2.com/v2/professions/Engineer) +//! * [Wiki](https://wiki.guildwars2.com/wiki/API:2/professions) + +use super::HasId; +use serde::{Deserialize, Serialize}; + +#[derive(Deserialize, Serialize, Debug, Clone)] +pub struct Profession { + /// The profession id. + pub id: String, + /// The name of the profession. + pub name: String, + /// List of specialization ids. + pub specializations: Vec, + /// List of skills. + pub skills: Vec, +} + +impl HasId for Profession { + type Id = String; + fn get_id(&self) -> String { + self.id.clone() + } +} + +#[derive(Deserialize, Serialize, Debug, Clone)] +pub struct Skill { + /// The id of the skill. + pub id: u32, + /// The skill bar slot that this skill can be used in. + pub slot: String, + #[serde(rename = "type")] + pub typ: String, +} -- cgit v1.2.3