Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR to add room meeting details endpoint #129

Closed
wants to merge 2 commits into from
Closed
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
6 changes: 6 additions & 0 deletions docs/user/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ rooms

.. autoclass:: webexteamssdk.api.rooms.RoomsAPI()

.. _room_meeting_details:

room_meeting_details
--------------------

.. autoclass:: webexteamssdk.api.room_meeting_details.RoomMeetingDetailsAPI()

.. _teams:

Expand Down
130 changes: 66 additions & 64 deletions docs/user/api_structure_table.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webexteamssdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from .models.immutable import (
AccessToken, AdminAuditEvent, AttachmentAction, Event, GuestIssuerToken,
immutable_data_factory, License, Membership, Message, Organization, Person,
Role, Room, Team, TeamMembership, Webhook, WebhookEvent,
Role, Room, RoomMeetingDetails, Team, TeamMembership, Webhook, WebhookEvent,
)
from .models.simple import simple_data_factory, SimpleDataModel
from .utils import WebexTeamsDateTime
Expand Down
2 changes: 2 additions & 0 deletions webexteamssdk/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from .people import PeopleAPI
from .roles import RolesAPI
from .rooms import RoomsAPI
from .room_meeting_details import RoomMeetingDetailsAPI
from .team_memberships import TeamMembershipsAPI
from .teams import TeamsAPI
from .webhooks import WebhooksAPI
Expand Down Expand Up @@ -205,6 +206,7 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
self.people = PeopleAPI(self._session, object_factory)
self.roles = RolesAPI(self._session, object_factory)
self.rooms = RoomsAPI(self._session, object_factory)
self.room_meeting_details = RoomMeetingDetailsAPI(self._session, object_factory)
self.teams = TeamsAPI(self._session, object_factory)
self.team_memberships = TeamMembershipsAPI(
self._session, object_factory,
Expand Down
97 changes: 97 additions & 0 deletions webexteamssdk/api/room_meeting_details.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# -*- coding: utf-8 -*-
"""Webex Teams Room Meeting Details API wrapper.

Copyright (c) 2016-2019 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, WHETHER 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 __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)

from builtins import *

from past.builtins import basestring

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


API_ENDPOINT = 'rooms'
OBJECT_TYPE = 'room_meeting_details'


class RoomMeetingDetailsAPI(object):
"""Webex Teams Room Meeting Details API.

Wraps the Webex Teams Rooms API and exposes the API as native Python
methods that return native Python objects.

"""

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

Args:
session(RestSession): The RESTful session object to be used for
API calls to the Webex Teams service.

Raises:
TypeError: If the parameter types are incorrect.

"""
check_type(session, RestSession)

super(RoomMeetingDetailsAPI, self).__init__()

self._session = session
self._object_factory = object_factory


def get(self, roomId):
"""Get the meeting details of a room, by ID.

Args:
roomId(basestring): The ID of the room to be retrieved.

Returns:
RoomMeetingDetails: A RoomMeetingDetails object with the
meeting details of the requested room.

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

"""
check_type(roomId, basestring)

# API request
json_data = self._session.get(API_ENDPOINT + '/' + roomId + '/meetingInfo')

# Return a room object created from the response JSON data
return self._object_factory(OBJECT_TYPE, json_data)
5 changes: 4 additions & 1 deletion webexteamssdk/models/immutable.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
from .mixins.team_membership import TeamMembershipBasicPropertiesMixin
from .mixins.webhook import WebhookBasicPropertiesMixin
from .mixins.webhook_event import WebhookEventBasicPropertiesMixin

from .mixins.room_meeting_details import RoomMeetingDetailsBasicPropertiesMixin

class ImmutableData(object):
"""Model a Webex Teams JSON object as an immutable native Python object."""
Expand Down Expand Up @@ -239,6 +239,8 @@ class Role(ImmutableData, RoleBasicPropertiesMixin):
class Room(ImmutableData, RoomBasicPropertiesMixin):
"""Webex Teams Room data model."""

class RoomMeetingDetails(ImmutableData, RoomMeetingDetailsBasicPropertiesMixin):
"""Webex Teams Room meeting details data model."""

class Team(ImmutableData, TeamBasicPropertiesMixin):
"""Webex Teams Team data model."""
Expand Down Expand Up @@ -278,6 +280,7 @@ class GuestIssuerToken(ImmutableData, GuestIssuerTokenBasicPropertiesMixin):
person=Person,
role=Role,
room=Room,
room_meeting_details=RoomMeetingDetails,
team=Team,
team_membership=TeamMembership,
webhook=Webhook,
Expand Down
69 changes: 69 additions & 0 deletions webexteamssdk/models/mixins/room_meeting_details.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
"""Webex Teams Room meeting details data model.

Copyright (c) 2016-2019 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, WHETHER 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 __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)

from builtins import *

from webexteamssdk.utils import WebexTeamsDateTime


class RoomMeetingDetailsBasicPropertiesMixin(object):
"""Room meeting details basic properties."""

@property
def id(self):
"""A unique identifier for the room."""
return self._json_data.get('id')

@property
def meetingLink(self):
"""The Webex meeting URL for the room."""
return self._json_data.get('meetingLink')

@property
def sipAddress(self):
"""The SIP address for the room."""
return self._json_data.get('sipAddress')

@property
def meetingNumber(self):
"""The Webex meeting number for the room."""
return self._json_data.get('meetingNumber')

@property
def callInTollFreeNumber(self):
"""The toll-free PSTN number for the room."""
return self._json_data.get('callInTollFreeNumber')

@property
def callInTollNumber(self):
"""The toll (local) PSTN number for the room."""
return self._json_data.get('callInTollNumber')