Thread

This is the full description of the Thread class.


Thread class

class google_workspace.gmail.thread.Thread

A message thread. This includes all messages and allows for bulk operations.

Parameters
  • gmail_client (GmailClient) – The gmail_client.

  • thread_data (dict) – The raw thread data.

  • message_format (str, optional) – In which format to retrieve the messages. Can have one of the following values: "minimal", "full", "metadata". Defaults to: “full”.

add_labels(label_ids: Union[list, str]) dict

Add labels to this thread.

Parameters

label_ids (list | str) – The lables to add.

Returns

The API response.

Return type

dict

delete() dict

Delete this thread permanently.

Returns

The API response.

Return type

dict

mark_read() dict

Mark this thread and all of it’s messages read.

Returns

The API response.

Return type

dict

mark_unread() dict

Mark this thread and all of it’s messages unread.

Returns

The API response.

Return type

dict

property messages: Generator[Type[google_workspace.gmail.message.BaseMessage], None, None]

The messages.

Returns

A generator of the messages from this thread. Depending message_format it will return a different type of message.

Return type

Generator of Message | MessageMetadata | MessageMinimal

remove_labels(label_ids: Union[list, str]) dict

Remove labels from this thread.

Parameters

label_ids (list | str) – The lables to remove.

Returns

The API response.

Return type

dict

trash() dict

Move this thread to the trash.

Returns

The API response.

Return type

dict

untrash() dict

Untrash this thread.

Returns

The API response.

Return type

dict