Skip to content

Commit 900fd37

Browse files
author
ask-pyth
committed
Release 1.9.0. For changelog, check CHANGELOG.rst
1 parent 80ab62f commit 900fd37

File tree

14 files changed

+659
-6
lines changed

14 files changed

+659
-6
lines changed

ask-sdk-model/CHANGELOG.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,15 @@ This release contains the following changes :
121121
1.8.0
122122
~~~~~~~
123123

124-
This release contains the following changes :
124+
This release contains the following :
125+
Introduces support for customizing your skill’s experience for Echo Auto, which is now shipping to select customers via our invite program, and vehicles and other aftermarket devices that support Alexa Auto.
126+
The automotive experience introduces another way for customers to interact with skills, while they are on-the-go and their attention is on the road. Now you can adapt your skill experience to be succinct, location-aware, and adaptive to your customer’s needs while they’re outside the home.
125127

126-
- Introduces support for customizing your skill’s experience for Echo Auto, which is now shipping to select customers via our invite program, and vehicles and other aftermarket devices that support Alexa Auto.
127-
- The automotive experience introduces another way for customers to interact with skills, while they are on-the-go and their attention is on the road. Now you can adapt your skill experience to be succinct, location-aware, and adaptive to your customer’s needs while they’re outside the home.
128+
129+
1.9.0
130+
~~~~~~~
131+
132+
This release contains the following changes :
133+
134+
- Dynamic entities for customized interactions
135+
- Add additional 'entitlementReason' field in In-Skill products

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.8.0'
17+
__version__ = '1.9.0'
1818
__author__ = 'Alexa Skills Kit'
1919
__author_email__ = 'ask-sdk-dynamic@amazon.com'
2020
__license__ = 'Apache 2.0'

ask-sdk-model/ask_sdk_model/dialog/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
from .confirm_slot_directive import ConfirmSlotDirective
1919
from .elicit_slot_directive import ElicitSlotDirective
2020
from .confirm_intent_directive import ConfirmIntentDirective
21+
from .dynamic_entities_directive import DynamicEntitiesDirective
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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+
from ask_sdk_model.directive import Directive
22+
23+
24+
if typing.TYPE_CHECKING:
25+
from typing import Dict, List, Optional
26+
from datetime import datetime
27+
from ask_sdk_model.er.dynamic.update_behavior import UpdateBehavior
28+
from ask_sdk_model.er.dynamic.entity_list_item import EntityListItem
29+
30+
31+
class DynamicEntitiesDirective(Directive):
32+
"""
33+
34+
:param update_behavior:
35+
:type update_behavior: (optional) ask_sdk_model.er.dynamic.update_behavior.UpdateBehavior
36+
:param types:
37+
:type types: (optional) list[ask_sdk_model.er.dynamic.entity_list_item.EntityListItem]
38+
39+
"""
40+
deserialized_types = {
41+
'object_type': 'str',
42+
'update_behavior': 'ask_sdk_model.er.dynamic.update_behavior.UpdateBehavior',
43+
'types': 'list[ask_sdk_model.er.dynamic.entity_list_item.EntityListItem]'
44+
}
45+
46+
attribute_map = {
47+
'object_type': 'type',
48+
'update_behavior': 'updateBehavior',
49+
'types': 'types'
50+
}
51+
52+
def __init__(self, update_behavior=None, types=None):
53+
# type: (Optional[UpdateBehavior], Optional[List[EntityListItem]]) -> None
54+
"""
55+
56+
:param update_behavior:
57+
:type update_behavior: (optional) ask_sdk_model.er.dynamic.update_behavior.UpdateBehavior
58+
:param types:
59+
:type types: (optional) list[ask_sdk_model.er.dynamic.entity_list_item.EntityListItem]
60+
"""
61+
self.__discriminator_value = "Dialog.UpdateDynamicEntities"
62+
63+
self.object_type = self.__discriminator_value
64+
super(DynamicEntitiesDirective, self).__init__(object_type=self.__discriminator_value)
65+
self.update_behavior = update_behavior
66+
self.types = types
67+
68+
def to_dict(self):
69+
# type: () -> Dict[str, object]
70+
"""Returns the model properties as a dict"""
71+
result = {}
72+
73+
for attr, _ in six.iteritems(self.deserialized_types):
74+
value = getattr(self, attr)
75+
if isinstance(value, list):
76+
result[attr] = list(map(
77+
lambda x: x.to_dict() if hasattr(x, "to_dict") else
78+
x.value if isinstance(x, Enum) else x,
79+
value
80+
))
81+
elif isinstance(value, Enum):
82+
result[attr] = value.value
83+
elif hasattr(value, "to_dict"):
84+
result[attr] = value.to_dict()
85+
elif isinstance(value, dict):
86+
result[attr] = dict(map(
87+
lambda item: (item[0], item[1].to_dict())
88+
if hasattr(item[1], "to_dict") else
89+
(item[0], item[1].value)
90+
if isinstance(item[1], Enum) else item,
91+
value.items()
92+
))
93+
else:
94+
result[attr] = value
95+
96+
return result
97+
98+
def to_str(self):
99+
# type: () -> str
100+
"""Returns the string representation of the model"""
101+
return pprint.pformat(self.to_dict())
102+
103+
def __repr__(self):
104+
# type: () -> str
105+
"""For `print` and `pprint`"""
106+
return self.to_str()
107+
108+
def __eq__(self, other):
109+
# type: (object) -> bool
110+
"""Returns true if both objects are equal"""
111+
if not isinstance(other, DynamicEntitiesDirective):
112+
return False
113+
114+
return self.__dict__ == other.__dict__
115+
116+
def __ne__(self, other):
117+
# type: (object) -> bool
118+
"""Returns true if both objects are not equal"""
119+
return not self == other

ask-sdk-model/ask_sdk_model/directive.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class Directive(object):
4747
|
4848
| Connections.SendRequest: :py:class:`ask_sdk_model.interfaces.connections.send_request_directive.SendRequestDirective`,
4949
|
50+
| Dialog.UpdateDynamicEntities: :py:class:`ask_sdk_model.dialog.dynamic_entities_directive.DynamicEntitiesDirective`,
51+
|
5052
| Display.RenderTemplate: :py:class:`ask_sdk_model.interfaces.display.render_template_directive.RenderTemplateDirective`,
5153
|
5254
| GadgetController.SetLight: :py:class:`ask_sdk_model.interfaces.gadget_controller.set_light_directive.SetLightDirective`,
@@ -86,6 +88,7 @@ class Directive(object):
8688
'AudioPlayer.Play': 'ask_sdk_model.interfaces.audioplayer.play_directive.PlayDirective',
8789
'Alexa.Presentation.APL.ExecuteCommands': 'ask_sdk_model.interfaces.alexa.presentation.apl.execute_commands_directive.ExecuteCommandsDirective',
8890
'Connections.SendRequest': 'ask_sdk_model.interfaces.connections.send_request_directive.SendRequestDirective',
91+
'Dialog.UpdateDynamicEntities': 'ask_sdk_model.dialog.dynamic_entities_directive.DynamicEntitiesDirective',
8992
'Display.RenderTemplate': 'ask_sdk_model.interfaces.display.render_template_directive.RenderTemplateDirective',
9093
'GadgetController.SetLight': 'ask_sdk_model.interfaces.gadget_controller.set_light_directive.SetLightDirective',
9194
'Dialog.Delegate': 'ask_sdk_model.dialog.delegate_directive.DelegateDirective',
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# coding: utf-8
2+
3+
#
4+
# Copyright 2018 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+
from __future__ import absolute_import
16+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# coding: utf-8
2+
3+
#
4+
# Copyright 2018 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+
from __future__ import absolute_import
16+
17+
from .entity_value_and_synonyms import EntityValueAndSynonyms
18+
from .update_behavior import UpdateBehavior
19+
from .entity_list_item import EntityListItem
20+
from .entity import Entity
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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
25+
from datetime import datetime
26+
from ask_sdk_model.er.dynamic.entity_value_and_synonyms import EntityValueAndSynonyms
27+
28+
29+
class Entity(object):
30+
"""
31+
Represents an entity that the skill wants to store. An entity has an optional Id and the value and the synonyms for the entity
32+
33+
34+
:param id: An unique id associated with the entity
35+
:type id: (optional) str
36+
:param name:
37+
:type name: (optional) ask_sdk_model.er.dynamic.entity_value_and_synonyms.EntityValueAndSynonyms
38+
39+
"""
40+
deserialized_types = {
41+
'id': 'str',
42+
'name': 'ask_sdk_model.er.dynamic.entity_value_and_synonyms.EntityValueAndSynonyms'
43+
}
44+
45+
attribute_map = {
46+
'id': 'id',
47+
'name': 'name'
48+
}
49+
50+
def __init__(self, id=None, name=None):
51+
# type: (Optional[str], Optional[EntityValueAndSynonyms]) -> None
52+
"""Represents an entity that the skill wants to store. An entity has an optional Id and the value and the synonyms for the entity
53+
54+
:param id: An unique id associated with the entity
55+
:type id: (optional) str
56+
:param name:
57+
:type name: (optional) ask_sdk_model.er.dynamic.entity_value_and_synonyms.EntityValueAndSynonyms
58+
"""
59+
self.__discriminator_value = None
60+
61+
self.id = id
62+
self.name = name
63+
64+
def to_dict(self):
65+
# type: () -> Dict[str, object]
66+
"""Returns the model properties as a dict"""
67+
result = {}
68+
69+
for attr, _ in six.iteritems(self.deserialized_types):
70+
value = getattr(self, attr)
71+
if isinstance(value, list):
72+
result[attr] = list(map(
73+
lambda x: x.to_dict() if hasattr(x, "to_dict") else
74+
x.value if isinstance(x, Enum) else x,
75+
value
76+
))
77+
elif isinstance(value, Enum):
78+
result[attr] = value.value
79+
elif hasattr(value, "to_dict"):
80+
result[attr] = value.to_dict()
81+
elif isinstance(value, dict):
82+
result[attr] = dict(map(
83+
lambda item: (item[0], item[1].to_dict())
84+
if hasattr(item[1], "to_dict") else
85+
(item[0], item[1].value)
86+
if isinstance(item[1], Enum) else item,
87+
value.items()
88+
))
89+
else:
90+
result[attr] = value
91+
92+
return result
93+
94+
def to_str(self):
95+
# type: () -> str
96+
"""Returns the string representation of the model"""
97+
return pprint.pformat(self.to_dict())
98+
99+
def __repr__(self):
100+
# type: () -> str
101+
"""For `print` and `pprint`"""
102+
return self.to_str()
103+
104+
def __eq__(self, other):
105+
# type: (object) -> bool
106+
"""Returns true if both objects are equal"""
107+
if not isinstance(other, Entity):
108+
return False
109+
110+
return self.__dict__ == other.__dict__
111+
112+
def __ne__(self, other):
113+
# type: (object) -> bool
114+
"""Returns true if both objects are not equal"""
115+
return not self == other

0 commit comments

Comments
 (0)