Skip to content

Commit dc13ef3

Browse files
github-actions[bot]github-actions
and
github-actions
authored
Codes are generated by openapi generator (#622)
In the Messaging API, we've added a new endpoint that allows you to [display a loading animation](https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator). After your LINE Official Account receives a message from a user, the response may takes some time due to message preparation or reservation processing. In such cases, you can visually tell the user that you want them to wait by displaying a loading animation. news: https://developers.line.biz/en/news/2024/04/17/loading-indicator/ ![loading-animation 7aad3d6c](https://github.com/line/line-openapi/assets/24933664/4435a2c1-db0c-409a-92f1-7c5fb64903c3) Co-authored-by: github-actions <[email protected]>
1 parent fc57f26 commit dc13ef3

7 files changed

+464
-1
lines changed

line-openapi

linebot/v3/messaging/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
from linebot.v3.messaging.models.sender import Sender
167167
from linebot.v3.messaging.models.sent_message import SentMessage
168168
from linebot.v3.messaging.models.set_webhook_endpoint_request import SetWebhookEndpointRequest
169+
from linebot.v3.messaging.models.show_loading_animation_request import ShowLoadingAnimationRequest
169170
from linebot.v3.messaging.models.sticker_message import StickerMessage
170171
from linebot.v3.messaging.models.subscribed_membership_plan import SubscribedMembershipPlan
171172
from linebot.v3.messaging.models.subscribed_membership_user import SubscribedMembershipUser

linebot/v3/messaging/api/async_messaging_api.py

+160
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
from linebot.v3.messaging.models.room_member_count_response import RoomMemberCountResponse
6565
from linebot.v3.messaging.models.room_user_profile_response import RoomUserProfileResponse
6666
from linebot.v3.messaging.models.set_webhook_endpoint_request import SetWebhookEndpointRequest
67+
from linebot.v3.messaging.models.show_loading_animation_request import ShowLoadingAnimationRequest
6768
from linebot.v3.messaging.models.test_webhook_endpoint_request import TestWebhookEndpointRequest
6869
from linebot.v3.messaging.models.test_webhook_endpoint_response import TestWebhookEndpointResponse
6970
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
80048005
collection_formats=_collection_formats,
80058006
_request_auth=_params.get('_request_auth'))
80068007

8008+
@overload
8009+
async def show_loading_animation(self, show_loading_animation_request : ShowLoadingAnimationRequest, **kwargs) -> object: # noqa: E501
8010+
...
8011+
8012+
@overload
8013+
def show_loading_animation(self, show_loading_animation_request : ShowLoadingAnimationRequest, async_req: Optional[bool]=True, **kwargs) -> object: # noqa: E501
8014+
...
8015+
8016+
@validate_arguments
8017+
def show_loading_animation(self, show_loading_animation_request : ShowLoadingAnimationRequest, async_req: Optional[bool]=None, **kwargs) -> Union[object, Awaitable[object]]: # noqa: E501
8018+
"""show_loading_animation # noqa: E501
8019+
8020+
Display a loading animation in one-on-one chats between users and LINE Official Accounts. # noqa: E501
8021+
This method makes a synchronous HTTP request by default. To make an
8022+
asynchronous HTTP request, please pass async_req=True
8023+
8024+
>>> thread = api.show_loading_animation(show_loading_animation_request, async_req=True)
8025+
>>> result = thread.get()
8026+
8027+
:param show_loading_animation_request: (required)
8028+
:type show_loading_animation_request: ShowLoadingAnimationRequest
8029+
:param async_req: Whether to execute the request asynchronously.
8030+
:type async_req: bool, optional
8031+
:param _request_timeout: timeout setting for this request. If one
8032+
number provided, it will be total request
8033+
timeout. It can also be a pair (tuple) of
8034+
(connection, read) timeouts.
8035+
:return: Returns the result object.
8036+
If the method is called asynchronously,
8037+
returns the request thread.
8038+
:rtype: object
8039+
"""
8040+
kwargs['_return_http_data_only'] = True
8041+
if '_preload_content' in kwargs:
8042+
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")
8043+
if async_req is not None:
8044+
kwargs['async_req'] = async_req
8045+
return self.show_loading_animation_with_http_info(show_loading_animation_request, **kwargs) # noqa: E501
8046+
8047+
@validate_arguments
8048+
def show_loading_animation_with_http_info(self, show_loading_animation_request : ShowLoadingAnimationRequest, **kwargs) -> ApiResponse: # noqa: E501
8049+
"""show_loading_animation # noqa: E501
8050+
8051+
Display a loading animation in one-on-one chats between users and LINE Official Accounts. # noqa: E501
8052+
This method makes a synchronous HTTP request by default. To make an
8053+
asynchronous HTTP request, please pass async_req=True
8054+
8055+
>>> thread = api.show_loading_animation_with_http_info(show_loading_animation_request, async_req=True)
8056+
>>> result = thread.get()
8057+
8058+
:param show_loading_animation_request: (required)
8059+
:type show_loading_animation_request: ShowLoadingAnimationRequest
8060+
:param async_req: Whether to execute the request asynchronously.
8061+
:type async_req: bool, optional
8062+
:param _preload_content: if False, the ApiResponse.data will
8063+
be set to none and raw_data will store the
8064+
HTTP response body without reading/decoding.
8065+
Default is True.
8066+
:type _preload_content: bool, optional
8067+
:param _return_http_data_only: response data instead of ApiResponse
8068+
object with status code, headers, etc
8069+
:type _return_http_data_only: bool, optional
8070+
:param _request_timeout: timeout setting for this request. If one
8071+
number provided, it will be total request
8072+
timeout. It can also be a pair (tuple) of
8073+
(connection, read) timeouts.
8074+
:param _request_auth: set to override the auth_settings for an a single
8075+
request; this effectively ignores the authentication
8076+
in the spec for a single request.
8077+
:type _request_auth: dict, optional
8078+
:type _content_type: string, optional: force content-type for the request
8079+
:return: Returns the result object.
8080+
If the method is called asynchronously,
8081+
returns the request thread.
8082+
:rtype: tuple(object, status_code(int), headers(HTTPHeaderDict))
8083+
"""
8084+
8085+
_host = self.line_base_path
8086+
_params = locals()
8087+
8088+
_all_params = [
8089+
'show_loading_animation_request'
8090+
]
8091+
_all_params.extend(
8092+
[
8093+
'async_req',
8094+
'_return_http_data_only',
8095+
'_preload_content',
8096+
'_request_timeout',
8097+
'_request_auth',
8098+
'_content_type',
8099+
'_headers'
8100+
]
8101+
)
8102+
8103+
# validate the arguments
8104+
for _key, _val in _params['kwargs'].items():
8105+
if _key not in _all_params:
8106+
raise ApiTypeError(
8107+
"Got an unexpected keyword argument '%s'"
8108+
" to method show_loading_animation" % _key
8109+
)
8110+
_params[_key] = _val
8111+
del _params['kwargs']
8112+
8113+
_collection_formats = {}
8114+
8115+
# process the path parameters
8116+
_path_params = {}
8117+
8118+
# process the query parameters
8119+
_query_params = []
8120+
# process the header parameters
8121+
_header_params = dict(_params.get('_headers', {}))
8122+
# process the form parameters
8123+
_form_params = []
8124+
_files = {}
8125+
# process the body parameter
8126+
_body_params = None
8127+
if _params['show_loading_animation_request'] is not None:
8128+
_body_params = _params['show_loading_animation_request']
8129+
8130+
# set the HTTP header `Accept`
8131+
_header_params['Accept'] = self.api_client.select_header_accept(
8132+
['application/json']) # noqa: E501
8133+
8134+
# set the HTTP header `Content-Type`
8135+
_content_types_list = _params.get('_content_type',
8136+
self.api_client.select_header_content_type(
8137+
['application/json']))
8138+
if _content_types_list:
8139+
_header_params['Content-Type'] = _content_types_list
8140+
8141+
# authentication setting
8142+
_auth_settings = ['Bearer'] # noqa: E501
8143+
8144+
_response_types_map = {
8145+
'202': "object",
8146+
'400': "ErrorResponse",
8147+
}
8148+
8149+
return self.api_client.call_api(
8150+
'/v2/bot/chat/loading/start', 'POST',
8151+
_path_params,
8152+
_query_params,
8153+
_header_params,
8154+
body=_body_params,
8155+
post_params=_form_params,
8156+
files=_files,
8157+
response_types_map=_response_types_map,
8158+
auth_settings=_auth_settings,
8159+
async_req=_params.get('async_req'),
8160+
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
8161+
_preload_content=_params.get('_preload_content', True),
8162+
_request_timeout=_params.get('_request_timeout'),
8163+
_host=_host,
8164+
collection_formats=_collection_formats,
8165+
_request_auth=_params.get('_request_auth'))
8166+
80078167
@overload
80088168
async def test_webhook_endpoint(self, test_webhook_endpoint_request : Optional[TestWebhookEndpointRequest] = None, **kwargs) -> TestWebhookEndpointResponse: # noqa: E501
80098169
...

linebot/v3/messaging/api/messaging_api.py

+150
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
from linebot.v3.messaging.models.room_member_count_response import RoomMemberCountResponse
6363
from linebot.v3.messaging.models.room_user_profile_response import RoomUserProfileResponse
6464
from linebot.v3.messaging.models.set_webhook_endpoint_request import SetWebhookEndpointRequest
65+
from linebot.v3.messaging.models.show_loading_animation_request import ShowLoadingAnimationRequest
6566
from linebot.v3.messaging.models.test_webhook_endpoint_request import TestWebhookEndpointRequest
6667
from linebot.v3.messaging.models.test_webhook_endpoint_response import TestWebhookEndpointResponse
6768
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
74827483
collection_formats=_collection_formats,
74837484
_request_auth=_params.get('_request_auth'))
74847485

7486+
@validate_arguments
7487+
def show_loading_animation(self, show_loading_animation_request : ShowLoadingAnimationRequest, **kwargs) -> object: # noqa: E501
7488+
"""show_loading_animation # noqa: E501
7489+
7490+
Display a loading animation in one-on-one chats between users and LINE Official Accounts. # noqa: E501
7491+
This method makes a synchronous HTTP request by default. To make an
7492+
asynchronous HTTP request, please pass async_req=True
7493+
7494+
>>> thread = api.show_loading_animation(show_loading_animation_request, async_req=True)
7495+
>>> result = thread.get()
7496+
7497+
:param show_loading_animation_request: (required)
7498+
:type show_loading_animation_request: ShowLoadingAnimationRequest
7499+
:param async_req: Whether to execute the request asynchronously.
7500+
:type async_req: bool, optional
7501+
:param _request_timeout: timeout setting for this request. If one
7502+
number provided, it will be total request
7503+
timeout. It can also be a pair (tuple) of
7504+
(connection, read) timeouts.
7505+
:return: Returns the result object.
7506+
If the method is called asynchronously,
7507+
returns the request thread.
7508+
:rtype: object
7509+
"""
7510+
kwargs['_return_http_data_only'] = True
7511+
if '_preload_content' in kwargs:
7512+
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")
7513+
return self.show_loading_animation_with_http_info(show_loading_animation_request, **kwargs) # noqa: E501
7514+
7515+
@validate_arguments
7516+
def show_loading_animation_with_http_info(self, show_loading_animation_request : ShowLoadingAnimationRequest, **kwargs) -> ApiResponse: # noqa: E501
7517+
"""show_loading_animation # noqa: E501
7518+
7519+
Display a loading animation in one-on-one chats between users and LINE Official Accounts. # noqa: E501
7520+
This method makes a synchronous HTTP request by default. To make an
7521+
asynchronous HTTP request, please pass async_req=True
7522+
7523+
>>> thread = api.show_loading_animation_with_http_info(show_loading_animation_request, async_req=True)
7524+
>>> result = thread.get()
7525+
7526+
:param show_loading_animation_request: (required)
7527+
:type show_loading_animation_request: ShowLoadingAnimationRequest
7528+
:param async_req: Whether to execute the request asynchronously.
7529+
:type async_req: bool, optional
7530+
:param _preload_content: if False, the ApiResponse.data will
7531+
be set to none and raw_data will store the
7532+
HTTP response body without reading/decoding.
7533+
Default is True.
7534+
:type _preload_content: bool, optional
7535+
:param _return_http_data_only: response data instead of ApiResponse
7536+
object with status code, headers, etc
7537+
:type _return_http_data_only: bool, optional
7538+
:param _request_timeout: timeout setting for this request. If one
7539+
number provided, it will be total request
7540+
timeout. It can also be a pair (tuple) of
7541+
(connection, read) timeouts.
7542+
:param _request_auth: set to override the auth_settings for an a single
7543+
request; this effectively ignores the authentication
7544+
in the spec for a single request.
7545+
:type _request_auth: dict, optional
7546+
:type _content_type: string, optional: force content-type for the request
7547+
:return: Returns the result object.
7548+
If the method is called asynchronously,
7549+
returns the request thread.
7550+
:rtype: tuple(object, status_code(int), headers(HTTPHeaderDict))
7551+
"""
7552+
7553+
_host = self.line_base_path
7554+
_params = locals()
7555+
7556+
_all_params = [
7557+
'show_loading_animation_request'
7558+
]
7559+
_all_params.extend(
7560+
[
7561+
'async_req',
7562+
'_return_http_data_only',
7563+
'_preload_content',
7564+
'_request_timeout',
7565+
'_request_auth',
7566+
'_content_type',
7567+
'_headers'
7568+
]
7569+
)
7570+
7571+
# validate the arguments
7572+
for _key, _val in _params['kwargs'].items():
7573+
if _key not in _all_params:
7574+
raise ApiTypeError(
7575+
"Got an unexpected keyword argument '%s'"
7576+
" to method show_loading_animation" % _key
7577+
)
7578+
_params[_key] = _val
7579+
del _params['kwargs']
7580+
7581+
_collection_formats = {}
7582+
7583+
# process the path parameters
7584+
_path_params = {}
7585+
7586+
# process the query parameters
7587+
_query_params = []
7588+
# process the header parameters
7589+
_header_params = dict(_params.get('_headers', {}))
7590+
# process the form parameters
7591+
_form_params = []
7592+
_files = {}
7593+
# process the body parameter
7594+
_body_params = None
7595+
if _params['show_loading_animation_request'] is not None:
7596+
_body_params = _params['show_loading_animation_request']
7597+
7598+
# set the HTTP header `Accept`
7599+
_header_params['Accept'] = self.api_client.select_header_accept(
7600+
['application/json']) # noqa: E501
7601+
7602+
# set the HTTP header `Content-Type`
7603+
_content_types_list = _params.get('_content_type',
7604+
self.api_client.select_header_content_type(
7605+
['application/json']))
7606+
if _content_types_list:
7607+
_header_params['Content-Type'] = _content_types_list
7608+
7609+
# authentication setting
7610+
_auth_settings = ['Bearer'] # noqa: E501
7611+
7612+
_response_types_map = {
7613+
'202': "object",
7614+
'400': "ErrorResponse",
7615+
}
7616+
7617+
return self.api_client.call_api(
7618+
'/v2/bot/chat/loading/start', 'POST',
7619+
_path_params,
7620+
_query_params,
7621+
_header_params,
7622+
body=_body_params,
7623+
post_params=_form_params,
7624+
files=_files,
7625+
response_types_map=_response_types_map,
7626+
auth_settings=_auth_settings,
7627+
async_req=_params.get('async_req'),
7628+
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
7629+
_preload_content=_params.get('_preload_content', True),
7630+
_request_timeout=_params.get('_request_timeout'),
7631+
_host=_host,
7632+
collection_formats=_collection_formats,
7633+
_request_auth=_params.get('_request_auth'))
7634+
74857635
@validate_arguments
74867636
def test_webhook_endpoint(self, test_webhook_endpoint_request : Optional[TestWebhookEndpointRequest] = None, **kwargs) -> TestWebhookEndpointResponse: # noqa: E501
74877637
"""test_webhook_endpoint # noqa: E501

0 commit comments

Comments
 (0)