Skip to content

Commit fbb29c2

Browse files
author
ask-pyth
committedOct 10, 2019
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

+9
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

+1-1
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

+4-4
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

+1
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
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

+10-2
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

+6
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:
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
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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+
from ask_sdk_model.services.endpoint_enumeration.endpoint_info import EndpointInfo
27+
28+
29+
class EndpointEnumerationResponse(object):
30+
"""
31+
Contains the list of endpoints.
32+
33+
34+
:param endpoints: The list of endpoints.
35+
:type endpoints: (optional) list[ask_sdk_model.services.endpoint_enumeration.endpoint_info.EndpointInfo]
36+
37+
"""
38+
deserialized_types = {
39+
'endpoints': 'list[ask_sdk_model.services.endpoint_enumeration.endpoint_info.EndpointInfo]'
40+
} # type: Dict
41+
42+
attribute_map = {
43+
'endpoints': 'endpoints'
44+
} # type: Dict
45+
46+
def __init__(self, endpoints=None):
47+
# type: (Optional[List[EndpointInfo]]) -> None
48+
"""Contains the list of endpoints.
49+
50+
:param endpoints: The list of endpoints.
51+
:type endpoints: (optional) list[ask_sdk_model.services.endpoint_enumeration.endpoint_info.EndpointInfo]
52+
"""
53+
self.__discriminator_value = None # type: str
54+
55+
self.endpoints = endpoints
56+
57+
def to_dict(self):
58+
# type: () -> Dict[str, object]
59+
"""Returns the model properties as a dict"""
60+
result = {} # type: Dict
61+
62+
for attr, _ in six.iteritems(self.deserialized_types):
63+
value = getattr(self, attr)
64+
if isinstance(value, list):
65+
result[attr] = list(map(
66+
lambda x: x.to_dict() if hasattr(x, "to_dict") else
67+
x.value if isinstance(x, Enum) else x,
68+
value
69+
))
70+
elif isinstance(value, Enum):
71+
result[attr] = value.value
72+
elif hasattr(value, "to_dict"):
73+
result[attr] = value.to_dict()
74+
elif isinstance(value, dict):
75+
result[attr] = dict(map(
76+
lambda item: (item[0], item[1].to_dict())
77+
if hasattr(item[1], "to_dict") else
78+
(item[0], item[1].value)
79+
if isinstance(item[1], Enum) else item,
80+
value.items()
81+
))
82+
else:
83+
result[attr] = value
84+
85+
return result
86+
87+
def to_str(self):
88+
# type: () -> str
89+
"""Returns the string representation of the model"""
90+
return pprint.pformat(self.to_dict())
91+
92+
def __repr__(self):
93+
# type: () -> str
94+
"""For `print` and `pprint`"""
95+
return self.to_str()
96+
97+
def __eq__(self, other):
98+
# type: (object) -> bool
99+
"""Returns true if both objects are equal"""
100+
if not isinstance(other, EndpointEnumerationResponse):
101+
return False
102+
103+
return self.__dict__ == other.__dict__
104+
105+
def __ne__(self, other):
106+
# type: (object) -> bool
107+
"""Returns true if both objects are not equal"""
108+
return not self == other
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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 sys
17+
import os
18+
import re
19+
import six
20+
import typing
21+
22+
from ask_sdk_model.services.base_service_client import BaseServiceClient
23+
from ask_sdk_model.services.api_configuration import ApiConfiguration
24+
from ask_sdk_model.services.service_client_response import ServiceClientResponse
25+
26+
27+
if typing.TYPE_CHECKING:
28+
from typing import Dict, List, Union, Any
29+
from datetime import datetime
30+
from ask_sdk_model.services.endpoint_enumeration.endpoint_enumeration_response import EndpointEnumerationResponse
31+
from ask_sdk_model.services.endpoint_enumeration.error import Error
32+
33+
34+
class EndpointEnumerationServiceClient(BaseServiceClient):
35+
"""ServiceClient for calling the EndpointEnumerationService APIs.
36+
37+
:param api_configuration: Instance of :py:class:`ask_sdk_model.services.api_configuration.ApiConfiguration`
38+
:type api_configuration: ask_sdk_model.services.api_configuration.ApiConfiguration
39+
"""
40+
def __init__(self, api_configuration):
41+
# type: (ApiConfiguration) -> None
42+
"""
43+
:param api_configuration: Instance of :py:class:`ask_sdk_model.services.api_configuration.ApiConfiguration`
44+
:type api_configuration: ask_sdk_model.services.api_configuration.ApiConfiguration
45+
"""
46+
super(EndpointEnumerationServiceClient, self).__init__(api_configuration)
47+
48+
def get_endpoints(self, **kwargs):
49+
# type: (**Any) -> Union[EndpointEnumerationResponse, Error]
50+
"""
51+
This API is invoked by the skill to retrieve endpoints connected to the Echo device.
52+
53+
:rtype: Union[EndpointEnumerationResponse, Error]
54+
"""
55+
operation_name = "get_endpoints"
56+
params = locals()
57+
for key, val in six.iteritems(params['kwargs']):
58+
params[key] = val
59+
del params['kwargs']
60+
61+
resource_path = '/v1/endpoints/'
62+
resource_path = resource_path.replace('{format}', 'json')
63+
64+
path_params = {} # type: Dict
65+
66+
query_params = [] # type: List
67+
68+
header_params = [] # type: List
69+
70+
body_params = None
71+
header_params.append(('Content-type', 'application/json'))
72+
73+
# Authentication setting
74+
authorization_value = "Bearer " + self._authorization_value
75+
header_params.append(("Authorization", authorization_value))
76+
77+
error_definitions = [] # type: List
78+
error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.endpoint_enumeration_response.EndpointEnumerationResponse", status_code=200, message="Successfully retrieved the list of connected endpoints."))
79+
error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=400, message="Bad request. Returned when a required parameter is not present or badly formatted."))
80+
error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=401, message="Unauthenticated. Returned when the request is not authenticated."))
81+
error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=403, message="Forbidden. Returned when the request is authenticated but does not have sufficient permission."))
82+
error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=500, message="Server Error. Returned when the server encountered an error processing the request."))
83+
error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=503, message="Service Unavailable. Returned when the server is not ready to handle the request."))
84+
error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=0, message="Unexpected error"))
85+
86+
return self.invoke(
87+
method="GET",
88+
endpoint=self._api_endpoint,
89+
path=resource_path,
90+
path_params=path_params,
91+
query_params=query_params,
92+
header_params=header_params,
93+
body=body_params,
94+
response_definitions=error_definitions,
95+
response_type="ask_sdk_model.services.endpoint_enumeration.endpoint_enumeration_response.EndpointEnumerationResponse")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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+
from ask_sdk_model.services.endpoint_enumeration.endpoint_capability import EndpointCapability
27+
28+
29+
class EndpointInfo(object):
30+
"""
31+
Contains the list of connected endpoints and their declared capabilities.
32+
33+
34+
:param endpoint_id: A unique identifier for the endpoint.
35+
:type endpoint_id: (optional) str
36+
:param friendly_name: The name of the endpoint. Because this name might be changed by the user or the platform, it might be different than the Bluetooth friendly name.
37+
:type friendly_name: (optional) str
38+
:param capabilities: The list of endpoint capabilities.
39+
:type capabilities: (optional) list[ask_sdk_model.services.endpoint_enumeration.endpoint_capability.EndpointCapability]
40+
41+
"""
42+
deserialized_types = {
43+
'endpoint_id': 'str',
44+
'friendly_name': 'str',
45+
'capabilities': 'list[ask_sdk_model.services.endpoint_enumeration.endpoint_capability.EndpointCapability]'
46+
} # type: Dict
47+
48+
attribute_map = {
49+
'endpoint_id': 'endpointId',
50+
'friendly_name': 'friendlyName',
51+
'capabilities': 'capabilities'
52+
} # type: Dict
53+
54+
def __init__(self, endpoint_id=None, friendly_name=None, capabilities=None):
55+
# type: (Optional[str], Optional[str], Optional[List[EndpointCapability]]) -> None
56+
"""Contains the list of connected endpoints and their declared capabilities.
57+
58+
:param endpoint_id: A unique identifier for the endpoint.
59+
:type endpoint_id: (optional) str
60+
:param friendly_name: The name of the endpoint. Because this name might be changed by the user or the platform, it might be different than the Bluetooth friendly name.
61+
:type friendly_name: (optional) str
62+
:param capabilities: The list of endpoint capabilities.
63+
:type capabilities: (optional) list[ask_sdk_model.services.endpoint_enumeration.endpoint_capability.EndpointCapability]
64+
"""
65+
self.__discriminator_value = None # type: str
66+
67+
self.endpoint_id = endpoint_id
68+
self.friendly_name = friendly_name
69+
self.capabilities = capabilities
70+
71+
def to_dict(self):
72+
# type: () -> Dict[str, object]
73+
"""Returns the model properties as a dict"""
74+
result = {} # type: Dict
75+
76+
for attr, _ in six.iteritems(self.deserialized_types):
77+
value = getattr(self, attr)
78+
if isinstance(value, list):
79+
result[attr] = list(map(
80+
lambda x: x.to_dict() if hasattr(x, "to_dict") else
81+
x.value if isinstance(x, Enum) else x,
82+
value
83+
))
84+
elif isinstance(value, Enum):
85+
result[attr] = value.value
86+
elif hasattr(value, "to_dict"):
87+
result[attr] = value.to_dict()
88+
elif isinstance(value, dict):
89+
result[attr] = dict(map(
90+
lambda item: (item[0], item[1].to_dict())
91+
if hasattr(item[1], "to_dict") else
92+
(item[0], item[1].value)
93+
if isinstance(item[1], Enum) else item,
94+
value.items()
95+
))
96+
else:
97+
result[attr] = value
98+
99+
return result
100+
101+
def to_str(self):
102+
# type: () -> str
103+
"""Returns the string representation of the model"""
104+
return pprint.pformat(self.to_dict())
105+
106+
def __repr__(self):
107+
# type: () -> str
108+
"""For `print` and `pprint`"""
109+
return self.to_str()
110+
111+
def __eq__(self, other):
112+
# type: (object) -> bool
113+
"""Returns true if both objects are equal"""
114+
if not isinstance(other, EndpointInfo):
115+
return False
116+
117+
return self.__dict__ == other.__dict__
118+
119+
def __ne__(self, other):
120+
# type: (object) -> bool
121+
"""Returns true if both objects are not equal"""
122+
return not self == other
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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 Error(object):
29+
"""
30+
31+
:param code: Domain specific error code.
32+
:type code: (optional) str
33+
:param message: Detailed error message.
34+
:type message: (optional) str
35+
36+
"""
37+
deserialized_types = {
38+
'code': 'str',
39+
'message': 'str'
40+
} # type: Dict
41+
42+
attribute_map = {
43+
'code': 'code',
44+
'message': 'message'
45+
} # type: Dict
46+
47+
def __init__(self, code=None, message=None):
48+
# type: (Optional[str], Optional[str]) -> None
49+
"""
50+
51+
:param code: Domain specific error code.
52+
:type code: (optional) str
53+
:param message: Detailed error message.
54+
:type message: (optional) str
55+
"""
56+
self.__discriminator_value = None # type: str
57+
58+
self.code = code
59+
self.message = message
60+
61+
def to_dict(self):
62+
# type: () -> Dict[str, object]
63+
"""Returns the model properties as a dict"""
64+
result = {} # type: Dict
65+
66+
for attr, _ in six.iteritems(self.deserialized_types):
67+
value = getattr(self, attr)
68+
if isinstance(value, list):
69+
result[attr] = list(map(
70+
lambda x: x.to_dict() if hasattr(x, "to_dict") else
71+
x.value if isinstance(x, Enum) else x,
72+
value
73+
))
74+
elif isinstance(value, Enum):
75+
result[attr] = value.value
76+
elif hasattr(value, "to_dict"):
77+
result[attr] = value.to_dict()
78+
elif isinstance(value, dict):
79+
result[attr] = dict(map(
80+
lambda item: (item[0], item[1].to_dict())
81+
if hasattr(item[1], "to_dict") else
82+
(item[0], item[1].value)
83+
if isinstance(item[1], Enum) else item,
84+
value.items()
85+
))
86+
else:
87+
result[attr] = value
88+
89+
return result
90+
91+
def to_str(self):
92+
# type: () -> str
93+
"""Returns the string representation of the model"""
94+
return pprint.pformat(self.to_dict())
95+
96+
def __repr__(self):
97+
# type: () -> str
98+
"""For `print` and `pprint`"""
99+
return self.to_str()
100+
101+
def __eq__(self, other):
102+
# type: (object) -> bool
103+
"""Returns true if both objects are equal"""
104+
if not isinstance(other, Error):
105+
return False
106+
107+
return self.__dict__ == other.__dict__
108+
109+
def __ne__(self, other):
110+
# type: (object) -> bool
111+
"""Returns true if both objects are not equal"""
112+
return not self == other

‎ask-sdk-model/ask_sdk_model/services/endpoint_enumeration/py.typed

Whitespace-only changes.

‎ask-sdk-model/ask_sdk_model/services/service_client_factory.py

+15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import typing
2121
from .device_address import DeviceAddressServiceClient
2222
from .directive import DirectiveServiceClient
23+
from .endpoint_enumeration import EndpointEnumerationServiceClient
2324
from .list_management import ListManagementServiceClient
2425
from .monetization import MonetizationServiceClient
2526
from .proactive_events import ProactiveEventsServiceClient
@@ -69,6 +70,20 @@ def get_directive_service(self):
6970
raise ValueError(
7071
"ServiceClientFactory Error while initializing DirectiveServiceClient: " + str(e))
7172

73+
def get_endpoint_enumeration_service(self):
74+
# type: () -> EndpointEnumerationServiceClient
75+
"""Get EndpointEnumerationServiceClient for endpoint_enumeration_service.
76+
77+
:return: Client for calling the service
78+
:rtype: EndpointEnumerationServiceClient
79+
:raises: :py:class:`ValueError`
80+
"""
81+
try:
82+
return EndpointEnumerationServiceClient(self.api_configuration)
83+
except Exception as e:
84+
raise ValueError(
85+
"ServiceClientFactory Error while initializing EndpointEnumerationServiceClient: " + str(e))
86+
7287
def get_list_management_service(self):
7388
# type: () -> ListManagementServiceClient
7489
"""Get ListManagementServiceClient for list_management_service.

‎ask-sdk-model/ask_sdk_model/user.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828

2929
class User(object):
3030
"""
31-
Represents the user registered to the device initiating the request.
31+
An object that describes the Amazon account for which the skill is enabled.
3232
3333
3434
:param user_id: A string that represents a unique identifier for the user who made the request. The length of this identifier can vary, but is never more than 255 characters. The userId is automatically generated when a user enables the skill in the Alexa app. Note: Disabling and re-enabling a skill generates a new identifier.
3535
:type user_id: (optional) str
36-
:param access_token: A token identifying the user in another system. This is only provided if the user has successfully linked their account. See Linking an Alexa User with a User in Your System for more details.
36+
:param access_token: A token identifying the user in another system. This is only provided if the user has successfully linked their skill account with their Amazon account.
3737
:type access_token: (optional) str
3838
:param permissions:
3939
:type permissions: (optional) ask_sdk_model.permissions.Permissions
@@ -53,11 +53,11 @@ class User(object):
5353

5454
def __init__(self, user_id=None, access_token=None, permissions=None):
5555
# type: (Optional[str], Optional[str], Optional[Permissions]) -> None
56-
"""Represents the user registered to the device initiating the request.
56+
"""An object that describes the Amazon account for which the skill is enabled.
5757
5858
:param user_id: A string that represents a unique identifier for the user who made the request. The length of this identifier can vary, but is never more than 255 characters. The userId is automatically generated when a user enables the skill in the Alexa app. Note: Disabling and re-enabling a skill generates a new identifier.
5959
:type user_id: (optional) str
60-
:param access_token: A token identifying the user in another system. This is only provided if the user has successfully linked their account. See Linking an Alexa User with a User in Your System for more details.
60+
:param access_token: A token identifying the user in another system. This is only provided if the user has successfully linked their skill account with their Amazon account.
6161
:type access_token: (optional) str
6262
:param permissions:
6363
:type permissions: (optional) ask_sdk_model.permissions.Permissions

0 commit comments

Comments
 (0)
Please sign in to comment.