@pipedream/toggl 0.0.6 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/create-client/create-client.mjs +45 -0
- package/actions/create-project/create-project.mjs +86 -0
- package/actions/get-current-time-entry/get-current-time-entry.mjs +1 -1
- package/actions/get-time-entries/get-time-entries.mjs +1 -1
- package/actions/get-time-entry/get-time-entry.mjs +1 -1
- package/actions/update-client/update-client.mjs +61 -0
- package/actions/update-project/update-project.mjs +101 -0
- package/package.json +2 -2
- package/sources/new-start-time-entry/new-start-time-entry.mjs +1 -1
- package/sources/new-time-entry/new-time-entry.mjs +1 -1
- package/sources/new-update-time-entry/new-update-time-entry.mjs +1 -1
- package/sources/new-webhook-event/new-webhook-event.mjs +1 -1
- package/toggl.app.mjs +108 -0
|
@@ -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
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -2,7 +2,7 @@ import toggl from "../../toggl.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: "Get Current Time Entry",
|
|
5
|
-
version: "0.0.
|
|
5
|
+
version: "0.0.6",
|
|
6
6
|
key: "toggl-get-current-time-entry",
|
|
7
7
|
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)",
|
|
8
8
|
type: "action",
|
|
@@ -2,7 +2,7 @@ import toggl from "../../toggl.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: "Get Time Entries",
|
|
5
|
-
version: "0.0.
|
|
5
|
+
version: "0.0.6",
|
|
6
6
|
key: "toggl-get-time-entries",
|
|
7
7
|
description: "Get the last thousand time entries. [See docs here](https://developers.track.toggl.com/docs/api/time_entries#get-timeentries)",
|
|
8
8
|
type: "action",
|
|
@@ -2,7 +2,7 @@ import toggl from "../../toggl.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: "Get Time Entry",
|
|
5
|
-
version: "0.0.
|
|
5
|
+
version: "0.0.6",
|
|
6
6
|
key: "toggl-get-time-entry",
|
|
7
7
|
description: "Get details about a specific time entry. [See docs here](https://developers.track.toggl.com/docs/api/time_entries)",
|
|
8
8
|
type: "action",
|
|
@@ -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
|
+
};
|
|
@@ -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
|
+
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import base from "../common/base.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
...base,
|
|
5
5
|
name: "New Start Time Entry (Instant)",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.4",
|
|
7
7
|
key: "toggl-new-start-time-entry",
|
|
8
8
|
description: "Emit new event when a time entry is started. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
|
|
9
9
|
type: "source",
|
|
@@ -3,7 +3,7 @@ import base from "../common/base.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
...base,
|
|
5
5
|
name: "New Time Entry (Instant)",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.4",
|
|
7
7
|
key: "toggl-new-time-entry",
|
|
8
8
|
description: "Emit new event when a time entry is created. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
|
|
9
9
|
type: "source",
|
|
@@ -3,7 +3,7 @@ import base from "../common/base.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
...base,
|
|
5
5
|
name: "New Update Time Entry (Instant)",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.4",
|
|
7
7
|
key: "toggl-new-update-time-entry",
|
|
8
8
|
description: "Emit new event when a time entry is updated. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
|
|
9
9
|
type: "source",
|
|
@@ -4,7 +4,7 @@ import constants from "../common/constants.mjs";
|
|
|
4
4
|
export default {
|
|
5
5
|
...base,
|
|
6
6
|
name: "New Webhook Event (Instant)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.4",
|
|
8
8
|
key: "toggl-new-webhook-event",
|
|
9
9
|
description: "Emit new event on receive a webhook event. [See docs here](https://github.com/toggl/toggl_api_docs/blob/master/webhooks.md)",
|
|
10
10
|
type: "source",
|
package/toggl.app.mjs
CHANGED
|
@@ -39,6 +39,62 @@ export default {
|
|
|
39
39
|
}));
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
|
+
clientId: {
|
|
43
|
+
label: "Client ID",
|
|
44
|
+
description: "The client ID",
|
|
45
|
+
type: "integer",
|
|
46
|
+
async options({ workspaceId }) {
|
|
47
|
+
const clients = await this.getClients({
|
|
48
|
+
workspaceId,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return clients?.map((client) => ({
|
|
52
|
+
label: client.name,
|
|
53
|
+
value: client.id,
|
|
54
|
+
})) || [];
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
projectId: {
|
|
58
|
+
label: "Project ID",
|
|
59
|
+
description: "The project ID",
|
|
60
|
+
type: "integer",
|
|
61
|
+
async options({ workspaceId }) {
|
|
62
|
+
const projects = await this.getProjects({
|
|
63
|
+
workspaceId,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return projects?.map((project) => ({
|
|
67
|
+
label: project.name,
|
|
68
|
+
value: project.id,
|
|
69
|
+
})) || [];
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
clientName: {
|
|
73
|
+
type: "string",
|
|
74
|
+
label: "Name",
|
|
75
|
+
description: "Name of the client",
|
|
76
|
+
},
|
|
77
|
+
notes: {
|
|
78
|
+
type: "string",
|
|
79
|
+
label: "Notes",
|
|
80
|
+
description: "Notes about the client",
|
|
81
|
+
optional: true,
|
|
82
|
+
},
|
|
83
|
+
projectName: {
|
|
84
|
+
type: "string",
|
|
85
|
+
label: "Name",
|
|
86
|
+
description: "Name of the project",
|
|
87
|
+
},
|
|
88
|
+
startDate: {
|
|
89
|
+
type: "string",
|
|
90
|
+
label: "Start Date",
|
|
91
|
+
description: "The start date of the project in `YYYY-MM-DD` format",
|
|
92
|
+
},
|
|
93
|
+
endDate: {
|
|
94
|
+
type: "string",
|
|
95
|
+
label: "End Date",
|
|
96
|
+
description: "The end date of the project in `YYYY-MM-DD` format",
|
|
97
|
+
},
|
|
42
98
|
},
|
|
43
99
|
methods: {
|
|
44
100
|
_apiToken() {
|
|
@@ -79,6 +135,16 @@ export default {
|
|
|
79
135
|
getWorkspaces({ $ }) {
|
|
80
136
|
return this._makeRequest("v9", "me/workspaces", {}, $);
|
|
81
137
|
},
|
|
138
|
+
getClients({
|
|
139
|
+
workspaceId, $,
|
|
140
|
+
}) {
|
|
141
|
+
return this._makeRequest("v9", `workspaces/${workspaceId}/clients`, {}, $);
|
|
142
|
+
},
|
|
143
|
+
getProjects({
|
|
144
|
+
workspaceId, $,
|
|
145
|
+
}) {
|
|
146
|
+
return this._makeRequest("v9", `workspaces/${workspaceId}/projects`, {}, $);
|
|
147
|
+
},
|
|
82
148
|
getCurrentTimeEntry({ $ } = {}) {
|
|
83
149
|
return this._makeRequest("v9", "me/time_entries/current", {}, $);
|
|
84
150
|
},
|
|
@@ -97,5 +163,47 @@ export default {
|
|
|
97
163
|
} = {}) {
|
|
98
164
|
return this._makeRequest("v9", `me/time_entries/${timeEntryId}`, {}, $);
|
|
99
165
|
},
|
|
166
|
+
getClient({
|
|
167
|
+
workspaceId, clientId, $,
|
|
168
|
+
} = {}) {
|
|
169
|
+
return this._makeRequest("v9", `workspaces/${workspaceId}/clients/${clientId}`, {}, $);
|
|
170
|
+
},
|
|
171
|
+
getProject({
|
|
172
|
+
workspaceId, projectId, $,
|
|
173
|
+
} = {}) {
|
|
174
|
+
return this._makeRequest("v9", `workspaces/${workspaceId}/projects/${projectId}`, {}, $);
|
|
175
|
+
},
|
|
176
|
+
createClient({
|
|
177
|
+
workspaceId, data, $,
|
|
178
|
+
}) {
|
|
179
|
+
return this._makeRequest("v9", `workspaces/${workspaceId}/clients`, {
|
|
180
|
+
method: "post",
|
|
181
|
+
data,
|
|
182
|
+
}, $);
|
|
183
|
+
},
|
|
184
|
+
createProject({
|
|
185
|
+
workspaceId, data, $,
|
|
186
|
+
}) {
|
|
187
|
+
return this._makeRequest("v9", `workspaces/${workspaceId}/projects`, {
|
|
188
|
+
method: "post",
|
|
189
|
+
data,
|
|
190
|
+
}, $);
|
|
191
|
+
},
|
|
192
|
+
updateClient({
|
|
193
|
+
workspaceId, clientId, data, $,
|
|
194
|
+
}) {
|
|
195
|
+
return this._makeRequest("v9", `workspaces/${workspaceId}/clients/${clientId}`, {
|
|
196
|
+
method: "put",
|
|
197
|
+
data,
|
|
198
|
+
}, $);
|
|
199
|
+
},
|
|
200
|
+
updateProject({
|
|
201
|
+
workspaceId, projectId, data, $,
|
|
202
|
+
}) {
|
|
203
|
+
return this._makeRequest("v9", `workspaces/${workspaceId}/projects/${projectId}`, {
|
|
204
|
+
method: "put",
|
|
205
|
+
data,
|
|
206
|
+
}, $);
|
|
207
|
+
},
|
|
100
208
|
},
|
|
101
209
|
};
|