Skip to content

Commit a260506

Browse files
github-actions[bot]github-actions
and
github-actions
authored
Codes are generated by openapi generator (#612)
We're excited to announce that the Membership API is now available in the Messaging API. With this update, our SDK also supports the use of this API. For more details, check out the announcement: https://developers.line.biz/en/news/2024/03/28/re-release-endpoints-for-membership Co-authored-by: github-actions <[email protected]>
1 parent ec77ea2 commit a260506

11 files changed

+1239
-0
lines changed

linebot/v3/messaging/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
from linebot.v3.messaging.models.get_aggregation_unit_name_list_response import GetAggregationUnitNameListResponse
9898
from linebot.v3.messaging.models.get_aggregation_unit_usage_response import GetAggregationUnitUsageResponse
9999
from linebot.v3.messaging.models.get_followers_response import GetFollowersResponse
100+
from linebot.v3.messaging.models.get_membership_subscription_response import GetMembershipSubscriptionResponse
100101
from linebot.v3.messaging.models.get_message_content_transcoding_response import GetMessageContentTranscodingResponse
101102
from linebot.v3.messaging.models.get_webhook_endpoint_response import GetWebhookEndpointResponse
102103
from linebot.v3.messaging.models.group_member_count_response import GroupMemberCountResponse
@@ -117,6 +118,8 @@
117118
from linebot.v3.messaging.models.location_message import LocationMessage
118119
from linebot.v3.messaging.models.mark_messages_as_read_request import MarkMessagesAsReadRequest
119120
from linebot.v3.messaging.models.members_ids_response import MembersIdsResponse
121+
from linebot.v3.messaging.models.membership import Membership
122+
from linebot.v3.messaging.models.membership_list_response import MembershipListResponse
120123
from linebot.v3.messaging.models.message import Message
121124
from linebot.v3.messaging.models.message_action import MessageAction
122125
from linebot.v3.messaging.models.message_imagemap_action import MessageImagemapAction
@@ -164,6 +167,9 @@
164167
from linebot.v3.messaging.models.sent_message import SentMessage
165168
from linebot.v3.messaging.models.set_webhook_endpoint_request import SetWebhookEndpointRequest
166169
from linebot.v3.messaging.models.sticker_message import StickerMessage
170+
from linebot.v3.messaging.models.subscribed_membership_plan import SubscribedMembershipPlan
171+
from linebot.v3.messaging.models.subscribed_membership_user import SubscribedMembershipUser
172+
from linebot.v3.messaging.models.subscription import Subscription
167173
from linebot.v3.messaging.models.subscription_period_demographic import SubscriptionPeriodDemographic
168174
from linebot.v3.messaging.models.subscription_period_demographic_filter import SubscriptionPeriodDemographicFilter
169175
from linebot.v3.messaging.models.template import Template

linebot/v3/messaging/api/async_messaging_api.py

+295
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@
3131
from linebot.v3.messaging.models.get_aggregation_unit_name_list_response import GetAggregationUnitNameListResponse
3232
from linebot.v3.messaging.models.get_aggregation_unit_usage_response import GetAggregationUnitUsageResponse
3333
from linebot.v3.messaging.models.get_followers_response import GetFollowersResponse
34+
from linebot.v3.messaging.models.get_membership_subscription_response import GetMembershipSubscriptionResponse
3435
from linebot.v3.messaging.models.get_webhook_endpoint_response import GetWebhookEndpointResponse
3536
from linebot.v3.messaging.models.group_member_count_response import GroupMemberCountResponse
3637
from linebot.v3.messaging.models.group_summary_response import GroupSummaryResponse
3738
from linebot.v3.messaging.models.group_user_profile_response import GroupUserProfileResponse
3839
from linebot.v3.messaging.models.issue_link_token_response import IssueLinkTokenResponse
3940
from linebot.v3.messaging.models.mark_messages_as_read_request import MarkMessagesAsReadRequest
4041
from linebot.v3.messaging.models.members_ids_response import MembersIdsResponse
42+
from linebot.v3.messaging.models.membership_list_response import MembershipListResponse
4143
from linebot.v3.messaging.models.message_quota_response import MessageQuotaResponse
4244
from linebot.v3.messaging.models.multicast_request import MulticastRequest
4345
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
26392641
collection_formats=_collection_formats,
26402642
_request_auth=_params.get('_request_auth'))
26412643

2644+
@overload
2645+
async def get_membership_list(self, **kwargs) -> MembershipListResponse: # noqa: E501
2646+
...
2647+
2648+
@overload
2649+
def get_membership_list(self, async_req: Optional[bool]=True, **kwargs) -> MembershipListResponse: # noqa: E501
2650+
...
2651+
2652+
@validate_arguments
2653+
def get_membership_list(self, async_req: Optional[bool]=None, **kwargs) -> Union[MembershipListResponse, Awaitable[MembershipListResponse]]: # noqa: E501
2654+
"""get_membership_list # noqa: E501
2655+
2656+
Get a list of memberships. # noqa: E501
2657+
This method makes a synchronous HTTP request by default. To make an
2658+
asynchronous HTTP request, please pass async_req=True
2659+
2660+
>>> thread = api.get_membership_list(async_req=True)
2661+
>>> result = thread.get()
2662+
2663+
:param async_req: Whether to execute the request asynchronously.
2664+
:type async_req: bool, optional
2665+
:param _request_timeout: timeout setting for this request. If one
2666+
number provided, it will be total request
2667+
timeout. It can also be a pair (tuple) of
2668+
(connection, read) timeouts.
2669+
:return: Returns the result object.
2670+
If the method is called asynchronously,
2671+
returns the request thread.
2672+
:rtype: MembershipListResponse
2673+
"""
2674+
kwargs['_return_http_data_only'] = True
2675+
if '_preload_content' in kwargs:
2676+
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")
2677+
if async_req is not None:
2678+
kwargs['async_req'] = async_req
2679+
return self.get_membership_list_with_http_info(**kwargs) # noqa: E501
2680+
2681+
@validate_arguments
2682+
def get_membership_list_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
2683+
"""get_membership_list # noqa: E501
2684+
2685+
Get a list of memberships. # noqa: E501
2686+
This method makes a synchronous HTTP request by default. To make an
2687+
asynchronous HTTP request, please pass async_req=True
2688+
2689+
>>> thread = api.get_membership_list_with_http_info(async_req=True)
2690+
>>> result = thread.get()
2691+
2692+
:param async_req: Whether to execute the request asynchronously.
2693+
:type async_req: bool, optional
2694+
:param _preload_content: if False, the ApiResponse.data will
2695+
be set to none and raw_data will store the
2696+
HTTP response body without reading/decoding.
2697+
Default is True.
2698+
:type _preload_content: bool, optional
2699+
:param _return_http_data_only: response data instead of ApiResponse
2700+
object with status code, headers, etc
2701+
:type _return_http_data_only: bool, optional
2702+
:param _request_timeout: timeout setting for this request. If one
2703+
number provided, it will be total request
2704+
timeout. It can also be a pair (tuple) of
2705+
(connection, read) timeouts.
2706+
:param _request_auth: set to override the auth_settings for an a single
2707+
request; this effectively ignores the authentication
2708+
in the spec for a single request.
2709+
:type _request_auth: dict, optional
2710+
:type _content_type: string, optional: force content-type for the request
2711+
:return: Returns the result object.
2712+
If the method is called asynchronously,
2713+
returns the request thread.
2714+
:rtype: tuple(MembershipListResponse, status_code(int), headers(HTTPHeaderDict))
2715+
"""
2716+
2717+
_params = locals()
2718+
2719+
_all_params = [
2720+
]
2721+
_all_params.extend(
2722+
[
2723+
'async_req',
2724+
'_return_http_data_only',
2725+
'_preload_content',
2726+
'_request_timeout',
2727+
'_request_auth',
2728+
'_content_type',
2729+
'_headers'
2730+
]
2731+
)
2732+
2733+
# validate the arguments
2734+
for _key, _val in _params['kwargs'].items():
2735+
if _key not in _all_params:
2736+
raise ApiTypeError(
2737+
"Got an unexpected keyword argument '%s'"
2738+
" to method get_membership_list" % _key
2739+
)
2740+
_params[_key] = _val
2741+
del _params['kwargs']
2742+
2743+
_collection_formats = {}
2744+
2745+
# process the path parameters
2746+
_path_params = {}
2747+
2748+
# process the query parameters
2749+
_query_params = []
2750+
# process the header parameters
2751+
_header_params = dict(_params.get('_headers', {}))
2752+
# process the form parameters
2753+
_form_params = []
2754+
_files = {}
2755+
# process the body parameter
2756+
_body_params = None
2757+
# set the HTTP header `Accept`
2758+
_header_params['Accept'] = self.api_client.select_header_accept(
2759+
['application/json']) # noqa: E501
2760+
2761+
# authentication setting
2762+
_auth_settings = ['Bearer'] # noqa: E501
2763+
2764+
_response_types_map = {
2765+
'200': "MembershipListResponse",
2766+
'404': "ErrorResponse",
2767+
}
2768+
2769+
return self.api_client.call_api(
2770+
'/v2/bot/membership/list', 'GET',
2771+
_path_params,
2772+
_query_params,
2773+
_header_params,
2774+
body=_body_params,
2775+
post_params=_form_params,
2776+
files=_files,
2777+
response_types_map=_response_types_map,
2778+
auth_settings=_auth_settings,
2779+
async_req=_params.get('async_req'),
2780+
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
2781+
_preload_content=_params.get('_preload_content', True),
2782+
_request_timeout=_params.get('_request_timeout'),
2783+
collection_formats=_collection_formats,
2784+
_request_auth=_params.get('_request_auth'))
2785+
2786+
@overload
2787+
async def get_membership_subscription(self, user_id : Annotated[StrictStr, Field(..., description="User ID")], **kwargs) -> GetMembershipSubscriptionResponse: # noqa: E501
2788+
...
2789+
2790+
@overload
2791+
def get_membership_subscription(self, user_id : Annotated[StrictStr, Field(..., description="User ID")], async_req: Optional[bool]=True, **kwargs) -> GetMembershipSubscriptionResponse: # noqa: E501
2792+
...
2793+
2794+
@validate_arguments
2795+
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
2796+
"""get_membership_subscription # noqa: E501
2797+
2798+
Get a user's membership subscription. # noqa: E501
2799+
This method makes a synchronous HTTP request by default. To make an
2800+
asynchronous HTTP request, please pass async_req=True
2801+
2802+
>>> thread = api.get_membership_subscription(user_id, async_req=True)
2803+
>>> result = thread.get()
2804+
2805+
:param user_id: User ID (required)
2806+
:type user_id: str
2807+
:param async_req: Whether to execute the request asynchronously.
2808+
:type async_req: bool, optional
2809+
:param _request_timeout: timeout setting for this request. If one
2810+
number provided, it will be total request
2811+
timeout. It can also be a pair (tuple) of
2812+
(connection, read) timeouts.
2813+
:return: Returns the result object.
2814+
If the method is called asynchronously,
2815+
returns the request thread.
2816+
:rtype: GetMembershipSubscriptionResponse
2817+
"""
2818+
kwargs['_return_http_data_only'] = True
2819+
if '_preload_content' in kwargs:
2820+
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")
2821+
if async_req is not None:
2822+
kwargs['async_req'] = async_req
2823+
return self.get_membership_subscription_with_http_info(user_id, **kwargs) # noqa: E501
2824+
2825+
@validate_arguments
2826+
def get_membership_subscription_with_http_info(self, user_id : Annotated[StrictStr, Field(..., description="User ID")], **kwargs) -> ApiResponse: # noqa: E501
2827+
"""get_membership_subscription # noqa: E501
2828+
2829+
Get a user's membership subscription. # noqa: E501
2830+
This method makes a synchronous HTTP request by default. To make an
2831+
asynchronous HTTP request, please pass async_req=True
2832+
2833+
>>> thread = api.get_membership_subscription_with_http_info(user_id, async_req=True)
2834+
>>> result = thread.get()
2835+
2836+
:param user_id: User ID (required)
2837+
:type user_id: str
2838+
:param async_req: Whether to execute the request asynchronously.
2839+
:type async_req: bool, optional
2840+
:param _preload_content: if False, the ApiResponse.data will
2841+
be set to none and raw_data will store the
2842+
HTTP response body without reading/decoding.
2843+
Default is True.
2844+
:type _preload_content: bool, optional
2845+
:param _return_http_data_only: response data instead of ApiResponse
2846+
object with status code, headers, etc
2847+
:type _return_http_data_only: bool, optional
2848+
:param _request_timeout: timeout setting for this request. If one
2849+
number provided, it will be total request
2850+
timeout. It can also be a pair (tuple) of
2851+
(connection, read) timeouts.
2852+
:param _request_auth: set to override the auth_settings for an a single
2853+
request; this effectively ignores the authentication
2854+
in the spec for a single request.
2855+
:type _request_auth: dict, optional
2856+
:type _content_type: string, optional: force content-type for the request
2857+
:return: Returns the result object.
2858+
If the method is called asynchronously,
2859+
returns the request thread.
2860+
:rtype: tuple(GetMembershipSubscriptionResponse, status_code(int), headers(HTTPHeaderDict))
2861+
"""
2862+
2863+
_params = locals()
2864+
2865+
_all_params = [
2866+
'user_id'
2867+
]
2868+
_all_params.extend(
2869+
[
2870+
'async_req',
2871+
'_return_http_data_only',
2872+
'_preload_content',
2873+
'_request_timeout',
2874+
'_request_auth',
2875+
'_content_type',
2876+
'_headers'
2877+
]
2878+
)
2879+
2880+
# validate the arguments
2881+
for _key, _val in _params['kwargs'].items():
2882+
if _key not in _all_params:
2883+
raise ApiTypeError(
2884+
"Got an unexpected keyword argument '%s'"
2885+
" to method get_membership_subscription" % _key
2886+
)
2887+
_params[_key] = _val
2888+
del _params['kwargs']
2889+
2890+
_collection_formats = {}
2891+
2892+
# process the path parameters
2893+
_path_params = {}
2894+
if _params['user_id']:
2895+
_path_params['userId'] = _params['user_id']
2896+
2897+
2898+
# process the query parameters
2899+
_query_params = []
2900+
# process the header parameters
2901+
_header_params = dict(_params.get('_headers', {}))
2902+
# process the form parameters
2903+
_form_params = []
2904+
_files = {}
2905+
# process the body parameter
2906+
_body_params = None
2907+
# set the HTTP header `Accept`
2908+
_header_params['Accept'] = self.api_client.select_header_accept(
2909+
['application/json']) # noqa: E501
2910+
2911+
# authentication setting
2912+
_auth_settings = ['Bearer'] # noqa: E501
2913+
2914+
_response_types_map = {
2915+
'200': "GetMembershipSubscriptionResponse",
2916+
'400': "ErrorResponse",
2917+
'404': "ErrorResponse",
2918+
}
2919+
2920+
return self.api_client.call_api(
2921+
'/v2/bot/membership/subscription/{userId}', 'GET',
2922+
_path_params,
2923+
_query_params,
2924+
_header_params,
2925+
body=_body_params,
2926+
post_params=_form_params,
2927+
files=_files,
2928+
response_types_map=_response_types_map,
2929+
auth_settings=_auth_settings,
2930+
async_req=_params.get('async_req'),
2931+
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
2932+
_preload_content=_params.get('_preload_content', True),
2933+
_request_timeout=_params.get('_request_timeout'),
2934+
collection_formats=_collection_formats,
2935+
_request_auth=_params.get('_request_auth'))
2936+
26422937
@overload
26432938
async def get_message_quota(self, **kwargs) -> MessageQuotaResponse: # noqa: E501
26442939
...

0 commit comments

Comments
 (0)