1 | |
2 | |
3 | * Create a person without a contract |
4 | * Create a person without a contract hired under your own entity to Deel's HRIS. |
5 | **Token scopes**: `people:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/pwac`) |
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 | data: { |
34 | client: { |
35 | team: { |
36 | |
37 | * The team that the person is part of |
38 | */ |
39 | id: string |
40 | |
41 | * The direct manager of the person |
42 | */ |
43 | direct_manager_id?: string |
44 | |
45 | * The direct reports of the person |
46 | */ |
47 | direct_reports_ids?: string[] |
48 | [k: string]: unknown |
49 | } |
50 | department?: { |
51 | |
52 | * The department that the person is part of |
53 | */ |
54 | id: string |
55 | [k: string]: unknown |
56 | } |
57 | legal_entity: { |
58 | |
59 | * The legal entity that the person is part of |
60 | */ |
61 | id: string |
62 | [k: string]: unknown |
63 | } |
64 | [k: string]: unknown |
65 | } |
66 | |
67 | * The person that is being hired |
68 | */ |
69 | person: { |
70 | |
71 | * The personal email of the person being hired |
72 | */ |
73 | email: string |
74 | |
75 | * The state of the person being hired |
76 | */ |
77 | state?: string |
78 | |
79 | * The country of the person being hired |
80 | */ |
81 | country?: string |
82 | |
83 | * The end date of the person being hired |
84 | */ |
85 | end_date?: string |
86 | |
87 | * The job title of the person being hired |
88 | */ |
89 | job_title?: string |
90 | |
91 | * The last name of the person being hired |
92 | */ |
93 | last_name: string |
94 | |
95 | * The seniority of the person being hired |
96 | */ |
97 | seniority?: string |
98 | |
99 | * The first name of the person being hired |
100 | */ |
101 | first_name: string |
102 | |
103 | * The start date of the person being hired |
104 | */ |
105 | start_date: string |
106 | |
107 | * The work email of the person being hired |
108 | */ |
109 | work_email?: string |
110 | |
111 | * An external identifier for the person being hired |
112 | */ |
113 | external_id?: string |
114 | |
115 | * The nationality of the person being hired |
116 | */ |
117 | nationality?: string |
118 | |
119 | * The preferred last name of the person being hired |
120 | */ |
121 | preferred_last_name?: string |
122 | |
123 | * The preferred first name of the person being hired |
124 | */ |
125 | preferred_first_name?: string |
126 | [k: string]: unknown |
127 | } |
128 | [k: string]: unknown |
129 | } |
130 | [k: string]: unknown |
131 | } |
132 |
|