use crate::{
model::asset::{Asset, AssetLocation, AssetName},
scope::AssetsScopes,
Client, Error, ScopeBuilder,
};
pub struct AssetsEndpoints<'a> {
client: &'a Client,
}
impl<'a> AssetsEndpoints<'a> {
pub(super) fn new(client: &'a Client) -> Self {
Self { client }
}
define_endpoint! {
auth_get get_character_assets(
access_token: &str,
character_id: i64;
page: i32
) -> Result<Vec<Asset>, Error>
url = "{}/characters/{}/assets";
label = "assets";
required_scopes = ScopeBuilder::new()
.assets(AssetsScopes::new().read_assets())
.build();
}
define_endpoint! {
auth_post get_character_asset_locations(
access_token: &str,
item_ids: Vec<i64>,
character_id: i64
) -> Result<Vec<AssetLocation>, Error>
url = "{}/characters/{}/assets/locations";
label = "asset locations";
required_scopes = ScopeBuilder::new()
.assets(AssetsScopes::new().read_assets())
.build();
}
define_endpoint! {
auth_post get_character_asset_names(
access_token: &str,
item_ids: Vec<i64>,
character_id: i64
) -> Result<Vec<AssetName>, Error>
url = "{}/characters/{}/assets/names";
label = "asset names";
required_scopes = ScopeBuilder::new()
.assets(AssetsScopes::new().read_assets())
.build();
}
define_endpoint! {
auth_get get_corporation_assets(
access_token: &str,
corporation_id: i64;
page: i32
) -> Result<Vec<Asset>, Error>
url = "{}/corporations/{}/assets";
label = "assets";
required_scopes = ScopeBuilder::new()
.assets(AssetsScopes::new().read_corporation_assets())
.build();
}
define_endpoint! {
auth_post get_corporation_asset_locations(
access_token: &str,
item_ids: Vec<i64>,
corporation_id: i64
) -> Result<Vec<AssetLocation>, Error>
url = "{}/corporations/{}/assets/locations";
label = "asset locations";
required_scopes = ScopeBuilder::new()
.assets(AssetsScopes::new().read_corporation_assets())
.build();
}
define_endpoint! {
auth_post get_corporation_asset_names(
access_token: &str,
item_ids: Vec<i64>,
corporation_id: i64
) -> Result<Vec<AssetName>, Error>
url = "{}/corporations/{}/assets/names";
label = "asset names";
required_scopes = ScopeBuilder::new()
.assets(AssetsScopes::new().read_corporation_assets())
.build();
}
}