for (const contact of await api.mail.contacts.list()) {
console.log(contact.address, contact.name, contact.image);
}for contact in api.mail.contacts.list():
print(contact["address"], contact.get("name"), contact.get("avatar"))addressstringThe correspondent's address — the key.
namestringWhat to show instead of the address.
imagestring|nullAn absolute address for the photo, or null.
They belong to the account
Not to a mailbox. A contact saved once applies to every mailbox of the account — which is what you want, since the same person writes to several addresses.
The photo address is stable and cacheable
Not a short-lived signed link
A signed link would die in a list left open, the way message attachments do. A new photo gets a new address instead, which expires browser caches by itself.
Building a picker
const byAddress = new Map((await api.mail.contacts.list()).map((c) => [c.address, c]));
const display = (address) => byAddress.get(address)?.name ?? address;by_address = {c["address"]: c for c in api.mail.contacts.list()}
def display(address): return (by_address.get(address) or {}).get("name") or address