//native
/**
* Delete a reference page
* Delete a page from the API Reference section of your ReadMe project.
>📘
> This route is only available to projects that are using [ReadMe Refactored](https://docs.readme.com/main/docs/welcome-to-readme-refactored).
*/
export async function main(
auth: RT.Readme,
branch: string,
slug: string,
cleanup_definition?: string | undefined
) {
const url = new URL(`https://api.readme.com/v2/branches/${branch}/reference/${slug}`)
for (const [k, v] of [['cleanup_definition', cleanup_definition]]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 235 days ago