mstrio.distribution_services.contact package¶
Submodules¶
mstrio.distribution_services.contact.contact module¶
- class mstrio.distribution_services.contact.contact.Contact(connection: Connection, id: Optional[str] = None, name: Optional[str] = None)¶
Bases:
mstrio.utils.entity.EntityBase
,mstrio.utils.entity.DeleteMixin
Object representation of Microstrategy Contact object
- name¶
contact’s name
- id¶
contact’s id
- description¶
contact’s description
- enabled¶
specifies if a contact is enabled
- linked_user¶
user linked to contact, instance of User
- contact_addresses¶
list of contact’s addresses, instances of ContactAddress
- memberships¶
list of Contact Groups that the contact belongs to
- connection¶
instance of Connection class, represents connection to MicroStrategy Intelligence Server
- add_to_contact_group(contact_group: Union[mstrio.distribution_services.contact_group.contact_group.ContactGroup, str])¶
Add to ContactGroup
- Parameters
contact_group – contact group to which add this contact
- alter(name: Optional[str] = None, description: Optional[str] = None, enabled: Optional[bool] = None, linked_user: Optional[Union[mstrio.users_and_groups.user.User, str]] = None, contact_addresses: Optional[Iterable[Union[mstrio.distribution_services.contact.contact.ContactAddress, dict]]] = None)¶
Update properties of a contact
- Parameters
name – name of a contact
description – description of a contact
enabled – specifies if a contact is enabled
linked_user – an object of class User linked to the contact
contact_addresses – list of contact addresses
- classmethod create(connection: Connection, name: str, linked_user: Union[User, str], contact_addresses: Iterable[Union[ContactAddress, dict]], description: Optional[str] = None, enabled: bool = True) Contact ¶
Create a new contact.
- Parameters
connection – MicroStrategy connection object returned by connection.Connection()
name – contact name
linked_user – user linked to contact
contact_addresses – list of contact addresses
description – description of contact
enabled – specifies if contact should be enabled
- Returns
Contact object
- remove_from_contact_group(contact_group: Union[mstrio.distribution_services.contact_group.contact_group.ContactGroup, str])¶
Remove from ContactGroup
- Parameters
contact_group – contact group from which to remove this contact
- class mstrio.distribution_services.contact.contact.ContactAddress(name: str, physical_address: str, delivery_type: Union[mstrio.distribution_services.contact.contact.ContactDeliveryType, str], device: Union[Device, str], id: Optional[str] = None, is_default: bool = False, connection: Optional[Connection] = None)¶
Bases:
mstrio.utils.helper.Dictable
Representation of contact address object
- id¶
id of contact address, optional
- name¶
contact address’ name
- physical_address¶
physical address of contact
- delivery_type¶
object of type ContactDeliveryType
- is_default¶
specifies if address is default, optional, default value: False
- device¶
instance of Device or string (containing device’s id), if device is a string, connection is required
- connection¶
instance of Connection, optional, is required if device is string
- classmethod from_dict(source, connection, to_snake_case=True) mstrio.distribution_services.contact.contact.ContactAddress ¶
Creates an object from a dictionary. The dictionary’s 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 _FROM_DICT_MAP.
- Parameters
cls (T) – Class (type) of an object that should be created.
source (Dict[str, Any]) – A dictionary from which an object 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.
- Returns
An object of type T.
- Return type
T
- to_dict(camel_case=True) dict ¶
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.
- Returns
- A dictionary representation of object’s attributes and values.
By default the dictionary keys are in camel case.
- Return type
dict
- class mstrio.distribution_services.contact.contact.ContactDeliveryType(value)¶
Bases:
mstrio.utils.enum_helper.AutoName
An enumeration.
- EMAIL = 'email'¶
- FILE = 'file'¶
- FTP = 'ftp'¶
- MOBILE_ANDROID = 'mobile_android'¶
- MOBILE_IPAD = 'mobile_ipad'¶
- MOBILE_IPHONE = 'mobile_iphone'¶
- PRINTER = 'printer'¶
- UNSUPPORTED = 'unsupported'¶
- mstrio.distribution_services.contact.contact.list_contacts(connection: Connection, to_dictionary: bool = False, limit: Optional[int] = None, **filters) Union[List[Contact], List[dict]] ¶
Get all contacts as list of Contact objects or dictionaries.
Optionally filter the contacts by specifying filters.
- Parameters
connection – MicroStrategy connection object
to_dictionary – If True returns a list of contact dicts, otherwise returns a list of contact objects
limit – limit the number of elements returned. If None (default), all objects are returned.
**filters – Available filter parameters: [‘id’, ‘name’, ‘description’, ‘enabled’]