Skip to content

Commit fbb29c2

Browse files
author
ask-pyth
committed
Release 1.15.0. For changelog, check CHANGELOG.rst
1 parent 1d3ed27 commit fbb29c2

16 files changed

+696
-11
lines changed

ask-sdk-model/CHANGELOG.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,12 @@ This release contains the following changes :
207207
- Models for [Custom interfaces](https://developer.amazon.com/docs/alexa-gadgets-toolkit-preview/custom-interface.html). The custom interfaces feature enables Alexa Skill Developers to implement interactions between skills and gadgets using developer-defined directives and events.
208208

209209
- Added BillingAgreementType and SubscriptionAmount in BillingAgreementAttributes. This change is mandatory for skills in EU, and optional for NA and JP. With this upgrade, skill developers in EU can enjoy full benefits of the Amazon Pay solution that supports PSD2.
210+
211+
212+
1.15.0
213+
~~~~~~~
214+
215+
This release contains the following changes :
216+
- A new `mode property <https://developer.amazon.com/docs/alexa-presentation-language/apl-viewport-property.html#viewport_mode_property>`__ in APL viewports
217+
- The `gadget endpoint enumeration service <https://developer.amazon.com/es/docs/alexa-gadgets-toolkit/send-gadget-custom-directive-from-skill.html#call-endpoint-enumeration-api>`__
218+
- Fixing a bug in base service client that leads to exceptions for a HTTP 204 response.

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.14.0'
17+
__version__ = '1.15.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/interfaces/system/system_state.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class SystemState(object):
3737
:type user: (optional) ask_sdk_model.user.User
3838
:param device:
3939
:type device: (optional) ask_sdk_model.device.Device
40-
:param api_endpoint:
40+
:param api_endpoint: A string that references the correct base URI to refer to by region, for use with APIs such as the Device Location API and Progressive Response API.
4141
:type api_endpoint: (optional) str
42-
:param api_access_token:
42+
:param api_access_token: A bearer token string that can be used by the skill (during the skill session) to access Alexa APIs resources of the registered Alexa customer and/or person who is making the request. This token encapsulates the permissions authorized under the registered Alexa account and device, and (optionally) the recognized person. Some resources, such as name or email, require explicit customer consent.\&quot;
4343
:type api_access_token: (optional) str
4444
4545
"""
@@ -69,9 +69,9 @@ def __init__(self, application=None, user=None, device=None, api_endpoint=None,
6969
:type user: (optional) ask_sdk_model.user.User
7070
:param device:
7171
:type device: (optional) ask_sdk_model.device.Device
72-
:param api_endpoint:
72+
:param api_endpoint: A string that references the correct base URI to refer to by region, for use with APIs such as the Device Location API and Progressive Response API.
7373
:type api_endpoint: (optional) str
74-
:param api_access_token:
74+
:param api_access_token: A bearer token string that can be used by the skill (during the skill session) to access Alexa APIs resources of the registered Alexa customer and/or person who is making the request. This token encapsulates the permissions authorized under the registered Alexa account and device, and (optionally) the recognized person. Some resources, such as name or email, require explicit customer consent.\&quot;
7575
:type api_access_token: (optional) str
7676
"""
7777
self.__discriminator_value = None # type: str

ask-sdk-model/ask_sdk_model/interfaces/viewport/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from .touch import Touch
1818
from .shape import Shape
19+
from .mode import Mode
1920
from .keyboard import Keyboard
2021
from .viewport_state_video import Video
2122
from .viewport_state import ViewportState
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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 Mode(Enum):
29+
"""
30+
The expected use case of the device&#39;s viewport, encapsulating the available input mechanisms and user viewing distance.
31+
32+
33+
34+
Allowed enum values: [AUTO, HUB, MOBILE, PC, TV]
35+
"""
36+
AUTO = "AUTO"
37+
HUB = "HUB"
38+
MOBILE = "MOBILE"
39+
PC = "PC"
40+
TV = "TV"
41+
42+
def to_dict(self):
43+
# type: () -> Dict[str, object]
44+
"""Returns the model properties as a dict"""
45+
result = {self.name: self.value}
46+
return result
47+
48+
def to_str(self):
49+
# type: () -> str
50+
"""Returns the string representation of the model"""
51+
return pprint.pformat(self.value)
52+
53+
def __repr__(self):
54+
# type: () -> str
55+
"""For `print` and `pprint`"""
56+
return self.to_str()
57+
58+
def __eq__(self, other):
59+
# type: (object) -> bool
60+
"""Returns true if both objects are equal"""
61+
if not isinstance(other, Mode):
62+
return False
63+
64+
return self.__dict__ == other.__dict__
65+
66+
def __ne__(self, other):
67+
# type: (object) -> bool
68+
"""Returns true if both objects are not equal"""
69+
return not self == other

ask-sdk-model/ask_sdk_model/interfaces/viewport/viewport_state.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from ask_sdk_model.interfaces.viewport.keyboard import Keyboard
2929
from ask_sdk_model.interfaces.viewport.shape import Shape
3030
from ask_sdk_model.interfaces.viewport.viewport_state_video import Video
31+
from ask_sdk_model.interfaces.viewport.mode import Mode
3132

3233

3334
class ViewportState(object):
@@ -37,6 +38,8 @@ class ViewportState(object):
3738
3839
:param experiences: The experiences supported by the device, in descending order of arcMinuteWidth and arcMinuteHeight.
3940
:type experiences: (optional) list[ask_sdk_model.interfaces.viewport.experience.Experience]
41+
:param mode:
42+
:type mode: (optional) ask_sdk_model.interfaces.viewport.mode.Mode
4043
:param shape:
4144
:type shape: (optional) ask_sdk_model.interfaces.viewport.shape.Shape
4245
:param pixel_width: The number of pixels present in the viewport at its maximum width.
@@ -59,6 +62,7 @@ class ViewportState(object):
5962
"""
6063
deserialized_types = {
6164
'experiences': 'list[ask_sdk_model.interfaces.viewport.experience.Experience]',
65+
'mode': 'ask_sdk_model.interfaces.viewport.mode.Mode',
6266
'shape': 'ask_sdk_model.interfaces.viewport.shape.Shape',
6367
'pixel_width': 'float',
6468
'pixel_height': 'float',
@@ -72,6 +76,7 @@ class ViewportState(object):
7276

7377
attribute_map = {
7478
'experiences': 'experiences',
79+
'mode': 'mode',
7580
'shape': 'shape',
7681
'pixel_width': 'pixelWidth',
7782
'pixel_height': 'pixelHeight',
@@ -83,12 +88,14 @@ class ViewportState(object):
8388
'video': 'video'
8489
} # type: Dict
8590

86-
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):
87-
# 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
91+
def __init__(self, experiences=None, mode=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):
92+
# type: (Optional[List[Experience]], Optional[Mode], Optional[Shape], Optional[float], Optional[float], Optional[float], Optional[float], Optional[float], Optional[List[Touch]], Optional[List[Keyboard]], Optional[Video]) -> None
8893
"""This object contains the characteristics related to the device&#39;s viewport.
8994
9095
:param experiences: The experiences supported by the device, in descending order of arcMinuteWidth and arcMinuteHeight.
9196
:type experiences: (optional) list[ask_sdk_model.interfaces.viewport.experience.Experience]
97+
:param mode:
98+
:type mode: (optional) ask_sdk_model.interfaces.viewport.mode.Mode
9299
:param shape:
93100
:type shape: (optional) ask_sdk_model.interfaces.viewport.shape.Shape
94101
:param pixel_width: The number of pixels present in the viewport at its maximum width.
@@ -111,6 +118,7 @@ def __init__(self, experiences=None, shape=None, pixel_width=None, pixel_height=
111118
self.__discriminator_value = None # type: str
112119

113120
self.experiences = experiences
121+
self.mode = mode
114122
self.shape = shape
115123
self.pixel_width = pixel_width
116124
self.pixel_height = pixel_height

ask-sdk-model/ask_sdk_model/services/base_service_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ def invoke(
108108
if BaseServiceClient.__is_code_successful(response.status_code):
109109
if response_type is None:
110110
return None
111+
112+
# Body of HTTP 204 (No Content) response should be empty
113+
# Return None immediately, since body is not a valid json value to be deserialized
114+
if response.status_code == 204 and not response.body:
115+
return None
116+
111117
return self._serializer.deserialize(response.body, response_type)
112118

113119
if response_definitions:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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 .error import Error
18+
from .endpoint_capability import EndpointCapability
19+
from .endpoint_enumeration_response import EndpointEnumerationResponse
20+
from .endpoint_info import EndpointInfo
21+
from .endpoint_enumeration_service_client import EndpointEnumerationServiceClient
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+
22+
23+
if typing.TYPE_CHECKING:
24+
from typing import Dict, List, Optional, Union
25+
from datetime import datetime
26+
27+
28+
class EndpointCapability(object):
29+
"""
30+
31+
:param interface: The name of the capability interface.
32+
:type interface: (optional) str
33+
:param object_type: The type of capability interface. This is usually AlexaInterface.
34+
:type object_type: (optional) str
35+
:param version: The version of the capability interface that the endpoint supports.
36+
:type version: (optional) str
37+
38+
"""
39+
deserialized_types = {
40+
'interface': 'str',
41+
'object_type': 'str',
42+
'version': 'str'
43+
} # type: Dict
44+
45+
attribute_map = {
46+
'interface': 'interface',
47+
'object_type': 'type',
48+
'version': 'version'
49+
} # type: Dict
50+
51+
def __init__(self, interface=None, object_type=None, version=None):
52+
# type: (Optional[str], Optional[str], Optional[str]) -> None
53+
"""
54+
55+
:param interface: The name of the capability interface.
56+
:type interface: (optional) str
57+
:param object_type: The type of capability interface. This is usually AlexaInterface.
58+
:type object_type: (optional) str
59+
:param version: The version of the capability interface that the endpoint supports.
60+
:type version: (optional) str
61+
"""
62+
self.__discriminator_value = None # type: str
63+
64+
self.interface = interface
65+
self.object_type = object_type
66+
self.version = version
67+
68+
def to_dict(self):
69+
# type: () -> Dict[str, object]
70+
"""Returns the model properties as a dict"""
71+
result = {} # type: Dict
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, EndpointCapability):
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

0 commit comments

Comments
 (0)