//native
type Attio = {
token: string;
};
/**
* Identify
* Identify the current access token, the workspace it is linked to, and any permissions it has.
*/
export async function main(auth: Attio) {
const url = new URL(`https://api.attio.com/v2/self`);
const response = await fetch(url, {
method: "GET",
headers: {
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 51 days ago