Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/nifty/actions/assign-task/assign-task.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "nifty-assign-task",
name: "Assign Task to Team Member",
description: "Assigns a specific task to a team member in Nifty. [See the documentation](https://openapi.niftypm.com/api#put-api-v1-0-tasks-task_id-assignees)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
nifty,
Expand Down
2 changes: 1 addition & 1 deletion components/nifty/actions/create-message/create-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "nifty-create-message",
name: "Create Message",
description: "Sends a new message in a team's discussion. [See the documentation](https://openapi.niftypm.com/api)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
nifty,
Expand Down
2 changes: 1 addition & 1 deletion components/nifty/actions/create-project/create-project.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "nifty-create-project",
name: "Create Project",
description: "Creates a new project in a designated portfolio. [See the documentation](https://openapi.niftypm.com/api#/Projects/ProjectAPIController_createProject)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
nifty,
Expand Down
112 changes: 112 additions & 0 deletions components/nifty/actions/create-task/create-task.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import nifty from "../../nifty.app.mjs";

export default {
key: "nifty-create-task",
name: "Create Task",
description: "Creates a new task. [See the documentation](https://developers.niftypm.com/operation/operation-taskapicontroller_createtask)",
version: "0.0.1",
type: "action",
props: {
nifty,
projectId: {
propDefinition: [
nifty,
"projectId",
],
},
taskGroupId: {
propDefinition: [
nifty,
"taskGroupId",
(c) => ({
projectId: c.projectId,
}),
],
},
name: {
type: "string",
label: "Name",
description: "The name of the task",
},
description: {
type: "string",
label: "Description",
description: "A description of the task",
optional: true,
},
order: {
type: "integer",
label: "Order",
description: "The order of the task",
optional: true,
},
parentTaskId: {
propDefinition: [
nifty,
"taskId",
(c) => ({
projectId: c.projectId,
}),
],
label: "Parent Task ID",
description: "Enter a parent task ID to create this task as subtask of another task",
optional: true,
},
milestoneId: {
propDefinition: [
nifty,
"milestoneId",
(c) => ({
projectId: c.projectId,
}),
],
},
dueDate: {
type: "string",
label: "Due Date",
description: "Due date of the task in ISO-8601 format",
optional: true,
},
startDate: {
type: "string",
label: "Start Date",
description: "Start date of the task in ISO-8601 format",
optional: true,
},
assigneeIds: {
propDefinition: [
nifty,
"memberId",
],
type: "string[]",
label: "Assignee IDs",
description: "An array of assignee IDs to assign to the task",
optional: true,
},
labels: {
type: "string[]",
label: "Labels",
description: "An array of labels to add to the task",
optional: true,
},
},
async run({ $ }) {
const response = await this.nifty.createTask({
$,
data: {
task_group_id: this.taskGroupId,
name: this.name,
description: this.description,
order: this.order,
task_id: this.parentTaskId,
milestone_id: this.milestoneId,
due_date: this.dueDate,
start_date: this.startDate,
assignee_ids: this.assigneeIds,
labels: this.labels,
},
});
$.export("$summary", `Successfully created task with ID: ${response.id}`);
return response;
},
};
118 changes: 99 additions & 19 deletions components/nifty/nifty.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
propDefinitions: {
appId: {
type: "string",
label: "App Id",
label: "App ID",
description: `The unique identifier for the App. On Nifty, a new app can be created by following these steps:
1. Access Profile Settings > App Center > Integrate with API > Create a new App.
2. In the Create App popup, add the following Pipedream Redirect URL to the Redirect URLs: \`https://api.pipedream.com/connect/oauth/oa_aWyi2m/callback\`.
Expand All @@ -20,30 +20,33 @@ export default {
},
});

return apps.map(({ id: value, name: label }) => ({
return apps.map(({
id: value, name: label,
}) => ({
label,
value,
}));
},
},
memberId: {
type: "string",
label: "Member Id",
description:
"The unique identifier for the member that the task will be assigned.",
label: "Member ID",
description: "The unique identifier for the member that the task will be assigned",
async options() {
const members = await this.listMembers();

return members.map(({ id: value, name: label }) => ({
return members.map(({
id: value, name: label,
}) => ({
label,
value,
}));
},
},
projectId: {
type: "string",
label: "Project Id",
description: "The unique identifier for the project.",
label: "Project ID",
description: "The unique identifier for the project",
async options({ page }) {
const { projects } = await this.listProjects({
params: {
Expand All @@ -52,34 +55,41 @@ export default {
},
});

return projects.map(({ id: value, name: label }) => ({
return projects.map(({
id: value, name: label,
}) => ({
label,
value,
}));
},
},
taskId: {
type: "string",
label: "Task Id",
description: "The unique identifier for the task.",
async options({ page }) {
label: "Task ID",
description: "The unique identifier for the task",
async options({
page, projectId,
}) {
const { tasks } = await this.listTasks({
params: {
limit: LIMIT,
offset: LIMIT * page,
project_id: projectId,
},
});

return tasks.map(({ id: value, name: label }) => ({
return tasks.map(({
id: value, name: label,
}) => ({
label,
value,
}));
},
},
templateId: {
type: "string",
label: "Template Id",
description: "The unique identifier for the template.",
label: "Template ID",
description: "The unique identifier for the template",
async options({ page }) {
const { items } = await this.listTemplates({
params: {
Expand All @@ -89,12 +99,63 @@ export default {
},
});

return items.map(({ id: value, name: label }) => ({
return items.map(({
id: value, name: label,
}) => ({
label,
value,
}));
},
},
milestoneId: {
type: "string",
label: "Milestone ID",
description: "The unique identifier of a milestone",
optional: true,
async options({
page, projectId,
}) {
const { items } = await this.listMilestones({
params: {
limit: LIMIT,
offset: LIMIT * page,
project_id: projectId,
},
});

return items.map(({
id: value, name: label,
}) => ({
label,
value,
}));
},
},
taskGroupId: {
type: "string",
label: "Task Group ID",
description: "The unique identifier of a task group",
async options({
page, projectId,
}) {
const { items } = await this.listMilestones({
params: {
limit: LIMIT,
offset: LIMIT * page,
project_id: projectId,
},
});

return items
.filter(({ task_group }) => task_group )
.map(({
task_group: value, name: label,
}) => ({
label,
value,
}));
},
},
},
methods: {
_baseUrl() {
Expand All @@ -105,7 +166,9 @@ export default {
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
};
},
_makeRequest({ $ = this, path, ...opts }) {
_makeRequest({
$ = this, path, ...opts
}) {
return axios($, {
url: this._baseUrl() + path,
headers: this._headers(),
Expand Down Expand Up @@ -160,6 +223,12 @@ export default {
...opts,
});
},
listMilestones(opts = {}) {
return this._makeRequest({
path: "/milestones",
...opts,
});
},
listTemplates(opts = {}) {
return this._makeRequest({
path: "/templates",
Expand All @@ -173,7 +242,9 @@ export default {
...opts,
});
},
deleteHook({ hookId, ...opts }) {
deleteHook({
hookId, ...opts
}) {
return this._makeRequest({
method: "DELETE",
path: `/webhooks/${hookId}`,
Expand All @@ -187,7 +258,9 @@ export default {
...opts,
});
},
assignTask({ taskId, ...opts }) {
assignTask({
taskId, ...opts
}) {
return this._makeRequest({
method: "PUT",
path: `/tasks/${taskId}/assignees`,
Expand All @@ -201,5 +274,12 @@ export default {
...opts,
});
},
createTask(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/tasks",
...opts,
});
},
},
};
4 changes: 2 additions & 2 deletions components/nifty/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/nifty",
"version": "0.1.0",
"version": "0.2.0",
"description": "Pipedream Nifty Components",
"main": "nifty.app.mjs",
"keywords": [
Expand All @@ -13,6 +13,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.5.1"
"@pipedream/platform": "^3.0.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "nifty-new-message-posted",
name: "New Message Posted",
description: "Emit new event when a new message is posted in a team's discussion.",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "nifty-new-task-created",
name: "New Task Created",
description: "Emit new event when a task is created in a project.",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Loading
Loading