Models#
Activity log#
- class ActivityReportFilter#
Builder class to create an activity report filter for use with
get_activity_report_where().All text-based fields are always case-insensitive.
Examples
>>> # Activity report for this library only >>> pygranta_system_filter = ActivityReportFilter().with_application_name("PyGranta System") >>> client.get_activity_report_where(pygranta_system_filter)
>>> # Activity report relating to the MI_Training database >>> mi_training_filter = ActivityReportFilter().with_database_key("MI_Training", exact_match=True) >>> client.get_activity_report_where(mi_training_filter)
>>> # Activity report for a domain user >>> domain_user_filter = ActivityReportFilter().with_username("DOMAIN\\user", exact_match=True) >>> client.get_activity_report_where(domain_user_filter)
>>> # Activity report for edit operations using MI Training database using MI Scripting Toolkit, made last month >>> first_of_this_month = datetime.date.today().replace(day=1) >>> last_of_last_month = first_of_this_month - datetime.timedelta(days=1) >>> first_of_last_month = last_of_last_month.replace(day=1) >>> combination_filter = ( ... ActivityReportFilter() ... .with_application_name("Scripting Toolkit") ... .with_database_key("MI_Training") ... .with_usage_mode(ActivityUsageMode.EDIT) ... .with_date_from(first_of_last_month, inclusive=True) ... .with_date_to(last_of_last_month, inclusive=True) ... ) >>> view_filter.get_activity_report_where(combination_filter)
- with_application_name(application_name, exact_match=False)#
Filter based on a single application name used as part of the activity.
For filtering based on multiple applications simultaneously, use the
with_application_names()method.- Parameters:
- Returns:
ActivityReportFilterThe current
ActivityReportFilterobject.
- with_application_names(application_names, exact_match=False)#
Filter based on multiple application names used as part of the activity.
For partial filtering based on multiple applications simultaneously, use the
with_application_names()method.- Parameters:
- application_names
listofstr The names of applications used as part of the activity.
- exact_matchbool, optional
If true, every application name must be involved in the activity for it to be returned. Defaults to false, in which case the activity may contain additional application names not specified here.
- application_names
- Returns:
ActivityReportFilterThe current
ActivityReportFilterobject.
- with_database_key(database_key, exact_match=False)#
Filter based on a database key used as part of the activity.
If
database_key = None, then theexact_matchargument is ignored.- Parameters:
- database_key
strorNone The name of the database key used as part of the activity. To find activities relating to application use only, specify
None.- exact_matchbool, optional
If true, the database key must match exactly, excluding case sensitivity. Defaults to false, in which case a partial match is allowed.
- database_key
- Returns:
ActivityReportFilterThe current
ActivityReportFilterobject.
- with_date_from(date_from, inclusive=False)#
Filter based on the earliest allowed date of the activity.
- Parameters:
- date_from
datetime.date The earliest allowed date of the activity.
- inclusivebool, optional
If true, activities occurring on the specified date are allowed. Defaults to false, in which case activities occurring on the specified date are not allowed.
- date_from
- Returns:
ActivityReportFilterThe current
ActivityReportFilterobject.
- with_date_to(date_to, inclusive=False)#
Filter based on the latest allowed date of the activity.
- Parameters:
- date_to
datetime.date The latest allowed date of the activity.
- inclusivebool, optional
If true, activities occurring on the specified date are allowed. Defaults to false, in which case activities occurring on the specified date are not allowed.
- date_to
- Returns:
ActivityReportFilterThe current
ActivityReportFilterobject.
- with_usage_mode(usage_mode)#
Filter based on the usage mode of the activity.
- Parameters:
- usage_mode
ActivityUsageMode The usage mode of the activity.
- usage_mode
- Returns:
ActivityReportFilterThe current
ActivityReportFilterobject.
- with_username(username, exact_match=False)#
Filter based on the username of the user who performed the activity.
- Parameters:
- Returns:
ActivityReportFilterThe current
ActivityReportFilterobject.
- class ActivityItem(activity_date, application_names, username, usage_mode, database_key)#
Describes an activity report item as obtained from the API.
Read-only dataclass - do not directly instantiate or modify instances of this class.
- usage_mode: ActivityUsageMode#
The usage mode associated with the activity.
- class ActivityUsageMode(value)#
Usage modes for an activity.
Can be used in
ActivityReportFilter.with_usage_mode().- VIEW = 'view'#
- EDIT = 'edit'#
- class GrantaMIVersion(version, binary_compatibility_version)#
Information about a Granta MI version.