1 | |
2 | |
3 | * Create background check |
4 | * Create background check. |
5 | **Token scopes**: `contracts:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/background-checks/regular`) |
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 | |
34 | * The background check information for a contract. Either `individual_check_ids` or `package_id` must be provided, but not both. |
35 | */ |
36 | data: { |
37 | |
38 | * Unique identifier of this resource. |
39 | */ |
40 | package_id?: string |
41 | |
42 | * List of contract ids. |
43 | */ |
44 | contract_ids: string[] |
45 | |
46 | * A list of individual check IDs. |
47 | */ |
48 | individual_check_ids?: string[] |
49 | [k: string]: unknown |
50 | } |
51 | [k: string]: unknown |
52 | } |
53 |
|