//native
/**
* Get Profile
* Get the connected account's email address, total message and thread counts, and current `historyId`. Requires gmail.readonly, gmail.compose or gmail.modify on the connection (gmail.send alone is not enough).
*/
export async function main(auth: RT.Gmail) {
const response = await fetch(
"https://gmail.googleapis.com/gmail/v1/users/me/profile",
{
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 6 hours ago