use crate::error::Error;
use crate::model::standing::Standing;
use crate::scope::CharactersScopes;
use crate::{Client, ScopeBuilder};
use crate::model::asset::Blueprint;
use crate::model::character::{
Character, CharacterAffiliation, CharacterCorporationHistory, CharacterCorporationRole,
CharacterCorporationTitle, CharacterJumpFatigue, CharacterMedal,
CharacterNewContactNotification, CharacterNotification, CharacterPortraits,
CharacterResearchAgent,
};
pub struct CharacterEndpoints<'a> {
client: &'a Client,
}
impl<'a> CharacterEndpoints<'a> {
pub(super) fn new(client: &'a Client) -> Self {
Self { client }
}
define_endpoint! {
pub_get get_character_public_information(
character_id: i64
) -> Result<Character, Error>
url = "{}/characters/{}";
label = "public information";
}
define_endpoint! {
pub_post character_affiliation(
character_ids: Vec<i64>,
) -> Result<Vec<CharacterAffiliation>, Error>
url = "{}/characters/affiliation";
label = "character affiliation";
}
define_endpoint! {
auth_get get_agents_research(
access_token: &str,
character_id: i64
) -> Result<Vec<CharacterResearchAgent>, Error>
url = "{}/characters/{}/agents_research";
label = "research agents";
required_scopes = ScopeBuilder::new()
.characters(CharactersScopes::new().read_agents_research())
.build();
}
define_endpoint! {
auth_get get_blueprints(
access_token: &str,
character_id: i64;
page: i32
) -> Result<Vec<Blueprint>, Error>
url = "{}/characters/{}/blueprints";
label = "blueprints";
required_scopes = ScopeBuilder::new().characters(CharactersScopes::new().read_blueprints()).build();
}
define_endpoint! {
pub_get get_corporation_history(
character_id: i64
) -> Result<Vec<CharacterCorporationHistory>, Error>
url = "{}/characters/{}/corporationhistory";
label = "corporation history";
}
define_endpoint! {
auth_post calculate_a_cspa_charge_cost(
access_token: &str,
character_ids: Vec<i64>,
character_id: i64
) -> Result<f64, Error>
url = "{}/characters/{}/cspa";
label = "CSPA charge cost";
required_scopes = ScopeBuilder::new().characters(CharactersScopes::new().read_contacts()).build();
}
define_endpoint! {
auth_get get_jump_fatigue(
access_token: &str,
character_id: i64
) -> Result<CharacterJumpFatigue, Error>
url = "{}/characters/{}/fatigue";
label = "jump fatigue";
required_scopes = ScopeBuilder::new().characters(CharactersScopes::new().read_fatigue()).build();
}
define_endpoint! {
auth_get get_medals(
access_token: &str,
character_id: i64
) -> Result<Vec<CharacterMedal>, Error>
url = "{}/characters/{}/medals";
label = "medals";
required_scopes = ScopeBuilder::new().characters(CharactersScopes::new().read_medals()).build();
}
define_endpoint! {
auth_get get_character_notifications(
access_token: &str,
character_id: i64
) -> Result<Vec<CharacterNotification>, Error>
url = "{}/characters/{}/notifications";
label = "notifications";
required_scopes = ScopeBuilder::new().characters(CharactersScopes::new().read_notifications()).build();
}
define_endpoint! {
auth_get get_new_contact_notifications(
access_token: &str,
character_id: i64
) -> Result<Vec<CharacterNewContactNotification>, Error>
url = "{}/characters/{}/notifications/contacts";
label = "new contact notifications";
required_scopes = ScopeBuilder::new().characters(CharactersScopes::new().read_notifications()).build();
}
define_endpoint! {
pub_get get_character_portraits(
character_id: i64
) -> Result<CharacterPortraits, Error>
url = "{}/characters/{}/portrait";
label = "portraits";
}
define_endpoint! {
auth_get get_character_corporation_roles(
access_token: &str,
character_id: i64
) -> Result<CharacterCorporationRole, Error>
url = "{}/characters/{}/roles";
label = "corporation roles";
required_scopes = ScopeBuilder::new().characters(CharactersScopes::new().read_corporation_roles()).build();
}
define_endpoint! {
auth_get get_standings(
access_token: &str,
character_id: i64
) -> Result<Vec<Standing>, Error>
url = "{}/characters/{}/standings";
label = "NPC standings";
required_scopes = ScopeBuilder::new().characters(CharactersScopes::new().read_standings()).build();
}
define_endpoint! {
auth_get get_character_corporation_titles(
access_token: &str,
character_id: i64
) -> Result<Vec<CharacterCorporationTitle>, Error>
url = "{}/characters/{}/titles";
label = "standings";
required_scopes = ScopeBuilder::new().characters(CharactersScopes::new().read_titles()).build();
}
}