Skip to content

Commit

Permalink
Release 1.22.0. For changelog, check CHANGELOG.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
ask-pyth committed Mar 16, 2020
1 parent b4a7388 commit 5adfd53
Show file tree
Hide file tree
Showing 28 changed files with 2,657 additions and 1 deletion.
9 changes: 9 additions & 0 deletions ask-sdk-model/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,12 @@ This release contains the following changes :
This release contains the following changes :

- Updated `rules for recurrence creation <https://developer.amazon.com/en-US/docs/alexa/smapi/alexa-reminders-api-reference.html#in-session-and-out-of-session-behavior-for-alexa-reminders-api>`__ in reminders.


1.22.0
~~~~~~

This release contains the following changes :

- APIs related to `timer management <https://developer.amazon.com/en-US/docs/alexa/smapi/alexa-timers-api-reference.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.21.0'
__version__ = '1.22.0'
__author__ = 'Alexa Skills Kit'
__author_email__ = 'ask-sdk-dynamic@amazon.com'
__license__ = 'Apache 2.0'
Expand Down
16 changes: 16 additions & 0 deletions ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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

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 .status_map import StatusMap
Empty file.
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 StatusMap(object):
"""
A map whose key is the new status and value is the message ID list. The status of the messages whose IDs are in the list will be updated to the new status from the key.
:param read: List of read messages
:type read: (optional) list[str]
:param deleted: List of deleted messages
:type deleted: (optional) list[str]
"""
deserialized_types = {
'read': 'list[str]',
'deleted': 'list[str]'
} # type: Dict

attribute_map = {
'read': 'read',
'deleted': 'deleted'
} # type: Dict
supports_multiple_types = False

def __init__(self, read=None, deleted=None):
# type: (Optional[List[object]], Optional[List[object]]) -> None
"""A map whose key is the new status and value is the message ID list. The status of the messages whose IDs are in the list will be updated to the new status from the key.
:param read: List of read messages
:type read: (optional) list[str]
:param deleted: List of deleted messages
:type deleted: (optional) list[str]
"""
self.__discriminator_value = None # type: str

self.read = read
self.deleted = deleted

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, StatusMap):
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
Empty file.
15 changes: 15 additions & 0 deletions ask-sdk-model/ask_sdk_model/services/service_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from .proactive_events import ProactiveEventsServiceClient
from .reminder_management import ReminderManagementServiceClient
from .skill_messaging import SkillMessagingServiceClient
from .timer_management import TimerManagementServiceClient
from .ups import UpsServiceClient

if typing.TYPE_CHECKING:
Expand Down Expand Up @@ -126,6 +127,20 @@ def get_reminder_management_service(self):
raise ValueError(
"ServiceClientFactory Error while initializing ReminderManagementServiceClient: " + str(e))

def get_timer_management_service(self):
# type: () -> TimerManagementServiceClient
"""Get TimerManagementServiceClient for timer_management_service.
:return: Client for calling the service
:rtype: TimerManagementServiceClient
:raises: :py:class:`ValueError`
"""
try:
return TimerManagementServiceClient(self.api_configuration)
except Exception as e:
raise ValueError(
"ServiceClientFactory Error while initializing TimerManagementServiceClient: " + str(e))

def get_ups_service(self):
# type: () -> UpsServiceClient
"""Get UpsServiceClient for ups_service.
Expand Down
34 changes: 34 additions & 0 deletions ask-sdk-model/ask_sdk_model/services/timer_management/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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 .error import Error
from .notification_config import NotificationConfig
from .timer_response import TimerResponse
from .timer_request import TimerRequest
from .display_experience import DisplayExperience
from .task import Task
from .launch_task_operation import LaunchTaskOperation
from .visibility import Visibility
from .status import Status
from .triggering_behavior import TriggeringBehavior
from .text_to_confirm import TextToConfirm
from .creation_behavior import CreationBehavior
from .timer_management_service_client import TimerManagementServiceClient
from .announce_operation import AnnounceOperation
from .timers_response import TimersResponse
from .operation import Operation
from .text_to_announce import TextToAnnounce
from .notify_only_operation import NotifyOnlyOperation
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# 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
from ask_sdk_model.services.timer_management.operation import Operation


if typing.TYPE_CHECKING:
from typing import Dict, List, Optional, Union
from datetime import datetime
from ask_sdk_model.services.timer_management.text_to_announce import TextToAnnounce


class AnnounceOperation(Operation):
"""
ANNOUNCE trigger behavior represents announcing a certain text that the developer wants to be read out at the expiration of the timer.
:param text_to_announce:
:type text_to_announce: (optional) list[ask_sdk_model.services.timer_management.text_to_announce.TextToAnnounce]
"""
deserialized_types = {
'object_type': 'str',
'text_to_announce': 'list[ask_sdk_model.services.timer_management.text_to_announce.TextToAnnounce]'
} # type: Dict

attribute_map = {
'object_type': 'type',
'text_to_announce': 'textToAnnounce'
} # type: Dict
supports_multiple_types = False

def __init__(self, text_to_announce=None):
# type: (Optional[List[TextToAnnounce]]) -> None
"""ANNOUNCE trigger behavior represents announcing a certain text that the developer wants to be read out at the expiration of the timer.
:param text_to_announce:
:type text_to_announce: (optional) list[ask_sdk_model.services.timer_management.text_to_announce.TextToAnnounce]
"""
self.__discriminator_value = "ANNOUNCE" # type: str

self.object_type = self.__discriminator_value
super(AnnounceOperation, self).__init__(object_type=self.__discriminator_value)
self.text_to_announce = text_to_announce

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, AnnounceOperation):
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
Loading

0 comments on commit 5adfd53

Please sign in to comment.