|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +# |
| 4 | +# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file |
| 7 | +# except in compliance with the License. A copy of the License is located at |
| 8 | +# |
| 9 | +# http://aws.amazon.com/apache2.0/ |
| 10 | +# |
| 11 | +# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for |
| 13 | +# the specific language governing permissions and limitations under the License. |
| 14 | +# |
| 15 | + |
| 16 | +import pprint |
| 17 | +import re # noqa: F401 |
| 18 | +import six |
| 19 | +import typing |
| 20 | +from enum import Enum |
| 21 | +from ask_sdk_model.cause import Cause |
| 22 | + |
| 23 | + |
| 24 | +if typing.TYPE_CHECKING: |
| 25 | + from typing import Dict, List, Optional, Union |
| 26 | + from datetime import datetime |
| 27 | + from ask_sdk_model.status import Status |
| 28 | + |
| 29 | + |
| 30 | +class ConnectionCompleted(Cause): |
| 31 | + """ |
| 32 | + Represents the status and result needed to resume a skill's suspended session. |
| 33 | +
|
| 34 | +
|
| 35 | + :param token: This is an echo back string that skills send when during Connections.StartConnection directive. They will receive it when they get the SessionResumedRequest. It is never sent to the skill handling the request. |
| 36 | + :type token: (optional) str |
| 37 | + :param status: |
| 38 | + :type status: (optional) ask_sdk_model.status.Status |
| 39 | + :param result: This is the result object to resume the skill's suspended session. |
| 40 | + :type result: (optional) object |
| 41 | +
|
| 42 | + """ |
| 43 | + deserialized_types = { |
| 44 | + 'object_type': 'str', |
| 45 | + 'token': 'str', |
| 46 | + 'status': 'ask_sdk_model.status.Status', |
| 47 | + 'result': 'object' |
| 48 | + } # type: Dict |
| 49 | + |
| 50 | + attribute_map = { |
| 51 | + 'object_type': 'type', |
| 52 | + 'token': 'token', |
| 53 | + 'status': 'status', |
| 54 | + 'result': 'result' |
| 55 | + } # type: Dict |
| 56 | + |
| 57 | + def __init__(self, token=None, status=None, result=None): |
| 58 | + # type: (Optional[str], Optional[Status], Optional[object]) -> None |
| 59 | + """Represents the status and result needed to resume a skill's suspended session. |
| 60 | +
|
| 61 | + :param token: This is an echo back string that skills send when during Connections.StartConnection directive. They will receive it when they get the SessionResumedRequest. It is never sent to the skill handling the request. |
| 62 | + :type token: (optional) str |
| 63 | + :param status: |
| 64 | + :type status: (optional) ask_sdk_model.status.Status |
| 65 | + :param result: This is the result object to resume the skill's suspended session. |
| 66 | + :type result: (optional) object |
| 67 | + """ |
| 68 | + self.__discriminator_value = "ConnectionCompleted" # type: str |
| 69 | + |
| 70 | + self.object_type = self.__discriminator_value |
| 71 | + super(ConnectionCompleted, self).__init__(object_type=self.__discriminator_value) |
| 72 | + self.token = token |
| 73 | + self.status = status |
| 74 | + self.result = result |
| 75 | + |
| 76 | + def to_dict(self): |
| 77 | + # type: () -> Dict[str, object] |
| 78 | + """Returns the model properties as a dict""" |
| 79 | + result = {} # type: Dict |
| 80 | + |
| 81 | + for attr, _ in six.iteritems(self.deserialized_types): |
| 82 | + value = getattr(self, attr) |
| 83 | + if isinstance(value, list): |
| 84 | + result[attr] = list(map( |
| 85 | + lambda x: x.to_dict() if hasattr(x, "to_dict") else |
| 86 | + x.value if isinstance(x, Enum) else x, |
| 87 | + value |
| 88 | + )) |
| 89 | + elif isinstance(value, Enum): |
| 90 | + result[attr] = value.value |
| 91 | + elif hasattr(value, "to_dict"): |
| 92 | + result[attr] = value.to_dict() |
| 93 | + elif isinstance(value, dict): |
| 94 | + result[attr] = dict(map( |
| 95 | + lambda item: (item[0], item[1].to_dict()) |
| 96 | + if hasattr(item[1], "to_dict") else |
| 97 | + (item[0], item[1].value) |
| 98 | + if isinstance(item[1], Enum) else item, |
| 99 | + value.items() |
| 100 | + )) |
| 101 | + else: |
| 102 | + result[attr] = value |
| 103 | + |
| 104 | + return result |
| 105 | + |
| 106 | + def to_str(self): |
| 107 | + # type: () -> str |
| 108 | + """Returns the string representation of the model""" |
| 109 | + return pprint.pformat(self.to_dict()) |
| 110 | + |
| 111 | + def __repr__(self): |
| 112 | + # type: () -> str |
| 113 | + """For `print` and `pprint`""" |
| 114 | + return self.to_str() |
| 115 | + |
| 116 | + def __eq__(self, other): |
| 117 | + # type: (object) -> bool |
| 118 | + """Returns true if both objects are equal""" |
| 119 | + if not isinstance(other, ConnectionCompleted): |
| 120 | + return False |
| 121 | + |
| 122 | + return self.__dict__ == other.__dict__ |
| 123 | + |
| 124 | + def __ne__(self, other): |
| 125 | + # type: (object) -> bool |
| 126 | + """Returns true if both objects are not equal""" |
| 127 | + return not self == other |
0 commit comments