diff --git a/ask-sdk-model/CHANGELOG.rst b/ask-sdk-model/CHANGELOG.rst index 43a797a..a9133dc 100644 --- a/ask-sdk-model/CHANGELOG.rst +++ b/ask-sdk-model/CHANGELOG.rst @@ -153,3 +153,9 @@ This release includes the following : - Fixing the imports under `reminder_management` service, to deserialize the reminders correctly. + + +1.10.2 +^^^^^^^ + +- Added video codecs information in the APL Viewport Characteristic `Video property `__. diff --git a/ask-sdk-model/ask_sdk_model/__version__.py b/ask-sdk-model/ask_sdk_model/__version__.py index c33d45c..c54eaf1 100644 --- a/ask-sdk-model/ask_sdk_model/__version__.py +++ b/ask-sdk-model/ask_sdk_model/__version__.py @@ -14,7 +14,7 @@ __pip_package_name__ = 'ask-sdk-model' __description__ = 'The ASK SDK Model package provides model definitions, for building Alexa Skills.' __url__ = 'https://github.com/alexa/alexa-apis-for-python' -__version__ = '1.10.1' +__version__ = '1.10.2' __author__ = 'Alexa Skills Kit' __author_email__ = 'ask-sdk-dynamic@amazon.com' __license__ = 'Apache 2.0' diff --git a/ask-sdk-model/ask_sdk_model/interfaces/viewport/__init__.py b/ask-sdk-model/ask_sdk_model/interfaces/viewport/__init__.py index e929773..6dd9dde 100644 --- a/ask-sdk-model/ask_sdk_model/interfaces/viewport/__init__.py +++ b/ask-sdk-model/ask_sdk_model/interfaces/viewport/__init__.py @@ -17,5 +17,6 @@ from .touch import Touch from .shape import Shape from .keyboard import Keyboard +from .viewport_state_video import Video from .viewport_state import ViewportState from .experience import Experience diff --git a/ask-sdk-model/ask_sdk_model/interfaces/viewport/video/__init__.py b/ask-sdk-model/ask_sdk_model/interfaces/viewport/video/__init__.py new file mode 100644 index 0000000..1fb1fe3 --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/interfaces/viewport/video/__init__.py @@ -0,0 +1,17 @@ +# coding: utf-8 + +# +# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the 'License'). You may not use this file +# except in compliance with the License. A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for +# the specific language governing permissions and limitations under the License. +# +from __future__ import absolute_import + +from .codecs import Codecs diff --git a/ask-sdk-model/ask_sdk_model/interfaces/viewport/video/codecs.py b/ask-sdk-model/ask_sdk_model/interfaces/viewport/video/codecs.py new file mode 100644 index 0000000..e29ad8f --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/interfaces/viewport/video/codecs.py @@ -0,0 +1,66 @@ +# coding: utf-8 + +# +# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file +# except in compliance with the License. A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for +# the specific language governing permissions and limitations under the License. +# + +import pprint +import re # noqa: F401 +import six +import typing +from enum import Enum + + +if typing.TYPE_CHECKING: + from typing import Dict, List, Optional + from datetime import datetime + + +class Codecs(Enum): + """ + A named bundle of codecs which are available for playing video on the viewport. + + + + Allowed enum values: [H_264_41, H_264_42] + """ + H_264_41 = "H_264_41" + H_264_42 = "H_264_42" + + def to_dict(self): + # type: () -> Dict[str, object] + """Returns the model properties as a dict""" + result = {self.name: self.value} + return result + + def to_str(self): + # type: () -> str + """Returns the string representation of the model""" + return pprint.pformat(self.value) + + def __repr__(self): + # type: () -> str + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + # type: (object) -> bool + """Returns true if both objects are equal""" + if not isinstance(other, Codecs): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + # type: (object) -> bool + """Returns true if both objects are not equal""" + return not self == other diff --git a/ask-sdk-model/ask_sdk_model/interfaces/viewport/video/py.typed b/ask-sdk-model/ask_sdk_model/interfaces/viewport/video/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/ask-sdk-model/ask_sdk_model/interfaces/viewport/viewport_state.py b/ask-sdk-model/ask_sdk_model/interfaces/viewport/viewport_state.py index f37060c..b7f1d63 100644 --- a/ask-sdk-model/ask_sdk_model/interfaces/viewport/viewport_state.py +++ b/ask-sdk-model/ask_sdk_model/interfaces/viewport/viewport_state.py @@ -27,6 +27,7 @@ from ask_sdk_model.interfaces.viewport.touch import Touch from ask_sdk_model.interfaces.viewport.keyboard import Keyboard from ask_sdk_model.interfaces.viewport.shape import Shape + from ask_sdk_model.interfaces.viewport.video import Video class ViewportState(object): @@ -52,6 +53,8 @@ class ViewportState(object): :type touch: (optional) list[ask_sdk_model.interfaces.viewport.touch.Touch] :param keyboard: The physical button input mechanisms supported by the device. An empty array indicates physical button input is unsupported. :type keyboard: (optional) list[ask_sdk_model.interfaces.viewport.keyboard.Keyboard] + :param video: + :type video: (optional) ask_sdk_model.interfaces.viewport.video.Video """ deserialized_types = { @@ -63,7 +66,8 @@ class ViewportState(object): 'current_pixel_width': 'float', 'current_pixel_height': 'float', 'touch': 'list[ask_sdk_model.interfaces.viewport.touch.Touch]', - 'keyboard': 'list[ask_sdk_model.interfaces.viewport.keyboard.Keyboard]' + 'keyboard': 'list[ask_sdk_model.interfaces.viewport.keyboard.Keyboard]', + 'video': 'ask_sdk_model.interfaces.viewport.video.Video' } # type: Dict attribute_map = { @@ -75,11 +79,12 @@ class ViewportState(object): 'current_pixel_width': 'currentPixelWidth', 'current_pixel_height': 'currentPixelHeight', 'touch': 'touch', - 'keyboard': 'keyboard' + 'keyboard': 'keyboard', + 'video': 'video' } # type: Dict - def __init__(self, experiences=None, shape=None, pixel_width=None, pixel_height=None, dpi=None, current_pixel_width=None, current_pixel_height=None, touch=None, keyboard=None): - # type: (Optional[List[Experience]], Optional[Shape], Optional[float], Optional[float], Optional[float], Optional[float], Optional[float], Optional[List[Touch]], Optional[List[Keyboard]]) -> None + def __init__(self, experiences=None, shape=None, pixel_width=None, pixel_height=None, dpi=None, current_pixel_width=None, current_pixel_height=None, touch=None, keyboard=None, video=None): + # type: (Optional[List[Experience]], Optional[Shape], Optional[float], Optional[float], Optional[float], Optional[float], Optional[float], Optional[List[Touch]], Optional[List[Keyboard]], Optional[Video]) -> None """This object contains the characteristics related to the device's viewport. :param experiences: The experiences supported by the device, in descending order of arcMinuteWidth and arcMinuteHeight. @@ -100,6 +105,8 @@ def __init__(self, experiences=None, shape=None, pixel_width=None, pixel_height= :type touch: (optional) list[ask_sdk_model.interfaces.viewport.touch.Touch] :param keyboard: The physical button input mechanisms supported by the device. An empty array indicates physical button input is unsupported. :type keyboard: (optional) list[ask_sdk_model.interfaces.viewport.keyboard.Keyboard] + :param video: + :type video: (optional) ask_sdk_model.interfaces.viewport.video.Video """ self.__discriminator_value = None # type: str @@ -112,6 +119,7 @@ def __init__(self, experiences=None, shape=None, pixel_width=None, pixel_height= self.current_pixel_height = current_pixel_height self.touch = touch self.keyboard = keyboard + self.video = video def to_dict(self): # type: () -> Dict[str, object] diff --git a/ask-sdk-model/ask_sdk_model/interfaces/viewport/viewport_state_video.py b/ask-sdk-model/ask_sdk_model/interfaces/viewport/viewport_state_video.py new file mode 100644 index 0000000..73feb0b --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/interfaces/viewport/viewport_state_video.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +# +# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file +# except in compliance with the License. A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for +# the specific language governing permissions and limitations under the License. +# + +import pprint +import re # noqa: F401 +import six +import typing +from enum import Enum + + +if typing.TYPE_CHECKING: + from typing import Dict, List, Optional + from datetime import datetime + from ask_sdk_model.interfaces.viewport.video.codecs import Codecs + + +class Video(object): + """ + Details of the technologies which are available for playing video on the device. + + + :param codecs: Codecs which are available for playing video on the device. + :type codecs: (optional) list[ask_sdk_model.interfaces.viewport.video.codecs.Codecs] + + """ + deserialized_types = { + 'codecs': 'list[ask_sdk_model.interfaces.viewport.video.codecs.Codecs]' + } # type: Dict + + attribute_map = { + 'codecs': 'codecs' + } # type: Dict + + def __init__(self, codecs=None): + # type: (Optional[List[Codecs]]) -> None + """Details of the technologies which are available for playing video on the device. + + :param codecs: Codecs which are available for playing video on the device. + :type codecs: (optional) list[ask_sdk_model.interfaces.viewport.video.codecs.Codecs] + """ + self.__discriminator_value = None # type: str + + self.codecs = codecs + + def to_dict(self): + # type: () -> Dict[str, object] + """Returns the model properties as a dict""" + result = {} # type: Dict + + for attr, _ in six.iteritems(self.deserialized_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else + x.value if isinstance(x, Enum) else x, + value + )) + elif isinstance(value, Enum): + result[attr] = value.value + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else + (item[0], item[1].value) + if isinstance(item[1], Enum) else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + # type: () -> str + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + # type: () -> str + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + # type: (object) -> bool + """Returns true if both objects are equal""" + if not isinstance(other, Video): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + # type: (object) -> bool + """Returns true if both objects are not equal""" + return not self == other