Skip to content

Commit

Permalink
Merge pull request #20 from sageteamorg/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sepehr-akbarzadeh authored Jul 24, 2024
2 parents d84fbf3 + 67636ff commit b06198a
Showing 1 changed file with 25 additions and 0 deletions.
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}"

0 comments on commit b06198a

Please sign in to comment.