Skip to content

Commit

Permalink
Release 1.18.1. For changelog, check CHANGELOG.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
ask-pyth committed Nov 5, 2019
1 parent 1128bfe commit 2749b29
Show file tree
Hide file tree
Showing 38 changed files with 2,411 additions and 173 deletions.
8 changes: 8 additions & 0 deletions ask-sdk-model/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,11 @@ This release contains the following changes :
This release contains the following changes:

- support for `personalization <https://developer.amazon.com/docs/custom-skills/add-personalization-to-your-skill.html#invocation-request-examples>`__ in the skill.


1.18.1
^^^^^^^

This release contains the following changes :

- Models for APL visual context.
2 changes: 1 addition & 1 deletion ask-sdk-model/ask_sdk_model/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.18.0'
__version__ = '1.18.1'
__author__ = 'Alexa Skills Kit'
__author_email__ = 'ask-sdk-dynamic@amazon.com'
__license__ = 'Apache 2.0'
Expand Down
12 changes: 10 additions & 2 deletions ask-sdk-model/ask_sdk_model/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
if typing.TYPE_CHECKING:
from typing import Dict, List, Optional, Union
from datetime import datetime
from ask_sdk_model.interfaces.alexa.presentation.apl.rendered_document_state import RenderedDocumentState
from ask_sdk_model.interfaces.system.system_state import SystemState
from ask_sdk_model.interfaces.automotive.automotive_state import AutomotiveState
from ask_sdk_model.interfaces.geolocation.geolocation_state import GeolocationState
Expand All @@ -37,6 +38,8 @@ class Context(object):
:param system: Provides information about the current state of the Alexa service and the device interacting with your skill.
:type system: (optional) ask_sdk_model.interfaces.system.system_state.SystemState
:param alexa_presentation_apl: Provides the current state for the Alexa.Presentation.APL interface.
:type alexa_presentation_apl: (optional) ask_sdk_model.interfaces.alexa.presentation.apl.rendered_document_state.RenderedDocumentState
:param audio_player: Provides the current state for the AudioPlayer interface.
:type audio_player: (optional) ask_sdk_model.interfaces.audioplayer.audio_player_state.AudioPlayerState
:param automotive: Provides the automotive specific information of the device.
Expand All @@ -53,6 +56,7 @@ class Context(object):
"""
deserialized_types = {
'system': 'ask_sdk_model.interfaces.system.system_state.SystemState',
'alexa_presentation_apl': 'ask_sdk_model.interfaces.alexa.presentation.apl.rendered_document_state.RenderedDocumentState',
'audio_player': 'ask_sdk_model.interfaces.audioplayer.audio_player_state.AudioPlayerState',
'automotive': 'ask_sdk_model.interfaces.automotive.automotive_state.AutomotiveState',
'display': 'ask_sdk_model.interfaces.display.display_state.DisplayState',
Expand All @@ -63,6 +67,7 @@ class Context(object):

attribute_map = {
'system': 'System',
'alexa_presentation_apl': 'Alexa.Presentation.APL',
'audio_player': 'AudioPlayer',
'automotive': 'Automotive',
'display': 'Display',
Expand All @@ -71,12 +76,14 @@ class Context(object):
'viewports': 'Viewports'
} # type: Dict

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

self.system = system
self.alexa_presentation_apl = alexa_presentation_apl
self.audio_player = audio_player
self.automotive = automotive
self.display = display
Expand Down
3 changes: 3 additions & 0 deletions ask-sdk-model/ask_sdk_model/directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class Directive(object):
| CustomInterfaceController.StopEventHandler: :py:class:`ask_sdk_model.interfaces.custom_interface_controller.stop_event_handler_directive.StopEventHandlerDirective`,
|
| Navigation.Assistance.AnnounceRoadRegulation: :py:class:`ask_sdk_model.interfaces.navigation.assistance.announce_road_regulation.AnnounceRoadRegulation`,
|
| Connections.SendRequest: :py:class:`ask_sdk_model.interfaces.connections.send_request_directive.SendRequestDirective`,
|
| Dialog.UpdateDynamicEntities: :py:class:`ask_sdk_model.dialog.dynamic_entities_directive.DynamicEntitiesDirective`,
Expand Down Expand Up @@ -98,6 +100,7 @@ class Directive(object):

discriminator_value_class_map = {
'CustomInterfaceController.StopEventHandler': 'ask_sdk_model.interfaces.custom_interface_controller.stop_event_handler_directive.StopEventHandlerDirective',
'Navigation.Assistance.AnnounceRoadRegulation': 'ask_sdk_model.interfaces.navigation.assistance.announce_road_regulation.AnnounceRoadRegulation',
'Connections.SendRequest': 'ask_sdk_model.interfaces.connections.send_request_directive.SendRequestDirective',
'Dialog.UpdateDynamicEntities': 'ask_sdk_model.dialog.dynamic_entities_directive.DynamicEntitiesDirective',
'CustomInterfaceController.StartEventHandler': 'ask_sdk_model.interfaces.custom_interface_controller.start_event_handler_directive.StartEventHandlerDirective',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
#
from __future__ import absolute_import

from .component_visible_on_screen_media_tag_state_enum import ComponentVisibleOnScreenMediaTagStateEnum
from .component_visible_on_screen_pager_tag import ComponentVisibleOnScreenPagerTag
from .position import Position
from .idle_command import IdleCommand
from .open_url_command import OpenUrlCommand
from .user_event import UserEvent
from .play_media_command import PlayMediaCommand
from .component_visible_on_screen import ComponentVisibleOnScreen
from .render_document_directive import RenderDocumentDirective
from .audio_track import AudioTrack
from .parallel_command import ParallelCommand
Expand All @@ -33,24 +36,33 @@
from .skew_transform_property import SkewTransformProperty
from .animated_transform_property import AnimatedTransformProperty
from .animate_item_command import AnimateItemCommand
from .component_visible_on_screen_media_tag import ComponentVisibleOnScreenMediaTag
from .transform_property import TransformProperty
from .align import Align
from .highlight_mode import HighlightMode
from .sequential_command import SequentialCommand
from .runtime import Runtime
from .execute_commands_directive import ExecuteCommandsDirective
from .component_visible_on_screen_scrollable_tag import ComponentVisibleOnScreenScrollableTag
from .move_transform_property import MoveTransformProperty
from .clear_focus_command import ClearFocusCommand
from .component_entity import ComponentEntity
from .command import Command
from .set_focus_command import SetFocusCommand
from .control_media_command import ControlMediaCommand
from .component_visible_on_screen_list_tag import ComponentVisibleOnScreenListTag
from .set_page_command import SetPageCommand
from .component_visible_on_screen_list_item_tag import ComponentVisibleOnScreenListItemTag
from .component_visible_on_screen_scrollable_tag_direction_enum import ComponentVisibleOnScreenScrollableTagDirectionEnum
from .scale_transform_property import ScaleTransformProperty
from .send_event_command import SendEventCommand
from .component_visible_on_screen_tags import ComponentVisibleOnScreenTags
from .alexa_presentation_apl_interface import AlexaPresentationAplInterface
from .component_visible_on_screen_viewport_tag import ComponentVisibleOnScreenViewportTag
from .set_state_command import SetStateCommand
from .rotate_transform_property import RotateTransformProperty
from .scroll_to_index_command import ScrollToIndexCommand
from .speak_list_command import SpeakListCommand
from .media_command_type import MediaCommandType
from .rendered_document_state import RenderedDocumentState
from .component_state import ComponentState
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# 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, Union
from datetime import datetime


class ComponentEntity(object):
"""
The entity context data which was attached to an element.
:param object_type:
:type object_type: (optional) str
:param value:
:type value: (optional) str
:param id:
:type id: (optional) str
"""
deserialized_types = {
'object_type': 'str',
'value': 'str',
'id': 'str'
} # type: Dict

attribute_map = {
'object_type': 'type',
'value': 'value',
'id': 'id'
} # type: Dict

def __init__(self, object_type=None, value=None, id=None):
# type: (Optional[str], Optional[str], Optional[str]) -> None
"""The entity context data which was attached to an element.
:param object_type:
:type object_type: (optional) str
:param value:
:type value: (optional) str
:param id:
:type id: (optional) str
"""
self.__discriminator_value = None # type: str

self.object_type = object_type
self.value = value
self.id = id

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, ComponentEntity):
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
Loading

0 comments on commit 2749b29

Please sign in to comment.