1 | |
2 | |
3 | * Update personal information by external id |
4 | * Update worker's personal information by using an external identifier. |
5 | **Token scopes**: `people:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, worker_id: string, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/people/external/${worker_id}/personal`) |
9 |
|
10 | const response = await fetch(url, { |
11 | method: 'PATCH', |
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 | |
35 | * The date of birth of the worker. Format: YYYY-MM-DD. |
36 | */ |
37 | date_of_birth?: string |
38 | |
39 | * The personal email of the worker. |
40 | */ |
41 | personal_email?: string |
42 | |
43 | * The preferred name of the worker. |
44 | */ |
45 | preferred_name?: string |
46 | |
47 | * The legal last name of the worker. |
48 | */ |
49 | legal_last_name?: string |
50 | |
51 | * The legal first name of the worker. |
52 | */ |
53 | legal_first_name?: string |
54 | [k: string]: unknown |
55 | } |
56 | [k: string]: unknown |
57 | } |
58 |
|