feat(clickup): add new folders trigger

This commit is contained in:
Rıdvan Akca
2024-02-13 18:09:07 +03:00
committed by Ali BARIN
parent 26fc63c52c
commit b4cc7f4d81
9 changed files with 184 additions and 1 deletions

View File

@@ -0,0 +1,4 @@
import listSpaces from './list-spaces/index.js';
import listWorkspaces from './list-workspaces/index.js';
export default [listSpaces, listWorkspaces];

View File

@@ -0,0 +1,28 @@
export default {
name: 'List spaces',
key: 'listSpaces',
async run($) {
const spaces = {
data: [],
};
const workspaceId = $.step.parameters.workspaceId;
if (!workspaceId) {
return spaces;
}
const { data } = await $.http.get(`/v2/team/${workspaceId}/space`);
if (data.spaces) {
for (const space of data.spaces) {
spaces.data.push({
value: space.id,
name: space.name,
});
}
}
return spaces;
},
};

View File

@@ -0,0 +1,23 @@
export default {
name: 'List workspaces',
key: 'listWorkspaces',
async run($) {
const workspaces = {
data: [],
};
const { data } = await $.http.get('/v2/team');
if (data.teams) {
for (const workspace of data.teams) {
workspaces.data.push({
value: workspace.id,
name: workspace.name,
});
}
}
return workspaces;
},
};