@pipedream/trackingtime 0.0.1 → 0.2.0

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/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # Overview
2
+
3
+ The TrackingTime API enables the automation of time tracking, task management, and reporting processes. In Pipedream, you can use this API to create powerful workflows that connect TrackingTime with other apps to streamline productivity, enhance project management, and generate insights on time allocation. Automate tasks based on project activities, sync time entries with calendars, or trigger notifications based on tracked time data.
4
+
5
+ # Example Use Cases
6
+
7
+ - **Automatically Log Time for Scheduled Meetings**: Sync your TrackingTime projects with Google Calendar events. Whenever a new event starts, trigger a workflow that logs time in TrackingTime for the duration of the event, ensuring accurate time tracking for meetings.
8
+
9
+ - **Generate Weekly Time Reports**: Set up a weekly scheduled workflow that retrieves time tracking data from TrackingTime and compiles it into a report. This report can then be sent via email using a service like SendGrid, keeping stakeholders updated on time investment and project progress.
10
+
11
+ - **Project Management Integration**: When a task is marked as completed in a project management tool like Trello, trigger a workflow that automatically stops the corresponding time entry in TrackingTime. This keeps your time records in sync with project milestones and deliverables.
@@ -0,0 +1,24 @@
1
+ import trackingtime from "../../trackingtime.app.mjs";
2
+
3
+ export default {
4
+ key: "trackingtime-list-project-id-options",
5
+ name: "List Project ID Options",
6
+ description: "Retrieves available options for the Project ID field.",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ trackingtime,
16
+ },
17
+ async run({ $ }) {
18
+ const options = await trackingtime.propDefinitions.projectId.options.call(this.trackingtime);
19
+ $.export("$summary", `Successfully retrieved ${options.length} option${options.length === 1
20
+ ? ""
21
+ : "s"}`);
22
+ return options;
23
+ },
24
+ };
@@ -0,0 +1,24 @@
1
+ import trackingtime from "../../trackingtime.app.mjs";
2
+
3
+ export default {
4
+ key: "trackingtime-list-task-id-options",
5
+ name: "List Task ID Options",
6
+ description: "Retrieves available options for the Task ID field.",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ trackingtime,
16
+ },
17
+ async run({ $ }) {
18
+ const options = await trackingtime.propDefinitions.taskId.options.call(this.trackingtime);
19
+ $.export("$summary", `Successfully retrieved ${options.length} option${options.length === 1
20
+ ? ""
21
+ : "s"}`);
22
+ return options;
23
+ },
24
+ };
@@ -0,0 +1,91 @@
1
+ import app from "../../trackingtime.app.mjs";
2
+
3
+ export default {
4
+ name: "Start Tracking Time",
5
+ version: "0.0.2",
6
+ annotations: {
7
+ destructiveHint: true,
8
+ openWorldHint: true,
9
+ readOnlyHint: false,
10
+ },
11
+ key: "trackingtime-start-tracking-time",
12
+ description: "Start tracking time of a task. [See the documentation](https://api.trackingtime.co/doc/time_tracking.html#sync:~:text=Sync%20tracking%20event-,Start%20Tracking%20Time,-Starts%20a%20timer)",
13
+ type: "action",
14
+ props: {
15
+ app,
16
+ taskId: {
17
+ propDefinition: [
18
+ app,
19
+ "taskId",
20
+ ],
21
+ },
22
+ projectId: {
23
+ propDefinition: [
24
+ app,
25
+ "projectId",
26
+ ],
27
+ optional: true,
28
+ },
29
+ date: {
30
+ label: "Date",
31
+ description: "The event's start date. Format ISO 8601: `yyyy-MM-dd HH:mm:ss` like `2014-01-31 17:30:59`",
32
+ type: "string",
33
+ optional: true,
34
+ },
35
+ estimatedTime: {
36
+ label: "Estimated Time",
37
+ description: "Set a new estimated time for this task",
38
+ type: "string",
39
+ optional: true,
40
+ },
41
+ stopRunningTask: {
42
+ label: "Stop Running Task",
43
+ description: "If set to true, any currently running task will be stopped before the new one is started.",
44
+ type: "boolean",
45
+ optional: true,
46
+ },
47
+ returnTask: {
48
+ label: "Return Task",
49
+ description: "If set to true, a task object is returned",
50
+ type: "boolean",
51
+ optional: true,
52
+ },
53
+ tags: {
54
+ label: "Tags",
55
+ description: "An array of tags to be added to the newly created time entry. E.g. `[{\"n\":\"name\",\"c\":\"color\",\"v\":\"value\",\"t\":\"type\"}]`",
56
+ type: "boolean",
57
+ optional: true,
58
+ },
59
+ timezone: {
60
+ label: "Timezone",
61
+ description: "The user's timezone as `GMT+3` or `GMT+03:00`",
62
+ type: "string",
63
+ optional: true,
64
+ },
65
+ },
66
+ async run({ $ }) {
67
+ const tags = typeof this.tags === "string"
68
+ ? JSON.parse(this.tags)
69
+ : this.tags;
70
+
71
+ const response = await this.app.startTrackingTime({
72
+ $,
73
+ taskId: this.taskId,
74
+ params: {
75
+ date: this.date,
76
+ projectId: this.projectId,
77
+ return_task: this.returnTask,
78
+ stop_running_task: this.stopRunningTask,
79
+ estimated_time: this.estimatedTime,
80
+ timezone: this.timezone,
81
+ tags,
82
+ },
83
+ });
84
+
85
+ if (response) {
86
+ $.export("$summary", `Successfully started tracking time of the task ID ${this.taskId}`);
87
+ }
88
+
89
+ return response;
90
+ },
91
+ };
@@ -0,0 +1,35 @@
1
+ import app from "../../trackingtime.app.mjs";
2
+
3
+ export default {
4
+ name: "Stop Tracking Time",
5
+ version: "0.0.2",
6
+ annotations: {
7
+ destructiveHint: true,
8
+ openWorldHint: true,
9
+ readOnlyHint: false,
10
+ },
11
+ key: "trackingtime-stop-tracking-time",
12
+ description: "Stop tracking time of a task. [See the documentation](https://api.trackingtime.co/doc/time_tracking.html#sync:~:text=Sync%20tracking%20event-,Start%20Tracking%20Time,-Starts%20a%20timer)",
13
+ type: "action",
14
+ props: {
15
+ app,
16
+ taskId: {
17
+ propDefinition: [
18
+ app,
19
+ "taskId",
20
+ ],
21
+ },
22
+ },
23
+ async run({ $ }) {
24
+ const response = await this.app.stopTrackingTime({
25
+ $,
26
+ taskId: this.taskId,
27
+ });
28
+
29
+ if (response) {
30
+ $.export("$summary", `Successfully stopped tracking time of the task ID ${this.taskId}`);
31
+ }
32
+
33
+ return response;
34
+ },
35
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/trackingtime",
3
- "version": "0.0.1",
3
+ "version": "0.2.0",
4
4
  "description": "Pipedream TrackingTime Components",
5
5
  "main": "trackingtime.app.mjs",
6
6
  "keywords": [
@@ -11,5 +11,8 @@
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
12
  "publishConfig": {
13
13
  "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "@pipedream/platform": "^1.6.8"
14
17
  }
15
18
  }
@@ -1,11 +1,83 @@
1
+ import { axios } from "@pipedream/platform";
2
+
1
3
  export default {
2
4
  type: "app",
3
5
  app: "trackingtime",
4
- propDefinitions: {},
6
+ propDefinitions: {
7
+ taskId: {
8
+ label: "Task ID",
9
+ description: "The task ID",
10
+ type: "string",
11
+ async options() {
12
+ const { data: tasks } = await this.getTasks();
13
+
14
+ return tasks.map((task) => ({
15
+ label: task.name,
16
+ value: task.id,
17
+ }));
18
+ },
19
+ },
20
+ projectId: {
21
+ label: "Project ID",
22
+ description: "The project ID",
23
+ type: "string",
24
+ async options() {
25
+ const { data: projects } = await this.getProjects();
26
+
27
+ return projects.map((task) => ({
28
+ label: task.name,
29
+ value: task.id,
30
+ }));
31
+ },
32
+ },
33
+ },
5
34
  methods: {
6
- // this.$auth contains connected account data
7
- authKeys() {
8
- console.log(Object.keys(this.$auth));
35
+ _appPassword() {
36
+ return this.$auth.app_password;
37
+ },
38
+ _apiUrl() {
39
+ return "https://app.trackingtime.co/api/v4";
40
+ },
41
+ _makeRequest({
42
+ $ = this, path, ...args
43
+ }) {
44
+ return axios($, {
45
+ url: `${this._apiUrl()}${path}`,
46
+ ...args,
47
+ auth: {
48
+ username: "API_TOKEN",
49
+ password: this._appPassword(),
50
+ },
51
+ });
52
+ },
53
+ startTrackingTime({
54
+ taskId, args,
55
+ }) {
56
+ return this._makeRequest({
57
+ path: `/tasks/track/${taskId}`,
58
+ ...args,
59
+ });
60
+ },
61
+ stopTrackingTime({
62
+ taskId, args,
63
+ }) {
64
+ return this._makeRequest({
65
+ path: `/tasks/stop/${taskId}`,
66
+ method: "post",
67
+ ...args,
68
+ });
69
+ },
70
+ getTasks(args = {}) {
71
+ return this._makeRequest({
72
+ path: "/tasks",
73
+ ...args,
74
+ });
75
+ },
76
+ getProjects(args = {}) {
77
+ return this._makeRequest({
78
+ path: "/projects",
79
+ ...args,
80
+ });
9
81
  },
10
82
  },
11
- };
83
+ };