diff --git a/components/gmail/actions/get-send-as-alias/get-send-as-alias.mjs b/components/gmail/actions/get-send-as-alias/get-send-as-alias.mjs new file mode 100644 index 0000000000000..258dd96352cdc --- /dev/null +++ b/components/gmail/actions/get-send-as-alias/get-send-as-alias.mjs @@ -0,0 +1,32 @@ +import gmail from "../../gmail.app.mjs"; +import constants from "../../common/constants.mjs"; + +export default { + key: "gmail-get-send-as-alias", + name: "Get Send As Alias", + description: "Get a send as alias for the authenticated user. [See the documentation](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.settings.sendAs/get)", + version: "0.0.1", + type: "action", + props: { + gmail, + sendAsEmail: { + type: "string", + label: "Send As Email", + description: "The email address of the send as alias to get", + async options() { + const { sendAs } = await this.gmail.listSignatures(); + return sendAs.map(({ sendAsEmail }) => sendAsEmail); + }, + }, + }, + async run({ $ }) { + const { data } = await this.gmail._client().users.settings.sendAs.get({ + userId: constants.USER_ID, + sendAsEmail: this.sendAsEmail, + }); + + $.export("$summary", "Successfully retrieved send as alias"); + + return data; + }, +}; diff --git a/components/gmail/actions/list-send-as-aliases/list-send-as-aliases.mjs b/components/gmail/actions/list-send-as-aliases/list-send-as-aliases.mjs new file mode 100644 index 0000000000000..7d79b4b1593c5 --- /dev/null +++ b/components/gmail/actions/list-send-as-aliases/list-send-as-aliases.mjs @@ -0,0 +1,21 @@ +import gmail from "../../gmail.app.mjs"; + +export default { + key: "gmail-list-send-as-aliases", + name: "List Send As Aliases", + description: "List all send as aliases for the authenticated user. [See the documentation](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.settings.sendAs/list)", + version: "0.0.1", + type: "action", + props: { + gmail, + }, + async run({ $ }) { + const response = await this.gmail.listSignatures({ + $, + }); + + $.export("$summary", `Successfully retrieved ${response.sendAs?.length} send as aliases`); + + return response; + }, +}; diff --git a/components/gmail/package.json b/components/gmail/package.json index b1c2c0793ce71..4d4001aff0649 100644 --- a/components/gmail/package.json +++ b/components/gmail/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/gmail", - "version": "1.2.0", + "version": "1.3.0", "description": "Pipedream Gmail Components", "main": "gmail.app.mjs", "keywords": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e8683c60c5cc8..5f29633402ed3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10067,8 +10067,7 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/paazl: - specifiers: {} + components/paazl: {} components/paddle: {}