//native
/**
* List Locales
* List the locales enabled on the account (e.g. `en-us`, `fr`), for the Help Center and dynamic content `locale` parameters.
*/
export async function main(auth: RT.Zendesk) {
const response = await fetch(
`https://${auth.subdomain}.zendesk.com/api/v2/locales`,
{
headers: {
Authorization: auth.token
? `Bearer ${auth.token}`
: `Basic ${btoa(`${auth.username}:${auth.password}`)}`,
Accept: "application/json",
},
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 days ago