//native
/**
* List Templates
* List the design manager templates (pages, emails, blogs). Their `path` is what `templatePath` expects when creating pages and emails. Requires the content scope.
*/
export async function main(
auth: RT.Hubspot,
limit: number | undefined,
offset: number | undefined
) {
const url = new URL(`https://api.hubapi.com/content/api/v2/templates`)
if (limit != null) url.searchParams.append("limit", String(limit))
if (offset != null) url.searchParams.append("offset", String(offset))
const response = await fetch(url, {
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 hours ago