//native
type Webflow = {
token: string
}
export async function main(
auth: Webflow,
collection_id: string,
item_id: string,
cmsLocaleId: string | undefined
) {
const url = new URL(
`https://api.webflow.com/v2/collections/${collection_id}/items/${item_id}/live`
)
for (const [k, v] of [['cmsLocaleId', cmsLocaleId]]) {
if (v !== undefined && v !== '' && k !== undefined) {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'Bearer ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 514 days ago