Compare commits

..

1 Commits

Author SHA1 Message Date
Rıdvan Akca
7985a79adc feat(gmail): add send to trash action 2024-04-24 13:24:13 +02:00
3 changed files with 34 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import createDraft from './create-draft/index.js';
import replyToEmail from './reply-to-email/index.js';
import sendEmail from './send-email/index.js';
import sendToTrash from './send-to-trash/index.js';
export default [createDraft, replyToEmail, sendEmail];
export default [createDraft, replyToEmail, sendEmail, sendToTrash];

View File

@@ -0,0 +1,30 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Send to trash',
key: 'sendToTrash',
description: 'Send an existing email message to the trash.',
arguments: [
{
label: 'Message ID',
key: 'messageId',
type: 'string',
required: true,
description: '',
variables: true,
},
],
async run($) {
const { messageId } = $.step.parameters;
const userId = $.auth.data.userId;
const { data } = await $.http.post(
`/gmail/v1/users/${userId}/messages/${messageId}/trash`
);
$.setActionItem({
raw: data,
});
},
});

View File

@@ -7,6 +7,8 @@ items:
desc: Respond to an email.
- name: Send email
desc: Send a new email message.
- name: Send to trash
desc: Send an existing email message to the trash.
---
<script setup>