Skip to content

Commit

Permalink
Add support for fetching mail label information (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhelwig committed Jan 30, 2024
1 parent 33753a2 commit ffd2079
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/groups/mail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,38 @@ use crate::prelude::*;
pub struct MailGroup<'a> {
pub(crate) esi: &'a Esi,
}

#[derive(Debug, Deserialize, Serialize, Clone)]
/// Information about all mail labels.
pub struct MailLabels {
/// List of individual mail labels.
pub labels: Vec<MailLabel>,
/// Total unread count across all labels.
pub unread_count: Option<i32>,
}

#[derive(Debug, Deserialize, Serialize, Clone)]
/// Information about an individual mail label.
pub struct MailLabel {
/// Color of the label as RGB Hex (`#rrggbb`).
pub color: String,
/// ID of the label.
pub label_id: i32,
/// Name of the label.
pub name: String,
/// Number of unread messages with this label.
#[serde(default)]
pub unread_count: Option<i32>,
}

impl<'a> MailGroup<'a> {
api_get!(
/// Return a list of the users mail labels, unread counts for each
/// label and a total unread count.
get_character_mail_labels,
"get_characters_character_id_mail_labels",
RequestType::Authenticated,
MailLabels,
(character_id: i32) => "{character_id}"
);
}

0 comments on commit ffd2079

Please sign in to comment.