Skip to content

Commit a434ac0

Browse files
author
ask-pyth
committed
Release 1.13.0. For changelog, check CHANGELOG.rst
1 parent 987b653 commit a434ac0

17 files changed

+939
-5
lines changed

ask-sdk-model/CHANGELOG.rst

+8
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,11 @@ This release contains the following changes :
189189
- Provide APL expression language in some APL commands, alongside their primitive types (eg: `delay` in all commands).
190190
- Added `ENDPOINT_TIMEOUT` enumeration in `SessionEndedReason`.
191191

192+
193+
194+
1.13.0
195+
~~~~~~~
196+
197+
This release contains the following changes :
198+
199+
- Models for `Skill Connections <https://developer.amazon.com/docs/custom-skills/skill-connections.html>`__. With the Skill Connections feature, you can enable an Alexa skill to fulfill a customer request that it can't otherwise handle by forwarding the request to another skill for fulfillment.

ask-sdk-model/ask_sdk_model/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@
1919
from .application import Application
2020
from .permissions import Permissions
2121
from .slot_confirmation_status import SlotConfirmationStatus
22+
from .connection_completed import ConnectionCompleted
2223
from .slot import Slot
24+
from .task import Task
2325
from .intent_confirmation_status import IntentConfirmationStatus
2426
from .supported_interfaces import SupportedInterfaces
2527
from .session_ended_error import SessionEndedError
28+
from .status import Status
2629
from .response import Response
2730
from .directive import Directive
2831
from .device import Device
@@ -32,10 +35,12 @@
3235
from .dialog_state import DialogState
3336
from .launch_request import LaunchRequest
3437
from .session import Session
38+
from .session_resumed_request import SessionResumedRequest
3539
from .response_envelope import ResponseEnvelope
3640
from .request import Request
3741
from .session_ended_request import SessionEndedRequest
3842
from .context import Context
43+
from .cause import Cause
3944
from .request_envelope import RequestEnvelope
4045
from .session_ended_error_type import SessionEndedErrorType
4146
from .intent import Intent

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.12.0'
17+
__version__ = '1.13.0'
1818
__author__ = 'Alexa Skills Kit'
1919
__author_email__ = '[email protected]'
2020
__license__ = 'Apache 2.0'

ask-sdk-model/ask_sdk_model/cause.py

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
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+
from abc import ABCMeta, abstractmethod
22+
23+
24+
if typing.TYPE_CHECKING:
25+
from typing import Dict, List, Optional, Union
26+
from datetime import datetime
27+
28+
29+
class Cause(object):
30+
"""
31+
Describes the type of the Cause.
32+
33+
34+
:param object_type:
35+
:type object_type: (optional) str
36+
37+
.. note::
38+
39+
This is an abstract class. Use the following mapping, to figure out
40+
the model class to be instantiated, that sets ``type`` variable.
41+
42+
| ConnectionCompleted: :py:class:`ask_sdk_model.connection_completed.ConnectionCompleted`
43+
44+
"""
45+
deserialized_types = {
46+
'object_type': 'str'
47+
} # type: Dict
48+
49+
attribute_map = {
50+
'object_type': 'type'
51+
} # type: Dict
52+
53+
discriminator_value_class_map = {
54+
'ConnectionCompleted': 'ask_sdk_model.connection_completed.ConnectionCompleted'
55+
}
56+
57+
json_discriminator_key = "type"
58+
59+
__metaclass__ = ABCMeta
60+
61+
@abstractmethod
62+
def __init__(self, object_type=None):
63+
# type: (Optional[str]) -> None
64+
"""Describes the type of the Cause.
65+
66+
:param object_type:
67+
:type object_type: (optional) str
68+
"""
69+
self.__discriminator_value = None # type: str
70+
71+
self.object_type = object_type
72+
73+
@classmethod
74+
def get_real_child_model(cls, data):
75+
# type: (Dict[str, str]) -> Optional[str]
76+
"""Returns the real base class specified by the discriminator"""
77+
discriminator_value = data[cls.json_discriminator_key]
78+
return cls.discriminator_value_class_map.get(discriminator_value)
79+
80+
def to_dict(self):
81+
# type: () -> Dict[str, object]
82+
"""Returns the model properties as a dict"""
83+
result = {} # type: Dict
84+
85+
for attr, _ in six.iteritems(self.deserialized_types):
86+
value = getattr(self, attr)
87+
if isinstance(value, list):
88+
result[attr] = list(map(
89+
lambda x: x.to_dict() if hasattr(x, "to_dict") else
90+
x.value if isinstance(x, Enum) else x,
91+
value
92+
))
93+
elif isinstance(value, Enum):
94+
result[attr] = value.value
95+
elif hasattr(value, "to_dict"):
96+
result[attr] = value.to_dict()
97+
elif isinstance(value, dict):
98+
result[attr] = dict(map(
99+
lambda item: (item[0], item[1].to_dict())
100+
if hasattr(item[1], "to_dict") else
101+
(item[0], item[1].value)
102+
if isinstance(item[1], Enum) else item,
103+
value.items()
104+
))
105+
else:
106+
result[attr] = value
107+
108+
return result
109+
110+
def to_str(self):
111+
# type: () -> str
112+
"""Returns the string representation of the model"""
113+
return pprint.pformat(self.to_dict())
114+
115+
def __repr__(self):
116+
# type: () -> str
117+
"""For `print` and `pprint`"""
118+
return self.to_str()
119+
120+
def __eq__(self, other):
121+
# type: (object) -> bool
122+
"""Returns true if both objects are equal"""
123+
if not isinstance(other, Cause):
124+
return False
125+
126+
return self.__dict__ == other.__dict__
127+
128+
def __ne__(self, other):
129+
# type: (object) -> bool
130+
"""Returns true if both objects are not equal"""
131+
return not self == other
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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+
from ask_sdk_model.cause import Cause
22+
23+
24+
if typing.TYPE_CHECKING:
25+
from typing import Dict, List, Optional, Union
26+
from datetime import datetime
27+
from ask_sdk_model.status import Status
28+
29+
30+
class ConnectionCompleted(Cause):
31+
"""
32+
Represents the status and result needed to resume a skill&#39;s suspended session.
33+
34+
35+
:param token: This is an echo back string that skills send when during Connections.StartConnection directive. They will receive it when they get the SessionResumedRequest. It is never sent to the skill handling the request.
36+
:type token: (optional) str
37+
:param status:
38+
:type status: (optional) ask_sdk_model.status.Status
39+
:param result: This is the result object to resume the skill&#39;s suspended session.
40+
:type result: (optional) object
41+
42+
"""
43+
deserialized_types = {
44+
'object_type': 'str',
45+
'token': 'str',
46+
'status': 'ask_sdk_model.status.Status',
47+
'result': 'object'
48+
} # type: Dict
49+
50+
attribute_map = {
51+
'object_type': 'type',
52+
'token': 'token',
53+
'status': 'status',
54+
'result': 'result'
55+
} # type: Dict
56+
57+
def __init__(self, token=None, status=None, result=None):
58+
# type: (Optional[str], Optional[Status], Optional[object]) -> None
59+
"""Represents the status and result needed to resume a skill&#39;s suspended session.
60+
61+
:param token: This is an echo back string that skills send when during Connections.StartConnection directive. They will receive it when they get the SessionResumedRequest. It is never sent to the skill handling the request.
62+
:type token: (optional) str
63+
:param status:
64+
:type status: (optional) ask_sdk_model.status.Status
65+
:param result: This is the result object to resume the skill&#39;s suspended session.
66+
:type result: (optional) object
67+
"""
68+
self.__discriminator_value = "ConnectionCompleted" # type: str
69+
70+
self.object_type = self.__discriminator_value
71+
super(ConnectionCompleted, self).__init__(object_type=self.__discriminator_value)
72+
self.token = token
73+
self.status = status
74+
self.result = result
75+
76+
def to_dict(self):
77+
# type: () -> Dict[str, object]
78+
"""Returns the model properties as a dict"""
79+
result = {} # type: Dict
80+
81+
for attr, _ in six.iteritems(self.deserialized_types):
82+
value = getattr(self, attr)
83+
if isinstance(value, list):
84+
result[attr] = list(map(
85+
lambda x: x.to_dict() if hasattr(x, "to_dict") else
86+
x.value if isinstance(x, Enum) else x,
87+
value
88+
))
89+
elif isinstance(value, Enum):
90+
result[attr] = value.value
91+
elif hasattr(value, "to_dict"):
92+
result[attr] = value.to_dict()
93+
elif isinstance(value, dict):
94+
result[attr] = dict(map(
95+
lambda item: (item[0], item[1].to_dict())
96+
if hasattr(item[1], "to_dict") else
97+
(item[0], item[1].value)
98+
if isinstance(item[1], Enum) else item,
99+
value.items()
100+
))
101+
else:
102+
result[attr] = value
103+
104+
return result
105+
106+
def to_str(self):
107+
# type: () -> str
108+
"""Returns the string representation of the model"""
109+
return pprint.pformat(self.to_dict())
110+
111+
def __repr__(self):
112+
# type: () -> str
113+
"""For `print` and `pprint`"""
114+
return self.to_str()
115+
116+
def __eq__(self, other):
117+
# type: (object) -> bool
118+
"""Returns true if both objects are equal"""
119+
if not isinstance(other, ConnectionCompleted):
120+
return False
121+
122+
return self.__dict__ == other.__dict__
123+
124+
def __ne__(self, other):
125+
# type: (object) -> bool
126+
"""Returns true if both objects are not equal"""
127+
return not self == other

ask-sdk-model/ask_sdk_model/directive.py

+6
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,16 @@ class Directive(object):
5959
|
6060
| Dialog.ConfirmIntent: :py:class:`ask_sdk_model.dialog.confirm_intent_directive.ConfirmIntentDirective`,
6161
|
62+
| Connections.StartConnection: :py:class:`ask_sdk_model.interfaces.connections.v1.start_connection_directive.StartConnectionDirective`,
63+
|
6264
| GameEngine.StartInputHandler: :py:class:`ask_sdk_model.interfaces.game_engine.start_input_handler_directive.StartInputHandlerDirective`,
6365
|
6466
| VideoApp.Launch: :py:class:`ask_sdk_model.interfaces.videoapp.launch_directive.LaunchDirective`,
6567
|
6668
| GameEngine.StopInputHandler: :py:class:`ask_sdk_model.interfaces.game_engine.stop_input_handler_directive.StopInputHandlerDirective`,
6769
|
70+
| Tasks.CompleteTask: :py:class:`ask_sdk_model.interfaces.tasks.complete_task_directive.CompleteTaskDirective`,
71+
|
6872
| Alexa.Presentation.APL.RenderDocument: :py:class:`ask_sdk_model.interfaces.alexa.presentation.apl.render_document_directive.RenderDocumentDirective`,
6973
|
7074
| Connections.SendResponse: :py:class:`ask_sdk_model.interfaces.connections.send_response_directive.SendResponseDirective`,
@@ -94,9 +98,11 @@ class Directive(object):
9498
'Dialog.Delegate': 'ask_sdk_model.dialog.delegate_directive.DelegateDirective',
9599
'Hint': 'ask_sdk_model.interfaces.display.hint_directive.HintDirective',
96100
'Dialog.ConfirmIntent': 'ask_sdk_model.dialog.confirm_intent_directive.ConfirmIntentDirective',
101+
'Connections.StartConnection': 'ask_sdk_model.interfaces.connections.v1.start_connection_directive.StartConnectionDirective',
97102
'GameEngine.StartInputHandler': 'ask_sdk_model.interfaces.game_engine.start_input_handler_directive.StartInputHandlerDirective',
98103
'VideoApp.Launch': 'ask_sdk_model.interfaces.videoapp.launch_directive.LaunchDirective',
99104
'GameEngine.StopInputHandler': 'ask_sdk_model.interfaces.game_engine.stop_input_handler_directive.StopInputHandlerDirective',
105+
'Tasks.CompleteTask': 'ask_sdk_model.interfaces.tasks.complete_task_directive.CompleteTaskDirective',
100106
'Alexa.Presentation.APL.RenderDocument': 'ask_sdk_model.interfaces.alexa.presentation.apl.render_document_directive.RenderDocumentDirective',
101107
'Connections.SendResponse': 'ask_sdk_model.interfaces.connections.send_response_directive.SendResponseDirective',
102108
'Dialog.ElicitSlot': 'ask_sdk_model.dialog.elicit_slot_directive.ElicitSlotDirective',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 .start_connection_directive import StartConnectionDirective

ask-sdk-model/ask_sdk_model/interfaces/connections/v1/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)