Skip to main content

esi_openapi/groups/
killmails.rs

1use crate::prelude::*;
2
3/// Endpoints for Killmails
4pub struct KillmailsGroup<'a> {
5    pub(crate) esi: &'a Esi,
6}
7
8#[derive(Debug, Deserialize)]
9#[allow(missing_docs)]
10pub struct RecentKillMail {
11    pub killmail_hash: String,
12    pub killmail_id: i32,
13}
14
15#[derive(Debug, Deserialize)]
16#[allow(missing_docs)]
17pub struct KillmailAttacker {
18    pub alliance_id: Option<i32>,
19    pub character_id: Option<i32>,
20    pub corporation_id: Option<i32>,
21    pub damage_done: i32,
22    pub faction_id: Option<i32>,
23    pub final_blow: bool,
24    pub security_status: f64,
25    pub ship_type_id: Option<i32>,
26    pub weapon_type_id: Option<i32>,
27}
28
29#[derive(Debug, Deserialize)]
30#[allow(missing_docs)]
31pub struct KillmailItem {
32    pub flag: i32,
33    pub item_type_id: i32,
34    pub quantity_destroyed: Option<i64>,
35    pub quantity_dropped: Option<i64>,
36    pub singleton: i32,
37    /// Items inside this item (e.g. the contents of a container).
38    pub items: Option<Vec<KillmailItem>>,
39}
40
41#[derive(Debug, Deserialize)]
42#[allow(missing_docs)]
43pub struct KillmailVictim {
44    pub alliance_id: Option<i32>,
45    pub character_id: Option<i32>,
46    pub corporation_id: Option<i32>,
47    pub damage_taken: i32,
48    pub faction_id: Option<i32>,
49    pub items: Option<Vec<KillmailItem>>,
50    pub position: Option<KillmailPosition>,
51    pub ship_type_id: i32,
52}
53
54#[derive(Debug, Deserialize)]
55#[allow(missing_docs)]
56pub struct KillmailPosition {
57    pub x: f64,
58    pub y: f64,
59    pub z: f64,
60}
61
62#[derive(Debug, Deserialize)]
63#[allow(missing_docs)]
64pub struct Killmail {
65    pub killmail_id: i32,
66    pub killmail_time: String,
67    pub solar_system_id: i32,
68    pub moon_id: Option<i32>,
69    pub war_id: Option<i32>,
70    pub attackers: Vec<KillmailAttacker>,
71    pub victim: KillmailVictim,
72}
73
74impl KillmailsGroup<'_> {
75    // NOTE unknown type; I haven't played in a long time
76    api_get!(
77        /// Get a character's recent kills & losses.
78        get_character_recent,
79        "GetCharactersCharacterIdKillmailsRecent",
80        RequestType::Authenticated,
81        Vec<RecentKillMail>,
82        (character_id: i32) => "{character_id}"
83    );
84
85    api_get!(
86        /// Get a killmail.
87        get_killmail,
88        "GetKillmailsKillmailIdKillmailHash",
89        RequestType::Public,
90        Killmail,
91        (killmail_id: i32) => "{killmail_id}",
92        (killmail_hash: &str) => "{killmail_hash}"
93    );
94
95    // more endpoints ...
96}