Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for fetching mail label information #37

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}"
);
}