//native
type Adhook = {
token: string
}
export async function main(
auth: Adhook,
id: string,
body: {
id?: string
tenantId?: string
subtenantId?: string
name?: string
description?: string
start?: string
end?: string
color?: string
parentAnnualPlanTopicId?: string
createdAt?: string
createdByUserId?: string
createdByUserEmail?: string
attachments?: { name?: string; url?: string; fileExtension?: string }[]
}
) {
const url = new URL(`https://app.adhook.io/v1/topics/${id}`)
const response = await fetch(url, {
method: 'PUT',
headers: {
Authorization: `Bearer ${auth.token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 519 days ago