Replists
ptnad.api.replists.RepListsAPI
Methods:
Name | Description |
---|---|
add_dynamic_list_item |
Add an item to a dynamic reputation list. |
bulk_add_items |
Add multiple items to a dynamic reputation list. |
bulk_delete_items |
Delete multiple items from a dynamic reputation list. |
create_list |
Create a new reputation list. |
delete_list |
Delete a reputation list. |
get_all_lists |
Get all reputation lists using pagination. |
get_dynamic_list_items |
Get items from a dynamic reputation list. |
get_list |
Get information about a specific reputation list. |
get_lists |
Get a list of reputation lists. |
get_stats |
Get statistics about reputation lists. |
remove_item |
Remove an item from a dynamic reputation list. |
update_list |
Update a reputation list. |
Source code in src/ptnad/api/replists.py
add_dynamic_list_item
add_dynamic_list_item(external_key: str, value: str, attributes: Dict[str, Any] | None = None) -> Dict[str, Any]
Add an item to a dynamic reputation list.
Args: external_key (str): External key of the reputation list. value (str): Value to add to the list. attributes (Optional[Dict[str, Any]]): Additional attributes for the item.
Returns: Dict[str, Any]: Information about the added item.
Raises: PTNADAPIError: If there's an error adding the item.
Source code in src/ptnad/api/replists.py
bulk_add_items
Add multiple items to a dynamic reputation list.
Args: external_key (str): External key of the reputation list. items (List[Dict[str, Any]]): List of items to add, each item should have 'value' and optionally 'attrs'.
Raises: PTNADAPIError: If there's an error adding the items.
Source code in src/ptnad/api/replists.py
bulk_delete_items
Delete multiple items from a dynamic reputation list.
Args: external_key (str): External key of the reputation list. values (List[str]): List of values to delete from the list.
Raises: PTNADAPIError: If there's an error deleting the items.
Source code in src/ptnad/api/replists.py
create_list
create_list(name: str, type: str, color: str, description: str | None = None, content: Union[str, List[str], None] = None, external_key: str | None = None) -> Dict[str, Any]
Create a new reputation list.
Args: name (str): Name of the reputation list. Must be a valid slug (letters, numbers, underscores, hyphens). type (str): Type of the reputation list ('ip', 'dn', 'uri', or 'md5'). color (str): Color code for the reputation list ('0' to '7'). description (Optional[str]): Description of the reputation list. content (Optional[Union[str, List[str]]]): Content of the reputation list. Can be a string or a list of strings that will be joined with newlines. external_key (Optional[str]): External key for the reputation list.
Returns: Dict[str, Any]: Information about the created reputation list.
Raises: ValidationError: If the input parameters are invalid. PTNADAPIError: If there's an error creating the list.
Source code in src/ptnad/api/replists.py
delete_list
Delete a reputation list.
Args: list_id (int): ID of the reputation list to delete.
Raises: PTNADAPIError: If there's an error deleting the reputation list.
Source code in src/ptnad/api/replists.py
get_all_lists
get_all_lists(search: str | None = None, ordering: str | None = None, limit: int = 100) -> List[Dict[str, Any]]
Get all reputation lists using pagination.
Args: search (Optional[str]): Keyword to filter the lists by name, description, or vendor name. ordering (Optional[str]): Field to sort the results by (id, name, color, type, created, modified, items_count, description, vendor__name). Use prefix with '-' for descending order. limit (int): Number of lists to fetch per request (default: 100).
Returns: List[Dict[str, Any]]: A list of dictionaries containing all reputation list information.
Raises: PTNADAPIError: If there's an error retrieving the lists.
Source code in src/ptnad/api/replists.py
get_dynamic_list_items
Get items from a dynamic reputation list.
Args: external_key (str): External key of the reputation list. ordering (Optional[str]): Field to sort the results by (value or modified).
Returns: List[Dict[str, Any]]: List of items in the reputation list.
Raises: PTNADAPIError: If there's an error retrieving the items.
Source code in src/ptnad/api/replists.py
get_list
Get information about a specific reputation list.
Args: list_id (int): ID of the reputation list.
Returns: Dict[str, Any]: Information about the reputation list.
Raises: PTNADAPIError: If there's an error retrieving the list.
Source code in src/ptnad/api/replists.py
get_lists
get_lists(search: str | None = None, ordering: str | None = None, limit: int = 100, offset: int = 0) -> List[Dict[str, Any]]
Get a list of reputation lists.
Args: search (Optional[str]): Keyword to filter the lists by name, description, or vendor name. ordering (Optional[str]): Field to sort the results by (id, name, color, type, created, modified, items_count, description, vendor__name). Use prefix '-' for descending order. limit (int): Maximum number of lists to return (default: 100). offset (int): Number of lists to skip (default: 0).
Returns: List[Dict[str, Any]]: A list of dictionaries containing reputation list information.
Raises: PTNADAPIError: If there's an error retrieving the lists.
Source code in src/ptnad/api/replists.py
get_stats
Get statistics about reputation lists.
Returns: Dict[str, Any]: Statistics about reputation lists.
Raises: PTNADAPIError: If there's an error retrieving the statistics.
Source code in src/ptnad/api/replists.py
remove_item
Remove an item from a dynamic reputation list.
Args: external_key (str): External key of the reputation list. value (str): Value to remove from the reputation list.
Raises: PTNADAPIError: If there's an error removing the item.
Source code in src/ptnad/api/replists.py
update_list
Update a reputation list.
Args: list_id (int): ID of the reputation list to update. **kwargs: Fields to update (color, name, type, description, content).
Returns: Dict[str, Any]: Updated information about the reputation list.
Raises: PTNADAPIError: If there's an error updating the list.