diff --git a/line-openapi b/line-openapi index 1ca46400a..f9859923b 160000 --- a/line-openapi +++ b/line-openapi @@ -1 +1 @@ -Subproject commit 1ca46400ade898510d5bb38018952143757891bb +Subproject commit f9859923b5dc9f8179a018243a756b0fe4669cd3 diff --git a/linebot/v3/messaging/__init__.py b/linebot/v3/messaging/__init__.py index a4e876353..cae8d98b1 100644 --- a/linebot/v3/messaging/__init__.py +++ b/linebot/v3/messaging/__init__.py @@ -166,6 +166,7 @@ from linebot.v3.messaging.models.sender import Sender from linebot.v3.messaging.models.sent_message import SentMessage from linebot.v3.messaging.models.set_webhook_endpoint_request import SetWebhookEndpointRequest +from linebot.v3.messaging.models.show_loading_animation_request import ShowLoadingAnimationRequest from linebot.v3.messaging.models.sticker_message import StickerMessage from linebot.v3.messaging.models.subscribed_membership_plan import SubscribedMembershipPlan from linebot.v3.messaging.models.subscribed_membership_user import SubscribedMembershipUser diff --git a/linebot/v3/messaging/api/async_messaging_api.py b/linebot/v3/messaging/api/async_messaging_api.py index 3fe4f6db2..d1a7912de 100644 --- a/linebot/v3/messaging/api/async_messaging_api.py +++ b/linebot/v3/messaging/api/async_messaging_api.py @@ -64,6 +64,7 @@ from linebot.v3.messaging.models.room_member_count_response import RoomMemberCountResponse from linebot.v3.messaging.models.room_user_profile_response import RoomUserProfileResponse from linebot.v3.messaging.models.set_webhook_endpoint_request import SetWebhookEndpointRequest +from linebot.v3.messaging.models.show_loading_animation_request import ShowLoadingAnimationRequest from linebot.v3.messaging.models.test_webhook_endpoint_request import TestWebhookEndpointRequest from linebot.v3.messaging.models.test_webhook_endpoint_response import TestWebhookEndpointResponse from linebot.v3.messaging.models.update_rich_menu_alias_request import UpdateRichMenuAliasRequest @@ -8004,6 +8005,165 @@ def set_webhook_endpoint_with_http_info(self, set_webhook_endpoint_request : Set collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @overload + async def show_loading_animation(self, show_loading_animation_request : ShowLoadingAnimationRequest, **kwargs) -> object: # noqa: E501 + ... + + @overload + def show_loading_animation(self, show_loading_animation_request : ShowLoadingAnimationRequest, async_req: Optional[bool]=True, **kwargs) -> object: # noqa: E501 + ... + + @validate_arguments + def show_loading_animation(self, show_loading_animation_request : ShowLoadingAnimationRequest, async_req: Optional[bool]=None, **kwargs) -> Union[object, Awaitable[object]]: # noqa: E501 + """show_loading_animation # noqa: E501 + + Display a loading animation in one-on-one chats between users and LINE Official Accounts. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.show_loading_animation(show_loading_animation_request, async_req=True) + >>> result = thread.get() + + :param show_loading_animation_request: (required) + :type show_loading_animation_request: ShowLoadingAnimationRequest + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: object + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the show_loading_animation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + if async_req is not None: + kwargs['async_req'] = async_req + return self.show_loading_animation_with_http_info(show_loading_animation_request, **kwargs) # noqa: E501 + + @validate_arguments + def show_loading_animation_with_http_info(self, show_loading_animation_request : ShowLoadingAnimationRequest, **kwargs) -> ApiResponse: # noqa: E501 + """show_loading_animation # noqa: E501 + + Display a loading animation in one-on-one chats between users and LINE Official Accounts. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.show_loading_animation_with_http_info(show_loading_animation_request, async_req=True) + >>> result = thread.get() + + :param show_loading_animation_request: (required) + :type show_loading_animation_request: ShowLoadingAnimationRequest + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'show_loading_animation_request' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method show_loading_animation" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['show_loading_animation_request'] is not None: + _body_params = _params['show_loading_animation_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '202': "object", + '400': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/chat/loading/start', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + _host=_host, + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @overload async def test_webhook_endpoint(self, test_webhook_endpoint_request : Optional[TestWebhookEndpointRequest] = None, **kwargs) -> TestWebhookEndpointResponse: # noqa: E501 ... diff --git a/linebot/v3/messaging/api/messaging_api.py b/linebot/v3/messaging/api/messaging_api.py index 7646c9547..263feed5e 100644 --- a/linebot/v3/messaging/api/messaging_api.py +++ b/linebot/v3/messaging/api/messaging_api.py @@ -62,6 +62,7 @@ from linebot.v3.messaging.models.room_member_count_response import RoomMemberCountResponse from linebot.v3.messaging.models.room_user_profile_response import RoomUserProfileResponse from linebot.v3.messaging.models.set_webhook_endpoint_request import SetWebhookEndpointRequest +from linebot.v3.messaging.models.show_loading_animation_request import ShowLoadingAnimationRequest from linebot.v3.messaging.models.test_webhook_endpoint_request import TestWebhookEndpointRequest from linebot.v3.messaging.models.test_webhook_endpoint_response import TestWebhookEndpointResponse from linebot.v3.messaging.models.update_rich_menu_alias_request import UpdateRichMenuAliasRequest @@ -7482,6 +7483,155 @@ def set_webhook_endpoint_with_http_info(self, set_webhook_endpoint_request : Set collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + def show_loading_animation(self, show_loading_animation_request : ShowLoadingAnimationRequest, **kwargs) -> object: # noqa: E501 + """show_loading_animation # noqa: E501 + + Display a loading animation in one-on-one chats between users and LINE Official Accounts. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.show_loading_animation(show_loading_animation_request, async_req=True) + >>> result = thread.get() + + :param show_loading_animation_request: (required) + :type show_loading_animation_request: ShowLoadingAnimationRequest + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: object + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the show_loading_animation_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + return self.show_loading_animation_with_http_info(show_loading_animation_request, **kwargs) # noqa: E501 + + @validate_arguments + def show_loading_animation_with_http_info(self, show_loading_animation_request : ShowLoadingAnimationRequest, **kwargs) -> ApiResponse: # noqa: E501 + """show_loading_animation # noqa: E501 + + Display a loading animation in one-on-one chats between users and LINE Official Accounts. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.show_loading_animation_with_http_info(show_loading_animation_request, async_req=True) + >>> result = thread.get() + + :param show_loading_animation_request: (required) + :type show_loading_animation_request: ShowLoadingAnimationRequest + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'show_loading_animation_request' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method show_loading_animation" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['show_loading_animation_request'] is not None: + _body_params = _params['show_loading_animation_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '202': "object", + '400': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/chat/loading/start', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + _host=_host, + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments def test_webhook_endpoint(self, test_webhook_endpoint_request : Optional[TestWebhookEndpointRequest] = None, **kwargs) -> TestWebhookEndpointResponse: # noqa: E501 """test_webhook_endpoint # noqa: E501 diff --git a/linebot/v3/messaging/docs/MessagingApi.md b/linebot/v3/messaging/docs/MessagingApi.md index 2af829b60..49f6a5de8 100644 --- a/linebot/v3/messaging/docs/MessagingApi.md +++ b/linebot/v3/messaging/docs/MessagingApi.md @@ -56,6 +56,7 @@ Method | HTTP request | Description [**rich_menu_batch**](MessagingApi.md#rich_menu_batch) | **POST** /v2/bot/richmenu/batch | [**set_default_rich_menu**](MessagingApi.md#set_default_rich_menu) | **POST** /v2/bot/user/all/richmenu/{richMenuId} | [**set_webhook_endpoint**](MessagingApi.md#set_webhook_endpoint) | **PUT** /v2/bot/channel/webhook/endpoint | +[**show_loading_animation**](MessagingApi.md#show_loading_animation) | **POST** /v2/bot/chat/loading/start | [**test_webhook_endpoint**](MessagingApi.md#test_webhook_endpoint) | **POST** /v2/bot/channel/webhook/test | [**unlink_rich_menu_id_from_user**](MessagingApi.md#unlink_rich_menu_id_from_user) | **DELETE** /v2/bot/user/{userId}/richmenu | [**unlink_rich_menu_id_from_users**](MessagingApi.md#unlink_rich_menu_id_from_users) | **POST** /v2/bot/richmenu/bulk/unlink | @@ -3947,6 +3948,82 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **show_loading_animation** +> object show_loading_animation(show_loading_animation_request) + + + +Display a loading animation in one-on-one chats between users and LINE Official Accounts. + +### Example + +* Bearer Authentication (Bearer): +```python +import time +import os +import linebot.v3.messaging +from linebot.v3.messaging.models.show_loading_animation_request import ShowLoadingAnimationRequest +from linebot.v3.messaging.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.line.me +# See configuration.py for a list of all supported configuration parameters. +configuration = linebot.v3.messaging.Configuration( + host = "https://api.line.me" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: Bearer +configuration = linebot.v3.messaging.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with linebot.v3.messaging.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = linebot.v3.messaging.MessagingApi(api_client) + show_loading_animation_request = linebot.v3.messaging.ShowLoadingAnimationRequest() # ShowLoadingAnimationRequest | + + try: + api_response = api_instance.show_loading_animation(show_loading_animation_request) + print("The response of MessagingApi->show_loading_animation:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MessagingApi->show_loading_animation: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **show_loading_animation_request** | [**ShowLoadingAnimationRequest**](ShowLoadingAnimationRequest.md)| | + +### Return type + +**object** + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**202** | Accepted | - | +**400** | An invalid chat ID is specified, or the loadingSeconds value is invalid. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **test_webhook_endpoint** > TestWebhookEndpointResponse test_webhook_endpoint(test_webhook_endpoint_request=test_webhook_endpoint_request) diff --git a/linebot/v3/messaging/models/__init__.py b/linebot/v3/messaging/models/__init__.py index 9ee053fd1..93ea4df70 100644 --- a/linebot/v3/messaging/models/__init__.py +++ b/linebot/v3/messaging/models/__init__.py @@ -145,6 +145,7 @@ from linebot.v3.messaging.models.sender import Sender from linebot.v3.messaging.models.sent_message import SentMessage from linebot.v3.messaging.models.set_webhook_endpoint_request import SetWebhookEndpointRequest +from linebot.v3.messaging.models.show_loading_animation_request import ShowLoadingAnimationRequest from linebot.v3.messaging.models.sticker_message import StickerMessage from linebot.v3.messaging.models.subscribed_membership_plan import SubscribedMembershipPlan from linebot.v3.messaging.models.subscribed_membership_user import SubscribedMembershipUser diff --git a/linebot/v3/messaging/models/show_loading_animation_request.py b/linebot/v3/messaging/models/show_loading_animation_request.py new file mode 100644 index 000000000..62fbdc336 --- /dev/null +++ b/linebot/v3/messaging/models/show_loading_animation_request.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + LINE Messaging API + + This document describes LINE Messaging API. # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic.v1 import BaseModel, Field, StrictStr, conint + +class ShowLoadingAnimationRequest(BaseModel): + """ + ShowLoadingAnimationRequest + https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator-request-body + """ + chat_id: StrictStr = Field(..., alias="chatId", description="User ID of the target user for whom the loading animation is to be displayed.") + loading_seconds: Optional[conint(strict=True, le=60, ge=5)] = Field(None, alias="loadingSeconds", description="The number of seconds to display the loading indicator. It must be a multiple of 5. The maximum value is 60 seconds. ") + + __properties = ["chatId", "loadingSeconds"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> ShowLoadingAnimationRequest: + """Create an instance of ShowLoadingAnimationRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ShowLoadingAnimationRequest: + """Create an instance of ShowLoadingAnimationRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ShowLoadingAnimationRequest.parse_obj(obj) + + _obj = ShowLoadingAnimationRequest.parse_obj({ + "chat_id": obj.get("chatId"), + "loading_seconds": obj.get("loadingSeconds") + }) + return _obj +