1 | |
2 | |
3 | * Add/Edit Timesheet Clock Entries |
4 | * Add or edit timesheet clock entries. |
5 | */ |
6 | export async function main(auth: RT.BambooHr, body?: Body) { |
7 | const url = new URL( |
8 | `https://${auth.companyDomain}.bamboohr.com/api/v1/time_tracking/clock_entries/store` |
9 | ) |
10 |
|
11 | const response = await fetch(url, { |
12 | method: 'POST', |
13 | headers: { |
14 | 'Content-Type': 'application/json', |
15 | Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`) |
16 | }, |
17 | body: JSON.stringify(body) |
18 | }) |
19 | if (!response.ok) { |
20 | const text = await response.text() |
21 | throw new Error(`${response.status} ${text}`) |
22 | } |
23 | return await response.json() |
24 | } |
25 |
|
26 | |
27 | |
28 | * This file was automatically generated by json-schema-to-typescript. |
29 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
30 | * and run json-schema-to-typescript to regenerate this file. |
31 | */ |
32 |
|
33 | |
34 | * Request body schema for operations involving multiple clock entries |
35 | */ |
36 | export interface Body { |
37 | |
38 | * Array of clock entries |
39 | * |
40 | * @minItems 1 |
41 | */ |
42 | entries: { |
43 | |
44 | * Unique identifier for the employee. |
45 | */ |
46 | employeeId: number |
47 | |
48 | * Date for the timesheet entry. Must be in YYYY-MM-DD format. |
49 | */ |
50 | date: string |
51 | |
52 | * Start time for the timesheet entry. Local time for the employee. Must be in hh:mm 24 hour format. |
53 | */ |
54 | start: string |
55 | |
56 | * End time for the timesheet entry. Local time for the employee. Must be in hh:mm 24 hour format. |
57 | */ |
58 | end: string |
59 | |
60 | * The ID of an existing timesheet entry. This can be specified to edit an existing entry. |
61 | */ |
62 | id?: number |
63 | |
64 | * The ID of the project to associate with the timesheet entry. |
65 | */ |
66 | projectId?: number |
67 | |
68 | * The ID of the task to associate with the timesheet entry. |
69 | */ |
70 | taskId?: number |
71 | |
72 | * Optional note to associate with the timesheet entry. |
73 | */ |
74 | note?: string |
75 | [k: string]: unknown |
76 | }[] |
77 | [k: string]: unknown |
78 | } |
79 |
|