//native
type Phrase = {
token: string
baseUrl: string
}
/**
* Unlink a child key from a parent key
* Unlinks a single child key from a given parent key.
*/
export async function main(auth: Phrase, project_id: string, id: string, child_key_id: string) {
const url = new URL(`${auth.baseUrl}/projects/${project_id}/keys/${id}/key_links/${child_key_id}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'ApiToken ' + 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 235 days ago