Skip to content

Commit

Permalink
Codes are generated by openapi generator (#622)
Browse files Browse the repository at this point in the history
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 <github-actions@github.com>
  • Loading branch information
github-actions[bot] and github-actions committed Apr 17, 2024
1 parent fc57f26 commit dc13ef3
Show file tree
Hide file tree
Showing 7 changed files with 464 additions and 1 deletion.
2 changes: 1 addition & 1 deletion line-openapi
Submodule line-openapi updated 1 files
+50 −0 messaging-api.yml
1 change: 1 addition & 0 deletions linebot/v3/messaging/__init__.py
Expand Up @@ -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
Expand Down
160 changes: 160 additions & 0 deletions linebot/v3/messaging/api/async_messaging_api.py
Expand Up @@ -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
Expand Down Expand Up @@ -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
...
Expand Down
150 changes: 150 additions & 0 deletions linebot/v3/messaging/api/messaging_api.py
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dc13ef3

Please sign in to comment.