Skip to content

Commit c05e19a

Browse files
committed
added docs and type check for Media
1 parent 9981afa commit c05e19a

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

webexteamssdk/cards/components.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@
2424

2525
from .abstract_components import Serializable
2626
from .utils import check_type
27+
from .options import BlockElementHeight, Spacing
2728

2829
class MediaSource(Serializable):
2930
"""Defines the source of a Media element."""
3031
def __init__(self,
3132
mimeType,
3233
url):
33-
"""Create a new MediaSource
34+
"""Create a new MediaSource component.
3435
3536
Args:
3637
mimeType(str): Mime type of the associated media(i.e. 'video/mp4')
@@ -47,6 +48,7 @@ def __init__(self,
4748
simple_properties=['mimeType', 'url'])
4849

4950
class Media(Serializable):
51+
"""Displays a media player for audio or video content"""
5052
def __init__(self,
5153
sources,
5254
poster=None,
@@ -55,6 +57,26 @@ def __init__(self,
5557
separator=None,
5658
spacing=None,
5759
id=None):
60+
"""Create a new Media component.
61+
62+
Args:
63+
sources(list): A list of media sources to be played
64+
poster(str): The url to the image that is displayed before playing
65+
altText(str): Alternative text for this component
66+
height(BlockElementHeight): The height of this block element
67+
separator(bool): Draw a separating line when set to true
68+
spacing(Spacing): Specify the spacing of this component
69+
id(str): The id of this component
70+
"""
71+
# Check types
72+
check_type(sources, MediaSource, True, False)
73+
check_type(poster, str, False, True)
74+
check_type(altText, str, False, True)
75+
check_type(height, BlockElementHeight, False, True)
76+
check_type(separator, bool, False, True)
77+
check_type(spacing, Spacing, False, True)
78+
check_type(id, str, False, True)
79+
5880
self.type = "Media"
5981
self.sources = sources #Needs to be a list of media sources
6082
self.poster = poster

0 commit comments

Comments
 (0)