SyncEventFilter#
- class teamworksams.export_filter.SyncEventFilter(user_key: str | None = None, user_value: str | List[str] | None = None)[source]#
Bases:
object
Filter for selecting users in sync event data export.
Defines criteria for filtering events retrieved by
sync_event_data()
, allowing selection based on user attributes (e.g., username, group). Validates filter parameters for compatibility with the AMS ‘synchronise’ endpoint.- Parameters:
user_key (Optional[str]) – The user attribute to filter by, one of ‘about’, ‘username’, ‘email’, ‘group’, or ‘current_group’. If None, no filtering is applied. Defaults to None.
user_value (Optional[Union[str, List[str]]]) – The value(s) to filter by, such as a username, email, or group name. Can be a single string or a list of strings. If None, no filtering is applied. Defaults to None.
- user_key#
The filter key.
- Type:
Optional[str]
- user_value#
The filter value(s).
- Type:
Optional[Union[str, List[str]]]
- Raises:
ValueError – If user_key is not one of the valid options (‘about’, ‘username’, ‘email’, ‘group’, ‘current_group’).
Examples
>>> from teamworksams import SyncEventFilter, sync_event_data >>> filter = SyncEventFilter(user_key = "group", user_value = "Group A") >>> df, new_sync_time = sync_event_data( ... form = "Training Log", ... last_synchronisation_time = 1677654321000, ... url = "https://example.smartabase.com/site", ... filter = filter ... )
Additional Notes#
The
user_key
must be one of ‘username’, ‘email’, ‘group’, or ‘about’;user_value
is case-sensitive and supports lists for multiple values (e.g., [‘TeamA’]).Use with sync_event_data() to limit synchronized events to specific users, optimizing performance for incremental updates.
See Also#
sync_event_data(): Function using
SyncEventFilter
.SyncEventOption(): Configuration options for synchronization.
Exporting Data: Synchronization workflows.