Skip to main content

esi_openapi/groups/
assets.rs

1use crate::prelude::*;
2
3/// Endpoints for Assets
4pub struct AssetsGroup<'a> {
5    pub(crate) esi: &'a Esi,
6}
7
8#[derive(Debug, Deserialize)]
9#[allow(missing_docs)]
10pub struct Asset {
11    pub is_blueprint_copy: Option<bool>,
12    pub is_singleton: bool,
13    pub item_id: i64,
14    pub location_flag: String,
15    pub location_id: i64,
16    pub location_type: String,
17    pub quantity: i32,
18    pub type_id: i32,
19}
20
21#[derive(Debug, Deserialize)]
22#[allow(missing_docs)]
23pub struct AssetLocationPosition {
24    pub x: f64,
25    pub y: f64,
26    pub z: f64,
27}
28
29#[derive(Debug, Deserialize)]
30#[allow(missing_docs)]
31pub struct AssetLocation {
32    pub item_id: i64,
33    pub position: AssetLocationPosition,
34}
35
36#[derive(Debug, Deserialize)]
37#[allow(missing_docs)]
38pub struct AssetName {
39    pub item_id: u64,
40    pub name: String,
41}
42
43impl AssetsGroup<'_> {
44    api_get!(
45        /// Get a character's assets.
46        get_character_assets,
47        "GetCharactersCharacterIdAssets",
48        RequestType::Authenticated,
49        Vec<Asset>,
50        (character_id: i32) => "{character_id}"
51    );
52
53    api_post!(
54        /// Get locations of some of a character's assets.
55        get_character_assets_locations,
56        "PostCharactersCharacterIdAssetsLocations",
57        RequestType::Authenticated,
58        Vec<AssetLocation>,
59        (character_id: i32) => "{character_id}",
60        item_ids: &[i64],
61    );
62
63    api_post!(
64        /// Get names of some of a character's assets.
65        get_character_assets_names,
66        "PostCharactersCharacterIdAssetsNames",
67        RequestType::Authenticated,
68        Vec<AssetName>,
69        (character_id: i32) => "{character_id}",
70        item_ids: &[u64],
71    );
72
73    api_get!(
74        /// Get a corporation's assets.
75        ///
76        /// Requires the auth'd character to be a director/+ in the corp.
77        get_corporation_assets,
78        "GetCorporationsCorporationIdAssets",
79        RequestType::Authenticated,
80        Vec<Asset>,
81        (corporation_id: u64) => "{corporation_id}"
82    );
83
84    api_post!(
85        /// Get locations of some of a corporation's assets.
86        ///
87        /// Requires the auth'd character to be a director/+ in the corp.
88        get_corporation_assets_locations,
89        "PostCorporationsCorporationIdAssetsLocations",
90        RequestType::Authenticated,
91        Vec<AssetLocation>,
92        (corporation_id: u64) => "{corporation_id}",
93        item_ids: &[u64],
94    );
95
96    api_post!(
97        /// Get names of some of a corporation's assets.
98        ///
99        /// Requires the auth'd character to be a director/+ in the corp.
100        get_corporation_assets_names,
101        "PostCorporationsCorporationIdAssetsNames",
102        RequestType::Authenticated,
103        Vec<AssetName>,
104        (corporation_id: u64) => "{corporation_id}",
105        item_ids: &[u64],
106    );
107}