diff --git a/ask-sdk-model/CHANGELOG.rst b/ask-sdk-model/CHANGELOG.rst index dd889cb..04129dd 100644 --- a/ask-sdk-model/CHANGELOG.rst +++ b/ask-sdk-model/CHANGELOG.rst @@ -291,3 +291,12 @@ This release contains the following changes : This release contains the following changes : - Updated `rules for recurrence creation `__ in reminders. + + +1.22.0 +~~~~~~ + +This release contains the following changes : + +- APIs related to `timer management `__. + diff --git a/ask-sdk-model/ask_sdk_model/__version__.py b/ask-sdk-model/ask_sdk_model/__version__.py index 6f72cf2..96098ac 100644 --- a/ask-sdk-model/ask_sdk_model/__version__.py +++ b/ask-sdk-model/ask_sdk_model/__version__.py @@ -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' diff --git a/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/__init__.py b/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/__init__.py new file mode 100644 index 0000000..57220ec --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/__init__.py @@ -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 + diff --git a/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/messagingcontroller/__init__.py b/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/messagingcontroller/__init__.py new file mode 100644 index 0000000..9e5ea9d --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/messagingcontroller/__init__.py @@ -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 diff --git a/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/messagingcontroller/py.typed b/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/messagingcontroller/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/messagingcontroller/status_map.py b/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/messagingcontroller/status_map.py new file mode 100644 index 0000000..32444d6 --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/messagingcontroller/status_map.py @@ -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 diff --git a/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/py.typed b/ask-sdk-model/ask_sdk_model/interfaces/alexa/comms/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/ask-sdk-model/ask_sdk_model/services/service_client_factory.py b/ask-sdk-model/ask_sdk_model/services/service_client_factory.py index 1907000..30e9e46 100644 --- a/ask-sdk-model/ask_sdk_model/services/service_client_factory.py +++ b/ask-sdk-model/ask_sdk_model/services/service_client_factory.py @@ -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: @@ -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. diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/__init__.py b/ask-sdk-model/ask_sdk_model/services/timer_management/__init__.py new file mode 100644 index 0000000..46acb26 --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/__init__.py @@ -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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/announce_operation.py b/ask-sdk-model/ask_sdk_model/services/timer_management/announce_operation.py new file mode 100644 index 0000000..6936d13 --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/announce_operation.py @@ -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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/creation_behavior.py b/ask-sdk-model/ask_sdk_model/services/timer_management/creation_behavior.py new file mode 100644 index 0000000..a67c159 --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/creation_behavior.py @@ -0,0 +1,109 @@ +# 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 + from ask_sdk_model.services.timer_management.display_experience import DisplayExperience + + +class CreationBehavior(object): + """ + Whether the native Timer GUI is shown for 8-seconds upon Timer Creation. + + + :param display_experience: + :type display_experience: (optional) ask_sdk_model.services.timer_management.display_experience.DisplayExperience + + """ + deserialized_types = { + 'display_experience': 'ask_sdk_model.services.timer_management.display_experience.DisplayExperience' + } # type: Dict + + attribute_map = { + 'display_experience': 'displayExperience' + } # type: Dict + supports_multiple_types = False + + def __init__(self, display_experience=None): + # type: (Optional[DisplayExperience]) -> None + """Whether the native Timer GUI is shown for 8-seconds upon Timer Creation. + + :param display_experience: + :type display_experience: (optional) ask_sdk_model.services.timer_management.display_experience.DisplayExperience + """ + self.__discriminator_value = None # type: str + + self.display_experience = display_experience + + 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, CreationBehavior): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/display_experience.py b/ask-sdk-model/ask_sdk_model/services/timer_management/display_experience.py new file mode 100644 index 0000000..ac86f3d --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/display_experience.py @@ -0,0 +1,109 @@ +# 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 + from ask_sdk_model.services.timer_management.visibility import Visibility + + +class DisplayExperience(object): + """ + Multi model presentation of the timer creation. + + + :param visibility: + :type visibility: (optional) ask_sdk_model.services.timer_management.visibility.Visibility + + """ + deserialized_types = { + 'visibility': 'ask_sdk_model.services.timer_management.visibility.Visibility' + } # type: Dict + + attribute_map = { + 'visibility': 'visibility' + } # type: Dict + supports_multiple_types = False + + def __init__(self, visibility=None): + # type: (Optional[Visibility]) -> None + """Multi model presentation of the timer creation. + + :param visibility: + :type visibility: (optional) ask_sdk_model.services.timer_management.visibility.Visibility + """ + self.__discriminator_value = None # type: str + + self.visibility = visibility + + 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, DisplayExperience): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/error.py b/ask-sdk-model/ask_sdk_model/services/timer_management/error.py new file mode 100644 index 0000000..3e38a7d --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/error.py @@ -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 Error(object): + """ + Error object for Response. + + + :param code: Domain specific error code + :type code: (optional) str + :param message: Detailed error message + :type message: (optional) str + + """ + deserialized_types = { + 'code': 'str', + 'message': 'str' + } # type: Dict + + attribute_map = { + 'code': 'code', + 'message': 'message' + } # type: Dict + supports_multiple_types = False + + def __init__(self, code=None, message=None): + # type: (Optional[str], Optional[str]) -> None + """Error object for Response. + + :param code: Domain specific error code + :type code: (optional) str + :param message: Detailed error message + :type message: (optional) str + """ + self.__discriminator_value = None # type: str + + self.code = code + self.message = message + + 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, Error): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/launch_task_operation.py b/ask-sdk-model/ask_sdk_model/services/timer_management/launch_task_operation.py new file mode 100644 index 0000000..8088399 --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/launch_task_operation.py @@ -0,0 +1,122 @@ +# 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_confirm import TextToConfirm + from ask_sdk_model.services.timer_management.task import Task + + +class LaunchTaskOperation(Operation): + """ + LAUNCH_TASK trigger behavior representing launch a Skill Connection task exposed by the same skill. + + + :param text_to_confirm: + :type text_to_confirm: (optional) list[ask_sdk_model.services.timer_management.text_to_confirm.TextToConfirm] + :param task: + :type task: (optional) ask_sdk_model.services.timer_management.task.Task + + """ + deserialized_types = { + 'object_type': 'str', + 'text_to_confirm': 'list[ask_sdk_model.services.timer_management.text_to_confirm.TextToConfirm]', + 'task': 'ask_sdk_model.services.timer_management.task.Task' + } # type: Dict + + attribute_map = { + 'object_type': 'type', + 'text_to_confirm': 'textToConfirm', + 'task': 'task' + } # type: Dict + supports_multiple_types = False + + def __init__(self, text_to_confirm=None, task=None): + # type: (Optional[List[TextToConfirm]], Optional[Task]) -> None + """LAUNCH_TASK trigger behavior representing launch a Skill Connection task exposed by the same skill. + + :param text_to_confirm: + :type text_to_confirm: (optional) list[ask_sdk_model.services.timer_management.text_to_confirm.TextToConfirm] + :param task: + :type task: (optional) ask_sdk_model.services.timer_management.task.Task + """ + self.__discriminator_value = "LAUNCH_TASK" # type: str + + self.object_type = self.__discriminator_value + super(LaunchTaskOperation, self).__init__(object_type=self.__discriminator_value) + self.text_to_confirm = text_to_confirm + self.task = task + + 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, LaunchTaskOperation): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/notification_config.py b/ask-sdk-model/ask_sdk_model/services/timer_management/notification_config.py new file mode 100644 index 0000000..bc729f3 --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/notification_config.py @@ -0,0 +1,108 @@ +# 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 NotificationConfig(object): + """ + notification of the timer expiration. + + + :param play_audible: Whether the native trigger CX is employed for this timer. By extension, this also denote whether an explicit ‘Stop’ is required. + :type play_audible: (optional) bool + + """ + deserialized_types = { + 'play_audible': 'bool' + } # type: Dict + + attribute_map = { + 'play_audible': 'playAudible' + } # type: Dict + supports_multiple_types = False + + def __init__(self, play_audible=None): + # type: (Optional[bool]) -> None + """notification of the timer expiration. + + :param play_audible: Whether the native trigger CX is employed for this timer. By extension, this also denote whether an explicit ‘Stop’ is required. + :type play_audible: (optional) bool + """ + self.__discriminator_value = None # type: str + + self.play_audible = play_audible + + 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, NotificationConfig): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/notify_only_operation.py b/ask-sdk-model/ask_sdk_model/services/timer_management/notify_only_operation.py new file mode 100644 index 0000000..4a29319 --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/notify_only_operation.py @@ -0,0 +1,106 @@ +# 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 + + +class NotifyOnlyOperation(Operation): + """ + NOTIFY_ONLY trigger behavior represents chime only when timer expired. + + + + """ + deserialized_types = { + 'object_type': 'str' + } # type: Dict + + attribute_map = { + 'object_type': 'type' + } # type: Dict + supports_multiple_types = False + + def __init__(self): + # type: () -> None + """NOTIFY_ONLY trigger behavior represents chime only when timer expired. + + """ + self.__discriminator_value = "NOTIFY_ONLY" # type: str + + self.object_type = self.__discriminator_value + super(NotifyOnlyOperation, self).__init__(object_type=self.__discriminator_value) + + 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, NotifyOnlyOperation): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/operation.py b/ask-sdk-model/ask_sdk_model/services/timer_management/operation.py new file mode 100644 index 0000000..f45139b --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/operation.py @@ -0,0 +1,138 @@ +# 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 abc import ABCMeta, abstractmethod + + +if typing.TYPE_CHECKING: + from typing import Dict, List, Optional, Union + from datetime import datetime + + +class Operation(object): + """ + Triggering information for Timer. + + + :param object_type: The exact type of operation + :type object_type: (optional) str + + .. note:: + + This is an abstract class. Use the following mapping, to figure out + the model class to be instantiated, that sets ``type`` variable. + + | LAUNCH_TASK: :py:class:`ask_sdk_model.services.timer_management.launch_task_operation.LaunchTaskOperation`, + | + | ANNOUNCE: :py:class:`ask_sdk_model.services.timer_management.announce_operation.AnnounceOperation`, + | + | NOTIFY_ONLY: :py:class:`ask_sdk_model.services.timer_management.notify_only_operation.NotifyOnlyOperation` + + """ + deserialized_types = { + 'object_type': 'str' + } # type: Dict + + attribute_map = { + 'object_type': 'type' + } # type: Dict + supports_multiple_types = False + + discriminator_value_class_map = { + 'LAUNCH_TASK': 'ask_sdk_model.services.timer_management.launch_task_operation.LaunchTaskOperation', + 'ANNOUNCE': 'ask_sdk_model.services.timer_management.announce_operation.AnnounceOperation', + 'NOTIFY_ONLY': 'ask_sdk_model.services.timer_management.notify_only_operation.NotifyOnlyOperation' + } + + json_discriminator_key = "type" + + __metaclass__ = ABCMeta + + @abstractmethod + def __init__(self, object_type=None): + # type: (Optional[str]) -> None + """Triggering information for Timer. + + :param object_type: The exact type of operation + :type object_type: (optional) str + """ + self.__discriminator_value = None # type: str + + self.object_type = object_type + + @classmethod + def get_real_child_model(cls, data): + # type: (Dict[str, str]) -> Optional[str] + """Returns the real base class specified by the discriminator""" + discriminator_value = data[cls.json_discriminator_key] + return cls.discriminator_value_class_map.get(discriminator_value) + + 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, Operation): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/py.typed b/ask-sdk-model/ask_sdk_model/services/timer_management/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/status.py b/ask-sdk-model/ask_sdk_model/services/timer_management/status.py new file mode 100644 index 0000000..4ec73ec --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/status.py @@ -0,0 +1,67 @@ +# 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 Status(Enum): + """ + Status of timer + + + + Allowed enum values: [ON, PAUSED, OFF] + """ + ON = "ON" + PAUSED = "PAUSED" + OFF = "OFF" + + def to_dict(self): + # type: () -> Dict[str, object] + """Returns the model properties as a dict""" + result = {self.name: self.value} + return result + + def to_str(self): + # type: () -> str + """Returns the string representation of the model""" + return pprint.pformat(self.value) + + 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, Status): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/task.py b/ask-sdk-model/ask_sdk_model/services/timer_management/task.py new file mode 100644 index 0000000..26cb104 --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/task.py @@ -0,0 +1,122 @@ +# 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 Task(object): + """ + Custom task passed by skill developers when the operation type is \"LAUNCH_TASK\" + + + :param name: task name + :type name: (optional) str + :param version: task version E.g. \"1\" + :type version: (optional) str + :param input: Developers can pass in any dictionary they need for the skill + :type input: (optional) object + + """ + deserialized_types = { + 'name': 'str', + 'version': 'str', + 'input': 'object' + } # type: Dict + + attribute_map = { + 'name': 'name', + 'version': 'version', + 'input': 'input' + } # type: Dict + supports_multiple_types = False + + def __init__(self, name=None, version=None, input=None): + # type: (Optional[str], Optional[str], Optional[object]) -> None + """Custom task passed by skill developers when the operation type is \"LAUNCH_TASK\" + + :param name: task name + :type name: (optional) str + :param version: task version E.g. \"1\" + :type version: (optional) str + :param input: Developers can pass in any dictionary they need for the skill + :type input: (optional) object + """ + self.__discriminator_value = None # type: str + + self.name = name + self.version = version + self.input = input + + 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, Task): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/text_to_announce.py b/ask-sdk-model/ask_sdk_model/services/timer_management/text_to_announce.py new file mode 100644 index 0000000..51d37da --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/text_to_announce.py @@ -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 TextToAnnounce(object): + """ + When the operation type is \"ANNOUNCE\", announces a certain text that the developer wants to be read out at the expiration of the timer. + + + :param locale: The locale in which the announcement text is rendered. + :type locale: (optional) str + :param text: If provided, triggerText will be delivered by Timers speechlet upon trigger dismissal or immediately upon timer expiry if playAudible = false. + :type text: (optional) str + + """ + deserialized_types = { + 'locale': 'str', + 'text': 'str' + } # type: Dict + + attribute_map = { + 'locale': 'locale', + 'text': 'text' + } # type: Dict + supports_multiple_types = False + + def __init__(self, locale=None, text=None): + # type: (Optional[str], Optional[str]) -> None + """When the operation type is \"ANNOUNCE\", announces a certain text that the developer wants to be read out at the expiration of the timer. + + :param locale: The locale in which the announcement text is rendered. + :type locale: (optional) str + :param text: If provided, triggerText will be delivered by Timers speechlet upon trigger dismissal or immediately upon timer expiry if playAudible = false. + :type text: (optional) str + """ + self.__discriminator_value = None # type: str + + self.locale = locale + self.text = text + + 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, TextToAnnounce): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/text_to_confirm.py b/ask-sdk-model/ask_sdk_model/services/timer_management/text_to_confirm.py new file mode 100644 index 0000000..39067d7 --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/text_to_confirm.py @@ -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 TextToConfirm(object): + """ + When the operation type is \"LAUNCH_TASK\", confirm with the customer at the expiration of the timer. + + + :param locale: The locale in which the confirmation text is rendered. + :type locale: (optional) str + :param text: Prompt will be given to user upon trigger dismissal or timer expiry (depending on playAudible). %s (placeholder for “continue with Skill Name”) is mandatory. + :type text: (optional) str + + """ + deserialized_types = { + 'locale': 'str', + 'text': 'str' + } # type: Dict + + attribute_map = { + 'locale': 'locale', + 'text': 'text' + } # type: Dict + supports_multiple_types = False + + def __init__(self, locale=None, text=None): + # type: (Optional[str], Optional[str]) -> None + """When the operation type is \"LAUNCH_TASK\", confirm with the customer at the expiration of the timer. + + :param locale: The locale in which the confirmation text is rendered. + :type locale: (optional) str + :param text: Prompt will be given to user upon trigger dismissal or timer expiry (depending on playAudible). %s (placeholder for “continue with Skill Name”) is mandatory. + :type text: (optional) str + """ + self.__discriminator_value = None # type: str + + self.locale = locale + self.text = text + + 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, TextToConfirm): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/timer_management_service_client.py b/ask-sdk-model/ask_sdk_model/services/timer_management/timer_management_service_client.py new file mode 100644 index 0000000..fd809bd --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/timer_management_service_client.py @@ -0,0 +1,515 @@ +# 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 sys +import os +import re +import six +import typing + +from ask_sdk_model.services.base_service_client import BaseServiceClient +from ask_sdk_model.services.api_configuration import ApiConfiguration +from ask_sdk_model.services.service_client_response import ServiceClientResponse +from ask_sdk_model.services.api_response import ApiResponse +from ask_sdk_model.services.utils import user_agent_info + + + +if typing.TYPE_CHECKING: + from typing import Dict, List, Union, Any + from datetime import datetime + from ask_sdk_model.services.timer_management.timer_request import TimerRequest + from ask_sdk_model.services.timer_management.timer_response import TimerResponse + from ask_sdk_model.services.timer_management.timers_response import TimersResponse + from ask_sdk_model.services.timer_management.error import Error + + +class TimerManagementServiceClient(BaseServiceClient): + """ServiceClient for calling the TimerManagementService APIs. + + :param api_configuration: Instance of ApiConfiguration + :type api_configuration: ask_sdk_model.services.api_configuration.ApiConfiguration + """ + def __init__(self, api_configuration, custom_user_agent=None): + # type: (ApiConfiguration, str) -> None + """ + :param api_configuration: Instance of :py:class:`ask_sdk_model.services.api_configuration.ApiConfiguration` + :type api_configuration: ask_sdk_model.services.api_configuration.ApiConfiguration + :param custom_user_agent: Custom User Agent string provided by the developer. + :type custom_user_agent: str + """ + super(TimerManagementServiceClient, self).__init__(api_configuration) + self.user_agent = user_agent_info(sdk_version="1.0.0", custom_user_agent=custom_user_agent) + + def delete_timers(self, **kwargs): + # type: (**Any) -> Union[ApiResponse, Error] + """ + Delete all timers created by the skill. + + :param full_response: Boolean value to check if response should contain headers and status code information. + This value had to be passed through keyword arguments, by default the parameter value is set to False. + :type full_response: boolean + :rtype: Union[ApiResponse, Error] + """ + operation_name = "delete_timers" + params = locals() + for key, val in six.iteritems(params['kwargs']): + params[key] = val + del params['kwargs'] + + resource_path = '/v1/alerts/timers/' + resource_path = resource_path.replace('{format}', 'json') + + path_params = {} # type: Dict + + query_params = [] # type: List + + header_params = [] # type: List + + body_params = None + header_params.append(('Content-type', 'application/json')) + header_params.append(('User-Agent', self.user_agent)) + + # Response Type + full_response = False + if 'full_response' in params: + full_response = params['full_response'] + + # Authentication setting + authorization_value = "Bearer " + self._authorization_value + header_params.append(("Authorization", authorization_value)) + + error_definitions = [] # type: List + error_definitions.append(ServiceClientResponse(response_type=None, status_code=200, message="Success")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=400, message="Bad Request")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=401, message="Unauthorized")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=500, message="Internal Server Error")) + + api_response = self.invoke( + method="DELETE", + endpoint=self._api_endpoint, + path=resource_path, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=body_params, + response_definitions=error_definitions, + response_type=None) + + if full_response: + return api_response + + + def get_timers(self, **kwargs): + # type: (**Any) -> Union[ApiResponse, Error, TimersResponse] + """ + Get all timers created by the skill. + + :param full_response: Boolean value to check if response should contain headers and status code information. + This value had to be passed through keyword arguments, by default the parameter value is set to False. + :type full_response: boolean + :rtype: Union[ApiResponse, Error, TimersResponse] + """ + operation_name = "get_timers" + params = locals() + for key, val in six.iteritems(params['kwargs']): + params[key] = val + del params['kwargs'] + + resource_path = '/v1/alerts/timers/' + resource_path = resource_path.replace('{format}', 'json') + + path_params = {} # type: Dict + + query_params = [] # type: List + + header_params = [] # type: List + + body_params = None + header_params.append(('Content-type', 'application/json')) + header_params.append(('User-Agent', self.user_agent)) + + # Response Type + full_response = False + if 'full_response' in params: + full_response = params['full_response'] + + # Authentication setting + authorization_value = "Bearer " + self._authorization_value + header_params.append(("Authorization", authorization_value)) + + error_definitions = [] # type: List + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.timers_response.TimersResponse", status_code=200, message="Success")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=400, message="Bad Request")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=401, message="Unauthorized")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=500, message="Internal Server Error")) + + api_response = self.invoke( + method="GET", + endpoint=self._api_endpoint, + path=resource_path, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=body_params, + response_definitions=error_definitions, + response_type="ask_sdk_model.services.timer_management.timers_response.TimersResponse") + + if full_response: + return api_response + return api_response.body + + def delete_timer(self, id, **kwargs): + # type: (str, **Any) -> Union[ApiResponse, Error] + """ + Delete a timer by ID. + + :param id: (required) + :type id: str + :param full_response: Boolean value to check if response should contain headers and status code information. + This value had to be passed through keyword arguments, by default the parameter value is set to False. + :type full_response: boolean + :rtype: Union[ApiResponse, Error] + """ + operation_name = "delete_timer" + params = locals() + for key, val in six.iteritems(params['kwargs']): + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params) or (params['id'] is None): + raise ValueError( + "Missing the required parameter `id` when calling `" + operation_name + "`") + + resource_path = '/v1/alerts/timers/{id}' + resource_path = resource_path.replace('{format}', 'json') + + path_params = {} # type: Dict + if 'id' in params: + path_params['id'] = params['id'] + + query_params = [] # type: List + + header_params = [] # type: List + + body_params = None + header_params.append(('Content-type', 'application/json')) + header_params.append(('User-Agent', self.user_agent)) + + # Response Type + full_response = False + if 'full_response' in params: + full_response = params['full_response'] + + # Authentication setting + authorization_value = "Bearer " + self._authorization_value + header_params.append(("Authorization", authorization_value)) + + error_definitions = [] # type: List + error_definitions.append(ServiceClientResponse(response_type=None, status_code=200, message="Success")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=400, message="Bad Request")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=401, message="Unauthorized")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=404, message="Timer not found")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=500, message="Internal Server Error")) + + api_response = self.invoke( + method="DELETE", + endpoint=self._api_endpoint, + path=resource_path, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=body_params, + response_definitions=error_definitions, + response_type=None) + + if full_response: + return api_response + + + def get_timer(self, id, **kwargs): + # type: (str, **Any) -> Union[ApiResponse, TimerResponse, Error] + """ + Get timer by ID. + + :param id: (required) + :type id: str + :param full_response: Boolean value to check if response should contain headers and status code information. + This value had to be passed through keyword arguments, by default the parameter value is set to False. + :type full_response: boolean + :rtype: Union[ApiResponse, TimerResponse, Error] + """ + operation_name = "get_timer" + params = locals() + for key, val in six.iteritems(params['kwargs']): + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params) or (params['id'] is None): + raise ValueError( + "Missing the required parameter `id` when calling `" + operation_name + "`") + + resource_path = '/v1/alerts/timers/{id}' + resource_path = resource_path.replace('{format}', 'json') + + path_params = {} # type: Dict + if 'id' in params: + path_params['id'] = params['id'] + + query_params = [] # type: List + + header_params = [] # type: List + + body_params = None + header_params.append(('Content-type', 'application/json')) + header_params.append(('User-Agent', self.user_agent)) + + # Response Type + full_response = False + if 'full_response' in params: + full_response = params['full_response'] + + # Authentication setting + authorization_value = "Bearer " + self._authorization_value + header_params.append(("Authorization", authorization_value)) + + error_definitions = [] # type: List + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.timer_response.TimerResponse", status_code=200, message="Success")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=400, message="Bad Request")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=401, message="Unauthorized")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=404, message="Timer not found")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=500, message="Internal Server Error")) + + api_response = self.invoke( + method="GET", + endpoint=self._api_endpoint, + path=resource_path, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=body_params, + response_definitions=error_definitions, + response_type="ask_sdk_model.services.timer_management.timer_response.TimerResponse") + + if full_response: + return api_response + return api_response.body + + def pause_timer(self, id, **kwargs): + # type: (str, **Any) -> Union[ApiResponse, Error] + """ + Pause a timer. + + :param id: (required) + :type id: str + :param full_response: Boolean value to check if response should contain headers and status code information. + This value had to be passed through keyword arguments, by default the parameter value is set to False. + :type full_response: boolean + :rtype: Union[ApiResponse, Error] + """ + operation_name = "pause_timer" + params = locals() + for key, val in six.iteritems(params['kwargs']): + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params) or (params['id'] is None): + raise ValueError( + "Missing the required parameter `id` when calling `" + operation_name + "`") + + resource_path = '/v1/alerts/timers/{id}/pause' + resource_path = resource_path.replace('{format}', 'json') + + path_params = {} # type: Dict + if 'id' in params: + path_params['id'] = params['id'] + + query_params = [] # type: List + + header_params = [] # type: List + + body_params = None + header_params.append(('Content-type', 'application/json')) + header_params.append(('User-Agent', self.user_agent)) + + # Response Type + full_response = False + if 'full_response' in params: + full_response = params['full_response'] + + # Authentication setting + authorization_value = "Bearer " + self._authorization_value + header_params.append(("Authorization", authorization_value)) + + error_definitions = [] # type: List + error_definitions.append(ServiceClientResponse(response_type=None, status_code=200, message="Success")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=400, message="Bad Request")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=401, message="Unauthorized")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=404, message="Timer not found")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=500, message="Internal Server Error")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=504, message="Device offline")) + + api_response = self.invoke( + method="POST", + endpoint=self._api_endpoint, + path=resource_path, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=body_params, + response_definitions=error_definitions, + response_type=None) + + if full_response: + return api_response + + + def resume_timer(self, id, **kwargs): + # type: (str, **Any) -> Union[ApiResponse, Error] + """ + Resume a timer. + + :param id: (required) + :type id: str + :param full_response: Boolean value to check if response should contain headers and status code information. + This value had to be passed through keyword arguments, by default the parameter value is set to False. + :type full_response: boolean + :rtype: Union[ApiResponse, Error] + """ + operation_name = "resume_timer" + params = locals() + for key, val in six.iteritems(params['kwargs']): + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params) or (params['id'] is None): + raise ValueError( + "Missing the required parameter `id` when calling `" + operation_name + "`") + + resource_path = '/v1/alerts/timers/{id}/resume' + resource_path = resource_path.replace('{format}', 'json') + + path_params = {} # type: Dict + if 'id' in params: + path_params['id'] = params['id'] + + query_params = [] # type: List + + header_params = [] # type: List + + body_params = None + header_params.append(('Content-type', 'application/json')) + header_params.append(('User-Agent', self.user_agent)) + + # Response Type + full_response = False + if 'full_response' in params: + full_response = params['full_response'] + + # Authentication setting + authorization_value = "Bearer " + self._authorization_value + header_params.append(("Authorization", authorization_value)) + + error_definitions = [] # type: List + error_definitions.append(ServiceClientResponse(response_type=None, status_code=200, message="Success")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=400, message="Bad Request")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=401, message="Unauthorized")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=404, message="Timer not found")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=500, message="Internal Server Error")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=504, message="Device offline")) + + api_response = self.invoke( + method="POST", + endpoint=self._api_endpoint, + path=resource_path, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=body_params, + response_definitions=error_definitions, + response_type=None) + + if full_response: + return api_response + + + def create_timer(self, timer_request, **kwargs): + # type: (TimerRequest, **Any) -> Union[ApiResponse, TimerResponse, Error] + """ + Create a new timer. + + :param timer_request: (required) + :type timer_request: ask_sdk_model.services.timer_management.timer_request.TimerRequest + :param full_response: Boolean value to check if response should contain headers and status code information. + This value had to be passed through keyword arguments, by default the parameter value is set to False. + :type full_response: boolean + :rtype: Union[ApiResponse, TimerResponse, Error] + """ + operation_name = "create_timer" + params = locals() + for key, val in six.iteritems(params['kwargs']): + params[key] = val + del params['kwargs'] + # verify the required parameter 'timer_request' is set + if ('timer_request' not in params) or (params['timer_request'] is None): + raise ValueError( + "Missing the required parameter `timer_request` when calling `" + operation_name + "`") + + resource_path = '/v1/alerts/timers/' + resource_path = resource_path.replace('{format}', 'json') + + path_params = {} # type: Dict + + query_params = [] # type: List + + header_params = [] # type: List + + body_params = None + if 'timer_request' in params: + body_params = params['timer_request'] + header_params.append(('Content-type', 'application/json')) + header_params.append(('User-Agent', self.user_agent)) + + # Response Type + full_response = False + if 'full_response' in params: + full_response = params['full_response'] + + # Authentication setting + authorization_value = "Bearer " + self._authorization_value + header_params.append(("Authorization", authorization_value)) + + error_definitions = [] # type: List + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.timer_response.TimerResponse", status_code=200, message="Success")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=400, message="Bad Request")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=401, message="Unauthorized")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=403, message="Forbidden")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=500, message="Internal Server Error")) + error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.timer_management.error.Error", status_code=504, message="Device offline")) + + api_response = self.invoke( + method="POST", + endpoint=self._api_endpoint, + path=resource_path, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=body_params, + response_definitions=error_definitions, + response_type="ask_sdk_model.services.timer_management.timer_response.TimerResponse") + + if full_response: + return api_response + return api_response.body diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/timer_request.py b/ask-sdk-model/ask_sdk_model/services/timer_management/timer_request.py new file mode 100644 index 0000000..c61165c --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/timer_request.py @@ -0,0 +1,131 @@ +# 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 + from ask_sdk_model.services.timer_management.creation_behavior import CreationBehavior + from ask_sdk_model.services.timer_management.triggering_behavior import TriggeringBehavior + + +class TimerRequest(object): + """ + Input request for creating a timer. + + + :param duration: An ISO-8601 representation of duration. E.g. for 2 minutes and 3 seconds - \"PT2M3S\". + :type duration: (optional) str + :param timer_label: Label of this timer alert, maximum of 256 characters. + :type timer_label: (optional) str + :param creation_behavior: + :type creation_behavior: (optional) ask_sdk_model.services.timer_management.creation_behavior.CreationBehavior + :param triggering_behavior: + :type triggering_behavior: (optional) ask_sdk_model.services.timer_management.triggering_behavior.TriggeringBehavior + + """ + deserialized_types = { + 'duration': 'str', + 'timer_label': 'str', + 'creation_behavior': 'ask_sdk_model.services.timer_management.creation_behavior.CreationBehavior', + 'triggering_behavior': 'ask_sdk_model.services.timer_management.triggering_behavior.TriggeringBehavior' + } # type: Dict + + attribute_map = { + 'duration': 'duration', + 'timer_label': 'timerLabel', + 'creation_behavior': 'creationBehavior', + 'triggering_behavior': 'triggeringBehavior' + } # type: Dict + supports_multiple_types = False + + def __init__(self, duration=None, timer_label=None, creation_behavior=None, triggering_behavior=None): + # type: (Optional[str], Optional[str], Optional[CreationBehavior], Optional[TriggeringBehavior]) -> None + """Input request for creating a timer. + + :param duration: An ISO-8601 representation of duration. E.g. for 2 minutes and 3 seconds - \"PT2M3S\". + :type duration: (optional) str + :param timer_label: Label of this timer alert, maximum of 256 characters. + :type timer_label: (optional) str + :param creation_behavior: + :type creation_behavior: (optional) ask_sdk_model.services.timer_management.creation_behavior.CreationBehavior + :param triggering_behavior: + :type triggering_behavior: (optional) ask_sdk_model.services.timer_management.triggering_behavior.TriggeringBehavior + """ + self.__discriminator_value = None # type: str + + self.duration = duration + self.timer_label = timer_label + self.creation_behavior = creation_behavior + self.triggering_behavior = triggering_behavior + + 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, TimerRequest): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/timer_response.py b/ask-sdk-model/ask_sdk_model/services/timer_management/timer_response.py new file mode 100644 index 0000000..0b03d1c --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/timer_response.py @@ -0,0 +1,158 @@ +# 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 + from ask_sdk_model.services.timer_management.status import Status + + +class TimerResponse(object): + """ + Timer object + + + :param id: Unique id of this timer alert + :type id: (optional) str + :param status: + :type status: (optional) ask_sdk_model.services.timer_management.status.Status + :param duration: An ISO-8601 representation of duration. E.g. for 2 minutes and 3 seconds - \"PT2M3S\". + :type duration: (optional) str + :param trigger_time: Valid ISO 8601 format - Trigger time of this timer alert. + :type trigger_time: (optional) datetime + :param timer_label: Label of this timer alert, maximum of 256 character. + :type timer_label: (optional) str + :param created_time: Valid ISO 8601 format - Creation time of this timer alert. + :type created_time: (optional) datetime + :param updated_time: Valid ISO 8601 format - Last updated time of this timer alert. + :type updated_time: (optional) datetime + :param remaining_time_when_paused: An ISO-8601 representation of duration remaining since the timer was last paused. E.g. for 1 hour, 3 minutes and 31 seconds - \"PT1H3M31S\". + :type remaining_time_when_paused: (optional) str + + """ + deserialized_types = { + 'id': 'str', + 'status': 'ask_sdk_model.services.timer_management.status.Status', + 'duration': 'str', + 'trigger_time': 'datetime', + 'timer_label': 'str', + 'created_time': 'datetime', + 'updated_time': 'datetime', + 'remaining_time_when_paused': 'str' + } # type: Dict + + attribute_map = { + 'id': 'id', + 'status': 'status', + 'duration': 'duration', + 'trigger_time': 'triggerTime', + 'timer_label': 'timerLabel', + 'created_time': 'createdTime', + 'updated_time': 'updatedTime', + 'remaining_time_when_paused': 'remainingTimeWhenPaused' + } # type: Dict + supports_multiple_types = False + + def __init__(self, id=None, status=None, duration=None, trigger_time=None, timer_label=None, created_time=None, updated_time=None, remaining_time_when_paused=None): + # type: (Optional[str], Optional[Status], Optional[str], Optional[datetime], Optional[str], Optional[datetime], Optional[datetime], Optional[str]) -> None + """Timer object + + :param id: Unique id of this timer alert + :type id: (optional) str + :param status: + :type status: (optional) ask_sdk_model.services.timer_management.status.Status + :param duration: An ISO-8601 representation of duration. E.g. for 2 minutes and 3 seconds - \"PT2M3S\". + :type duration: (optional) str + :param trigger_time: Valid ISO 8601 format - Trigger time of this timer alert. + :type trigger_time: (optional) datetime + :param timer_label: Label of this timer alert, maximum of 256 character. + :type timer_label: (optional) str + :param created_time: Valid ISO 8601 format - Creation time of this timer alert. + :type created_time: (optional) datetime + :param updated_time: Valid ISO 8601 format - Last updated time of this timer alert. + :type updated_time: (optional) datetime + :param remaining_time_when_paused: An ISO-8601 representation of duration remaining since the timer was last paused. E.g. for 1 hour, 3 minutes and 31 seconds - \"PT1H3M31S\". + :type remaining_time_when_paused: (optional) str + """ + self.__discriminator_value = None # type: str + + self.id = id + self.status = status + self.duration = duration + self.trigger_time = trigger_time + self.timer_label = timer_label + self.created_time = created_time + self.updated_time = updated_time + self.remaining_time_when_paused = remaining_time_when_paused + + 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, TimerResponse): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/timers_response.py b/ask-sdk-model/ask_sdk_model/services/timer_management/timers_response.py new file mode 100644 index 0000000..1099f8c --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/timers_response.py @@ -0,0 +1,123 @@ +# 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 + from ask_sdk_model.services.timer_management.timer_response import TimerResponse + + +class TimersResponse(object): + """ + Timers object with paginated list of multiple timers + + + :param total_count: Total count of timers returned. + :type total_count: (optional) int + :param timers: List of multiple Timer objects + :type timers: (optional) list[ask_sdk_model.services.timer_management.timer_response.TimerResponse] + :param next_token: Link to retrieve next set of timers if total count is greater than max results. + :type next_token: (optional) str + + """ + deserialized_types = { + 'total_count': 'int', + 'timers': 'list[ask_sdk_model.services.timer_management.timer_response.TimerResponse]', + 'next_token': 'str' + } # type: Dict + + attribute_map = { + 'total_count': 'totalCount', + 'timers': 'timers', + 'next_token': 'nextToken' + } # type: Dict + supports_multiple_types = False + + def __init__(self, total_count=None, timers=None, next_token=None): + # type: (Optional[int], Optional[List[TimerResponse]], Optional[str]) -> None + """Timers object with paginated list of multiple timers + + :param total_count: Total count of timers returned. + :type total_count: (optional) int + :param timers: List of multiple Timer objects + :type timers: (optional) list[ask_sdk_model.services.timer_management.timer_response.TimerResponse] + :param next_token: Link to retrieve next set of timers if total count is greater than max results. + :type next_token: (optional) str + """ + self.__discriminator_value = None # type: str + + self.total_count = total_count + self.timers = timers + self.next_token = next_token + + 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, TimersResponse): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/triggering_behavior.py b/ask-sdk-model/ask_sdk_model/services/timer_management/triggering_behavior.py new file mode 100644 index 0000000..f683b2f --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/triggering_behavior.py @@ -0,0 +1,117 @@ +# 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 + from ask_sdk_model.services.timer_management.operation import Operation + from ask_sdk_model.services.timer_management.notification_config import NotificationConfig + + +class TriggeringBehavior(object): + """ + The triggering behavior upon Timer Expired. + + + :param operation: + :type operation: (optional) ask_sdk_model.services.timer_management.operation.Operation + :param notification_config: + :type notification_config: (optional) ask_sdk_model.services.timer_management.notification_config.NotificationConfig + + """ + deserialized_types = { + 'operation': 'ask_sdk_model.services.timer_management.operation.Operation', + 'notification_config': 'ask_sdk_model.services.timer_management.notification_config.NotificationConfig' + } # type: Dict + + attribute_map = { + 'operation': 'operation', + 'notification_config': 'notificationConfig' + } # type: Dict + supports_multiple_types = False + + def __init__(self, operation=None, notification_config=None): + # type: (Optional[Operation], Optional[NotificationConfig]) -> None + """The triggering behavior upon Timer Expired. + + :param operation: + :type operation: (optional) ask_sdk_model.services.timer_management.operation.Operation + :param notification_config: + :type notification_config: (optional) ask_sdk_model.services.timer_management.notification_config.NotificationConfig + """ + self.__discriminator_value = None # type: str + + self.operation = operation + self.notification_config = notification_config + + 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, TriggeringBehavior): + 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 diff --git a/ask-sdk-model/ask_sdk_model/services/timer_management/visibility.py b/ask-sdk-model/ask_sdk_model/services/timer_management/visibility.py new file mode 100644 index 0000000..1ec5b5b --- /dev/null +++ b/ask-sdk-model/ask_sdk_model/services/timer_management/visibility.py @@ -0,0 +1,66 @@ +# 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 Visibility(Enum): + """ + The default native Timer GUI \"visible\" is shown for 8-seconds upon Timer Creation. Otherwise, \"hidden\" will not show default native Timer GUI. + + + + Allowed enum values: [VISIBLE, HIDDEN] + """ + VISIBLE = "VISIBLE" + HIDDEN = "HIDDEN" + + def to_dict(self): + # type: () -> Dict[str, object] + """Returns the model properties as a dict""" + result = {self.name: self.value} + return result + + def to_str(self): + # type: () -> str + """Returns the string representation of the model""" + return pprint.pformat(self.value) + + 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, Visibility): + 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