Skip to content

Commit 2e1c941

Browse files
github-actions[bot]github-actions
and
github-actions
authored
Support new Membership API and Webhook (#758)
line/line-openapi#86 # Support new Membership API and Webhook We have implemented and supported new API and Webhook about Membership. ## API to get a list of users who joined the membership You can obtain a list of user IDs for users who have joined the membership of your LINE Official Account by calling `client.getJoinedMembershipUsers(...)`. Documents: https://developers.line.biz/en/reference/messaging-api/#get-membership-user-ids ## Membership Webhook We have introduced new Webhook events `MembershipEvent` that indicates that a user has joined, left or renewed a membership of your LINE Official Account. Documents: https://developers.line.biz/en/reference/messaging-api/#membership-event ## For more details For more details, check out the announcement: https://developers.line.biz/en/news/2025/02/13/membership-api/ Co-authored-by: github-actions <[email protected]>
1 parent 8955719 commit 2e1c941

15 files changed

+910
-5
lines changed

line-openapi

linebot/v3/messaging/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
from linebot.v3.messaging.models.get_aggregation_unit_name_list_response import GetAggregationUnitNameListResponse
9999
from linebot.v3.messaging.models.get_aggregation_unit_usage_response import GetAggregationUnitUsageResponse
100100
from linebot.v3.messaging.models.get_followers_response import GetFollowersResponse
101+
from linebot.v3.messaging.models.get_joined_membership_users_response import GetJoinedMembershipUsersResponse
101102
from linebot.v3.messaging.models.get_membership_subscription_response import GetMembershipSubscriptionResponse
102103
from linebot.v3.messaging.models.get_message_content_transcoding_response import GetMessageContentTranscodingResponse
103104
from linebot.v3.messaging.models.get_webhook_endpoint_response import GetWebhookEndpointResponse

linebot/v3/messaging/api/async_messaging_api.py

+171-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from typing_extensions import Annotated
2121
from typing import overload, Optional, Union, Awaitable
2222

23-
from pydantic.v1 import Field, StrictStr, conint, constr, validator
23+
from pydantic.v1 import Field, StrictInt, StrictStr, conint, constr, validator
2424

2525
from typing import Any, Dict, Optional
2626

@@ -30,6 +30,7 @@
3030
from linebot.v3.messaging.models.get_aggregation_unit_name_list_response import GetAggregationUnitNameListResponse
3131
from linebot.v3.messaging.models.get_aggregation_unit_usage_response import GetAggregationUnitUsageResponse
3232
from linebot.v3.messaging.models.get_followers_response import GetFollowersResponse
33+
from linebot.v3.messaging.models.get_joined_membership_users_response import GetJoinedMembershipUsersResponse
3334
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
@@ -2374,6 +2375,175 @@ def get_group_summary_with_http_info(self, group_id : Annotated[StrictStr, Field
23742375
collection_formats=_collection_formats,
23752376
_request_auth=_params.get('_request_auth'))
23762377

2378+
@overload
2379+
async def get_joined_membership_users(self, membership_id : Annotated[StrictInt, Field(..., description="Membership plan ID.")], start : Annotated[Optional[StrictStr], Field(description="A continuation token to get next remaining membership user IDs. Returned only when there are remaining user IDs that weren't returned in the userIds property in the previous request. The continuation token expires in 24 hours (86,400 seconds). ")] = None, limit : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="The max number of items to return for this API call. The value is set to 300 by default, but the max acceptable value is 1000. ")] = None, **kwargs) -> GetJoinedMembershipUsersResponse: # noqa: E501
2380+
...
2381+
2382+
@overload
2383+
def get_joined_membership_users(self, membership_id : Annotated[StrictInt, Field(..., description="Membership plan ID.")], start : Annotated[Optional[StrictStr], Field(description="A continuation token to get next remaining membership user IDs. Returned only when there are remaining user IDs that weren't returned in the userIds property in the previous request. The continuation token expires in 24 hours (86,400 seconds). ")] = None, limit : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="The max number of items to return for this API call. The value is set to 300 by default, but the max acceptable value is 1000. ")] = None, async_req: Optional[bool]=True, **kwargs) -> GetJoinedMembershipUsersResponse: # noqa: E501
2384+
...
2385+
2386+
@validate_arguments
2387+
def get_joined_membership_users(self, membership_id : Annotated[StrictInt, Field(..., description="Membership plan ID.")], start : Annotated[Optional[StrictStr], Field(description="A continuation token to get next remaining membership user IDs. Returned only when there are remaining user IDs that weren't returned in the userIds property in the previous request. The continuation token expires in 24 hours (86,400 seconds). ")] = None, limit : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="The max number of items to return for this API call. The value is set to 300 by default, but the max acceptable value is 1000. ")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[GetJoinedMembershipUsersResponse, Awaitable[GetJoinedMembershipUsersResponse]]: # noqa: E501
2388+
"""get_joined_membership_users # noqa: E501
2389+
2390+
Get a list of user IDs who joined the membership. # noqa: E501
2391+
This method makes a synchronous HTTP request by default. To make an
2392+
asynchronous HTTP request, please pass async_req=True
2393+
2394+
>>> thread = api.get_joined_membership_users(membership_id, start, limit, async_req=True)
2395+
>>> result = thread.get()
2396+
2397+
:param membership_id: Membership plan ID. (required)
2398+
:type membership_id: int
2399+
:param start: A continuation token to get next remaining membership user IDs. Returned only when there are remaining user IDs that weren't returned in the userIds property in the previous request. The continuation token expires in 24 hours (86,400 seconds).
2400+
:type start: str
2401+
:param limit: The max number of items to return for this API call. The value is set to 300 by default, but the max acceptable value is 1000.
2402+
:type limit: int
2403+
:param async_req: Whether to execute the request asynchronously.
2404+
:type async_req: bool, optional
2405+
:param _request_timeout: timeout setting for this request. If one
2406+
number provided, it will be total request
2407+
timeout. It can also be a pair (tuple) of
2408+
(connection, read) timeouts.
2409+
:return: Returns the result object.
2410+
If the method is called asynchronously,
2411+
returns the request thread.
2412+
:rtype: GetJoinedMembershipUsersResponse
2413+
"""
2414+
kwargs['_return_http_data_only'] = True
2415+
if '_preload_content' in kwargs:
2416+
raise ValueError("Error! Please call the get_joined_membership_users_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
2417+
if async_req is not None:
2418+
kwargs['async_req'] = async_req
2419+
return self.get_joined_membership_users_with_http_info(membership_id, start, limit, **kwargs) # noqa: E501
2420+
2421+
@validate_arguments
2422+
def get_joined_membership_users_with_http_info(self, membership_id : Annotated[StrictInt, Field(..., description="Membership plan ID.")], start : Annotated[Optional[StrictStr], Field(description="A continuation token to get next remaining membership user IDs. Returned only when there are remaining user IDs that weren't returned in the userIds property in the previous request. The continuation token expires in 24 hours (86,400 seconds). ")] = None, limit : Annotated[Optional[conint(strict=True, le=1000, ge=1)], Field(description="The max number of items to return for this API call. The value is set to 300 by default, but the max acceptable value is 1000. ")] = None, **kwargs) -> ApiResponse: # noqa: E501
2423+
"""get_joined_membership_users # noqa: E501
2424+
2425+
Get a list of user IDs who joined the membership. # noqa: E501
2426+
This method makes a synchronous HTTP request by default. To make an
2427+
asynchronous HTTP request, please pass async_req=True
2428+
2429+
>>> thread = api.get_joined_membership_users_with_http_info(membership_id, start, limit, async_req=True)
2430+
>>> result = thread.get()
2431+
2432+
:param membership_id: Membership plan ID. (required)
2433+
:type membership_id: int
2434+
:param start: A continuation token to get next remaining membership user IDs. Returned only when there are remaining user IDs that weren't returned in the userIds property in the previous request. The continuation token expires in 24 hours (86,400 seconds).
2435+
:type start: str
2436+
:param limit: The max number of items to return for this API call. The value is set to 300 by default, but the max acceptable value is 1000.
2437+
:type limit: int
2438+
:param async_req: Whether to execute the request asynchronously.
2439+
:type async_req: bool, optional
2440+
:param _preload_content: if False, the ApiResponse.data will
2441+
be set to none and raw_data will store the
2442+
HTTP response body without reading/decoding.
2443+
Default is True.
2444+
:type _preload_content: bool, optional
2445+
:param _return_http_data_only: response data instead of ApiResponse
2446+
object with status code, headers, etc
2447+
:type _return_http_data_only: bool, optional
2448+
:param _request_timeout: timeout setting for this request. If one
2449+
number provided, it will be total request
2450+
timeout. It can also be a pair (tuple) of
2451+
(connection, read) timeouts.
2452+
:param _request_auth: set to override the auth_settings for an a single
2453+
request; this effectively ignores the authentication
2454+
in the spec for a single request.
2455+
:type _request_auth: dict, optional
2456+
:type _content_type: string, optional: force content-type for the request
2457+
:return: Returns the result object.
2458+
If the method is called asynchronously,
2459+
returns the request thread.
2460+
:rtype: tuple(GetJoinedMembershipUsersResponse, status_code(int), headers(HTTPHeaderDict))
2461+
"""
2462+
2463+
_host = self.line_base_path
2464+
_params = locals()
2465+
2466+
_all_params = [
2467+
'membership_id',
2468+
'start',
2469+
'limit'
2470+
]
2471+
_all_params.extend(
2472+
[
2473+
'async_req',
2474+
'_return_http_data_only',
2475+
'_preload_content',
2476+
'_request_timeout',
2477+
'_request_auth',
2478+
'_content_type',
2479+
'_headers'
2480+
]
2481+
)
2482+
2483+
# validate the arguments
2484+
for _key, _val in _params['kwargs'].items():
2485+
if _key not in _all_params:
2486+
raise ApiTypeError(
2487+
"Got an unexpected keyword argument '%s'"
2488+
" to method get_joined_membership_users" % _key
2489+
)
2490+
_params[_key] = _val
2491+
del _params['kwargs']
2492+
2493+
_collection_formats = {}
2494+
2495+
# process the path parameters
2496+
_path_params = {}
2497+
if _params['membership_id']:
2498+
_path_params['membershipId'] = _params['membership_id']
2499+
2500+
2501+
# process the query parameters
2502+
_query_params = []
2503+
if _params.get('start') is not None: # noqa: E501
2504+
_query_params.append(('start', _params['start']))
2505+
2506+
if _params.get('limit') is not None: # noqa: E501
2507+
_query_params.append(('limit', _params['limit']))
2508+
2509+
# process the header parameters
2510+
_header_params = dict(_params.get('_headers', {}))
2511+
# process the form parameters
2512+
_form_params = []
2513+
_files = {}
2514+
# process the body parameter
2515+
_body_params = None
2516+
# set the HTTP header `Accept`
2517+
_header_params['Accept'] = self.api_client.select_header_accept(
2518+
['application/json']) # noqa: E501
2519+
2520+
# authentication setting
2521+
_auth_settings = ['Bearer'] # noqa: E501
2522+
2523+
_response_types_map = {
2524+
'200': "GetJoinedMembershipUsersResponse",
2525+
'400': "ErrorResponse",
2526+
'404': "ErrorResponse",
2527+
}
2528+
2529+
return self.api_client.call_api(
2530+
'/v2/bot/membership/{membershipId}/users/ids', 'GET',
2531+
_path_params,
2532+
_query_params,
2533+
_header_params,
2534+
body=_body_params,
2535+
post_params=_form_params,
2536+
files=_files,
2537+
response_types_map=_response_types_map,
2538+
auth_settings=_auth_settings,
2539+
async_req=_params.get('async_req'),
2540+
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
2541+
_preload_content=_params.get('_preload_content', True),
2542+
_request_timeout=_params.get('_request_timeout'),
2543+
_host=_host,
2544+
collection_formats=_collection_formats,
2545+
_request_auth=_params.get('_request_auth'))
2546+
23772547
@overload
23782548
async def get_membership_list(self, **kwargs) -> MembershipListResponse: # noqa: E501
23792549
...

0 commit comments

Comments
 (0)