diff --git a/README.md b/README.md index a287602..bd7adb6 100644 --- a/README.md +++ b/README.md @@ -113,8 +113,8 @@ m.body() # Cleaned text (no quotes/signatures) m.html() # HTML body (falls back to text wrapped in
)
# View message with headers (as dict or plain text)
-view_msg(m.id) # Returns dict with headers + body
-view_msg(m.id, as_json=False) # Returns formatted text
+view_email(m.id) # Returns dict with headers + body
+view_email(m.id, as_json=False) # Returns formatted text
# View full thread
view_thread(t.id) # Dict of msgid -> msg dict
diff --git a/solvemail/__init__.py b/solvemail/__init__.py
index b4fc6ed..ca827f0 100644
--- a/solvemail/__init__.py
+++ b/solvemail/__init__.py
@@ -42,7 +42,7 @@ def g():
if _g is None: raise AttributeError('Call solvemail.init(...) first')
return _g
-def solvemail_tools(): return '&`[search_threads, search_msgs, thread, draft, drafts, labels, label, find_labels, profile, send, reply_draft, reply_to_thread, create_label, trash_msgs, view_inbox, view_inbox_threads, view_msg, view_thread, batch_delete, batch_label, create_draft, message, send_drafts, report_spam]`'
+def solvemail_tools(): return '&`[search_threads, search_msgs, thread, draft, drafts, labels, label, find_labels, profile, send, reply_draft, reply_to_thread, create_label, trash_msgs, view_inbox, view_inbox_threads, view_email, view_thread, batch_delete, batch_label, create_draft, message, send_drafts, report_spam]`'
def wait_secs(secs: float = 1.0):
"Pause for `secs` seconds; use if rate limited"
diff --git a/solvemail/core.py b/solvemail/core.py
index 1ee6c4b..942f3a0 100644
--- a/solvemail/core.py
+++ b/solvemail/core.py
@@ -710,7 +710,7 @@ def view_inbox_threads(self, max_threads=20, unread=False):
threads = self.search_threads(q, max_results=max_threads)
return self.get_threads(threads, fmt='full')
- def view_msgs(self,
+ def view_emails(self,
ids:list, # Message ids to fetch
fmt:str='metadata' # Format: 'full', 'metadata', or 'minimal'
):
@@ -727,7 +727,7 @@ def view_threads(self,
return [{'id': t.id, 'msgs': [{'id': m.id, 'frm': m.frm, 'to': m.to, 'subject': m.subj,
'snippet': m.snip, 'labels': list(m.label_ids)} for m in t.msgs()]} for t in threads]
- def view_msg(self,
+ def view_email(self,
id:str, # Message id
clean:bool=True, # Strip reply quotations and signatures?
as_text:bool=True, # Return text body (vs HTML)?
@@ -756,7 +756,7 @@ def view_thread(self,
):
"View thread messages with optional headers/metadata. This is primarily for LLM and programmatic use. Humans use `thread()` to get HTML view."
t = self.thread(id, fmt='full')
- res = {m.id: self.view_msg(m.id, clean=clean, as_text=as_text, as_json=as_json) for m in t.msgs()}
+ res = {m.id: self.view_email(m.id, clean=clean, as_text=as_text, as_json=as_json) for m in t.msgs()}
if as_json: return res
return ('\n\n' + '='*60 + '\n\n').join(res.values())