1 | |
2 | |
3 | * Create a worker relation |
4 | * Create a hierarchical relation between a worker and its subordinates. |
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/worker_relations/profile`) |
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.json() |
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 | |
35 | * An array containing the secondary HrisProfiles IDs. |
36 | * |
37 | * @minItems 1 |
38 | */ |
39 | child_hris_profile_ids: string[] |
40 | |
41 | * Primary HrisProfile ID |
42 | */ |
43 | parent_hris_profile_id: string |
44 | |
45 | * The ID of the Worker Relation Type. |
46 | */ |
47 | hris_relationship_type_id: string |
48 | [k: string]: unknown |
49 | } |
50 | [k: string]: unknown |
51 | } |
52 |
|