Skip to main content

esi_openapi/groups/
assets.rs

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