Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/user/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ organizations
.. autoclass:: webexpythonsdk.api.organizations.OrganizationsAPI()


.. _org_contacts:
.. _organization_contacts:

organization_contacts
---------------------

.. autoclass:: webexpythonsdk.api.organization_contacts.OrganizationContactsAPI()


.. _people:

people
Expand Down Expand Up @@ -230,6 +239,15 @@ Organization
:inherited-members:


.. _OrganizationContact:

Organization Contact
--------------------

.. autoclass:: OrganizationContact()
:inherited-members:


.. _Person:

Person
Expand Down
7 changes: 7 additions & 0 deletions docs/user/api_structure_table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
| | :ref:`organizations` | :meth:`list() <webexpythonsdk.api.organizations.OrganizationsAPI.list>` |
| | | :meth:`create() <webexpythonsdk.api.organizations.OrganizationsAPI.create>` |
+------------------------+---------------------------+---------------------------------------------------------------------------------+
| | :ref:`org_contacts` | :meth:`list() <webexpythonsdk.api.organization_contacts.OrganizationContactsAPI.list>`|
| | | :meth:`search() <webexpythonsdk.api.organization_contacts.OrganizationContactsAPI.search>`|
| | | :meth:`create() <webexpythonsdk.api.organization_contacts.OrganizationContactsAPI.create>`|
| | | :meth:`get() <webexpythonsdk.api.organization_contacts.OrganizationContactsAPI.get>`|
| | | :meth:`update() <webexpythonsdk.api.organization_contacts.OrganizationContactsAPI.update>`|
| | | :meth:`delete() <webexpythonsdk.api.organization_contacts.OrganizationContactsAPI.delete>`|
+------------------------+---------------------------+---------------------------------------------------------------------------------+
| | :ref:`people` | :meth:`list() <webexpythonsdk.api.people.PeopleAPI.list>` |
| | | :meth:`create() <webexpythonsdk.api.people.PeopleAPI.create>` |
| | | :meth:`get() <webexpythonsdk.api.people.PeopleAPI.get>` |
Expand Down
1 change: 1 addition & 0 deletions src/webexpythonsdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
MeetingTemplate,
Membership,
Message,
OrganizationContact,
Organization,
Person,
Recording,
Expand Down
7 changes: 7 additions & 0 deletions src/webexpythonsdk/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from .licenses import LicensesAPI
from .memberships import MembershipsAPI
from .messages import MessagesAPI
from .organization_contacts import OrganizationContactsAPI
from .organizations import OrganizationsAPI
from .people import PeopleAPI
from .roles import RolesAPI
Expand All @@ -52,6 +53,7 @@
from .meeting_templates import MeetingTemplatesAPI
from .meeting_invitees import MeetingInviteesAPI
from .meeting_registrants import MeetingRegistrantsAPI
from .hunt_groups import HuntGroupsAPI

import os

Expand Down Expand Up @@ -219,6 +221,10 @@ def __init__(
self.licenses = LicensesAPI(self._session, object_factory)
self.memberships = MembershipsAPI(self._session, object_factory)
self.messages = MessagesAPI(self._session, object_factory)
self.organization_contacts = OrganizationContactsAPI(
self._session,
object_factory,
)
self.organizations = OrganizationsAPI(self._session, object_factory)
self.people = PeopleAPI(self._session, object_factory)
self.roles = RolesAPI(self._session, object_factory)
Expand All @@ -241,6 +247,7 @@ def __init__(
self.meeting_registrants = MeetingRegistrantsAPI(
self._session, object_factory
)
self.hunt_groups = HuntGroupsAPI(self._session, object_factory)

@property
def access_token(self):
Expand Down
108 changes: 108 additions & 0 deletions src/webexpythonsdk/api/hunt_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
"""Webex Features: Hunt Group API wrapper.

Copyright (c) 2016-2024 Cisco and/or its affiliates.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from ..restsession import RestSession
from ..utils import (
check_type,
dict_from_items_with_values,
)


API_ENDPOINT = "features/huntGroups"
OBJECT_TYPE = "hunt_group"


class HuntGroupsAPI(object):
"""Webex Features: Hunt Group API.

Wraps the Webex Calling Hunt Group API and exposes the API as native
Python methods that return native Python objects.
See: https://developer.webex.com/docs/api/v1/features-hunt-group
"""

def __init__(self, session, object_factory):
"""Initialize a new HuntGroupsAPI object with the provided RestSession.

Args:
session(RestSession): The RESTful session object to be used for
API calls to the Webex service.
object_factory(callable): The factory function to use to create
Python objects from the returned Webex JSON data objects.

Raises:
TypeError: If the parameter types are incorrect.

"""
check_type(session, RestSession)

super(HuntGroupsAPI, self).__init__()

self._session = session
self._object_factory = object_factory

def create(
self,
org_id,
location_id,
name,
extension,
**request_parameters,
):
"""Create a hunt group.

Creates a new hunt group for the given organization and location.
See: https://developer.webex.com/docs/api/v1/features-hunt-group/
create-a-hunt-group

Args:
org_id(str): The ID of the organization.
location_id(str): The ID of the location for the hunt group.
name(str): A user-friendly name for the hunt group.
extension(str): The extension for the hunt group.
**request_parameters: Additional request body parameters (e.g.
phoneNumber, callRoutingPattern, agents, etc.).

Returns:
ImmutableData: The created hunt group object.

Raises:
TypeError: If the parameter types are incorrect.
ApiError: If the Webex cloud returns an error.

"""
check_type(org_id, str)
check_type(location_id, str)
check_type(name, str)
check_type(extension, str)

post_data = dict_from_items_with_values(
request_parameters,
orgId=org_id,
locationId=location_id,
name=name,
extension=extension,
)

json_data = self._session.post(API_ENDPOINT, json=post_data)

return self._object_factory(OBJECT_TYPE, json_data)
Loading