Skip to content

Support query parameters in Get Time Entries action #16540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
44 changes: 44 additions & 0 deletions components/toggl/actions/get-time-entries/get-time-entries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,53 @@ export default {
type: "action",
props: {
toggl,
startDate: {
type: "string",
label: "Start Date",
description: "Get entries with start time, from start_date YYYY-MM-DD or with time in RFC3339 format. To be used with end_date.",
optional: true,
},
endDate: {
type: "string",
label: "End Date",
description: "Get entries with start time, until end_date YYYY-MM-DD or with time in RFC3339 format. To be used with start_date.",
optional: true,
},
since: {
type: "string",
label: "Since (UNIX timestamp)",
description: "Get entries modified since this date using UNIX timestamp, including deleted ones.",
optional: true,
},
before: {
type: "string",
label: "Before",
description: "Get entries with start time, before given date (YYYY-MM-DD) or with time in RFC3339 format.",
optional: true,
},
meta: {
type: "boolean",
label: "Meta",
description: "Should the response contain data for meta entities.",
optional: true,
},
includeSharing: {
type: "boolean",
label: "Include Sharing",
description: "Include sharing details in the response.",
optional: true,
},
},
async run({ $ }) {
const params = {};
if (this.startDate) params.start_date = this.startDate;
if (this.endDate) params.end_date = this.endDate;
if (this.since) params.since = this.since;
if (this.before) params.before = this.before;
if (typeof this.meta === "boolean") params.meta = this.meta;
if (typeof this.includeSharing === "boolean") params.include_sharing = this.includeSharing;
const response = await this.toggl.getTimeEntries({
params,
$,
});

Expand Down
Loading