1 | |
2 | |
3 | * Add Candidate |
4 | * Add a candidate to Deel. |
5 | **Token scopes**: `candidates:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/candidates`) |
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 | * Details of candidate to create |
35 | */ |
36 | data: { |
37 | |
38 | * Unique identifier of candidate in your ATS. |
39 | */ |
40 | id: string |
41 | |
42 | * Link to candidate's profile in ATS. |
43 | */ |
44 | link: string |
45 | |
46 | * Worker's work email address. |
47 | */ |
48 | email?: string |
49 | |
50 | * Job location state. |
51 | */ |
52 | state?: string |
53 | |
54 | * Offer status |
55 | */ |
56 | status: 'offer-accepted' | 'offer-sent' | 'offer-declined' | 'offer-deleted' |
57 | |
58 | * Country code. |
59 | */ |
60 | country?: string |
61 | |
62 | * Job Title. |
63 | */ |
64 | job_title?: string |
65 | |
66 | * Candidate's last name. |
67 | */ |
68 | last_name: string |
69 | |
70 | * Candidate's first name. |
71 | */ |
72 | first_name: string |
73 | |
74 | * Short date in format ISO-8601 (YYYY-MM-DD). |
75 | */ |
76 | start_date: string |
77 | |
78 | * Nationality of the worker. |
79 | */ |
80 | nationality?: string |
81 | |
82 | * Worker's personal email address. |
83 | */ |
84 | personal_email?: string |
85 | [k: string]: unknown |
86 | } |
87 | [k: string]: unknown |
88 | } |
89 |
|