Skip to content

Commit

Permalink
new components (#13884)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelle0927 authored Sep 12, 2024
1 parent 3106435 commit bde7b75
Show file tree
Hide file tree
Showing 13 changed files with 409 additions and 8 deletions.
45 changes: 45 additions & 0 deletions components/toggl/actions/create-client/create-client.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import toggl from "../../toggl.app.mjs";

export default {
key: "toggl-create-client",
name: "Create Client",
description: "Create a new client in Toggl. [See the documentation](https://engineering.toggl.com/docs/api/clients#post-create-client)",
version: "0.0.1",
type: "action",
props: {
toggl,
workspaceId: {
propDefinition: [
toggl,
"workspaceId",
],
},
name: {
propDefinition: [
toggl,
"clientName",
],
},
notes: {
propDefinition: [
toggl,
"notes",
],
},
},
async run({ $ }) {
const response = await this.toggl.createClient({
$,
workspaceId: this.workspaceId,
data: {
name: this.name,
notes: this.notes,
wid: this.workspaceId,
},
});
if (response.id) {
$.export("$summary", `Successfully created client with ID: ${response.id}`);
}
return response;
},
};
86 changes: 86 additions & 0 deletions components/toggl/actions/create-project/create-project.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import toggl from "../../toggl.app.mjs";

export default {
key: "toggl-create-project",
name: "Create Project",
description: "Create a new project in Toggl. [See the documentation](https://engineering.toggl.com/docs/api/projects#post-workspaceprojects)",
version: "0.0.1",
type: "action",
props: {
toggl,
workspaceId: {
propDefinition: [
toggl,
"workspaceId",
],
},
name: {
propDefinition: [
toggl,
"projectName",
],
},
startDate: {
propDefinition: [
toggl,
"startDate",
],
},
endDate: {
propDefinition: [
toggl,
"endDate",
],
},
active: {
type: "boolean",
label: "Active",
description: "Whether the project is active or archived. Defaults to `true`.",
optional: true,
default: true,
},
isPrivate: {
type: "boolean",
label: "Is Private?",
description: "Whether the project is private or not. Defaults to `false`.",
optional: true,
default: false,
},
isShared: {
type: "boolean",
label: "Is Shared?",
description: "Whether the project is shared or not. Defaults to `false`.",
optional: true,
default: false,
},
clientId: {
propDefinition: [
toggl,
"clientId",
(c) => ({
workspaceId: c.workspaceId,
}),
],
optional: true,
},
},
async run({ $ }) {
const response = await this.toggl.createProject({
$,
workspaceId: this.workspaceId,
data: {
name: this.name,
start_date: this.startDate,
end_date: this.endDate,
active: this.active,
is_private: this.isPrivate,
is_shared: this.isShared,
client_id: this.clientId,
},
});
if (response.id) {
$.export("$summary", `Successfully created project with ID: ${response.id}`);
}
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import toggl from "../../toggl.app.mjs";

export default {
name: "Get Current Time Entry",
version: "0.0.5",
version: "0.0.6",
key: "toggl-get-current-time-entry",
description: "Get the time entry that is running now. [See docs here]https://developers.track.toggl.com/docs/api/time_entries#get-get-current-time-entry)",
type: "action",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import toggl from "../../toggl.app.mjs";

export default {
name: "Get Time Entries",
version: "0.0.5",
version: "0.0.6",
key: "toggl-get-time-entries",
description: "Get the last thousand time entries. [See docs here](https://developers.track.toggl.com/docs/api/time_entries#get-timeentries)",
type: "action",
Expand Down
2 changes: 1 addition & 1 deletion components/toggl/actions/get-time-entry/get-time-entry.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import toggl from "../../toggl.app.mjs";

export default {
name: "Get Time Entry",
version: "0.0.5",
version: "0.0.6",
key: "toggl-get-time-entry",
description: "Get details about a specific time entry. [See docs here](https://developers.track.toggl.com/docs/api/time_entries)",
type: "action",
Expand Down
61 changes: 61 additions & 0 deletions components/toggl/actions/update-client/update-client.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import toggl from "../../toggl.app.mjs";

export default {
key: "toggl-update-client",
name: "Update Client",
description: "Updates an existing client in Toggl. [See the documentation](https://engineering.toggl.com/docs/api/clients#put-change-client)",
version: "0.0.1",
type: "action",
props: {
toggl,
workspaceId: {
propDefinition: [
toggl,
"workspaceId",
],
},
clientId: {
propDefinition: [
toggl,
"clientId",
(c) => ({
workspaceId: c.workspaceId,
}),
],
},
name: {
propDefinition: [
toggl,
"clientName",
],
optional: true,
},
notes: {
propDefinition: [
toggl,
"notes",
],
},
},
async run({ $ }) {
const client = await this.toggl.getClient({
$,
workspaceId: this.workspaceId,
clientId: this.clientId,
});
const response = await this.toggl.updateClient({
$,
workspaceId: this.workspaceId,
clientId: this.clientId,
data: {
name: this.name || client.name,
notes: this.notes || client.notes,
wid: this.workspaceId,
},
});
if (response.id) {
$.export("$summary", `Successfully updated client with ID: ${response.id}`);
}
return response;
},
};
101 changes: 101 additions & 0 deletions components/toggl/actions/update-project/update-project.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import toggl from "../../toggl.app.mjs";

export default {
key: "toggl-update-project",
name: "Update Project",
description: "Updates an existing project in Toggl. [See the documentation](https://engineering.toggl.com/docs/api/projects#put-workspaceproject)",
version: "0.0.1",
type: "action",
props: {
toggl,
workspaceId: {
propDefinition: [
toggl,
"workspaceId",
],
},
projectId: {
propDefinition: [
toggl,
"projectId",
(c) => ({
workspaceId: c.workspaceId,
}),
],
},
name: {
propDefinition: [
toggl,
"projectName",
],
optional: true,
},
startDate: {
propDefinition: [
toggl,
"startDate",
],
optional: true,
},
endDate: {
propDefinition: [
toggl,
"endDate",
],
optional: true,
},
active: {
type: "boolean",
label: "Active",
description: "Whether the project is active or archived.",
optional: true,
},
isPrivate: {
type: "boolean",
label: "Is Private?",
description: "Whether the project is private or not.",
optional: true,
},
isShared: {
type: "boolean",
label: "Is Shared?",
description: "Whether the project is shared or not.",
optional: true,
},
clientId: {
propDefinition: [
toggl,
"clientId",
(c) => ({
workspaceId: c.workspaceId,
}),
],
optional: true,
},
},
async run({ $ }) {
const project = await this.toggl.getProject({
$,
workspaceId: this.workspaceId,
projectId: this.projectId,
});
const response = await this.toggl.updateProject({
$,
workspaceId: this.workspaceId,
projectId: this.projectId,
data: {
name: this.name || project.name,
start_date: this.startDate || project.start_date,
end_date: this.endDate || project.end_date,
active: this.active || project.active,
is_private: this.isPrivate || project.isPrivate,
is_shared: this.isShared || project.is_shared,
client_id: this.clientId || project.client_id,
},
});
if (response.id) {
$.export("$summary", `Successfully updated project with ID: ${response.id}`);
}
return response;
},
};
2 changes: 1 addition & 1 deletion components/toggl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/toggl",
"version": "0.0.6",
"version": "0.1.0",
"description": "Pipedream Toggl Components",
"main": "toggl.app.js",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import base from "../common/base.mjs";
export default {
...base,
name: "New Start Time Entry (Instant)",
version: "0.0.3",
version: "0.0.4",
key: "toggl-new-start-time-entry",
description: "Emit new event when a time entry is started. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
type: "source",
Expand Down
2 changes: 1 addition & 1 deletion components/toggl/sources/new-time-entry/new-time-entry.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import base from "../common/base.mjs";
export default {
...base,
name: "New Time Entry (Instant)",
version: "0.0.3",
version: "0.0.4",
key: "toggl-new-time-entry",
description: "Emit new event when a time entry is created. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
type: "source",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import base from "../common/base.mjs";
export default {
...base,
name: "New Update Time Entry (Instant)",
version: "0.0.3",
version: "0.0.4",
key: "toggl-new-update-time-entry",
description: "Emit new event when a time entry is updated. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
type: "source",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import constants from "../common/constants.mjs";
export default {
...base,
name: "New Webhook Event (Instant)",
version: "0.0.3",
version: "0.0.4",
key: "toggl-new-webhook-event",
description: "Emit new event on receive a webhook event. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
type: "source",
Expand Down
Loading

0 comments on commit bde7b75

Please sign in to comment.