//native
type Confluence = {
email: string
apiToken: string
domain: string
}
/**
* Get content state settings for space
* Get object describing whether content states are allowed at all, if custom content states or space content states
are restricted, and a list of space content states allowed for the space if they are not restricted.
**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
'Admin' permission for the space.
*/
export async function main(auth: Confluence, spaceKey: string) {
const url = new URL(`https://${auth.domain}/wiki/rest/api/space/${spaceKey}/state/settings`)
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago