Watchlists¶
_incydr_sdk.watchlists.client.WatchlistsV1
(parent)Client for /v1/watchlists
endpoints.
Usage example:
>>> import incydr
>>> client = incydr.Client(**kwargs)
>>> client.watchlists.v1.get_page()
add_departments
(self, watchlist_id, departments)Include departments on a watchlist. Use the departments
client to see available departments.
Parameters:
- watchlist:
str
(required) - Watchlist ID. - departments:
str
,List[str]
(required) - List of departments to include on the watchlist.
Returns: A requests.Response
indicating success.
add_directory_groups
(self, watchlist_id, group_ids)Include directory groups on a watchlist. Use the directory_groups
client to see available directory groups.
Parameters:
- watchlist:
str
(required) - Watchlist ID. - group_ids:
str
,List[str]
(required) - List of directory group IDs to include on the watchlist.
Returns: A requests.Response
indicating success.
add_excluded_users
(self, watchlist_id, user_ids)Exclude individual users from a watchlist.
Parameters:
- watchlist:
str
(required) - Watchlist ID. - user_ids:
str
,List[str]
(required) - List of unique user IDs to exclude from the watchlist. A maximum of 100 users can be processed in a single request.
Returns: A requests.Response
indicating success.
add_included_users
(self, watchlist_id, user_ids)Include individual users on a watchlist.
Parameters:
- watchlist:
str
(required) - Watchlist ID. - user_ids:
str
,List[str]
(required) - List of unique user IDs to include on the watchlist. A maximum of 100 users can be processed in a single request.
Returns: A requests.Response
indicating success.
create
(self, watchlist_type, title=None, description=None)Create a new watchlist.
Parameters:
- watchlist_type:
WatchlistType
(required) - Type of the watchlist to create. - title: The required title for a custom watchlist.
- description: The optional description for a custom watchlist.
Returns: A 'Watchlist` object.
delete
(self, watchlist_id)Delete a watchlist.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID.
Returns: A requests.Response
indicating success.
get
(self, watchlist_id)Get a single watchlist.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID.
Returns: A Watchlist
object.
get_department
(self, watchlist_id, department)Get an included department from a watchlist.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID. - department:
str
(required) - A included department.
Returns: An IncludedDepartment
object.
get_directory_group
(self, watchlist_id, group_id)Get an included directory group from a watchlist.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID. - group_id:
str
(required) - Directory group ID.
Returns: An IncludedDirectoryGroup
object.
get_excluded_user
(self, watchlist_id, user_id)Get an excluded user from a watchlist.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID. - user_id:
str
(required) - Unique user ID.
Returns: A WatchlistUser
object.
get_id_by_name
(self, name)Get a watchlist ID by either its type (ex: DEPARTING_EMPLOYEE
) or its title in the case of CUSTOM
watchlists.
Parameters:
- name:
str
,WatchlistType
(required) - AWatchlistType
or in the case ofCUSTOM
watchlists, the watchlisttitle
.
Returns: A watchlist ID (str
).
get_included_user
(self, watchlist_id, user_id)Get an included user from a watchlist.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID. - user_id:
str
(required) - Unique user ID.
Returns: A WatchlistUser
object.
get_member
(self, watchlist_id, user_id)Get a single member of a watchlist. A member may have been added as an included user, or is a member of an included department, etc.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID. - user_id:
str
(required) - Unique user ID.
Returns: A WatchlistUser
object.
get_page
(self, page_num=1, page_size=None, user_id=None)Get a page of watchlists.
Filter results by passing appropriate parameters:
Parameters:
- page_num:
int
- Page number for results, starting at 1. - page_size:
int
- Max number of results to return for a page. - user_id:
str
- Matches watchlists where the user is a member.
Returns: A WatchlistsPage
object.
iter_all
(self, page_size=None, user_id=None)Iterate over all watchlists.
Accepts the same parameters as .get_page()
excepting page_num
.
Returns: A generator yielding individual Watchlist
objects.
list_departments
(self, watchlist_id)List departments included on a watchlist.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID.
Returns: An IncludedDepartmentsList
object.
list_directory_groups
(self, watchlist_id)List directory groups included on a watchlist.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID.
Returns: An IncludedUsersList
object.
list_excluded_users
(self, watchlist_id)List individual users excluded from a watchlist.
- watchlist_id:
str
(required) - Watchlist ID.
Returns: An ExcludedUsersList
object.
list_included_users
(self, watchlist_id)List individual users included on a watchlist.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID.
Returns: An IncludedUsersList
object.
list_members
(self, watchlist_id)Get a list of all members of a watchlist. These users may have been added as an included user, or are members of an included department, etc.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID.
Returns: A WatchlistMembersList
object.
remove_departments
(self, watchlist_id, departments)Remove included departments from a watchlist.
Parameters:
- watchlist:
str
- Watchlist ID or a watchlist type. An ID must be provided for custom watchlists. - departments:
str
,List[str]
(required) - List of departments to remove from the watchlist.
Returns: A requests.Response
indicating success.
remove_directory_groups
(self, watchlist_id, group_ids)Remove included directory groups from a watchlist.
Parameters:
- watchlist:
str
(required) - Watchlist ID. - group_ids:
str
,List[str]
(required) - List of directory group IDs to remove from the watchlist.
Returns: A requests.Response
indicating success.
remove_excluded_users
(self, watchlist_id, user_ids)Remove excluded users from a watchlist.
Parameters:
- watchlist:
str
(required) - Watchlist ID. - user_ids:
str
,List[str]
(required) - List of unique user IDs to remove from the exclusion list. A maximum of 100 users can be processed in a single request.
Returns: A requests.Response
indicating success.
remove_included_users
(self, watchlist_id, user_ids)Remove included users from a watchlist.
Parameters:
- watchlist:
str
(required) - Watchlist ID. - user_ids:
str
,List[str]
(required) - List of unique user IDs to remove from the watchlist. A maximum of 100 users can be processed in a single request.
Returns: A requests.Response
indicating success.
update
(self, watchlist_id, title=None, description=None)Update a custom watchlist.
Parameters:
- watchlist_id:
str
(required) - Watchlist ID. - title:
str
- Updated title for a custom watchlist. Defaults to None. - **description:
str
- Updated description for a custom watchlist. Pass an empty string to clear this field. Defaults to None.
Returns: A Watchlist
object.