This guide assumes you've already done the following:
Mailboxes are synonymous with:
A mailbox is a container for emails (sent, received, drafts) and each account can have many.
See mailbox model in the reference.
A call to list mailboxes will, by default, return all mailboxes for all connected email accounts.
WorkAPI does not attempt to merge mailboxes together, instead returning each as a separate entity. Requests to list emails can then be filtered by one or more mailbox IDs to allow the developer to fetch all mails in all inboxes.
token = "<user's token>"
client = LivilApi::Service.new(token)
mailboxes = client.list_mailboxes
mailboxes
# => [LivilApi::Mailbox(id: '...', name: 'INBOX', unread_count: 100, ...), LivilApi::Mailbox(id: '...', name: 'SENT', unread_count: 0, ...), ...]