Skip to content

Commit 45597ff

Browse files
committed
Minor changes to attachment actions
1 parent 6cc2936 commit 45597ff

File tree

3 files changed

+22
-28
lines changed

3 files changed

+22
-28
lines changed

webexteamssdk/api/attachment_actions.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,10 @@
3333
from builtins import *
3434

3535
from past.builtins import basestring
36-
from requests_toolbelt import MultipartEncoder
3736

38-
from ..generator_containers import generator_container
37+
from ..models.immutable import AttachmentAction
3938
from ..restsession import RestSession
40-
from ..utils import (
41-
check_type, dict_from_items_with_values, is_local_file, is_web_url,
42-
open_local_file,
43-
)
39+
from ..utils import check_type, dict_from_items_with_values
4440

4541

4642
API_ENDPOINT = 'attachment/actions'
@@ -56,7 +52,7 @@ class AttachmentActionsAPI(object):
5652
"""
5753

5854
def __init__(self, session, object_factory):
59-
"""Init a new AttachmentActionsAPI object with the provided RestSession.
55+
"""Initialize a new AttachmentActionsAPI object.
6056
6157
Args:
6258
session(RestSession): The RESTful session object to be used for
@@ -71,21 +67,20 @@ def __init__(self, session, object_factory):
7167
self._session = session
7268
self._object_factory = object_factory
7369

74-
def create(self, type=None, messageId=None, inputs=None,
75-
**request_parameters):
76-
"""Create an attachment action.
70+
def create(self, type, messageId, inputs, **request_parameters):
71+
"""Create a new attachment action.
7772
7873
Args:
79-
type(attachment action enum): The type of attachment action.
80-
messageId(basestring): The ID of parent message the attachment
81-
action is to be performed on.
82-
inputs(dict): inputs to attachment fields
74+
type(basestring): The type of action to perform.
75+
messageId(basestring): The ID of the message which contains the
76+
attachment.
77+
inputs(dict): The attachment action's inputs.
8378
**request_parameters: Additional request parameters (provides
8479
support for parameters that may be added in the future).
8580
8681
Returns:
87-
Attachment action: A attachment action object with the details
88-
of the created attachment action.
82+
AttachmentAction: A attachment action object with the details of
83+
the created attachment action.
8984
9085
Raises:
9186
TypeError: If the parameter types are incorrect.
@@ -95,7 +90,6 @@ def create(self, type=None, messageId=None, inputs=None,
9590
contain a valid URL or path to a local file.
9691
9792
"""
98-
9993
check_type(type, basestring)
10094
check_type(messageId, basestring)
10195
check_type(inputs, dict)

webexteamssdk/models/immutable.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ class AccessToken(ImmutableData, AccessTokenBasicPropertiesMixin):
178178
"""Webex Teams Access-Token data model."""
179179

180180

181+
class AttachmentAction(ImmutableData, AttachmentActionBasicPropertiesMixin):
182+
"""Webex Attachment Actions data model"""
183+
184+
181185
class Event(ImmutableData, EventBasicPropertiesMixin):
182186
"""Webex Teams Event data model."""
183187

@@ -231,10 +235,6 @@ class Webhook(ImmutableData, WebhookBasicPropertiesMixin):
231235
"""Webex Teams Webhook data model."""
232236

233237

234-
class AttachmentAction(ImmutableData, AttachmentActionBasicPropertiesMixin):
235-
"""Webex Attachment Actions data model"""
236-
237-
238238
class WebhookEvent(ImmutableData, WebhookEventBasicPropertiesMixin):
239239
"""Webex Teams Webhook-Events data model."""
240240

webexteamssdk/models/mixins/attachment_action.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,22 @@ class AttachmentActionBasicPropertiesMixin(object):
4040

4141
@property
4242
def id(self):
43-
"""The unique identifier for the attachment action."""
43+
"""A unique identifier for the action."""
4444
return self._json_data.get('id')
4545

4646
@property
4747
def personId(self):
48-
"""The ID of the person who performed the attachment action."""
48+
"""The ID of the person who performed the action."""
4949
return self._json_data.get('personId')
5050

5151
@property
5252
def roomId(self):
53-
"""The room ID of the attachment action."""
53+
"""The ID of the room the action was performed within."""
5454
return self._json_data.get('roomId')
5555

5656
@property
5757
def type(self):
58-
"""The type of attachment action.
58+
"""The type of action performed.
5959
6060
Attachment action enum:
6161
'submit': submit filled in inputs
@@ -64,17 +64,17 @@ def type(self):
6464

6565
@property
6666
def messageId(self):
67-
"""The ID of parent message the attachment action was performed on."""
67+
"""The parent message the attachment action was performed on."""
6868
return self._json_data.get('messageId')
6969

7070
@property
7171
def inputs(self):
72-
"""The attachment action's inputs"""
72+
"""The action's inputs."""
7373
return self._json_data('inputs')
7474

7575
@property
7676
def created(self):
77-
"""The date and time the attachment action was created."""
77+
"""The date and time the action was created."""
7878
created = self._json_data.get('created')
7979
if created:
8080
return WebexTeamsDateTime.strptime(created)

0 commit comments

Comments
 (0)