Skip to content

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

@NewGraphEnvironment

Description

@NewGraphEnvironment

Problem

mc_thread_read() returns all messages in a thread but doesn't distinguish between sent messages and drafts. When iterating on email drafts, there's no way to pull the current draft content from a thread without dropping down to raw gmailr and decoding base64 manually.

Proposed Solution

Add a drafts parameter to mc_thread_read():

mc_thread_read("thread_id", drafts = TRUE)
  • drafts = FALSE (default): current behavior, no change
  • drafts = TRUE: include draft messages in the output with a status column ("sent" / "draft")

Implementation notes

  • Gmail API returns draft metadata via gm_drafts() — cross-reference message IDs in the thread with draft message IDs to flag status
  • Existing tests need review to ensure the new column doesn't break downstream expectations when drafts = FALSE
  • Branch + PR workflow

Why not a standalone mc_draft_read()?

Draft content is most useful in thread context (seeing what you're replying to). A param on the existing function keeps the API surface small and avoids needing to know draft IDs separately.

Relates to NewGraphEnvironment/compost

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions