diff --git a/linebot/v3/messaging/__init__.py b/linebot/v3/messaging/__init__.py index 1f78ad5f1..a4e876353 100644 --- a/linebot/v3/messaging/__init__.py +++ b/linebot/v3/messaging/__init__.py @@ -97,6 +97,7 @@ from linebot.v3.messaging.models.get_aggregation_unit_name_list_response import GetAggregationUnitNameListResponse from linebot.v3.messaging.models.get_aggregation_unit_usage_response import GetAggregationUnitUsageResponse from linebot.v3.messaging.models.get_followers_response import GetFollowersResponse +from linebot.v3.messaging.models.get_membership_subscription_response import GetMembershipSubscriptionResponse from linebot.v3.messaging.models.get_message_content_transcoding_response import GetMessageContentTranscodingResponse from linebot.v3.messaging.models.get_webhook_endpoint_response import GetWebhookEndpointResponse from linebot.v3.messaging.models.group_member_count_response import GroupMemberCountResponse @@ -117,6 +118,8 @@ from linebot.v3.messaging.models.location_message import LocationMessage from linebot.v3.messaging.models.mark_messages_as_read_request import MarkMessagesAsReadRequest from linebot.v3.messaging.models.members_ids_response import MembersIdsResponse +from linebot.v3.messaging.models.membership import Membership +from linebot.v3.messaging.models.membership_list_response import MembershipListResponse from linebot.v3.messaging.models.message import Message from linebot.v3.messaging.models.message_action import MessageAction from linebot.v3.messaging.models.message_imagemap_action import MessageImagemapAction @@ -164,6 +167,9 @@ 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.sticker_message import StickerMessage +from linebot.v3.messaging.models.subscribed_membership_plan import SubscribedMembershipPlan +from linebot.v3.messaging.models.subscribed_membership_user import SubscribedMembershipUser +from linebot.v3.messaging.models.subscription import Subscription from linebot.v3.messaging.models.subscription_period_demographic import SubscriptionPeriodDemographic from linebot.v3.messaging.models.subscription_period_demographic_filter import SubscriptionPeriodDemographicFilter from linebot.v3.messaging.models.template import Template diff --git a/linebot/v3/messaging/api/async_messaging_api.py b/linebot/v3/messaging/api/async_messaging_api.py index 86f649044..15d8a908c 100644 --- a/linebot/v3/messaging/api/async_messaging_api.py +++ b/linebot/v3/messaging/api/async_messaging_api.py @@ -31,6 +31,7 @@ from linebot.v3.messaging.models.get_aggregation_unit_name_list_response import GetAggregationUnitNameListResponse from linebot.v3.messaging.models.get_aggregation_unit_usage_response import GetAggregationUnitUsageResponse from linebot.v3.messaging.models.get_followers_response import GetFollowersResponse +from linebot.v3.messaging.models.get_membership_subscription_response import GetMembershipSubscriptionResponse from linebot.v3.messaging.models.get_webhook_endpoint_response import GetWebhookEndpointResponse from linebot.v3.messaging.models.group_member_count_response import GroupMemberCountResponse from linebot.v3.messaging.models.group_summary_response import GroupSummaryResponse @@ -38,6 +39,7 @@ from linebot.v3.messaging.models.issue_link_token_response import IssueLinkTokenResponse from linebot.v3.messaging.models.mark_messages_as_read_request import MarkMessagesAsReadRequest from linebot.v3.messaging.models.members_ids_response import MembersIdsResponse +from linebot.v3.messaging.models.membership_list_response import MembershipListResponse from linebot.v3.messaging.models.message_quota_response import MessageQuotaResponse from linebot.v3.messaging.models.multicast_request import MulticastRequest from linebot.v3.messaging.models.narrowcast_progress_response import NarrowcastProgressResponse @@ -2639,6 +2641,299 @@ def get_group_summary_with_http_info(self, group_id : Annotated[StrictStr, Field collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @overload + async def get_membership_list(self, **kwargs) -> MembershipListResponse: # noqa: E501 + ... + + @overload + def get_membership_list(self, async_req: Optional[bool]=True, **kwargs) -> MembershipListResponse: # noqa: E501 + ... + + @validate_arguments + def get_membership_list(self, async_req: Optional[bool]=None, **kwargs) -> Union[MembershipListResponse, Awaitable[MembershipListResponse]]: # noqa: E501 + """get_membership_list # noqa: E501 + + Get a list of memberships. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_membership_list(async_req=True) + >>> result = thread.get() + + :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: MembershipListResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_membership_list_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.get_membership_list_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + def get_membership_list_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """get_membership_list # noqa: E501 + + Get a list of memberships. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_membership_list_with_http_info(async_req=True) + >>> result = thread.get() + + :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(MembershipListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _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 get_membership_list" % _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 + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "MembershipListResponse", + '404': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/membership/list', 'GET', + _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'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @overload + async def get_membership_subscription(self, user_id : Annotated[StrictStr, Field(..., description="User ID")], **kwargs) -> GetMembershipSubscriptionResponse: # noqa: E501 + ... + + @overload + def get_membership_subscription(self, user_id : Annotated[StrictStr, Field(..., description="User ID")], async_req: Optional[bool]=True, **kwargs) -> GetMembershipSubscriptionResponse: # noqa: E501 + ... + + @validate_arguments + def get_membership_subscription(self, user_id : Annotated[StrictStr, Field(..., description="User ID")], async_req: Optional[bool]=None, **kwargs) -> Union[GetMembershipSubscriptionResponse, Awaitable[GetMembershipSubscriptionResponse]]: # noqa: E501 + """get_membership_subscription # noqa: E501 + + Get a user's membership subscription. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_membership_subscription(user_id, async_req=True) + >>> result = thread.get() + + :param user_id: User ID (required) + :type user_id: str + :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: GetMembershipSubscriptionResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_membership_subscription_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.get_membership_subscription_with_http_info(user_id, **kwargs) # noqa: E501 + + @validate_arguments + def get_membership_subscription_with_http_info(self, user_id : Annotated[StrictStr, Field(..., description="User ID")], **kwargs) -> ApiResponse: # noqa: E501 + """get_membership_subscription # noqa: E501 + + Get a user's membership subscription. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_membership_subscription_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param user_id: User ID (required) + :type user_id: str + :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(GetMembershipSubscriptionResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'user_id' + ] + _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 get_membership_subscription" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['user_id']: + _path_params['userId'] = _params['user_id'] + + + # 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 + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "GetMembershipSubscriptionResponse", + '400': "ErrorResponse", + '404': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/membership/subscription/{userId}', 'GET', + _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'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @overload async def get_message_quota(self, **kwargs) -> MessageQuotaResponse: # noqa: E501 ... diff --git a/linebot/v3/messaging/api/messaging_api.py b/linebot/v3/messaging/api/messaging_api.py index 78c9e4323..80b610b63 100644 --- a/linebot/v3/messaging/api/messaging_api.py +++ b/linebot/v3/messaging/api/messaging_api.py @@ -29,6 +29,7 @@ from linebot.v3.messaging.models.get_aggregation_unit_name_list_response import GetAggregationUnitNameListResponse from linebot.v3.messaging.models.get_aggregation_unit_usage_response import GetAggregationUnitUsageResponse from linebot.v3.messaging.models.get_followers_response import GetFollowersResponse +from linebot.v3.messaging.models.get_membership_subscription_response import GetMembershipSubscriptionResponse from linebot.v3.messaging.models.get_webhook_endpoint_response import GetWebhookEndpointResponse from linebot.v3.messaging.models.group_member_count_response import GroupMemberCountResponse from linebot.v3.messaging.models.group_summary_response import GroupSummaryResponse @@ -36,6 +37,7 @@ from linebot.v3.messaging.models.issue_link_token_response import IssueLinkTokenResponse from linebot.v3.messaging.models.mark_messages_as_read_request import MarkMessagesAsReadRequest from linebot.v3.messaging.models.members_ids_response import MembersIdsResponse +from linebot.v3.messaging.models.membership_list_response import MembershipListResponse from linebot.v3.messaging.models.message_quota_response import MessageQuotaResponse from linebot.v3.messaging.models.multicast_request import MulticastRequest from linebot.v3.messaging.models.narrowcast_progress_response import NarrowcastProgressResponse @@ -2467,6 +2469,279 @@ def get_group_summary_with_http_info(self, group_id : Annotated[StrictStr, Field collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + def get_membership_list(self, **kwargs) -> MembershipListResponse: # noqa: E501 + """get_membership_list # noqa: E501 + + Get a list of memberships. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_membership_list(async_req=True) + >>> result = thread.get() + + :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: MembershipListResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_membership_list_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + return self.get_membership_list_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + def get_membership_list_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """get_membership_list # noqa: E501 + + Get a list of memberships. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_membership_list_with_http_info(async_req=True) + >>> result = thread.get() + + :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(MembershipListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _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 get_membership_list" % _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 + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "MembershipListResponse", + '404': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/membership/list', 'GET', + _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'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def get_membership_subscription(self, user_id : Annotated[StrictStr, Field(..., description="User ID")], **kwargs) -> GetMembershipSubscriptionResponse: # noqa: E501 + """get_membership_subscription # noqa: E501 + + Get a user's membership subscription. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_membership_subscription(user_id, async_req=True) + >>> result = thread.get() + + :param user_id: User ID (required) + :type user_id: str + :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: GetMembershipSubscriptionResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_membership_subscription_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + return self.get_membership_subscription_with_http_info(user_id, **kwargs) # noqa: E501 + + @validate_arguments + def get_membership_subscription_with_http_info(self, user_id : Annotated[StrictStr, Field(..., description="User ID")], **kwargs) -> ApiResponse: # noqa: E501 + """get_membership_subscription # noqa: E501 + + Get a user's membership subscription. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_membership_subscription_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param user_id: User ID (required) + :type user_id: str + :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(GetMembershipSubscriptionResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'user_id' + ] + _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 get_membership_subscription" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['user_id']: + _path_params['userId'] = _params['user_id'] + + + # 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 + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "GetMembershipSubscriptionResponse", + '400': "ErrorResponse", + '404': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/membership/subscription/{userId}', 'GET', + _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'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments def get_message_quota(self, **kwargs) -> MessageQuotaResponse: # noqa: E501 """get_message_quota # noqa: E501 diff --git a/linebot/v3/messaging/docs/MessagingApi.md b/linebot/v3/messaging/docs/MessagingApi.md index c5faefe78..2af829b60 100644 --- a/linebot/v3/messaging/docs/MessagingApi.md +++ b/linebot/v3/messaging/docs/MessagingApi.md @@ -21,6 +21,8 @@ Method | HTTP request | Description [**get_group_member_profile**](MessagingApi.md#get_group_member_profile) | **GET** /v2/bot/group/{groupId}/member/{userId} | [**get_group_members_ids**](MessagingApi.md#get_group_members_ids) | **GET** /v2/bot/group/{groupId}/members/ids | [**get_group_summary**](MessagingApi.md#get_group_summary) | **GET** /v2/bot/group/{groupId}/summary | +[**get_membership_list**](MessagingApi.md#get_membership_list) | **GET** /v2/bot/membership/list | +[**get_membership_subscription**](MessagingApi.md#get_membership_subscription) | **GET** /v2/bot/membership/subscription/{userId} | [**get_message_quota**](MessagingApi.md#get_message_quota) | **GET** /v2/bot/message/quota | [**get_message_quota_consumption**](MessagingApi.md#get_message_quota_consumption) | **GET** /v2/bot/message/quota/consumption | [**get_narrowcast_progress**](MessagingApi.md#get_narrowcast_progress) | **GET** /v2/bot/message/progress/narrowcast | @@ -1330,6 +1332,155 @@ Name | Type | Description | Notes [[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) +# **get_membership_list** +> MembershipListResponse get_membership_list() + + + +Get a list of memberships. + +### Example + +* Bearer Authentication (Bearer): +```python +import time +import os +import linebot.v3.messaging +from linebot.v3.messaging.models.membership_list_response import MembershipListResponse +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) + + try: + api_response = api_instance.get_membership_list() + print("The response of MessagingApi->get_membership_list:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MessagingApi->get_membership_list: %s\n" % e) +``` + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**MembershipListResponse**](MembershipListResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**404** | Unable to get information about the memberships. | - | + +[[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) + +# **get_membership_subscription** +> GetMembershipSubscriptionResponse get_membership_subscription(user_id) + + + +Get a user's membership subscription. + +### Example + +* Bearer Authentication (Bearer): +```python +import time +import os +import linebot.v3.messaging +from linebot.v3.messaging.models.get_membership_subscription_response import GetMembershipSubscriptionResponse +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) + user_id = 'user_id_example' # str | User ID + + try: + api_response = api_instance.get_membership_subscription(user_id) + print("The response of MessagingApi->get_membership_subscription:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MessagingApi->get_membership_subscription: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_id** | **str**| User ID | + +### Return type + +[**GetMembershipSubscriptionResponse**](GetMembershipSubscriptionResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | An invalid user ID is specified. | - | +**404** | Unable to get information about the membership to which the user subscribes. | - | + +[[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) + # **get_message_quota** > MessageQuotaResponse get_message_quota() diff --git a/linebot/v3/messaging/models/__init__.py b/linebot/v3/messaging/models/__init__.py index 2975f5a1f..9ee053fd1 100644 --- a/linebot/v3/messaging/models/__init__.py +++ b/linebot/v3/messaging/models/__init__.py @@ -76,6 +76,7 @@ from linebot.v3.messaging.models.get_aggregation_unit_name_list_response import GetAggregationUnitNameListResponse from linebot.v3.messaging.models.get_aggregation_unit_usage_response import GetAggregationUnitUsageResponse from linebot.v3.messaging.models.get_followers_response import GetFollowersResponse +from linebot.v3.messaging.models.get_membership_subscription_response import GetMembershipSubscriptionResponse from linebot.v3.messaging.models.get_message_content_transcoding_response import GetMessageContentTranscodingResponse from linebot.v3.messaging.models.get_webhook_endpoint_response import GetWebhookEndpointResponse from linebot.v3.messaging.models.group_member_count_response import GroupMemberCountResponse @@ -96,6 +97,8 @@ from linebot.v3.messaging.models.location_message import LocationMessage from linebot.v3.messaging.models.mark_messages_as_read_request import MarkMessagesAsReadRequest from linebot.v3.messaging.models.members_ids_response import MembersIdsResponse +from linebot.v3.messaging.models.membership import Membership +from linebot.v3.messaging.models.membership_list_response import MembershipListResponse from linebot.v3.messaging.models.message import Message from linebot.v3.messaging.models.message_action import MessageAction from linebot.v3.messaging.models.message_imagemap_action import MessageImagemapAction @@ -143,6 +146,9 @@ 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.sticker_message import StickerMessage +from linebot.v3.messaging.models.subscribed_membership_plan import SubscribedMembershipPlan +from linebot.v3.messaging.models.subscribed_membership_user import SubscribedMembershipUser +from linebot.v3.messaging.models.subscription import Subscription from linebot.v3.messaging.models.subscription_period_demographic import SubscriptionPeriodDemographic from linebot.v3.messaging.models.subscription_period_demographic_filter import SubscriptionPeriodDemographicFilter from linebot.v3.messaging.models.template import Template diff --git a/linebot/v3/messaging/models/get_membership_subscription_response.py b/linebot/v3/messaging/models/get_membership_subscription_response.py new file mode 100644 index 000000000..bb45bc841 --- /dev/null +++ b/linebot/v3/messaging/models/get_membership_subscription_response.py @@ -0,0 +1,80 @@ +# 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 List +from pydantic.v1 import BaseModel, Field, conlist +from linebot.v3.messaging.models.subscription import Subscription + +class GetMembershipSubscriptionResponse(BaseModel): + """ + A user's membership subscription status + https://developers.line.biz/en/reference/messaging-api/#get-a-users-membership-subscription-status + """ + subscriptions: conlist(Subscription, min_items=0) = Field(..., description="List of subscription information") + + __properties = ["subscriptions"] + + 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) -> GetMembershipSubscriptionResponse: + """Create an instance of GetMembershipSubscriptionResponse 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) + # override the default output from pydantic.v1 by calling `to_dict()` of each item in subscriptions (list) + _items = [] + if self.subscriptions: + for _item in self.subscriptions: + if _item: + _items.append(_item.to_dict()) + _dict['subscriptions'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> GetMembershipSubscriptionResponse: + """Create an instance of GetMembershipSubscriptionResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetMembershipSubscriptionResponse.parse_obj(obj) + + _obj = GetMembershipSubscriptionResponse.parse_obj({ + "subscriptions": [Subscription.from_dict(_item) for _item in obj.get("subscriptions")] if obj.get("subscriptions") is not None else None + }) + return _obj + diff --git a/linebot/v3/messaging/models/membership.py b/linebot/v3/messaging/models/membership.py new file mode 100644 index 000000000..3d2e6c117 --- /dev/null +++ b/linebot/v3/messaging/models/membership.py @@ -0,0 +1,101 @@ +# 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 List, Optional, Union +from pydantic.v1 import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conlist, validator + +class Membership(BaseModel): + """ + Membership + """ + membership_id: StrictInt = Field(..., alias="membershipId", description="Membership plan ID.") + title: StrictStr = Field(..., description="Membership plan name.") + description: StrictStr = Field(..., description="Membership plan description.") + benefits: conlist(StrictStr, min_items=1) = Field(..., description="List of membership plan perks.") + price: Union[StrictFloat, StrictInt] = Field(..., description="Monthly fee for membership plan. (e.g. 1500.00)") + currency: StrictStr = Field(..., description="The currency of membership.price.") + member_count: StrictInt = Field(..., alias="memberCount", description="Number of members subscribed to the membership plan.") + member_limit: Optional[StrictInt] = Field(..., alias="memberLimit", description="The upper limit of members who can subscribe. If no upper limit is set, it will be null.") + is_in_app_purchase: StrictBool = Field(..., alias="isInAppPurchase", description="Payment method for users who subscribe to a membership plan.") + is_published: StrictBool = Field(..., alias="isPublished", description="Membership plan status.") + + __properties = ["membershipId", "title", "description", "benefits", "price", "currency", "memberCount", "memberLimit", "isInAppPurchase", "isPublished"] + + @validator('currency') + def currency_validate_enum(cls, value): + """Validates the enum""" + if value not in ('JPY', 'TWD', 'THB'): + raise ValueError("must be one of enum values ('JPY', 'TWD', 'THB')") + return value + + 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) -> Membership: + """Create an instance of Membership 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) + # set to None if member_limit (nullable) is None + # and __fields_set__ contains the field + if self.member_limit is None and "member_limit" in self.__fields_set__: + _dict['memberLimit'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Membership: + """Create an instance of Membership from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Membership.parse_obj(obj) + + _obj = Membership.parse_obj({ + "membership_id": obj.get("membershipId"), + "title": obj.get("title"), + "description": obj.get("description"), + "benefits": obj.get("benefits"), + "price": obj.get("price"), + "currency": obj.get("currency"), + "member_count": obj.get("memberCount"), + "member_limit": obj.get("memberLimit"), + "is_in_app_purchase": obj.get("isInAppPurchase"), + "is_published": obj.get("isPublished") + }) + return _obj + diff --git a/linebot/v3/messaging/models/membership_list_response.py b/linebot/v3/messaging/models/membership_list_response.py new file mode 100644 index 000000000..eb85daffa --- /dev/null +++ b/linebot/v3/messaging/models/membership_list_response.py @@ -0,0 +1,79 @@ +# 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 List +from pydantic.v1 import BaseModel, Field, conlist +from linebot.v3.messaging.models.membership import Membership + +class MembershipListResponse(BaseModel): + """ + List of memberships + """ + memberships: conlist(Membership, min_items=0) = Field(..., description="List of membership information") + + __properties = ["memberships"] + + 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) -> MembershipListResponse: + """Create an instance of MembershipListResponse 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) + # override the default output from pydantic.v1 by calling `to_dict()` of each item in memberships (list) + _items = [] + if self.memberships: + for _item in self.memberships: + if _item: + _items.append(_item.to_dict()) + _dict['memberships'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> MembershipListResponse: + """Create an instance of MembershipListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return MembershipListResponse.parse_obj(obj) + + _obj = MembershipListResponse.parse_obj({ + "memberships": [Membership.from_dict(_item) for _item in obj.get("memberships")] if obj.get("memberships") is not None else None + }) + return _obj + diff --git a/linebot/v3/messaging/models/subscribed_membership_plan.py b/linebot/v3/messaging/models/subscribed_membership_plan.py new file mode 100644 index 000000000..96e117a4a --- /dev/null +++ b/linebot/v3/messaging/models/subscribed_membership_plan.py @@ -0,0 +1,88 @@ +# 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 List, Union +from pydantic.v1 import BaseModel, Field, StrictFloat, StrictInt, StrictStr, conlist, validator + +class SubscribedMembershipPlan(BaseModel): + """ + Object containing information about the membership plan. + """ + membership_id: StrictInt = Field(..., alias="membershipId", description="Membership plan ID.") + title: StrictStr = Field(..., description="Membership plan name.") + description: StrictStr = Field(..., description="Membership plan description.") + benefits: conlist(StrictStr, min_items=1) = Field(..., description="List of membership plan perks.") + price: Union[StrictFloat, StrictInt] = Field(..., description="Monthly fee for membership plan. (e.g. 1500.00)") + currency: StrictStr = Field(..., description="The currency of membership.price.") + + __properties = ["membershipId", "title", "description", "benefits", "price", "currency"] + + @validator('currency') + def currency_validate_enum(cls, value): + """Validates the enum""" + if value not in ('JPY', 'TWD', 'THB'): + raise ValueError("must be one of enum values ('JPY', 'TWD', 'THB')") + return value + + 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) -> SubscribedMembershipPlan: + """Create an instance of SubscribedMembershipPlan 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) -> SubscribedMembershipPlan: + """Create an instance of SubscribedMembershipPlan from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SubscribedMembershipPlan.parse_obj(obj) + + _obj = SubscribedMembershipPlan.parse_obj({ + "membership_id": obj.get("membershipId"), + "title": obj.get("title"), + "description": obj.get("description"), + "benefits": obj.get("benefits"), + "price": obj.get("price"), + "currency": obj.get("currency") + }) + return _obj + diff --git a/linebot/v3/messaging/models/subscribed_membership_user.py b/linebot/v3/messaging/models/subscribed_membership_user.py new file mode 100644 index 000000000..23f6cf4ca --- /dev/null +++ b/linebot/v3/messaging/models/subscribed_membership_user.py @@ -0,0 +1,77 @@ +# 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 pydantic.v1 import BaseModel, Field, StrictInt, StrictStr + +class SubscribedMembershipUser(BaseModel): + """ + Object containing user membership subscription information. + """ + membership_no: StrictInt = Field(..., alias="membershipNo", description="The user's member number in the membership plan.") + joined_time: StrictInt = Field(..., alias="joinedTime", description="UNIX timestamp at which the user subscribed to the membership.") + next_billing_date: StrictStr = Field(..., alias="nextBillingDate", description="Next payment date for membership plan. - Format: yyyy-MM-dd (e.g. 2024-02-08) - Timezone: UTC+9 ") + total_subscription_months: StrictInt = Field(..., alias="totalSubscriptionMonths", description="The period of time in months that the user has been subscribed to a membership plan. If a user previously canceled and then re-subscribed to the same membership plan, only the period after the re-subscription will be counted.") + + __properties = ["membershipNo", "joinedTime", "nextBillingDate", "totalSubscriptionMonths"] + + 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) -> SubscribedMembershipUser: + """Create an instance of SubscribedMembershipUser 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) -> SubscribedMembershipUser: + """Create an instance of SubscribedMembershipUser from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SubscribedMembershipUser.parse_obj(obj) + + _obj = SubscribedMembershipUser.parse_obj({ + "membership_no": obj.get("membershipNo"), + "joined_time": obj.get("joinedTime"), + "next_billing_date": obj.get("nextBillingDate"), + "total_subscription_months": obj.get("totalSubscriptionMonths") + }) + return _obj + diff --git a/linebot/v3/messaging/models/subscription.py b/linebot/v3/messaging/models/subscription.py new file mode 100644 index 000000000..a3a1b0fe5 --- /dev/null +++ b/linebot/v3/messaging/models/subscription.py @@ -0,0 +1,81 @@ +# 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 pydantic.v1 import BaseModel, Field +from linebot.v3.messaging.models.subscribed_membership_plan import SubscribedMembershipPlan +from linebot.v3.messaging.models.subscribed_membership_user import SubscribedMembershipUser + +class Subscription(BaseModel): + """ + An array of memberships. + """ + membership: SubscribedMembershipPlan = Field(...) + user: SubscribedMembershipUser = Field(...) + + __properties = ["membership", "user"] + + 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) -> Subscription: + """Create an instance of Subscription 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) + # override the default output from pydantic.v1 by calling `to_dict()` of membership + if self.membership: + _dict['membership'] = self.membership.to_dict() + # override the default output from pydantic.v1 by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Subscription: + """Create an instance of Subscription from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Subscription.parse_obj(obj) + + _obj = Subscription.parse_obj({ + "membership": SubscribedMembershipPlan.from_dict(obj.get("membership")) if obj.get("membership") is not None else None, + "user": SubscribedMembershipUser.from_dict(obj.get("user")) if obj.get("user") is not None else None + }) + return _obj +