diff --git a/README.rst b/README.rst index cf1470717..820f80aa8 100644 --- a/README.rst +++ b/README.rst @@ -41,15 +41,13 @@ Usage: from flask import Flask, request, abort from linebot.v3 import ( + LineBotClient, WebhookHandler ) from linebot.v3.exceptions import ( InvalidSignatureError ) from linebot.v3.messaging import ( - Configuration, - ApiClient, - MessagingApi, ReplyMessageRequest, TextMessage ) @@ -60,7 +58,7 @@ Usage: app = Flask(__name__) - configuration = Configuration(access_token='YOUR_CHANNEL_ACCESS_TOKEN') + line_bot_client = LineBotClient(channel_access_token='YOUR_CHANNEL_ACCESS_TOKEN') handler = WebhookHandler('YOUR_CHANNEL_SECRET') @@ -85,14 +83,12 @@ Usage: @handler.add(MessageEvent, message=TextMessageContent) def handle_message(event): - with ApiClient(configuration) as api_client: - line_bot_api = MessagingApi(api_client) - line_bot_api.reply_message_with_http_info( - ReplyMessageRequest( - reply_token=event.reply_token, - messages=[TextMessage(text=event.message.text)] - ) + line_bot_client.reply_message( + ReplyMessageRequest( + reply_token=event.reply_token, + messages=[TextMessage(text=event.message.text)] ) + ) if __name__ == "__main__": app.run() @@ -122,6 +118,7 @@ WebhookParser parser = linebot.v3.WebhookParser( 'YOUR_CHANNEL_SECRET', skip_signature_verification=lambda: False + ) parse(self, body, signature, as_payload=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -141,7 +138,7 @@ If the signature does NOT match, ``InvalidSignatureError`` is raised. payload = parser.parse(body, signature, as_payload=True) for event in payload.events: - do_something(payload.event, payload.destination) + do_something(event, payload.destination) WebhookHandler ~~~~~~~~~~~~~~ @@ -159,6 +156,7 @@ WebhookHandler handler = linebot.v3.WebhookHandler( 'YOUR_CHANNEL_SECRET', skip_signature_verification=lambda: False + ) handle(self, body, signature) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -178,16 +176,16 @@ Add a **handler** method by using this decorator. .. code:: python - @handler.add(MessageEvent, message=TextMessage) + @handler.add(MessageEvent, message=TextMessageContent) def handle_message(event): - line_bot_api.reply_message( + line_bot_client.reply_message( ReplyMessageRequest( reply_token=event.reply_token, messages=[TextMessage(text=event.message.text)] ) ) -When the event is an instance of MessageEvent and event.message is an instance of TextMessage, +When the event is an instance of MessageEvent and event.message is an instance of TextMessageContent, this handler method is called. .. code:: python @@ -286,7 +284,7 @@ Thus, you can send a JSON designed with `Flex Message Simulator None: + """Create a unified async LINE Bot client. + + :param str channel_access_token: Channel access token. + :param kwargs: Additional keyword arguments passed to each Configuration. + """ + self._audience_configuration = AudienceConfiguration( + access_token=channel_access_token, **kwargs + ) + self._audience_api_client = AudienceAsyncApiClient( + self._audience_configuration + ) + self._insight_configuration = InsightConfiguration( + access_token=channel_access_token, **kwargs + ) + self._insight_api_client = InsightAsyncApiClient( + self._insight_configuration + ) + self._liff_configuration = LiffConfiguration( + access_token=channel_access_token, **kwargs + ) + self._liff_api_client = LiffAsyncApiClient( + self._liff_configuration + ) + self._messaging_configuration = MessagingConfiguration( + access_token=channel_access_token, **kwargs + ) + self._messaging_api_client = MessagingAsyncApiClient( + self._messaging_configuration + ) + self._module_configuration = ModuleConfiguration( + access_token=channel_access_token, **kwargs + ) + self._module_api_client = ModuleAsyncApiClient( + self._module_configuration + ) + self._moduleattach_configuration = ModuleattachConfiguration( + access_token=channel_access_token, **kwargs + ) + self._moduleattach_api_client = ModuleattachAsyncApiClient( + self._moduleattach_configuration + ) + self._shop_configuration = ShopConfiguration( + access_token=channel_access_token, **kwargs + ) + self._shop_api_client = ShopAsyncApiClient( + self._shop_configuration + ) + + self._manage_audience = AsyncManageAudience(self._audience_api_client) + self._manage_audience_blob = AsyncManageAudienceBlob(self._audience_api_client) + self._insight = AsyncInsight(self._insight_api_client) + self._liff = AsyncLiff(self._liff_api_client) + self._messaging_api = AsyncMessagingApi(self._messaging_api_client) + self._messaging_api_blob = AsyncMessagingApiBlob(self._messaging_api_client) + self._line_module = AsyncLineModule(self._module_api_client) + self._line_module_attach = AsyncLineModuleAttach(self._moduleattach_api_client) + self._shop = AsyncShop(self._shop_api_client) + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc_value, traceback): + await self.close() + + async def close(self) -> None: + """Close all underlying async API clients.""" + errors: list[BaseException] = [] + try: + await self._audience_api_client.close() + except Exception as e: + errors.append(e) + try: + await self._insight_api_client.close() + except Exception as e: + errors.append(e) + try: + await self._liff_api_client.close() + except Exception as e: + errors.append(e) + try: + await self._messaging_api_client.close() + except Exception as e: + errors.append(e) + try: + await self._module_api_client.close() + except Exception as e: + errors.append(e) + try: + await self._moduleattach_api_client.close() + except Exception as e: + errors.append(e) + try: + await self._shop_api_client.close() + except Exception as e: + errors.append(e) + if errors: + raise errors[0] + + async def add_audience_to_audience_group(self, add_audience_to_audience_group_request: AddAudienceToAudienceGroupRequest) -> None: + """Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by JSON) + + :param add_audience_to_audience_group_request: (required) + :type add_audience_to_audience_group_request: AddAudienceToAudienceGroupRequest + :return: Returns the result object. + :rtype: None + """ + return await self._manage_audience.add_audience_to_audience_group(add_audience_to_audience_group_request) + + async def add_audience_to_audience_group_with_http_info(self, add_audience_to_audience_group_request: AddAudienceToAudienceGroupRequest) -> AudienceApiResponse: + """Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by JSON) + + :param add_audience_to_audience_group_request: (required) + :type add_audience_to_audience_group_request: AddAudienceToAudienceGroupRequest + :return: Returns the result object. + :rtype: None + """ + return await self._manage_audience.add_audience_to_audience_group_with_http_info(add_audience_to_audience_group_request) + + async def create_audience_group(self, create_audience_group_request: CreateAudienceGroupRequest) -> CreateAudienceGroupResponse: + """Create audience for uploading user IDs (by JSON) + + :param create_audience_group_request: (required) + :type create_audience_group_request: CreateAudienceGroupRequest + :return: Returns the result object. + :rtype: CreateAudienceGroupResponse + """ + return await self._manage_audience.create_audience_group(create_audience_group_request) + + async def create_audience_group_with_http_info(self, create_audience_group_request: CreateAudienceGroupRequest) -> AudienceApiResponse: + """Create audience for uploading user IDs (by JSON) + + :param create_audience_group_request: (required) + :type create_audience_group_request: CreateAudienceGroupRequest + :return: Returns the result object. + :rtype: tuple(CreateAudienceGroupResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._manage_audience.create_audience_group_with_http_info(create_audience_group_request) + + async def create_click_based_audience_group(self, create_click_based_audience_group_request: CreateClickBasedAudienceGroupRequest) -> CreateClickBasedAudienceGroupResponse: + """Create audience for click-based retargeting + + :param create_click_based_audience_group_request: (required) + :type create_click_based_audience_group_request: CreateClickBasedAudienceGroupRequest + :return: Returns the result object. + :rtype: CreateClickBasedAudienceGroupResponse + """ + return await self._manage_audience.create_click_based_audience_group(create_click_based_audience_group_request) + + async def create_click_based_audience_group_with_http_info(self, create_click_based_audience_group_request: CreateClickBasedAudienceGroupRequest) -> AudienceApiResponse: + """Create audience for click-based retargeting + + :param create_click_based_audience_group_request: (required) + :type create_click_based_audience_group_request: CreateClickBasedAudienceGroupRequest + :return: Returns the result object. + :rtype: tuple(CreateClickBasedAudienceGroupResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._manage_audience.create_click_based_audience_group_with_http_info(create_click_based_audience_group_request) + + async def create_imp_based_audience_group(self, create_imp_based_audience_group_request: CreateImpBasedAudienceGroupRequest) -> CreateImpBasedAudienceGroupResponse: + """Create audience for impression-based retargeting + + :param create_imp_based_audience_group_request: (required) + :type create_imp_based_audience_group_request: CreateImpBasedAudienceGroupRequest + :return: Returns the result object. + :rtype: CreateImpBasedAudienceGroupResponse + """ + return await self._manage_audience.create_imp_based_audience_group(create_imp_based_audience_group_request) + + async def create_imp_based_audience_group_with_http_info(self, create_imp_based_audience_group_request: CreateImpBasedAudienceGroupRequest) -> AudienceApiResponse: + """Create audience for impression-based retargeting + + :param create_imp_based_audience_group_request: (required) + :type create_imp_based_audience_group_request: CreateImpBasedAudienceGroupRequest + :return: Returns the result object. + :rtype: tuple(CreateImpBasedAudienceGroupResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._manage_audience.create_imp_based_audience_group_with_http_info(create_imp_based_audience_group_request) + + async def delete_audience_group(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> None: + """Delete audience + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: None + """ + return await self._manage_audience.delete_audience_group(audience_group_id) + + async def delete_audience_group_with_http_info(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> AudienceApiResponse: + """Delete audience + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: None + """ + return await self._manage_audience.delete_audience_group_with_http_info(audience_group_id) + + async def get_audience_data(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> GetAudienceDataResponse: + """Gets audience data. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: GetAudienceDataResponse + """ + return await self._manage_audience.get_audience_data(audience_group_id) + + async def get_audience_data_with_http_info(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> AudienceApiResponse: + """Gets audience data. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: tuple(GetAudienceDataResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._manage_audience.get_audience_data_with_http_info(audience_group_id) + + async def get_audience_groups(self, page: Annotated[conint(strict=True, ge=1), Field(..., description='The page to return when getting (paginated) results. Must be 1 or higher.')], description: Annotated[Optional[StrictStr], Field(description='The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ')] = None, status: Annotated[Optional[AudienceGroupStatus], Field(description='The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ')] = None, size: Annotated[Optional[conint(strict=True, le=40)], Field(description='The number of audiences per page. Default: 20 Max: 40 ')] = None, includes_external_public_groups: Annotated[Optional[StrictBool], Field(description='true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. ')] = None, create_route: Annotated[Optional[AudienceGroupCreateRoute], Field(description='How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ')] = None) -> GetAudienceGroupsResponse: + """Gets data for more than one audience. + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param includes_external_public_groups: true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. + :type includes_external_public_groups: bool + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :return: Returns the result object. + :rtype: GetAudienceGroupsResponse + """ + return await self._manage_audience.get_audience_groups(page, description, status, size, includes_external_public_groups, create_route) + + async def get_audience_groups_with_http_info(self, page: Annotated[conint(strict=True, ge=1), Field(..., description='The page to return when getting (paginated) results. Must be 1 or higher.')], description: Annotated[Optional[StrictStr], Field(description='The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ')] = None, status: Annotated[Optional[AudienceGroupStatus], Field(description='The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ')] = None, size: Annotated[Optional[conint(strict=True, le=40)], Field(description='The number of audiences per page. Default: 20 Max: 40 ')] = None, includes_external_public_groups: Annotated[Optional[StrictBool], Field(description='true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. ')] = None, create_route: Annotated[Optional[AudienceGroupCreateRoute], Field(description='How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ')] = None) -> AudienceApiResponse: + """Gets data for more than one audience. + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param includes_external_public_groups: true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. + :type includes_external_public_groups: bool + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :return: Returns the result object. + :rtype: tuple(GetAudienceGroupsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._manage_audience.get_audience_groups_with_http_info(page, description, status, size, includes_external_public_groups, create_route) + + async def get_shared_audience_data(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> GetSharedAudienceDataResponse: + """Gets audience data. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: GetSharedAudienceDataResponse + """ + return await self._manage_audience.get_shared_audience_data(audience_group_id) + + async def get_shared_audience_data_with_http_info(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> AudienceApiResponse: + """Gets audience data. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: tuple(GetSharedAudienceDataResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._manage_audience.get_shared_audience_data_with_http_info(audience_group_id) + + async def get_shared_audience_groups(self, page: Annotated[conint(strict=True, ge=1), Field(..., description='The page to return when getting (paginated) results. Must be 1 or higher.')], description: Annotated[Optional[StrictStr], Field(description='The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ')] = None, status: Annotated[Optional[AudienceGroupStatus], Field(description='The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ')] = None, size: Annotated[Optional[conint(strict=True, le=40)], Field(description='The number of audiences per page. Default: 20 Max: 40 ')] = None, create_route: Annotated[Optional[AudienceGroupCreateRoute], Field(description='How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ')] = None, includes_owned_audience_groups: Annotated[Optional[StrictBool], Field(description='true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager ')] = None) -> GetSharedAudienceGroupsResponse: + """Gets data for more than one audience, including those shared by the Business Manager. + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :param includes_owned_audience_groups: true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager + :type includes_owned_audience_groups: bool + :return: Returns the result object. + :rtype: GetSharedAudienceGroupsResponse + """ + return await self._manage_audience.get_shared_audience_groups(page, description, status, size, create_route, includes_owned_audience_groups) + + async def get_shared_audience_groups_with_http_info(self, page: Annotated[conint(strict=True, ge=1), Field(..., description='The page to return when getting (paginated) results. Must be 1 or higher.')], description: Annotated[Optional[StrictStr], Field(description='The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ')] = None, status: Annotated[Optional[AudienceGroupStatus], Field(description='The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ')] = None, size: Annotated[Optional[conint(strict=True, le=40)], Field(description='The number of audiences per page. Default: 20 Max: 40 ')] = None, create_route: Annotated[Optional[AudienceGroupCreateRoute], Field(description='How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ')] = None, includes_owned_audience_groups: Annotated[Optional[StrictBool], Field(description='true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager ')] = None) -> AudienceApiResponse: + """Gets data for more than one audience, including those shared by the Business Manager. + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :param includes_owned_audience_groups: true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager + :type includes_owned_audience_groups: bool + :return: Returns the result object. + :rtype: tuple(GetSharedAudienceGroupsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._manage_audience.get_shared_audience_groups_with_http_info(page, description, status, size, create_route, includes_owned_audience_groups) + + async def update_audience_group_description(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')], update_audience_group_description_request: UpdateAudienceGroupDescriptionRequest) -> None: + """Renames an existing audience. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :param update_audience_group_description_request: (required) + :type update_audience_group_description_request: UpdateAudienceGroupDescriptionRequest + :return: Returns the result object. + :rtype: None + """ + return await self._manage_audience.update_audience_group_description(audience_group_id, update_audience_group_description_request) + + async def update_audience_group_description_with_http_info(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')], update_audience_group_description_request: UpdateAudienceGroupDescriptionRequest) -> AudienceApiResponse: + """Renames an existing audience. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :param update_audience_group_description_request: (required) + :type update_audience_group_description_request: UpdateAudienceGroupDescriptionRequest + :return: Returns the result object. + :rtype: None + """ + return await self._manage_audience.update_audience_group_description_with_http_info(audience_group_id, update_audience_group_description_request) + + async def add_user_ids_to_audience(self, file: Annotated[Union[StrictBytes, StrictStr], Field(..., description='A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 ')], audience_group_id: Annotated[Optional[StrictInt], Field(description='The audience ID.')] = None, upload_description: Annotated[Optional[StrictStr], Field(description='The description to register with the job')] = None) -> None: + """Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by file). + + :param file: A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 (required) + :type file: bytearray + :param audience_group_id: The audience ID. + :type audience_group_id: int + :param upload_description: The description to register with the job + :type upload_description: str + :return: Returns the result object. + :rtype: None + """ + return await self._manage_audience_blob.add_user_ids_to_audience(file, audience_group_id, upload_description) + + async def add_user_ids_to_audience_with_http_info(self, file: Annotated[Union[StrictBytes, StrictStr], Field(..., description='A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 ')], audience_group_id: Annotated[Optional[StrictInt], Field(description='The audience ID.')] = None, upload_description: Annotated[Optional[StrictStr], Field(description='The description to register with the job')] = None) -> AudienceApiResponse: + """Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by file). + + :param file: A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 (required) + :type file: bytearray + :param audience_group_id: The audience ID. + :type audience_group_id: int + :param upload_description: The description to register with the job + :type upload_description: str + :return: Returns the result object. + :rtype: None + """ + return await self._manage_audience_blob.add_user_ids_to_audience_with_http_info(file, audience_group_id, upload_description) + + async def create_audience_for_uploading_user_ids(self, file: Annotated[Union[StrictBytes, StrictStr], Field(..., description='A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 ')], description: Annotated[Optional[constr(strict=True, max_length=120)], Field(description="The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 ")] = None, is_ifa_audience: Annotated[Optional[StrictBool], Field(description='To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. ')] = None, upload_description: Annotated[Optional[StrictStr], Field(description='The description to register for the job (in `jobs[].description`). ')] = None) -> CreateAudienceGroupResponse: + """Create audience for uploading user IDs (by file). + + :param file: A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 (required) + :type file: bytearray + :param description: The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 + :type description: str + :param is_ifa_audience: To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. + :type is_ifa_audience: bool + :param upload_description: The description to register for the job (in `jobs[].description`). + :type upload_description: str + :return: Returns the result object. + :rtype: CreateAudienceGroupResponse + """ + return await self._manage_audience_blob.create_audience_for_uploading_user_ids(file, description, is_ifa_audience, upload_description) + + async def create_audience_for_uploading_user_ids_with_http_info(self, file: Annotated[Union[StrictBytes, StrictStr], Field(..., description='A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 ')], description: Annotated[Optional[constr(strict=True, max_length=120)], Field(description="The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 ")] = None, is_ifa_audience: Annotated[Optional[StrictBool], Field(description='To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. ')] = None, upload_description: Annotated[Optional[StrictStr], Field(description='The description to register for the job (in `jobs[].description`). ')] = None) -> AudienceApiResponse: + """Create audience for uploading user IDs (by file). + + :param file: A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 (required) + :type file: bytearray + :param description: The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 + :type description: str + :param is_ifa_audience: To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. + :type is_ifa_audience: bool + :param upload_description: The description to register for the job (in `jobs[].description`). + :type upload_description: str + :return: Returns the result object. + :rtype: tuple(CreateAudienceGroupResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._manage_audience_blob.create_audience_for_uploading_user_ids_with_http_info(file, description, is_ifa_audience, upload_description) + + async def get_friends_demographics(self) -> GetFriendsDemographicsResponse: + """Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID). + + :return: Returns the result object. + :rtype: GetFriendsDemographicsResponse + """ + return await self._insight.get_friends_demographics() + + async def get_friends_demographics_with_http_info(self) -> InsightApiResponse: + """Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID). + + :return: Returns the result object. + :rtype: tuple(GetFriendsDemographicsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._insight.get_friends_demographics_with_http_info() + + async def get_message_event(self, request_id: Annotated[constr(strict=True, min_length=1), Field(..., description='Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. ')]) -> GetMessageEventResponse: + """Get user interaction statistics + + Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. + + :param request_id: Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: GetMessageEventResponse + """ + return await self._insight.get_message_event(request_id) + + async def get_message_event_with_http_info(self, request_id: Annotated[constr(strict=True, min_length=1), Field(..., description='Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. ')]) -> InsightApiResponse: + """Get user interaction statistics + + Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. + + :param request_id: Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: tuple(GetMessageEventResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._insight.get_message_event_with_http_info(request_id) + + async def get_number_of_followers(self, var_date: Annotated[Optional[constr(strict=True, max_length=8, min_length=8)], Field(description='Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 ')] = None) -> GetNumberOfFollowersResponse: + """Get number of followers + + Returns the number of users who have added the LINE Official Account on or before a specified date. + + :param var_date: Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 + :type var_date: str + :return: Returns the result object. + :rtype: GetNumberOfFollowersResponse + """ + return await self._insight.get_number_of_followers(var_date) + + async def get_number_of_followers_with_http_info(self, var_date: Annotated[Optional[constr(strict=True, max_length=8, min_length=8)], Field(description='Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 ')] = None) -> InsightApiResponse: + """Get number of followers + + Returns the number of users who have added the LINE Official Account on or before a specified date. + + :param var_date: Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 + :type var_date: str + :return: Returns the result object. + :rtype: tuple(GetNumberOfFollowersResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._insight.get_number_of_followers_with_http_info(var_date) + + async def get_number_of_message_deliveries(self, var_date: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 ')]) -> GetNumberOfMessageDeliveriesResponse: + """Get number of message deliveries + + Returns the number of messages sent from LINE Official Account on a specified day. + + :param var_date: Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: GetNumberOfMessageDeliveriesResponse + """ + return await self._insight.get_number_of_message_deliveries(var_date) + + async def get_number_of_message_deliveries_with_http_info(self, var_date: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 ')]) -> InsightApiResponse: + """Get number of message deliveries + + Returns the number of messages sent from LINE Official Account on a specified day. + + :param var_date: Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(GetNumberOfMessageDeliveriesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._insight.get_number_of_message_deliveries_with_http_info(var_date) + + async def get_statistics_per_unit(self, custom_aggregation_unit: Annotated[constr(strict=True, max_length=30, min_length=1), Field(..., description='Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. ')], var_from: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ')], to: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ')]) -> GetStatisticsPerUnitResponse: + """You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account. + + :param custom_aggregation_unit: Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. (required) + :type custom_aggregation_unit: str + :param var_from: Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 (required) + :type to: str + :return: Returns the result object. + :rtype: GetStatisticsPerUnitResponse + """ + return await self._insight.get_statistics_per_unit(custom_aggregation_unit, var_from, to) + + async def get_statistics_per_unit_with_http_info(self, custom_aggregation_unit: Annotated[constr(strict=True, max_length=30, min_length=1), Field(..., description='Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. ')], var_from: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ')], to: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ')]) -> InsightApiResponse: + """You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account. + + :param custom_aggregation_unit: Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. (required) + :type custom_aggregation_unit: str + :param var_from: Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 (required) + :type to: str + :return: Returns the result object. + :rtype: tuple(GetStatisticsPerUnitResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._insight.get_statistics_per_unit_with_http_info(custom_aggregation_unit, var_from, to) + + async def add_liff_app(self, add_liff_app_request: AddLiffAppRequest) -> AddLiffAppResponse: + """Create LIFF app + + Adding the LIFF app to a channel + + :param add_liff_app_request: (required) + :type add_liff_app_request: AddLiffAppRequest + :return: Returns the result object. + :rtype: AddLiffAppResponse + """ + return await self._liff.add_liff_app(add_liff_app_request) + + async def add_liff_app_with_http_info(self, add_liff_app_request: AddLiffAppRequest) -> LiffApiResponse: + """Create LIFF app + + Adding the LIFF app to a channel + + :param add_liff_app_request: (required) + :type add_liff_app_request: AddLiffAppRequest + :return: Returns the result object. + :rtype: tuple(AddLiffAppResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._liff.add_liff_app_with_http_info(add_liff_app_request) + + async def delete_liff_app(self, liff_id: Annotated[StrictStr, Field(..., description='ID of the LIFF app to be updated')]) -> None: + """Delete LIFF app from a channel + + Deletes a LIFF app from a channel. + + :param liff_id: ID of the LIFF app to be updated (required) + :type liff_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._liff.delete_liff_app(liff_id) + + async def delete_liff_app_with_http_info(self, liff_id: Annotated[StrictStr, Field(..., description='ID of the LIFF app to be updated')]) -> LiffApiResponse: + """Delete LIFF app from a channel + + Deletes a LIFF app from a channel. + + :param liff_id: ID of the LIFF app to be updated (required) + :type liff_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._liff.delete_liff_app_with_http_info(liff_id) + + async def get_all_liff_apps(self) -> GetAllLiffAppsResponse: + """Get all LIFF apps + + Gets information on all the LIFF apps added to the channel. + + :return: Returns the result object. + :rtype: GetAllLiffAppsResponse + """ + return await self._liff.get_all_liff_apps() + + async def get_all_liff_apps_with_http_info(self) -> LiffApiResponse: + """Get all LIFF apps + + Gets information on all the LIFF apps added to the channel. + + :return: Returns the result object. + :rtype: tuple(GetAllLiffAppsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._liff.get_all_liff_apps_with_http_info() + + async def update_liff_app(self, liff_id: Annotated[StrictStr, Field(..., description='ID of the LIFF app to be updated')], update_liff_app_request: UpdateLiffAppRequest) -> None: + """Update LIFF app from a channel + + Update LIFF app settings + + :param liff_id: ID of the LIFF app to be updated (required) + :type liff_id: str + :param update_liff_app_request: (required) + :type update_liff_app_request: UpdateLiffAppRequest + :return: Returns the result object. + :rtype: None + """ + return await self._liff.update_liff_app(liff_id, update_liff_app_request) + + async def update_liff_app_with_http_info(self, liff_id: Annotated[StrictStr, Field(..., description='ID of the LIFF app to be updated')], update_liff_app_request: UpdateLiffAppRequest) -> LiffApiResponse: + """Update LIFF app from a channel + + Update LIFF app settings + + :param liff_id: ID of the LIFF app to be updated (required) + :type liff_id: str + :param update_liff_app_request: (required) + :type update_liff_app_request: UpdateLiffAppRequest + :return: Returns the result object. + :rtype: None + """ + return await self._liff.update_liff_app_with_http_info(liff_id, update_liff_app_request) + + async def broadcast(self, broadcast_request: BroadcastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> object: + """Sends a message to multiple users at any time. + + :param broadcast_request: (required) + :type broadcast_request: BroadcastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: object + """ + return await self._messaging_api.broadcast(broadcast_request, x_line_retry_key) + + async def broadcast_with_http_info(self, broadcast_request: BroadcastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> MessagingApiResponse: + """Sends a message to multiple users at any time. + + :param broadcast_request: (required) + :type broadcast_request: BroadcastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.broadcast_with_http_info(broadcast_request, x_line_retry_key) + + async def cancel_default_rich_menu(self) -> None: + """Cancel default rich menu + + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.cancel_default_rich_menu() + + async def cancel_default_rich_menu_with_http_info(self) -> MessagingApiResponse: + """Cancel default rich menu + + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.cancel_default_rich_menu_with_http_info() + + async def close_coupon(self, coupon_id: StrictStr) -> None: + """Close coupon + + :param coupon_id: (required) + :type coupon_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.close_coupon(coupon_id) + + async def close_coupon_with_http_info(self, coupon_id: StrictStr) -> MessagingApiResponse: + """Close coupon + + :param coupon_id: (required) + :type coupon_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.close_coupon_with_http_info(coupon_id) + + async def create_coupon(self, coupon_create_request: Optional[CouponCreateRequest] = None) -> CouponCreateResponse: + """Create a new coupon. Define coupon details such as type, title, and validity period. + + :param coupon_create_request: + :type coupon_create_request: CouponCreateRequest + :return: Returns the result object. + :rtype: CouponCreateResponse + """ + return await self._messaging_api.create_coupon(coupon_create_request) + + async def create_coupon_with_http_info(self, coupon_create_request: Optional[CouponCreateRequest] = None) -> MessagingApiResponse: + """Create a new coupon. Define coupon details such as type, title, and validity period. + + :param coupon_create_request: + :type coupon_create_request: CouponCreateRequest + :return: Returns the result object. + :rtype: tuple(CouponCreateResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.create_coupon_with_http_info(coupon_create_request) + + async def create_rich_menu(self, rich_menu_request: RichMenuRequest) -> RichMenuIdResponse: + """Create rich menu + + :param rich_menu_request: (required) + :type rich_menu_request: RichMenuRequest + :return: Returns the result object. + :rtype: RichMenuIdResponse + """ + return await self._messaging_api.create_rich_menu(rich_menu_request) + + async def create_rich_menu_with_http_info(self, rich_menu_request: RichMenuRequest) -> MessagingApiResponse: + """Create rich menu + + :param rich_menu_request: (required) + :type rich_menu_request: RichMenuRequest + :return: Returns the result object. + :rtype: tuple(RichMenuIdResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.create_rich_menu_with_http_info(rich_menu_request) + + async def create_rich_menu_alias(self, create_rich_menu_alias_request: CreateRichMenuAliasRequest) -> None: + """Create rich menu alias + + :param create_rich_menu_alias_request: (required) + :type create_rich_menu_alias_request: CreateRichMenuAliasRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.create_rich_menu_alias(create_rich_menu_alias_request) + + async def create_rich_menu_alias_with_http_info(self, create_rich_menu_alias_request: CreateRichMenuAliasRequest) -> MessagingApiResponse: + """Create rich menu alias + + :param create_rich_menu_alias_request: (required) + :type create_rich_menu_alias_request: CreateRichMenuAliasRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.create_rich_menu_alias_with_http_info(create_rich_menu_alias_request) + + async def delete_rich_menu(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> None: + """Deletes a rich menu. + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.delete_rich_menu(rich_menu_id) + + async def delete_rich_menu_with_http_info(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> MessagingApiResponse: + """Deletes a rich menu. + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.delete_rich_menu_with_http_info(rich_menu_id) + + async def delete_rich_menu_alias(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='Rich menu alias ID that you want to delete.')]) -> None: + """Delete rich menu alias + + :param rich_menu_alias_id: Rich menu alias ID that you want to delete. (required) + :type rich_menu_alias_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.delete_rich_menu_alias(rich_menu_alias_id) + + async def delete_rich_menu_alias_with_http_info(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='Rich menu alias ID that you want to delete.')]) -> MessagingApiResponse: + """Delete rich menu alias + + :param rich_menu_alias_id: Rich menu alias ID that you want to delete. (required) + :type rich_menu_alias_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.delete_rich_menu_alias_with_http_info(rich_menu_alias_id) + + async def get_aggregation_unit_name_list(self, limit: Annotated[Optional[StrictStr], Field(description='The maximum number of aggregation units you can get per request. ')] = None, start: Annotated[Optional[StrictStr], Field(description="Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. ")] = None) -> GetAggregationUnitNameListResponse: + """Get name list of units used this month + + :param limit: The maximum number of aggregation units you can get per request. + :type limit: str + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. + :type start: str + :return: Returns the result object. + :rtype: GetAggregationUnitNameListResponse + """ + return await self._messaging_api.get_aggregation_unit_name_list(limit, start) + + async def get_aggregation_unit_name_list_with_http_info(self, limit: Annotated[Optional[StrictStr], Field(description='The maximum number of aggregation units you can get per request. ')] = None, start: Annotated[Optional[StrictStr], Field(description="Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. ")] = None) -> MessagingApiResponse: + """Get name list of units used this month + + :param limit: The maximum number of aggregation units you can get per request. + :type limit: str + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. + :type start: str + :return: Returns the result object. + :rtype: tuple(GetAggregationUnitNameListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_aggregation_unit_name_list_with_http_info(limit, start) + + async def get_aggregation_unit_usage(self) -> GetAggregationUnitUsageResponse: + """Get number of units used this month + + :return: Returns the result object. + :rtype: GetAggregationUnitUsageResponse + """ + return await self._messaging_api.get_aggregation_unit_usage() + + async def get_aggregation_unit_usage_with_http_info(self) -> MessagingApiResponse: + """Get number of units used this month + + :return: Returns the result object. + :rtype: tuple(GetAggregationUnitUsageResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_aggregation_unit_usage_with_http_info() + + async def get_bot_info(self) -> BotInfoResponse: + """Get bot info + + :return: Returns the result object. + :rtype: BotInfoResponse + """ + return await self._messaging_api.get_bot_info() + + async def get_bot_info_with_http_info(self) -> MessagingApiResponse: + """Get bot info + + :return: Returns the result object. + :rtype: tuple(BotInfoResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_bot_info_with_http_info() + + async def get_coupon_detail(self, coupon_id: StrictStr) -> CouponResponse: + """Get coupon detail + + :param coupon_id: (required) + :type coupon_id: str + :return: Returns the result object. + :rtype: CouponResponse + """ + return await self._messaging_api.get_coupon_detail(coupon_id) + + async def get_coupon_detail_with_http_info(self, coupon_id: StrictStr) -> MessagingApiResponse: + """Get coupon detail + + :param coupon_id: (required) + :type coupon_id: str + :return: Returns the result object. + :rtype: tuple(CouponResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_coupon_detail_with_http_info(coupon_id) + + async def get_default_rich_menu_id(self) -> RichMenuIdResponse: + """Gets the ID of the default rich menu set with the Messaging API. + + :return: Returns the result object. + :rtype: RichMenuIdResponse + """ + return await self._messaging_api.get_default_rich_menu_id() + + async def get_default_rich_menu_id_with_http_info(self) -> MessagingApiResponse: + """Gets the ID of the default rich menu set with the Messaging API. + + :return: Returns the result object. + :rtype: tuple(RichMenuIdResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_default_rich_menu_id_with_http_info() + + async def get_followers(self, start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. ')] = None, limit: Annotated[Optional[conint(strict=True, le=1000)], Field(description='The maximum number of user IDs to retrieve in a single request.')] = None) -> GetFollowersResponse: + """Get a list of users who added your LINE Official Account as a friend + + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. + :type start: str + :param limit: The maximum number of user IDs to retrieve in a single request. + :type limit: int + :return: Returns the result object. + :rtype: GetFollowersResponse + """ + return await self._messaging_api.get_followers(start, limit) + + async def get_followers_with_http_info(self, start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. ')] = None, limit: Annotated[Optional[conint(strict=True, le=1000)], Field(description='The maximum number of user IDs to retrieve in a single request.')] = None) -> MessagingApiResponse: + """Get a list of users who added your LINE Official Account as a friend + + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. + :type start: str + :param limit: The maximum number of user IDs to retrieve in a single request. + :type limit: int + :return: Returns the result object. + :rtype: tuple(GetFollowersResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_followers_with_http_info(start, limit) + + async def get_group_member_count(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> GroupMemberCountResponse: + """Get number of users in a group chat + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: GroupMemberCountResponse + """ + return await self._messaging_api.get_group_member_count(group_id) + + async def get_group_member_count_with_http_info(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> MessagingApiResponse: + """Get number of users in a group chat + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: tuple(GroupMemberCountResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_group_member_count_with_http_info(group_id) + + async def get_group_member_profile(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')], user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> GroupUserProfileResponse: + """Get group chat member profile + + :param group_id: Group ID (required) + :type group_id: str + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: GroupUserProfileResponse + """ + return await self._messaging_api.get_group_member_profile(group_id, user_id) + + async def get_group_member_profile_with_http_info(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')], user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> MessagingApiResponse: + """Get group chat member profile + + :param group_id: Group ID (required) + :type group_id: str + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(GroupUserProfileResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_group_member_profile_with_http_info(group_id, user_id) + + async def get_group_members_ids(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')], start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. ')] = None) -> MembersIdsResponse: + """Get group chat member user IDs + + :param group_id: Group ID (required) + :type group_id: str + :param start: Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + :type start: str + :return: Returns the result object. + :rtype: MembersIdsResponse + """ + return await self._messaging_api.get_group_members_ids(group_id, start) + + async def get_group_members_ids_with_http_info(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')], start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. ')] = None) -> MessagingApiResponse: + """Get group chat member user IDs + + :param group_id: Group ID (required) + :type group_id: str + :param start: Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + :type start: str + :return: Returns the result object. + :rtype: tuple(MembersIdsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_group_members_ids_with_http_info(group_id, start) + + async def get_group_summary(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> GroupSummaryResponse: + """Get group chat summary + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: GroupSummaryResponse + """ + return await self._messaging_api.get_group_summary(group_id) + + async def get_group_summary_with_http_info(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> MessagingApiResponse: + """Get group chat summary + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: tuple(GroupSummaryResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_group_summary_with_http_info(group_id) + + 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) -> GetJoinedMembershipUsersResponse: + """Get a list of user IDs who joined the membership. + + :param membership_id: Membership plan ID. (required) + :type membership_id: int + :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). + :type start: str + :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. + :type limit: int + :return: Returns the result object. + :rtype: GetJoinedMembershipUsersResponse + """ + return await self._messaging_api.get_joined_membership_users(membership_id, start, limit) + + async 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) -> MessagingApiResponse: + """Get a list of user IDs who joined the membership. + + :param membership_id: Membership plan ID. (required) + :type membership_id: int + :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). + :type start: str + :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. + :type limit: int + :return: Returns the result object. + :rtype: tuple(GetJoinedMembershipUsersResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_joined_membership_users_with_http_info(membership_id, start, limit) + + async def get_membership_list(self) -> MembershipListResponse: + """Get a list of memberships. + + :return: Returns the result object. + :rtype: MembershipListResponse + """ + return await self._messaging_api.get_membership_list() + + async def get_membership_list_with_http_info(self) -> MessagingApiResponse: + """Get a list of memberships. + + :return: Returns the result object. + :rtype: tuple(MembershipListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_membership_list_with_http_info() + + async def get_membership_subscription(self, user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> GetMembershipSubscriptionResponse: + """Get a user's membership subscription. + + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: GetMembershipSubscriptionResponse + """ + return await self._messaging_api.get_membership_subscription(user_id) + + async def get_membership_subscription_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> MessagingApiResponse: + """Get a user's membership subscription. + + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(GetMembershipSubscriptionResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_membership_subscription_with_http_info(user_id) + + async def get_message_quota(self) -> MessageQuotaResponse: + """Gets the target limit for sending messages in the current month. The total number of the free messages and the additional messages is returned. + + :return: Returns the result object. + :rtype: MessageQuotaResponse + """ + return await self._messaging_api.get_message_quota() + + async def get_message_quota_with_http_info(self) -> MessagingApiResponse: + """Gets the target limit for sending messages in the current month. The total number of the free messages and the additional messages is returned. + + :return: Returns the result object. + :rtype: tuple(MessageQuotaResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_message_quota_with_http_info() + + async def get_message_quota_consumption(self) -> QuotaConsumptionResponse: + """Gets the number of messages sent in the current month. + + :return: Returns the result object. + :rtype: QuotaConsumptionResponse + """ + return await self._messaging_api.get_message_quota_consumption() + + async def get_message_quota_consumption_with_http_info(self) -> MessagingApiResponse: + """Gets the number of messages sent in the current month. + + :return: Returns the result object. + :rtype: tuple(QuotaConsumptionResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_message_quota_consumption_with_http_info() + + async def get_narrowcast_progress(self, request_id: Annotated[StrictStr, Field(..., description="The narrowcast message's request ID. Each Messaging API request has a request ID.")]) -> NarrowcastProgressResponse: + """Gets the status of a narrowcast message. + + :param request_id: The narrowcast message's request ID. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: NarrowcastProgressResponse + """ + return await self._messaging_api.get_narrowcast_progress(request_id) + + async def get_narrowcast_progress_with_http_info(self, request_id: Annotated[StrictStr, Field(..., description="The narrowcast message's request ID. Each Messaging API request has a request ID.")]) -> MessagingApiResponse: + """Gets the status of a narrowcast message. + + :param request_id: The narrowcast message's request ID. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: tuple(NarrowcastProgressResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_narrowcast_progress_with_http_info(request_id) + + async def get_number_of_sent_broadcast_messages(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 ')]) -> NumberOfMessagesResponse: + """Get number of sent broadcast messages + + :param var_date: Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: NumberOfMessagesResponse + """ + return await self._messaging_api.get_number_of_sent_broadcast_messages(var_date) + + async def get_number_of_sent_broadcast_messages_with_http_info(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 ')]) -> MessagingApiResponse: + """Get number of sent broadcast messages + + :param var_date: Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(NumberOfMessagesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_number_of_sent_broadcast_messages_with_http_info(var_date) + + async def get_number_of_sent_multicast_messages(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> NumberOfMessagesResponse: + """Get number of sent multicast messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: NumberOfMessagesResponse + """ + return await self._messaging_api.get_number_of_sent_multicast_messages(var_date) + + async def get_number_of_sent_multicast_messages_with_http_info(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> MessagingApiResponse: + """Get number of sent multicast messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(NumberOfMessagesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_number_of_sent_multicast_messages_with_http_info(var_date) + + async def get_number_of_sent_push_messages(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> NumberOfMessagesResponse: + """Get number of sent push messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: NumberOfMessagesResponse + """ + return await self._messaging_api.get_number_of_sent_push_messages(var_date) + + async def get_number_of_sent_push_messages_with_http_info(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> MessagingApiResponse: + """Get number of sent push messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(NumberOfMessagesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_number_of_sent_push_messages_with_http_info(var_date) + + async def get_number_of_sent_reply_messages(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> NumberOfMessagesResponse: + """Get number of sent reply messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: NumberOfMessagesResponse + """ + return await self._messaging_api.get_number_of_sent_reply_messages(var_date) + + async def get_number_of_sent_reply_messages_with_http_info(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> MessagingApiResponse: + """Get number of sent reply messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(NumberOfMessagesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_number_of_sent_reply_messages_with_http_info(var_date) + + async def get_pnp_message_statistics(self, var_date: Annotated[constr(strict=True), Field(..., description='Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 ')]) -> NumberOfMessagesResponse: + """Get number of sent LINE notification messages + + :param var_date: Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: NumberOfMessagesResponse + """ + return await self._messaging_api.get_pnp_message_statistics(var_date) + + async def get_pnp_message_statistics_with_http_info(self, var_date: Annotated[constr(strict=True), Field(..., description='Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 ')]) -> MessagingApiResponse: + """Get number of sent LINE notification messages + + :param var_date: Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(NumberOfMessagesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_pnp_message_statistics_with_http_info(var_date) + + async def get_profile(self, user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> UserProfileResponse: + """Get profile + + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: UserProfileResponse + """ + return await self._messaging_api.get_profile(user_id) + + async def get_profile_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> MessagingApiResponse: + """Get profile + + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(UserProfileResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_profile_with_http_info(user_id) + + async def get_rich_menu(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> RichMenuResponse: + """Gets a rich menu via a rich menu ID. + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: RichMenuResponse + """ + return await self._messaging_api.get_rich_menu(rich_menu_id) + + async def get_rich_menu_with_http_info(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> MessagingApiResponse: + """Gets a rich menu via a rich menu ID. + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: tuple(RichMenuResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_rich_menu_with_http_info(rich_menu_id) + + async def get_rich_menu_alias(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='The rich menu alias ID whose information you want to obtain.')]) -> RichMenuAliasResponse: + """Get rich menu alias information + + :param rich_menu_alias_id: The rich menu alias ID whose information you want to obtain. (required) + :type rich_menu_alias_id: str + :return: Returns the result object. + :rtype: RichMenuAliasResponse + """ + return await self._messaging_api.get_rich_menu_alias(rich_menu_alias_id) + + async def get_rich_menu_alias_with_http_info(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='The rich menu alias ID whose information you want to obtain.')]) -> MessagingApiResponse: + """Get rich menu alias information + + :param rich_menu_alias_id: The rich menu alias ID whose information you want to obtain. (required) + :type rich_menu_alias_id: str + :return: Returns the result object. + :rtype: tuple(RichMenuAliasResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_rich_menu_alias_with_http_info(rich_menu_alias_id) + + async def get_rich_menu_alias_list(self) -> RichMenuAliasListResponse: + """Get list of rich menu alias + + :return: Returns the result object. + :rtype: RichMenuAliasListResponse + """ + return await self._messaging_api.get_rich_menu_alias_list() + + async def get_rich_menu_alias_list_with_http_info(self) -> MessagingApiResponse: + """Get list of rich menu alias + + :return: Returns the result object. + :rtype: tuple(RichMenuAliasListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_rich_menu_alias_list_with_http_info() + + async def get_rich_menu_batch_progress(self, request_id: Annotated[StrictStr, Field(..., description='A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID.')]) -> RichMenuBatchProgressResponse: + """Get the status of Replace or unlink a linked rich menus in batches. + + :param request_id: A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: RichMenuBatchProgressResponse + """ + return await self._messaging_api.get_rich_menu_batch_progress(request_id) + + async def get_rich_menu_batch_progress_with_http_info(self, request_id: Annotated[StrictStr, Field(..., description='A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID.')]) -> MessagingApiResponse: + """Get the status of Replace or unlink a linked rich menus in batches. + + :param request_id: A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: tuple(RichMenuBatchProgressResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_rich_menu_batch_progress_with_http_info(request_id) + + async def get_rich_menu_id_of_user(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')]) -> RichMenuIdResponse: + """Get rich menu ID of user + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: RichMenuIdResponse + """ + return await self._messaging_api.get_rich_menu_id_of_user(user_id) + + async def get_rich_menu_id_of_user_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')]) -> MessagingApiResponse: + """Get rich menu ID of user + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(RichMenuIdResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_rich_menu_id_of_user_with_http_info(user_id) + + async def get_rich_menu_list(self) -> RichMenuListResponse: + """Get rich menu list + + :return: Returns the result object. + :rtype: RichMenuListResponse + """ + return await self._messaging_api.get_rich_menu_list() + + async def get_rich_menu_list_with_http_info(self) -> MessagingApiResponse: + """Get rich menu list + + :return: Returns the result object. + :rtype: tuple(RichMenuListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_rich_menu_list_with_http_info() + + async def get_room_member_count(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')]) -> RoomMemberCountResponse: + """Get number of users in a multi-person chat + + :param room_id: Room ID (required) + :type room_id: str + :return: Returns the result object. + :rtype: RoomMemberCountResponse + """ + return await self._messaging_api.get_room_member_count(room_id) + + async def get_room_member_count_with_http_info(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')]) -> MessagingApiResponse: + """Get number of users in a multi-person chat + + :param room_id: Room ID (required) + :type room_id: str + :return: Returns the result object. + :rtype: tuple(RoomMemberCountResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_room_member_count_with_http_info(room_id) + + async def get_room_member_profile(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')], user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> RoomUserProfileResponse: + """Get multi-person chat member profile + + :param room_id: Room ID (required) + :type room_id: str + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: RoomUserProfileResponse + """ + return await self._messaging_api.get_room_member_profile(room_id, user_id) + + async def get_room_member_profile_with_http_info(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')], user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> MessagingApiResponse: + """Get multi-person chat member profile + + :param room_id: Room ID (required) + :type room_id: str + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(RoomUserProfileResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_room_member_profile_with_http_info(room_id, user_id) + + async def get_room_members_ids(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')], start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. ')] = None) -> MembersIdsResponse: + """Get multi-person chat member user IDs + + :param room_id: Room ID (required) + :type room_id: str + :param start: Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + :type start: str + :return: Returns the result object. + :rtype: MembersIdsResponse + """ + return await self._messaging_api.get_room_members_ids(room_id, start) + + async def get_room_members_ids_with_http_info(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')], start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. ')] = None) -> MessagingApiResponse: + """Get multi-person chat member user IDs + + :param room_id: Room ID (required) + :type room_id: str + :param start: Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + :type start: str + :return: Returns the result object. + :rtype: tuple(MembersIdsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_room_members_ids_with_http_info(room_id, start) + + async def get_webhook_endpoint(self) -> GetWebhookEndpointResponse: + """Get webhook endpoint information + + :return: Returns the result object. + :rtype: GetWebhookEndpointResponse + """ + return await self._messaging_api.get_webhook_endpoint() + + async def get_webhook_endpoint_with_http_info(self) -> MessagingApiResponse: + """Get webhook endpoint information + + :return: Returns the result object. + :rtype: tuple(GetWebhookEndpointResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.get_webhook_endpoint_with_http_info() + + async def issue_link_token(self, user_id: Annotated[StrictStr, Field(..., description='User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. ')]) -> IssueLinkTokenResponse: + """Issue link token + + :param user_id: User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: IssueLinkTokenResponse + """ + return await self._messaging_api.issue_link_token(user_id) + + async def issue_link_token_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. ')]) -> MessagingApiResponse: + """Issue link token + + :param user_id: User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(IssueLinkTokenResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.issue_link_token_with_http_info(user_id) + + async def leave_group(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> None: + """Leave group chat + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.leave_group(group_id) + + async def leave_group_with_http_info(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> MessagingApiResponse: + """Leave group chat + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.leave_group_with_http_info(group_id) + + async def leave_room(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')]) -> None: + """Leave multi-person chat + + :param room_id: Room ID (required) + :type room_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.leave_room(room_id) + + async def leave_room_with_http_info(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')]) -> MessagingApiResponse: + """Leave multi-person chat + + :param room_id: Room ID (required) + :type room_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.leave_room_with_http_info(room_id) + + async def link_rich_menu_id_to_user(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')], rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> None: + """Link rich menu to user. + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.link_rich_menu_id_to_user(user_id, rich_menu_id) + + async def link_rich_menu_id_to_user_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')], rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> MessagingApiResponse: + """Link rich menu to user. + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.link_rich_menu_id_to_user_with_http_info(user_id, rich_menu_id) + + async def link_rich_menu_id_to_users(self, rich_menu_bulk_link_request: RichMenuBulkLinkRequest) -> None: + """Link rich menu to multiple users + + :param rich_menu_bulk_link_request: (required) + :type rich_menu_bulk_link_request: RichMenuBulkLinkRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.link_rich_menu_id_to_users(rich_menu_bulk_link_request) + + async def link_rich_menu_id_to_users_with_http_info(self, rich_menu_bulk_link_request: RichMenuBulkLinkRequest) -> MessagingApiResponse: + """Link rich menu to multiple users + + :param rich_menu_bulk_link_request: (required) + :type rich_menu_bulk_link_request: RichMenuBulkLinkRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.link_rich_menu_id_to_users_with_http_info(rich_menu_bulk_link_request) + + async def list_coupon(self, status: Annotated[Optional[conlist(StrictStr, unique_items=True)], Field(description='Filter coupons by their status.')] = None, start: Annotated[Optional[StrictStr], Field(description='Pagination token to retrieve the next page of results.')] = None, limit: Annotated[Optional[conint(strict=True, le=100, ge=1)], Field(description='Maximum number of coupons to return per request.')] = None) -> MessagingApiPagerCouponListResponse: + """Get a paginated list of coupons. + + :param status: Filter coupons by their status. + :type status: List[str] + :param start: Pagination token to retrieve the next page of results. + :type start: str + :param limit: Maximum number of coupons to return per request. + :type limit: int + :return: Returns the result object. + :rtype: MessagingApiPagerCouponListResponse + """ + return await self._messaging_api.list_coupon(status, start, limit) + + async def list_coupon_with_http_info(self, status: Annotated[Optional[conlist(StrictStr, unique_items=True)], Field(description='Filter coupons by their status.')] = None, start: Annotated[Optional[StrictStr], Field(description='Pagination token to retrieve the next page of results.')] = None, limit: Annotated[Optional[conint(strict=True, le=100, ge=1)], Field(description='Maximum number of coupons to return per request.')] = None) -> MessagingApiResponse: + """Get a paginated list of coupons. + + :param status: Filter coupons by their status. + :type status: List[str] + :param start: Pagination token to retrieve the next page of results. + :type start: str + :param limit: Maximum number of coupons to return per request. + :type limit: int + :return: Returns the result object. + :rtype: tuple(MessagingApiPagerCouponListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.list_coupon_with_http_info(status, start, limit) + + async def mark_messages_as_read(self, mark_messages_as_read_request: MarkMessagesAsReadRequest) -> None: + """Mark messages from users as read + + :param mark_messages_as_read_request: (required) + :type mark_messages_as_read_request: MarkMessagesAsReadRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.mark_messages_as_read(mark_messages_as_read_request) + + async def mark_messages_as_read_with_http_info(self, mark_messages_as_read_request: MarkMessagesAsReadRequest) -> MessagingApiResponse: + """Mark messages from users as read + + :param mark_messages_as_read_request: (required) + :type mark_messages_as_read_request: MarkMessagesAsReadRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.mark_messages_as_read_with_http_info(mark_messages_as_read_request) + + async def mark_messages_as_read_by_token(self, mark_messages_as_read_by_token_request: MarkMessagesAsReadByTokenRequest) -> None: + """Mark messages from users as read by token + + :param mark_messages_as_read_by_token_request: (required) + :type mark_messages_as_read_by_token_request: MarkMessagesAsReadByTokenRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.mark_messages_as_read_by_token(mark_messages_as_read_by_token_request) + + async def mark_messages_as_read_by_token_with_http_info(self, mark_messages_as_read_by_token_request: MarkMessagesAsReadByTokenRequest) -> MessagingApiResponse: + """Mark messages from users as read by token + + :param mark_messages_as_read_by_token_request: (required) + :type mark_messages_as_read_by_token_request: MarkMessagesAsReadByTokenRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.mark_messages_as_read_by_token_with_http_info(mark_messages_as_read_by_token_request) + + async def multicast(self, multicast_request: MulticastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> object: + """An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats. + + :param multicast_request: (required) + :type multicast_request: MulticastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: object + """ + return await self._messaging_api.multicast(multicast_request, x_line_retry_key) + + async def multicast_with_http_info(self, multicast_request: MulticastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> MessagingApiResponse: + """An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats. + + :param multicast_request: (required) + :type multicast_request: MulticastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.multicast_with_http_info(multicast_request, x_line_retry_key) + + async def narrowcast(self, narrowcast_request: NarrowcastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> object: + """Send narrowcast message + + :param narrowcast_request: (required) + :type narrowcast_request: NarrowcastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: object + """ + return await self._messaging_api.narrowcast(narrowcast_request, x_line_retry_key) + + async def narrowcast_with_http_info(self, narrowcast_request: NarrowcastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> MessagingApiResponse: + """Send narrowcast message + + :param narrowcast_request: (required) + :type narrowcast_request: NarrowcastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.narrowcast_with_http_info(narrowcast_request, x_line_retry_key) + + async def push_message(self, push_message_request: PushMessageRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> PushMessageResponse: + """Sends a message to a user, group chat, or multi-person chat at any time. + + :param push_message_request: (required) + :type push_message_request: PushMessageRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: PushMessageResponse + """ + return await self._messaging_api.push_message(push_message_request, x_line_retry_key) + + async def push_message_with_http_info(self, push_message_request: PushMessageRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> MessagingApiResponse: + """Sends a message to a user, group chat, or multi-person chat at any time. + + :param push_message_request: (required) + :type push_message_request: PushMessageRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: tuple(PushMessageResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.push_message_with_http_info(push_message_request, x_line_retry_key) + + async def push_messages_by_phone(self, pnp_messages_request: PnpMessagesRequest, x_line_delivery_tag: Annotated[Optional[constr(strict=True, max_length=100, min_length=16)], Field(description='String returned in the delivery.data property of the delivery completion event via Webhook.')] = None) -> None: + """Send LINE notification message + + :param pnp_messages_request: (required) + :type pnp_messages_request: PnpMessagesRequest + :param x_line_delivery_tag: String returned in the delivery.data property of the delivery completion event via Webhook. + :type x_line_delivery_tag: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.push_messages_by_phone(pnp_messages_request, x_line_delivery_tag) + + async def push_messages_by_phone_with_http_info(self, pnp_messages_request: PnpMessagesRequest, x_line_delivery_tag: Annotated[Optional[constr(strict=True, max_length=100, min_length=16)], Field(description='String returned in the delivery.data property of the delivery completion event via Webhook.')] = None) -> MessagingApiResponse: + """Send LINE notification message + + :param pnp_messages_request: (required) + :type pnp_messages_request: PnpMessagesRequest + :param x_line_delivery_tag: String returned in the delivery.data property of the delivery completion event via Webhook. + :type x_line_delivery_tag: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.push_messages_by_phone_with_http_info(pnp_messages_request, x_line_delivery_tag) + + async def reply_message(self, reply_message_request: ReplyMessageRequest) -> ReplyMessageResponse: + """Send reply message + + :param reply_message_request: (required) + :type reply_message_request: ReplyMessageRequest + :return: Returns the result object. + :rtype: ReplyMessageResponse + """ + return await self._messaging_api.reply_message(reply_message_request) + + async def reply_message_with_http_info(self, reply_message_request: ReplyMessageRequest) -> MessagingApiResponse: + """Send reply message + + :param reply_message_request: (required) + :type reply_message_request: ReplyMessageRequest + :return: Returns the result object. + :rtype: tuple(ReplyMessageResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.reply_message_with_http_info(reply_message_request) + + async def rich_menu_batch(self, rich_menu_batch_request: RichMenuBatchRequest) -> None: + """You can use this endpoint to batch control the rich menu linked to the users using the endpoint such as Link rich menu to user. The following operations are available: 1. Replace a rich menu with another rich menu for all users linked to a specific rich menu 2. Unlink a rich menu for all users linked to a specific rich menu 3. Unlink a rich menu for all users linked the rich menu + + :param rich_menu_batch_request: (required) + :type rich_menu_batch_request: RichMenuBatchRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.rich_menu_batch(rich_menu_batch_request) + + async def rich_menu_batch_with_http_info(self, rich_menu_batch_request: RichMenuBatchRequest) -> MessagingApiResponse: + """You can use this endpoint to batch control the rich menu linked to the users using the endpoint such as Link rich menu to user. The following operations are available: 1. Replace a rich menu with another rich menu for all users linked to a specific rich menu 2. Unlink a rich menu for all users linked to a specific rich menu 3. Unlink a rich menu for all users linked the rich menu + + :param rich_menu_batch_request: (required) + :type rich_menu_batch_request: RichMenuBatchRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.rich_menu_batch_with_http_info(rich_menu_batch_request) + + async def set_default_rich_menu(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> None: + """Set default rich menu + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.set_default_rich_menu(rich_menu_id) + + async def set_default_rich_menu_with_http_info(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> MessagingApiResponse: + """Set default rich menu + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.set_default_rich_menu_with_http_info(rich_menu_id) + + async def set_webhook_endpoint(self, set_webhook_endpoint_request: SetWebhookEndpointRequest) -> None: + """Set webhook endpoint URL + + :param set_webhook_endpoint_request: (required) + :type set_webhook_endpoint_request: SetWebhookEndpointRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.set_webhook_endpoint(set_webhook_endpoint_request) + + async def set_webhook_endpoint_with_http_info(self, set_webhook_endpoint_request: SetWebhookEndpointRequest) -> MessagingApiResponse: + """Set webhook endpoint URL + + :param set_webhook_endpoint_request: (required) + :type set_webhook_endpoint_request: SetWebhookEndpointRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.set_webhook_endpoint_with_http_info(set_webhook_endpoint_request) + + async def show_loading_animation(self, show_loading_animation_request: ShowLoadingAnimationRequest) -> object: + """Display a loading animation in one-on-one chats between users and LINE Official Accounts. + + :param show_loading_animation_request: (required) + :type show_loading_animation_request: ShowLoadingAnimationRequest + :return: Returns the result object. + :rtype: object + """ + return await self._messaging_api.show_loading_animation(show_loading_animation_request) + + async def show_loading_animation_with_http_info(self, show_loading_animation_request: ShowLoadingAnimationRequest) -> MessagingApiResponse: + """Display a loading animation in one-on-one chats between users and LINE Official Accounts. + + :param show_loading_animation_request: (required) + :type show_loading_animation_request: ShowLoadingAnimationRequest + :return: Returns the result object. + :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.show_loading_animation_with_http_info(show_loading_animation_request) + + async def test_webhook_endpoint(self, test_webhook_endpoint_request: Optional[TestWebhookEndpointRequest] = None) -> TestWebhookEndpointResponse: + """Test webhook endpoint + + :param test_webhook_endpoint_request: + :type test_webhook_endpoint_request: TestWebhookEndpointRequest + :return: Returns the result object. + :rtype: TestWebhookEndpointResponse + """ + return await self._messaging_api.test_webhook_endpoint(test_webhook_endpoint_request) + + async def test_webhook_endpoint_with_http_info(self, test_webhook_endpoint_request: Optional[TestWebhookEndpointRequest] = None) -> MessagingApiResponse: + """Test webhook endpoint + + :param test_webhook_endpoint_request: + :type test_webhook_endpoint_request: TestWebhookEndpointRequest + :return: Returns the result object. + :rtype: tuple(TestWebhookEndpointResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api.test_webhook_endpoint_with_http_info(test_webhook_endpoint_request) + + async def unlink_rich_menu_id_from_user(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')]) -> None: + """Unlink rich menu from user + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.unlink_rich_menu_id_from_user(user_id) + + async def unlink_rich_menu_id_from_user_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')]) -> MessagingApiResponse: + """Unlink rich menu from user + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.unlink_rich_menu_id_from_user_with_http_info(user_id) + + async def unlink_rich_menu_id_from_users(self, rich_menu_bulk_unlink_request: RichMenuBulkUnlinkRequest) -> None: + """Unlink rich menus from multiple users + + :param rich_menu_bulk_unlink_request: (required) + :type rich_menu_bulk_unlink_request: RichMenuBulkUnlinkRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.unlink_rich_menu_id_from_users(rich_menu_bulk_unlink_request) + + async def unlink_rich_menu_id_from_users_with_http_info(self, rich_menu_bulk_unlink_request: RichMenuBulkUnlinkRequest) -> MessagingApiResponse: + """Unlink rich menus from multiple users + + :param rich_menu_bulk_unlink_request: (required) + :type rich_menu_bulk_unlink_request: RichMenuBulkUnlinkRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.unlink_rich_menu_id_from_users_with_http_info(rich_menu_bulk_unlink_request) + + async def update_rich_menu_alias(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='The rich menu alias ID you want to update.')], update_rich_menu_alias_request: UpdateRichMenuAliasRequest) -> None: + """Update rich menu alias + + :param rich_menu_alias_id: The rich menu alias ID you want to update. (required) + :type rich_menu_alias_id: str + :param update_rich_menu_alias_request: (required) + :type update_rich_menu_alias_request: UpdateRichMenuAliasRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.update_rich_menu_alias(rich_menu_alias_id, update_rich_menu_alias_request) + + async def update_rich_menu_alias_with_http_info(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='The rich menu alias ID you want to update.')], update_rich_menu_alias_request: UpdateRichMenuAliasRequest) -> MessagingApiResponse: + """Update rich menu alias + + :param rich_menu_alias_id: The rich menu alias ID you want to update. (required) + :type rich_menu_alias_id: str + :param update_rich_menu_alias_request: (required) + :type update_rich_menu_alias_request: UpdateRichMenuAliasRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.update_rich_menu_alias_with_http_info(rich_menu_alias_id, update_rich_menu_alias_request) + + async def validate_broadcast(self, validate_message_request: ValidateMessageRequest) -> None: + """Validate message objects of a broadcast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_broadcast(validate_message_request) + + async def validate_broadcast_with_http_info(self, validate_message_request: ValidateMessageRequest) -> MessagingApiResponse: + """Validate message objects of a broadcast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_broadcast_with_http_info(validate_message_request) + + async def validate_multicast(self, validate_message_request: ValidateMessageRequest) -> None: + """Validate message objects of a multicast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_multicast(validate_message_request) + + async def validate_multicast_with_http_info(self, validate_message_request: ValidateMessageRequest) -> MessagingApiResponse: + """Validate message objects of a multicast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_multicast_with_http_info(validate_message_request) + + async def validate_narrowcast(self, validate_message_request: ValidateMessageRequest) -> None: + """Validate message objects of a narrowcast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_narrowcast(validate_message_request) + + async def validate_narrowcast_with_http_info(self, validate_message_request: ValidateMessageRequest) -> MessagingApiResponse: + """Validate message objects of a narrowcast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_narrowcast_with_http_info(validate_message_request) + + async def validate_push(self, validate_message_request: ValidateMessageRequest) -> None: + """Validate message objects of a push message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_push(validate_message_request) + + async def validate_push_with_http_info(self, validate_message_request: ValidateMessageRequest) -> MessagingApiResponse: + """Validate message objects of a push message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_push_with_http_info(validate_message_request) + + async def validate_reply(self, validate_message_request: ValidateMessageRequest) -> None: + """Validate message objects of a reply message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_reply(validate_message_request) + + async def validate_reply_with_http_info(self, validate_message_request: ValidateMessageRequest) -> MessagingApiResponse: + """Validate message objects of a reply message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_reply_with_http_info(validate_message_request) + + async def validate_rich_menu_batch_request(self, rich_menu_batch_request: RichMenuBatchRequest) -> None: + """Validate a request body of the Replace or unlink the linked rich menus in batches endpoint. + + :param rich_menu_batch_request: (required) + :type rich_menu_batch_request: RichMenuBatchRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_rich_menu_batch_request(rich_menu_batch_request) + + async def validate_rich_menu_batch_request_with_http_info(self, rich_menu_batch_request: RichMenuBatchRequest) -> MessagingApiResponse: + """Validate a request body of the Replace or unlink the linked rich menus in batches endpoint. + + :param rich_menu_batch_request: (required) + :type rich_menu_batch_request: RichMenuBatchRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_rich_menu_batch_request_with_http_info(rich_menu_batch_request) + + async def validate_rich_menu_object(self, rich_menu_request: RichMenuRequest) -> None: + """Validate rich menu object + + :param rich_menu_request: (required) + :type rich_menu_request: RichMenuRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_rich_menu_object(rich_menu_request) + + async def validate_rich_menu_object_with_http_info(self, rich_menu_request: RichMenuRequest) -> MessagingApiResponse: + """Validate rich menu object + + :param rich_menu_request: (required) + :type rich_menu_request: RichMenuRequest + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api.validate_rich_menu_object_with_http_info(rich_menu_request) + + async def get_message_content(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of video or audio')]) -> bytearray: + """Download image, video, and audio data sent from users. + + :param message_id: Message ID of video or audio (required) + :type message_id: str + :return: Returns the result object. + :rtype: bytearray + """ + return await self._messaging_api_blob.get_message_content(message_id) + + async def get_message_content_with_http_info(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of video or audio')]) -> MessagingApiResponse: + """Download image, video, and audio data sent from users. + + :param message_id: Message ID of video or audio (required) + :type message_id: str + :return: Returns the result object. + :rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api_blob.get_message_content_with_http_info(message_id) + + async def get_message_content_preview(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of image or video')]) -> bytearray: + """Get a preview image of the image or video + + :param message_id: Message ID of image or video (required) + :type message_id: str + :return: Returns the result object. + :rtype: bytearray + """ + return await self._messaging_api_blob.get_message_content_preview(message_id) + + async def get_message_content_preview_with_http_info(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of image or video')]) -> MessagingApiResponse: + """Get a preview image of the image or video + + :param message_id: Message ID of image or video (required) + :type message_id: str + :return: Returns the result object. + :rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api_blob.get_message_content_preview_with_http_info(message_id) + + async def get_message_content_transcoding_by_message_id(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of video or audio')]) -> GetMessageContentTranscodingResponse: + """Verify the preparation status of a video or audio for getting + + :param message_id: Message ID of video or audio (required) + :type message_id: str + :return: Returns the result object. + :rtype: GetMessageContentTranscodingResponse + """ + return await self._messaging_api_blob.get_message_content_transcoding_by_message_id(message_id) + + async def get_message_content_transcoding_by_message_id_with_http_info(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of video or audio')]) -> MessagingApiResponse: + """Verify the preparation status of a video or audio for getting + + :param message_id: Message ID of video or audio (required) + :type message_id: str + :return: Returns the result object. + :rtype: tuple(GetMessageContentTranscodingResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api_blob.get_message_content_transcoding_by_message_id_with_http_info(message_id) + + async def get_rich_menu_image(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of the rich menu with the image to be downloaded')]) -> bytearray: + """Download rich menu image. + + :param rich_menu_id: ID of the rich menu with the image to be downloaded (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: bytearray + """ + return await self._messaging_api_blob.get_rich_menu_image(rich_menu_id) + + async def get_rich_menu_image_with_http_info(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of the rich menu with the image to be downloaded')]) -> MessagingApiResponse: + """Download rich menu image. + + :param rich_menu_id: ID of the rich menu with the image to be downloaded (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._messaging_api_blob.get_rich_menu_image_with_http_info(rich_menu_id) + + async def set_rich_menu_image(self, rich_menu_id: Annotated[StrictStr, Field(..., description='The ID of the rich menu to attach the image to')], body: Union[StrictBytes, StrictStr]) -> None: + """Upload rich menu image + + :param rich_menu_id: The ID of the rich menu to attach the image to (required) + :type rich_menu_id: str + :param body: (required) + :type body: bytearray + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api_blob.set_rich_menu_image(rich_menu_id, body) + + async def set_rich_menu_image_with_http_info(self, rich_menu_id: Annotated[StrictStr, Field(..., description='The ID of the rich menu to attach the image to')], body: Union[StrictBytes, StrictStr]) -> MessagingApiResponse: + """Upload rich menu image + + :param rich_menu_id: The ID of the rich menu to attach the image to (required) + :type rich_menu_id: str + :param body: (required) + :type body: bytearray + :return: Returns the result object. + :rtype: None + """ + return await self._messaging_api_blob.set_rich_menu_image_with_http_info(rich_menu_id, body) + + async def acquire_chat_control(self, chat_id: Annotated[StrictStr, Field(..., description='The `userId`, `roomId`, or `groupId`')], acquire_chat_control_request: Optional[AcquireChatControlRequest] = None) -> None: + """If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API. The channel that was previously an Active Channel will automatically switch to a Standby Channel. + + :param chat_id: The `userId`, `roomId`, or `groupId` (required) + :type chat_id: str + :param acquire_chat_control_request: + :type acquire_chat_control_request: AcquireChatControlRequest + :return: Returns the result object. + :rtype: None + """ + return await self._line_module.acquire_chat_control(chat_id, acquire_chat_control_request) + + async def acquire_chat_control_with_http_info(self, chat_id: Annotated[StrictStr, Field(..., description='The `userId`, `roomId`, or `groupId`')], acquire_chat_control_request: Optional[AcquireChatControlRequest] = None) -> ModuleApiResponse: + """If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API. The channel that was previously an Active Channel will automatically switch to a Standby Channel. + + :param chat_id: The `userId`, `roomId`, or `groupId` (required) + :type chat_id: str + :param acquire_chat_control_request: + :type acquire_chat_control_request: AcquireChatControlRequest + :return: Returns the result object. + :rtype: None + """ + return await self._line_module.acquire_chat_control_with_http_info(chat_id, acquire_chat_control_request) + + async def detach_module(self, detach_module_request: Optional[DetachModuleRequest] = None) -> None: + """The module channel admin calls the Detach API to detach the module channel from a LINE Official Account. + + :param detach_module_request: + :type detach_module_request: DetachModuleRequest + :return: Returns the result object. + :rtype: None + """ + return await self._line_module.detach_module(detach_module_request) + + async def detach_module_with_http_info(self, detach_module_request: Optional[DetachModuleRequest] = None) -> ModuleApiResponse: + """The module channel admin calls the Detach API to detach the module channel from a LINE Official Account. + + :param detach_module_request: + :type detach_module_request: DetachModuleRequest + :return: Returns the result object. + :rtype: None + """ + return await self._line_module.detach_module_with_http_info(detach_module_request) + + async def get_modules(self, start: Annotated[Optional[StrictStr], Field(description="Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. ")] = None, limit: Annotated[Optional[conint(strict=True, le=100)], Field(description='Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 ')] = None) -> GetModulesResponse: + """Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels. + + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. + :type start: str + :param limit: Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 + :type limit: int + :return: Returns the result object. + :rtype: GetModulesResponse + """ + return await self._line_module.get_modules(start, limit) + + async def get_modules_with_http_info(self, start: Annotated[Optional[StrictStr], Field(description="Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. ")] = None, limit: Annotated[Optional[conint(strict=True, le=100)], Field(description='Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 ')] = None) -> ModuleApiResponse: + """Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels. + + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. + :type start: str + :param limit: Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 + :type limit: int + :return: Returns the result object. + :rtype: tuple(GetModulesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._line_module.get_modules_with_http_info(start, limit) + + async def release_chat_control(self, chat_id: Annotated[StrictStr, Field(..., description='The `userId`, `roomId`, or `groupId`')]) -> None: + """To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API. + + :param chat_id: The `userId`, `roomId`, or `groupId` (required) + :type chat_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._line_module.release_chat_control(chat_id) + + async def release_chat_control_with_http_info(self, chat_id: Annotated[StrictStr, Field(..., description='The `userId`, `roomId`, or `groupId`')]) -> ModuleApiResponse: + """To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API. + + :param chat_id: The `userId`, `roomId`, or `groupId` (required) + :type chat_id: str + :return: Returns the result object. + :rtype: None + """ + return await self._line_module.release_chat_control_with_http_info(chat_id) + + async def attach_module(self, grant_type: Annotated[StrictStr, Field(..., description='authorization_code')], code: Annotated[StrictStr, Field(..., description='Authorization code received from the LINE Platform.')], redirect_uri: Annotated[StrictStr, Field(..., description='Specify the redirect_uri specified in the URL for authentication and authorization.')], code_verifier: Annotated[Optional[StrictStr], Field(description='Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks.')] = None, client_id: Annotated[Optional[StrictStr], Field(description='Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. ')] = None, client_secret: Annotated[Optional[StrictStr], Field(description='Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. ')] = None, region: Annotated[Optional[StrictStr], Field(description='If you specified a value for region in the URL for authentication and authorization, specify the same value. ')] = None, basic_search_id: Annotated[Optional[StrictStr], Field(description='If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value.')] = None, scope: Annotated[Optional[StrictStr], Field(description='If you specified a value for scope in the URL for authentication and authorization, specify the same value.')] = None, brand_type: Annotated[Optional[StrictStr], Field(description='If you specified a value for brand_type in the URL for authentication and authorization, specify the same value.')] = None) -> AttachModuleResponse: + """Attach by operation of the module channel provider + + :param grant_type: authorization_code (required) + :type grant_type: str + :param code: Authorization code received from the LINE Platform. (required) + :type code: str + :param redirect_uri: Specify the redirect_uri specified in the URL for authentication and authorization. (required) + :type redirect_uri: str + :param code_verifier: Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks. + :type code_verifier: str + :param client_id: Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. + :type client_id: str + :param client_secret: Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. + :type client_secret: str + :param region: If you specified a value for region in the URL for authentication and authorization, specify the same value. + :type region: str + :param basic_search_id: If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value. + :type basic_search_id: str + :param scope: If you specified a value for scope in the URL for authentication and authorization, specify the same value. + :type scope: str + :param brand_type: If you specified a value for brand_type in the URL for authentication and authorization, specify the same value. + :type brand_type: str + :return: Returns the result object. + :rtype: AttachModuleResponse + """ + return await self._line_module_attach.attach_module(grant_type, code, redirect_uri, code_verifier, client_id, client_secret, region, basic_search_id, scope, brand_type) + + async def attach_module_with_http_info(self, grant_type: Annotated[StrictStr, Field(..., description='authorization_code')], code: Annotated[StrictStr, Field(..., description='Authorization code received from the LINE Platform.')], redirect_uri: Annotated[StrictStr, Field(..., description='Specify the redirect_uri specified in the URL for authentication and authorization.')], code_verifier: Annotated[Optional[StrictStr], Field(description='Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks.')] = None, client_id: Annotated[Optional[StrictStr], Field(description='Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. ')] = None, client_secret: Annotated[Optional[StrictStr], Field(description='Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. ')] = None, region: Annotated[Optional[StrictStr], Field(description='If you specified a value for region in the URL for authentication and authorization, specify the same value. ')] = None, basic_search_id: Annotated[Optional[StrictStr], Field(description='If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value.')] = None, scope: Annotated[Optional[StrictStr], Field(description='If you specified a value for scope in the URL for authentication and authorization, specify the same value.')] = None, brand_type: Annotated[Optional[StrictStr], Field(description='If you specified a value for brand_type in the URL for authentication and authorization, specify the same value.')] = None) -> ModuleattachApiResponse: + """Attach by operation of the module channel provider + + :param grant_type: authorization_code (required) + :type grant_type: str + :param code: Authorization code received from the LINE Platform. (required) + :type code: str + :param redirect_uri: Specify the redirect_uri specified in the URL for authentication and authorization. (required) + :type redirect_uri: str + :param code_verifier: Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks. + :type code_verifier: str + :param client_id: Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. + :type client_id: str + :param client_secret: Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. + :type client_secret: str + :param region: If you specified a value for region in the URL for authentication and authorization, specify the same value. + :type region: str + :param basic_search_id: If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value. + :type basic_search_id: str + :param scope: If you specified a value for scope in the URL for authentication and authorization, specify the same value. + :type scope: str + :param brand_type: If you specified a value for brand_type in the URL for authentication and authorization, specify the same value. + :type brand_type: str + :return: Returns the result object. + :rtype: tuple(AttachModuleResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return await self._line_module_attach.attach_module_with_http_info(grant_type, code, redirect_uri, code_verifier, client_id, client_secret, region, basic_search_id, scope, brand_type) + + async def mission_sticker_v3(self, mission_sticker_request: MissionStickerRequest) -> None: + """Sends a mission sticker. + + :param mission_sticker_request: (required) + :type mission_sticker_request: MissionStickerRequest + :return: Returns the result object. + :rtype: None + """ + return await self._shop.mission_sticker_v3(mission_sticker_request) + + async def mission_sticker_v3_with_http_info(self, mission_sticker_request: MissionStickerRequest) -> ShopApiResponse: + """Sends a mission sticker. + + :param mission_sticker_request: (required) + :type mission_sticker_request: MissionStickerRequest + :return: Returns the result object. + :rtype: None + """ + return await self._shop.mission_sticker_v3_with_http_info(mission_sticker_request) + diff --git a/linebot/v3/audience/api/async_manage_audience.py b/linebot/v3/audience/api/async_manage_audience.py index 3a4dc1dd9..1413ffc82 100644 --- a/linebot/v3/audience/api/async_manage_audience.py +++ b/linebot/v3/audience/api/async_manage_audience.py @@ -52,6 +52,9 @@ class AsyncManageAudience(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.AsyncLineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/audience/api/async_manage_audience_blob.py b/linebot/v3/audience/api/async_manage_audience_blob.py index 0c5efdf39..cfa9a0432 100644 --- a/linebot/v3/audience/api/async_manage_audience_blob.py +++ b/linebot/v3/audience/api/async_manage_audience_blob.py @@ -39,6 +39,9 @@ class AsyncManageAudienceBlob(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.AsyncLineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/audience/api/manage_audience.py b/linebot/v3/audience/api/manage_audience.py index d575501db..8e5210bf3 100644 --- a/linebot/v3/audience/api/manage_audience.py +++ b/linebot/v3/audience/api/manage_audience.py @@ -50,6 +50,9 @@ class ManageAudience(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.LineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/audience/api/manage_audience_blob.py b/linebot/v3/audience/api/manage_audience_blob.py index 189e21f1e..55f07ded4 100644 --- a/linebot/v3/audience/api/manage_audience_blob.py +++ b/linebot/v3/audience/api/manage_audience_blob.py @@ -37,6 +37,9 @@ class ManageAudienceBlob(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.LineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/insight/api/async_insight.py b/linebot/v3/insight/api/async_insight.py index d81e797c6..cf3463d01 100644 --- a/linebot/v3/insight/api/async_insight.py +++ b/linebot/v3/insight/api/async_insight.py @@ -43,6 +43,9 @@ class AsyncInsight(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.AsyncLineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/insight/api/insight.py b/linebot/v3/insight/api/insight.py index 70c774e52..238402283 100644 --- a/linebot/v3/insight/api/insight.py +++ b/linebot/v3/insight/api/insight.py @@ -41,6 +41,9 @@ class Insight(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.LineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/liff/api/async_liff.py b/linebot/v3/liff/api/async_liff.py index 174db3d77..4e89a6415 100644 --- a/linebot/v3/liff/api/async_liff.py +++ b/linebot/v3/liff/api/async_liff.py @@ -40,6 +40,9 @@ class AsyncLiff(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.AsyncLineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/liff/api/liff.py b/linebot/v3/liff/api/liff.py index 3e063b66a..f16663b1a 100644 --- a/linebot/v3/liff/api/liff.py +++ b/linebot/v3/liff/api/liff.py @@ -38,6 +38,9 @@ class Liff(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.LineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/line_bot_client.py b/linebot/v3/line_bot_client.py new file mode 100644 index 000000000..01d02033d --- /dev/null +++ b/linebot/v3/line_bot_client.py @@ -0,0 +1,2415 @@ +# coding: utf-8 + +# Auto-generated by tools/generate_unified_client.py. Do not edit manually. + +from typing import Optional, Union +from typing_extensions import Annotated +from pydantic.v1 import Field, StrictBool, StrictBytes, StrictInt, StrictStr, conint, conlist, constr + +from linebot.v3.audience.configuration import Configuration as AudienceConfiguration +from linebot.v3.audience.api_client import ApiClient as AudienceApiClient +from linebot.v3.insight.configuration import Configuration as InsightConfiguration +from linebot.v3.insight.api_client import ApiClient as InsightApiClient +from linebot.v3.liff.configuration import Configuration as LiffConfiguration +from linebot.v3.liff.api_client import ApiClient as LiffApiClient +from linebot.v3.messaging.configuration import Configuration as MessagingConfiguration +from linebot.v3.messaging.api_client import ApiClient as MessagingApiClient +from linebot.v3.module.configuration import Configuration as ModuleConfiguration +from linebot.v3.module.api_client import ApiClient as ModuleApiClient +from linebot.v3.moduleattach.configuration import Configuration as ModuleattachConfiguration +from linebot.v3.moduleattach.api_client import ApiClient as ModuleattachApiClient +from linebot.v3.shop.configuration import Configuration as ShopConfiguration +from linebot.v3.shop.api_client import ApiClient as ShopApiClient + +from linebot.v3.audience.api.manage_audience import ManageAudience +from linebot.v3.audience.api.manage_audience_blob import ManageAudienceBlob +from linebot.v3.insight.api.insight import Insight +from linebot.v3.liff.api.liff import Liff +from linebot.v3.messaging.api.messaging_api import MessagingApi +from linebot.v3.messaging.api.messaging_api_blob import MessagingApiBlob +from linebot.v3.module.api.line_module import LineModule +from linebot.v3.moduleattach.api.line_module_attach import LineModuleAttach +from linebot.v3.shop.api.shop import Shop +from linebot.v3.audience.api_response import ApiResponse as AudienceApiResponse +from linebot.v3.insight.api_response import ApiResponse as InsightApiResponse +from linebot.v3.liff.api_response import ApiResponse as LiffApiResponse +from linebot.v3.messaging.api_response import ApiResponse as MessagingApiResponse +from linebot.v3.module.api_response import ApiResponse as ModuleApiResponse +from linebot.v3.moduleattach.api_response import ApiResponse as ModuleattachApiResponse +from linebot.v3.shop.api_response import ApiResponse as ShopApiResponse + +from linebot.v3.audience.models.add_audience_to_audience_group_request import AddAudienceToAudienceGroupRequest +from linebot.v3.audience.models.audience_group_create_route import AudienceGroupCreateRoute +from linebot.v3.audience.models.audience_group_status import AudienceGroupStatus +from linebot.v3.audience.models.create_audience_group_request import CreateAudienceGroupRequest +from linebot.v3.audience.models.create_audience_group_response import CreateAudienceGroupResponse +from linebot.v3.audience.models.create_click_based_audience_group_request import CreateClickBasedAudienceGroupRequest +from linebot.v3.audience.models.create_click_based_audience_group_response import CreateClickBasedAudienceGroupResponse +from linebot.v3.audience.models.create_imp_based_audience_group_request import CreateImpBasedAudienceGroupRequest +from linebot.v3.audience.models.create_imp_based_audience_group_response import CreateImpBasedAudienceGroupResponse +from linebot.v3.audience.models.get_audience_data_response import GetAudienceDataResponse +from linebot.v3.audience.models.get_audience_groups_response import GetAudienceGroupsResponse +from linebot.v3.audience.models.get_shared_audience_data_response import GetSharedAudienceDataResponse +from linebot.v3.audience.models.get_shared_audience_groups_response import GetSharedAudienceGroupsResponse +from linebot.v3.audience.models.update_audience_group_description_request import UpdateAudienceGroupDescriptionRequest +from linebot.v3.insight.models.get_friends_demographics_response import GetFriendsDemographicsResponse +from linebot.v3.insight.models.get_message_event_response import GetMessageEventResponse +from linebot.v3.insight.models.get_number_of_followers_response import GetNumberOfFollowersResponse +from linebot.v3.insight.models.get_number_of_message_deliveries_response import GetNumberOfMessageDeliveriesResponse +from linebot.v3.insight.models.get_statistics_per_unit_response import GetStatisticsPerUnitResponse +from linebot.v3.liff.models.add_liff_app_request import AddLiffAppRequest +from linebot.v3.liff.models.add_liff_app_response import AddLiffAppResponse +from linebot.v3.liff.models.get_all_liff_apps_response import GetAllLiffAppsResponse +from linebot.v3.liff.models.update_liff_app_request import UpdateLiffAppRequest +from linebot.v3.messaging.models.bot_info_response import BotInfoResponse +from linebot.v3.messaging.models.broadcast_request import BroadcastRequest +from linebot.v3.messaging.models.coupon_create_request import CouponCreateRequest +from linebot.v3.messaging.models.coupon_create_response import CouponCreateResponse +from linebot.v3.messaging.models.coupon_response import CouponResponse +from linebot.v3.messaging.models.create_rich_menu_alias_request import CreateRichMenuAliasRequest +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_joined_membership_users_response import GetJoinedMembershipUsersResponse +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 +from linebot.v3.messaging.models.group_summary_response import GroupSummaryResponse +from linebot.v3.messaging.models.group_user_profile_response import GroupUserProfileResponse +from linebot.v3.messaging.models.issue_link_token_response import IssueLinkTokenResponse +from linebot.v3.messaging.models.mark_messages_as_read_by_token_request import MarkMessagesAsReadByTokenRequest +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.messaging_api_pager_coupon_list_response import MessagingApiPagerCouponListResponse +from linebot.v3.messaging.models.multicast_request import MulticastRequest +from linebot.v3.messaging.models.narrowcast_progress_response import NarrowcastProgressResponse +from linebot.v3.messaging.models.narrowcast_request import NarrowcastRequest +from linebot.v3.messaging.models.number_of_messages_response import NumberOfMessagesResponse +from linebot.v3.messaging.models.pnp_messages_request import PnpMessagesRequest +from linebot.v3.messaging.models.push_message_request import PushMessageRequest +from linebot.v3.messaging.models.push_message_response import PushMessageResponse +from linebot.v3.messaging.models.quota_consumption_response import QuotaConsumptionResponse +from linebot.v3.messaging.models.reply_message_request import ReplyMessageRequest +from linebot.v3.messaging.models.reply_message_response import ReplyMessageResponse +from linebot.v3.messaging.models.rich_menu_alias_list_response import RichMenuAliasListResponse +from linebot.v3.messaging.models.rich_menu_alias_response import RichMenuAliasResponse +from linebot.v3.messaging.models.rich_menu_batch_progress_response import RichMenuBatchProgressResponse +from linebot.v3.messaging.models.rich_menu_batch_request import RichMenuBatchRequest +from linebot.v3.messaging.models.rich_menu_bulk_link_request import RichMenuBulkLinkRequest +from linebot.v3.messaging.models.rich_menu_bulk_unlink_request import RichMenuBulkUnlinkRequest +from linebot.v3.messaging.models.rich_menu_id_response import RichMenuIdResponse +from linebot.v3.messaging.models.rich_menu_list_response import RichMenuListResponse +from linebot.v3.messaging.models.rich_menu_request import RichMenuRequest +from linebot.v3.messaging.models.rich_menu_response import RichMenuResponse +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 +from linebot.v3.messaging.models.user_profile_response import UserProfileResponse +from linebot.v3.messaging.models.validate_message_request import ValidateMessageRequest +from linebot.v3.module.models.acquire_chat_control_request import AcquireChatControlRequest +from linebot.v3.module.models.detach_module_request import DetachModuleRequest +from linebot.v3.module.models.get_modules_response import GetModulesResponse +from linebot.v3.moduleattach.models.attach_module_response import AttachModuleResponse +from linebot.v3.shop.models.mission_sticker_request import MissionStickerRequest + + +class LineBotClient: + """A single entry-point client that wraps all LINE API operations. + + The LINE Bot SDK v3 splits API operations across multiple subpackages + (messaging, audience, insight, liff, etc.), each with its own + ``Configuration``, ``ApiClient``, and API class. + ``LineBotClient`` consolidates them so that you can call every + API method through one instance with a single ``channel_access_token``. + + Wrapped subpackages: ``audience``, ``insight``, ``liff``, ``messaging``, ``module``, ``moduleattach``, ``shop``. + + Auto-generated by ``tools/generate_unified_client.py``. + Do not edit manually. + + Usage:: + + from linebot.v3 import LineBotClient + + with LineBotClient(channel_access_token="YOUR_TOKEN") as client: + client.reply_message(...) + """ + + def __init__(self, channel_access_token: str, **kwargs) -> None: + """Create a unified LINE Bot client. + + :param str channel_access_token: Channel access token. + :param kwargs: Additional keyword arguments passed to each Configuration. + """ + self._audience_configuration = AudienceConfiguration( + access_token=channel_access_token, **kwargs + ) + self._audience_api_client = AudienceApiClient( + self._audience_configuration + ) + self._insight_configuration = InsightConfiguration( + access_token=channel_access_token, **kwargs + ) + self._insight_api_client = InsightApiClient( + self._insight_configuration + ) + self._liff_configuration = LiffConfiguration( + access_token=channel_access_token, **kwargs + ) + self._liff_api_client = LiffApiClient( + self._liff_configuration + ) + self._messaging_configuration = MessagingConfiguration( + access_token=channel_access_token, **kwargs + ) + self._messaging_api_client = MessagingApiClient( + self._messaging_configuration + ) + self._module_configuration = ModuleConfiguration( + access_token=channel_access_token, **kwargs + ) + self._module_api_client = ModuleApiClient( + self._module_configuration + ) + self._moduleattach_configuration = ModuleattachConfiguration( + access_token=channel_access_token, **kwargs + ) + self._moduleattach_api_client = ModuleattachApiClient( + self._moduleattach_configuration + ) + self._shop_configuration = ShopConfiguration( + access_token=channel_access_token, **kwargs + ) + self._shop_api_client = ShopApiClient( + self._shop_configuration + ) + + self._manage_audience = ManageAudience(self._audience_api_client) + self._manage_audience_blob = ManageAudienceBlob(self._audience_api_client) + self._insight = Insight(self._insight_api_client) + self._liff = Liff(self._liff_api_client) + self._messaging_api = MessagingApi(self._messaging_api_client) + self._messaging_api_blob = MessagingApiBlob(self._messaging_api_client) + self._line_module = LineModule(self._module_api_client) + self._line_module_attach = LineModuleAttach(self._moduleattach_api_client) + self._shop = Shop(self._shop_api_client) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.close() + + def close(self) -> None: + """Close all underlying API clients.""" + errors: list[BaseException] = [] + try: + self._audience_api_client.close() + except Exception as e: + errors.append(e) + try: + self._insight_api_client.close() + except Exception as e: + errors.append(e) + try: + self._liff_api_client.close() + except Exception as e: + errors.append(e) + try: + self._messaging_api_client.close() + except Exception as e: + errors.append(e) + try: + self._module_api_client.close() + except Exception as e: + errors.append(e) + try: + self._moduleattach_api_client.close() + except Exception as e: + errors.append(e) + try: + self._shop_api_client.close() + except Exception as e: + errors.append(e) + if errors: + raise errors[0] + + def add_audience_to_audience_group(self, add_audience_to_audience_group_request: AddAudienceToAudienceGroupRequest) -> None: + """Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by JSON) + + :param add_audience_to_audience_group_request: (required) + :type add_audience_to_audience_group_request: AddAudienceToAudienceGroupRequest + :return: Returns the result object. + :rtype: None + """ + return self._manage_audience.add_audience_to_audience_group(add_audience_to_audience_group_request) + + def add_audience_to_audience_group_with_http_info(self, add_audience_to_audience_group_request: AddAudienceToAudienceGroupRequest) -> AudienceApiResponse: + """Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by JSON) + + :param add_audience_to_audience_group_request: (required) + :type add_audience_to_audience_group_request: AddAudienceToAudienceGroupRequest + :return: Returns the result object. + :rtype: None + """ + return self._manage_audience.add_audience_to_audience_group_with_http_info(add_audience_to_audience_group_request) + + def create_audience_group(self, create_audience_group_request: CreateAudienceGroupRequest) -> CreateAudienceGroupResponse: + """Create audience for uploading user IDs (by JSON) + + :param create_audience_group_request: (required) + :type create_audience_group_request: CreateAudienceGroupRequest + :return: Returns the result object. + :rtype: CreateAudienceGroupResponse + """ + return self._manage_audience.create_audience_group(create_audience_group_request) + + def create_audience_group_with_http_info(self, create_audience_group_request: CreateAudienceGroupRequest) -> AudienceApiResponse: + """Create audience for uploading user IDs (by JSON) + + :param create_audience_group_request: (required) + :type create_audience_group_request: CreateAudienceGroupRequest + :return: Returns the result object. + :rtype: tuple(CreateAudienceGroupResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._manage_audience.create_audience_group_with_http_info(create_audience_group_request) + + def create_click_based_audience_group(self, create_click_based_audience_group_request: CreateClickBasedAudienceGroupRequest) -> CreateClickBasedAudienceGroupResponse: + """Create audience for click-based retargeting + + :param create_click_based_audience_group_request: (required) + :type create_click_based_audience_group_request: CreateClickBasedAudienceGroupRequest + :return: Returns the result object. + :rtype: CreateClickBasedAudienceGroupResponse + """ + return self._manage_audience.create_click_based_audience_group(create_click_based_audience_group_request) + + def create_click_based_audience_group_with_http_info(self, create_click_based_audience_group_request: CreateClickBasedAudienceGroupRequest) -> AudienceApiResponse: + """Create audience for click-based retargeting + + :param create_click_based_audience_group_request: (required) + :type create_click_based_audience_group_request: CreateClickBasedAudienceGroupRequest + :return: Returns the result object. + :rtype: tuple(CreateClickBasedAudienceGroupResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._manage_audience.create_click_based_audience_group_with_http_info(create_click_based_audience_group_request) + + def create_imp_based_audience_group(self, create_imp_based_audience_group_request: CreateImpBasedAudienceGroupRequest) -> CreateImpBasedAudienceGroupResponse: + """Create audience for impression-based retargeting + + :param create_imp_based_audience_group_request: (required) + :type create_imp_based_audience_group_request: CreateImpBasedAudienceGroupRequest + :return: Returns the result object. + :rtype: CreateImpBasedAudienceGroupResponse + """ + return self._manage_audience.create_imp_based_audience_group(create_imp_based_audience_group_request) + + def create_imp_based_audience_group_with_http_info(self, create_imp_based_audience_group_request: CreateImpBasedAudienceGroupRequest) -> AudienceApiResponse: + """Create audience for impression-based retargeting + + :param create_imp_based_audience_group_request: (required) + :type create_imp_based_audience_group_request: CreateImpBasedAudienceGroupRequest + :return: Returns the result object. + :rtype: tuple(CreateImpBasedAudienceGroupResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._manage_audience.create_imp_based_audience_group_with_http_info(create_imp_based_audience_group_request) + + def delete_audience_group(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> None: + """Delete audience + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: None + """ + return self._manage_audience.delete_audience_group(audience_group_id) + + def delete_audience_group_with_http_info(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> AudienceApiResponse: + """Delete audience + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: None + """ + return self._manage_audience.delete_audience_group_with_http_info(audience_group_id) + + def get_audience_data(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> GetAudienceDataResponse: + """Gets audience data. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: GetAudienceDataResponse + """ + return self._manage_audience.get_audience_data(audience_group_id) + + def get_audience_data_with_http_info(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> AudienceApiResponse: + """Gets audience data. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: tuple(GetAudienceDataResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._manage_audience.get_audience_data_with_http_info(audience_group_id) + + def get_audience_groups(self, page: Annotated[conint(strict=True, ge=1), Field(..., description='The page to return when getting (paginated) results. Must be 1 or higher.')], description: Annotated[Optional[StrictStr], Field(description='The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ')] = None, status: Annotated[Optional[AudienceGroupStatus], Field(description='The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ')] = None, size: Annotated[Optional[conint(strict=True, le=40)], Field(description='The number of audiences per page. Default: 20 Max: 40 ')] = None, includes_external_public_groups: Annotated[Optional[StrictBool], Field(description='true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. ')] = None, create_route: Annotated[Optional[AudienceGroupCreateRoute], Field(description='How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ')] = None) -> GetAudienceGroupsResponse: + """Gets data for more than one audience. + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param includes_external_public_groups: true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. + :type includes_external_public_groups: bool + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :return: Returns the result object. + :rtype: GetAudienceGroupsResponse + """ + return self._manage_audience.get_audience_groups(page, description, status, size, includes_external_public_groups, create_route) + + def get_audience_groups_with_http_info(self, page: Annotated[conint(strict=True, ge=1), Field(..., description='The page to return when getting (paginated) results. Must be 1 or higher.')], description: Annotated[Optional[StrictStr], Field(description='The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ')] = None, status: Annotated[Optional[AudienceGroupStatus], Field(description='The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ')] = None, size: Annotated[Optional[conint(strict=True, le=40)], Field(description='The number of audiences per page. Default: 20 Max: 40 ')] = None, includes_external_public_groups: Annotated[Optional[StrictBool], Field(description='true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. ')] = None, create_route: Annotated[Optional[AudienceGroupCreateRoute], Field(description='How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ')] = None) -> AudienceApiResponse: + """Gets data for more than one audience. + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param includes_external_public_groups: true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. + :type includes_external_public_groups: bool + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :return: Returns the result object. + :rtype: tuple(GetAudienceGroupsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._manage_audience.get_audience_groups_with_http_info(page, description, status, size, includes_external_public_groups, create_route) + + def get_shared_audience_data(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> GetSharedAudienceDataResponse: + """Gets audience data. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: GetSharedAudienceDataResponse + """ + return self._manage_audience.get_shared_audience_data(audience_group_id) + + def get_shared_audience_data_with_http_info(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')]) -> AudienceApiResponse: + """Gets audience data. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :return: Returns the result object. + :rtype: tuple(GetSharedAudienceDataResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._manage_audience.get_shared_audience_data_with_http_info(audience_group_id) + + def get_shared_audience_groups(self, page: Annotated[conint(strict=True, ge=1), Field(..., description='The page to return when getting (paginated) results. Must be 1 or higher.')], description: Annotated[Optional[StrictStr], Field(description='The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ')] = None, status: Annotated[Optional[AudienceGroupStatus], Field(description='The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ')] = None, size: Annotated[Optional[conint(strict=True, le=40)], Field(description='The number of audiences per page. Default: 20 Max: 40 ')] = None, create_route: Annotated[Optional[AudienceGroupCreateRoute], Field(description='How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ')] = None, includes_owned_audience_groups: Annotated[Optional[StrictBool], Field(description='true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager ')] = None) -> GetSharedAudienceGroupsResponse: + """Gets data for more than one audience, including those shared by the Business Manager. + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :param includes_owned_audience_groups: true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager + :type includes_owned_audience_groups: bool + :return: Returns the result object. + :rtype: GetSharedAudienceGroupsResponse + """ + return self._manage_audience.get_shared_audience_groups(page, description, status, size, create_route, includes_owned_audience_groups) + + def get_shared_audience_groups_with_http_info(self, page: Annotated[conint(strict=True, ge=1), Field(..., description='The page to return when getting (paginated) results. Must be 1 or higher.')], description: Annotated[Optional[StrictStr], Field(description='The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. ')] = None, status: Annotated[Optional[AudienceGroupStatus], Field(description='The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. ')] = None, size: Annotated[Optional[conint(strict=True, le=40)], Field(description='The number of audiences per page. Default: 20 Max: 40 ')] = None, create_route: Annotated[Optional[AudienceGroupCreateRoute], Field(description='How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. ')] = None, includes_owned_audience_groups: Annotated[Optional[StrictBool], Field(description='true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager ')] = None) -> AudienceApiResponse: + """Gets data for more than one audience, including those shared by the Business Manager. + + :param page: The page to return when getting (paginated) results. Must be 1 or higher. (required) + :type page: int + :param description: The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + :type description: str + :param status: The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + :type status: AudienceGroupStatus + :param size: The number of audiences per page. Default: 20 Max: 40 + :type size: int + :param create_route: How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + :type create_route: AudienceGroupCreateRoute + :param includes_owned_audience_groups: true: Include audienceGroups owned by LINE Official Account Manager false: Respond only audienceGroups shared by Business Manager + :type includes_owned_audience_groups: bool + :return: Returns the result object. + :rtype: tuple(GetSharedAudienceGroupsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._manage_audience.get_shared_audience_groups_with_http_info(page, description, status, size, create_route, includes_owned_audience_groups) + + def update_audience_group_description(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')], update_audience_group_description_request: UpdateAudienceGroupDescriptionRequest) -> None: + """Renames an existing audience. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :param update_audience_group_description_request: (required) + :type update_audience_group_description_request: UpdateAudienceGroupDescriptionRequest + :return: Returns the result object. + :rtype: None + """ + return self._manage_audience.update_audience_group_description(audience_group_id, update_audience_group_description_request) + + def update_audience_group_description_with_http_info(self, audience_group_id: Annotated[StrictInt, Field(..., description='The audience ID.')], update_audience_group_description_request: UpdateAudienceGroupDescriptionRequest) -> AudienceApiResponse: + """Renames an existing audience. + + :param audience_group_id: The audience ID. (required) + :type audience_group_id: int + :param update_audience_group_description_request: (required) + :type update_audience_group_description_request: UpdateAudienceGroupDescriptionRequest + :return: Returns the result object. + :rtype: None + """ + return self._manage_audience.update_audience_group_description_with_http_info(audience_group_id, update_audience_group_description_request) + + def add_user_ids_to_audience(self, file: Annotated[Union[StrictBytes, StrictStr], Field(..., description='A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 ')], audience_group_id: Annotated[Optional[StrictInt], Field(description='The audience ID.')] = None, upload_description: Annotated[Optional[StrictStr], Field(description='The description to register with the job')] = None) -> None: + """Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by file). + + :param file: A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 (required) + :type file: bytearray + :param audience_group_id: The audience ID. + :type audience_group_id: int + :param upload_description: The description to register with the job + :type upload_description: str + :return: Returns the result object. + :rtype: None + """ + return self._manage_audience_blob.add_user_ids_to_audience(file, audience_group_id, upload_description) + + def add_user_ids_to_audience_with_http_info(self, file: Annotated[Union[StrictBytes, StrictStr], Field(..., description='A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 ')], audience_group_id: Annotated[Optional[StrictInt], Field(description='The audience ID.')] = None, upload_description: Annotated[Optional[StrictStr], Field(description='The description to register with the job')] = None) -> AudienceApiResponse: + """Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by file). + + :param file: A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 (required) + :type file: bytearray + :param audience_group_id: The audience ID. + :type audience_group_id: int + :param upload_description: The description to register with the job + :type upload_description: str + :return: Returns the result object. + :rtype: None + """ + return self._manage_audience_blob.add_user_ids_to_audience_with_http_info(file, audience_group_id, upload_description) + + def create_audience_for_uploading_user_ids(self, file: Annotated[Union[StrictBytes, StrictStr], Field(..., description='A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 ')], description: Annotated[Optional[constr(strict=True, max_length=120)], Field(description="The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 ")] = None, is_ifa_audience: Annotated[Optional[StrictBool], Field(description='To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. ')] = None, upload_description: Annotated[Optional[StrictStr], Field(description='The description to register for the job (in `jobs[].description`). ')] = None) -> CreateAudienceGroupResponse: + """Create audience for uploading user IDs (by file). + + :param file: A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 (required) + :type file: bytearray + :param description: The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 + :type description: str + :param is_ifa_audience: To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. + :type is_ifa_audience: bool + :param upload_description: The description to register for the job (in `jobs[].description`). + :type upload_description: str + :return: Returns the result object. + :rtype: CreateAudienceGroupResponse + """ + return self._manage_audience_blob.create_audience_for_uploading_user_ids(file, description, is_ifa_audience, upload_description) + + def create_audience_for_uploading_user_ids_with_http_info(self, file: Annotated[Union[StrictBytes, StrictStr], Field(..., description='A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 ')], description: Annotated[Optional[constr(strict=True, max_length=120)], Field(description="The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 ")] = None, is_ifa_audience: Annotated[Optional[StrictBool], Field(description='To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. ')] = None, upload_description: Annotated[Optional[StrictStr], Field(description='The description to register for the job (in `jobs[].description`). ')] = None) -> AudienceApiResponse: + """Create audience for uploading user IDs (by file). + + :param file: A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 (required) + :type file: bytearray + :param description: The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 + :type description: str + :param is_ifa_audience: To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. + :type is_ifa_audience: bool + :param upload_description: The description to register for the job (in `jobs[].description`). + :type upload_description: str + :return: Returns the result object. + :rtype: tuple(CreateAudienceGroupResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._manage_audience_blob.create_audience_for_uploading_user_ids_with_http_info(file, description, is_ifa_audience, upload_description) + + def get_friends_demographics(self) -> GetFriendsDemographicsResponse: + """Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID). + + :return: Returns the result object. + :rtype: GetFriendsDemographicsResponse + """ + return self._insight.get_friends_demographics() + + def get_friends_demographics_with_http_info(self) -> InsightApiResponse: + """Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID). + + :return: Returns the result object. + :rtype: tuple(GetFriendsDemographicsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._insight.get_friends_demographics_with_http_info() + + def get_message_event(self, request_id: Annotated[constr(strict=True, min_length=1), Field(..., description='Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. ')]) -> GetMessageEventResponse: + """Get user interaction statistics + + Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. + + :param request_id: Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: GetMessageEventResponse + """ + return self._insight.get_message_event(request_id) + + def get_message_event_with_http_info(self, request_id: Annotated[constr(strict=True, min_length=1), Field(..., description='Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. ')]) -> InsightApiResponse: + """Get user interaction statistics + + Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. + + :param request_id: Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: tuple(GetMessageEventResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._insight.get_message_event_with_http_info(request_id) + + def get_number_of_followers(self, var_date: Annotated[Optional[constr(strict=True, max_length=8, min_length=8)], Field(description='Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 ')] = None) -> GetNumberOfFollowersResponse: + """Get number of followers + + Returns the number of users who have added the LINE Official Account on or before a specified date. + + :param var_date: Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 + :type var_date: str + :return: Returns the result object. + :rtype: GetNumberOfFollowersResponse + """ + return self._insight.get_number_of_followers(var_date) + + def get_number_of_followers_with_http_info(self, var_date: Annotated[Optional[constr(strict=True, max_length=8, min_length=8)], Field(description='Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 ')] = None) -> InsightApiResponse: + """Get number of followers + + Returns the number of users who have added the LINE Official Account on or before a specified date. + + :param var_date: Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 + :type var_date: str + :return: Returns the result object. + :rtype: tuple(GetNumberOfFollowersResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._insight.get_number_of_followers_with_http_info(var_date) + + def get_number_of_message_deliveries(self, var_date: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 ')]) -> GetNumberOfMessageDeliveriesResponse: + """Get number of message deliveries + + Returns the number of messages sent from LINE Official Account on a specified day. + + :param var_date: Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: GetNumberOfMessageDeliveriesResponse + """ + return self._insight.get_number_of_message_deliveries(var_date) + + def get_number_of_message_deliveries_with_http_info(self, var_date: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 ')]) -> InsightApiResponse: + """Get number of message deliveries + + Returns the number of messages sent from LINE Official Account on a specified day. + + :param var_date: Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(GetNumberOfMessageDeliveriesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._insight.get_number_of_message_deliveries_with_http_info(var_date) + + def get_statistics_per_unit(self, custom_aggregation_unit: Annotated[constr(strict=True, max_length=30, min_length=1), Field(..., description='Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. ')], var_from: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ')], to: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ')]) -> GetStatisticsPerUnitResponse: + """You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account. + + :param custom_aggregation_unit: Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. (required) + :type custom_aggregation_unit: str + :param var_from: Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 (required) + :type to: str + :return: Returns the result object. + :rtype: GetStatisticsPerUnitResponse + """ + return self._insight.get_statistics_per_unit(custom_aggregation_unit, var_from, to) + + def get_statistics_per_unit_with_http_info(self, custom_aggregation_unit: Annotated[constr(strict=True, max_length=30, min_length=1), Field(..., description='Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. ')], var_from: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ')], to: Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description='End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ')]) -> InsightApiResponse: + """You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account. + + :param custom_aggregation_unit: Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. (required) + :type custom_aggregation_unit: str + :param var_from: Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 (required) + :type to: str + :return: Returns the result object. + :rtype: tuple(GetStatisticsPerUnitResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._insight.get_statistics_per_unit_with_http_info(custom_aggregation_unit, var_from, to) + + def add_liff_app(self, add_liff_app_request: AddLiffAppRequest) -> AddLiffAppResponse: + """Create LIFF app + + Adding the LIFF app to a channel + + :param add_liff_app_request: (required) + :type add_liff_app_request: AddLiffAppRequest + :return: Returns the result object. + :rtype: AddLiffAppResponse + """ + return self._liff.add_liff_app(add_liff_app_request) + + def add_liff_app_with_http_info(self, add_liff_app_request: AddLiffAppRequest) -> LiffApiResponse: + """Create LIFF app + + Adding the LIFF app to a channel + + :param add_liff_app_request: (required) + :type add_liff_app_request: AddLiffAppRequest + :return: Returns the result object. + :rtype: tuple(AddLiffAppResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._liff.add_liff_app_with_http_info(add_liff_app_request) + + def delete_liff_app(self, liff_id: Annotated[StrictStr, Field(..., description='ID of the LIFF app to be updated')]) -> None: + """Delete LIFF app from a channel + + Deletes a LIFF app from a channel. + + :param liff_id: ID of the LIFF app to be updated (required) + :type liff_id: str + :return: Returns the result object. + :rtype: None + """ + return self._liff.delete_liff_app(liff_id) + + def delete_liff_app_with_http_info(self, liff_id: Annotated[StrictStr, Field(..., description='ID of the LIFF app to be updated')]) -> LiffApiResponse: + """Delete LIFF app from a channel + + Deletes a LIFF app from a channel. + + :param liff_id: ID of the LIFF app to be updated (required) + :type liff_id: str + :return: Returns the result object. + :rtype: None + """ + return self._liff.delete_liff_app_with_http_info(liff_id) + + def get_all_liff_apps(self) -> GetAllLiffAppsResponse: + """Get all LIFF apps + + Gets information on all the LIFF apps added to the channel. + + :return: Returns the result object. + :rtype: GetAllLiffAppsResponse + """ + return self._liff.get_all_liff_apps() + + def get_all_liff_apps_with_http_info(self) -> LiffApiResponse: + """Get all LIFF apps + + Gets information on all the LIFF apps added to the channel. + + :return: Returns the result object. + :rtype: tuple(GetAllLiffAppsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._liff.get_all_liff_apps_with_http_info() + + def update_liff_app(self, liff_id: Annotated[StrictStr, Field(..., description='ID of the LIFF app to be updated')], update_liff_app_request: UpdateLiffAppRequest) -> None: + """Update LIFF app from a channel + + Update LIFF app settings + + :param liff_id: ID of the LIFF app to be updated (required) + :type liff_id: str + :param update_liff_app_request: (required) + :type update_liff_app_request: UpdateLiffAppRequest + :return: Returns the result object. + :rtype: None + """ + return self._liff.update_liff_app(liff_id, update_liff_app_request) + + def update_liff_app_with_http_info(self, liff_id: Annotated[StrictStr, Field(..., description='ID of the LIFF app to be updated')], update_liff_app_request: UpdateLiffAppRequest) -> LiffApiResponse: + """Update LIFF app from a channel + + Update LIFF app settings + + :param liff_id: ID of the LIFF app to be updated (required) + :type liff_id: str + :param update_liff_app_request: (required) + :type update_liff_app_request: UpdateLiffAppRequest + :return: Returns the result object. + :rtype: None + """ + return self._liff.update_liff_app_with_http_info(liff_id, update_liff_app_request) + + def broadcast(self, broadcast_request: BroadcastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> object: + """Sends a message to multiple users at any time. + + :param broadcast_request: (required) + :type broadcast_request: BroadcastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: object + """ + return self._messaging_api.broadcast(broadcast_request, x_line_retry_key) + + def broadcast_with_http_info(self, broadcast_request: BroadcastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> MessagingApiResponse: + """Sends a message to multiple users at any time. + + :param broadcast_request: (required) + :type broadcast_request: BroadcastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.broadcast_with_http_info(broadcast_request, x_line_retry_key) + + def cancel_default_rich_menu(self) -> None: + """Cancel default rich menu + + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.cancel_default_rich_menu() + + def cancel_default_rich_menu_with_http_info(self) -> MessagingApiResponse: + """Cancel default rich menu + + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.cancel_default_rich_menu_with_http_info() + + def close_coupon(self, coupon_id: StrictStr) -> None: + """Close coupon + + :param coupon_id: (required) + :type coupon_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.close_coupon(coupon_id) + + def close_coupon_with_http_info(self, coupon_id: StrictStr) -> MessagingApiResponse: + """Close coupon + + :param coupon_id: (required) + :type coupon_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.close_coupon_with_http_info(coupon_id) + + def create_coupon(self, coupon_create_request: Optional[CouponCreateRequest] = None) -> CouponCreateResponse: + """Create a new coupon. Define coupon details such as type, title, and validity period. + + :param coupon_create_request: + :type coupon_create_request: CouponCreateRequest + :return: Returns the result object. + :rtype: CouponCreateResponse + """ + return self._messaging_api.create_coupon(coupon_create_request) + + def create_coupon_with_http_info(self, coupon_create_request: Optional[CouponCreateRequest] = None) -> MessagingApiResponse: + """Create a new coupon. Define coupon details such as type, title, and validity period. + + :param coupon_create_request: + :type coupon_create_request: CouponCreateRequest + :return: Returns the result object. + :rtype: tuple(CouponCreateResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.create_coupon_with_http_info(coupon_create_request) + + def create_rich_menu(self, rich_menu_request: RichMenuRequest) -> RichMenuIdResponse: + """Create rich menu + + :param rich_menu_request: (required) + :type rich_menu_request: RichMenuRequest + :return: Returns the result object. + :rtype: RichMenuIdResponse + """ + return self._messaging_api.create_rich_menu(rich_menu_request) + + def create_rich_menu_with_http_info(self, rich_menu_request: RichMenuRequest) -> MessagingApiResponse: + """Create rich menu + + :param rich_menu_request: (required) + :type rich_menu_request: RichMenuRequest + :return: Returns the result object. + :rtype: tuple(RichMenuIdResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.create_rich_menu_with_http_info(rich_menu_request) + + def create_rich_menu_alias(self, create_rich_menu_alias_request: CreateRichMenuAliasRequest) -> None: + """Create rich menu alias + + :param create_rich_menu_alias_request: (required) + :type create_rich_menu_alias_request: CreateRichMenuAliasRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.create_rich_menu_alias(create_rich_menu_alias_request) + + def create_rich_menu_alias_with_http_info(self, create_rich_menu_alias_request: CreateRichMenuAliasRequest) -> MessagingApiResponse: + """Create rich menu alias + + :param create_rich_menu_alias_request: (required) + :type create_rich_menu_alias_request: CreateRichMenuAliasRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.create_rich_menu_alias_with_http_info(create_rich_menu_alias_request) + + def delete_rich_menu(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> None: + """Deletes a rich menu. + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.delete_rich_menu(rich_menu_id) + + def delete_rich_menu_with_http_info(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> MessagingApiResponse: + """Deletes a rich menu. + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.delete_rich_menu_with_http_info(rich_menu_id) + + def delete_rich_menu_alias(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='Rich menu alias ID that you want to delete.')]) -> None: + """Delete rich menu alias + + :param rich_menu_alias_id: Rich menu alias ID that you want to delete. (required) + :type rich_menu_alias_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.delete_rich_menu_alias(rich_menu_alias_id) + + def delete_rich_menu_alias_with_http_info(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='Rich menu alias ID that you want to delete.')]) -> MessagingApiResponse: + """Delete rich menu alias + + :param rich_menu_alias_id: Rich menu alias ID that you want to delete. (required) + :type rich_menu_alias_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.delete_rich_menu_alias_with_http_info(rich_menu_alias_id) + + def get_aggregation_unit_name_list(self, limit: Annotated[Optional[StrictStr], Field(description='The maximum number of aggregation units you can get per request. ')] = None, start: Annotated[Optional[StrictStr], Field(description="Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. ")] = None) -> GetAggregationUnitNameListResponse: + """Get name list of units used this month + + :param limit: The maximum number of aggregation units you can get per request. + :type limit: str + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. + :type start: str + :return: Returns the result object. + :rtype: GetAggregationUnitNameListResponse + """ + return self._messaging_api.get_aggregation_unit_name_list(limit, start) + + def get_aggregation_unit_name_list_with_http_info(self, limit: Annotated[Optional[StrictStr], Field(description='The maximum number of aggregation units you can get per request. ')] = None, start: Annotated[Optional[StrictStr], Field(description="Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. ")] = None) -> MessagingApiResponse: + """Get name list of units used this month + + :param limit: The maximum number of aggregation units you can get per request. + :type limit: str + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. + :type start: str + :return: Returns the result object. + :rtype: tuple(GetAggregationUnitNameListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_aggregation_unit_name_list_with_http_info(limit, start) + + def get_aggregation_unit_usage(self) -> GetAggregationUnitUsageResponse: + """Get number of units used this month + + :return: Returns the result object. + :rtype: GetAggregationUnitUsageResponse + """ + return self._messaging_api.get_aggregation_unit_usage() + + def get_aggregation_unit_usage_with_http_info(self) -> MessagingApiResponse: + """Get number of units used this month + + :return: Returns the result object. + :rtype: tuple(GetAggregationUnitUsageResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_aggregation_unit_usage_with_http_info() + + def get_bot_info(self) -> BotInfoResponse: + """Get bot info + + :return: Returns the result object. + :rtype: BotInfoResponse + """ + return self._messaging_api.get_bot_info() + + def get_bot_info_with_http_info(self) -> MessagingApiResponse: + """Get bot info + + :return: Returns the result object. + :rtype: tuple(BotInfoResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_bot_info_with_http_info() + + def get_coupon_detail(self, coupon_id: StrictStr) -> CouponResponse: + """Get coupon detail + + :param coupon_id: (required) + :type coupon_id: str + :return: Returns the result object. + :rtype: CouponResponse + """ + return self._messaging_api.get_coupon_detail(coupon_id) + + def get_coupon_detail_with_http_info(self, coupon_id: StrictStr) -> MessagingApiResponse: + """Get coupon detail + + :param coupon_id: (required) + :type coupon_id: str + :return: Returns the result object. + :rtype: tuple(CouponResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_coupon_detail_with_http_info(coupon_id) + + def get_default_rich_menu_id(self) -> RichMenuIdResponse: + """Gets the ID of the default rich menu set with the Messaging API. + + :return: Returns the result object. + :rtype: RichMenuIdResponse + """ + return self._messaging_api.get_default_rich_menu_id() + + def get_default_rich_menu_id_with_http_info(self) -> MessagingApiResponse: + """Gets the ID of the default rich menu set with the Messaging API. + + :return: Returns the result object. + :rtype: tuple(RichMenuIdResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_default_rich_menu_id_with_http_info() + + def get_followers(self, start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. ')] = None, limit: Annotated[Optional[conint(strict=True, le=1000)], Field(description='The maximum number of user IDs to retrieve in a single request.')] = None) -> GetFollowersResponse: + """Get a list of users who added your LINE Official Account as a friend + + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. + :type start: str + :param limit: The maximum number of user IDs to retrieve in a single request. + :type limit: int + :return: Returns the result object. + :rtype: GetFollowersResponse + """ + return self._messaging_api.get_followers(start, limit) + + def get_followers_with_http_info(self, start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. ')] = None, limit: Annotated[Optional[conint(strict=True, le=1000)], Field(description='The maximum number of user IDs to retrieve in a single request.')] = None) -> MessagingApiResponse: + """Get a list of users who added your LINE Official Account as a friend + + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. + :type start: str + :param limit: The maximum number of user IDs to retrieve in a single request. + :type limit: int + :return: Returns the result object. + :rtype: tuple(GetFollowersResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_followers_with_http_info(start, limit) + + def get_group_member_count(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> GroupMemberCountResponse: + """Get number of users in a group chat + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: GroupMemberCountResponse + """ + return self._messaging_api.get_group_member_count(group_id) + + def get_group_member_count_with_http_info(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> MessagingApiResponse: + """Get number of users in a group chat + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: tuple(GroupMemberCountResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_group_member_count_with_http_info(group_id) + + def get_group_member_profile(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')], user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> GroupUserProfileResponse: + """Get group chat member profile + + :param group_id: Group ID (required) + :type group_id: str + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: GroupUserProfileResponse + """ + return self._messaging_api.get_group_member_profile(group_id, user_id) + + def get_group_member_profile_with_http_info(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')], user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> MessagingApiResponse: + """Get group chat member profile + + :param group_id: Group ID (required) + :type group_id: str + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(GroupUserProfileResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_group_member_profile_with_http_info(group_id, user_id) + + def get_group_members_ids(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')], start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. ')] = None) -> MembersIdsResponse: + """Get group chat member user IDs + + :param group_id: Group ID (required) + :type group_id: str + :param start: Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + :type start: str + :return: Returns the result object. + :rtype: MembersIdsResponse + """ + return self._messaging_api.get_group_members_ids(group_id, start) + + def get_group_members_ids_with_http_info(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')], start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. ')] = None) -> MessagingApiResponse: + """Get group chat member user IDs + + :param group_id: Group ID (required) + :type group_id: str + :param start: Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + :type start: str + :return: Returns the result object. + :rtype: tuple(MembersIdsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_group_members_ids_with_http_info(group_id, start) + + def get_group_summary(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> GroupSummaryResponse: + """Get group chat summary + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: GroupSummaryResponse + """ + return self._messaging_api.get_group_summary(group_id) + + def get_group_summary_with_http_info(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> MessagingApiResponse: + """Get group chat summary + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: tuple(GroupSummaryResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_group_summary_with_http_info(group_id) + + 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) -> GetJoinedMembershipUsersResponse: + """Get a list of user IDs who joined the membership. + + :param membership_id: Membership plan ID. (required) + :type membership_id: int + :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). + :type start: str + :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. + :type limit: int + :return: Returns the result object. + :rtype: GetJoinedMembershipUsersResponse + """ + return self._messaging_api.get_joined_membership_users(membership_id, start, limit) + + 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) -> MessagingApiResponse: + """Get a list of user IDs who joined the membership. + + :param membership_id: Membership plan ID. (required) + :type membership_id: int + :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). + :type start: str + :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. + :type limit: int + :return: Returns the result object. + :rtype: tuple(GetJoinedMembershipUsersResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_joined_membership_users_with_http_info(membership_id, start, limit) + + def get_membership_list(self) -> MembershipListResponse: + """Get a list of memberships. + + :return: Returns the result object. + :rtype: MembershipListResponse + """ + return self._messaging_api.get_membership_list() + + def get_membership_list_with_http_info(self) -> MessagingApiResponse: + """Get a list of memberships. + + :return: Returns the result object. + :rtype: tuple(MembershipListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_membership_list_with_http_info() + + def get_membership_subscription(self, user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> GetMembershipSubscriptionResponse: + """Get a user's membership subscription. + + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: GetMembershipSubscriptionResponse + """ + return self._messaging_api.get_membership_subscription(user_id) + + def get_membership_subscription_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> MessagingApiResponse: + """Get a user's membership subscription. + + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(GetMembershipSubscriptionResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_membership_subscription_with_http_info(user_id) + + def get_message_quota(self) -> MessageQuotaResponse: + """Gets the target limit for sending messages in the current month. The total number of the free messages and the additional messages is returned. + + :return: Returns the result object. + :rtype: MessageQuotaResponse + """ + return self._messaging_api.get_message_quota() + + def get_message_quota_with_http_info(self) -> MessagingApiResponse: + """Gets the target limit for sending messages in the current month. The total number of the free messages and the additional messages is returned. + + :return: Returns the result object. + :rtype: tuple(MessageQuotaResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_message_quota_with_http_info() + + def get_message_quota_consumption(self) -> QuotaConsumptionResponse: + """Gets the number of messages sent in the current month. + + :return: Returns the result object. + :rtype: QuotaConsumptionResponse + """ + return self._messaging_api.get_message_quota_consumption() + + def get_message_quota_consumption_with_http_info(self) -> MessagingApiResponse: + """Gets the number of messages sent in the current month. + + :return: Returns the result object. + :rtype: tuple(QuotaConsumptionResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_message_quota_consumption_with_http_info() + + def get_narrowcast_progress(self, request_id: Annotated[StrictStr, Field(..., description="The narrowcast message's request ID. Each Messaging API request has a request ID.")]) -> NarrowcastProgressResponse: + """Gets the status of a narrowcast message. + + :param request_id: The narrowcast message's request ID. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: NarrowcastProgressResponse + """ + return self._messaging_api.get_narrowcast_progress(request_id) + + def get_narrowcast_progress_with_http_info(self, request_id: Annotated[StrictStr, Field(..., description="The narrowcast message's request ID. Each Messaging API request has a request ID.")]) -> MessagingApiResponse: + """Gets the status of a narrowcast message. + + :param request_id: The narrowcast message's request ID. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: tuple(NarrowcastProgressResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_narrowcast_progress_with_http_info(request_id) + + def get_number_of_sent_broadcast_messages(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 ')]) -> NumberOfMessagesResponse: + """Get number of sent broadcast messages + + :param var_date: Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: NumberOfMessagesResponse + """ + return self._messaging_api.get_number_of_sent_broadcast_messages(var_date) + + def get_number_of_sent_broadcast_messages_with_http_info(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 ')]) -> MessagingApiResponse: + """Get number of sent broadcast messages + + :param var_date: Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(NumberOfMessagesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_number_of_sent_broadcast_messages_with_http_info(var_date) + + def get_number_of_sent_multicast_messages(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> NumberOfMessagesResponse: + """Get number of sent multicast messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: NumberOfMessagesResponse + """ + return self._messaging_api.get_number_of_sent_multicast_messages(var_date) + + def get_number_of_sent_multicast_messages_with_http_info(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> MessagingApiResponse: + """Get number of sent multicast messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(NumberOfMessagesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_number_of_sent_multicast_messages_with_http_info(var_date) + + def get_number_of_sent_push_messages(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> NumberOfMessagesResponse: + """Get number of sent push messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: NumberOfMessagesResponse + """ + return self._messaging_api.get_number_of_sent_push_messages(var_date) + + def get_number_of_sent_push_messages_with_http_info(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> MessagingApiResponse: + """Get number of sent push messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(NumberOfMessagesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_number_of_sent_push_messages_with_http_info(var_date) + + def get_number_of_sent_reply_messages(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> NumberOfMessagesResponse: + """Get number of sent reply messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: NumberOfMessagesResponse + """ + return self._messaging_api.get_number_of_sent_reply_messages(var_date) + + def get_number_of_sent_reply_messages_with_http_info(self, var_date: Annotated[StrictStr, Field(..., description='Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 ')]) -> MessagingApiResponse: + """Get number of sent reply messages + + :param var_date: Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(NumberOfMessagesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_number_of_sent_reply_messages_with_http_info(var_date) + + def get_pnp_message_statistics(self, var_date: Annotated[constr(strict=True), Field(..., description='Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 ')]) -> NumberOfMessagesResponse: + """Get number of sent LINE notification messages + + :param var_date: Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: NumberOfMessagesResponse + """ + return self._messaging_api.get_pnp_message_statistics(var_date) + + def get_pnp_message_statistics_with_http_info(self, var_date: Annotated[constr(strict=True), Field(..., description='Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 ')]) -> MessagingApiResponse: + """Get number of sent LINE notification messages + + :param var_date: Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 (required) + :type var_date: str + :return: Returns the result object. + :rtype: tuple(NumberOfMessagesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_pnp_message_statistics_with_http_info(var_date) + + def get_profile(self, user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> UserProfileResponse: + """Get profile + + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: UserProfileResponse + """ + return self._messaging_api.get_profile(user_id) + + def get_profile_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> MessagingApiResponse: + """Get profile + + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(UserProfileResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_profile_with_http_info(user_id) + + def get_rich_menu(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> RichMenuResponse: + """Gets a rich menu via a rich menu ID. + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: RichMenuResponse + """ + return self._messaging_api.get_rich_menu(rich_menu_id) + + def get_rich_menu_with_http_info(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> MessagingApiResponse: + """Gets a rich menu via a rich menu ID. + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: tuple(RichMenuResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_rich_menu_with_http_info(rich_menu_id) + + def get_rich_menu_alias(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='The rich menu alias ID whose information you want to obtain.')]) -> RichMenuAliasResponse: + """Get rich menu alias information + + :param rich_menu_alias_id: The rich menu alias ID whose information you want to obtain. (required) + :type rich_menu_alias_id: str + :return: Returns the result object. + :rtype: RichMenuAliasResponse + """ + return self._messaging_api.get_rich_menu_alias(rich_menu_alias_id) + + def get_rich_menu_alias_with_http_info(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='The rich menu alias ID whose information you want to obtain.')]) -> MessagingApiResponse: + """Get rich menu alias information + + :param rich_menu_alias_id: The rich menu alias ID whose information you want to obtain. (required) + :type rich_menu_alias_id: str + :return: Returns the result object. + :rtype: tuple(RichMenuAliasResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_rich_menu_alias_with_http_info(rich_menu_alias_id) + + def get_rich_menu_alias_list(self) -> RichMenuAliasListResponse: + """Get list of rich menu alias + + :return: Returns the result object. + :rtype: RichMenuAliasListResponse + """ + return self._messaging_api.get_rich_menu_alias_list() + + def get_rich_menu_alias_list_with_http_info(self) -> MessagingApiResponse: + """Get list of rich menu alias + + :return: Returns the result object. + :rtype: tuple(RichMenuAliasListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_rich_menu_alias_list_with_http_info() + + def get_rich_menu_batch_progress(self, request_id: Annotated[StrictStr, Field(..., description='A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID.')]) -> RichMenuBatchProgressResponse: + """Get the status of Replace or unlink a linked rich menus in batches. + + :param request_id: A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: RichMenuBatchProgressResponse + """ + return self._messaging_api.get_rich_menu_batch_progress(request_id) + + def get_rich_menu_batch_progress_with_http_info(self, request_id: Annotated[StrictStr, Field(..., description='A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID.')]) -> MessagingApiResponse: + """Get the status of Replace or unlink a linked rich menus in batches. + + :param request_id: A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID. (required) + :type request_id: str + :return: Returns the result object. + :rtype: tuple(RichMenuBatchProgressResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_rich_menu_batch_progress_with_http_info(request_id) + + def get_rich_menu_id_of_user(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')]) -> RichMenuIdResponse: + """Get rich menu ID of user + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: RichMenuIdResponse + """ + return self._messaging_api.get_rich_menu_id_of_user(user_id) + + def get_rich_menu_id_of_user_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')]) -> MessagingApiResponse: + """Get rich menu ID of user + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(RichMenuIdResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_rich_menu_id_of_user_with_http_info(user_id) + + def get_rich_menu_list(self) -> RichMenuListResponse: + """Get rich menu list + + :return: Returns the result object. + :rtype: RichMenuListResponse + """ + return self._messaging_api.get_rich_menu_list() + + def get_rich_menu_list_with_http_info(self) -> MessagingApiResponse: + """Get rich menu list + + :return: Returns the result object. + :rtype: tuple(RichMenuListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_rich_menu_list_with_http_info() + + def get_room_member_count(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')]) -> RoomMemberCountResponse: + """Get number of users in a multi-person chat + + :param room_id: Room ID (required) + :type room_id: str + :return: Returns the result object. + :rtype: RoomMemberCountResponse + """ + return self._messaging_api.get_room_member_count(room_id) + + def get_room_member_count_with_http_info(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')]) -> MessagingApiResponse: + """Get number of users in a multi-person chat + + :param room_id: Room ID (required) + :type room_id: str + :return: Returns the result object. + :rtype: tuple(RoomMemberCountResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_room_member_count_with_http_info(room_id) + + def get_room_member_profile(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')], user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> RoomUserProfileResponse: + """Get multi-person chat member profile + + :param room_id: Room ID (required) + :type room_id: str + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: RoomUserProfileResponse + """ + return self._messaging_api.get_room_member_profile(room_id, user_id) + + def get_room_member_profile_with_http_info(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')], user_id: Annotated[StrictStr, Field(..., description='User ID')]) -> MessagingApiResponse: + """Get multi-person chat member profile + + :param room_id: Room ID (required) + :type room_id: str + :param user_id: User ID (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(RoomUserProfileResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_room_member_profile_with_http_info(room_id, user_id) + + def get_room_members_ids(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')], start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. ')] = None) -> MembersIdsResponse: + """Get multi-person chat member user IDs + + :param room_id: Room ID (required) + :type room_id: str + :param start: Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + :type start: str + :return: Returns the result object. + :rtype: MembersIdsResponse + """ + return self._messaging_api.get_room_members_ids(room_id, start) + + def get_room_members_ids_with_http_info(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')], start: Annotated[Optional[StrictStr], Field(description='Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. ')] = None) -> MessagingApiResponse: + """Get multi-person chat member user IDs + + :param room_id: Room ID (required) + :type room_id: str + :param start: Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + :type start: str + :return: Returns the result object. + :rtype: tuple(MembersIdsResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_room_members_ids_with_http_info(room_id, start) + + def get_webhook_endpoint(self) -> GetWebhookEndpointResponse: + """Get webhook endpoint information + + :return: Returns the result object. + :rtype: GetWebhookEndpointResponse + """ + return self._messaging_api.get_webhook_endpoint() + + def get_webhook_endpoint_with_http_info(self) -> MessagingApiResponse: + """Get webhook endpoint information + + :return: Returns the result object. + :rtype: tuple(GetWebhookEndpointResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.get_webhook_endpoint_with_http_info() + + def issue_link_token(self, user_id: Annotated[StrictStr, Field(..., description='User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. ')]) -> IssueLinkTokenResponse: + """Issue link token + + :param user_id: User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: IssueLinkTokenResponse + """ + return self._messaging_api.issue_link_token(user_id) + + def issue_link_token_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. ')]) -> MessagingApiResponse: + """Issue link token + + :param user_id: User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: tuple(IssueLinkTokenResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.issue_link_token_with_http_info(user_id) + + def leave_group(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> None: + """Leave group chat + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.leave_group(group_id) + + def leave_group_with_http_info(self, group_id: Annotated[StrictStr, Field(..., description='Group ID')]) -> MessagingApiResponse: + """Leave group chat + + :param group_id: Group ID (required) + :type group_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.leave_group_with_http_info(group_id) + + def leave_room(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')]) -> None: + """Leave multi-person chat + + :param room_id: Room ID (required) + :type room_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.leave_room(room_id) + + def leave_room_with_http_info(self, room_id: Annotated[StrictStr, Field(..., description='Room ID')]) -> MessagingApiResponse: + """Leave multi-person chat + + :param room_id: Room ID (required) + :type room_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.leave_room_with_http_info(room_id) + + def link_rich_menu_id_to_user(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')], rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> None: + """Link rich menu to user. + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.link_rich_menu_id_to_user(user_id, rich_menu_id) + + def link_rich_menu_id_to_user_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')], rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> MessagingApiResponse: + """Link rich menu to user. + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.link_rich_menu_id_to_user_with_http_info(user_id, rich_menu_id) + + def link_rich_menu_id_to_users(self, rich_menu_bulk_link_request: RichMenuBulkLinkRequest) -> None: + """Link rich menu to multiple users + + :param rich_menu_bulk_link_request: (required) + :type rich_menu_bulk_link_request: RichMenuBulkLinkRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.link_rich_menu_id_to_users(rich_menu_bulk_link_request) + + def link_rich_menu_id_to_users_with_http_info(self, rich_menu_bulk_link_request: RichMenuBulkLinkRequest) -> MessagingApiResponse: + """Link rich menu to multiple users + + :param rich_menu_bulk_link_request: (required) + :type rich_menu_bulk_link_request: RichMenuBulkLinkRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.link_rich_menu_id_to_users_with_http_info(rich_menu_bulk_link_request) + + def list_coupon(self, status: Annotated[Optional[conlist(StrictStr, unique_items=True)], Field(description='Filter coupons by their status.')] = None, start: Annotated[Optional[StrictStr], Field(description='Pagination token to retrieve the next page of results.')] = None, limit: Annotated[Optional[conint(strict=True, le=100, ge=1)], Field(description='Maximum number of coupons to return per request.')] = None) -> MessagingApiPagerCouponListResponse: + """Get a paginated list of coupons. + + :param status: Filter coupons by their status. + :type status: List[str] + :param start: Pagination token to retrieve the next page of results. + :type start: str + :param limit: Maximum number of coupons to return per request. + :type limit: int + :return: Returns the result object. + :rtype: MessagingApiPagerCouponListResponse + """ + return self._messaging_api.list_coupon(status, start, limit) + + def list_coupon_with_http_info(self, status: Annotated[Optional[conlist(StrictStr, unique_items=True)], Field(description='Filter coupons by their status.')] = None, start: Annotated[Optional[StrictStr], Field(description='Pagination token to retrieve the next page of results.')] = None, limit: Annotated[Optional[conint(strict=True, le=100, ge=1)], Field(description='Maximum number of coupons to return per request.')] = None) -> MessagingApiResponse: + """Get a paginated list of coupons. + + :param status: Filter coupons by their status. + :type status: List[str] + :param start: Pagination token to retrieve the next page of results. + :type start: str + :param limit: Maximum number of coupons to return per request. + :type limit: int + :return: Returns the result object. + :rtype: tuple(MessagingApiPagerCouponListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.list_coupon_with_http_info(status, start, limit) + + def mark_messages_as_read(self, mark_messages_as_read_request: MarkMessagesAsReadRequest) -> None: + """Mark messages from users as read + + :param mark_messages_as_read_request: (required) + :type mark_messages_as_read_request: MarkMessagesAsReadRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.mark_messages_as_read(mark_messages_as_read_request) + + def mark_messages_as_read_with_http_info(self, mark_messages_as_read_request: MarkMessagesAsReadRequest) -> MessagingApiResponse: + """Mark messages from users as read + + :param mark_messages_as_read_request: (required) + :type mark_messages_as_read_request: MarkMessagesAsReadRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.mark_messages_as_read_with_http_info(mark_messages_as_read_request) + + def mark_messages_as_read_by_token(self, mark_messages_as_read_by_token_request: MarkMessagesAsReadByTokenRequest) -> None: + """Mark messages from users as read by token + + :param mark_messages_as_read_by_token_request: (required) + :type mark_messages_as_read_by_token_request: MarkMessagesAsReadByTokenRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.mark_messages_as_read_by_token(mark_messages_as_read_by_token_request) + + def mark_messages_as_read_by_token_with_http_info(self, mark_messages_as_read_by_token_request: MarkMessagesAsReadByTokenRequest) -> MessagingApiResponse: + """Mark messages from users as read by token + + :param mark_messages_as_read_by_token_request: (required) + :type mark_messages_as_read_by_token_request: MarkMessagesAsReadByTokenRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.mark_messages_as_read_by_token_with_http_info(mark_messages_as_read_by_token_request) + + def multicast(self, multicast_request: MulticastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> object: + """An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats. + + :param multicast_request: (required) + :type multicast_request: MulticastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: object + """ + return self._messaging_api.multicast(multicast_request, x_line_retry_key) + + def multicast_with_http_info(self, multicast_request: MulticastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> MessagingApiResponse: + """An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats. + + :param multicast_request: (required) + :type multicast_request: MulticastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.multicast_with_http_info(multicast_request, x_line_retry_key) + + def narrowcast(self, narrowcast_request: NarrowcastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> object: + """Send narrowcast message + + :param narrowcast_request: (required) + :type narrowcast_request: NarrowcastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: object + """ + return self._messaging_api.narrowcast(narrowcast_request, x_line_retry_key) + + def narrowcast_with_http_info(self, narrowcast_request: NarrowcastRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> MessagingApiResponse: + """Send narrowcast message + + :param narrowcast_request: (required) + :type narrowcast_request: NarrowcastRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.narrowcast_with_http_info(narrowcast_request, x_line_retry_key) + + def push_message(self, push_message_request: PushMessageRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> PushMessageResponse: + """Sends a message to a user, group chat, or multi-person chat at any time. + + :param push_message_request: (required) + :type push_message_request: PushMessageRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: PushMessageResponse + """ + return self._messaging_api.push_message(push_message_request, x_line_retry_key) + + def push_message_with_http_info(self, push_message_request: PushMessageRequest, x_line_retry_key: Annotated[Optional[StrictStr], Field(description="Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. ")] = None) -> MessagingApiResponse: + """Sends a message to a user, group chat, or multi-person chat at any time. + + :param push_message_request: (required) + :type push_message_request: PushMessageRequest + :param x_line_retry_key: Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + :type x_line_retry_key: str + :return: Returns the result object. + :rtype: tuple(PushMessageResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.push_message_with_http_info(push_message_request, x_line_retry_key) + + def push_messages_by_phone(self, pnp_messages_request: PnpMessagesRequest, x_line_delivery_tag: Annotated[Optional[constr(strict=True, max_length=100, min_length=16)], Field(description='String returned in the delivery.data property of the delivery completion event via Webhook.')] = None) -> None: + """Send LINE notification message + + :param pnp_messages_request: (required) + :type pnp_messages_request: PnpMessagesRequest + :param x_line_delivery_tag: String returned in the delivery.data property of the delivery completion event via Webhook. + :type x_line_delivery_tag: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.push_messages_by_phone(pnp_messages_request, x_line_delivery_tag) + + def push_messages_by_phone_with_http_info(self, pnp_messages_request: PnpMessagesRequest, x_line_delivery_tag: Annotated[Optional[constr(strict=True, max_length=100, min_length=16)], Field(description='String returned in the delivery.data property of the delivery completion event via Webhook.')] = None) -> MessagingApiResponse: + """Send LINE notification message + + :param pnp_messages_request: (required) + :type pnp_messages_request: PnpMessagesRequest + :param x_line_delivery_tag: String returned in the delivery.data property of the delivery completion event via Webhook. + :type x_line_delivery_tag: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.push_messages_by_phone_with_http_info(pnp_messages_request, x_line_delivery_tag) + + def reply_message(self, reply_message_request: ReplyMessageRequest) -> ReplyMessageResponse: + """Send reply message + + :param reply_message_request: (required) + :type reply_message_request: ReplyMessageRequest + :return: Returns the result object. + :rtype: ReplyMessageResponse + """ + return self._messaging_api.reply_message(reply_message_request) + + def reply_message_with_http_info(self, reply_message_request: ReplyMessageRequest) -> MessagingApiResponse: + """Send reply message + + :param reply_message_request: (required) + :type reply_message_request: ReplyMessageRequest + :return: Returns the result object. + :rtype: tuple(ReplyMessageResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.reply_message_with_http_info(reply_message_request) + + def rich_menu_batch(self, rich_menu_batch_request: RichMenuBatchRequest) -> None: + """You can use this endpoint to batch control the rich menu linked to the users using the endpoint such as Link rich menu to user. The following operations are available: 1. Replace a rich menu with another rich menu for all users linked to a specific rich menu 2. Unlink a rich menu for all users linked to a specific rich menu 3. Unlink a rich menu for all users linked the rich menu + + :param rich_menu_batch_request: (required) + :type rich_menu_batch_request: RichMenuBatchRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.rich_menu_batch(rich_menu_batch_request) + + def rich_menu_batch_with_http_info(self, rich_menu_batch_request: RichMenuBatchRequest) -> MessagingApiResponse: + """You can use this endpoint to batch control the rich menu linked to the users using the endpoint such as Link rich menu to user. The following operations are available: 1. Replace a rich menu with another rich menu for all users linked to a specific rich menu 2. Unlink a rich menu for all users linked to a specific rich menu 3. Unlink a rich menu for all users linked the rich menu + + :param rich_menu_batch_request: (required) + :type rich_menu_batch_request: RichMenuBatchRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.rich_menu_batch_with_http_info(rich_menu_batch_request) + + def set_default_rich_menu(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> None: + """Set default rich menu + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.set_default_rich_menu(rich_menu_id) + + def set_default_rich_menu_with_http_info(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of a rich menu')]) -> MessagingApiResponse: + """Set default rich menu + + :param rich_menu_id: ID of a rich menu (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.set_default_rich_menu_with_http_info(rich_menu_id) + + def set_webhook_endpoint(self, set_webhook_endpoint_request: SetWebhookEndpointRequest) -> None: + """Set webhook endpoint URL + + :param set_webhook_endpoint_request: (required) + :type set_webhook_endpoint_request: SetWebhookEndpointRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.set_webhook_endpoint(set_webhook_endpoint_request) + + def set_webhook_endpoint_with_http_info(self, set_webhook_endpoint_request: SetWebhookEndpointRequest) -> MessagingApiResponse: + """Set webhook endpoint URL + + :param set_webhook_endpoint_request: (required) + :type set_webhook_endpoint_request: SetWebhookEndpointRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.set_webhook_endpoint_with_http_info(set_webhook_endpoint_request) + + def show_loading_animation(self, show_loading_animation_request: ShowLoadingAnimationRequest) -> object: + """Display a loading animation in one-on-one chats between users and LINE Official Accounts. + + :param show_loading_animation_request: (required) + :type show_loading_animation_request: ShowLoadingAnimationRequest + :return: Returns the result object. + :rtype: object + """ + return self._messaging_api.show_loading_animation(show_loading_animation_request) + + def show_loading_animation_with_http_info(self, show_loading_animation_request: ShowLoadingAnimationRequest) -> MessagingApiResponse: + """Display a loading animation in one-on-one chats between users and LINE Official Accounts. + + :param show_loading_animation_request: (required) + :type show_loading_animation_request: ShowLoadingAnimationRequest + :return: Returns the result object. + :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.show_loading_animation_with_http_info(show_loading_animation_request) + + def test_webhook_endpoint(self, test_webhook_endpoint_request: Optional[TestWebhookEndpointRequest] = None) -> TestWebhookEndpointResponse: + """Test webhook endpoint + + :param test_webhook_endpoint_request: + :type test_webhook_endpoint_request: TestWebhookEndpointRequest + :return: Returns the result object. + :rtype: TestWebhookEndpointResponse + """ + return self._messaging_api.test_webhook_endpoint(test_webhook_endpoint_request) + + def test_webhook_endpoint_with_http_info(self, test_webhook_endpoint_request: Optional[TestWebhookEndpointRequest] = None) -> MessagingApiResponse: + """Test webhook endpoint + + :param test_webhook_endpoint_request: + :type test_webhook_endpoint_request: TestWebhookEndpointRequest + :return: Returns the result object. + :rtype: tuple(TestWebhookEndpointResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api.test_webhook_endpoint_with_http_info(test_webhook_endpoint_request) + + def unlink_rich_menu_id_from_user(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')]) -> None: + """Unlink rich menu from user + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.unlink_rich_menu_id_from_user(user_id) + + def unlink_rich_menu_id_from_user_with_http_info(self, user_id: Annotated[StrictStr, Field(..., description='User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.')]) -> MessagingApiResponse: + """Unlink rich menu from user + + :param user_id: User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. (required) + :type user_id: str + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.unlink_rich_menu_id_from_user_with_http_info(user_id) + + def unlink_rich_menu_id_from_users(self, rich_menu_bulk_unlink_request: RichMenuBulkUnlinkRequest) -> None: + """Unlink rich menus from multiple users + + :param rich_menu_bulk_unlink_request: (required) + :type rich_menu_bulk_unlink_request: RichMenuBulkUnlinkRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.unlink_rich_menu_id_from_users(rich_menu_bulk_unlink_request) + + def unlink_rich_menu_id_from_users_with_http_info(self, rich_menu_bulk_unlink_request: RichMenuBulkUnlinkRequest) -> MessagingApiResponse: + """Unlink rich menus from multiple users + + :param rich_menu_bulk_unlink_request: (required) + :type rich_menu_bulk_unlink_request: RichMenuBulkUnlinkRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.unlink_rich_menu_id_from_users_with_http_info(rich_menu_bulk_unlink_request) + + def update_rich_menu_alias(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='The rich menu alias ID you want to update.')], update_rich_menu_alias_request: UpdateRichMenuAliasRequest) -> None: + """Update rich menu alias + + :param rich_menu_alias_id: The rich menu alias ID you want to update. (required) + :type rich_menu_alias_id: str + :param update_rich_menu_alias_request: (required) + :type update_rich_menu_alias_request: UpdateRichMenuAliasRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.update_rich_menu_alias(rich_menu_alias_id, update_rich_menu_alias_request) + + def update_rich_menu_alias_with_http_info(self, rich_menu_alias_id: Annotated[StrictStr, Field(..., description='The rich menu alias ID you want to update.')], update_rich_menu_alias_request: UpdateRichMenuAliasRequest) -> MessagingApiResponse: + """Update rich menu alias + + :param rich_menu_alias_id: The rich menu alias ID you want to update. (required) + :type rich_menu_alias_id: str + :param update_rich_menu_alias_request: (required) + :type update_rich_menu_alias_request: UpdateRichMenuAliasRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.update_rich_menu_alias_with_http_info(rich_menu_alias_id, update_rich_menu_alias_request) + + def validate_broadcast(self, validate_message_request: ValidateMessageRequest) -> None: + """Validate message objects of a broadcast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_broadcast(validate_message_request) + + def validate_broadcast_with_http_info(self, validate_message_request: ValidateMessageRequest) -> MessagingApiResponse: + """Validate message objects of a broadcast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_broadcast_with_http_info(validate_message_request) + + def validate_multicast(self, validate_message_request: ValidateMessageRequest) -> None: + """Validate message objects of a multicast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_multicast(validate_message_request) + + def validate_multicast_with_http_info(self, validate_message_request: ValidateMessageRequest) -> MessagingApiResponse: + """Validate message objects of a multicast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_multicast_with_http_info(validate_message_request) + + def validate_narrowcast(self, validate_message_request: ValidateMessageRequest) -> None: + """Validate message objects of a narrowcast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_narrowcast(validate_message_request) + + def validate_narrowcast_with_http_info(self, validate_message_request: ValidateMessageRequest) -> MessagingApiResponse: + """Validate message objects of a narrowcast message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_narrowcast_with_http_info(validate_message_request) + + def validate_push(self, validate_message_request: ValidateMessageRequest) -> None: + """Validate message objects of a push message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_push(validate_message_request) + + def validate_push_with_http_info(self, validate_message_request: ValidateMessageRequest) -> MessagingApiResponse: + """Validate message objects of a push message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_push_with_http_info(validate_message_request) + + def validate_reply(self, validate_message_request: ValidateMessageRequest) -> None: + """Validate message objects of a reply message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_reply(validate_message_request) + + def validate_reply_with_http_info(self, validate_message_request: ValidateMessageRequest) -> MessagingApiResponse: + """Validate message objects of a reply message + + :param validate_message_request: (required) + :type validate_message_request: ValidateMessageRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_reply_with_http_info(validate_message_request) + + def validate_rich_menu_batch_request(self, rich_menu_batch_request: RichMenuBatchRequest) -> None: + """Validate a request body of the Replace or unlink the linked rich menus in batches endpoint. + + :param rich_menu_batch_request: (required) + :type rich_menu_batch_request: RichMenuBatchRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_rich_menu_batch_request(rich_menu_batch_request) + + def validate_rich_menu_batch_request_with_http_info(self, rich_menu_batch_request: RichMenuBatchRequest) -> MessagingApiResponse: + """Validate a request body of the Replace or unlink the linked rich menus in batches endpoint. + + :param rich_menu_batch_request: (required) + :type rich_menu_batch_request: RichMenuBatchRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_rich_menu_batch_request_with_http_info(rich_menu_batch_request) + + def validate_rich_menu_object(self, rich_menu_request: RichMenuRequest) -> None: + """Validate rich menu object + + :param rich_menu_request: (required) + :type rich_menu_request: RichMenuRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_rich_menu_object(rich_menu_request) + + def validate_rich_menu_object_with_http_info(self, rich_menu_request: RichMenuRequest) -> MessagingApiResponse: + """Validate rich menu object + + :param rich_menu_request: (required) + :type rich_menu_request: RichMenuRequest + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api.validate_rich_menu_object_with_http_info(rich_menu_request) + + def get_message_content(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of video or audio')]) -> bytearray: + """Download image, video, and audio data sent from users. + + :param message_id: Message ID of video or audio (required) + :type message_id: str + :return: Returns the result object. + :rtype: bytearray + """ + return self._messaging_api_blob.get_message_content(message_id) + + def get_message_content_with_http_info(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of video or audio')]) -> MessagingApiResponse: + """Download image, video, and audio data sent from users. + + :param message_id: Message ID of video or audio (required) + :type message_id: str + :return: Returns the result object. + :rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api_blob.get_message_content_with_http_info(message_id) + + def get_message_content_preview(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of image or video')]) -> bytearray: + """Get a preview image of the image or video + + :param message_id: Message ID of image or video (required) + :type message_id: str + :return: Returns the result object. + :rtype: bytearray + """ + return self._messaging_api_blob.get_message_content_preview(message_id) + + def get_message_content_preview_with_http_info(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of image or video')]) -> MessagingApiResponse: + """Get a preview image of the image or video + + :param message_id: Message ID of image or video (required) + :type message_id: str + :return: Returns the result object. + :rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api_blob.get_message_content_preview_with_http_info(message_id) + + def get_message_content_transcoding_by_message_id(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of video or audio')]) -> GetMessageContentTranscodingResponse: + """Verify the preparation status of a video or audio for getting + + :param message_id: Message ID of video or audio (required) + :type message_id: str + :return: Returns the result object. + :rtype: GetMessageContentTranscodingResponse + """ + return self._messaging_api_blob.get_message_content_transcoding_by_message_id(message_id) + + def get_message_content_transcoding_by_message_id_with_http_info(self, message_id: Annotated[StrictStr, Field(..., description='Message ID of video or audio')]) -> MessagingApiResponse: + """Verify the preparation status of a video or audio for getting + + :param message_id: Message ID of video or audio (required) + :type message_id: str + :return: Returns the result object. + :rtype: tuple(GetMessageContentTranscodingResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api_blob.get_message_content_transcoding_by_message_id_with_http_info(message_id) + + def get_rich_menu_image(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of the rich menu with the image to be downloaded')]) -> bytearray: + """Download rich menu image. + + :param rich_menu_id: ID of the rich menu with the image to be downloaded (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: bytearray + """ + return self._messaging_api_blob.get_rich_menu_image(rich_menu_id) + + def get_rich_menu_image_with_http_info(self, rich_menu_id: Annotated[StrictStr, Field(..., description='ID of the rich menu with the image to be downloaded')]) -> MessagingApiResponse: + """Download rich menu image. + + :param rich_menu_id: ID of the rich menu with the image to be downloaded (required) + :type rich_menu_id: str + :return: Returns the result object. + :rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict)) + """ + return self._messaging_api_blob.get_rich_menu_image_with_http_info(rich_menu_id) + + def set_rich_menu_image(self, rich_menu_id: Annotated[StrictStr, Field(..., description='The ID of the rich menu to attach the image to')], body: Union[StrictBytes, StrictStr]) -> None: + """Upload rich menu image + + :param rich_menu_id: The ID of the rich menu to attach the image to (required) + :type rich_menu_id: str + :param body: (required) + :type body: bytearray + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api_blob.set_rich_menu_image(rich_menu_id, body) + + def set_rich_menu_image_with_http_info(self, rich_menu_id: Annotated[StrictStr, Field(..., description='The ID of the rich menu to attach the image to')], body: Union[StrictBytes, StrictStr]) -> MessagingApiResponse: + """Upload rich menu image + + :param rich_menu_id: The ID of the rich menu to attach the image to (required) + :type rich_menu_id: str + :param body: (required) + :type body: bytearray + :return: Returns the result object. + :rtype: None + """ + return self._messaging_api_blob.set_rich_menu_image_with_http_info(rich_menu_id, body) + + def acquire_chat_control(self, chat_id: Annotated[StrictStr, Field(..., description='The `userId`, `roomId`, or `groupId`')], acquire_chat_control_request: Optional[AcquireChatControlRequest] = None) -> None: + """If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API. The channel that was previously an Active Channel will automatically switch to a Standby Channel. + + :param chat_id: The `userId`, `roomId`, or `groupId` (required) + :type chat_id: str + :param acquire_chat_control_request: + :type acquire_chat_control_request: AcquireChatControlRequest + :return: Returns the result object. + :rtype: None + """ + return self._line_module.acquire_chat_control(chat_id, acquire_chat_control_request) + + def acquire_chat_control_with_http_info(self, chat_id: Annotated[StrictStr, Field(..., description='The `userId`, `roomId`, or `groupId`')], acquire_chat_control_request: Optional[AcquireChatControlRequest] = None) -> ModuleApiResponse: + """If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API. The channel that was previously an Active Channel will automatically switch to a Standby Channel. + + :param chat_id: The `userId`, `roomId`, or `groupId` (required) + :type chat_id: str + :param acquire_chat_control_request: + :type acquire_chat_control_request: AcquireChatControlRequest + :return: Returns the result object. + :rtype: None + """ + return self._line_module.acquire_chat_control_with_http_info(chat_id, acquire_chat_control_request) + + def detach_module(self, detach_module_request: Optional[DetachModuleRequest] = None) -> None: + """The module channel admin calls the Detach API to detach the module channel from a LINE Official Account. + + :param detach_module_request: + :type detach_module_request: DetachModuleRequest + :return: Returns the result object. + :rtype: None + """ + return self._line_module.detach_module(detach_module_request) + + def detach_module_with_http_info(self, detach_module_request: Optional[DetachModuleRequest] = None) -> ModuleApiResponse: + """The module channel admin calls the Detach API to detach the module channel from a LINE Official Account. + + :param detach_module_request: + :type detach_module_request: DetachModuleRequest + :return: Returns the result object. + :rtype: None + """ + return self._line_module.detach_module_with_http_info(detach_module_request) + + def get_modules(self, start: Annotated[Optional[StrictStr], Field(description="Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. ")] = None, limit: Annotated[Optional[conint(strict=True, le=100)], Field(description='Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 ')] = None) -> GetModulesResponse: + """Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels. + + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. + :type start: str + :param limit: Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 + :type limit: int + :return: Returns the result object. + :rtype: GetModulesResponse + """ + return self._line_module.get_modules(start, limit) + + def get_modules_with_http_info(self, start: Annotated[Optional[StrictStr], Field(description="Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. ")] = None, limit: Annotated[Optional[conint(strict=True, le=100)], Field(description='Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 ')] = None) -> ModuleApiResponse: + """Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels. + + :param start: Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. + :type start: str + :param limit: Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 + :type limit: int + :return: Returns the result object. + :rtype: tuple(GetModulesResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._line_module.get_modules_with_http_info(start, limit) + + def release_chat_control(self, chat_id: Annotated[StrictStr, Field(..., description='The `userId`, `roomId`, or `groupId`')]) -> None: + """To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API. + + :param chat_id: The `userId`, `roomId`, or `groupId` (required) + :type chat_id: str + :return: Returns the result object. + :rtype: None + """ + return self._line_module.release_chat_control(chat_id) + + def release_chat_control_with_http_info(self, chat_id: Annotated[StrictStr, Field(..., description='The `userId`, `roomId`, or `groupId`')]) -> ModuleApiResponse: + """To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API. + + :param chat_id: The `userId`, `roomId`, or `groupId` (required) + :type chat_id: str + :return: Returns the result object. + :rtype: None + """ + return self._line_module.release_chat_control_with_http_info(chat_id) + + def attach_module(self, grant_type: Annotated[StrictStr, Field(..., description='authorization_code')], code: Annotated[StrictStr, Field(..., description='Authorization code received from the LINE Platform.')], redirect_uri: Annotated[StrictStr, Field(..., description='Specify the redirect_uri specified in the URL for authentication and authorization.')], code_verifier: Annotated[Optional[StrictStr], Field(description='Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks.')] = None, client_id: Annotated[Optional[StrictStr], Field(description='Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. ')] = None, client_secret: Annotated[Optional[StrictStr], Field(description='Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. ')] = None, region: Annotated[Optional[StrictStr], Field(description='If you specified a value for region in the URL for authentication and authorization, specify the same value. ')] = None, basic_search_id: Annotated[Optional[StrictStr], Field(description='If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value.')] = None, scope: Annotated[Optional[StrictStr], Field(description='If you specified a value for scope in the URL for authentication and authorization, specify the same value.')] = None, brand_type: Annotated[Optional[StrictStr], Field(description='If you specified a value for brand_type in the URL for authentication and authorization, specify the same value.')] = None) -> AttachModuleResponse: + """Attach by operation of the module channel provider + + :param grant_type: authorization_code (required) + :type grant_type: str + :param code: Authorization code received from the LINE Platform. (required) + :type code: str + :param redirect_uri: Specify the redirect_uri specified in the URL for authentication and authorization. (required) + :type redirect_uri: str + :param code_verifier: Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks. + :type code_verifier: str + :param client_id: Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. + :type client_id: str + :param client_secret: Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. + :type client_secret: str + :param region: If you specified a value for region in the URL for authentication and authorization, specify the same value. + :type region: str + :param basic_search_id: If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value. + :type basic_search_id: str + :param scope: If you specified a value for scope in the URL for authentication and authorization, specify the same value. + :type scope: str + :param brand_type: If you specified a value for brand_type in the URL for authentication and authorization, specify the same value. + :type brand_type: str + :return: Returns the result object. + :rtype: AttachModuleResponse + """ + return self._line_module_attach.attach_module(grant_type, code, redirect_uri, code_verifier, client_id, client_secret, region, basic_search_id, scope, brand_type) + + def attach_module_with_http_info(self, grant_type: Annotated[StrictStr, Field(..., description='authorization_code')], code: Annotated[StrictStr, Field(..., description='Authorization code received from the LINE Platform.')], redirect_uri: Annotated[StrictStr, Field(..., description='Specify the redirect_uri specified in the URL for authentication and authorization.')], code_verifier: Annotated[Optional[StrictStr], Field(description='Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks.')] = None, client_id: Annotated[Optional[StrictStr], Field(description='Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. ')] = None, client_secret: Annotated[Optional[StrictStr], Field(description='Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. ')] = None, region: Annotated[Optional[StrictStr], Field(description='If you specified a value for region in the URL for authentication and authorization, specify the same value. ')] = None, basic_search_id: Annotated[Optional[StrictStr], Field(description='If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value.')] = None, scope: Annotated[Optional[StrictStr], Field(description='If you specified a value for scope in the URL for authentication and authorization, specify the same value.')] = None, brand_type: Annotated[Optional[StrictStr], Field(description='If you specified a value for brand_type in the URL for authentication and authorization, specify the same value.')] = None) -> ModuleattachApiResponse: + """Attach by operation of the module channel provider + + :param grant_type: authorization_code (required) + :type grant_type: str + :param code: Authorization code received from the LINE Platform. (required) + :type code: str + :param redirect_uri: Specify the redirect_uri specified in the URL for authentication and authorization. (required) + :type redirect_uri: str + :param code_verifier: Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks. + :type code_verifier: str + :param client_id: Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. + :type client_id: str + :param client_secret: Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. + :type client_secret: str + :param region: If you specified a value for region in the URL for authentication and authorization, specify the same value. + :type region: str + :param basic_search_id: If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value. + :type basic_search_id: str + :param scope: If you specified a value for scope in the URL for authentication and authorization, specify the same value. + :type scope: str + :param brand_type: If you specified a value for brand_type in the URL for authentication and authorization, specify the same value. + :type brand_type: str + :return: Returns the result object. + :rtype: tuple(AttachModuleResponse, status_code(int), headers(HTTPHeaderDict)) + """ + return self._line_module_attach.attach_module_with_http_info(grant_type, code, redirect_uri, code_verifier, client_id, client_secret, region, basic_search_id, scope, brand_type) + + def mission_sticker_v3(self, mission_sticker_request: MissionStickerRequest) -> None: + """Sends a mission sticker. + + :param mission_sticker_request: (required) + :type mission_sticker_request: MissionStickerRequest + :return: Returns the result object. + :rtype: None + """ + return self._shop.mission_sticker_v3(mission_sticker_request) + + def mission_sticker_v3_with_http_info(self, mission_sticker_request: MissionStickerRequest) -> ShopApiResponse: + """Sends a mission sticker. + + :param mission_sticker_request: (required) + :type mission_sticker_request: MissionStickerRequest + :return: Returns the result object. + :rtype: None + """ + return self._shop.mission_sticker_v3_with_http_info(mission_sticker_request) + diff --git a/linebot/v3/messaging/api/async_messaging_api.py b/linebot/v3/messaging/api/async_messaging_api.py index 3c1121ab2..6d31ab772 100644 --- a/linebot/v3/messaging/api/async_messaging_api.py +++ b/linebot/v3/messaging/api/async_messaging_api.py @@ -89,6 +89,9 @@ class AsyncMessagingApi(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.AsyncLineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/messaging/api/async_messaging_api_blob.py b/linebot/v3/messaging/api/async_messaging_api_blob.py index e2b6f20db..9a93c8756 100644 --- a/linebot/v3/messaging/api/async_messaging_api_blob.py +++ b/linebot/v3/messaging/api/async_messaging_api_blob.py @@ -39,6 +39,9 @@ class AsyncMessagingApiBlob(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.AsyncLineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/messaging/api/messaging_api.py b/linebot/v3/messaging/api/messaging_api.py index a0df4448e..c592bbcad 100644 --- a/linebot/v3/messaging/api/messaging_api.py +++ b/linebot/v3/messaging/api/messaging_api.py @@ -87,6 +87,9 @@ class MessagingApi(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.LineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/messaging/api/messaging_api_blob.py b/linebot/v3/messaging/api/messaging_api_blob.py index 0e2adbb2a..a84f2a1c9 100644 --- a/linebot/v3/messaging/api/messaging_api_blob.py +++ b/linebot/v3/messaging/api/messaging_api_blob.py @@ -37,6 +37,9 @@ class MessagingApiBlob(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.LineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/module/api/async_line_module.py b/linebot/v3/module/api/async_line_module.py index 4f001c431..88505d5ab 100644 --- a/linebot/v3/module/api/async_line_module.py +++ b/linebot/v3/module/api/async_line_module.py @@ -41,6 +41,9 @@ class AsyncLineModule(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.AsyncLineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/module/api/line_module.py b/linebot/v3/module/api/line_module.py index 6df51570f..9d08d5dce 100644 --- a/linebot/v3/module/api/line_module.py +++ b/linebot/v3/module/api/line_module.py @@ -39,6 +39,9 @@ class LineModule(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.LineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/moduleattach/api/async_line_module_attach.py b/linebot/v3/moduleattach/api/async_line_module_attach.py index 89f17f3c5..d1b5bca7c 100644 --- a/linebot/v3/moduleattach/api/async_line_module_attach.py +++ b/linebot/v3/moduleattach/api/async_line_module_attach.py @@ -39,6 +39,9 @@ class AsyncLineModuleAttach(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.AsyncLineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/moduleattach/api/line_module_attach.py b/linebot/v3/moduleattach/api/line_module_attach.py index db4611db9..1f2544c55 100644 --- a/linebot/v3/moduleattach/api/line_module_attach.py +++ b/linebot/v3/moduleattach/api/line_module_attach.py @@ -37,6 +37,9 @@ class LineModuleAttach(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.LineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/oauth/api/async_channel_access_token.py b/linebot/v3/oauth/api/async_channel_access_token.py index ab5e6d07e..204a394fe 100644 --- a/linebot/v3/oauth/api/async_channel_access_token.py +++ b/linebot/v3/oauth/api/async_channel_access_token.py @@ -41,6 +41,9 @@ class AsyncChannelAccessToken(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.AsyncLineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/oauth/api/channel_access_token.py b/linebot/v3/oauth/api/channel_access_token.py index 35c4a9f89..aabb44cb9 100644 --- a/linebot/v3/oauth/api/channel_access_token.py +++ b/linebot/v3/oauth/api/channel_access_token.py @@ -39,6 +39,9 @@ class ChannelAccessToken(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.LineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/shop/api/async_shop.py b/linebot/v3/shop/api/async_shop.py index e3e15453e..a9b7ea8ec 100644 --- a/linebot/v3/shop/api/async_shop.py +++ b/linebot/v3/shop/api/async_shop.py @@ -35,6 +35,9 @@ class AsyncShop(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.AsyncLineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/shop/api/shop.py b/linebot/v3/shop/api/shop.py index 433404d66..a9802e0c6 100644 --- a/linebot/v3/shop/api/shop.py +++ b/linebot/v3/shop/api/shop.py @@ -33,6 +33,9 @@ class Shop(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.LineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/webhooks/api/async_dummy.py b/linebot/v3/webhooks/api/async_dummy.py index b62e2ebb7..ae94a1b8d 100644 --- a/linebot/v3/webhooks/api/async_dummy.py +++ b/linebot/v3/webhooks/api/async_dummy.py @@ -35,6 +35,9 @@ class AsyncDummy(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.AsyncLineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/linebot/v3/webhooks/api/dummy.py b/linebot/v3/webhooks/api/dummy.py index b6b7c8ea6..e096f2f86 100644 --- a/linebot/v3/webhooks/api/dummy.py +++ b/linebot/v3/webhooks/api/dummy.py @@ -33,6 +33,9 @@ class Dummy(object): Ref: https://openapi-generator.tech Do not edit the class manually. + + Tip: Use :class:`linebot.v3.LineBotClient` to call every + LINE API method through a single instance. """ def __init__(self, api_client=None): diff --git a/tests/v3/test_async_line_bot_client.py b/tests/v3/test_async_line_bot_client.py new file mode 100644 index 000000000..8c00ea4c7 --- /dev/null +++ b/tests/v3/test_async_line_bot_client.py @@ -0,0 +1,524 @@ +# -*- coding: utf-8 -*- + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +"""Tests for AsyncLineBotClient. + +Verifies that AsyncLineBotClient correctly delegates to each underlying +async API client and sends proper HTTP requests. +""" + +import json +import unittest + +from pytest_httpserver import HTTPServer + +from linebot.v3 import AsyncLineBotClient +from linebot.v3.messaging import ( + PushMessageRequest, + ReplyMessageRequest, + TextMessage, +) +from linebot.v3.messaging.exceptions import ApiException as MessagingApiException +from linebot.v3.shop.models import MissionStickerRequest + + +class TestAsyncLineBotClientMessagingApi(unittest.IsolatedAsyncioTestCase): + """Test MessagingApi delegation through AsyncLineBotClient.""" + + async def test_push_message(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/push", + method="POST", + ).respond_with_json( + {"sentMessages": [{"id": "msg001", "quoteToken": "qt001"}]}, + status=200 + ) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + req = PushMessageRequest( + to="U123", + messages=[TextMessage(text="hello")] + ) + await client.push_message(push_message_request=req) + + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "POST") + self.assertEqual(request.path, "/v2/bot/message/push") + body = json.loads(request.data.decode("utf-8")) + self.assertEqual(body["to"], "U123") + self.assertEqual(body["messages"][0]["type"], "text") + self.assertEqual(body["messages"][0]["text"], "hello") + + async def test_reply_message(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/reply", + method="POST", + ).respond_with_json( + {"sentMessages": [{"id": "msg002", "quoteToken": "qt002"}]}, + status=200 + ) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + req = ReplyMessageRequest( + replyToken="reply-token-xxx", + messages=[TextMessage(text="hi")] + ) + await client.reply_message(reply_message_request=req) + + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "POST") + body = json.loads(request.data.decode("utf-8")) + self.assertEqual(body["replyToken"], "reply-token-xxx") + self.assertEqual(body["messages"][0]["text"], "hi") + + async def test_get_followers_with_query_params(self): + expected_response = { + "userIds": ["U4af4980629", "U0c229f96c4"], + "next": "yANU9IA..." + } + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/followers/ids", + method="GET", + ).respond_with_json(expected_response, status=200) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = await client.get_followers(start="xBQU2IB", limit=100) + + self.assertEqual(response.user_ids, expected_response["userIds"]) + self.assertEqual(response.next, expected_response["next"]) + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "GET") + self.assertIn(b"start=xBQU2IB", request.query_string) + self.assertIn(b"limit=100", request.query_string) + + async def test_get_followers_without_start(self): + expected_response = {"userIds": ["U4af4980629"]} + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/followers/ids", + method="GET", + ).respond_with_json(expected_response, status=200) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = await client.get_followers() + + self.assertEqual(response.user_ids, ["U4af4980629"]) + request, _ = httpserver.log[0] + self.assertEqual(request.query_string, b"") + + async def test_get_profile(self): + expected_response = { + "displayName": "Test User", + "userId": "U4af4980629", + "pictureUrl": "https://example.com/pic.png", + "statusMessage": "Hello" + } + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/profile/U4af4980629", + method="GET", + ).respond_with_json(expected_response, status=200) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = await client.get_profile(user_id="U4af4980629") + + self.assertEqual(response.display_name, "Test User") + self.assertEqual(response.user_id, "U4af4980629") + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "GET") + self.assertEqual(request.path, "/v2/bot/profile/U4af4980629") + + +class TestAsyncLineBotClientInsight(unittest.IsolatedAsyncioTestCase): + """Test Insight API delegation through AsyncLineBotClient.""" + + async def test_get_number_of_followers(self): + expected_response = { + "status": "ready", + "followers": 123, + "targetedReaches": 100, + "blocks": 5 + } + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/insight/followers", + method="GET", + ).respond_with_json(expected_response, status=200) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = await client.get_number_of_followers(var_date="20240101") + + self.assertEqual(response.followers, 123) + self.assertEqual(response.targeted_reaches, 100) + self.assertEqual(response.blocks, 5) + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertIn(b"date=20240101", request.query_string) + + +class TestAsyncLineBotClientLiff(unittest.IsolatedAsyncioTestCase): + """Test LIFF API delegation through AsyncLineBotClient.""" + + async def test_get_all_liff_apps(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/liff/v1/apps", + method="GET", + ).respond_with_json({"apps": []}, status=200) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = await client.get_all_liff_apps() + + self.assertEqual(response.apps, []) + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "GET") + self.assertEqual(request.path, "/liff/v1/apps") + + +class TestAsyncLineBotClientAudience(unittest.IsolatedAsyncioTestCase): + """Test ManageAudience API delegation through AsyncLineBotClient.""" + + async def test_delete_audience_group(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/audienceGroup/12345", + method="DELETE", + ).respond_with_json({}, status=200) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + await client.delete_audience_group(audience_group_id=12345) + + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "DELETE") + self.assertEqual(request.path, "/v2/bot/audienceGroup/12345") + + +class TestAsyncLineBotClientModule(unittest.IsolatedAsyncioTestCase): + """Test LineModule API delegation through AsyncLineBotClient.""" + + async def test_get_modules(self): + expected_response = { + "bots": [{"userId": "U111", "basicId": "@bot", "displayName": "TestBot"}], + "next": "next-token" + } + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/list", + method="GET", + ).respond_with_json(expected_response, status=200) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + await client.get_modules(start="start-token", limit=20) + + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "GET") + self.assertIn(b"start=start-token", request.query_string) + self.assertIn(b"limit=20", request.query_string) + + +class TestAsyncLineBotClientModuleAttach(unittest.IsolatedAsyncioTestCase): + """Test LineModuleAttach API delegation through AsyncLineBotClient.""" + + async def test_attach_module(self): + expected_response = { + "bot_id": "U1234567890", + "scopes": ["message:send"] + } + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/module/auth/v1/token", + method="POST", + ).respond_with_json(expected_response, status=200) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = await client.attach_module( + grant_type="authorization_code", + code="auth_code", + redirect_uri="https://example.com/callback" + ) + + self.assertEqual(response.bot_id, "U1234567890") + self.assertEqual(response.scopes, ["message:send"]) + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "POST") + self.assertEqual(request.path, "/module/auth/v1/token") + + +class TestAsyncLineBotClientShop(unittest.IsolatedAsyncioTestCase): + """Test Shop API delegation through AsyncLineBotClient.""" + + async def test_mission_sticker_v3(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/shop/v3/mission", + method="POST", + ).respond_with_json({}, status=200) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + req = MissionStickerRequest( + to="U4af4980629", + productId="prod_id", + productType="prod_type", + sendPresentMessage=False + ) + await client.mission_sticker_v3(mission_sticker_request=req) + + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "POST") + self.assertEqual(request.path, "/shop/v3/mission") + body = json.loads(request.data.decode("utf-8")) + self.assertEqual(body["to"], "U4af4980629") + self.assertEqual(body["productId"], "prod_id") + self.assertEqual(body["productType"], "prod_type") + self.assertEqual(body["sendPresentMessage"], False) + + +class TestAsyncLineBotClientAuthorizationHeader(unittest.IsolatedAsyncioTestCase): + """Test that the Authorization header is correctly propagated to all domains.""" + + def _assert_bearer_token(self, httpserver, expected_token): + request, _ = httpserver.log[-1] + self.assertEqual( + request.headers.get("Authorization"), f"Bearer {expected_token}" + ) + + async def test_messaging_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/profile/U123", + method="GET", + ).respond_with_json( + {"displayName": "T", "userId": "U123"}, status=200 + ) + + async with AsyncLineBotClient( + channel_access_token="my-secret-token", + host=httpserver.url_for("/") + ) as client: + await client.get_profile(user_id="U123") + + self._assert_bearer_token(httpserver, "my-secret-token") + + async def test_insight_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/insight/followers", + method="GET", + ).respond_with_json( + {"status": "ready", "followers": 0, "targetedReaches": 0, "blocks": 0}, + status=200 + ) + + async with AsyncLineBotClient( + channel_access_token="insight-token", + host=httpserver.url_for("/") + ) as client: + await client.get_number_of_followers(var_date="20240101") + + self._assert_bearer_token(httpserver, "insight-token") + + async def test_audience_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/audienceGroup/99999", + method="DELETE", + ).respond_with_json({}, status=200) + + async with AsyncLineBotClient( + channel_access_token="audience-token", + host=httpserver.url_for("/") + ) as client: + await client.delete_audience_group(audience_group_id=99999) + + self._assert_bearer_token(httpserver, "audience-token") + + async def test_liff_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/liff/v1/apps", + method="GET", + ).respond_with_json({"apps": []}, status=200) + + async with AsyncLineBotClient( + channel_access_token="liff-token", + host=httpserver.url_for("/") + ) as client: + await client.get_all_liff_apps() + + self._assert_bearer_token(httpserver, "liff-token") + + async def test_module_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/list", + method="GET", + ).respond_with_json({"bots": []}, status=200) + + async with AsyncLineBotClient( + channel_access_token="module-token", + host=httpserver.url_for("/") + ) as client: + await client.get_modules() + + self._assert_bearer_token(httpserver, "module-token") + + async def test_shop_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/shop/v3/mission", + method="POST", + ).respond_with_json({}, status=200) + + async with AsyncLineBotClient( + channel_access_token="shop-token", + host=httpserver.url_for("/") + ) as client: + req = MissionStickerRequest( + to="U123", + productId="p", + productType="t", + sendPresentMessage=False + ) + await client.mission_sticker_v3(mission_sticker_request=req) + + self._assert_bearer_token(httpserver, "shop-token") + + +class TestAsyncLineBotClientWithHttpInfo(unittest.IsolatedAsyncioTestCase): + """Test _with_http_info methods return ApiResponse with status/headers/data.""" + + async def test_push_message_with_http_info(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/push", + method="POST", + ).respond_with_json( + {"sentMessages": [{"id": "msg001", "quoteToken": "qt001"}]}, + status=200 + ) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + req = PushMessageRequest( + to="U123", + messages=[TextMessage(text="hello")] + ) + api_response = await client.push_message_with_http_info( + push_message_request=req + ) + + self.assertEqual(api_response.status_code, 200) + self.assertIsNotNone(api_response.data) + self.assertEqual(api_response.data.sent_messages[0].id, "msg001") + + +class TestAsyncLineBotClientBlobApi(unittest.IsolatedAsyncioTestCase): + """Test MessagingApiBlob delegation through AsyncLineBotClient.""" + + async def test_get_message_content(self): + content = b"fake-binary-content" + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/msg123/content", + method="GET", + ).respond_with_data(content, status=200, content_type="image/jpeg") + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + result = await client.get_message_content(message_id="msg123") + + self.assertEqual(result, content) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "GET") + self.assertEqual(request.path, "/v2/bot/message/msg123/content") + + +class TestAsyncLineBotClientErrors(unittest.IsolatedAsyncioTestCase): + """Test error handling through AsyncLineBotClient.""" + + async def test_api_error_from_messaging(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/push", + method="POST", + ).respond_with_json( + {"message": "Invalid request"}, + status=400 + ) + + async with AsyncLineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + req = PushMessageRequest( + to="U123", + messages=[TextMessage(text="hello")] + ) + with self.assertRaises(MessagingApiException) as ctx: + await client.push_message(push_message_request=req) + + self.assertEqual(ctx.exception.status, 400) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/v3/test_line_bot_client.py b/tests/v3/test_line_bot_client.py new file mode 100644 index 000000000..0e0c13bfc --- /dev/null +++ b/tests/v3/test_line_bot_client.py @@ -0,0 +1,647 @@ +# -*- coding: utf-8 -*- + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +"""Tests for LineBotClient. + +Verifies that LineBotClient correctly delegates to each underlying API client +and sends proper HTTP requests. Uses pytest_httpserver for HTTP mocking. + +Reference: line-bot-sdk-nodejs/test/line-bot-client.spec.ts +""" + +import json +import unittest + +from pytest_httpserver import HTTPServer + +from linebot.v3 import LineBotClient +from linebot.v3.messaging import ( + PushMessageRequest, + ReplyMessageRequest, + TextMessage, +) +from linebot.v3.messaging.exceptions import ApiException as MessagingApiException +from linebot.v3.shop.models import MissionStickerRequest + + +class TestLineBotClientInit(unittest.TestCase): + """Test initialization and context manager.""" + + def test_init(self): + client = LineBotClient(channel_access_token="test-token") + self.assertIsNotNone(client._manage_audience) + self.assertIsNotNone(client._manage_audience_blob) + self.assertIsNotNone(client._insight) + self.assertIsNotNone(client._liff) + self.assertIsNotNone(client._messaging_api) + self.assertIsNotNone(client._messaging_api_blob) + self.assertIsNotNone(client._line_module) + self.assertIsNotNone(client._line_module_attach) + self.assertIsNotNone(client._shop) + client.close() + + def test_context_manager(self): + with LineBotClient(channel_access_token="test-token") as client: + self.assertIsNotNone(client) + + def test_kwargs_forwarded_to_configuration(self): + """Verify that extra kwargs (e.g., host) are forwarded to Configuration.""" + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/profile/U123", + method="GET", + ).respond_with_json( + {"displayName": "T", "userId": "U123"}, status=200 + ) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = client.get_profile(user_id="U123") + + self.assertEqual(response.user_id, "U123") + + +class TestLineBotClientMessagingApi(unittest.TestCase): + """Test MessagingApi delegation through LineBotClient.""" + + def test_push_message(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/push", + method="POST", + ).respond_with_json( + {"sentMessages": [{"id": "msg001", "quoteToken": "qt001"}]}, + status=200 + ) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + req = PushMessageRequest( + to="U123", + messages=[TextMessage(text="hello")] + ) + client.push_message(push_message_request=req) + + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "POST") + self.assertEqual(request.path, "/v2/bot/message/push") + body = json.loads(request.data.decode("utf-8")) + self.assertEqual(body["to"], "U123") + self.assertEqual(body["messages"][0]["type"], "text") + self.assertEqual(body["messages"][0]["text"], "hello") + + def test_reply_message(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/reply", + method="POST", + ).respond_with_json( + {"sentMessages": [{"id": "msg002", "quoteToken": "qt002"}]}, + status=200 + ) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + req = ReplyMessageRequest( + replyToken="reply-token-xxx", + messages=[TextMessage(text="hi")] + ) + client.reply_message(reply_message_request=req) + + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "POST") + body = json.loads(request.data.decode("utf-8")) + self.assertEqual(body["replyToken"], "reply-token-xxx") + self.assertEqual(body["messages"][0]["text"], "hi") + + def test_get_followers_with_query_params(self): + expected_response = { + "userIds": ["U4af4980629", "U0c229f96c4"], + "next": "yANU9IA..." + } + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/followers/ids", + method="GET", + ).respond_with_json(expected_response, status=200) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = client.get_followers(start="xBQU2IB", limit=100) + + self.assertEqual(response.user_ids, expected_response["userIds"]) + self.assertEqual(response.next, expected_response["next"]) + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "GET") + self.assertIn(b"start=xBQU2IB", request.query_string) + self.assertIn(b"limit=100", request.query_string) + + def test_get_followers_without_start(self): + expected_response = {"userIds": ["U4af4980629"]} + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/followers/ids", + method="GET", + ).respond_with_json(expected_response, status=200) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = client.get_followers() + + self.assertEqual(response.user_ids, ["U4af4980629"]) + request, _ = httpserver.log[0] + self.assertEqual(request.query_string, b"") + + def test_get_profile(self): + expected_response = { + "displayName": "Test User", + "userId": "U4af4980629", + "pictureUrl": "https://example.com/pic.png", + "statusMessage": "Hello" + } + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/profile/U4af4980629", + method="GET", + ).respond_with_json(expected_response, status=200) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = client.get_profile(user_id="U4af4980629") + + self.assertEqual(response.display_name, "Test User") + self.assertEqual(response.user_id, "U4af4980629") + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "GET") + self.assertEqual(request.path, "/v2/bot/profile/U4af4980629") + + +class TestLineBotClientInsight(unittest.TestCase): + """Test Insight API delegation through LineBotClient.""" + + def test_get_number_of_followers(self): + expected_response = { + "status": "ready", + "followers": 123, + "targetedReaches": 100, + "blocks": 5 + } + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/insight/followers", + method="GET", + ).respond_with_json(expected_response, status=200) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = client.get_number_of_followers(var_date="20240101") + + self.assertEqual(response.followers, 123) + self.assertEqual(response.targeted_reaches, 100) + self.assertEqual(response.blocks, 5) + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertIn(b"date=20240101", request.query_string) + + +class TestLineBotClientLiff(unittest.TestCase): + """Test LIFF API delegation through LineBotClient.""" + + def test_get_all_liff_apps(self): + expected_response = {"apps": []} + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/liff/v1/apps", + method="GET", + ).respond_with_json(expected_response, status=200) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = client.get_all_liff_apps() + + self.assertEqual(response.apps, []) + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "GET") + self.assertEqual(request.path, "/liff/v1/apps") + + +class TestLineBotClientAudience(unittest.TestCase): + """Test ManageAudience API delegation through LineBotClient.""" + + def test_delete_audience_group(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/audienceGroup/12345", + method="DELETE", + ).respond_with_json({}, status=200) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + client.delete_audience_group(audience_group_id=12345) + + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "DELETE") + self.assertEqual(request.path, "/v2/bot/audienceGroup/12345") + + +class TestLineBotClientModule(unittest.TestCase): + """Test LineModule API delegation through LineBotClient.""" + + def test_get_modules_with_query_params(self): + expected_response = { + "bots": [{"userId": "U111", "basicId": "@bot", "displayName": "TestBot"}], + "next": "next-token" + } + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/list", + method="GET", + ).respond_with_json(expected_response, status=200) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + client.get_modules(start="start-token", limit=20) + + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "GET") + self.assertIn(b"start=start-token", request.query_string) + self.assertIn(b"limit=20", request.query_string) + + def test_get_modules_without_start(self): + expected_response = {"bots": []} + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/list", + method="GET", + ).respond_with_json(expected_response, status=200) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + client.get_modules() + + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertNotIn(b"start=", request.query_string) + + +class TestLineBotClientModuleAttach(unittest.TestCase): + """Test LineModuleAttach API delegation through LineBotClient.""" + + def test_attach_module(self): + expected_response = { + "bot_id": "U1234567890", + "scopes": ["message:send"] + } + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/module/auth/v1/token", + method="POST", + ).respond_with_json(expected_response, status=200) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + response = client.attach_module( + grant_type="authorization_code", + code="auth_code", + redirect_uri="https://example.com/callback" + ) + + self.assertEqual(response.bot_id, "U1234567890") + self.assertEqual(response.scopes, ["message:send"]) + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "POST") + self.assertEqual(request.path, "/module/auth/v1/token") + + +class TestLineBotClientShop(unittest.TestCase): + """Test Shop API delegation through LineBotClient.""" + + def test_mission_sticker_v3(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/shop/v3/mission", + method="POST", + ).respond_with_json({}, status=200) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + req = MissionStickerRequest( + to="U4af4980629", + productId="prod_id", + productType="prod_type", + sendPresentMessage=False + ) + client.mission_sticker_v3(mission_sticker_request=req) + + self.assertEqual(len(httpserver.log), 1) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "POST") + self.assertEqual(request.path, "/shop/v3/mission") + body = json.loads(request.data.decode("utf-8")) + self.assertEqual(body["to"], "U4af4980629") + self.assertEqual(body["productId"], "prod_id") + self.assertEqual(body["productType"], "prod_type") + self.assertEqual(body["sendPresentMessage"], False) + + +class TestLineBotClientAuthorizationHeader(unittest.TestCase): + """Test that the Authorization header is correctly propagated to all domains.""" + + def _assert_bearer_token(self, httpserver, expected_token): + request, _ = httpserver.log[-1] + self.assertEqual( + request.headers.get("Authorization"), f"Bearer {expected_token}" + ) + + def test_messaging_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/profile/U123", + method="GET", + ).respond_with_json( + {"displayName": "T", "userId": "U123"}, status=200 + ) + + with LineBotClient( + channel_access_token="my-secret-token", + host=httpserver.url_for("/") + ) as client: + client.get_profile(user_id="U123") + + self._assert_bearer_token(httpserver, "my-secret-token") + + def test_insight_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/insight/followers", + method="GET", + ).respond_with_json( + {"status": "ready", "followers": 0, "targetedReaches": 0, "blocks": 0}, + status=200 + ) + + with LineBotClient( + channel_access_token="insight-token", + host=httpserver.url_for("/") + ) as client: + client.get_number_of_followers(var_date="20240101") + + self._assert_bearer_token(httpserver, "insight-token") + + def test_audience_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/audienceGroup/99999", + method="DELETE", + ).respond_with_json({}, status=200) + + with LineBotClient( + channel_access_token="audience-token", + host=httpserver.url_for("/") + ) as client: + client.delete_audience_group(audience_group_id=99999) + + self._assert_bearer_token(httpserver, "audience-token") + + def test_liff_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/liff/v1/apps", + method="GET", + ).respond_with_json({"apps": []}, status=200) + + with LineBotClient( + channel_access_token="liff-token", + host=httpserver.url_for("/") + ) as client: + client.get_all_liff_apps() + + self._assert_bearer_token(httpserver, "liff-token") + + def test_module_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/list", + method="GET", + ).respond_with_json({"bots": []}, status=200) + + with LineBotClient( + channel_access_token="module-token", + host=httpserver.url_for("/") + ) as client: + client.get_modules() + + self._assert_bearer_token(httpserver, "module-token") + + def test_shop_api_sends_bearer_token(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/shop/v3/mission", + method="POST", + ).respond_with_json({}, status=200) + + with LineBotClient( + channel_access_token="shop-token", + host=httpserver.url_for("/") + ) as client: + req = MissionStickerRequest( + to="U123", + productId="p", + productType="t", + sendPresentMessage=False + ) + client.mission_sticker_v3(mission_sticker_request=req) + + self._assert_bearer_token(httpserver, "shop-token") + + +class TestLineBotClientWithHttpInfo(unittest.TestCase): + """Test _with_http_info methods return ApiResponse with status/headers/data.""" + + def test_push_message_with_http_info(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/push", + method="POST", + ).respond_with_json( + {"sentMessages": [{"id": "msg001", "quoteToken": "qt001"}]}, + status=200 + ) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + req = PushMessageRequest( + to="U123", + messages=[TextMessage(text="hello")] + ) + api_response = client.push_message_with_http_info( + push_message_request=req + ) + + self.assertEqual(api_response.status_code, 200) + self.assertIsNotNone(api_response.data) + self.assertEqual(api_response.data.sent_messages[0].id, "msg001") + + def test_reply_message_with_http_info(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/reply", + method="POST", + ).respond_with_json( + {"sentMessages": [{"id": "msg002", "quoteToken": "qt002"}]}, + status=200 + ) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + req = ReplyMessageRequest( + replyToken="reply-token-xxx", + messages=[TextMessage(text="hi")] + ) + api_response = client.reply_message_with_http_info( + reply_message_request=req + ) + + self.assertEqual(api_response.status_code, 200) + self.assertIsNotNone(api_response.headers) + + def test_get_profile_with_http_info(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/profile/U123", + method="GET", + ).respond_with_json( + {"displayName": "Test", "userId": "U123"}, status=200 + ) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + api_response = client.get_profile_with_http_info(user_id="U123") + + self.assertEqual(api_response.status_code, 200) + self.assertEqual(api_response.data.user_id, "U123") + self.assertEqual(api_response.data.display_name, "Test") + + +class TestLineBotClientBlobApi(unittest.TestCase): + """Test MessagingApiBlob delegation through LineBotClient.""" + + def test_get_message_content(self): + content = b"fake-binary-content" + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/msg123/content", + method="GET", + ).respond_with_data(content, status=200, content_type="image/jpeg") + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + result = client.get_message_content(message_id="msg123") + + self.assertEqual(result, content) + request, _ = httpserver.log[0] + self.assertEqual(request.method, "GET") + self.assertEqual(request.path, "/v2/bot/message/msg123/content") + + def test_get_message_content_with_http_info(self): + content = b"fake-binary-content" + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/msg456/content", + method="GET", + ).respond_with_data(content, status=200, content_type="video/mp4") + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + api_response = client.get_message_content_with_http_info( + message_id="msg456" + ) + + self.assertEqual(api_response.status_code, 200) + self.assertIsNotNone(api_response.data) + + +class TestLineBotClientErrors(unittest.TestCase): + """Test error handling through LineBotClient.""" + + def test_api_error_from_messaging(self): + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/message/push", + method="POST", + ).respond_with_json( + {"message": "Invalid request"}, + status=400 + ) + + with LineBotClient( + channel_access_token="test-token", + host=httpserver.url_for("/") + ) as client: + req = PushMessageRequest( + to="U123", + messages=[TextMessage(text="hello")] + ) + with self.assertRaises(MessagingApiException) as ctx: + client.push_message(push_message_request=req) + + self.assertEqual(ctx.exception.status, 400) + + +if __name__ == '__main__': + unittest.main() diff --git a/tools/generate_unified_client.py b/tools/generate_unified_client.py new file mode 100644 index 000000000..5bdc0dd03 --- /dev/null +++ b/tools/generate_unified_client.py @@ -0,0 +1,862 @@ +"""Generate unified LineBotClient and AsyncLineBotClient classes. + +This script parses all individual API client classes using the ast module +and generates unified client classes that delegate to the underlying clients. + +Client definitions are **auto-discovered** from the generated code so that +adding a new API module requires zero changes to this script. + +Run after generate-code.py: + python3 tools/generate_unified_client.py +""" + +import ast +import os +import re +import sys +from dataclasses import dataclass + + +# Modules to exclude from the unified client. +# - oauth: token management is done before client creation +# - webhooks: models-only module, no real API client +EXCLUDE_MODULES = frozenset({"oauth", "webhooks"}) + + +# --------------------------------------------------------------------------- +# Data Classes +# --------------------------------------------------------------------------- + +@dataclass +class ClientDef: + """Definition of a single API client to include in the unified client.""" + module: str # e.g. "messaging" + sync_file: str # path relative to repo root + sync_class: str # e.g. "MessagingApi" + async_file: str + async_class: str # e.g. "AsyncMessagingApi" + attr_name: str # attribute name on unified client, e.g. "_messaging_api" + base_url: str # e.g. "https://api.line.me" + + +@dataclass +class MethodInfo: + """Extracted information about a public API method.""" + name: str + params_source: str # parameter list source (excluding ``self``) + return_annotation: str # return type as source text + docstring: str | None + + +# --------------------------------------------------------------------------- +# Auto-Discovery +# --------------------------------------------------------------------------- + +def discover_clients(repo_root: str) -> list[ClientDef]: + """Auto-discover API client classes from generated code under ``linebot/v3/``. + + Scans each module directory for sync/async API file pairs, parses them + with AST to extract class names and base URLs. + """ + v3_dir = os.path.join(repo_root, "linebot", "v3") + clients: list[ClientDef] = [] + + for module_name in sorted(os.listdir(v3_dir)): + if module_name.startswith("_") or module_name in EXCLUDE_MODULES: + continue + module_dir = os.path.join(v3_dir, module_name) + api_dir = os.path.join(module_dir, "api") + if not os.path.isdir(api_dir): + continue + # Must have configuration.py to be a proper API module + if not os.path.isfile(os.path.join(module_dir, "configuration.py")): + continue + + for filename in sorted(os.listdir(api_dir)): + if not filename.endswith(".py"): + continue + # Skip async files (handled as counterparts) and __init__.py + if filename.startswith("async_") or filename == "__init__.py": + continue + + sync_path = os.path.join(api_dir, filename) + result = _parse_api_file(sync_path) + if result is None: + continue + sync_class, base_url = result + + # Find async counterpart: async_{filename} + async_path = os.path.join(api_dir, f"async_{filename}") + if not os.path.isfile(async_path): + continue + async_result = _parse_api_file(async_path) + if async_result is None: + continue + async_class = async_result[0] + + attr_name = "_" + _camel_to_snake(sync_class) + + clients.append(ClientDef( + module=module_name, + sync_file=os.path.relpath(sync_path, repo_root), + sync_class=sync_class, + async_file=os.path.relpath(async_path, repo_root), + async_class=async_class, + attr_name=attr_name, + base_url=base_url, + )) + + return clients + + +def _parse_api_file(filepath: str) -> tuple[str, str] | None: + """Parse an API source file and extract the main class name and base URL. + + Looks for a class with ``self.line_base_path = "..."`` in its ``__init__``. + Returns ``(class_name, base_url)`` or ``None``. + """ + with open(filepath, "r") as f: + source = f.read() + + tree = ast.parse(source) + + for node in ast.iter_child_nodes(tree): + if not isinstance(node, ast.ClassDef): + continue + for item in node.body: + if not isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef)): + continue + if item.name != "__init__": + continue + for stmt in ast.walk(item): + if not isinstance(stmt, ast.Assign): + continue + for target in stmt.targets: + if (isinstance(target, ast.Attribute) + and isinstance(target.value, ast.Name) + and target.value.id == "self" + and target.attr == "line_base_path" + and isinstance(stmt.value, ast.Constant) + and isinstance(stmt.value.value, str)): + return (node.name, stmt.value.value) + + return None + + +def _camel_to_snake(name: str) -> str: + """Convert CamelCase to snake_case. + + ``MessagingApiBlob`` -> ``messaging_api_blob`` + """ + s1 = re.sub(r"([A-Z]+)([A-Z][a-z])", r"\1_\2", name) + return re.sub(r"([a-z\d])([A-Z])", r"\1_\2", s1).lower() + + +def _module_alias(module_name: str) -> str: + """Derive a PascalCase prefix from a module directory name for import aliases. + + ``messaging`` -> ``Messaging``, ``moduleattach`` -> ``Moduleattach``. + """ + return module_name[0].upper() + module_name[1:] + + +# --------------------------------------------------------------------------- +# AST Method Extraction +# --------------------------------------------------------------------------- + +def _extract_params_source( + func: ast.FunctionDef, + exclude_params: frozenset[str] | None = None, +) -> str: + """Extract parameters source (without ``self``) from a function def.""" + parts: list[str] = [] + args = func.args + + all_args = args.args[1:] # skip self + num_defaults = len(args.defaults) + num_args = len(all_args) + + for i, arg in enumerate(all_args): + if exclude_params and arg.arg in exclude_params: + continue + part = arg.arg + if arg.annotation: + part += ": " + ast.unparse(arg.annotation) + default_index = i - (num_args - num_defaults) + if default_index >= 0: + part += " = " + ast.unparse(args.defaults[default_index]) + parts.append(part) + + return ", ".join(parts) + + +def _is_deprecation_wrapper(func_node: ast.FunctionDef) -> bool: + """Return True if the method body contains ``warnings.warn(..., DeprecationWarning)``.""" + for node in ast.walk(func_node): + if not isinstance(node, ast.Call): + continue + if (isinstance(node.func, ast.Attribute) + and node.func.attr == "warn" + and isinstance(node.func.value, ast.Name) + and node.func.value.id == "warnings"): + for arg in node.args: + if isinstance(arg, ast.Name) and arg.id == "DeprecationWarning": + return True + return False + + +def _unwrap_awaitable_union(returns: ast.expr) -> str: + """Unwrap ``Union[T, Awaitable[T]]`` to ``T`` for async method signatures. + + If the return annotation is ``Union[X, Awaitable[X]]``, returns the + unparsed source for ``X``. Otherwise falls back to ``ast.unparse()``. + """ + if (isinstance(returns, ast.Subscript) + and isinstance(returns.value, ast.Name) + and returns.value.id == "Union" + and isinstance(returns.slice, ast.Tuple) + and len(returns.slice.elts) == 2): + second = returns.slice.elts[1] + if (isinstance(second, ast.Subscript) + and isinstance(second.value, ast.Name) + and second.value.id == "Awaitable"): + return ast.unparse(returns.slice.elts[0]) + return ast.unparse(returns) + + +# Regex for ``# noqa: ...`` suffixes. +_NOQA_RE = re.compile(r'\s*#\s*noqa\b.*') + +# Lines that match any of these patterns are dropped entirely. +_DROP_LINE_PATTERNS: list[re.Pattern[str]] = [ + re.compile(r'>>> thread = api\.'), + re.compile(r'>>> result = thread\.get\(\)'), + re.compile(r':param async_req:'), + re.compile(r':type async_req:'), + re.compile(r':param _request_timeout:'), + re.compile(r':param _preload_content:'), + re.compile(r':type _preload_content:'), + re.compile(r':param _return_http_data_only:'), + re.compile(r':type _return_http_data_only:'), + re.compile(r':param _request_auth:'), + re.compile(r':type _request_auth:'), + re.compile(r':type _content_type:'), + re.compile(r'If the method is called asynchronously,'), + re.compile(r'returns the request thread\.'), +] + + +def _clean_docstring_for_unified( + docstring: str | None, + method_name: str, +) -> str | None: + """Clean up a docstring for the unified client. + + Removes fragments that are not relevant to the unified client wrapper: + + * Redundant operationId first line (just repeats the method name). + * ``# noqa: E501`` suffixes. + * ``async_req``-related boilerplate (examples, param docs). + * ``_``-prefixed internal parameter docs (``_request_timeout``, etc.). + * "This method makes a synchronous HTTP request…" block. + * Multi-line continuation of ``_request_timeout`` description. + """ + if not docstring: + return docstring + + lines = docstring.split('\n') + cleaned: list[str] = [] + skip_block = False + + for line in lines: + stripped = line.strip() + + # --- Skip multi-line continuations of a dropped block ---- + if skip_block: + # Continuation lines are indented non-`:` text. A new + # ``:param`` / ``:type`` / ``:return`` / ``:rtype`` or a + # blank line ends the block. + if stripped and not stripped.startswith(':'): + continue + skip_block = False + + # --- Drop the first line if it's just the operationId ---- + if not cleaned: + bare = _NOQA_RE.sub('', stripped) + # operationId matches method_name or its _with_http_info base + if bare == method_name or bare == method_name.removesuffix('_with_http_info'): + continue + + # --- "This method makes a synchronous HTTP request…" block --- + if stripped.startswith('This method makes a synchronous'): + # May span 2 lines; skip until we see a blank or `:` + skip_block = True + continue + + # --- Pattern-based line drops --- + drop = False + for pat in _DROP_LINE_PATTERNS: + if pat.search(stripped): + # :param / :type descriptions can span multiple lines + if stripped.startswith(':param') or stripped.startswith(':type'): + skip_block = True + drop = True + break + if drop: + continue + + # --- Strip ``# noqa`` suffixes --- + line = _NOQA_RE.sub('', line) + cleaned.append(line) + + # Collapse multiple consecutive blank lines + result: list[str] = [] + prev_blank = False + for line in cleaned: + if line.strip() == '': + if prev_blank: + continue + prev_blank = True + else: + prev_blank = False + result.append(line) + + # Strip trailing blank lines + while result and result[-1].strip() == '': + result.pop() + + return '\n'.join(result).strip() or None + + +def extract_methods( + filepath: str, + class_name: str, + *, + is_async: bool = False, +) -> list[MethodInfo]: + """Parse a Python source file and extract public methods from the given class. + + When *is_async* is ``True`` the extracted signatures are additionally + cleaned up for the async unified client: + + * The ``async_req`` parameter is excluded. + * ``Union[T, Awaitable[T]]`` return annotations are unwrapped to ``T``. + + Docstrings are always cleaned for the unified client (both sync and async). + """ + with open(filepath, "r") as f: + source = f.read() + + tree = ast.parse(source) + + target_class: ast.ClassDef | None = None + for node in ast.walk(tree): + if isinstance(node, ast.ClassDef) and node.name == class_name: + target_class = node + break + + if target_class is None: + raise ValueError(f"Class {class_name} not found in {filepath}") + + exclude = frozenset({"async_req"}) if is_async else None + + methods: list[MethodInfo] = [] + for item in target_class.body: + if not isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef)): + continue + + name = item.name + + # Skip private / dunder methods + if name.startswith("_"): + continue + + # Skip @overload stubs (async files have these) + if any( + (isinstance(dec, ast.Name) and dec.id == "overload") + or (isinstance(dec, ast.Attribute) and dec.attr == "overload") + for dec in item.decorator_list + ): + continue + + # Skip deprecation wrappers (e.g. liff backward-compat aliases) + if _is_deprecation_wrapper(item): + continue + + params_source = _extract_params_source(item, exclude_params=exclude) + + ret_ann = "" + if item.returns: + if is_async: + ret_ann = _unwrap_awaitable_union(item.returns) + else: + ret_ann = ast.unparse(item.returns) + + docstring = ast.get_docstring(item) + docstring = _clean_docstring_for_unified(docstring, name) + + methods.append(MethodInfo( + name=name, + params_source=params_source, + return_annotation=ret_ann, + docstring=docstring, + )) + + return methods + + +# --------------------------------------------------------------------------- +# Import Collection +# --------------------------------------------------------------------------- + +def collect_model_imports(filepath: str) -> list[str]: + """Collect ``from linebot.v3.*.models.* import *`` lines from a source file.""" + imports: list[str] = [] + with open(filepath, "r") as f: + for line in f: + stripped = line.strip() + if stripped.startswith("from linebot.v3.") and ".models." in stripped: + imports.append(stripped) + return imports + + +def collect_typed_imports(filepath: str) -> dict[str, set[str]]: + """Collect typing / pydantic import names, grouped by source module.""" + result: dict[str, set[str]] = {} + with open(filepath, "r") as f: + for line in f: + stripped = line.strip() + for prefix in ("from typing_extensions import ", + "from typing import ", + "from pydantic.v1 import "): + if stripped.startswith(prefix): + module = prefix.replace("from ", "").replace(" import ", "").strip() + after_import = stripped[len(prefix):] + names = result.setdefault(module, set()) + for name in after_import.split(","): + name = name.strip().rstrip(")").split("#")[0].strip() + if name: + names.add(name) + break + return result + + +# --------------------------------------------------------------------------- +# Code Generation Helpers +# --------------------------------------------------------------------------- + +def _format_docstring(docstring: str, indent: str = ' ') -> list[str]: + """Format a multi-line docstring for embedding in generated code. + + The *docstring* is expected to be the already-cleaned output of + ``ast.get_docstring()`` (leading/trailing blank lines stripped, + common indent removed). + """ + if not docstring: + return [] + + doc_lines = docstring.split('\n') + if len(doc_lines) == 1: + return [f'{indent}"""{doc_lines[0]}"""'] + + result: list[str] = [] + result.append(f'{indent}"""{doc_lines[0]}') + for line in doc_lines[1:]: + if line.strip(): + result.append(f'{indent}{line}') + else: + result.append('') + result.append(f'{indent}"""') + return result + + +def _extract_call_args_from_params(params_source: str) -> str: + """Extract call argument names from a parameter source string. + + ``'req : Request, key : Optional[str] = None, **kwargs'`` + -> ``'req, key, **kwargs'`` + """ + if not params_source: + return "" + + parts: list[str] = [] + depth = 0 + current = "" + for ch in params_source + ",": + if ch in "([{": + depth += 1 + current += ch + elif ch in ")]}": + depth -= 1 + current += ch + elif ch == "," and depth == 0: + param = current.strip() + if param: + if param.startswith("**") or param.startswith("*"): + pass # skip *args / **kwargs + else: + name = param.split(":")[0].split("=")[0].strip() + parts.append(name) + current = "" + else: + current += ch + + return ", ".join(parts) + + +def _filter_imports( + candidates: dict[str, set[str]], + body_text: str, +) -> dict[str, set[str]]: + """Return only the import names from *candidates* that appear in *body_text*.""" + result: dict[str, set[str]] = {} + for mod, names in candidates.items(): + used = {n for n in names if re.search(rf'\b{re.escape(n)}\b', body_text)} + if used: + result[mod] = used + return result + + +# --------------------------------------------------------------------------- +# Code Generation +# --------------------------------------------------------------------------- + +def _generate_client( + repo_root: str, + client_defs: list[ClientDef], + unique_modules: list[str], + *, + is_async: bool, +) -> None: + """Generate a unified client file (sync or async). + + The two variants share the vast majority of their logic; the *is_async* + flag controls the handful of differences (class name, context-manager + protocol, ``await`` keywords, etc.). + """ + class_name = "AsyncLineBotClient" if is_async else "LineBotClient" + output_file = "async_line_bot_client.py" if is_async else "line_bot_client.py" + api_client_cls = "AsyncApiClient" if is_async else "ApiClient" + api_client_mod = "async_api_client" if is_async else "api_client" + + # --- Collect methods and imports from underlying API files ------------ + all_model_imports: set[str] = set() + all_typed_imports: dict[str, set[str]] = {} + all_methods: list[tuple[ClientDef, MethodInfo, str]] = [] + + for cdef in client_defs: + filepath = os.path.join( + repo_root, cdef.async_file if is_async else cdef.sync_file + ) + all_model_imports.update(collect_model_imports(filepath)) + for mod, names in collect_typed_imports(filepath).items(): + all_typed_imports.setdefault(mod, set()).update(names) + + target_class = cdef.async_class if is_async else cdef.sync_class + methods = extract_methods(filepath, target_class, is_async=is_async) + for m in methods: + call_args = _extract_call_args_from_params(m.params_source) + all_methods.append((cdef, m, call_args)) + + # Check for duplicate method names (once is enough) + if not is_async: + seen: set[str] = set() + for _, m, _ in all_methods: + if m.name in seen: + print(f"WARNING: Duplicate method name: {m.name}", file=sys.stderr) + seen.add(m.name) + + # --- Build class body lines first (needed for import filtering) ------- + body: list[str] = [] + mod_list = ", ".join(f"``{m}``" for m in unique_modules) + + # Class definition + docstring + body.append(f'class {class_name}:') + if is_async: + body.append(' """Async version of :class:`LineBotClient`.') + body.append('') + body.append(' Wraps all LINE API subpackages into a single async client so that') + body.append(' every API method can be called through one instance.') + body.append(' See :class:`LineBotClient` for details.') + else: + body.append(' """A single entry-point client that wraps all LINE API operations.') + body.append('') + body.append(' The LINE Bot SDK v3 splits API operations across multiple subpackages') + body.append(' (messaging, audience, insight, liff, etc.), each with its own') + body.append(' ``Configuration``, ``ApiClient``, and API class.') + body.append(f' ``{class_name}`` consolidates them so that you can call every') + body.append(' API method through one instance with a single ``channel_access_token``.') + body.append('') + body.append(f' Wrapped subpackages: {mod_list}.') + body.append('') + body.append(' Auto-generated by ``tools/generate_unified_client.py``.') + body.append(' Do not edit manually.') + body.append('') + body.append(' Usage::') + body.append('') + body.append(f' from linebot.v3 import {class_name}') + body.append('') + if is_async: + body.append(f' async with {class_name}(channel_access_token="YOUR_TOKEN") as client:') + body.append(' await client.reply_message(...)') + else: + body.append(f' with {class_name}(channel_access_token="YOUR_TOKEN") as client:') + body.append(' client.reply_message(...)') + body.append(' """') + body.append('') + + # __init__ + body.append(' def __init__(self, channel_access_token: str, **kwargs) -> None:') + init_doc = "Create a unified async LINE Bot client." if is_async else "Create a unified LINE Bot client." + body.append(f' """{init_doc}') + body.append('') + body.append(' :param str channel_access_token: Channel access token.') + body.append(' :param kwargs: Additional keyword arguments passed to each Configuration.') + body.append(' """') + + for mod in unique_modules: + alias = _module_alias(mod) + body.append(f' self._{mod}_configuration = {alias}Configuration(') + body.append(f' access_token=channel_access_token, **kwargs') + body.append(f' )') + body.append(f' self._{mod}_api_client = {alias}{api_client_cls}(') + body.append(f' self._{mod}_configuration') + body.append(f' )') + body.append('') + + for cdef in client_defs: + target_class = cdef.async_class if is_async else cdef.sync_class + body.append( + f' self.{cdef.attr_name} = {target_class}(self._{cdef.module}_api_client)' + ) + body.append('') + + # Context manager + close + if is_async: + body.append(' async def __aenter__(self):') + body.append(' return self') + body.append('') + body.append(' async def __aexit__(self, exc_type, exc_value, traceback):') + body.append(' await self.close()') + body.append('') + body.append(' async def close(self) -> None:') + body.append(' """Close all underlying async API clients."""') + body.append(' errors: list[BaseException] = []') + for mod in unique_modules: + body.append(f' try:') + body.append(f' await self._{mod}_api_client.close()') + body.append(f' except Exception as e:') + body.append(f' errors.append(e)') + else: + body.append(' def __enter__(self):') + body.append(' return self') + body.append('') + body.append(' def __exit__(self, exc_type, exc_value, traceback):') + body.append(' self.close()') + body.append('') + body.append(' def close(self) -> None:') + body.append(' """Close all underlying API clients."""') + body.append(' errors: list[BaseException] = []') + for mod in unique_modules: + body.append(f' try:') + body.append(f' self._{mod}_api_client.close()') + body.append(f' except Exception as e:') + body.append(f' errors.append(e)') + body.append(' if errors:') + body.append(' raise errors[0]') + body.append('') + + # Delegating methods + def_kw = "async def" if is_async else "def" + await_kw = "return await" if is_async else "return" + for cdef, method, call_args in all_methods: + # Replace bare ``ApiResponse`` with the module-specific alias so the + # return annotation matches the type actually returned at runtime. + ret_ann = method.return_annotation + if ret_ann: + module_alias = _module_alias(cdef.module) + ret_ann = re.sub(r'\bApiResponse\b', f'{module_alias}ApiResponse', ret_ann) + ret_part = f' -> {ret_ann}' if ret_ann else '' + if method.params_source: + sig = f' {def_kw} {method.name}(self, {method.params_source}){ret_part}:' + else: + sig = f' {def_kw} {method.name}(self){ret_part}:' + body.append(sig) + + if method.docstring: + body.extend(_format_docstring(method.docstring)) + body.append(f' {await_kw} self.{cdef.attr_name}.{method.name}({call_args})') + body.append('') + + # --- Filter imports to only those actually used in the body ----------- + body_text = "\n".join(body) + filtered_typed = _filter_imports(all_typed_imports, body_text) + + # --- Assemble final file: header + imports + body -------------------- + lines: list[str] = [] + lines.append('# coding: utf-8') + lines.append('') + + # Auto-generated comment (no module docstring — it leaks into Sphinx output) + lines.append('# Auto-generated by tools/generate_unified_client.py. Do not edit manually.') + lines.append('') + + # Typing / pydantic imports (filtered to actually used names) + for mod in ("typing", "typing_extensions", "pydantic.v1"): + names = filtered_typed.get(mod, set()) + if names: + lines.append(f'from {mod} import {", ".join(sorted(names))}') + lines.append('') + + # Configuration and ApiClient imports with aliases + for mod in unique_modules: + alias = _module_alias(mod) + lines.append( + f'from linebot.v3.{mod}.configuration import Configuration as {alias}Configuration' + ) + lines.append( + f'from linebot.v3.{mod}.{api_client_mod} import {api_client_cls} as {alias}{api_client_cls}' + ) + lines.append('') + + # API class imports + for cdef in client_defs: + filepath = cdef.async_file if is_async else cdef.sync_file + pkg = filepath.replace("/", ".").replace(".py", "") + target_class = cdef.async_class if is_async else cdef.sync_class + lines.append(f'from {pkg} import {target_class}') + # ApiResponse — each subpackage defines its own distinct class; import + # each with a module-specific alias so _with_http_info wrappers annotate + # the correct runtime type. + for mod in unique_modules: + alias = _module_alias(mod) + lines.append( + f'from linebot.v3.{mod}.api_response import ApiResponse as {alias}ApiResponse' + ) + lines.append('') + + # Model imports (sorted, deduplicated) + for imp in sorted(all_model_imports): + lines.append(imp) + lines.append('') + lines.append('') + + # Append class body + lines.extend(body) + + # Write output + output_path = os.path.join(repo_root, "linebot/v3", output_file) + with open(output_path, "w") as f: + f.write("\n".join(lines) + "\n") + print(f"Generated {output_path} ({len(all_methods)} methods)") + + +def inject_docstring_references( + repo_root: str, + client_defs: list[ClientDef], +) -> None: + """Insert a ``.. tip::`` reference to the unified client in each wrapped class's docstring.""" + + # The class docstring in every generated API file ends with: + # Do not edit the class manually. + # """ + # (4-space indent distinguishes it from the module-level docstring whose + # closing ``"""`` sits at column 0.) + OLD_TAIL = ' Do not edit the class manually.\n """' + + def _build_new_tail(unified_class: str) -> str: + return ( + ' Do not edit the class manually.\n' + '\n' + f' Tip: Use :class:`linebot.v3.{unified_class}` to call every\n' + ' LINE API method through a single instance.\n' + ' """' + ) + + count = 0 + processed: set[str] = set() + for cdef in client_defs: + for filepath, unified in ( + (os.path.join(repo_root, cdef.sync_file), "LineBotClient"), + (os.path.join(repo_root, cdef.async_file), "AsyncLineBotClient"), + ): + if filepath in processed: + continue + processed.add(filepath) + + with open(filepath, "r") as f: + content = f.read() + + new_tail = _build_new_tail(unified) + + # Idempotency: already injected + if new_tail in content: + continue + + if OLD_TAIL not in content: + print(f"WARNING: docstring pattern not found in {filepath}", + file=sys.stderr) + continue + + # Replace only the first occurrence (the class docstring) + content = content.replace(OLD_TAIL, new_tail, 1) + with open(filepath, "w") as f: + f.write(content) + count += 1 + + print(f"Injected unified-client references into {count} files") + + + + + +def update_init_file(repo_root: str) -> None: + """Add LineBotClient and AsyncLineBotClient exports to ``linebot/v3/__init__.py``.""" + init_path = os.path.join(repo_root, "linebot/v3/__init__.py") + with open(init_path, "r") as f: + content = f.read() + + sync_import = "from .line_bot_client import LineBotClient # noqa" + async_import = "from .async_line_bot_client import AsyncLineBotClient # noqa" + + if sync_import in content: + return + + with open(init_path, "a") as f: + f.write(f"\n{sync_import}\n{async_import}\n") + + print(f"Updated {init_path}") + + +# --------------------------------------------------------------------------- +# Main +# --------------------------------------------------------------------------- + +def main() -> None: + script_dir = os.path.dirname(os.path.abspath(__file__)) + repo_root = os.path.dirname(script_dir) + + if not os.path.exists(os.path.join(repo_root, "linebot/v3/__init__.py")): + print("Error: Cannot find linebot/v3/__init__.py. " + "Run this script from the repository root or the tools/ directory.", + file=sys.stderr) + sys.exit(1) + + client_defs = discover_clients(repo_root) + unique_modules = list(dict.fromkeys(c.module for c in client_defs)) + + print(f"Discovered {len(client_defs)} API clients across " + f"{len(unique_modules)} modules:") + for cdef in client_defs: + print(f" {cdef.module}: {cdef.sync_class} / {cdef.async_class}") + + _generate_client(repo_root, client_defs, unique_modules, is_async=False) + _generate_client(repo_root, client_defs, unique_modules, is_async=True) + inject_docstring_references(repo_root, client_defs) + update_init_file(repo_root) + + print("Done.") + + +if __name__ == "__main__": + main()