//native
/**
* Review a single task
* Review a specific task associated with a Deel contract to approve or decline the submitted work. The review includes the status (approved or declined) and an optional reason if declined.
**Token scopes**: `contracts:write`
*/
export async function main(auth: RT.Deel, contract_id: string, task_id: string, body: Body) {
const url = new URL(
`https://api.letsdeel.com/rest/v2/contracts/${contract_id}/tasks/${task_id}/reviews`
)
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?: {
/**
* Optional reason for declining the task.
*/
reason?: string
/**
* The review status of the task. Possible values are 'approved' or 'declined'.
*/
status: 'approved' | 'declined'
[k: string]: unknown
}
[k: string]: unknown
}
Submitted by hugo697 235 days ago