diff --git a/.gitignore b/.gitignore index 3b1a0128..951e90d7 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,6 @@ tmp/ *.iml .openapi-generator + +# github workflow +pr_info.json diff --git a/linebot/v3/messaging/__init__.py b/linebot/v3/messaging/__init__.py index d050ec19..c02b2244 100644 --- a/linebot/v3/messaging/__init__.py +++ b/linebot/v3/messaging/__init__.py @@ -44,7 +44,6 @@ from linebot.v3.messaging.models.app_type_demographic_filter import AppTypeDemographicFilter from linebot.v3.messaging.models.area_demographic import AreaDemographic from linebot.v3.messaging.models.area_demographic_filter import AreaDemographicFilter -from linebot.v3.messaging.models.audience_match_messages_request import AudienceMatchMessagesRequest from linebot.v3.messaging.models.audience_recipient import AudienceRecipient from linebot.v3.messaging.models.audio_message import AudioMessage from linebot.v3.messaging.models.bot_info_response import BotInfoResponse diff --git a/linebot/v3/messaging/api/async_messaging_api.py b/linebot/v3/messaging/api/async_messaging_api.py index c53fb8c5..6735a609 100644 --- a/linebot/v3/messaging/api/async_messaging_api.py +++ b/linebot/v3/messaging/api/async_messaging_api.py @@ -24,7 +24,6 @@ from typing import Any, Dict, Optional -from linebot.v3.messaging.models.audience_match_messages_request import AudienceMatchMessagesRequest from linebot.v3.messaging.models.bot_info_response import BotInfoResponse from linebot.v3.messaging.models.broadcast_request import BroadcastRequest from linebot.v3.messaging.models.create_rich_menu_alias_request import CreateRichMenuAliasRequest @@ -93,158 +92,6 @@ def __init__(self, api_client=None): self.line_base_path = "https://api.line.me" - @overload - async def audience_match(self, audience_match_messages_request : AudienceMatchMessagesRequest, **kwargs) -> None: # noqa: E501 - ... - - @overload - def audience_match(self, audience_match_messages_request : AudienceMatchMessagesRequest, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 - ... - - @validate_arguments - def audience_match(self, audience_match_messages_request : AudienceMatchMessagesRequest, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 - """audience_match # noqa: E501 - - Send a message using phone number # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.audience_match(audience_match_messages_request, async_req=True) - >>> result = thread.get() - - :param audience_match_messages_request: (required) - :type audience_match_messages_request: AudienceMatchMessagesRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the audience_match_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - if async_req is not None: - kwargs['async_req'] = async_req - return self.audience_match_with_http_info(audience_match_messages_request, **kwargs) # noqa: E501 - - @validate_arguments - def audience_match_with_http_info(self, audience_match_messages_request : AudienceMatchMessagesRequest, **kwargs) -> ApiResponse: # noqa: E501 - """audience_match # noqa: E501 - - Send a message using phone number # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.audience_match_with_http_info(audience_match_messages_request, async_req=True) - >>> result = thread.get() - - :param audience_match_messages_request: (required) - :type audience_match_messages_request: AudienceMatchMessagesRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _host = self.line_base_path - _params = locals() - - _all_params = [ - 'audience_match_messages_request' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method audience_match" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['audience_match_messages_request'] is not None: - _body_params = _params['audience_match_messages_request'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['Bearer'] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - '/bot/ad/multicast/phone', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - @overload async def 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, **kwargs) -> object: # noqa: E501 ... diff --git a/linebot/v3/messaging/api/messaging_api.py b/linebot/v3/messaging/api/messaging_api.py index 55753ba8..b56840fc 100644 --- a/linebot/v3/messaging/api/messaging_api.py +++ b/linebot/v3/messaging/api/messaging_api.py @@ -22,7 +22,6 @@ from typing import Any, Dict, Optional -from linebot.v3.messaging.models.audience_match_messages_request import AudienceMatchMessagesRequest from linebot.v3.messaging.models.bot_info_response import BotInfoResponse from linebot.v3.messaging.models.broadcast_request import BroadcastRequest from linebot.v3.messaging.models.create_rich_menu_alias_request import CreateRichMenuAliasRequest @@ -91,148 +90,6 @@ def __init__(self, api_client=None): self.line_base_path = "https://api.line.me" - @validate_arguments - def audience_match(self, audience_match_messages_request : AudienceMatchMessagesRequest, **kwargs) -> None: # noqa: E501 - """audience_match # noqa: E501 - - Send a message using phone number # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.audience_match(audience_match_messages_request, async_req=True) - >>> result = thread.get() - - :param audience_match_messages_request: (required) - :type audience_match_messages_request: AudienceMatchMessagesRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - raise ValueError("Error! Please call the audience_match_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") - return self.audience_match_with_http_info(audience_match_messages_request, **kwargs) # noqa: E501 - - @validate_arguments - def audience_match_with_http_info(self, audience_match_messages_request : AudienceMatchMessagesRequest, **kwargs) -> ApiResponse: # noqa: E501 - """audience_match # noqa: E501 - - Send a message using phone number # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.audience_match_with_http_info(audience_match_messages_request, async_req=True) - >>> result = thread.get() - - :param audience_match_messages_request: (required) - :type audience_match_messages_request: AudienceMatchMessagesRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _host = self.line_base_path - _params = locals() - - _all_params = [ - 'audience_match_messages_request' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method audience_match" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['audience_match_messages_request'] is not None: - _body_params = _params['audience_match_messages_request'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['Bearer'] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - '/bot/ad/multicast/phone', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - @validate_arguments def 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, **kwargs) -> object: # noqa: E501 """broadcast # noqa: E501 diff --git a/linebot/v3/messaging/docs/MessagingApi.md b/linebot/v3/messaging/docs/MessagingApi.md index 8b5e2663..45faed47 100644 --- a/linebot/v3/messaging/docs/MessagingApi.md +++ b/linebot/v3/messaging/docs/MessagingApi.md @@ -4,7 +4,6 @@ All URIs are relative to *https://api.line.me* Method | HTTP request | Description ------------- | ------------- | ------------- -[**audience_match**](MessagingApi.md#audience_match) | **POST** /bot/ad/multicast/phone | [**broadcast**](MessagingApi.md#broadcast) | **POST** /v2/bot/message/broadcast | [**cancel_default_rich_menu**](MessagingApi.md#cancel_default_rich_menu) | **DELETE** /v2/bot/user/all/richmenu | [**create_rich_menu**](MessagingApi.md#create_rich_menu) | **POST** /v2/bot/richmenu | @@ -70,79 +69,6 @@ Method | HTTP request | Description [**validate_rich_menu_object**](MessagingApi.md#validate_rich_menu_object) | **POST** /v2/bot/richmenu/validate | -# **audience_match** -> audience_match(audience_match_messages_request) - - - -Send a message using phone number - -### Example - -* Bearer Authentication (Bearer): -```python -import time -import os -import linebot.v3.messaging -from linebot.v3.messaging.models.audience_match_messages_request import AudienceMatchMessagesRequest -from linebot.v3.messaging.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://api.line.me -# See configuration.py for a list of all supported configuration parameters. -configuration = linebot.v3.messaging.Configuration( - host = "https://api.line.me" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure Bearer authorization: Bearer -configuration = linebot.v3.messaging.Configuration( - access_token = os.environ["BEARER_TOKEN"] -) - -# Enter a context with an instance of the API client -with linebot.v3.messaging.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = linebot.v3.messaging.MessagingApi(api_client) - audience_match_messages_request = linebot.v3.messaging.AudienceMatchMessagesRequest() # AudienceMatchMessagesRequest | - - try: - api_instance.audience_match(audience_match_messages_request) - except Exception as e: - print("Exception when calling MessagingApi->audience_match: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **audience_match_messages_request** | [**AudienceMatchMessagesRequest**](AudienceMatchMessagesRequest.md)| | - -### Return type - -void (empty response body) - -### Authorization - -[Bearer](../README.md#Bearer) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **broadcast** > object broadcast(broadcast_request, x_line_retry_key=x_line_retry_key) diff --git a/linebot/v3/messaging/models/__init__.py b/linebot/v3/messaging/models/__init__.py index 63a262da..dced3bfd 100644 --- a/linebot/v3/messaging/models/__init__.py +++ b/linebot/v3/messaging/models/__init__.py @@ -23,7 +23,6 @@ from linebot.v3.messaging.models.app_type_demographic_filter import AppTypeDemographicFilter from linebot.v3.messaging.models.area_demographic import AreaDemographic from linebot.v3.messaging.models.area_demographic_filter import AreaDemographicFilter -from linebot.v3.messaging.models.audience_match_messages_request import AudienceMatchMessagesRequest from linebot.v3.messaging.models.audience_recipient import AudienceRecipient from linebot.v3.messaging.models.audio_message import AudioMessage from linebot.v3.messaging.models.bot_info_response import BotInfoResponse diff --git a/linebot/v3/messaging/models/audience_match_messages_request.py b/linebot/v3/messaging/models/audience_match_messages_request.py deleted file mode 100644 index f7927c2b..00000000 --- a/linebot/v3/messaging/models/audience_match_messages_request.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding: utf-8 - -""" - LINE Messaging API - - This document describes LINE Messaging API. # noqa: E501 - - The version of the OpenAPI document: 0.0.1 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic.v1 import BaseModel, Field, StrictBool, StrictStr, conlist -from linebot.v3.messaging.models.message import Message - -class AudienceMatchMessagesRequest(BaseModel): - """ - AudienceMatchMessagesRequest - https://developers.line.biz/en/reference/partner-docs/#phone-audience-match - """ - messages: conlist(Message, max_items=5, min_items=1) = Field(..., description="Destination of the message (A value obtained by hashing the telephone number, which is another value normalized to E.164 format, with SHA256).") - to: conlist(StrictStr, max_items=500, min_items=1) = Field(..., description="Message to send.") - notification_disabled: Optional[StrictBool] = Field(False, alias="notificationDisabled", description="`true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. ") - - __properties = ["messages", "to", "notificationDisabled"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> AudienceMatchMessagesRequest: - """Create an instance of AudienceMatchMessagesRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic.v1 by calling `to_dict()` of each item in messages (list) - _items = [] - if self.messages: - for _item in self.messages: - if _item: - _items.append(_item.to_dict()) - _dict['messages'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> AudienceMatchMessagesRequest: - """Create an instance of AudienceMatchMessagesRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return AudienceMatchMessagesRequest.parse_obj(obj) - - _obj = AudienceMatchMessagesRequest.parse_obj({ - "messages": [Message.from_dict(_item) for _item in obj.get("messages")] if obj.get("messages") is not None else None, - "to": obj.get("to"), - "notification_disabled": obj.get("notificationDisabled") if obj.get("notificationDisabled") is not None else False - }) - return _obj -