From 1d4a24be1f24271d5dce55ff55c6b669085cbc5c Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 13 Apr 2025 14:49:45 -0300 Subject: [PATCH 1/2] package update --- components/gmail/package.json | 2 +- pnpm-lock.yaml | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/components/gmail/package.json b/components/gmail/package.json index 41868414a4024..5db6e3f772f94 100644 --- a/components/gmail/package.json +++ b/components/gmail/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/gmail", - "version": "0.2.10", + "version": "0.3.0", "description": "Pipedream Gmail Components", "main": "gmail.app.mjs", "keywords": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2a1a4bb091b81..3d45fabab79c8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4308,8 +4308,7 @@ importers: components/facebook_conversions: {} - components/facebook_graph_api: - specifiers: {} + components/facebook_graph_api: {} components/facebook_groups: dependencies: @@ -4929,8 +4928,7 @@ importers: components/gatekeeper: {} - components/gather: - specifiers: {} + components/gather: {} components/gatherup: dependencies: @@ -11991,8 +11989,7 @@ importers: components/smartengage: {} - components/smartlead: - specifiers: {} + components/smartlead: {} components/smartproxy: {} From 3956ec4113b9b410f712c0188fdea21c73fc85c9 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 13 Apr 2025 18:08:48 -0300 Subject: [PATCH 2/2] Creating 'archive email' action --- .../actions/archive-email/archive-email.mjs | 35 +++++++++++++++++++ components/gmail/common/constants.mjs | 2 ++ 2 files changed, 37 insertions(+) create mode 100644 components/gmail/actions/archive-email/archive-email.mjs diff --git a/components/gmail/actions/archive-email/archive-email.mjs b/components/gmail/actions/archive-email/archive-email.mjs new file mode 100644 index 0000000000000..a1bca2ae6aa00 --- /dev/null +++ b/components/gmail/actions/archive-email/archive-email.mjs @@ -0,0 +1,35 @@ +import gmail from "../../gmail.app.mjs"; +import constants from "../../common/constants.mjs"; + +export default { + key: "gmail-archive-email", + name: "Archive Email", + description: "Archive an email message. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)", + version: "0.0.1", + type: "action", + props: { + gmail, + message: { + propDefinition: [ + gmail, + "message", + ], + }, + }, + async run({ $ }) { + const { + gmail, + message, + } = this; + + const response = await gmail.updateLabels({ + message, + removeLabelIds: [ + constants.INBOX_LABEL_ID, + ], + }); + + $.export("$summary", `Successfully archived email (ID: ${message})`); + return response; + }, +}; diff --git a/components/gmail/common/constants.mjs b/components/gmail/common/constants.mjs index 1d4ff4a9c2f8f..deb65852ee483 100644 --- a/components/gmail/common/constants.mjs +++ b/components/gmail/common/constants.mjs @@ -5,10 +5,12 @@ const BODY_TYPES = { }; const HISTORICAL_EVENTS = 10; const DEFAULT_LIMIT = 100; +const INBOX_LABEL_ID = "INBOX"; export default { USER_ID, BODY_TYPES, HISTORICAL_EVENTS, DEFAULT_LIMIT, + INBOX_LABEL_ID, };