//native
/**
* Fetch multiple EOR Contract forms
* Retrieve paginated, versioned form definitions for creating EOR contracts for the specified countries. Use this endpoint when initializing or resuming a contract-creation flow to determine the required sections, fields, validation rules, and conditional logic per country (and optional contract type/locale). Always consume the latest effective version from the response and handle pagination. Not intended for reading or updating existing contracts.
**Token scopes**: `forms:read`
*/
export async function main(
auth: RT.Deel,
body: Body,
limit?: string | undefined,
cursor?: string | undefined
) {
const url = new URL(`https://api.letsdeel.com/rest/v2/forms/eor/create-contract/definitions`)
for (const [k, v] of [
['limit', limit],
['cursor', cursor]
]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
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: {
/**
* Array of countries for which to fetch quote forms. Maximum 10 countries per request.
*
* @minItems 1
*/
countries: {
/**
* The selected state code of the contract. This is only required for countries that specify it.
*/
state?: string
/**
* Two-letter country code in ISO 3166-1 alpha-2 format
*/
country_code: string
[k: string]: unknown
}[]
/**
* The selected start date of the contract in ISO 8601 formatted date string.
*/
start_date?: string
/**
* The selected number of work hours per week.
*/
work_hours_per_week?: number
/**
* The contract duration in days for definite contracts.
*/
contract_duration_in_days?: number
[k: string]: unknown
}
[k: string]: unknown
}
Submitted by hugo697 235 days ago