|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +# |
| 4 | +# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file |
| 7 | +# except in compliance with the License. A copy of the License is located at |
| 8 | +# |
| 9 | +# http://aws.amazon.com/apache2.0/ |
| 10 | +# |
| 11 | +# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for |
| 13 | +# the specific language governing permissions and limitations under the License. |
| 14 | +# |
| 15 | + |
| 16 | +import pprint |
| 17 | +import re # noqa: F401 |
| 18 | +import six |
| 19 | +import typing |
| 20 | +from enum import Enum |
| 21 | +from ask_sdk_model.request import Request |
| 22 | + |
| 23 | + |
| 24 | +if typing.TYPE_CHECKING: |
| 25 | + from typing import Dict, List, Optional |
| 26 | + from datetime import datetime |
| 27 | + from ask_sdk_model.dialog_state import DialogState |
| 28 | + from ask_sdk_model.intent import Intent |
| 29 | + |
| 30 | + |
| 31 | +class CanFulfillIntentRequest(Request): |
| 32 | + """ |
| 33 | + An object that represents a request made to skill to query whether the skill can understand and fulfill the intent request with detected slots, before actually asking the skill to take action. Skill should be aware this is not to actually take action, skill should handle this request without causing side-effect, skill should not modify some state outside its scope or has an observable interaction with its calling functions or the outside world besides returning a value, such as playing sound,turning on/off lights, committing a transaction or a charge. |
| 34 | +
|
| 35 | +
|
| 36 | + :param request_id: Represents the unique identifier for the specific request. |
| 37 | + :type request_id: (optional) str |
| 38 | + :param timestamp: Provides the date and time when Alexa sent the request as an ISO 8601 formatted string. Used to verify the request when hosting your skill as a web service. |
| 39 | + :type timestamp: (optional) datetime |
| 40 | + :param dialog_state: |
| 41 | + :type dialog_state: (optional) ask_sdk_model.dialog_state.DialogState |
| 42 | + :param intent: |
| 43 | + :type intent: (optional) ask_sdk_model.intent.Intent |
| 44 | + :param locale: A string indicating the user’s locale. For example: en-US. |
| 45 | + :type locale: (optional) str |
| 46 | +
|
| 47 | + """ |
| 48 | + deserialized_types = { |
| 49 | + 'object_type': 'str', |
| 50 | + 'request_id': 'str', |
| 51 | + 'timestamp': 'datetime', |
| 52 | + 'dialog_state': 'ask_sdk_model.dialog_state.DialogState', |
| 53 | + 'intent': 'ask_sdk_model.intent.Intent', |
| 54 | + 'locale': 'str' |
| 55 | + } |
| 56 | + |
| 57 | + attribute_map = { |
| 58 | + 'object_type': 'type', |
| 59 | + 'request_id': 'requestId', |
| 60 | + 'timestamp': 'timestamp', |
| 61 | + 'dialog_state': 'dialogState', |
| 62 | + 'intent': 'intent', |
| 63 | + 'locale': 'locale' |
| 64 | + } |
| 65 | + |
| 66 | + def __init__(self, request_id=None, timestamp=None, dialog_state=None, intent=None, locale=None): |
| 67 | + # type: (Optional[str], Optional[datetime], Optional[DialogState], Optional[Intent], Optional[str]) -> None |
| 68 | + """An object that represents a request made to skill to query whether the skill can understand and fulfill the intent request with detected slots, before actually asking the skill to take action. Skill should be aware this is not to actually take action, skill should handle this request without causing side-effect, skill should not modify some state outside its scope or has an observable interaction with its calling functions or the outside world besides returning a value, such as playing sound,turning on/off lights, committing a transaction or a charge. |
| 69 | +
|
| 70 | + :param request_id: Represents the unique identifier for the specific request. |
| 71 | + :type request_id: (optional) str |
| 72 | + :param timestamp: Provides the date and time when Alexa sent the request as an ISO 8601 formatted string. Used to verify the request when hosting your skill as a web service. |
| 73 | + :type timestamp: (optional) datetime |
| 74 | + :param dialog_state: |
| 75 | + :type dialog_state: (optional) ask_sdk_model.dialog_state.DialogState |
| 76 | + :param intent: |
| 77 | + :type intent: (optional) ask_sdk_model.intent.Intent |
| 78 | + :param locale: A string indicating the user’s locale. For example: en-US. |
| 79 | + :type locale: (optional) str |
| 80 | + """ |
| 81 | + self.__discriminator_value = "CanFulfillIntentRequest" |
| 82 | + |
| 83 | + self.object_type = self.__discriminator_value |
| 84 | + super(CanFulfillIntentRequest, self).__init__(object_type=self.__discriminator_value, request_id=request_id, timestamp=timestamp) |
| 85 | + self.dialog_state = dialog_state |
| 86 | + self.intent = intent |
| 87 | + self.locale = locale |
| 88 | + |
| 89 | + def to_dict(self): |
| 90 | + # type: () -> Dict[str, object] |
| 91 | + """Returns the model properties as a dict""" |
| 92 | + result = {} |
| 93 | + |
| 94 | + for attr, _ in six.iteritems(self.deserialized_types): |
| 95 | + value = getattr(self, attr) |
| 96 | + if isinstance(value, list): |
| 97 | + result[attr] = list(map( |
| 98 | + lambda x: x.to_dict() if hasattr(x, "to_dict") else |
| 99 | + x.value if isinstance(x, Enum) else x, |
| 100 | + value |
| 101 | + )) |
| 102 | + elif isinstance(value, Enum): |
| 103 | + result[attr] = value.value |
| 104 | + elif hasattr(value, "to_dict"): |
| 105 | + result[attr] = value.to_dict() |
| 106 | + elif isinstance(value, dict): |
| 107 | + result[attr] = dict(map( |
| 108 | + lambda item: (item[0], item[1].to_dict()) |
| 109 | + if hasattr(item[1], "to_dict") else |
| 110 | + (item[0], item[1].value) |
| 111 | + if isinstance(item[1], Enum) else item, |
| 112 | + value.items() |
| 113 | + )) |
| 114 | + else: |
| 115 | + result[attr] = value |
| 116 | + |
| 117 | + return result |
| 118 | + |
| 119 | + def to_str(self): |
| 120 | + # type: () -> str |
| 121 | + """Returns the string representation of the model""" |
| 122 | + return pprint.pformat(self.to_dict()) |
| 123 | + |
| 124 | + def __repr__(self): |
| 125 | + # type: () -> str |
| 126 | + """For `print` and `pprint`""" |
| 127 | + return self.to_str() |
| 128 | + |
| 129 | + def __eq__(self, other): |
| 130 | + # type: (object) -> bool |
| 131 | + """Returns true if both objects are equal""" |
| 132 | + if not isinstance(other, CanFulfillIntentRequest): |
| 133 | + return False |
| 134 | + |
| 135 | + return self.__dict__ == other.__dict__ |
| 136 | + |
| 137 | + def __ne__(self, other): |
| 138 | + # type: (object) -> bool |
| 139 | + """Returns true if both objects are not equal""" |
| 140 | + return not self == other |
0 commit comments