feat(monday): add create board action

This commit is contained in:
Rıdvan Akca
2024-05-08 12:14:32 +02:00
parent f0b5d85a7a
commit ff0dd0b415
5 changed files with 88 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create board',
key: 'createBoard',
description: 'Creates a new board.',
arguments: [
{
label: 'Board Name',
key: 'boardName',
type: 'string',
required: true,
description: 'Title for the board.',
variables: true,
},
{
label: 'Board Kind',
key: 'boardKind',
type: 'dropdown',
required: true,
description: '',
variables: true,
options: [
{
label: 'Main',
value: 'public',
},
{
label: 'Private',
value: 'private',
},
{
label: 'Shareable',
value: 'share',
},
],
},
{
label: 'Template ID',
key: 'templateId',
type: 'string',
required: false,
description:
"When you switch on developer mode, you'll spot the template IDs in your template store. Additionally, you have the option to utilize the Board ID from any board you've saved as a template.",
variables: true,
},
],
async run($) {
const { boardName, boardKind, templateId } = $.step.parameters;
const body = {
query: `mutation {
create_board (board_name: "${boardName}", board_kind: ${boardKind}${
templateId ? `, template_id: ${templateId}` : ''
}) {
id
name
board_kind
}
}`,
};
const { data } = await $.http.post('/', body);
$.setActionItem({
raw: data,
});
},
});

View File

@@ -0,0 +1,3 @@
import createBoard from './create-board/index.js';
export default [createBoard];

View File

@@ -2,6 +2,7 @@ import defineApp from '../../helpers/define-app.js';
import addAuthHeader from './common/add-auth-header.js';
import auth from './auth/index.js';
import triggers from './triggers/index.js';
import actions from './actions/index.js';
export default defineApp({
name: 'Monday',
@@ -15,4 +16,5 @@ export default defineApp({
beforeRequest: [addAuthHeader],
auth,
triggers,
actions,
});

View File

@@ -229,6 +229,7 @@ export default defineConfig({
collapsible: true,
collapsed: true,
items: [
{ text: 'Actions', link: '/apps/monday/actions' },
{ text: 'Triggers', link: '/apps/monday/triggers' },
{ text: 'Connection', link: '/apps/monday/connection' },
],

View File

@@ -0,0 +1,12 @@
---
favicon: /favicons/monday.svg
items:
- name: Create board
desc: Creates a new board.
---
<script setup>
import CustomListing from '../../components/CustomListing.vue'
</script>
<CustomListing />