Commit Graph

511 Commits

Author SHA1 Message Date
Jeremiah Russell
1af61d0ed0 ♻️ refactor(core): remove unused trash module
- removes the trash module
- simplifies the crate structure
2025-10-14 07:41:39 +01:00
Jeremiah Russell
f0a268861f ♻️ refactor(trash): refactor trash module to trait implementation
- remove the `Trash` struct
- implement `Trash` as a trait for `GmailClient`
- move `batch_move_to_trash` and `batch_trash` functions to the `Trash` trait implementation
- update function calls to use the new trait implementation
2025-10-14 07:41:39 +01:00
Jeremiah Russell
9625e64979 ♻️ refactor(message_list): remove client parameter from add_labels
- remove client parameter from `add_labels` function to use self
- simplify the function signature and improve code readability
2025-10-14 07:41:39 +01:00
Jeremiah Russell
0ebfde4912 ♻️ refactor(delete): restructure delete functionality
- remove Delete struct
- implement Delete trait for GmailClient
- move prepare and batch_delete functions to GmailClient
- update imports to reflect changes
2025-10-14 07:41:39 +01:00
Jeremiah Russell
2ef8f2f7f3 ♻️ refactor(core): remove unused Delete module
- Delete module is no longer needed.
2025-10-14 07:41:39 +01:00
Jeremiah Russell
33cf154791 ♻️ refactor(processor): consolidate message operations in GmailClient
- move label adding and message deletion logic to GmailClient
- reduce code duplication and improve code structure
- simplify processor methods by reusing GmailClient functions
2025-10-14 07:41:39 +01:00
Jeremiah Russell
8094e46f0f feat(gmail_client): integrate message summary
- introduce message summary struct for efficient data handling
2025-10-14 07:41:39 +01:00
Jeremiah Russell
edc27739f8 ♻️ refactor(gmail_client): move message_summary to gmail_client
- move `message_summary.rs` from `message_list` to `gmail_client` for better organization
- derive `Clone` for `MessageSummary` struct
2025-10-14 07:41:39 +01:00
Jeremiah Russell
247f8e6b00 ♻️ refactor(message_list): implement MessageList trait for GmailClient
- move MessageList trait and implementation to message_list.rs
- implement MessageList trait for GmailClient struct
- remove unused MessageList struct
- update function signatures to use GmailClient instead of MessageList struct
2025-10-14 07:41:39 +01:00
Jeremiah Russell
940daca729 feat(gmail): create gmail client struct
- create gmail client struct
- add label map
- add max results
- add label ids
- add query
- add messages
2025-10-14 07:41:39 +01:00
Jeremiah Russell
4d452ab5b0 ♻️ refactor(cli): use GmailClient instead of credential file
- use GmailClient to reduce redundant credential file passing
2025-10-14 07:41:39 +01:00
Jeremiah Russell
88fbf74587 ♻️ refactor(cli): use client for trash subcommand
- use the api client for the trash subcommand
2025-10-14 07:41:39 +01:00
Jeremiah Russell
cfd33540aa ♻️ refactor(cli): use gmail client in run_cli
- use gmail client in `run_cli` to avoid passing credentials around
2025-10-14 07:41:39 +01:00
Jeremiah Russell
f79fd2d48c ♻️ refactor(cli): pass client to run command
- pass client to run command to enable api calls
2025-10-14 07:41:39 +01:00
Jeremiah Russell
9018fa02d4 ♻️ refactor(processor): use reference for GmailClient in processor builder
- modify the `builder` function to accept a reference to `GmailClient` rather than cloning it
- this avoids unnecessary cloning of the `GmailClient`
2025-10-14 07:41:39 +01:00
Jeremiah Russell
9bdb559104 ♻️ refactor(cli): use client instance for message subcommand
- use client instance for message subcommand to avoid redundant credential file access
2025-10-14 07:41:39 +01:00
Jeremiah Russell
7eeebddf2e ♻️ refactor(cli): use GmailClient for MessageList
- use GmailClient instance instead of credential file path
- pass GmailClient to add_labels
2025-10-14 07:41:39 +01:00
Jeremiah Russell
704b2b023e 🐛 fix(cli): fix delete command
- pass the client to the delete command
2025-10-14 07:41:39 +01:00
Jeremiah Russell
22e1916262 ♻️ refactor(cli): use GmailClient in delete_cli
- use GmailClient struct instead of credential_file path
- simplifies client handling and avoids redundant credential loading
2025-10-14 07:41:39 +01:00
Jeremiah Russell
04478a13f8 ♻️ refactor(cli): use gmail client for label operations
- replace credential file with gmail client for label operations
- use gmail client to list labels
2025-10-14 07:41:39 +01:00
Jeremiah Russell
da8304e02f ♻️ refactor(trash): use GmailClient instead of credential string
- use GmailClient to manage gmail API interactions
- remove credential string
2025-10-14 07:41:39 +01:00
Jeremiah Russell
a22ce8e882 ♻️ refactor(delete): use GmailClient for message list creation
- use GmailClient struct for creating a new message list
- this change improve code maintainability and testability
2025-10-14 07:41:39 +01:00
Jeremiah Russell
3dab10fdfe ♻️ refactor(message_list): update add_labels function to accept &GmailClient
- modify add_labels function to accept a reference to GmailClient
2025-10-14 07:41:39 +01:00
Jeremiah Russell
0dc8f8c47b ♻️ refactor(gmail): improve gmail client structure
- add clone derive to GmailClient struct
- rename get_messages to get_message_list for clarity
2025-10-14 07:41:39 +01:00
Jeremiah Russell
e5b93c0bdd ♻️ refactor(processor): use GmailClient instead of credential_file
- replace credential_file with GmailClient in Processor and ProcessorBuilder
- update builder method to accept GmailClient
- update trash_messages and delete_messages methods to use GmailClient
2025-10-14 07:41:39 +01:00
Jeremiah Russell
4ba9d672a6 ♻️ refactor(cli): remove unused credential file
- remove credential file parameters
- use GmailClient instance instead
2025-10-14 07:41:39 +01:00
Jeremiah Russell
455deb8420 feat(gmail): add get messages functionality
- implement get_messages function to retrieve a list of messages from Gmail
- create a hub function to get the Gmail hub from the client
2025-10-14 07:41:39 +01:00
Jeremiah Russell
ceb4548649 ♻️ refactor(message_list): use gmail client for label retrieval
- removes credential file and Labels struct from add_labels function
- uses GmailClient to get label id
- simplifies label adding process
2025-10-14 07:41:39 +01:00
Jeremiah Russell
ebd5d56603 ♻️ refactor(core): rename labels module to gmail_client
- rename labels module to gmail_client for better clarity and context
2025-10-14 07:41:39 +01:00
Jeremiah Russell
c5ba366ade feat(error): add NoLabelsFound error
- add `NoLabelsFound` error type to handle cases where no labels are found in the mailbox
2025-10-14 07:41:39 +01:00
Jeremiah Russell
946398380b ♻️ refactor(gmail): rename labels.rs to gmail_client.rs
- Renamed `labels.rs` to `gmail_client.rs` for better clarity
- Refactor `Labels` struct to `GmailClient` for better naming
- Update `get_label_map` to use BTreeMap for label storage
- Remove the show flag functionality
2025-10-14 07:41:39 +01:00
Jerus Bot
c76cd42c1d chore: Release cull-gmail v0.0.7 2025-10-12 07:19:53 +00:00
Jeremiah Russell
a3ef97aef2 feat(processor): introduce processor builder
- add ProcessorBuilder for flexible Processor construction
- deprecate Processor::new in favor of Processor::builder
2025-10-12 07:37:54 +01:00
Jeremiah Russell
4592daa1cc feat(cli): add execute option to processor
- allow users to skip execution of actions with a new `execute` option
2025-10-12 07:37:54 +01:00
Jerus Bot
f5c929d1a5 chore: update prlog for pr 2025-10-12 07:37:54 +01:00
Jeremiah Russell
aa1074d4bb feat(processor): add execute flag for dry run
- introduce execute flag to control actual execution of actions
- add set_execute method to modify the execute flag
- log warning message when execution is stopped for dry run
2025-10-12 07:37:54 +01:00
Jeremiah Russell
89dd35d487 feat(cli): add execute flag to run action
- introduce execute flag to control action execution
- add skip_trash flag to skip rules with trash action
- add skip_delete flag to skip rules with delete action
2025-10-12 07:37:54 +01:00
Jeremiah Russell
fea5c91dcb ♻️ refactor(utils): remove unused get_start_boundary function
- remove the `get_start_boundary` function as it is no longer used
2025-10-11 23:07:43 +01:00
Jeremiah Russell
6f2262cdb3 🐛 fix(utils): correct string elision boundary calculation
- fix an issue where the elision range could start mid-character
- ensure the elision range always starts at a char boundary
2025-10-11 23:07:43 +01:00
Jerus Bot
7ffa25295c chore: update prlog for pr 2025-10-11 23:07:43 +01:00
Jeremiah Russell
558b2cfd7f 🐛 fix(utils): correct string elision boundary calculation
- ensure elision respects character boundaries for utf-8 strings
- prevent panics when eliding near multi-byte characters
2025-10-11 23:07:43 +01:00
Jerus Bot
4e4e11f20d chore: update prlog for pr 2025-10-11 10:00:31 +01:00
Jeremiah Russell
bda012e7e7 feat(message_list): increase default max results
- increase default max results to 200
2025-10-11 10:00:31 +01:00
Jeremiah Russell
2110d56331 ♻️ refactor(cli): extract action execution to separate function
- move action execution logic into its own function
- improve readability and maintainability
2025-10-11 09:35:12 +01:00
Jeremiah Russell
d951826c51 ♻️ refactor(config): extract common logic to reduce duplication
- extract common logic for determining action, period, and count into separate function
- reduce duplication in `fmt::Display` and `describe` methods
2025-10-11 09:35:12 +01:00
Jeremiah Russell
88e1da65c0 ♻️ refactor(eol_rule): simplify eol_rule tests
- introduce a builder function to reduce duplication in test setup
- remove unnecessary rule id assignment in tests, using default value
2025-10-11 09:35:12 +01:00
Jeremiah Russell
6eb86c5d36 feat(cli): add skip action flags to cli
- add flags `--skip-trash` and `--skip-delete` to skip trash and delete actions
- add display order and help heading for better cli usage
2025-10-11 09:35:12 +01:00
Jeremiah Russell
edcc1bbe45 feat(cli): add skip-delete flag to cli
- introduce a new flag `--skip-delete`
- add a new option to skip rules with `delete` action
2025-10-11 09:35:12 +01:00
Jeremiah Russell
1997fd2142 feat(cli): add option to skip trash actions
- introduce `--skip-trash` flag to prevent trashing messages
- add warning log when a trash action is skipped due to the flag
2025-10-11 09:35:12 +01:00
Jeremiah Russell
81157e6ce9 feat(config): add date calculation for EOL queries
- introduce calculate_for_date function to allow EOL query generation for specific dates
- add test cases for EOL query generation with different time spans
2025-10-11 09:35:12 +01:00