eversal-esi 0.2.0

ESI Library for the Eversal project
Documentation
use super::{Killmail, RecentKillmail};
use crate::{get_authenticated, get_public, Esi, EsiResult, Response};

impl Esi {
  /**
   * Requires the following scope: esi-killmails.read_killmails.v1
   * Return a list of a character’s kills and losses going back 90 days
   * esi: https://esi.evetech.net/latest/characters/{character_id}/killmails/
   */
  pub async fn get_character_recent_killmails(
    &self,
    character_id: i32,
    access_token: &str,
    etag: Option<&str>,
  ) -> EsiResult<Response<Vec<RecentKillmail>>> {
    let result = get_authenticated::<Vec<RecentKillmail>>(
      access_token,
      &format!("characters/{}/killmails/recent/", character_id),
      self,
      None,
      etag,
    )
    .await?;
    Ok(result)
  }

  /**
   * Requires the following scope: esi-killmails.read_corporation_killmails.v1
   * Get a list of a corporation’s kills and losses going back 90 days
   * esi: https://esi.evetech.net/latest/corporations/{corporation_id}/killmails/
   */
  pub async fn get_corporation_recent_killmails(
    &self,
    corporation_id: i32,
    access_token: &str,
    etag: Option<&str>,
  ) -> EsiResult<Response<Vec<RecentKillmail>>> {
    let result = get_authenticated::<Vec<RecentKillmail>>(
      access_token,
      &format!("corporations/{}/killmails/recent/", corporation_id),
      self,
      None,
      etag,
    )
    .await?;
    Ok(result)
  }

  /**
   * Return a single killmail from its ID and hash
   * esi: https://esi.evetech.net/latest/killmails/{killmail_id}/{killmail_hash}/
   */
  pub async fn get_killmail(
    &self,
    killmail_id: i32,
    killmail_hash: &str,
    etag: Option<&str>,
  ) -> EsiResult<Response<Killmail>> {
    let result = get_public::<Killmail>(
      &format!("killmails/{}/{}/", killmail_id, killmail_hash),
      self,
      None,
      etag,
    )
    .await?;
    Ok(result)
  }
}