mstrio > server > history_list

class mstrio.server.history_list.HistoryList(connection, id=None, message_id=None, name=None, project_id=None, scope='all_users')

Bases: EntityBase

Class representation of a Strategy history list message.

Parameters:
  • connection (Connection)

  • id (str | None)

  • message_id (str | None)

  • name (str | None)

  • project_id (str | None)

  • scope (str)

connection

A Strategy connection object.

id

History list message ID.

name

Message display name or title.

title

Message title.

display_name

Message display name.

status

Message status.

request_status

Request status.

target_info

Information about the target object.

project_id

Project ID.

project_name

Project name.

owner_id

Message owner ID.

owner_name

Message owner name.

classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)

Creates multiple objects from a list of dictionaries. For each dictionary provided the keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in the object’s _FROM_DICT_MAP.

Parameters:
  • cls (T) – Class (type) of the objects that should be created.

  • source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects will be constructed.

  • connection (Connection, optional) – A MSTR Connection object. Defaults to None.

  • to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to True.

  • with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.

Returns:

A list of objects of type T.

Return type:

T

classmethod from_dict(source, connection, to_snake_case=True, with_missing_value=False)
Overrides Dictable.from_dict() to instantiate an object from

a dictionary without calling any additional getters.

Parameters:
  • cls – Class (type) of an object that should be created.

  • source (dict[str, Any]) – a dictionary from which an object will be constructed.

  • connection (Connection) – A Strategy Connection object.

  • to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case, default True.

  • with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.

Returns:

An instance of the cls class.

classmethod to_csv(objects, name, path=None, properties=None)

Exports MSTR objects to a csv file.

Optionally, saves only the object properties specified in the properties parameter.

Parameters:
  • objects (T | list[T]) – List of objects of the same type that

  • exported. (will be)

  • name (str) – The name of the csv file ending with ‘.csv’

  • path (Optional[str], optional) – A path to the directory where the file will be saved. Defaults to None.

  • properties (Optional[list[str]], optional) – A list of object’s attribute names that should be included in the exported file. Defaults to None.

Raises:
  • TypeError – If objects is not of type T or list of type T

  • objects. –

Return type:

None

static bulk_send(connection, requests)

Send multiple project-scoped objects to history list.

Return type:

dict

Parameters:
static get_messages_by_ids(connection, message_ids, **kwargs)

Get history list messages by IDs.

Parameters:
  • connection (Connection) – Strategy connection object.

  • message_ids (list[str]) – IDs of history list messages.

  • **kwargs – Parameters accepted by get_history_list_messages_by_ids.

Returns:

list[HistoryList] | list[dict] – List of history list message dictionaries or HistoryList objects.

Return type:

list[HistoryList] | list[dict]

static list_HL_messages(connection, **kwargs)

List history list messages.

Parameters:
  • connection (Connection) – Strategy connection object.

  • **kwargs – Parameters accepted by list_history_list_messages.

Returns:

list[HistoryList] | list[dict] – List of history list message dictionaries or HistoryList objects.

Return type:

list[HistoryList] | list[dict]

static send(connection, object_id, object_type, project_id, message_id=None, display_name=None)

Send a report, document, or dossier to history list.

Return type:

dict

Parameters:
  • connection (Connection)

  • object_id (str)

  • object_type (str)

  • project_id (str)

  • message_id (str | None)

  • display_name (str | None)

static update_messages_status(connection, message_statuses, project_id=None)

Update statuses of history list messages in bulk.

Return type:

dict

Parameters:
  • connection (Connection)

  • message_statuses (list[dict])

  • project_id (str | None)

__init__(connection, id=None, message_id=None, name=None, project_id=None, scope='all_users')

Initialize a history list message by ID or name.

Parameters:
  • connection (Connection) – Strategy connection object.

  • id (str, optional) – History list message ID.

  • message_id (str, optional) – Alias for id.

  • name (str, optional) – Message display name.

  • project_id (str, optional) – Project ID used to scope lookup and message operations.

  • scope (str, optional) – History list retrieval scope used to look up the message. Defaults to all_users.

Return type:

None

alter(display_name)

Alter the history list message display name.

Note

The current admin-rest implementation supports only a replace operation on /displayName. Other patch paths are rejected by the server.

Parameters:

display_name (str) – New display name.

Return type:

None

delete(force=False, remove_others_message=False)

Delete the history list message.

Parameters:
  • force (bool, optional) – If True, do not ask for confirmation.

  • remove_others_message (bool, optional) – Allow removing messages from other users than the requester. Defaults to False.

Returns:

bool – True when the deletion request is sent. False when the confirmation prompt is rejected.

Return type:

bool

fetch()

Fetch history list message details from Strategy.

Return type:

None

list_properties(excluded_properties=None)

Fetch and list all properties of the history list message.

Parameters:

excluded_properties (list[str], optional) – A list of object properties that should be excluded from the returned dictionary.

Returns:

dict – Dictionary with history list message properties.

Return type:

dict

print()

Pretty Print all properties of the object.

Return type:

None

to_dataframe()

Converts all properties of the object to a dataframe.

Returns:

A DataFrame object containing object properties.

Return type:

DataFrame

to_dict(camel_case=True, whitelist_keys=None, skip_private_keys=False)

Converts an object to a dictionary excluding object’s private properties. When converting the object to a dictionary, the object’s attributes become the dictionary’s keys and are in camel case by default Attribute values stored as objects are automatically converted to non-/ primitive data structures.

Parameters:
  • camel_case (bool, optional) – Set to True if attribute names should be converted from snake case to camel case. Defaults to True.

  • whitelist_keys (list[str], optional) – List of keys to include in the resulting dictionary. If None, all keys (except hidden ones) are included. Defaults to None.

  • skip_private_keys (bool, optional) – If True, skips private keys in final dict representation.

Returns:

A dictionary representation of object’s attributes and values.

By default, the dictionary keys are in camel case.

Return type:

dict

update_properties()

Save compatible local changes of the object attributes to the I-Server. Changes are retrieved from the self._altered_properties dictionary. After the process of update has finished, self._altered_properties is cleared. For this method to work properly, you must override the _alter_properties() method in a subclass.

Raises:

requests.HTTPError – If I-Server raises exception

Return type:

None

property connection: Connection

An object representation of Strategy connection specific to the object.

property folder_id: str | None
property id: str

The object’s id.

property type: ObjectTypes

The object’s type.

mstrio.server.history_list.bulk_send_to_history_list(connection, requests)

Send multiple project-scoped objects to history list.

Parameters:
  • connection (Connection) – Strategy connection object.

  • requests (list[dict]) – Project-scoped send requests accepted by REST API, each containing projectId and objects.

Returns:

dict – Response data dictionary.

Return type:

dict

mstrio.server.history_list.delete_all_history_list_messages(connection)

Removes all History List messages from all the users.

Parameters:

connection (Connection) – Strategy connection object.

Return type:

None

mstrio.server.history_list.get_history_list_messages_by_ids(connection, message_ids, scope='all_users', to_dictionary=True)

Get history list messages by IDs.

Parameters:
  • connection (Connection) – Strategy connection object.

  • message_ids (list[str]) – IDs of history list messages.

  • scope (str, optional) – History list retrieval scope. Available values: single_user, all_users, and single_library_user.

  • to_dictionary (bool, optional) – If True, returns dictionaries. If False, returns HistoryList objects.

Returns:

list[HistoryList] | list[dict] – List of history list message dictionaries or HistoryList objects.

Return type:

list[HistoryList] | list[dict]

mstrio.server.history_list.list_history_list_messages(connection, project_id=None, scope='all_users', status=None, read_status=None, application_type=None, target_info_name=None, target_info_object_id=None, target_info_object_creator=None, message_display_name=None, owner_id=None, type=None, offset=0, limit=None, fields=None, to_dictionary=True)

List history list messages.

Parameters:
  • connection (Connection) – Strategy connection object.

  • project_id (str, optional) – Project ID used to filter messages.

  • scope (str, optional) – History list retrieval scope. Available values: single_user, all_users, and single_library_user.

  • status (str, optional) – Message request status filter.

  • read_status (bool, optional) – Message read status filter.

  • application_type (str, optional) – Client application type filter.

  • target_info_name (str, optional) – Target object name partial-match filter.

  • target_info_object_id (str, optional) – Target object ID filter.

  • target_info_object_creator (str, optional) – Target object creator name partial-match filter.

  • message_display_name (str, optional) – Message display name partial-match filter.

  • owner_id (str, optional) – Message owner ID filter.

  • type (str, optional) – Content type filter. Available values include report, document, and dossier.

  • offset (int, optional) – Starting point within returned results.

  • limit (int, optional) – Maximum number of messages to retrieve. If None, retrieves all available messages.

  • fields (str, optional) – Comma-separated, top-level field whitelist.

  • to_dictionary (bool, optional) – If True, returns dictionaries. If False, returns HistoryList objects.

Returns:

list[HistoryList] | list[dict] – List of history list message dictionaries or HistoryList objects.

Return type:

list[HistoryList] | list[dict]

mstrio.server.history_list.send_to_history_list(connection, object_id, object_type, project_id, message_id=None, display_name=None)

Send a report, document, or dossier to history list.

Parameters:
  • connection (Connection) – Strategy connection object.

  • object_id (str) – ID of the object to send.

  • object_type (str) – Object type accepted by REST API.

  • project_id (str) – Project ID used in X-MSTR-ProjectID header.

  • message_id (str, optional) – Optional report or document instance ID.

  • display_name (str, optional) – Optional display name.

Returns:

dict – Response data dictionary.

Return type:

dict

mstrio.server.history_list.update_history_list_messages_status(connection, message_statuses, project_id=None)

Update statuses of history list messages in bulk.

Parameters:
  • connection (Connection) – Strategy connection object.

  • message_statuses (list[dict]) – Message status updates in the format {“id”: “<message_id>”, “status”: “read_message”}.

  • project_id (str, optional) – Project ID used in X-MSTR-ProjectID header.

Returns:

dict – Response data dictionary.

Return type:

dict