Skip to content

Commit da5c98d

Browse files
committed
new components
1 parent 9decc02 commit da5c98d

File tree

13 files changed

+409
-8
lines changed

13 files changed

+409
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import toggl from "../../toggl.app.mjs";
2+
3+
export default {
4+
key: "toggl-create-client",
5+
name: "Create Client",
6+
description: "Create a new client in Toggl. [See the documentation](https://engineering.toggl.com/docs/api/clients#post-create-client)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
toggl,
11+
workspaceId: {
12+
propDefinition: [
13+
toggl,
14+
"workspaceId",
15+
],
16+
},
17+
name: {
18+
propDefinition: [
19+
toggl,
20+
"clientName",
21+
],
22+
},
23+
notes: {
24+
propDefinition: [
25+
toggl,
26+
"notes",
27+
],
28+
},
29+
},
30+
async run({ $ }) {
31+
const response = await this.toggl.createClient({
32+
$,
33+
workspaceId: this.workspaceId,
34+
data: {
35+
name: this.name,
36+
notes: this.notes,
37+
wid: this.workspaceId,
38+
},
39+
});
40+
if (response.id) {
41+
$.export("$summary", `Successfully created client with ID: ${response.id}`);
42+
}
43+
return response;
44+
},
45+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import toggl from "../../toggl.app.mjs";
2+
3+
export default {
4+
key: "toggl-create-project",
5+
name: "Create Project",
6+
description: "Create a new project in Toggl. [See the documentation](https://engineering.toggl.com/docs/api/projects#post-workspaceprojects)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
toggl,
11+
workspaceId: {
12+
propDefinition: [
13+
toggl,
14+
"workspaceId",
15+
],
16+
},
17+
name: {
18+
propDefinition: [
19+
toggl,
20+
"projectName",
21+
],
22+
},
23+
startDate: {
24+
propDefinition: [
25+
toggl,
26+
"startDate",
27+
],
28+
},
29+
endDate: {
30+
propDefinition: [
31+
toggl,
32+
"endDate",
33+
],
34+
},
35+
active: {
36+
type: "boolean",
37+
label: "Active",
38+
description: "Whether the project is active or archived. Defaults to `true`.",
39+
optional: true,
40+
default: true,
41+
},
42+
isPrivate: {
43+
type: "boolean",
44+
label: "Is Private?",
45+
description: "Whether the project is private or not. Defaults to `false`.",
46+
optional: true,
47+
default: false,
48+
},
49+
isShared: {
50+
type: "boolean",
51+
label: "Is Shared?",
52+
description: "Whether the project is shared or not. Defaults to `false`.",
53+
optional: true,
54+
default: false,
55+
},
56+
clientId: {
57+
propDefinition: [
58+
toggl,
59+
"clientId",
60+
(c) => ({
61+
workspaceId: c.workspaceId,
62+
}),
63+
],
64+
optional: true,
65+
},
66+
},
67+
async run({ $ }) {
68+
const response = await this.toggl.createProject({
69+
$,
70+
workspaceId: this.workspaceId,
71+
data: {
72+
name: this.name,
73+
start_date: this.startDate,
74+
end_date: this.endDate,
75+
active: this.active,
76+
is_private: this.isPrivate,
77+
is_shared: this.isShared,
78+
client_id: this.clientId,
79+
},
80+
});
81+
if (response.id) {
82+
$.export("$summary", `Successfully created project with ID: ${response.id}`);
83+
}
84+
return response;
85+
},
86+
};

components/toggl/actions/get-current-time-entry/get-current-time-entry.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import toggl from "../../toggl.app.mjs";
22

33
export default {
44
name: "Get Current Time Entry",
5-
version: "0.0.5",
5+
version: "0.0.6",
66
key: "toggl-get-current-time-entry",
77
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)",
88
type: "action",

components/toggl/actions/get-time-entries/get-time-entries.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import toggl from "../../toggl.app.mjs";
22

33
export default {
44
name: "Get Time Entries",
5-
version: "0.0.5",
5+
version: "0.0.6",
66
key: "toggl-get-time-entries",
77
description: "Get the last thousand time entries. [See docs here](https://developers.track.toggl.com/docs/api/time_entries#get-timeentries)",
88
type: "action",

components/toggl/actions/get-time-entry/get-time-entry.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import toggl from "../../toggl.app.mjs";
22

33
export default {
44
name: "Get Time Entry",
5-
version: "0.0.5",
5+
version: "0.0.6",
66
key: "toggl-get-time-entry",
77
description: "Get details about a specific time entry. [See docs here](https://developers.track.toggl.com/docs/api/time_entries)",
88
type: "action",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import toggl from "../../toggl.app.mjs";
2+
3+
export default {
4+
key: "toggl-update-client",
5+
name: "Update Client",
6+
description: "Updates an existing client in Toggl. [See the documentation](https://engineering.toggl.com/docs/api/clients#put-change-client)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
toggl,
11+
workspaceId: {
12+
propDefinition: [
13+
toggl,
14+
"workspaceId",
15+
],
16+
},
17+
clientId: {
18+
propDefinition: [
19+
toggl,
20+
"clientId",
21+
(c) => ({
22+
workspaceId: c.workspaceId,
23+
}),
24+
],
25+
},
26+
name: {
27+
propDefinition: [
28+
toggl,
29+
"clientName",
30+
],
31+
optional: true,
32+
},
33+
notes: {
34+
propDefinition: [
35+
toggl,
36+
"notes",
37+
],
38+
},
39+
},
40+
async run({ $ }) {
41+
const client = await this.toggl.getClient({
42+
$,
43+
workspaceId: this.workspaceId,
44+
clientId: this.clientId,
45+
});
46+
const response = await this.toggl.updateClient({
47+
$,
48+
workspaceId: this.workspaceId,
49+
clientId: this.clientId,
50+
data: {
51+
name: this.name || client.name,
52+
notes: this.notes || client.notes,
53+
wid: this.workspaceId,
54+
},
55+
});
56+
if (response.id) {
57+
$.export("$summary", `Successfully updated client with ID: ${response.id}`);
58+
}
59+
return response;
60+
},
61+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import toggl from "../../toggl.app.mjs";
2+
3+
export default {
4+
key: "toggl-update-project",
5+
name: "Update Project",
6+
description: "Updates an existing project in Toggl. [See the documentation](https://engineering.toggl.com/docs/api/projects#put-workspaceproject)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
toggl,
11+
workspaceId: {
12+
propDefinition: [
13+
toggl,
14+
"workspaceId",
15+
],
16+
},
17+
projectId: {
18+
propDefinition: [
19+
toggl,
20+
"projectId",
21+
(c) => ({
22+
workspaceId: c.workspaceId,
23+
}),
24+
],
25+
},
26+
name: {
27+
propDefinition: [
28+
toggl,
29+
"projectName",
30+
],
31+
optional: true,
32+
},
33+
startDate: {
34+
propDefinition: [
35+
toggl,
36+
"startDate",
37+
],
38+
optional: true,
39+
},
40+
endDate: {
41+
propDefinition: [
42+
toggl,
43+
"endDate",
44+
],
45+
optional: true,
46+
},
47+
active: {
48+
type: "boolean",
49+
label: "Active",
50+
description: "Whether the project is active or archived.",
51+
optional: true,
52+
},
53+
isPrivate: {
54+
type: "boolean",
55+
label: "Is Private?",
56+
description: "Whether the project is private or not.",
57+
optional: true,
58+
},
59+
isShared: {
60+
type: "boolean",
61+
label: "Is Shared?",
62+
description: "Whether the project is shared or not.",
63+
optional: true,
64+
},
65+
clientId: {
66+
propDefinition: [
67+
toggl,
68+
"clientId",
69+
(c) => ({
70+
workspaceId: c.workspaceId,
71+
}),
72+
],
73+
optional: true,
74+
},
75+
},
76+
async run({ $ }) {
77+
const project = await this.toggl.getProject({
78+
$,
79+
workspaceId: this.workspaceId,
80+
projectId: this.projectId,
81+
});
82+
const response = await this.toggl.updateProject({
83+
$,
84+
workspaceId: this.workspaceId,
85+
projectId: this.projectId,
86+
data: {
87+
name: this.name || project.name,
88+
start_date: this.startDate || project.start_date,
89+
end_date: this.endDate || project.end_date,
90+
active: this.active || project.active,
91+
is_private: this.isPrivate || project.isPrivate,
92+
is_shared: this.isShared || project.is_shared,
93+
client_id: this.clientId || project.client_id,
94+
},
95+
});
96+
if (response.id) {
97+
$.export("$summary", `Successfully updated project with ID: ${response.id}`);
98+
}
99+
return response;
100+
},
101+
};

components/toggl/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/toggl",
3-
"version": "0.0.6",
3+
"version": "0.1.0",
44
"description": "Pipedream Toggl Components",
55
"main": "toggl.app.js",
66
"keywords": [

components/toggl/sources/new-start-time-entry/new-start-time-entry.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import base from "../common/base.mjs";
33
export default {
44
...base,
55
name: "New Start Time Entry (Instant)",
6-
version: "0.0.3",
6+
version: "0.0.4",
77
key: "toggl-new-start-time-entry",
88
description: "Emit new event when a time entry is started. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
99
type: "source",

components/toggl/sources/new-time-entry/new-time-entry.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import base from "../common/base.mjs";
33
export default {
44
...base,
55
name: "New Time Entry (Instant)",
6-
version: "0.0.3",
6+
version: "0.0.4",
77
key: "toggl-new-time-entry",
88
description: "Emit new event when a time entry is created. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
99
type: "source",

components/toggl/sources/new-update-time-entry/new-update-time-entry.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import base from "../common/base.mjs";
33
export default {
44
...base,
55
name: "New Update Time Entry (Instant)",
6-
version: "0.0.3",
6+
version: "0.0.4",
77
key: "toggl-new-update-time-entry",
88
description: "Emit new event when a time entry is updated. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
99
type: "source",

components/toggl/sources/new-webhook-event/new-webhook-event.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import constants from "../common/constants.mjs";
44
export default {
55
...base,
66
name: "New Webhook Event (Instant)",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
key: "toggl-new-webhook-event",
99
description: "Emit new event on receive a webhook event. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
1010
type: "source",

0 commit comments

Comments
 (0)