File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ import gmail from "../../gmail.app.mjs" ;
2+ import constants from "../../common/constants.mjs" ;
3+
4+ export default {
5+ key : "gmail-archive-email" ,
6+ name : "Archive Email" ,
7+ description : "Archive an email message. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)" ,
8+ version : "0.0.1" ,
9+ type : "action" ,
10+ props : {
11+ gmail,
12+ message : {
13+ propDefinition : [
14+ gmail ,
15+ "message" ,
16+ ] ,
17+ } ,
18+ } ,
19+ async run ( { $ } ) {
20+ const {
21+ gmail,
22+ message,
23+ } = this ;
24+
25+ const response = await gmail . updateLabels ( {
26+ message,
27+ removeLabelIds : [
28+ constants . INBOX_LABEL_ID ,
29+ ] ,
30+ } ) ;
31+
32+ $ . export ( "$summary" , `Successfully archived email (ID: ${ message } )` ) ;
33+ return response ;
34+ } ,
35+ } ;
Original file line number Diff line number Diff line change @@ -5,10 +5,12 @@ const BODY_TYPES = {
55} ;
66const HISTORICAL_EVENTS = 10 ;
77const DEFAULT_LIMIT = 100 ;
8+ const INBOX_LABEL_ID = "INBOX" ;
89
910export default {
1011 USER_ID ,
1112 BODY_TYPES ,
1213 HISTORICAL_EVENTS ,
1314 DEFAULT_LIMIT ,
15+ INBOX_LABEL_ID ,
1416} ;
You can’t perform that action at this time.
0 commit comments