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

Develop #20

Merged
merged 2 commits into from
Jul 24, 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
25 changes: 25 additions & 0 deletions sage_imap/helpers/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,28 @@ def message_id(message_id: str) -> str:
>>> print(criteria) # Output: HEADER "Message-ID" "<[email protected]>"
"""
return f'HEADER "Message-ID" "{message_id}"'

@staticmethod
def uid(uid: str) -> str:
"""
Generate search criteria for emails with the specified UID or range of UIDs.

Parameters
----------
uid : str
The UID or range of UIDs.

Returns
-------
str
The constructed search criteria.

Example
-------
>>> criteria = IMAPSearchCriteria.uid("100")
>>> print(criteria) # Output: UID 100

>>> criteria = IMAPSearchCriteria.uid("100:200")
>>> print(criteria) # Output: UID 100:200
"""
return f"UID {uid}"
Loading