//native
type Confluence = {
email: string
apiToken: string
domain: string
}
/**
* Get look and feel settings
* Returns the look and feel settings for the site or a single space. This
includes attributes such as the color scheme, padding, and border radius.
The look and feel settings for a space can be inherited from the global
look and feel settings or provided by a theme.
**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
None
*/
export async function main(auth: Confluence, spaceKey: string | undefined) {
const url = new URL(`https://${auth.domain}/wiki/rest/api/settings/lookandfeel`)
for (const [k, v] of [['spaceKey', spaceKey]]) {
if (v !== undefined && v !== '' && k !== undefined) {
url.searchParams.append(k, v)
}
}
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