Skip to content

Commit 2749b29

Browse files
author
ask-pyth
committed
Release 1.18.1. For changelog, check CHANGELOG.rst
1 parent 1128bfe commit 2749b29

38 files changed

+2411
-173
lines changed

ask-sdk-model/CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,11 @@ This release contains the following changes :
240240
This release contains the following changes:
241241

242242
- support for `personalization <https://developer.amazon.com/docs/custom-skills/add-personalization-to-your-skill.html#invocation-request-examples>`__ in the skill.
243+
244+
245+
1.18.1
246+
^^^^^^^
247+
248+
This release contains the following changes :
249+
250+
- Models for APL visual context.

ask-sdk-model/ask_sdk_model/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
__pip_package_name__ = 'ask-sdk-model'
1515
__description__ = 'The ASK SDK Model package provides model definitions, for building Alexa Skills.'
1616
__url__ = 'https://github.com/alexa/alexa-apis-for-python'
17-
__version__ = '1.18.0'
17+
__version__ = '1.18.1'
1818
__author__ = 'Alexa Skills Kit'
1919
__author_email__ = 'ask-sdk-dynamic@amazon.com'
2020
__license__ = 'Apache 2.0'

ask-sdk-model/ask_sdk_model/context.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
if typing.TYPE_CHECKING:
2424
from typing import Dict, List, Optional, Union
2525
from datetime import datetime
26+
from ask_sdk_model.interfaces.alexa.presentation.apl.rendered_document_state import RenderedDocumentState
2627
from ask_sdk_model.interfaces.system.system_state import SystemState
2728
from ask_sdk_model.interfaces.automotive.automotive_state import AutomotiveState
2829
from ask_sdk_model.interfaces.geolocation.geolocation_state import GeolocationState
@@ -37,6 +38,8 @@ class Context(object):
3738
3839
:param system: Provides information about the current state of the Alexa service and the device interacting with your skill.
3940
:type system: (optional) ask_sdk_model.interfaces.system.system_state.SystemState
41+
:param alexa_presentation_apl: Provides the current state for the Alexa.Presentation.APL interface.
42+
:type alexa_presentation_apl: (optional) ask_sdk_model.interfaces.alexa.presentation.apl.rendered_document_state.RenderedDocumentState
4043
:param audio_player: Provides the current state for the AudioPlayer interface.
4144
:type audio_player: (optional) ask_sdk_model.interfaces.audioplayer.audio_player_state.AudioPlayerState
4245
:param automotive: Provides the automotive specific information of the device.
@@ -53,6 +56,7 @@ class Context(object):
5356
"""
5457
deserialized_types = {
5558
'system': 'ask_sdk_model.interfaces.system.system_state.SystemState',
59+
'alexa_presentation_apl': 'ask_sdk_model.interfaces.alexa.presentation.apl.rendered_document_state.RenderedDocumentState',
5660
'audio_player': 'ask_sdk_model.interfaces.audioplayer.audio_player_state.AudioPlayerState',
5761
'automotive': 'ask_sdk_model.interfaces.automotive.automotive_state.AutomotiveState',
5862
'display': 'ask_sdk_model.interfaces.display.display_state.DisplayState',
@@ -63,6 +67,7 @@ class Context(object):
6367

6468
attribute_map = {
6569
'system': 'System',
70+
'alexa_presentation_apl': 'Alexa.Presentation.APL',
6671
'audio_player': 'AudioPlayer',
6772
'automotive': 'Automotive',
6873
'display': 'Display',
@@ -71,12 +76,14 @@ class Context(object):
7176
'viewports': 'Viewports'
7277
} # type: Dict
7378

74-
def __init__(self, system=None, audio_player=None, automotive=None, display=None, geolocation=None, viewport=None, viewports=None):
75-
# type: (Optional[SystemState], Optional[AudioPlayerState], Optional[AutomotiveState], Optional[DisplayState], Optional[GeolocationState], Optional[ViewportState], Optional[List[TypedViewportState]]) -> None
79+
def __init__(self, system=None, alexa_presentation_apl=None, audio_player=None, automotive=None, display=None, geolocation=None, viewport=None, viewports=None):
80+
# type: (Optional[SystemState], Optional[RenderedDocumentState], Optional[AudioPlayerState], Optional[AutomotiveState], Optional[DisplayState], Optional[GeolocationState], Optional[ViewportState], Optional[List[TypedViewportState]]) -> None
7681
"""
7782
7883
:param system: Provides information about the current state of the Alexa service and the device interacting with your skill.
7984
:type system: (optional) ask_sdk_model.interfaces.system.system_state.SystemState
85+
:param alexa_presentation_apl: Provides the current state for the Alexa.Presentation.APL interface.
86+
:type alexa_presentation_apl: (optional) ask_sdk_model.interfaces.alexa.presentation.apl.rendered_document_state.RenderedDocumentState
8087
:param audio_player: Provides the current state for the AudioPlayer interface.
8188
:type audio_player: (optional) ask_sdk_model.interfaces.audioplayer.audio_player_state.AudioPlayerState
8289
:param automotive: Provides the automotive specific information of the device.
@@ -93,6 +100,7 @@ def __init__(self, system=None, audio_player=None, automotive=None, display=None
93100
self.__discriminator_value = None # type: str
94101

95102
self.system = system
103+
self.alexa_presentation_apl = alexa_presentation_apl
96104
self.audio_player = audio_player
97105
self.automotive = automotive
98106
self.display = display

ask-sdk-model/ask_sdk_model/directive.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class Directive(object):
3939
4040
| CustomInterfaceController.StopEventHandler: :py:class:`ask_sdk_model.interfaces.custom_interface_controller.stop_event_handler_directive.StopEventHandlerDirective`,
4141
|
42+
| Navigation.Assistance.AnnounceRoadRegulation: :py:class:`ask_sdk_model.interfaces.navigation.assistance.announce_road_regulation.AnnounceRoadRegulation`,
43+
|
4244
| Connections.SendRequest: :py:class:`ask_sdk_model.interfaces.connections.send_request_directive.SendRequestDirective`,
4345
|
4446
| Dialog.UpdateDynamicEntities: :py:class:`ask_sdk_model.dialog.dynamic_entities_directive.DynamicEntitiesDirective`,
@@ -98,6 +100,7 @@ class Directive(object):
98100

99101
discriminator_value_class_map = {
100102
'CustomInterfaceController.StopEventHandler': 'ask_sdk_model.interfaces.custom_interface_controller.stop_event_handler_directive.StopEventHandlerDirective',
103+
'Navigation.Assistance.AnnounceRoadRegulation': 'ask_sdk_model.interfaces.navigation.assistance.announce_road_regulation.AnnounceRoadRegulation',
101104
'Connections.SendRequest': 'ask_sdk_model.interfaces.connections.send_request_directive.SendRequestDirective',
102105
'Dialog.UpdateDynamicEntities': 'ask_sdk_model.dialog.dynamic_entities_directive.DynamicEntitiesDirective',
103106
'CustomInterfaceController.StartEventHandler': 'ask_sdk_model.interfaces.custom_interface_controller.start_event_handler_directive.StartEventHandlerDirective',

ask-sdk-model/ask_sdk_model/interfaces/alexa/presentation/apl/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414
#
1515
from __future__ import absolute_import
1616

17+
from .component_visible_on_screen_media_tag_state_enum import ComponentVisibleOnScreenMediaTagStateEnum
18+
from .component_visible_on_screen_pager_tag import ComponentVisibleOnScreenPagerTag
1719
from .position import Position
1820
from .idle_command import IdleCommand
1921
from .open_url_command import OpenUrlCommand
2022
from .user_event import UserEvent
2123
from .play_media_command import PlayMediaCommand
24+
from .component_visible_on_screen import ComponentVisibleOnScreen
2225
from .render_document_directive import RenderDocumentDirective
2326
from .audio_track import AudioTrack
2427
from .parallel_command import ParallelCommand
@@ -33,24 +36,33 @@
3336
from .skew_transform_property import SkewTransformProperty
3437
from .animated_transform_property import AnimatedTransformProperty
3538
from .animate_item_command import AnimateItemCommand
39+
from .component_visible_on_screen_media_tag import ComponentVisibleOnScreenMediaTag
3640
from .transform_property import TransformProperty
3741
from .align import Align
3842
from .highlight_mode import HighlightMode
3943
from .sequential_command import SequentialCommand
4044
from .runtime import Runtime
4145
from .execute_commands_directive import ExecuteCommandsDirective
46+
from .component_visible_on_screen_scrollable_tag import ComponentVisibleOnScreenScrollableTag
4247
from .move_transform_property import MoveTransformProperty
4348
from .clear_focus_command import ClearFocusCommand
49+
from .component_entity import ComponentEntity
4450
from .command import Command
4551
from .set_focus_command import SetFocusCommand
4652
from .control_media_command import ControlMediaCommand
53+
from .component_visible_on_screen_list_tag import ComponentVisibleOnScreenListTag
4754
from .set_page_command import SetPageCommand
55+
from .component_visible_on_screen_list_item_tag import ComponentVisibleOnScreenListItemTag
56+
from .component_visible_on_screen_scrollable_tag_direction_enum import ComponentVisibleOnScreenScrollableTagDirectionEnum
4857
from .scale_transform_property import ScaleTransformProperty
4958
from .send_event_command import SendEventCommand
59+
from .component_visible_on_screen_tags import ComponentVisibleOnScreenTags
5060
from .alexa_presentation_apl_interface import AlexaPresentationAplInterface
61+
from .component_visible_on_screen_viewport_tag import ComponentVisibleOnScreenViewportTag
5162
from .set_state_command import SetStateCommand
5263
from .rotate_transform_property import RotateTransformProperty
5364
from .scroll_to_index_command import ScrollToIndexCommand
5465
from .speak_list_command import SpeakListCommand
5566
from .media_command_type import MediaCommandType
67+
from .rendered_document_state import RenderedDocumentState
5668
from .component_state import ComponentState
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# coding: utf-8
2+
3+
#
4+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
7+
# except in compliance with the License. A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
13+
# the specific language governing permissions and limitations under the License.
14+
#
15+
16+
import pprint
17+
import re # noqa: F401
18+
import six
19+
import typing
20+
from enum import Enum
21+
22+
23+
if typing.TYPE_CHECKING:
24+
from typing import Dict, List, Optional, Union
25+
from datetime import datetime
26+
27+
28+
class ComponentEntity(object):
29+
"""
30+
The entity context data which was attached to an element.
31+
32+
33+
:param object_type:
34+
:type object_type: (optional) str
35+
:param value:
36+
:type value: (optional) str
37+
:param id:
38+
:type id: (optional) str
39+
40+
"""
41+
deserialized_types = {
42+
'object_type': 'str',
43+
'value': 'str',
44+
'id': 'str'
45+
} # type: Dict
46+
47+
attribute_map = {
48+
'object_type': 'type',
49+
'value': 'value',
50+
'id': 'id'
51+
} # type: Dict
52+
53+
def __init__(self, object_type=None, value=None, id=None):
54+
# type: (Optional[str], Optional[str], Optional[str]) -> None
55+
"""The entity context data which was attached to an element.
56+
57+
:param object_type:
58+
:type object_type: (optional) str
59+
:param value:
60+
:type value: (optional) str
61+
:param id:
62+
:type id: (optional) str
63+
"""
64+
self.__discriminator_value = None # type: str
65+
66+
self.object_type = object_type
67+
self.value = value
68+
self.id = id
69+
70+
def to_dict(self):
71+
# type: () -> Dict[str, object]
72+
"""Returns the model properties as a dict"""
73+
result = {} # type: Dict
74+
75+
for attr, _ in six.iteritems(self.deserialized_types):
76+
value = getattr(self, attr)
77+
if isinstance(value, list):
78+
result[attr] = list(map(
79+
lambda x: x.to_dict() if hasattr(x, "to_dict") else
80+
x.value if isinstance(x, Enum) else x,
81+
value
82+
))
83+
elif isinstance(value, Enum):
84+
result[attr] = value.value
85+
elif hasattr(value, "to_dict"):
86+
result[attr] = value.to_dict()
87+
elif isinstance(value, dict):
88+
result[attr] = dict(map(
89+
lambda item: (item[0], item[1].to_dict())
90+
if hasattr(item[1], "to_dict") else
91+
(item[0], item[1].value)
92+
if isinstance(item[1], Enum) else item,
93+
value.items()
94+
))
95+
else:
96+
result[attr] = value
97+
98+
return result
99+
100+
def to_str(self):
101+
# type: () -> str
102+
"""Returns the string representation of the model"""
103+
return pprint.pformat(self.to_dict())
104+
105+
def __repr__(self):
106+
# type: () -> str
107+
"""For `print` and `pprint`"""
108+
return self.to_str()
109+
110+
def __eq__(self, other):
111+
# type: (object) -> bool
112+
"""Returns true if both objects are equal"""
113+
if not isinstance(other, ComponentEntity):
114+
return False
115+
116+
return self.__dict__ == other.__dict__
117+
118+
def __ne__(self, other):
119+
# type: (object) -> bool
120+
"""Returns true if both objects are not equal"""
121+
return not self == other

0 commit comments

Comments
 (0)