From af1c95e5c3b08e82cf427c67b667030b79998e1b Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Fri, 3 Oct 2025 14:34:04 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(labels):=20create=20labels=20m?= =?UTF-8?q?odule=20to=20manage=20Gmail=20labels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Implemented `Labels` struct for managing Gmail labels. - Added functions to retrieve and map labels. - Added logging for label names. --- src/labels.rs | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 src/labels.rs diff --git a/src/labels.rs b/src/labels.rs new file mode 100644 index 0000000..e5e45c9 --- /dev/null +++ b/src/labels.rs @@ -0,0 +1,113 @@ +use std::collections::HashMap; + +use google_gmail1::{ + Gmail, + api::{Label, ListLabelsResponse}, + hyper_rustls::{HttpsConnector, HttpsConnectorBuilder}, + hyper_util::{ + client::legacy::{Client, connect::HttpConnector}, + rt::TokioExecutor, + }, + yup_oauth2::{ApplicationSecret, InstalledFlowAuthenticator, InstalledFlowReturnMethod}, +}; + +use crate::{Credential, Error}; + +/// Default for the maximum number of results to return on a page +pub const DEFAULT_MAX_RESULTS: &str = "10"; + +/// Struct to capture configuration for List API call. +pub struct Labels { + hub: Gmail>, + label_list: Vec