1 | |
2 | |
3 | * Apply changes to positions. |
4 | * Apply add, edit, and delete operations to profiles. |
5 | **Token scopes**: `profile:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/hris/positions/apply_changes`) |
9 |
|
10 | const response = await fetch(url, { |
11 | method: 'POST', |
12 | headers: { |
13 | 'Content-Type': 'application/json', |
14 | Authorization: 'Bearer ' + auth.apiKey |
15 | }, |
16 | body: JSON.stringify(body) |
17 | }) |
18 | if (!response.ok) { |
19 | const text = await response.text() |
20 | throw new Error(`${response.status} ${text}`) |
21 | } |
22 | return await response.text() |
23 | } |
24 |
|
25 | |
26 | |
27 | * This file was automatically generated by json-schema-to-typescript. |
28 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
29 | * and run json-schema-to-typescript to regenerate this file. |
30 | */ |
31 |
|
32 | export interface Body { |
33 | data?: { |
34 | add?: { |
35 | |
36 | * Id of the role to be assigned to the position. |
37 | */ |
38 | role_id?: string |
39 | |
40 | * Id of the team to be assigned to the position. |
41 | */ |
42 | team_id: string |
43 | |
44 | * Flag to indicate if the position is supportive. |
45 | */ |
46 | is_supportive?: boolean |
47 | [k: string]: unknown |
48 | }[] |
49 | edit?: { |
50 | |
51 | * Id of the position to be edited. |
52 | */ |
53 | id: string |
54 | |
55 | * Id of the role to be assigned to the position. |
56 | */ |
57 | role_id?: string |
58 | |
59 | * Flag to indicate if the position is supportive. |
60 | */ |
61 | is_supportive?: boolean |
62 | [k: string]: unknown |
63 | }[] |
64 | delete?: { |
65 | |
66 | * Id of the position to be deleted. |
67 | */ |
68 | id: string |
69 | [k: string]: unknown |
70 | }[] |
71 | |
72 | * Id of the profile to which the positions belong. |
73 | */ |
74 | profile_id: string |
75 | [k: string]: unknown |
76 | } |
77 | [k: string]: unknown |
78 | } |
79 |
|