Skip to content

Add drafts param to mc_thread_read()#16

Merged
NewGraphEnvironment merged 2 commits intomainfrom
feat/thread-read-drafts
Mar 6, 2026
Merged

Add drafts param to mc_thread_read()#16
NewGraphEnvironment merged 2 commits intomainfrom
feat/thread-read-drafts

Conversation

@NewGraphEnvironment
Copy link
Owner

Summary

Add drafts parameter to mc_thread_read() so draft messages in a thread are visible alongside sent messages.

Changes

  • mc_thread_read(thread_id, drafts = TRUE) adds a status column ("sent" / "draft")
  • drafts = FALSE (default) preserves backwards compatibility — no column change
  • New internal fetch_thread_drafts() scans gm_drafts() for matching threadId and merges them in
  • 7 new unit tests covering: param validation, column structure with/without drafts, draft merging, empty thread edge cases

Why

Gmail API excludes drafts from gm_thread() results. When iterating on email drafts in a thread, there was no way to read the draft content without dropping to raw gmailr and manually decoding base64.

Fixes #15
Relates to NewGraphEnvironment/sred-2025-2026#1

NewGraphEnvironment and others added 2 commits March 5, 2026 14:33
Gmail API excludes draft messages from gm_thread() results.
When drafts = TRUE, scan gm_drafts() for matching thread_id
and merge them into the output with a status column
("sent" / "draft"). Default FALSE preserves backwards compat.

Fixes #15
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@NewGraphEnvironment NewGraphEnvironment merged commit d8377bc into main Mar 6, 2026
1 check passed
@NewGraphEnvironment NewGraphEnvironment deleted the feat/thread-read-drafts branch March 6, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add drafts param to mc_thread_read() for draft vs sent status

1 participant