Skip to content

Commit

Permalink
feat(miro): add create board action
Browse files Browse the repository at this point in the history
  • Loading branch information
ridvanakca committed Sep 25, 2023
1 parent 8a90ef8 commit 21c8c44
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 0 deletions.
92 changes: 92 additions & 0 deletions packages/backend/src/apps/miro/actions/create-board/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import defineAction from '../../../../helpers/define-action';

export default defineAction({
name: 'Create board',
key: 'createBoard',
description: 'Creates a new board.',
arguments: [
{
label: 'Name',
key: 'name',
type: 'string' as const,
required: true,
description: 'Title for the board.',
variables: true,
},
{
label: 'Description',
key: 'description',
type: 'string' as const,
required: false,
description: 'Description of the board.',
variables: true,
},
{
label: 'Team Access',
key: 'teamAccess',
type: 'dropdown' as const,
required: false,
description: '',
variables: true,
options: [
{
label: 'Private - nobody in the team can find and access the board',
value: 'private',
},
{
label: 'View - any team member can find and view the board',
value: 'view',
},
{
label: 'Comment - any team member can find and comment the board',
value: 'comment',
},
{
label: 'Edit - any team member can find and edit the board',
value: 'edit',
},
],
},
{
label: 'Access Via Link',
key: 'accessViaLink',
type: 'dropdown' as const,
required: false,
description: '',
variables: true,
options: [
{
label: 'Private - only you have access to the board',
value: 'private',
},
{
label: 'View - can view, no sign-in required',
value: 'view',
},
{
label: 'Comment - can comment, no sign-in required',
value: 'comment',
},
],
},
],

async run($) {
const body = {
name: $.step.parameters.name,
description: $.step.parameters.description,
policy: {
sharingPolicy: {
access: $.step.parameters.accessViaLink,
teamAccess: $.step.parameters.teamAccess,
},
},
};

const { data } = await $.http.post('/v2/boards', body);

$.setActionItem({
raw: data,
});
},
});
3 changes: 3 additions & 0 deletions packages/backend/src/apps/miro/actions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import createBoard from './create-board';

export default [createBoard];
2 changes: 2 additions & 0 deletions packages/backend/src/apps/miro/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import defineApp from '../../helpers/define-app';
import addAuthHeader from './common/add-auth-header';
import auth from './auth';
import actions from './actions';

export default defineApp({
name: 'Miro',
Expand All @@ -13,4 +14,5 @@ export default defineApp({
supportsConnections: true,
beforeRequest: [addAuthHeader],
auth,
actions,
});
9 changes: 9 additions & 0 deletions packages/docs/pages/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ export default defineConfig({
{ text: 'Connection', link: '/apps/mattermost/connection' },
],
},
{
text: 'Miro',
collapsible: true,
collapsed: true,
items: [
{ text: 'Actions', link: '/apps/miro/actions' },
{ text: 'Connection', link: '/apps/miro/connection' },
],
},
{
text: 'Notion',
collapsible: true,
Expand Down
12 changes: 12 additions & 0 deletions packages/docs/pages/apps/miro/actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
favicon: /favicons/miro.svg
items:
- name: Create board
desc: Creates a new board.
---

<script setup>
import CustomListing from '../../components/CustomListing.vue'
</script>

<CustomListing />
19 changes: 19 additions & 0 deletions packages/docs/pages/apps/miro/connection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Miro

:::info
This page explains the steps you need to follow to set up the Miro
connection in Automatisch. If any of the steps are outdated, please let us know!
:::

1. Go to [link](https://miro.com/signup/) to create a user account in Miro.
2. After signin in, go to [link](https://miro.com/app/dashboard/?createDevTeam=1) to create a developer team.
3. In the **Create new team** modal, select the checkbox and then click **Create team** button.
4. After that, click **Create new app** in Your app section.
5. Fill the field of **App Name**.
6. Select the **Expire user authorization token** checkbox and click the **Create app**.
7. Copy **OAuth Redirect URL** from Automatisch to the **Redirect URI for OAuth2.0** field.
8. Give permissions for **boards**, **identity**, and **team** scopes in Permissions field.
9. Copy the **Client ID** value to the `Client ID` field on Automatisch.
10. Copy the **Client secret** value to the `Client Secret` field on Automatisch.
11. Click **Submit** button on Automatisch.
12. Congrats! Start using your new Miro connection within the flows.
1 change: 1 addition & 0 deletions packages/docs/pages/public/favicons/miro.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 21c8c44

Please sign in to comment.