Skip to content

Commit

Permalink
Release 1.15.0. For changelog, check CHANGELOG.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
ask-pyth committed Oct 10, 2019
1 parent 1d3ed27 commit fbb29c2
Show file tree
Hide file tree
Showing 16 changed files with 696 additions and 11 deletions.
9 changes: 9 additions & 0 deletions ask-sdk-model/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,12 @@ This release contains the following changes :
- 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.

- 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.


1.15.0
~~~~~~~

This release contains the following changes :
- A new `mode property <https://developer.amazon.com/docs/alexa-presentation-language/apl-viewport-property.html#viewport_mode_property>`__ in APL viewports
- 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>`__
- Fixing a bug in base service client that leads to exceptions for a HTTP 204 response.
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.14.0'
__version__ = '1.15.0'
__author__ = 'Alexa Skills Kit'
__author_email__ = 'ask-sdk-dynamic@amazon.com'
__license__ = 'Apache 2.0'
Expand Down
8 changes: 4 additions & 4 deletions ask-sdk-model/ask_sdk_model/interfaces/system/system_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class SystemState(object):
:type user: (optional) ask_sdk_model.user.User
:param device:
:type device: (optional) ask_sdk_model.device.Device
:param api_endpoint:
: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.
:type api_endpoint: (optional) str
:param api_access_token:
: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;
:type api_access_token: (optional) str
"""
Expand Down Expand Up @@ -69,9 +69,9 @@ def __init__(self, application=None, user=None, device=None, api_endpoint=None,
:type user: (optional) ask_sdk_model.user.User
:param device:
:type device: (optional) ask_sdk_model.device.Device
:param api_endpoint:
: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.
:type api_endpoint: (optional) str
:param api_access_token:
: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;
:type api_access_token: (optional) str
"""
self.__discriminator_value = None # type: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from .touch import Touch
from .shape import Shape
from .mode import Mode
from .keyboard import Keyboard
from .viewport_state_video import Video
from .viewport_state import ViewportState
Expand Down
69 changes: 69 additions & 0 deletions ask-sdk-model/ask_sdk_model/interfaces/viewport/mode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 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 Mode(Enum):
"""
The expected use case of the device&#39;s viewport, encapsulating the available input mechanisms and user viewing distance.
Allowed enum values: [AUTO, HUB, MOBILE, PC, TV]
"""
AUTO = "AUTO"
HUB = "HUB"
MOBILE = "MOBILE"
PC = "PC"
TV = "TV"

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, Mode):
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
12 changes: 10 additions & 2 deletions ask-sdk-model/ask_sdk_model/interfaces/viewport/viewport_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from ask_sdk_model.interfaces.viewport.keyboard import Keyboard
from ask_sdk_model.interfaces.viewport.shape import Shape
from ask_sdk_model.interfaces.viewport.viewport_state_video import Video
from ask_sdk_model.interfaces.viewport.mode import Mode


class ViewportState(object):
Expand All @@ -37,6 +38,8 @@ class ViewportState(object):
:param experiences: The experiences supported by the device, in descending order of arcMinuteWidth and arcMinuteHeight.
:type experiences: (optional) list[ask_sdk_model.interfaces.viewport.experience.Experience]
:param mode:
:type mode: (optional) ask_sdk_model.interfaces.viewport.mode.Mode
:param shape:
:type shape: (optional) ask_sdk_model.interfaces.viewport.shape.Shape
:param pixel_width: The number of pixels present in the viewport at its maximum width.
Expand All @@ -59,6 +62,7 @@ class ViewportState(object):
"""
deserialized_types = {
'experiences': 'list[ask_sdk_model.interfaces.viewport.experience.Experience]',
'mode': 'ask_sdk_model.interfaces.viewport.mode.Mode',
'shape': 'ask_sdk_model.interfaces.viewport.shape.Shape',
'pixel_width': 'float',
'pixel_height': 'float',
Expand All @@ -72,6 +76,7 @@ class ViewportState(object):

attribute_map = {
'experiences': 'experiences',
'mode': 'mode',
'shape': 'shape',
'pixel_width': 'pixelWidth',
'pixel_height': 'pixelHeight',
Expand All @@ -83,12 +88,14 @@ class ViewportState(object):
'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, 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
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):
# 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
"""This object contains the characteristics related to the device&#39;s viewport.
:param experiences: The experiences supported by the device, in descending order of arcMinuteWidth and arcMinuteHeight.
:type experiences: (optional) list[ask_sdk_model.interfaces.viewport.experience.Experience]
:param mode:
:type mode: (optional) ask_sdk_model.interfaces.viewport.mode.Mode
:param shape:
:type shape: (optional) ask_sdk_model.interfaces.viewport.shape.Shape
:param pixel_width: The number of pixels present in the viewport at its maximum width.
Expand All @@ -111,6 +118,7 @@ def __init__(self, experiences=None, shape=None, pixel_width=None, pixel_height=
self.__discriminator_value = None # type: str

self.experiences = experiences
self.mode = mode
self.shape = shape
self.pixel_width = pixel_width
self.pixel_height = pixel_height
Expand Down
6 changes: 6 additions & 0 deletions ask-sdk-model/ask_sdk_model/services/base_service_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ def invoke(
if BaseServiceClient.__is_code_successful(response.status_code):
if response_type is None:
return None

# Body of HTTP 204 (No Content) response should be empty
# Return None immediately, since body is not a valid json value to be deserialized
if response.status_code == 204 and not response.body:
return None

return self._serializer.deserialize(response.body, response_type)

if response_definitions:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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 .error import Error
from .endpoint_capability import EndpointCapability
from .endpoint_enumeration_response import EndpointEnumerationResponse
from .endpoint_info import EndpointInfo
from .endpoint_enumeration_service_client import EndpointEnumerationServiceClient
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# 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 EndpointCapability(object):
"""
:param interface: The name of the capability interface.
:type interface: (optional) str
:param object_type: The type of capability interface. This is usually AlexaInterface.
:type object_type: (optional) str
:param version: The version of the capability interface that the endpoint supports.
:type version: (optional) str
"""
deserialized_types = {
'interface': 'str',
'object_type': 'str',
'version': 'str'
} # type: Dict

attribute_map = {
'interface': 'interface',
'object_type': 'type',
'version': 'version'
} # type: Dict

def __init__(self, interface=None, object_type=None, version=None):
# type: (Optional[str], Optional[str], Optional[str]) -> None
"""
:param interface: The name of the capability interface.
:type interface: (optional) str
:param object_type: The type of capability interface. This is usually AlexaInterface.
:type object_type: (optional) str
:param version: The version of the capability interface that the endpoint supports.
:type version: (optional) str
"""
self.__discriminator_value = None # type: str

self.interface = interface
self.object_type = object_type
self.version = version

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, EndpointCapability):
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 fbb29c2

Please sign in to comment.