await box.messages.update(id, { read: true });
await box.messages.update(id, { starred: true });
await box.messages.update(id, { folder: "trash" });box.messages.update(message_id, {"read": True})
box.messages.update(message_id, {"starred": True})
box.messages.update(message_id, {"folder": "trash"})readbooleanRead or unread.
starredbooleanStarred or not.
folderstringinbox · sent · drafts · spam · trash. Moves it.
Moving is a folder change
Archiving, trashing and marking as spam are all this call with a different folder — one operation rather than three, and every one of them reversible by setting the folder back.
Against remove()
| update({ folder: "trash" }) | remove() | |
|---|---|---|
| From a normal folder | moves to trash | moves to trash |
| From trash | — | deletes permanently |
Somebody who clicks the wrong button should be able to come back. The only place delete is final is the place whose whole meaning is « on the way out ».
unreadCount follows
Marking read changes the folder's count in the next listing. There is no separate call for a badge.