Compare commits
1 Commits
helix-new-
...
AUT-366
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2846dd2bdd |
4
packages/backend/src/apps/trello/dynamic-data/index.ts
Normal file
4
packages/backend/src/apps/trello/dynamic-data/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import listBoardLists from './list-board-lists';
|
||||
import listBoards from './list-boards';
|
||||
|
||||
export default [listBoardLists, listBoards];
|
@@ -0,0 +1,33 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List board lists',
|
||||
key: 'listBoardLists',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const boards: {
|
||||
data: IJSONObject[];
|
||||
} = {
|
||||
data: [],
|
||||
};
|
||||
|
||||
const boardId = $.step.parameters.boardId;
|
||||
|
||||
if (!boardId) {
|
||||
return { data: [] };
|
||||
}
|
||||
|
||||
const { data } = await $.http.get(`/1/boards/${boardId}/lists`);
|
||||
|
||||
if (data) {
|
||||
for (const list of data) {
|
||||
boards.data.push({
|
||||
value: list.id,
|
||||
name: list.name,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return boards;
|
||||
},
|
||||
};
|
@@ -0,0 +1,29 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List boards',
|
||||
key: 'listBoards',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const boards: {
|
||||
data: IJSONObject[];
|
||||
} = {
|
||||
data: [],
|
||||
};
|
||||
|
||||
const { data } = await $.http.get(`/1/members/me/boards`);
|
||||
|
||||
if (data) {
|
||||
for (const board of data) {
|
||||
boards.data.push({
|
||||
value: board.id,
|
||||
name: board.name,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return { data: [] };
|
||||
}
|
||||
|
||||
return boards;
|
||||
},
|
||||
};
|
@@ -1,6 +1,8 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import triggers from './triggers';
|
||||
import dynamicData from './dynamic-data';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Trello',
|
||||
@@ -13,4 +15,6 @@ export default defineApp({
|
||||
primaryColor: '0079bf',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
dynamicData,
|
||||
});
|
||||
|
3
packages/backend/src/apps/trello/triggers/index.ts
Normal file
3
packages/backend/src/apps/trello/triggers/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import newCards from './new-cards';
|
||||
|
||||
export default [newCards];
|
123
packages/backend/src/apps/trello/triggers/new-cards/index.ts
Normal file
123
packages/backend/src/apps/trello/triggers/new-cards/index.ts
Normal file
@@ -0,0 +1,123 @@
|
||||
import defineTrigger from '../../../../helpers/define-trigger';
|
||||
|
||||
export default defineTrigger({
|
||||
name: 'New cards',
|
||||
key: 'newCards',
|
||||
pollInterval: 15,
|
||||
description: 'Triggers upon the addition of a new card.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Board',
|
||||
key: 'boardId',
|
||||
type: 'dropdown' as const,
|
||||
required: false,
|
||||
description:
|
||||
'Selecting a board initiates the trigger for newly added cards on that board.',
|
||||
variables: true,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: 'listBoards',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'List',
|
||||
key: 'listId',
|
||||
type: 'dropdown' as const,
|
||||
required: false,
|
||||
dependsOn: ['parameters.boardId'],
|
||||
description: 'Requires to opt for a board.',
|
||||
variables: true,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: 'listBoardLists',
|
||||
},
|
||||
{
|
||||
name: 'parameters.boardId',
|
||||
value: '{parameters.boardId}',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Filter',
|
||||
key: 'filter',
|
||||
type: 'dropdown' as const,
|
||||
required: false,
|
||||
description: 'Default is open.',
|
||||
variables: true,
|
||||
options: [
|
||||
{
|
||||
label: 'open',
|
||||
value: 'open',
|
||||
},
|
||||
{
|
||||
label: 'closed',
|
||||
value: 'closed',
|
||||
},
|
||||
{
|
||||
label: 'all',
|
||||
value: 'all',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const { boardId, listId, filter } = $.step.parameters;
|
||||
|
||||
if (boardId && !listId) {
|
||||
const cardFilter = filter || 'open';
|
||||
|
||||
const { data } = await $.http.get(
|
||||
`/1/boards/${boardId}/cards/${cardFilter}`
|
||||
);
|
||||
|
||||
if (data) {
|
||||
for (const card of data) {
|
||||
$.pushTriggerItem({
|
||||
raw: card,
|
||||
meta: {
|
||||
internalId: card.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (listId) {
|
||||
const { data } = await $.http.get(`1/lists/${listId}/cards`);
|
||||
|
||||
if (data) {
|
||||
for (const card of data) {
|
||||
$.pushTriggerItem({
|
||||
raw: card,
|
||||
meta: {
|
||||
internalId: card.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const { data } = await $.http.get(`/1/members/me/cards`);
|
||||
|
||||
if (data) {
|
||||
for (const card of data) {
|
||||
$.pushTriggerItem({
|
||||
raw: card,
|
||||
meta: {
|
||||
internalId: card.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
@@ -377,7 +377,10 @@ export default defineConfig({
|
||||
text: 'Trello',
|
||||
collapsible: true,
|
||||
collapsed: true,
|
||||
items: [{ text: 'Connection', link: '/apps/trello/connection' }],
|
||||
items: [
|
||||
{ text: 'Triggers', link: '/apps/trello/triggers' },
|
||||
{ text: 'Connection', link: '/apps/trello/connection' },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: 'Twilio',
|
||||
|
12
packages/docs/pages/apps/trello/triggers.md
Normal file
12
packages/docs/pages/apps/trello/triggers.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
favicon: /favicons/trello.svg
|
||||
items:
|
||||
- name: New cards
|
||||
desc: Triggers upon the addition of a new card.
|
||||
---
|
||||
|
||||
<script setup>
|
||||
import CustomListing from '../../components/CustomListing.vue'
|
||||
</script>
|
||||
|
||||
<CustomListing />
|
@@ -39,6 +39,7 @@ The following integrations are currently supported by Automatisch.
|
||||
- [Stripe](/apps/stripe/triggers)
|
||||
- [Telegram](/apps/telegram-bot/actions)
|
||||
- [Todoist](/apps/todoist/triggers)
|
||||
- [Trello](/apps/trello/triggers)
|
||||
- [Twilio](/apps/twilio/triggers)
|
||||
- [Twitter](/apps/twitter/triggers)
|
||||
- [Typeform](/apps/typeform/triggers)
|
||||
|
Reference in New Issue
Block a user