//native
/**
* Review multiple tasks
* Review multiple tasks associated with a Deel contract to approve or decline the submitted work. The review includes a status (approved or declined) for each task and an optional reason for declined tasks.
**Token scopes**: `contracts:write`
*/
export async function main(auth: RT.Deel, contract_id: string, body: Body) {
const url = new URL(
`https://api.letsdeel.com/rest/v2/contracts/${contract_id}/tasks/many/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?: {
/**
* An array of task IDs to review. A maximum of 1000 task IDs is allowed per request.
*
* @minItems 1
* @maxItems 1000
*/
ids: string[]
/**
* Optional reason for declining the tasks.
*/
reason?: string
/**
* The review status of the tasks. Possible values are 'approved' or 'declined'.
*/
status: 'approved' | 'declined'
[k: string]: unknown
}
[k: string]: unknown
}
Submitted by hugo697 235 days ago