//native
// Ctrl+. to cache dependencies on imports hover, Ctrl+S to format.
type Hubspot = {
token: string;
};
export async function main(
auth: Hubspot,
objectType: string,
propertyName: string,
) {
const res = await fetch(
`https://api.hubapi.com/crm/v3/properties/${objectType}/${propertyName}?archived=false`,
{
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
method: "GET",
},
);
const jsonRes = await res.json();
if (jsonRes.status == "error") {
console.error(jsonRes);
throw new Error(jsonRes.message);
}
return jsonRes;
}
Submitted by hugo989 6 days ago