//native
/**
* Create raw shifts
* Create raw shifts
**Token scopes**: `time-tracking:write`
*/
export async function main(auth: RT.Deel, body: Body) {
const url = new URL(`https://api.letsdeel.com/rest/v2/time_tracking/shifts/raw`)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
export interface Body {
data: {
shifts: {
meta: {
end?: {
/**
* End date
*/
date?: string
/**
* End time
*/
time?: string
/**
* Is rest day
*/
is_rest_day?: boolean
/**
* Is public holiday
*/
is_public_holiday?: boolean
[k: string]: unknown
}
start?: {
/**
* Start date
*/
date?: string
/**
* Start time
*/
time?: string
/**
* Is rest day
*/
is_rest_day?: boolean
/**
* Is public holiday
*/
is_public_holiday?: boolean
[k: string]: unknown
}
breaks?: {
end?: {
/**
* Break end date
*/
date?: string
/**
* Break end time
*/
time?: string
[k: string]: unknown
}
start?: {
/**
* Break start date
*/
date?: string
/**
* Break start time
*/
time?: string
[k: string]: unknown
}
/**
* Is break paid
*/
is_paid?: boolean
[k: string]: unknown
}[]
/**
* Approval date
*/
approval_date?: string
[k: string]: unknown
}
/**
* Description of the shift.
*/
description?: string
/**
* Extrenal ID of the shift.
*/
external_id: string
/**
* Date of shift work
*/
date_of_work: string
[k: string]: unknown
}[]
/**
* Contract ID associated with the shifts.
*/
contract_id: string
[k: string]: unknown
}
[k: string]: unknown
}
Submitted by hugo697 235 days ago