//native
/**
* List Labels
* List the mailbox's system labels (INBOX, UNREAD, ...) and user labels with their ids. Requires gmail.labels, gmail.readonly or gmail.modify on the connection.
*/
export async function main(auth: RT.Gmail) {
const response = await fetch(
"https://gmail.googleapis.com/gmail/v1/users/me/labels",
{
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