1 | |
2 | |
3 | * Create a new HRIS Organization Structure. |
4 | * Create a new HRIS Organization Structure. |
5 | **Token scopes**: `organizations:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/hris/organization_structures`) |
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 | * The name of the organization structure. |
36 | */ |
37 | name?: string |
38 | teams?: { |
39 | |
40 | * The name of the team. |
41 | */ |
42 | name?: string |
43 | |
44 | * The external identifier of the team. |
45 | */ |
46 | external_id?: string |
47 | [k: string]: unknown |
48 | }[] |
49 | |
50 | * The external identifier of the organization structure. |
51 | */ |
52 | external_id?: string |
53 | |
54 | * Whether roles are enabled for the organization structure. |
55 | */ |
56 | enable_roles?: boolean |
57 | |
58 | * Whether multiple selection is enabled for the organization structure. |
59 | */ |
60 | is_multiple_select?: boolean |
61 | [k: string]: unknown |
62 | } |
63 | [k: string]: unknown |
64 | } |
65 |
|