Skip to content

Commit

Permalink
Update Webex Teams object properties and docstrings
Browse files Browse the repository at this point in the history
Review the object properties documented on https://developer.webex.com and ensure the mixin properties are up-to-date.  Also update the docstrings with the documention's updated descriptions.
  • Loading branch information
cmlccie committed Aug 20, 2019
1 parent 739583d commit caf316e
Show file tree
Hide file tree
Showing 13 changed files with 269 additions and 106 deletions.
9 changes: 9 additions & 0 deletions webexteamssdk/models/immutable.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ class AccessToken(ImmutableData, AccessTokenBasicPropertiesMixin):
class Event(ImmutableData, EventBasicPropertiesMixin):
"""Webex Teams Event data model."""

@property
def data(self):
"""The event’s data representation.
This object will contain the event's resource, such as memberships or
messages, at the time the event took place.
"""
return ImmutableData(self._json_data.get('data'))


class License(ImmutableData, LicenseBasicPropertiesMixin):
"""Webex Teams License data model."""
Expand Down
31 changes: 26 additions & 5 deletions webexteamssdk/models/mixins/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,48 @@ class EventBasicPropertiesMixin(object):

@property
def id(self):
"""Event ID."""
"""The unique identifier for the event."""
return self._json_data.get('id')

@property
def resource(self):
"""The event resource type (`messages`, `memberships`)."""
"""The type of resource in the event.
Event Resource Enum:
`messages`
`memberships`
"""
return self._json_data.get('resource')

@property
def type(self):
"""The event type (`created`, `updated`, `deleted`)."""
"""The action which took place in the event.
Event Type Enum:
`created`
`updated`
`deleted`
"""
return self._json_data.get('type')

@property
def appId(self):
"""The ID of the application for the event."""
return self._json_data.get('appId')

@property
def actorId(self):
"""The ID of the person that performed this event."""
"""The ID of the person who performed the action."""
return self._json_data.get('actorId')

@property
def orgId(self):
"""The ID of the organization for the event."""
return self._json_data.get('orgId')

@property
def created(self):
"""The date and time the event was performed."""
"""The date and time of the event."""
created = self._json_data.get('created')
if created:
return WebexTeamsDateTime.strptime(created)
Expand Down
8 changes: 4 additions & 4 deletions webexteamssdk/models/mixins/license.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ class LicenseBasicPropertiesMixin(object):

@property
def id(self):
"""The unique ID for the License."""
"""A unique identifier for the license."""
return self._json_data.get('id')

@property
def name(self):
"""The name of the License."""
"""Name of the licensed feature."""
return self._json_data.get('name')

@property
def totalUnits(self):
"""The total number of license units."""
"""Total number of license units allocated."""
return self._json_data.get('totalUnits')

@property
def consumedUnits(self):
"""The total number of license units consumed."""
"""Total number of license units consumed."""
return self._json_data.get('consumedUnits')
20 changes: 13 additions & 7 deletions webexteamssdk/models/mixins/membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

from builtins import *

import warnings

from webexteamssdk.utils import WebexTeamsDateTime


Expand All @@ -40,17 +42,17 @@ class MembershipBasicPropertiesMixin(object):

@property
def id(self):
"""The membership's unique ID."""
"""A unique identifier for the membership."""
return self._json_data.get('id')

@property
def roomId(self):
"""The ID of the room."""
"""The room ID."""
return self._json_data.get('roomId')

@property
def personId(self):
"""The ID of the person."""
"""The person ID."""
return self._json_data.get('personId')

@property
Expand All @@ -65,22 +67,26 @@ def personDisplayName(self):

@property
def personOrgId(self):
"""The ID of the organization that the person is associated with."""
"""The organization ID of the person."""
return self._json_data.get('personOrgId')

@property
def isModerator(self):
"""Person is a moderator for the room."""
"""Whether or not the participant is a room moderator."""
return self._json_data.get('isModerator')

@property
def isMonitor(self):
"""Person is a monitor for the room."""
"""Whether or not the participant is a monitoring bot (deprecated)."""
warnings.warn(
"The `isMonitor` attribute has been deprecated.",
DeprecationWarning,
)
return self._json_data.get('isMonitor')

@property
def created(self):
"""The date and time the membership was created."""
"""The date and time when the membership was created."""
created = self._json_data.get('created')
if created:
return WebexTeamsDateTime.strptime(created)
Expand Down
43 changes: 27 additions & 16 deletions webexteamssdk/models/mixins/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,53 +40,64 @@ class MessageBasicPropertiesMixin(object):

@property
def id(self):
"""The message's unique ID."""
"""The unique identifier for the message."""
return self._json_data.get('id')

@property
def roomId(self):
"""The ID of the room."""
"""The room ID of the message."""
return self._json_data.get('roomId')

@property
def roomType(self):
"""The type of room (i.e. 'group', 'direct' etc.)."""
"""The type of room.
Room Type Enum:
`direct`: 1:1 room
`group`: Group room
"""
return self._json_data.get('roomType')

@property
def text(self):
"""The message, in plain text."""
return self._json_data.get('text')

@property
def markdown(self):
"""The message, in Markdown format."""
return self._json_data.get('markdown')

@property
def html(self):
"""The message, in HTML format."""
return self._json_data.get('html')

@property
def files(self):
"""Files attached to the the message (list of URLs)."""
"""Public URLs for files attached to the message."""
return self._json_data.get('files')

@property
def personId(self):
"""The person ID of the sender."""
"""The person ID of the message author."""
return self._json_data.get('personId')

@property
def personEmail(self):
"""The email address of the sender."""
"""The email address of the message author."""
return self._json_data.get('personEmail')

@property
def markdown(self):
"""The message, in markdown format."""
return self._json_data.get('markdown')

@property
def html(self):
"""The message, in HTML format."""
return self._json_data.get('html')

@property
def mentionedPeople(self):
"""The list of IDs of people mentioned in the message."""
"""People IDs for anyone mentioned in the message."""
return self._json_data.get('mentionedPeople')

@property
def mentionedGroups(self):
"""Group names for the groups mentioned in the message."""
return self._json_data.get('mentionedGroups')

@property
def created(self):
Expand Down
6 changes: 3 additions & 3 deletions webexteamssdk/models/mixins/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ class OrganizationBasicPropertiesMixin(object):

@property
def id(self):
"""The unique ID for the Organization."""
"""A unique identifier for the organization."""
return self._json_data.get('id')

@property
def displayName(self):
"""The human-friendly display name of the Organization."""
"""Full name of the organization."""
return self._json_data.get('displayName')

@property
def created(self):
"""Creation date and time in ISO8601 format."""
"""The date and time the organization was created."""
created = self._json_data.get('created')
if created:
return WebexTeamsDateTime.strptime(created)
Expand Down

0 comments on commit caf316e

Please sign in to comment.