Skip to content

Commit 45a291e

Browse files
♻️ Change Clockify to export class
1 parent f46910c commit 45a291e

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/api/clockify.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,23 @@ const getTimeData = async (date: Date) => {
6363
}
6464
};
6565

66-
export const daily = async () => {
67-
console.log("Clockify: Starting...");
68-
for await (const day of [0, 1, 2, 3, 4]) {
69-
await getTimeData(dayjs().subtract(day, "day").toDate());
70-
console.log("Clockify: Added data");
71-
}
72-
console.log("Clockify: Added daily summaries");
73-
};
74-
7566
export const getUserId = async () => {
7667
const { data } = await axios.get(`https://api.clockify.me/api/v1/user`, {
7768
headers: { "X-Api-Key": apiKey },
7869
});
7970
console.log("User ID", data.id);
8071
};
8172

82-
export const summary = async () => {};
73+
export class Clockify implements Integration {
74+
name = "clockify";
75+
async update() {
76+
console.log("Clockify: Starting...");
77+
for await (const day of [0, 1, 2, 3, 4]) {
78+
await getTimeData(dayjs().subtract(day, "day").toDate());
79+
console.log("Clockify: Added data");
80+
}
81+
console.log("Clockify: Added daily summaries");
82+
}
83+
async summary() {}
84+
async legacy() {}
85+
}

src/integration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ interface Integration {
33
name: string;
44
update: () => Promise<void>;
55
summary: () => Promise<void>;
6+
legacy: (date: string | Date) => Promise<void>;
67
}

0 commit comments

Comments
 (0)