Skip to content

Commit

Permalink
Release 1.26.0. For changelog, check CHANGELOG.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
ask-pyth committed Sep 3, 2020
1 parent abb8d3d commit cf421c8
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 3 deletions.
8 changes: 8 additions & 0 deletions ask-sdk-model/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -332,3 +332,11 @@ This release contains the following changes :
This release contains the following changes :

- Introducing `person-level permissions <https://developer.amazon.com/en-US/docs/alexa/smapi/skill-events-in-alexa-skills.html#skill-permission-changed-event>`__ 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
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.25.0'
__version__ = '1.26.0'
__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/interfaces/system/system_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.\&quot;
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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.\&quot;
Expand All @@ -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

Expand Down
17 changes: 17 additions & 0 deletions ask-sdk-model/ask_sdk_model/interfaces/system_unit/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Empty file.
115 changes: 115 additions & 0 deletions ask-sdk-model/ask_sdk_model/interfaces/system_unit/unit.py
Original file line number Diff line number Diff line change
@@ -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.&lt;skillDirectedId&gt;
:type unit_id: (optional) str
:param persistent_unit_id: A string that represents a unitId directed using directedIdConfuser associated with the respective Organization&#39;s developer account. This identifier is directed at an Organization level. Same identifier is shared across Organization&#39;s backend systems (which invokes API), Skills owned by the organization and authorized 3P skills. This should be in format - amzn1.alexa.unit.did.&lt;LWAConfuserDirectedId&gt;
: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.&lt;skillDirectedId&gt;
:type unit_id: (optional) str
:param persistent_unit_id: A string that represents a unitId directed using directedIdConfuser associated with the respective Organization&#39;s developer account. This identifier is directed at an Organization level. Same identifier is shared across Organization&#39;s backend systems (which invokes API), Skills owned by the organization and authorized 3P skills. This should be in format - amzn1.alexa.unit.did.&lt;LWAConfuserDirectedId&gt;
: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

0 comments on commit cf421c8

Please sign in to comment.