feat: add defineTrigger and defineAction

This commit is contained in:
Ali BARIN
2022-10-15 22:16:10 +02:00
parent ee9d095454
commit 92a2d68a81
23 changed files with 147 additions and 131 deletions

View File

@@ -28,7 +28,7 @@ const findMessage = async ($: IGlobalVariable, options: FindMessageOptions) => {
const message: IActionOutput = {
data: {
raw: data?.data?.messages.matches[0],
raw: data?.messages.matches[0],
},
error: response?.integrationError || (!data.ok && data),
};

View File

@@ -1,7 +1,7 @@
import { IGlobalVariable } from '@automatisch/types';
import defineAction from '../../../../helpers/define-action';
import findMessage from './find-message';
export default {
export default defineAction({
name: 'Find message',
key: 'findMessage',
description: 'Find a Slack message using the Slack Search feature.',
@@ -71,7 +71,7 @@ export default {
},
],
async run($: IGlobalVariable) {
async run($) {
const parameters = $.step.parameters;
const query = parameters.query as string;
const sortBy = parameters.sortBy as string;
@@ -87,4 +87,4 @@ export default {
return messages;
},
};
});

View File

@@ -1,7 +1,7 @@
import { IGlobalVariable } from '@automatisch/types';
import defineAction from '../../../../helpers/define-action';
import postMessage from './post-message';
export default {
export default defineAction({
name: 'Send a message to channel',
key: 'sendMessageToChannel',
description: 'Send a message to a specific channel you specify.',
@@ -48,7 +48,7 @@ export default {
},
],
async run($: IGlobalVariable) {
async run($) {
const channelId = $.step.parameters.channel as string;
const text = $.step.parameters.message as string;
@@ -56,4 +56,4 @@ export default {
return message;
},
};
});