1 | |
2 | |
3 | * Update Goal |
4 | * Update a goal. This version will not update a goal to contain milestones, that functionality is added in version 1.1 |
5 | */ |
6 | export async function main( |
7 | auth: RT.BambooHr, |
8 | employeeId: string, |
9 | goalId: string, |
10 | body: EmployeeGoal |
11 | ) { |
12 | const url = new URL( |
13 | `https://${auth.companyDomain}.bamboohr.com/api/v1/performance/employees/${employeeId}/goals/${goalId}` |
14 | ) |
15 |
|
16 | const response = await fetch(url, { |
17 | method: 'PUT', |
18 | headers: { |
19 | 'Content-Type': 'application/json', |
20 | Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`) |
21 | }, |
22 | body: JSON.stringify(body) |
23 | }) |
24 | if (!response.ok) { |
25 | const text = await response.text() |
26 | throw new Error(`${response.status} ${text}`) |
27 | } |
28 | return await response.json() |
29 | } |
30 |
|
31 | |
32 | |
33 | * This file was automatically generated by json-schema-to-typescript. |
34 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
35 | * and run json-schema-to-typescript to regenerate this file. |
36 | */ |
37 |
|
38 | export interface EmployeeGoal { |
39 | |
40 | * A unique identifier for the record. Use this ID to reference this goal. |
41 | */ |
42 | id: number |
43 | |
44 | * The goal title. |
45 | */ |
46 | title: string |
47 | |
48 | * The goal description. |
49 | */ |
50 | description?: string |
51 | |
52 | * The goal completion percentage (0 - 100). |
53 | */ |
54 | percentComplete?: number |
55 | |
56 | * The option ID that aligns with this goal. |
57 | */ |
58 | alignsWithOptionId?: string |
59 | |
60 | * Employee IDs of employees with whom the goal is shared. All goal owners are considered "shared with". |
61 | */ |
62 | sharedWithEmployeeIds?: number[] |
63 | |
64 | * The goal due date in YYYY-mm-dd format. |
65 | */ |
66 | dueDate?: string |
67 | |
68 | * The date the goal was completed. |
69 | */ |
70 | completionDate?: number |
71 | [k: string]: unknown |
72 | } |
73 |
|