Skip to content

Commit 1128bfe

Browse files
author
ask-pyth
committed
Release 1.18.0. For changelog, check CHANGELOG.rst
1 parent 4ed3917 commit 1128bfe

File tree

10 files changed

+248
-38
lines changed

10 files changed

+248
-38
lines changed

ask-sdk-model/CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,11 @@ This release has the following changes :
232232
This release contains the following changes :
233233

234234
- APIs for `ISP support in kid skills <https://developer.amazon.com/docs/in-skill-purchase/isp-kid-skills.html>`__.
235+
236+
237+
1.18.0
238+
~~~~~~~
239+
240+
This release contains the following changes:
241+
242+
- support for `personalization <https://developer.amazon.com/docs/custom-skills/add-personalization-to-your-skill.html#invocation-request-examples>`__ in the skill.

ask-sdk-model/ask_sdk_model/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from .request import Request
4141
from .session_ended_request import SessionEndedRequest
4242
from .context import Context
43+
from .person import Person
4344
from .cause import Cause
4445
from .request_envelope import RequestEnvelope
4546
from .session_ended_error_type import SessionEndedErrorType

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.17.0'
17+
__version__ = '1.18.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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from typing import Dict, List, Optional, Union
2525
from datetime import datetime
2626
from ask_sdk_model.device import Device
27+
from ask_sdk_model.person import Person
2728
from ask_sdk_model.application import Application
2829
from ask_sdk_model.user import User
2930

@@ -37,6 +38,8 @@ class SystemState(object):
3738
:type user: (optional) ask_sdk_model.user.User
3839
:param device:
3940
:type device: (optional) ask_sdk_model.device.Device
41+
:param person:
42+
:type person: (optional) ask_sdk_model.person.Person
4043
: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.
4144
:type api_endpoint: (optional) str
4245
: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;
@@ -47,6 +50,7 @@ class SystemState(object):
4750
'application': 'ask_sdk_model.application.Application',
4851
'user': 'ask_sdk_model.user.User',
4952
'device': 'ask_sdk_model.device.Device',
53+
'person': 'ask_sdk_model.person.Person',
5054
'api_endpoint': 'str',
5155
'api_access_token': 'str'
5256
} # type: Dict
@@ -55,12 +59,13 @@ class SystemState(object):
5559
'application': 'application',
5660
'user': 'user',
5761
'device': 'device',
62+
'person': 'person',
5863
'api_endpoint': 'apiEndpoint',
5964
'api_access_token': 'apiAccessToken'
6065
} # type: Dict
6166

62-
def __init__(self, application=None, user=None, device=None, api_endpoint=None, api_access_token=None):
63-
# type: (Optional[Application], Optional[User], Optional[Device], Optional[str], Optional[str]) -> None
67+
def __init__(self, application=None, user=None, device=None, person=None, api_endpoint=None, api_access_token=None):
68+
# type: (Optional[Application], Optional[User], Optional[Device], Optional[Person], Optional[str], Optional[str]) -> None
6469
"""
6570
6671
:param application:
@@ -69,6 +74,8 @@ def __init__(self, application=None, user=None, device=None, api_endpoint=None,
6974
:type user: (optional) ask_sdk_model.user.User
7075
:param device:
7176
:type device: (optional) ask_sdk_model.device.Device
77+
:param person:
78+
:type person: (optional) ask_sdk_model.person.Person
7279
: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.
7380
:type api_endpoint: (optional) str
7481
: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;
@@ -79,6 +86,7 @@ def __init__(self, application=None, user=None, device=None, api_endpoint=None,
7986
self.application = application
8087
self.user = user
8188
self.device = device
89+
self.person = person
8290
self.api_endpoint = api_endpoint
8391
self.api_access_token = api_access_token
8492

ask-sdk-model/ask_sdk_model/person.py

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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 Person(object):
29+
"""
30+
An object that describes the user (person) who is making the request.
31+
32+
33+
:param person_id: A string that represents a unique identifier for the person who is making the request. The length of this identifier can vary, but is never more than 255 characters. It is generated when a recognized user makes a request to your skill.
34+
:type person_id: (optional) str
35+
:param access_token: A token identifying the user in another system. This is only provided if the recognized user has successfully linked their skill account with their Alexa profile. The accessToken field will not appear if null.
36+
:type access_token: (optional) str
37+
38+
"""
39+
deserialized_types = {
40+
'person_id': 'str',
41+
'access_token': 'str'
42+
} # type: Dict
43+
44+
attribute_map = {
45+
'person_id': 'personId',
46+
'access_token': 'accessToken'
47+
} # type: Dict
48+
49+
def __init__(self, person_id=None, access_token=None):
50+
# type: (Optional[str], Optional[str]) -> None
51+
"""An object that describes the user (person) who is making the request.
52+
53+
:param person_id: A string that represents a unique identifier for the person who is making the request. The length of this identifier can vary, but is never more than 255 characters. It is generated when a recognized user makes a request to your skill.
54+
:type person_id: (optional) str
55+
:param access_token: A token identifying the user in another system. This is only provided if the recognized user has successfully linked their skill account with their Alexa profile. The accessToken field will not appear if null.
56+
:type access_token: (optional) str
57+
"""
58+
self.__discriminator_value = None # type: str
59+
60+
self.person_id = person_id
61+
self.access_token = access_token
62+
63+
def to_dict(self):
64+
# type: () -> Dict[str, object]
65+
"""Returns the model properties as a dict"""
66+
result = {} # type: Dict
67+
68+
for attr, _ in six.iteritems(self.deserialized_types):
69+
value = getattr(self, attr)
70+
if isinstance(value, list):
71+
result[attr] = list(map(
72+
lambda x: x.to_dict() if hasattr(x, "to_dict") else
73+
x.value if isinstance(x, Enum) else x,
74+
value
75+
))
76+
elif isinstance(value, Enum):
77+
result[attr] = value.value
78+
elif hasattr(value, "to_dict"):
79+
result[attr] = value.to_dict()
80+
elif isinstance(value, dict):
81+
result[attr] = dict(map(
82+
lambda item: (item[0], item[1].to_dict())
83+
if hasattr(item[1], "to_dict") else
84+
(item[0], item[1].value)
85+
if isinstance(item[1], Enum) else item,
86+
value.items()
87+
))
88+
else:
89+
result[attr] = value
90+
91+
return result
92+
93+
def to_str(self):
94+
# type: () -> str
95+
"""Returns the string representation of the model"""
96+
return pprint.pformat(self.to_dict())
97+
98+
def __repr__(self):
99+
# type: () -> str
100+
"""For `print` and `pprint`"""
101+
return self.to_str()
102+
103+
def __eq__(self, other):
104+
# type: (object) -> bool
105+
"""Returns true if both objects are equal"""
106+
if not isinstance(other, Person):
107+
return False
108+
109+
return self.__dict__ == other.__dict__
110+
111+
def __ne__(self, other):
112+
# type: (object) -> bool
113+
"""Returns true if both objects are not equal"""
114+
return not self == other

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,21 @@ class AuthenticationConfiguration(object):
2424
:type client_id: str
2525
:param client_secret: Client Secret required for authentication.
2626
:type client_secret: str
27+
:param refresh_token: Client refresh_token required to get access token for API calls.
28+
:type refresh_token: str
2729
"""
2830

29-
def __init__(self, client_id=None, client_secret=None):
31+
def __init__(self, client_id=None, client_secret=None, refresh_token=None):
3032
# type: (str, str) -> None
3133
"""Represents a class that provides authentication configuration.
3234
3335
:param client_id: Client ID required for authentication.
3436
:type client_id: str
3537
:param client_secret: Client Secret required for authentication.
3638
:type client_secret: str
39+
:param refresh_token: Client refresh_token required to get access token for API calls.
40+
:type refresh_token: str
3741
"""
3842
self.client_id = client_id
3943
self.client_secret = client_secret
44+
self.refresh_token = refresh_token

ask-sdk-model/ask_sdk_model/services/lwa/access_token_request.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import typing
2121
from enum import Enum
2222

23-
2423
if typing.TYPE_CHECKING:
2524
from typing import Dict, Optional
2625

@@ -35,21 +34,25 @@ class AccessTokenRequest(object):
3534
:param scope: The required scope for which the access token is
3635
requested for
3736
:type scope: str
37+
:param refresh_token: Client refresh_token required to get access token for API calls.
38+
:type refresh_token: str
3839
"""
3940
deserialized_types = {
4041
'client_id': 'str',
4142
'client_secret': 'str',
43+
'refresh_token': 'str',
4244
'scope': 'str'
4345
}
4446

4547
attribute_map = {
4648
'client_id': 'client_id',
4749
'client_secret': 'client_secret',
50+
'refresh_token': 'refresh_token',
4851
'scope': 'scope'
4952
}
5053

51-
def __init__(self, client_id=None, client_secret=None, scope=None):
52-
# type: (Optional[str], Optional[str], Optional[str]) -> None
54+
def __init__(self, client_id=None, client_secret=None, scope=None, refresh_token=None):
55+
# type: (Optional[str], Optional[str], Optional[str], Optional[str]) -> None
5356
"""Request for retrieving an access token from LWA.
5457
5558
:param client_id: The ClientId value from developer console
@@ -59,12 +62,15 @@ def __init__(self, client_id=None, client_secret=None, scope=None):
5962
:param scope: The required scope for which the access token is
6063
requested for
6164
:type scope: str
65+
:param refresh_token: Client refresh_token required to get access token for API calls.
66+
:type refresh_token: str
6267
"""
6368
self.__discriminator_value = None
6469

6570
self.client_id = client_id
6671
self.client_secret = client_secret
6772
self.scope = scope
73+
self.refresh_token = refresh_token
6874

6975
def to_dict(self):
7076
# type: () -> Dict

0 commit comments

Comments
 (0)