diff --git a/ask-sdk-model/CHANGELOG.rst b/ask-sdk-model/CHANGELOG.rst index 95a024a..b1d530f 100644 --- a/ask-sdk-model/CHANGELOG.rst +++ b/ask-sdk-model/CHANGELOG.rst @@ -332,3 +332,11 @@ This release contains the following changes : This release contains the following changes : - Introducing `person-level permissions `__ for Skill events. + + +1.26.0 +~~~~~~ + +This release contains the following changes : + +- Support for 'Alexa for residential' properties. More information about 'Alexa for residential' can be found here : https://developer.amazon.com/en-US/docs/alexa/alexa-smart-properties/about-alexa-for-residential.html diff --git a/ask-sdk-model/ask_sdk_model/__version__.py b/ask-sdk-model/ask_sdk_model/__version__.py index 01b12ab..7672858 100644 --- a/ask-sdk-model/ask_sdk_model/__version__.py +++ b/ask-sdk-model/ask_sdk_model/__version__.py @@ -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.25.0' +__version__ = '1.26.0' __author__ = 'Alexa Skills Kit' __author_email__ = 'ask-sdk-dynamic@amazon.com' __license__ = 'Apache 2.0' diff --git a/ask-sdk-model/ask_sdk_model/interfaces/system/system_state.py b/ask-sdk-model/ask_sdk_model/interfaces/system/system_state.py index 5344084..9e7a749 100644 --- a/ask-sdk-model/ask_sdk_model/interfaces/system/system_state.py +++ b/ask-sdk-model/ask_sdk_model/interfaces/system/system_state.py @@ -24,6 +24,7 @@ from typing import Dict, List, Optional, Union from datetime import datetime from ask_sdk_model.device import Device + from ask_sdk_model.interfaces.system_unit.unit import Unit from ask_sdk_model.person import Person from ask_sdk_model.application import Application from ask_sdk_model.user import User @@ -40,6 +41,8 @@ class SystemState(object): :type device: (optional) ask_sdk_model.device.Device :param person: :type person: (optional) ask_sdk_model.person.Person + :param unit: + :type unit: (optional) ask_sdk_model.interfaces.system_unit.unit.Unit :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: 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.\" @@ -51,6 +54,7 @@ class SystemState(object): 'user': 'ask_sdk_model.user.User', 'device': 'ask_sdk_model.device.Device', 'person': 'ask_sdk_model.person.Person', + 'unit': 'ask_sdk_model.interfaces.system_unit.unit.Unit', 'api_endpoint': 'str', 'api_access_token': 'str' } # type: Dict @@ -60,13 +64,14 @@ class SystemState(object): 'user': 'user', 'device': 'device', 'person': 'person', + 'unit': 'unit', 'api_endpoint': 'apiEndpoint', 'api_access_token': 'apiAccessToken' } # type: Dict supports_multiple_types = False - def __init__(self, application=None, user=None, device=None, person=None, api_endpoint=None, api_access_token=None): - # type: (Optional[Application], Optional[User], Optional[Device], Optional[Person], Optional[str], Optional[str]) -> None + def __init__(self, application=None, user=None, device=None, person=None, unit=None, api_endpoint=None, api_access_token=None): + # type: (Optional[Application], Optional[User], Optional[Device], Optional[Person], Optional[Unit], Optional[str], Optional[str]) -> None """ :param application: @@ -77,6 +82,8 @@ def __init__(self, application=None, user=None, device=None, person=None, api_en :type device: (optional) ask_sdk_model.device.Device :param person: :type person: (optional) ask_sdk_model.person.Person + :param unit: + :type unit: (optional) ask_sdk_model.interfaces.system_unit.unit.Unit :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: 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.\" @@ -88,6 +95,7 @@ def __init__(self, application=None, user=None, device=None, person=None, api_en self.user = user self.device = device self.person = person + self.unit = unit self.api_endpoint = api_endpoint self.api_access_token = api_access_token diff --git a/ask-sdk-model/ask_sdk_model/interfaces/system_unit/__init__.py b/ask-sdk-model/ask_sdk_model/interfaces/system_unit/__init__.py new file mode 100644 index 0000000..6fef2f8 --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/interfaces/system_unit/__init__.py @@ -0,0 +1,17 @@ +# 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 .unit import Unit diff --git a/ask-sdk-model/ask_sdk_model/interfaces/system_unit/py.typed b/ask-sdk-model/ask_sdk_model/interfaces/system_unit/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/ask-sdk-model/ask_sdk_model/interfaces/system_unit/unit.py b/ask-sdk-model/ask_sdk_model/interfaces/system_unit/unit.py new file mode 100644 index 0000000..9672cdd --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/interfaces/system_unit/unit.py @@ -0,0 +1,115 @@ +# 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 Unit(object): + """ + An object that represents a logical entity for organizing actors and resources that interact with Alexa systems. + + + :param unit_id: A string that represents unitId directed at skill level. Each skill gets a different directed identifier for same internal identifier. This is Skill enablement scoped identifier. This should be in format - amzn1.ask.unit.<skillDirectedId> + :type unit_id: (optional) str + :param persistent_unit_id: A string that represents a unitId directed using directedIdConfuser associated with the respective Organization's developer account. This identifier is directed at an Organization level. Same identifier is shared across Organization's backend systems (which invokes API), Skills owned by the organization and authorized 3P skills. This should be in format - amzn1.alexa.unit.did.<LWAConfuserDirectedId> + :type persistent_unit_id: (optional) str + + """ + deserialized_types = { + 'unit_id': 'str', + 'persistent_unit_id': 'str' + } # type: Dict + + attribute_map = { + 'unit_id': 'unitId', + 'persistent_unit_id': 'persistentUnitId' + } # type: Dict + supports_multiple_types = False + + def __init__(self, unit_id=None, persistent_unit_id=None): + # type: (Optional[str], Optional[str]) -> None + """An object that represents a logical entity for organizing actors and resources that interact with Alexa systems. + + :param unit_id: A string that represents unitId directed at skill level. Each skill gets a different directed identifier for same internal identifier. This is Skill enablement scoped identifier. This should be in format - amzn1.ask.unit.<skillDirectedId> + :type unit_id: (optional) str + :param persistent_unit_id: A string that represents a unitId directed using directedIdConfuser associated with the respective Organization's developer account. This identifier is directed at an Organization level. Same identifier is shared across Organization's backend systems (which invokes API), Skills owned by the organization and authorized 3P skills. This should be in format - amzn1.alexa.unit.did.<LWAConfuserDirectedId> + :type persistent_unit_id: (optional) str + """ + self.__discriminator_value = None # type: str + + self.unit_id = unit_id + self.persistent_unit_id = persistent_unit_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, Unit): + 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