What's Changed
* Working with labels
* Add method `is_draft` to message
working wtih labels
Now you can get labels by type id:
python
labels = proton.get_labels_by_type_id(label_id)
Possible types:
- 1 - User's custom labels.
- 2 - Actually, I have no idea what it is. If this returned a non-empty list for you, please let me know what it is.
- 3 - User's custom folders.
- 4 - ProtonMail's system labels/folders (inbox, drafts, sent, spam, etc.)
Or you can get labels in another way:
python
user_folders = proton.get_user_folders()
user_labels = proton.get_user_labels()
system_labels = proton.get_system_labels()
Or you can get all labels:
python
labels = proton.get_all_labels()
Convert label_ids to label_obj in message:
python
print(message.labels) ['1', '5', '8', '15']
message.convert_labels(labels)
print(message.labels) [Label(id='8', name='Drafts', ...), ...]
Set/Unset label for messages:
python
proton.set_label_for_messages(label_or_id=label, messages_or_ids=[message])
proton.unset_label_for_messages(label_or_id=label, messages_or_ids=[message])
Get messages by label:
python
messages = proton.get_messages(label_or_id='4') spam
Message is_draft method
python
message.is_draft()
by opulentfox-29 in https://github.com/opulentfox-29/protonmail-api-client/pull/25
**Full Changelog**: https://github.com/opulentfox-29/protonmail-api-client/compare/v1.6.1...v1.7.0