From ffd2079c8dcecd2096713355a96152c956317ec7 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Tue, 30 Jan 2024 10:59:04 -0800 Subject: [PATCH] Add support for fetching mail label information (#37) --- src/groups/mail.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/groups/mail.rs b/src/groups/mail.rs index 551274c..b337e4c 100644 --- a/src/groups/mail.rs +++ b/src/groups/mail.rs @@ -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, + /// Total unread count across all labels. + pub unread_count: Option, +} + +#[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, +} + +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}" + ); +}