eversal-esi 0.2.0

ESI Library for the Eversal project
Documentation
use super::{Character, CharacterAffiliation};
use crate::{get_public, post_public, Esi, EsiResult, Response};

impl Esi {
  /**
   * Public information about a character
   * esi: https://esi.evetech.net/latest/characters/{character_id}/
   */
  pub async fn get_character(
    &self,
    character_id: i32,
    etag: Option<&str>,
  ) -> EsiResult<Response<Character>> {
    let result =
      get_public::<Character>(&format!("characters/{}", character_id), self, None, etag).await?;
    Ok(result)
  }

  /**
   * Requires the following scope: esi-characters.read_agents_research.v1
   * Return a list of agents research information for a character. The formula for finding the current research points with an agent is: currentPoints = remainderPoints + pointsPerDay * days(currentTime - researchStartDate)
   * esi: https://esi.evetech.net/latest/characters/{character_id}/agents_research/
   */
  pub async fn get_character_agents_research(
    &self,
    character_id: i32,
    etag: Option<&str>,
  ) -> EsiResult<Response<Vec<i32>>> {
    let result = get_public::<Vec<i32>>(
      &format!("characters/{}/agents_research", character_id),
      self,
      None,
      etag,
    )
    .await?;
    Ok(result)
  }

  /**
   * Bulk lookup of character IDs to corporation, alliance and faction
   * Requires the following scope: esi-characters.read_corporation_roles.v1
   * esi: https://esi.evetech.net/latest/characters/{character_ids}/affiliation/
   */
  pub async fn post_character_affiliations(
    &self,
    character_ids: Vec<i32>,
  ) -> EsiResult<Vec<CharacterAffiliation>> {
    let result = post_public::<Vec<CharacterAffiliation>, Vec<i32>>(
      "characters/affiliation",
      self,
      None,
      &character_ids,
    )
    .await?;
    Ok(result)
  }
}