//native
type Intercom = {
apiVersion: string
token: string
}
/**
* List all collections
* You can fetch a list of all collections by making a GET request to `https://api.intercom.io/help_center/collections`.
Collections will be returned in descending order on the `updated_at` attribute. This means if you need to iterate through results then we'll show the most recently updated collections first.
*/
export async function main(auth: Intercom) {
const url = new URL(`https://api.intercom.io/help_center/collections`)
const response = await fetch(url, {
method: 'GET',
headers: {
'Intercom-Version': auth.apiVersion,
Authorization: 'Bearer ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 536 days ago