//native
type Confluence = {
email: string
apiToken: string
domain: string
}
/**
* Select look and feel settings
* Sets the look and feel settings to the default (global) settings, the
custom settings, or the current theme's settings for a space.
The custom and theme settings can only be selected if there is already
a theme set for a space. Note, the default space settings are inherited
from the current global settings.
**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
'Admin' permission for the space.
*/
export async function main(
auth: Confluence,
body: { spaceKey: string; lookAndFeelType: 'global' | 'custom' | 'theme' }
) {
const url = new URL(`https://${auth.domain}/wiki/rest/api/settings/lookandfeel`)
const response = await fetch(url, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
},
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 235 days ago