Handlers
This is the full description of the Handler classes
BaseHandler class
- class google_workspace.gmail.handlers.BaseHandler
A handler class with no history type filter.
- Parameters
callback (
callable
) – A callback function to execute when there’s a new update. The function should take one agrument which will be theHistory
.labels (
list
|str
, optional) – Handle only updates to messages that have all of these labels. Defaults to None.filters (
list
, optional) – A list of functions. The functions should take one agrument which will be theHistory
and should return a bool if the message should be handled or not. Defaults to None.history_types (
str
, optional) – Which history types to handle. Can have one of the following values:"messageAdded"
,"messageDeleted"
,"labelAdded"
,"labelRemoved"
. Defaults to None.modified_labels (
list
|str
, optional) – For labelAdded and labelRemoved history types, only handle message that have all of these labels modified.
MessageAddedHandler class
- class google_workspace.gmail.handlers.MessageAddedHandler
A handler class with the messageAdded history type filter.
- Parameters
callback (
callable
) – A callback function to execute when there’s a new update. The function should take one agrument which will be theHistory
.labels (
list
|str
, optional) – Handle only updates to messages that have all of these labels. Defaults to None.filters (
list
, optional) – A list of functions. The functions should take one agrument which will be theHistory
and should return a bool if the message should be handled or not. Defaults to None.
MessageDeletedHandler class
- class google_workspace.gmail.handlers.MessageDeletedHandler
A handler class with the messageDeleted history type filter.
- Parameters
callback (
callable
) – A callback function to execute when there’s a new update. The function should take one agrument which will be theHistory
.labels (
list
|str
, optional) – Handle only updates to messages that have all of these labels. Defaults to None.filters (
list
, optional) – A list of functions. The functions should take one agrument which will be theHistory
and should return a bool if the message should be handled or not. Defaults to None.
LabelAddedHandler class
- class google_workspace.gmail.handlers.LabelAddedHandler
A handler class with the labelAdded history type filter.
- Parameters
callback (
callable
) – A callback function to execute when there’s a new update. The function should take one agrument which will be theHistory
.labels (
list
|str
, optional) – Handle only updates to messages that have all of these labels. Defaults to None.filters (
list
, optional) – A list of functions. The functions should take one agrument which will be theHistory
and should return a bool if the message should be handled or not. Defaults to None.modified_labels (
list
|str
, optional) – Only handle message that have all of these labels modified.
LabelRemovedHandler class
- class google_workspace.gmail.handlers.LabelRemovedHandler
A handler class with the labelRemoved history type filter.
- Parameters
callback (
callable
) – A callback function to execute when there’s a new update. The function should take one agrument which will be theHistory
.labels (
list
|str
, optional) – Handle only updates to messages that have all of these labels. Defaults to None.filters (
list
, optional) – A list of functions. The functions should take one agrument which will be theHistory
and should return a bool if the message should be handled or not. Defaults to None.modified_labels (
list
|str
, optional) – Only handle message that have all of these labels modified.