diff --git a/sage_imap/helpers/search.py b/sage_imap/helpers/search.py index e9faac8..866b175 100644 --- a/sage_imap/helpers/search.py +++ b/sage_imap/helpers/search.py @@ -348,3 +348,28 @@ def message_id(message_id: str) -> str: >>> print(criteria) # Output: HEADER "Message-ID" "" """ 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}"