1 | |
2 | |
3 | * Submit EOR Worker Resignation |
4 | * This endpoint allows workers to formally request the resignation of their EOR contract |
5 | **Token scopes**: `worker:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, contract_id: string, body: Body) { |
8 | const url = new URL( |
9 | `https://api.letsdeel.com/rest/v2/eor/workers/contracts/${contract_id}/offboarding` |
10 | ) |
11 |
|
12 | const formData = new FormData() |
13 | for (const [k, v] of Object.entries(body)) { |
14 | if (v !== undefined && v !== '') { |
15 | formData.append(k, String(v)) |
16 | } |
17 | } |
18 | const response = await fetch(url, { |
19 | method: 'POST', |
20 | headers: { |
21 | Authorization: 'Bearer ' + auth.apiKey |
22 | }, |
23 | body: formData |
24 | }) |
25 | if (!response.ok) { |
26 | const text = await response.text() |
27 | throw new Error(`${response.status} ${text}`) |
28 | } |
29 | return await response.json() |
30 | } |
31 |
|
32 | |
33 | |
34 | * This file was automatically generated by json-schema-to-typescript. |
35 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
36 | * and run json-schema-to-typescript to regenerate this file. |
37 | */ |
38 |
|
39 | export interface Body { |
40 | data: { |
41 | |
42 | * The reason for the employee's resignation |
43 | */ |
44 | reason: |
45 | | 'EMPLOYEE_IS_MOVING_TO_ANOTHER_COUNTRY' |
46 | | 'MOVING_EMPLOYEE_TO_INTERNAL_ENTITY' |
47 | | 'MOVING_EMPLOYEE_TO_DEEL_PEO' |
48 | | 'EMPLOYEE_FOUND_ANOTHER_JOB' |
49 | | 'EMPLOYEE_NOT_HAPPY_WITH_BENEFITS' |
50 | | 'EMPLOYEE_NOT_HAPPY_WITH_SALARY' |
51 | | 'EMPLOYEE_NOT_HAPPY_WITH_THE_ROLE' |
52 | | 'EMPLOYEE_NOT_HAPPY_WITH_COMPANY_CULTURE' |
53 | | 'EMPLOYEE_NOT_HAPPY_WITH_DEEL' |
54 | | 'EMPLOYEE_PROJECT_ENDED' |
55 | | 'EMPLOYEE_SWITCHING_TO_OTHER_EOR_PROVIDER' |
56 | | 'EMPLOYEE_LEFT_ROLE_FOR_PERSONAL_MATTERS' |
57 | | 'EMPLOYEE_MOVING_FROM_EOR_TO_CONTRACTOR_OR_FREELANCE' |
58 | | 'WORKER_TYPE_CHANGE' |
59 | | 'PREFERRED_NOT_TO_SAY' |
60 | |
61 | * Employee signature |
62 | */ |
63 | signature: string |
64 | |
65 | * Additional details explaining the resignation reason |
66 | */ |
67 | reason_detail?: string |
68 | |
69 | * The employee's desired last day of work in YYYY-MM-DD format |
70 | */ |
71 | desired_end_date: string |
72 | |
73 | * This field allows for uploading multiple files at once. Includes common image formats (JPG, JPEG, PNG, HEIC) and PDF documents. |
74 | */ |
75 | supporting_documents?: string |
76 | [k: string]: unknown |
77 | } |
78 | [k: string]: unknown |
79 | } |
80 |
|