def get_in_skill_product(self, accept_language, product_id, **kwargs):
        # type: (str, str) -> Union[Error, InSkillProduct]
        """
        Get In-Skill Product information based on user context for the Skill.

        :param accept_language: (required) User's locale/language in context
        :type accept_language: str
        :param product_id: (required) Product Id.
        :type product_id: str
        :rtype: Union[Error, InSkillProduct]
        """
        operation_name = "get_in_skill_product"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'accept_language' is set
        if ('accept_language' not in params) or (params['accept_language'] is None):
            raise ValueError(
                "Missing the required parameter `accept_language` when calling `" + operation_name + "`")
        # verify the required parameter 'product_id' is set
        if ('product_id' not in params) or (params['product_id'] is None):
            raise ValueError(
                "Missing the required parameter `product_id` when calling `" + operation_name + "`")

        resource_path = '/v1/users/~current/skills/~current/inSkillProducts/{productId}'.replace('{format}', 'json')
        path_params = {}
        if 'product_id' in params:
            path_params['productId'] = params['product_id']

        query_params = []

        header_params = []
        if 'accept_language' in params:
            header_params.append(('Accept-Language', params['accept_language']))

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # Authentication setting
        authorization_value = "Bearer " + self._authorization_value
        header_params.append(("Authorization", authorization_value))

        error_definitions = []
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.monetization.in_skill_product.InSkillProduct", status_code=200, message="Returns an In-Skill Product on success."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.monetization.error.Error", status_code=400, message="Invalid request."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.monetization.error.Error", status_code=401, message="The authentication token is invalid or doesn't have access to make this request"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.monetization.error.Error", status_code=404, message="Requested resource not found."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.monetization.error.Error", status_code=500, message="Internal Server Error."))

        return 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.monetization.in_skill_product.InSkillProduct")
Exemple #2
0
    def get_lists_metadata(self, **kwargs):
        # type: () -> Union[ForbiddenError, Error, AlexaListsMetadata]
        """
        Retrieves the metadata for all customer lists, including the customer’s default lists.  # noqa: E501

        :rtype: ask_sdk_model.services.list_management.alexa_lists_metadata.AlexaListsMetadata
        """
        operation_name = "get_lists_metadata"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']

        resource_path = '/v2/householdlists/'.replace('{format}', 'json')
        path_params = {}

        query_params = []

        header_params = []

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # Authentication setting
        authorization_value = "Bearer " + self._authorization_value
        header_params.append(("Authorization", authorization_value))

        error_definitions = []
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.list_management.alexa_lists_metadata.AlexaListsMetadata",
                status_code=200,
                message="Success"))  # noqa: E501
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.list_management.forbidden_error.ForbiddenError",
                status_code=403,
                message="Forbidden"))  # noqa: E501
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.list_management.error.Error",
                status_code=500,
                message="Internal Server Error"))  # noqa: E501

        return self.invoke(
            method="GET",
            endpoint="https://api.amazonalexa.com/",
            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.list_management.alexa_lists_metadata.AlexaListsMetadata"
        )
    def delete_timers(self, **kwargs):
        # type: (**Any) -> Union[ApiResponse, object, Error_249911d1]
        """
        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, object, Error_249911d1]
        """
        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
        
        return None
    def get_reminders(self, **kwargs):
        # type: (**Any) -> Union[ApiResponse, GetRemindersResponse, Error]
        """
        This API is invoked by the skill to get a all reminders created by the caller. 

        :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, GetRemindersResponse, Error]
        """
        operation_name = "get_reminders"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']

        resource_path = '/v1/alerts/reminders/'
        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.reminder_management.get_reminders_response.GetRemindersResponse", status_code=200, message="Success"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.reminder_management.error.Error", status_code=401, message="UserAuthenticationException. Request is not authorized/authenticated e.g. If customer does not have permission to create a reminder."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.reminder_management.error.Error", status_code=429, message="RateExceededException e.g. When the skill is throttled for exceeding the max rate"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.reminder_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.reminder_management.get_reminders_response.GetRemindersResponse")

        if full_response:
            return api_response
        return api_response.body
    def get_lists_metadata(self, **kwargs):
        # type: (**Any) -> Union[ApiResponse, ForbiddenError, Error, AlexaListsMetadata]
        """
        Retrieves the metadata for all customer lists, including the customer’s default lists. 

        :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, ForbiddenError, Error, AlexaListsMetadata]
        """
        operation_name = "get_lists_metadata"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']

        resource_path = '/v2/householdlists/'
        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.list_management.alexa_lists_metadata.AlexaListsMetadata", status_code=200, message="Success"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.forbidden_error.ForbiddenError", status_code=403, message="Forbidden"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=500, message="Internal Server Error"))

        api_response = self.invoke(
            method="GET",
            endpoint="https://api.amazonalexa.com/",
            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.list_management.alexa_lists_metadata.AlexaListsMetadata")

        if full_response:
            return api_response
        return api_response.body
Exemple #6
0
    def get_voice_purchase_setting(self, **kwargs):
        # type: (**Any) -> Union[ApiResponse, bool, Error]
        """
        Returns whether or not voice purchasing is enabled for 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, bool, Error]
        """
        operation_name = "get_voice_purchase_setting"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']

        resource_path = '/v1/users/~current/skills/~current/settings/voicePurchasing.enabled'
        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'))

        # 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="bool", status_code=200, message="Returns a boolean value for voice purchase setting on success."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.monetization.error.Error", status_code=400, message="Invalid request."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.monetization.error.Error", status_code=401, message="The authentication token is invalid or doesn't have access to make this request"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.monetization.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="bool")

        if full_response:
            return api_response
        return api_response.body
    def delete_list(self, list_id, **kwargs):
        # type: (str, **Any) -> Union[Error]
        """
        This API deletes a customer custom list.

        :param list_id: (required) Value of the customer’s listId retrieved from a getListsMetadata call
        :type list_id: str
        :rtype: None
        """
        operation_name = "delete_list"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'list_id' is set
        if ('list_id' not in params) or (params['list_id'] is None):
            raise ValueError(
                "Missing the required parameter `list_id` when calling `" + operation_name + "`")

        resource_path = '/v2/householdlists/{listId}/'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict
        if 'list_id' in params:
            path_params['listId'] = params['list_id']

        query_params = []  # type: List

        header_params = []  # type: List

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # 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.list_management.error.Error", status_code=403, message="Forbidden"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=404, message="Not Found"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=500, message="Internal Server Error"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=0, message="Internal Server Error"))

        self.invoke(
            method="DELETE",
            endpoint="https://api.amazonalexa.com/",
            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)
    def enqueue(self, send_directive_request, **kwargs):
        # type: (SendDirectiveRequest, **Any) -> Union[Error]
        """
        Send directives to Alexa.

        :param send_directive_request: (required) Represents the request object to send in the payload.
        :type send_directive_request: ask_sdk_model.services.directive.send_directive_request.SendDirectiveRequest
        :rtype: None
        """
        operation_name = "enqueue"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'send_directive_request' is set
        if ('send_directive_request' not in params) or (params['send_directive_request'] is None):
            raise ValueError(
                "Missing the required parameter `send_directive_request` when calling `" + operation_name + "`")

        resource_path = '/v1/directives'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict

        query_params = []  # type: List

        header_params = []  # type: List

        body_params = None
        if 'send_directive_request' in params:
            body_params = params['send_directive_request']
        header_params.append(('Content-type', 'application/json'))

        # 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=204, message="Directive sent successfully."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.directive.error.Error", status_code=400, message="Directive not valid."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.directive.error.Error", status_code=401, message="Not Authorized."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.directive.error.Error", status_code=403, message="The skill is not allowed to send directives at the moment."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.directive.error.Error", status_code=0, message="Unexpected error."))

        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)
    def get_persons_profile_name(self, **kwargs):
        # type: (**Any) -> Union[ApiResponse, str, Error]
        """
        Gets the full name of the recognized speaker at person-level. Requires speaker consent at person-level for scopes: [alexa::profile:name:read] 

        :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, str, Error]
        """
        operation_name = "get_persons_profile_name"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']

        resource_path = '/v2/persons/~current/profile/name'
        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="str", status_code=200, message="Successfully retrieved the requested information."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=204, message="The query did not return any results."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=401, message="The authentication token is malformed or invalid."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=403, message="The authentication token does not have access to resource."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=429, message="The skill has been throttled due to an excessive number of requests."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=0, message="An unexpected error occurred."))

        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="str")

        if full_response:
            return api_response
        return api_response.body
    def create_list(self, create_list_request, **kwargs):
        # type: (CreateListRequest, **Any) -> Union[Error, AlexaListMetadata]
        """
        This API creates a custom list. The new list name must be different than any existing list name. 

        :param create_list_request: (required) 
        :type create_list_request: ask_sdk_model.services.list_management.create_list_request.CreateListRequest
        :rtype: Union[Error, AlexaListMetadata]
        """
        operation_name = "create_list"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'create_list_request' is set
        if ('create_list_request' not in params) or (params['create_list_request'] is None):
            raise ValueError(
                "Missing the required parameter `create_list_request` when calling `" + operation_name + "`")

        resource_path = '/v2/householdlists/'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict

        query_params = []  # type: List

        header_params = []  # type: List

        body_params = None
        if 'create_list_request' in params:
            body_params = params['create_list_request']
        header_params.append(('Content-type', 'application/json'))

        # 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.list_management.alexa_list_metadata.AlexaListMetadata", status_code=201, message="Success"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=400, message="Bad Request"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=403, message="Forbidden"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=409, message="Conflict"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=500, message="Internal Server Error"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=0, message="Internal Server Error"))

        return self.invoke(
            method="POST",
            endpoint="https://api.amazonalexa.com/",
            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.list_management.alexa_list_metadata.AlexaListMetadata")
Exemple #11
0
    def get_system_time_zone(self, device_id, **kwargs):
        # type: (str) -> Union[str, Error]
        """
        Gets the time zone of the device. Does not require explict customer consent. 

        :param device_id: (required) The device Id
        :type device_id: str
        :rtype: Union[str, Error]
        """
        operation_name = "get_system_time_zone"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params) or (params['device_id'] is None):
            raise ValueError(
                "Missing the required parameter `device_id` when calling `" + operation_name + "`")

        resource_path = '/v2/devices/{deviceId}/settings/System.timeZone'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']

        query_params = []

        header_params = []

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # Authentication setting
        authorization_value = "Bearer " + self._authorization_value
        header_params.append(("Authorization", authorization_value))

        error_definitions = []
        error_definitions.append(ServiceClientResponse(response_type="str", status_code=200, message="Successfully get the setting"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=204, message="The query did not return any results."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=401, message="The authentication token is malformed or invalid."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=403, message="The authentication token does not have access to resource."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=429, message="The skill has been throttled due to an excessive number of requests."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=0, message="An unexpected error occurred."))

        return 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="str")
    def get_endpoints(self, **kwargs):
        # type: (**Any) -> Union[EndpointEnumerationResponse, Error]
        """
        This API is invoked by the skill to retrieve endpoints connected to the Echo device. 

        :rtype: Union[EndpointEnumerationResponse, Error]
        """
        operation_name = "get_endpoints"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']

        resource_path = '/v1/endpoints/'
        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'))

        # 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.endpoint_enumeration.endpoint_enumeration_response.EndpointEnumerationResponse", status_code=200, message="Successfully retrieved the list of connected endpoints."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=400, message="Bad request. Returned when a required parameter is not present or badly formatted."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=401, message="Unauthenticated. Returned when the request is not authenticated."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=403, message="Forbidden. Returned when the request is authenticated but does not have sufficient permission."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=500, message="Server Error. Returned when the server encountered an error processing the request."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=503, message="Service Unavailable. Returned when the server is not ready to handle the request."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.endpoint_enumeration.error.Error", status_code=0, message="Unexpected error"))

        return 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.endpoint_enumeration.endpoint_enumeration_response.EndpointEnumerationResponse")
    def get_country_and_postal_code(self, device_id, **kwargs):
        # type: (str) -> Union[ShortAddress, Error]
        """
        Gets the country and postal code of a device 

        :param device_id: (required) The device Id for which to get the country and postal code
        :type device_id: str
        :rtype: Union[ShortAddress, Error]
        """
        operation_name = "get_country_and_postal_code"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params) or (params['device_id'] is None):
            raise ValueError(
                "Missing the required parameter `device_id` when calling `" + operation_name + "`")

        resource_path = '/v1/devices/{deviceId}/settings/address/countryAndPostalCode'.replace('{format}', 'json')
        path_params = {}
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']

        query_params = []

        header_params = []

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # Authentication setting
        authorization_value = "Bearer " + self._authorization_value
        header_params.append(("Authorization", authorization_value))

        error_definitions = []
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.device_address.short_address.ShortAddress", status_code=200, message="Successfully get the country and postal code of the deviceId"))
        error_definitions.append(ServiceClientResponse(response_type=None, status_code=204, message="No content could be queried out"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.device_address.error.Error", status_code=403, message="The authentication token is invalid or doesn't have access to the resource"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.device_address.error.Error", status_code=405, message="The method is not supported"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.device_address.error.Error", status_code=429, message="The request is throttled"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.device_address.error.Error", status_code=0, message="Unexpected error"))

        return 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.device_address.short_address.ShortAddress")
Exemple #14
0
    def get_profile_given_name(self, **kwargs):
        # type: () -> Union[str, Error]
        """
        Gets the given name (first name) of the customer associated with the current enablement. Requires customer consent for scopes: [alexa::profile:given_name:read] 

        :rtype: Union[str, Error]
        """
        operation_name = "get_profile_given_name"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']

        resource_path = '/v2/accounts/~current/settings/Profile.givenName'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}

        query_params = []

        header_params = []

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # Authentication setting
        authorization_value = "Bearer " + self._authorization_value
        header_params.append(("Authorization", authorization_value))

        error_definitions = []
        error_definitions.append(ServiceClientResponse(response_type="str", status_code=200, message="Successfully retrieved the requested information."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=204, message="The query did not return any results."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=401, message="The authentication token is malformed or invalid."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=403, message="The authentication token does not have access to resource."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=429, message="The skill has been throttled due to an excessive number of requests."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=0, message="An unexpected error occurred."))

        return 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="str")
    def get_endpoints(self, **kwargs):
        # type: (**Any) -> Union[ApiResponse, object, EndpointEnumerationResponse, Error]
        """
        This API is invoked by the skill to retrieve endpoints connected to the Echo device. 

        :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, object, EndpointEnumerationResponse, Error]
        """
        operation_name = "get_endpoints"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']

        resource_path = '/v1/endpoints'
        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.endpoint_enumeration.endpoint_enumeration_response.EndpointEnumerationResponse",
                status_code=200,
                message=
                "Successfully retrieved the list of connected endpoints."))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.endpoint_enumeration.error.Error",
                status_code=400,
                message=
                "Bad request. Returned when a required parameter is not present or badly formatted."
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.endpoint_enumeration.error.Error",
                status_code=401,
                message=
                "Unauthenticated. Returned when the request is not authenticated."
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.endpoint_enumeration.error.Error",
                status_code=403,
                message=
                "Forbidden. Returned when the request is authenticated but does not have sufficient permission."
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.endpoint_enumeration.error.Error",
                status_code=500,
                message=
                "Server Error. Returned when the server encountered an error processing the request."
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.endpoint_enumeration.error.Error",
                status_code=503,
                message=
                "Service Unavailable. Returned when the server is not ready to handle the request."
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.endpoint_enumeration.error.Error",
                status_code=0,
                message="Unexpected 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.endpoint_enumeration.endpoint_enumeration_response.EndpointEnumerationResponse"
        )

        if full_response:
            return api_response
        return api_response.body
    def create_proactive_event(self, create_proactive_event_request, stage,
                               **kwargs):
        # type: (CreateProactiveEventRequest, SkillStage, **Any) -> Union[ApiResponse, object, Error]
        """
        Create a new proactive event in live stage.

        :param create_proactive_event_request: (required) Request to create a new proactive event.
        :type create_proactive_event_request: ask_sdk_model.services.proactive_events.create_proactive_event_request.CreateProactiveEventRequest
        :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, object, Error]
        """
        operation_name = "create_proactive_event"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'create_proactive_event_request' is set
        if ('create_proactive_event_request' not in params) or (
                params['create_proactive_event_request'] is None):
            raise ValueError(
                "Missing the required parameter `create_proactive_event_request` when calling `"
                + operation_name + "`")

        resource_path = '/v1/proactiveEvents'
        if stage == SkillStage.DEVELOPMENT:
            resource_path += "/stages/development"
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict

        query_params = []  # type: List

        header_params = []  # type: List

        body_params = None
        if 'create_proactive_event_request' in params:
            body_params = params['create_proactive_event_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
        access_token = self._lwa_service_client.get_access_token_for_scope(
            "alexa::proactive_events")
        authorization_value = "Bearer " + access_token
        header_params.append(('Authorization', authorization_value))

        error_definitions = []  # type: List
        error_definitions.append(
            ServiceClientResponse(response_type=None,
                                  status_code=202,
                                  message="Request accepted"))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.proactive_events.error.Error",
                status_code=400,
                message=
                "A required parameter is not present or is incorrectly formatted, or the requested creation of a resource has already been completed by a previous request. "
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.proactive_events.error.Error",
                status_code=403,
                message=
                "The authentication token is invalid or doesn't have authentication to access the resource"
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.proactive_events.error.Error",
                status_code=409,
                message=
                "A skill attempts to create duplicate events using the same referenceId for the same customer."
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.proactive_events.error.Error",
                status_code=429,
                message="The client has made more calls than the allowed limit."
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.proactive_events.error.Error",
                status_code=500,
                message=
                "The ProactiveEvents service encounters an internal error for a valid request."
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.proactive_events.error.Error",
                status_code=0,
                message="Unexpected error"))

        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

        return None
Exemple #17
0
    def send_skill_message(self, user_id, send_skill_messaging_request,
                           **kwargs):
        # type: (str, SendSkillMessagingRequest, **Any) -> Union[ApiResponse, object, Error]
        """
        Send a message request to a skill for a specified user.

        :param user_id: (required) The user Id for the specific user to send the message
        :type user_id: str
        :param send_skill_messaging_request: (required) Message Request to be sent to the skill.
        :type send_skill_messaging_request: ask_sdk_model.services.skill_messaging.send_skill_messaging_request.SendSkillMessagingRequest
        :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, object, Error]
        """
        operation_name = "send_skill_message"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'user_id' is set
        if ('user_id' not in params) or (params['user_id'] is None):
            raise ValueError(
                "Missing the required parameter `user_id` when calling `" +
                operation_name + "`")
        # verify the required parameter 'send_skill_messaging_request' is set
        if ('send_skill_messaging_request' not in params) or (
                params['send_skill_messaging_request'] is None):
            raise ValueError(
                "Missing the required parameter `send_skill_messaging_request` when calling `"
                + operation_name + "`")

        resource_path = '/v1/skillmessages/users/{userId}'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict
        if 'user_id' in params:
            path_params['userId'] = params['user_id']

        query_params = []  # type: List

        header_params = []  # type: List

        body_params = None
        if 'send_skill_messaging_request' in params:
            body_params = params['send_skill_messaging_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
        access_token = self._lwa_service_client.get_access_token_for_scope(
            "alexa:skill_messaging")
        authorization_value = "Bearer " + access_token
        header_params.append(('Authorization', authorization_value))

        error_definitions = []  # type: List
        error_definitions.append(
            ServiceClientResponse(
                response_type=None,
                status_code=202,
                message=
                "Message has been successfully accepted, and will be sent to the skill "
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.skill_messaging.error.Error",
                status_code=400,
                message="Data is missing or not valid "))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.skill_messaging.error.Error",
                status_code=403,
                message=
                "The skill messaging authentication token is expired or not valid "
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.skill_messaging.error.Error",
                status_code=404,
                message="The passed userId does not exist "))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.skill_messaging.error.Error",
                status_code=429,
                message=
                "The requester has exceeded their maximum allowable rate of messages "
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.skill_messaging.error.Error",
                status_code=500,
                message=
                "The SkillMessaging service encountered an internal error for a valid request. "
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.skill_messaging.error.Error",
                status_code=0,
                message="Unexpected error"))

        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

        return None
Exemple #18
0
    def enqueue(self, send_directive_request, **kwargs):
        # type: (SendDirectiveRequest, **Any) -> Union[ApiResponse, object, Error]
        """
        Send directives to Alexa.

        :param send_directive_request: (required) Represents the request object to send in the payload.
        :type send_directive_request: ask_sdk_model.services.directive.send_directive_request.SendDirectiveRequest
        :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, object, Error]
        """
        operation_name = "enqueue"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'send_directive_request' is set
        if ('send_directive_request' not in params) or (params['send_directive_request'] is None):
            raise ValueError(
                "Missing the required parameter `send_directive_request` when calling `" + operation_name + "`")

        resource_path = '/v1/directives'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict

        query_params = []  # type: List

        header_params = []  # type: List

        body_params = None
        if 'send_directive_request' in params:
            body_params = params['send_directive_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=None, status_code=204, message="Directive sent successfully."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.directive.error.Error", status_code=400, message="Directive not valid."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.directive.error.Error", status_code=401, message="Not Authorized."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.directive.error.Error", status_code=403, message="The skill is not allowed to send directives at the moment."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.directive.error.Error", status_code=0, message="Unexpected error."))

        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
        
        return None
    def create_timer(self, timer_request, **kwargs):
        # type: (TimerRequest, **Any) -> Union[ApiResponse, object, 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, object, 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
Exemple #20
0
    def get_list(self, list_id, status, **kwargs):
        # type: (str, str) -> Union[AlexaList, Error]
        """
        Retrieves the list metadata including the items in the list with requested status.  # noqa: E501

        :param list_id: (required) Retrieved from a call to GetListsMetadata to specify the listId in the request path.  # noqa: E501
        :type list_id: str
        :param status: (required) Specify the status of the list.  # noqa: E501
        :type status: str
        :rtype: ask_sdk_model.services.list_management.alexa_list.AlexaList
        """
        operation_name = "get_list"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'list_id' is set
        if ('list_id' not in params) or (params['list_id'] is None):
            raise ValueError(
                "Missing the required parameter `list_id` when calling `" +
                operation_name + "`")
        # verify the required parameter 'status' is set
        if ('status' not in params) or (params['status'] is None):
            raise ValueError(
                "Missing the required parameter `status` when calling `" +
                operation_name + "`")

        resource_path = '/v2/householdlists/{listId}/{status}/'.replace(
            '{format}', 'json')
        path_params = {}
        if 'list_id' in params:
            path_params['listId'] = params['list_id']
        if 'status' in params:
            path_params['status'] = params['status']

        query_params = []

        header_params = []

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # Authentication setting
        authorization_value = "Bearer " + self._authorization_value
        header_params.append(("Authorization", authorization_value))

        error_definitions = []
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.list_management.alexa_list.AlexaList",
                status_code=200,
                message="Success"))  # noqa: E501
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.list_management.error.Error",
                status_code=400,
                message="Bad Request"))  # noqa: E501
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.list_management.error.Error",
                status_code=403,
                message="Forbidden"))  # noqa: E501
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.list_management.error.Error",
                status_code=404,
                message="Not Found"))  # noqa: E501
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.list_management.error.Error",
                status_code=500,
                message="Internal Server Error"))  # noqa: E501
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.list_management.error.Error",
                status_code=0,
                message="Internal Server Error"))  # noqa: E501

        return self.invoke(
            method="GET",
            endpoint="https://api.amazonalexa.com/",
            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.list_management.alexa_list.AlexaList")
    def get_country_and_postal_code(self, device_id, **kwargs):
        # type: (str, **Any) -> Union[ApiResponse, object, ShortAddress, Error]
        """
        Gets the country and postal code of a device 

        :param device_id: (required) The device Id for which to get the country and postal code
        :type device_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, object, ShortAddress, Error]
        """
        operation_name = "get_country_and_postal_code"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params) or (params['device_id'] is None):
            raise ValueError(
                "Missing the required parameter `device_id` when calling `" +
                operation_name + "`")

        resource_path = '/v1/devices/{deviceId}/settings/address/countryAndPostalCode'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict
        if 'device_id' in params:
            path_params['deviceId'] = params['device_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.device_address.short_address.ShortAddress",
                status_code=200,
                message=
                "Successfully get the country and postal code of the deviceId")
        )
        error_definitions.append(
            ServiceClientResponse(response_type=None,
                                  status_code=204,
                                  message="No content could be queried out"))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.device_address.error.Error",
                status_code=403,
                message=
                "The authentication token is invalid or doesn't have access to the resource"
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.device_address.error.Error",
                status_code=405,
                message="The method is not supported"))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.device_address.error.Error",
                status_code=429,
                message="The request is throttled"))
        error_definitions.append(
            ServiceClientResponse(
                response_type=
                "ask_sdk_model.services.device_address.error.Error",
                status_code=0,
                message="Unexpected 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.device_address.short_address.ShortAddress")

        if full_response:
            return api_response
        return api_response.body
    def create_reminder(self, reminder_request, **kwargs):
        # type: (ReminderRequest, **Any) -> Union[ApiResponse, ReminderResponse, Error]
        """
        This API is invoked by the skill to create a new reminder. 

        :param reminder_request: (required) 
        :type reminder_request: ask_sdk_model.services.reminder_management.reminder_request.ReminderRequest
        :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, ReminderResponse, Error]
        """
        operation_name = "create_reminder"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'reminder_request' is set
        if ('reminder_request' not in params) or (params['reminder_request'] is None):
            raise ValueError(
                "Missing the required parameter `reminder_request` when calling `" + operation_name + "`")

        resource_path = '/v1/alerts/reminders/'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict

        query_params = []  # type: List

        header_params = []  # type: List

        body_params = None
        if 'reminder_request' in params:
            body_params = params['reminder_request']
        header_params.append(('Content-type', 'application/json'))

        # 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.reminder_management.reminder_response.ReminderResponse", status_code=200, message="Success"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.reminder_management.error.Error", status_code=400, message="Bad Request"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.reminder_management.error.Error", status_code=403, message="Forbidden"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.reminder_management.error.Error", status_code=429, message="RateExceededException e.g. When the skill is throttled for exceeding the max rate"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.reminder_management.error.Error", status_code=500, message="Internal Server Error"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.reminder_management.error.Error", status_code=503, message="Service Unavailable"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.reminder_management.error.Error", status_code=504, message="Gateway Timeout"))

        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.reminder_management.reminder_response.ReminderResponse")

        if full_response:
            return api_response
        return api_response.body
Exemple #23
0
    def get_in_skill_products(self, accept_language, **kwargs):
        # type: (str, **Any) -> Union[Error, InSkillProductsResponse]
        """
        Gets In-Skill Products based on user's context for the Skill.

        :param accept_language: (required) User's locale/language in context
        :type accept_language: str
        :param purchasable: Filter products based on whether they are purchasable by the user or not. * 'PURCHASABLE' - Products that are purchasable by the user. * 'NOT_PURCHASABLE' - Products that are not purchasable by the user.
        :type purchasable: str
        :param entitled: Filter products based on whether they are entitled to the user or not. * 'ENTITLED' - Products that the user is entitled to. * 'NOT_ENTITLED' - Products that the user is not entitled to.
        :type entitled: str
        :param product_type: Product type. * 'SUBSCRIPTION' - Once purchased, customers will own the content for the subscription period. * 'ENTITLEMENT' - Once purchased, customers will own the content forever. * 'CONSUMABLE' - Once purchased, customers will be entitled to the content until it is consumed. It can also be re-purchased.
        :type product_type: str
        :param next_token: When response to this API call is truncated (that is, isTruncated response element value is true), the response also includes the nextToken element, the value of which can be used in the next request as the continuation-token to list the next set of objects. The continuation token is an opaque value that In-Skill Products API understands. Token has expiry of 24 hours.
        :type next_token: str
        :param max_results: sets the maximum number of results returned in the response body. If you want to retrieve fewer than upper limit of 100 results, you can add this parameter to your request. maxResults should not exceed the upper limit. The response might contain fewer results than maxResults, but it will never contain more. If there are additional results that satisfy the search criteria, but these results were not returned because maxResults was exceeded, the response contains isTruncated = true.
        :type max_results: float
        :rtype: Union[Error, InSkillProductsResponse]
        """
        operation_name = "get_in_skill_products"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'accept_language' is set
        if ('accept_language'
                not in params) or (params['accept_language'] is None):
            raise ValueError(
                "Missing the required parameter `accept_language` when calling `"
                + operation_name + "`")

        resource_path = '/v1/users/~current/skills/~current/inSkillProducts'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict

        query_params = []  # type: List
        if 'purchasable' in params:
            query_params.append(('purchasable', params['purchasable']))
        if 'entitled' in params:
            query_params.append(('entitled', params['entitled']))
        if 'product_type' in params:
            query_params.append(('productType', params['product_type']))
        if 'next_token' in params:
            query_params.append(('nextToken', params['next_token']))
        if 'max_results' in params:
            query_params.append(('maxResults', params['max_results']))

        header_params = []  # type: List
        if 'accept_language' in params:
            header_params.append(
                ('Accept-Language', params['accept_language']))

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # 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.monetization.in_skill_products_response.InSkillProductsResponse",
                status_code=200,
                message="Returns a list of In-Skill products on success."))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=400,
                message="Invalid request"))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=401,
                message=
                "The authentication token is invalid or doesn't have access to make this request"
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=500,
                message="Internal Server Error"))

        return 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.monetization.in_skill_products_response.InSkillProductsResponse"
        )
Exemple #24
0
    def get_in_skill_products_transactions(self, accept_language, **kwargs):
        # type: (str, **Any) -> Union[Error, InSkillProductTransactionsResponse]
        """
        Returns transactions of all in skill products purchases of the customer

        :param accept_language: (required) User's locale/language in context
        :type accept_language: str
        :param product_id: Product Id.
        :type product_id: str
        :param status: Transaction status for in skill product purchases. * 'PENDING_APPROVAL_BY_PARENT' - The transaction is pending approval from parent. * 'APPROVED_BY_PARENT' - The transaction was approved by parent and fulfilled successfully.. * 'DENIED_BY_PARENT' - The transaction was declined by parent and hence not fulfilled. * 'EXPIRED_NO_ACTION_BY_PARENT' - The transaction was expired due to no response from parent and hence not fulfilled. * 'ERROR' - The transaction was not fullfiled as there was an error while processing the transaction.
        :type status: str
        :param from_last_modified_time: Filter transactions based on last modified time stamp, FROM duration in format (UTC ISO 8601) i.e. yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
        :type from_last_modified_time: datetime
        :param to_last_modified_time: Filter transactions based on last modified time stamp, TO duration in format (UTC ISO 8601) i.e. yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
        :type to_last_modified_time: datetime
        :param next_token: When response to this API call is truncated, the response also includes the nextToken in metadata, the value of which can be used in the next request as the continuation-token to list the next set of objects. The continuation token is an opaque value that In-Skill Products API understands. Token has expiry of 24 hours.
        :type next_token: str
        :param max_results: sets the maximum number of results returned in the response body. If you want to retrieve fewer than upper limit of 100 results, you can add this parameter to your request. maxResults should not exceed the upper limit. The response might contain fewer results than maxResults, but it will never contain more. If there are additional results that satisfy the search criteria, but these results were not returned because maxResults was exceeded, the response contains nextToken which can be used to fetch next set of result.
        :type max_results: float
        :rtype: Union[Error, InSkillProductTransactionsResponse]
        """
        operation_name = "get_in_skill_products_transactions"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'accept_language' is set
        if ('accept_language'
                not in params) or (params['accept_language'] is None):
            raise ValueError(
                "Missing the required parameter `accept_language` when calling `"
                + operation_name + "`")

        resource_path = '/v1/users/~current/skills/~current/inSkillProductsTransactions'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict

        query_params = []  # type: List
        if 'product_id' in params:
            query_params.append(('productId', params['product_id']))
        if 'status' in params:
            query_params.append(('status', params['status']))
        if 'from_last_modified_time' in params:
            query_params.append(
                ('fromLastModifiedTime', params['from_last_modified_time']))
        if 'to_last_modified_time' in params:
            query_params.append(
                ('toLastModifiedTime', params['to_last_modified_time']))
        if 'next_token' in params:
            query_params.append(('nextToken', params['next_token']))
        if 'max_results' in params:
            query_params.append(('maxResults', params['max_results']))

        header_params = []  # type: List
        if 'accept_language' in params:
            header_params.append(
                ('Accept-Language', params['accept_language']))

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # 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.monetization.in_skill_product_transactions_response.InSkillProductTransactionsResponse",
                status_code=200,
                message=
                "Returns a list of transactions of all in skill products purchases in last 30 days on success."
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=400,
                message="Invalid request"))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=401,
                message=
                "The authentication token is invalid or doesn't have access to make this request"
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=403,
                message="Forbidden request"))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=404,
                message="Product id doesn't exist / invalid / not found."))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=412,
                message="Non-Child Directed Skill is not supported."))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=429,
                message="The request is throttled."))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=500,
                message="Internal Server Error"))

        return 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.monetization.in_skill_product_transactions_response.InSkillProductTransactionsResponse"
        )
Exemple #25
0
    def get_voice_purchase_setting(self, **kwargs):
        # type: (**Any) -> Union[bool, Error]
        """
        Returns whether or not voice purchasing is enabled for the skill

        :rtype: Union[bool, Error]
        """
        operation_name = "get_voice_purchase_setting"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']

        resource_path = '/v1/users/~current/skills/~current/settings/voicePurchasing.enabled'
        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'))

        # Authentication setting
        authorization_value = "Bearer " + self._authorization_value
        header_params.append(("Authorization", authorization_value))

        error_definitions = []  # type: List
        error_definitions.append(
            ServiceClientResponse(
                response_type="bool",
                status_code=200,
                message=
                "Returns a boolean value for voice purchase setting on success."
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=400,
                message="Invalid request."))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=401,
                message=
                "The authentication token is invalid or doesn't have access to make this request"
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=500,
                message="Internal Server Error."))

        return 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="bool")
    def get_in_skill_product(self, accept_language, product_id, **kwargs):
        # type: (str, str, **Any) -> Union[ApiResponse, object, Error_c27e519d, InSkillProduct_81648c45]
        """
        Get In-Skill Product information based on user context for the Skill.

        :param accept_language: (required) User's locale/language in context
        :type accept_language: str
        :param product_id: (required) Product Id.
        :type product_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, object, Error_c27e519d, InSkillProduct_81648c45]
        """
        operation_name = "get_in_skill_product"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'accept_language' is set
        if ('accept_language'
                not in params) or (params['accept_language'] is None):
            raise ValueError(
                "Missing the required parameter `accept_language` when calling `"
                + operation_name + "`")
        # verify the required parameter 'product_id' is set
        if ('product_id' not in params) or (params['product_id'] is None):
            raise ValueError(
                "Missing the required parameter `product_id` when calling `" +
                operation_name + "`")

        resource_path = '/v1/users/~current/skills/~current/inSkillProducts/{productId}'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict
        if 'product_id' in params:
            path_params['productId'] = params['product_id']

        query_params = []  # type: List

        header_params = []  # type: List
        if 'accept_language' in params:
            header_params.append(
                ('Accept-Language', params['accept_language']))

        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.monetization.in_skill_product.InSkillProduct",
                status_code=200,
                message="Returns an In-Skill Product on success."))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=400,
                message="Invalid request."))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=401,
                message=
                "The authentication token is invalid or doesn't have access to make this request"
            ))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.error.Error",
                status_code=404,
                message="Requested resource not found."))
        error_definitions.append(
            ServiceClientResponse(
                response_type="ask_sdk_model.services.monetization.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.monetization.in_skill_product.InSkillProduct"
        )

        if full_response:
            return api_response
        return api_response.body
    def get_system_temperature_unit(self, device_id, **kwargs):
        # type: (str, **Any) -> Union[ApiResponse, TemperatureUnit, Error]
        """
        Gets the temperature measurement units of the device. Does not require explict customer consent. 

        :param device_id: (required) The device Id
        :type device_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, TemperatureUnit, Error]
        """
        operation_name = "get_system_temperature_unit"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params) or (params['device_id'] is None):
            raise ValueError(
                "Missing the required parameter `device_id` when calling `" + operation_name + "`")

        resource_path = '/v2/devices/{deviceId}/settings/System.temperatureUnit'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']

        query_params = []  # type: List

        header_params = []  # type: List

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # 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.ups.temperature_unit.TemperatureUnit", status_code=200, message="Successfully get the setting"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=204, message="The query did not return any results."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=401, message="The authentication token is malformed or invalid."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=403, message="The authentication token does not have access to resource."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=429, message="The skill has been throttled due to an excessive number of requests."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.ups.error.Error", status_code=0, message="An unexpected error occurred."))

        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.ups.temperature_unit.TemperatureUnit")

        if full_response:
            return api_response
        return api_response.body
Exemple #28
0
    def update_list(self, list_id, update_list_request, **kwargs):
        # type: (str, UpdateListRequest, **Any) -> Union[ApiResponse, Error, AlexaListMetadata]
        """
        This API updates a custom list. Only the list name or state can be updated. An Alexa customer can turn an archived list into an active one. 

        :param list_id: (required) Value of the customer’s listId retrieved from a getListsMetadata call. 
        :type list_id: str
        :param update_list_request: (required) 
        :type update_list_request: ask_sdk_model.services.list_management.update_list_request.UpdateListRequest
        :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, AlexaListMetadata]
        """
        operation_name = "update_list"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'list_id' is set
        if ('list_id' not in params) or (params['list_id'] is None):
            raise ValueError(
                "Missing the required parameter `list_id` when calling `" + operation_name + "`")
        # verify the required parameter 'update_list_request' is set
        if ('update_list_request' not in params) or (params['update_list_request'] is None):
            raise ValueError(
                "Missing the required parameter `update_list_request` when calling `" + operation_name + "`")

        resource_path = '/v2/householdlists/{listId}/'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict
        if 'list_id' in params:
            path_params['listId'] = params['list_id']

        query_params = []  # type: List

        header_params = []  # type: List

        body_params = None
        if 'update_list_request' in params:
            body_params = params['update_list_request']
        header_params.append(('Content-type', 'application/json'))

        # 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.list_management.alexa_list_metadata.AlexaListMetadata", status_code=200, message="Success"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=400, message="Bad Request"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=403, message="Forbidden"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=404, message="List not found"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=409, message="Conflict"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=500, message="Internal Server Error"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=0, message="Internal Server Error"))

        api_response = self.invoke(
            method="PUT",
            endpoint="https://api.amazonalexa.com/",
            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.list_management.alexa_list_metadata.AlexaListMetadata")

        if full_response:
            return api_response
        return api_response.body
    def delete_reminder(self, alert_token, **kwargs):
        # type: (str, **Any) -> Union[ApiResponse, Error]
        """
        This API is invoked by the skill to delete a single reminder. 

        :param alert_token: (required) 
        :type alert_token: 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_reminder"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'alert_token' is set
        if ('alert_token' not in params) or (params['alert_token'] is None):
            raise ValueError(
                "Missing the required parameter `alert_token` when calling `" + operation_name + "`")

        resource_path = '/v1/alerts/reminders/{alertToken}'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict
        if 'alert_token' in params:
            path_params['alertToken'] = params['alert_token']

        query_params = []  # type: List

        header_params = []  # type: List

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # 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.reminder_management.error.Error", status_code=401, message="UserAuthenticationException. Request is not authorized/authenticated e.g. If customer does not have permission to create a reminder."))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.reminder_management.error.Error", status_code=429, message="RateExceededException e.g. When the skill is throttled for exceeding the max rate"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.reminder_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
Exemple #30
0
    def get_list(self, list_id, status, **kwargs):
        # type: (str, str, **Any) -> Union[ApiResponse, AlexaList, Error]
        """
        Retrieves the list metadata including the items in the list with requested status. 

        :param list_id: (required) Retrieved from a call to GetListsMetadata to specify the listId in the request path. 
        :type list_id: str
        :param status: (required) Specify the status of the list. 
        :type status: 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, AlexaList, Error]
        """
        operation_name = "get_list"
        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'list_id' is set
        if ('list_id' not in params) or (params['list_id'] is None):
            raise ValueError(
                "Missing the required parameter `list_id` when calling `" + operation_name + "`")
        # verify the required parameter 'status' is set
        if ('status' not in params) or (params['status'] is None):
            raise ValueError(
                "Missing the required parameter `status` when calling `" + operation_name + "`")

        resource_path = '/v2/householdlists/{listId}/{status}/'
        resource_path = resource_path.replace('{format}', 'json')

        path_params = {}  # type: Dict
        if 'list_id' in params:
            path_params['listId'] = params['list_id']
        if 'status' in params:
            path_params['status'] = params['status']

        query_params = []  # type: List

        header_params = []  # type: List

        body_params = None
        header_params.append(('Content-type', 'application/json'))

        # 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.list_management.alexa_list.AlexaList", status_code=200, message="Success"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=400, message="Bad Request"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=403, message="Forbidden"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=404, message="Not Found"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=500, message="Internal Server Error"))
        error_definitions.append(ServiceClientResponse(response_type="ask_sdk_model.services.list_management.error.Error", status_code=0, message="Internal Server Error"))

        api_response = self.invoke(
            method="GET",
            endpoint="https://api.amazonalexa.com/",
            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.list_management.alexa_list.AlexaList")

        if full_response:
            return api_response
        return api_response.body