"""
user privacy API
"""
import json
from typing import Optional, Union
from .common import PersonSettingsApiChild
from ..base import ApiModel
from ..common import PersonPlaceAgent
__all__ = ['PrivacyApi', 'Privacy']
[docs]
class Privacy(ApiModel):
"""
Person privacy settings
"""
#: When true auto attendant extension dialing will be enabled.
aa_extension_dialing_enabled: Optional[bool] = None
#: When true auto attendant dialing by first or last name will be enabled.
aa_naming_dialing_enabled: Optional[bool] = None
#: When true phone status directory privacy will be enabled.
enable_phone_status_directory_privacy: Optional[bool] = None
#: When `true` privacy is enforced for call pickup and barge-in. Only people specified by `monitoringAgents` can
#: pick up the call or barge in by dialing the extension.
enable_phone_status_pickup_barge_in_privacy: Optional[bool] = None
#: List of people that are being monitored.
#: for updates IDs can be used directly instead of :class:`wxc_sdk.common.PersonPlaceAgent` objects
monitoring_agents: Optional[list[Union[str, PersonPlaceAgent]]] = None
[docs]
class PrivacyApi(PersonSettingsApiChild):
"""
API for person's call monitoring settings
"""
feature = 'privacy'
[docs]
def read(self, person_id: str, org_id: str = None) -> Privacy:
"""
Get a person's Privacy Settings
Get a person's privacy settings for the specified person id.
The privacy feature enables the person's line to be monitored by others and determine if they can be reached
by Auto Attendant services.
This API requires a full, user, or read-only administrator auth token with a scope of spark-admin:people_read.
:param person_id: Unique identifier for the person.
:type person_id: str
:param org_id: Person is in this organization. Only admin users of another organization (such as partners)
may use this parameter as the default is the same organization as the token used to access API.
:type org_id: str
:return: privacy settings
:rtype: :class:`Privacy`
"""
ep = self.f_ep(person_id=person_id)
params = org_id and {'orgId': org_id} or None
data = self.get(ep, params=params)
return Privacy.model_validate(data)