1 | |
2 | |
3 | * Create raw shifts |
4 | * Create raw shifts |
5 | **Token scopes**: `time-tracking:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/time_tracking/shifts/raw`) |
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 | shifts: { |
35 | meta: { |
36 | end?: { |
37 | |
38 | * End date |
39 | */ |
40 | date?: string |
41 | |
42 | * End time |
43 | */ |
44 | time?: string |
45 | |
46 | * Is rest day |
47 | */ |
48 | is_rest_day?: boolean |
49 | |
50 | * Is public holiday |
51 | */ |
52 | is_public_holiday?: boolean |
53 | [k: string]: unknown |
54 | } |
55 | start?: { |
56 | |
57 | * Start date |
58 | */ |
59 | date?: string |
60 | |
61 | * Start time |
62 | */ |
63 | time?: string |
64 | |
65 | * Is rest day |
66 | */ |
67 | is_rest_day?: boolean |
68 | |
69 | * Is public holiday |
70 | */ |
71 | is_public_holiday?: boolean |
72 | [k: string]: unknown |
73 | } |
74 | breaks?: { |
75 | end?: { |
76 | |
77 | * Break end date |
78 | */ |
79 | date?: string |
80 | |
81 | * Break end time |
82 | */ |
83 | time?: string |
84 | [k: string]: unknown |
85 | } |
86 | start?: { |
87 | |
88 | * Break start date |
89 | */ |
90 | date?: string |
91 | |
92 | * Break start time |
93 | */ |
94 | time?: string |
95 | [k: string]: unknown |
96 | } |
97 | |
98 | * Is break paid |
99 | */ |
100 | is_paid?: boolean |
101 | [k: string]: unknown |
102 | }[] |
103 | |
104 | * Approval date |
105 | */ |
106 | approval_date?: string |
107 | [k: string]: unknown |
108 | } |
109 | |
110 | * Description of the shift. |
111 | */ |
112 | description?: string |
113 | |
114 | * Extrenal ID of the shift. |
115 | */ |
116 | external_id: string |
117 | |
118 | * Date of shift work |
119 | */ |
120 | date_of_work: string |
121 | [k: string]: unknown |
122 | }[] |
123 | |
124 | * Contract ID associated with the shifts. |
125 | */ |
126 | contract_id: string |
127 | [k: string]: unknown |
128 | } |
129 | [k: string]: unknown |
130 | } |
131 |
|