1 | |
2 | |
3 | * Update a shift rate |
4 | * Update specific fields of an existing shift rate. |
5 | **Token scopes**: `time-tracking:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, external_id: string, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/time_tracking/shift_rates/${external_id}`) |
9 |
|
10 | const response = await fetch(url, { |
11 | method: 'PATCH', |
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 | |
35 | * The updated name of the shift rate. |
36 | */ |
37 | name?: string |
38 | |
39 | * The updated type of shift rate. |
40 | */ |
41 | type?: 'MULTIPLIER_PERCENTAGE' | 'PER_HOUR_FLAT_RATE' | 'PER_UNIT_FLAT_RATE' |
42 | |
43 | * The updated value of the shift rate. |
44 | */ |
45 | value?: number |
46 | [k: string]: unknown |
47 | } |
48 | [k: string]: unknown |
49 | } |
50 |
|