Skip to content

Commit a03e487

Browse files
Support query parameters in Get Time Entries action (#16540)
* Allow passing start_date, end_date, since, before, meta, include_sharing to Get Time Entries action (#16539) * chore(toggl): bump version in package.json and get-time-entries.mjs
1 parent cbe2297 commit a03e487

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

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

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,59 @@ import toggl from "../../toggl.app.mjs";
22

33
export default {
44
name: "Get Time Entries",
5-
version: "0.0.6",
5+
version: "0.0.7",
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",
99
props: {
1010
toggl,
11+
startDate: {
12+
type: "string",
13+
label: "Start Date",
14+
description: "Get entries with start time, from start_date YYYY-MM-DD or with time in RFC3339 format. To be used with end_date.",
15+
optional: true,
16+
},
17+
endDate: {
18+
type: "string",
19+
label: "End Date",
20+
description: "Get entries with start time, until end_date YYYY-MM-DD or with time in RFC3339 format. To be used with start_date.",
21+
optional: true,
22+
},
23+
since: {
24+
type: "string",
25+
label: "Since (UNIX timestamp)",
26+
description: "Get entries modified since this date using UNIX timestamp, including deleted ones.",
27+
optional: true,
28+
},
29+
before: {
30+
type: "string",
31+
label: "Before",
32+
description: "Get entries with start time, before given date (YYYY-MM-DD) or with time in RFC3339 format.",
33+
optional: true,
34+
},
35+
meta: {
36+
type: "boolean",
37+
label: "Meta",
38+
description: "Should the response contain data for meta entities.",
39+
optional: true,
40+
},
41+
includeSharing: {
42+
type: "boolean",
43+
label: "Include Sharing",
44+
description: "Include sharing details in the response.",
45+
optional: true,
46+
},
1147
},
1248
async run({ $ }) {
49+
const params = {};
50+
if (this.startDate) params.start_date = this.startDate;
51+
if (this.endDate) params.end_date = this.endDate;
52+
if (this.since) params.since = this.since;
53+
if (this.before) params.before = this.before;
54+
if (typeof this.meta === "boolean") params.meta = this.meta;
55+
if (typeof this.includeSharing === "boolean") params.include_sharing = this.includeSharing;
1356
const response = await this.toggl.getTimeEntries({
57+
params,
1458
$,
1559
});
1660

components/toggl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/toggl",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Pipedream Toggl Components",
55
"main": "toggl.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)