//native
/**
* Submit EOR Worker Resignation
* This endpoint allows workers to formally request the resignation of their EOR contract
**Token scopes**: `worker:write`
*/
export async function main(auth: RT.Deel, contract_id: string, body: Body) {
const url = new URL(
`https://api.letsdeel.com/rest/v2/eor/workers/contracts/${contract_id}/offboarding`
)
const formData = new FormData()
for (const [k, v] of Object.entries(body)) {
if (v !== undefined && v !== '') {
formData.append(k, String(v))
}
}
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: formData
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
export interface Body {
data: {
/**
* The reason for the employee's resignation
*/
reason:
| 'EMPLOYEE_IS_MOVING_TO_ANOTHER_COUNTRY'
| 'MOVING_EMPLOYEE_TO_INTERNAL_ENTITY'
| 'MOVING_EMPLOYEE_TO_DEEL_PEO'
| 'EMPLOYEE_FOUND_ANOTHER_JOB'
| 'EMPLOYEE_NOT_HAPPY_WITH_BENEFITS'
| 'EMPLOYEE_NOT_HAPPY_WITH_SALARY'
| 'EMPLOYEE_NOT_HAPPY_WITH_THE_ROLE'
| 'EMPLOYEE_NOT_HAPPY_WITH_COMPANY_CULTURE'
| 'EMPLOYEE_NOT_HAPPY_WITH_DEEL'
| 'EMPLOYEE_PROJECT_ENDED'
| 'EMPLOYEE_SWITCHING_TO_OTHER_EOR_PROVIDER'
| 'EMPLOYEE_LEFT_ROLE_FOR_PERSONAL_MATTERS'
| 'EMPLOYEE_MOVING_FROM_EOR_TO_CONTRACTOR_OR_FREELANCE'
| 'WORKER_TYPE_CHANGE'
| 'PREFERRED_NOT_TO_SAY'
/**
* Employee signature
*/
signature: string
/**
* Additional details explaining the resignation reason
*/
reason_detail?: string
/**
* The employee's desired last day of work in YYYY-MM-DD format
*/
desired_end_date: string
/**
* This field allows for uploading multiple files at once. Includes common image formats (JPG, JPEG, PNG, HEIC) and PDF documents.
*/
supporting_documents?: string
[k: string]: unknown
}
[k: string]: unknown
}
Submitted by hugo697 235 days ago