Composable query expressions for IMAP search.
Source code in email_profile/clients/imap/query.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151 | class Q:
"""Composable query expressions for IMAP search."""
@staticmethod
def subject(value: str) -> _Expr:
return _Expr(f'(SUBJECT "{_ascii(value)}")')
@staticmethod
def from_(value: str) -> _Expr:
return _Expr(f'(FROM "{_ascii(value)}")')
@staticmethod
def to(value: str) -> _Expr:
return _Expr(f'(TO "{_ascii(value)}")')
@staticmethod
def cc(value: str) -> _Expr:
return _Expr(f'(CC "{_ascii(value)}")')
@staticmethod
def body(value: str) -> _Expr:
return _Expr(f'(BODY "{_ascii(value)}")')
@staticmethod
def text(value: str) -> _Expr:
return _Expr(f'(TEXT "{_ascii(value)}")')
@staticmethod
def since(value: date) -> _Expr:
return _Expr(f"(SINCE {_imap_date(value)})")
@staticmethod
def before(value: date) -> _Expr:
return _Expr(f"(BEFORE {_imap_date(value)})")
@staticmethod
def on(value: date) -> _Expr:
return _Expr(f"(ON {_imap_date(value)})")
@staticmethod
def larger(n: int) -> _Expr:
return _Expr(f"(LARGER {n})")
@staticmethod
def smaller(n: int) -> _Expr:
return _Expr(f"(SMALLER {n})")
@staticmethod
def unseen() -> _Expr:
return _Expr("(UNSEEN)")
@staticmethod
def seen() -> _Expr:
return _Expr("(SEEN)")
@staticmethod
def answered() -> _Expr:
return _Expr("(ANSWERED)")
@staticmethod
def flagged() -> _Expr:
return _Expr("(FLAGGED)")
@staticmethod
def deleted() -> _Expr:
return _Expr("(DELETED)")
@staticmethod
def undeleted() -> _Expr:
return _Expr("(UNDELETED)")
@staticmethod
def all() -> _Expr:
return _Expr("ALL")
@staticmethod
def uid(value: str) -> _Expr:
return _Expr(f"UID {value}")
@staticmethod
def uid_set(uids: list[str]) -> _Expr:
return _Expr(f"UID {','.join(uids)}")
@staticmethod
def header(name: str, value: str) -> _Expr:
return _Expr(f'(HEADER {name} "{_ascii(value)}")')
|
all()
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def all() -> _Expr:
return _Expr("ALL")
|
answered()
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def answered() -> _Expr:
return _Expr("(ANSWERED)")
|
before(value)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def before(value: date) -> _Expr:
return _Expr(f"(BEFORE {_imap_date(value)})")
|
body(value)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def body(value: str) -> _Expr:
return _Expr(f'(BODY "{_ascii(value)}")')
|
cc(value)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def cc(value: str) -> _Expr:
return _Expr(f'(CC "{_ascii(value)}")')
|
deleted()
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def deleted() -> _Expr:
return _Expr("(DELETED)")
|
flagged()
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def flagged() -> _Expr:
return _Expr("(FLAGGED)")
|
from_(value)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def from_(value: str) -> _Expr:
return _Expr(f'(FROM "{_ascii(value)}")')
|
Source code in email_profile/clients/imap/query.py
| @staticmethod
def header(name: str, value: str) -> _Expr:
return _Expr(f'(HEADER {name} "{_ascii(value)}")')
|
larger(n)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def larger(n: int) -> _Expr:
return _Expr(f"(LARGER {n})")
|
on(value)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def on(value: date) -> _Expr:
return _Expr(f"(ON {_imap_date(value)})")
|
seen()
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def seen() -> _Expr:
return _Expr("(SEEN)")
|
since(value)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def since(value: date) -> _Expr:
return _Expr(f"(SINCE {_imap_date(value)})")
|
smaller(n)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def smaller(n: int) -> _Expr:
return _Expr(f"(SMALLER {n})")
|
subject(value)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def subject(value: str) -> _Expr:
return _Expr(f'(SUBJECT "{_ascii(value)}")')
|
text(value)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def text(value: str) -> _Expr:
return _Expr(f'(TEXT "{_ascii(value)}")')
|
to(value)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def to(value: str) -> _Expr:
return _Expr(f'(TO "{_ascii(value)}")')
|
uid(value)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def uid(value: str) -> _Expr:
return _Expr(f"UID {value}")
|
uid_set(uids)
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def uid_set(uids: list[str]) -> _Expr:
return _Expr(f"UID {','.join(uids)}")
|
undeleted()
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def undeleted() -> _Expr:
return _Expr("(UNDELETED)")
|
unseen()
staticmethod
Source code in email_profile/clients/imap/query.py
| @staticmethod
def unseen() -> _Expr:
return _Expr("(UNSEEN)")
|