diff --git a/line-openapi b/line-openapi index 92f9320b..b4589bc6 160000 --- a/line-openapi +++ b/line-openapi @@ -1 +1 @@ -Subproject commit 92f9320b891ee6a071c93220ce4a3e34e1f4d38b +Subproject commit b4589bc62a4c1a42016a08e2b8945154e10e7193 diff --git a/linebot/v3/messaging/__init__.py b/linebot/v3/messaging/__init__.py index b973542f..cd9987bf 100644 --- a/linebot/v3/messaging/__init__.py +++ b/linebot/v3/messaging/__init__.py @@ -35,6 +35,8 @@ from linebot.v3.messaging.exceptions import ApiException # import models into sdk package +from linebot.v3.messaging.models.acquisition_condition_request import AcquisitionConditionRequest +from linebot.v3.messaging.models.acquisition_condition_response import AcquisitionConditionResponse from linebot.v3.messaging.models.action import Action from linebot.v3.messaging.models.age_demographic import AgeDemographic from linebot.v3.messaging.models.age_demographic_filter import AgeDemographicFilter @@ -53,13 +55,44 @@ from linebot.v3.messaging.models.camera_roll_action import CameraRollAction from linebot.v3.messaging.models.carousel_column import CarouselColumn from linebot.v3.messaging.models.carousel_template import CarouselTemplate +from linebot.v3.messaging.models.cash_back_fixed_price_info_request import CashBackFixedPriceInfoRequest +from linebot.v3.messaging.models.cash_back_fixed_price_info_response import CashBackFixedPriceInfoResponse +from linebot.v3.messaging.models.cash_back_percentage_price_info_request import CashBackPercentagePriceInfoRequest +from linebot.v3.messaging.models.cash_back_percentage_price_info_response import CashBackPercentagePriceInfoResponse +from linebot.v3.messaging.models.cash_back_price_info_request import CashBackPriceInfoRequest +from linebot.v3.messaging.models.cash_back_price_info_response import CashBackPriceInfoResponse from linebot.v3.messaging.models.chat_reference import ChatReference from linebot.v3.messaging.models.clipboard_action import ClipboardAction from linebot.v3.messaging.models.clipboard_imagemap_action import ClipboardImagemapAction from linebot.v3.messaging.models.confirm_template import ConfirmTemplate +from linebot.v3.messaging.models.coupon_cash_back_reward_request import CouponCashBackRewardRequest +from linebot.v3.messaging.models.coupon_cash_back_reward_response import CouponCashBackRewardResponse +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_discount_reward_request import CouponDiscountRewardRequest +from linebot.v3.messaging.models.coupon_discount_reward_response import CouponDiscountRewardResponse +from linebot.v3.messaging.models.coupon_free_reward_request import CouponFreeRewardRequest +from linebot.v3.messaging.models.coupon_free_reward_response import CouponFreeRewardResponse +from linebot.v3.messaging.models.coupon_gift_reward_request import CouponGiftRewardRequest +from linebot.v3.messaging.models.coupon_gift_reward_response import CouponGiftRewardResponse +from linebot.v3.messaging.models.coupon_list_response import CouponListResponse +from linebot.v3.messaging.models.coupon_message import CouponMessage +from linebot.v3.messaging.models.coupon_others_reward_request import CouponOthersRewardRequest +from linebot.v3.messaging.models.coupon_others_reward_response import CouponOthersRewardResponse +from linebot.v3.messaging.models.coupon_response import CouponResponse +from linebot.v3.messaging.models.coupon_reward_request import CouponRewardRequest +from linebot.v3.messaging.models.coupon_reward_response import CouponRewardResponse from linebot.v3.messaging.models.create_rich_menu_alias_request import CreateRichMenuAliasRequest from linebot.v3.messaging.models.datetime_picker_action import DatetimePickerAction from linebot.v3.messaging.models.demographic_filter import DemographicFilter +from linebot.v3.messaging.models.discount_explicit_price_info_request import DiscountExplicitPriceInfoRequest +from linebot.v3.messaging.models.discount_explicit_price_info_response import DiscountExplicitPriceInfoResponse +from linebot.v3.messaging.models.discount_fixed_price_info_request import DiscountFixedPriceInfoRequest +from linebot.v3.messaging.models.discount_fixed_price_info_response import DiscountFixedPriceInfoResponse +from linebot.v3.messaging.models.discount_percentage_price_info_request import DiscountPercentagePriceInfoRequest +from linebot.v3.messaging.models.discount_percentage_price_info_response import DiscountPercentagePriceInfoResponse +from linebot.v3.messaging.models.discount_price_info_request import DiscountPriceInfoRequest +from linebot.v3.messaging.models.discount_price_info_response import DiscountPriceInfoResponse from linebot.v3.messaging.models.emoji import Emoji from linebot.v3.messaging.models.emoji_substitution_object import EmojiSubstitutionObject from linebot.v3.messaging.models.error_detail import ErrorDetail @@ -118,6 +151,8 @@ from linebot.v3.messaging.models.limit import Limit from linebot.v3.messaging.models.location_action import LocationAction from linebot.v3.messaging.models.location_message import LocationMessage +from linebot.v3.messaging.models.lottery_acquisition_condition_request import LotteryAcquisitionConditionRequest +from linebot.v3.messaging.models.lottery_acquisition_condition_response import LotteryAcquisitionConditionResponse from linebot.v3.messaging.models.mark_messages_as_read_request import MarkMessagesAsReadRequest from linebot.v3.messaging.models.members_ids_response import MembersIdsResponse from linebot.v3.messaging.models.membership import Membership @@ -128,9 +163,12 @@ from linebot.v3.messaging.models.message_action import MessageAction from linebot.v3.messaging.models.message_imagemap_action import MessageImagemapAction 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.normal_acquisition_condition_request import NormalAcquisitionConditionRequest +from linebot.v3.messaging.models.normal_acquisition_condition_response import NormalAcquisitionConditionResponse from linebot.v3.messaging.models.number_of_messages_response import NumberOfMessagesResponse from linebot.v3.messaging.models.operator_demographic_filter import OperatorDemographicFilter from linebot.v3.messaging.models.operator_recipient import OperatorRecipient @@ -144,6 +182,7 @@ from linebot.v3.messaging.models.quota_type import QuotaType from linebot.v3.messaging.models.recipient import Recipient from linebot.v3.messaging.models.redelivery_recipient import RedeliveryRecipient +from linebot.v3.messaging.models.referral_acquisition_condition_response import ReferralAcquisitionConditionResponse 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 diff --git a/linebot/v3/messaging/api/async_messaging_api.py b/linebot/v3/messaging/api/async_messaging_api.py index 25bf90e9..03823cb7 100644 --- a/linebot/v3/messaging/api/async_messaging_api.py +++ b/linebot/v3/messaging/api/async_messaging_api.py @@ -20,12 +20,15 @@ from typing_extensions import Annotated from typing import overload, Optional, Union, Awaitable -from pydantic.v1 import Field, StrictInt, StrictStr, conint, constr, validator +from pydantic.v1 import Field, StrictInt, StrictStr, conint, conlist, constr, validator from typing import Any, Dict, Optional 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 @@ -41,6 +44,7 @@ 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 @@ -400,6 +404,314 @@ def cancel_default_rich_menu_with_http_info(self, **kwargs) -> ApiResponse: # n collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @overload + async def close_coupon(self, coupon_id : StrictStr, **kwargs) -> None: # noqa: E501 + ... + + @overload + def close_coupon(self, coupon_id : StrictStr, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 + ... + + @validate_arguments + def close_coupon(self, coupon_id : StrictStr, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 + """close_coupon # noqa: E501 + + Close coupon # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.close_coupon(coupon_id, async_req=True) + >>> result = thread.get() + + :param coupon_id: (required) + :type coupon_id: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the close_coupon_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.close_coupon_with_http_info(coupon_id, **kwargs) # noqa: E501 + + @validate_arguments + def close_coupon_with_http_info(self, coupon_id : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 + """close_coupon # noqa: E501 + + Close coupon # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.close_coupon_with_http_info(coupon_id, async_req=True) + >>> result = thread.get() + + :param coupon_id: (required) + :type coupon_id: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'coupon_id' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method close_coupon" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['coupon_id']: + _path_params['couponId'] = _params['coupon_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/v2/bot/coupon/{couponId}/close', 'PUT', + _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 create_coupon(self, coupon_create_request : Optional[CouponCreateRequest] = None, **kwargs) -> CouponCreateResponse: # noqa: E501 + ... + + @overload + def create_coupon(self, coupon_create_request : Optional[CouponCreateRequest] = None, async_req: Optional[bool]=True, **kwargs) -> CouponCreateResponse: # noqa: E501 + ... + + @validate_arguments + def create_coupon(self, coupon_create_request : Optional[CouponCreateRequest] = None, async_req: Optional[bool]=None, **kwargs) -> Union[CouponCreateResponse, Awaitable[CouponCreateResponse]]: # noqa: E501 + """create_coupon # noqa: E501 + + Create a new coupon. Define coupon details such as type, title, and validity period. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_coupon(coupon_create_request, async_req=True) + >>> result = thread.get() + + :param coupon_create_request: + :type coupon_create_request: CouponCreateRequest + :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: CouponCreateResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the create_coupon_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.create_coupon_with_http_info(coupon_create_request, **kwargs) # noqa: E501 + + @validate_arguments + def create_coupon_with_http_info(self, coupon_create_request : Optional[CouponCreateRequest] = None, **kwargs) -> ApiResponse: # noqa: E501 + """create_coupon # noqa: E501 + + Create a new coupon. Define coupon details such as type, title, and validity period. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_coupon_with_http_info(coupon_create_request, async_req=True) + >>> result = thread.get() + + :param coupon_create_request: + :type coupon_create_request: CouponCreateRequest + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(CouponCreateResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'coupon_create_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 create_coupon" % _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['coupon_create_request'] is not None: + _body_params = _params['coupon_create_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # 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 = { + '200': "CouponCreateResponse", + '400': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/coupon', '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 create_rich_menu(self, rich_menu_request : RichMenuRequest, **kwargs) -> RichMenuIdResponse: # noqa: E501 ... @@ -988,10 +1300,169 @@ def delete_rich_menu_alias_with_http_info(self, rich_menu_alias_id : Annotated[S # authentication setting _auth_settings = ['Bearer'] # noqa: E501 - _response_types_map = {} + _response_types_map = {} + + return self.api_client.call_api( + '/v2/bot/richmenu/alias/{richMenuAliasId}', 'DELETE', + _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 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, **kwargs) -> GetAggregationUnitNameListResponse: # noqa: E501 + ... + + @overload + 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, async_req: Optional[bool]=True, **kwargs) -> GetAggregationUnitNameListResponse: # noqa: E501 + ... + + @validate_arguments + 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, async_req: Optional[bool]=None, **kwargs) -> Union[GetAggregationUnitNameListResponse, Awaitable[GetAggregationUnitNameListResponse]]: # noqa: E501 + """get_aggregation_unit_name_list # noqa: E501 + + Get name list of units used this month # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_aggregation_unit_name_list(limit, start, async_req=True) + >>> result = thread.get() + + :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 + :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: GetAggregationUnitNameListResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_aggregation_unit_name_list_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + if async_req is not None: + kwargs['async_req'] = async_req + return self.get_aggregation_unit_name_list_with_http_info(limit, start, **kwargs) # noqa: E501 + + @validate_arguments + 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, **kwargs) -> ApiResponse: # noqa: E501 + """get_aggregation_unit_name_list # noqa: E501 + + Get name list of units used this month # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_aggregation_unit_name_list_with_http_info(limit, start, async_req=True) + >>> result = thread.get() + + :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 + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(GetAggregationUnitNameListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'limit', + 'start' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_aggregation_unit_name_list" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('limit') is not None: # noqa: E501 + _query_params.append(('limit', _params['limit'])) + + if _params.get('start') is not None: # noqa: E501 + _query_params.append(('start', _params['start'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "GetAggregationUnitNameListResponse", + } return self.api_client.call_api( - '/v2/bot/richmenu/alias/{richMenuAliasId}', 'DELETE', + '/v2/bot/message/aggregation/list', 'GET', _path_params, _query_params, _header_params, @@ -1009,28 +1480,24 @@ def delete_rich_menu_alias_with_http_info(self, rich_menu_alias_id : Annotated[S _request_auth=_params.get('_request_auth')) @overload - 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, **kwargs) -> GetAggregationUnitNameListResponse: # noqa: E501 + async def get_aggregation_unit_usage(self, **kwargs) -> GetAggregationUnitUsageResponse: # noqa: E501 ... @overload - 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, async_req: Optional[bool]=True, **kwargs) -> GetAggregationUnitNameListResponse: # noqa: E501 + def get_aggregation_unit_usage(self, async_req: Optional[bool]=True, **kwargs) -> GetAggregationUnitUsageResponse: # noqa: E501 ... @validate_arguments - 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, async_req: Optional[bool]=None, **kwargs) -> Union[GetAggregationUnitNameListResponse, Awaitable[GetAggregationUnitNameListResponse]]: # noqa: E501 - """get_aggregation_unit_name_list # noqa: E501 + def get_aggregation_unit_usage(self, async_req: Optional[bool]=None, **kwargs) -> Union[GetAggregationUnitUsageResponse, Awaitable[GetAggregationUnitUsageResponse]]: # noqa: E501 + """get_aggregation_unit_usage # noqa: E501 - Get name list of units used this month # noqa: E501 + Get number of units used this month # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_aggregation_unit_name_list(limit, start, async_req=True) + >>> thread = api.get_aggregation_unit_usage(async_req=True) >>> result = thread.get() - :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 :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one @@ -1040,30 +1507,26 @@ def get_aggregation_unit_name_list(self, limit : Annotated[Optional[StrictStr], :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: GetAggregationUnitNameListResponse + :rtype: GetAggregationUnitUsageResponse """ kwargs['_return_http_data_only'] = True if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_aggregation_unit_name_list_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + raise ValueError("Error! Please call the get_aggregation_unit_usage_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") if async_req is not None: kwargs['async_req'] = async_req - return self.get_aggregation_unit_name_list_with_http_info(limit, start, **kwargs) # noqa: E501 + return self.get_aggregation_unit_usage_with_http_info(**kwargs) # noqa: E501 @validate_arguments - 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, **kwargs) -> ApiResponse: # noqa: E501 - """get_aggregation_unit_name_list # noqa: E501 + def get_aggregation_unit_usage_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """get_aggregation_unit_usage # noqa: E501 - Get name list of units used this month # noqa: E501 + Get number of units used this month # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_aggregation_unit_name_list_with_http_info(limit, start, async_req=True) + >>> thread = api.get_aggregation_unit_usage_with_http_info(async_req=True) >>> result = thread.get() - :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 :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _preload_content: if False, the ApiResponse.data will @@ -1086,15 +1549,13 @@ def get_aggregation_unit_name_list_with_http_info(self, limit : Annotated[Option :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: tuple(GetAggregationUnitNameListResponse, status_code(int), headers(HTTPHeaderDict)) + :rtype: tuple(GetAggregationUnitUsageResponse, status_code(int), headers(HTTPHeaderDict)) """ _host = self.line_base_path _params = locals() _all_params = [ - 'limit', - 'start' ] _all_params.extend( [ @@ -1113,7 +1574,7 @@ def get_aggregation_unit_name_list_with_http_info(self, limit : Annotated[Option if _key not in _all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_aggregation_unit_name_list" % _key + " to method get_aggregation_unit_usage" % _key ) _params[_key] = _val del _params['kwargs'] @@ -1125,12 +1586,6 @@ def get_aggregation_unit_name_list_with_http_info(self, limit : Annotated[Option # process the query parameters _query_params = [] - if _params.get('limit') is not None: # noqa: E501 - _query_params.append(('limit', _params['limit'])) - - if _params.get('start') is not None: # noqa: E501 - _query_params.append(('start', _params['start'])) - # process the header parameters _header_params = dict(_params.get('_headers', {})) # process the form parameters @@ -1146,11 +1601,11 @@ def get_aggregation_unit_name_list_with_http_info(self, limit : Annotated[Option _auth_settings = ['Bearer'] # noqa: E501 _response_types_map = { - '200': "GetAggregationUnitNameListResponse", + '200': "GetAggregationUnitUsageResponse", } return self.api_client.call_api( - '/v2/bot/message/aggregation/list', 'GET', + '/v2/bot/message/aggregation/info', 'GET', _path_params, _query_params, _header_params, @@ -1168,22 +1623,22 @@ def get_aggregation_unit_name_list_with_http_info(self, limit : Annotated[Option _request_auth=_params.get('_request_auth')) @overload - async def get_aggregation_unit_usage(self, **kwargs) -> GetAggregationUnitUsageResponse: # noqa: E501 + async def get_bot_info(self, **kwargs) -> BotInfoResponse: # noqa: E501 ... @overload - def get_aggregation_unit_usage(self, async_req: Optional[bool]=True, **kwargs) -> GetAggregationUnitUsageResponse: # noqa: E501 + def get_bot_info(self, async_req: Optional[bool]=True, **kwargs) -> BotInfoResponse: # noqa: E501 ... @validate_arguments - def get_aggregation_unit_usage(self, async_req: Optional[bool]=None, **kwargs) -> Union[GetAggregationUnitUsageResponse, Awaitable[GetAggregationUnitUsageResponse]]: # noqa: E501 - """get_aggregation_unit_usage # noqa: E501 + def get_bot_info(self, async_req: Optional[bool]=None, **kwargs) -> Union[BotInfoResponse, Awaitable[BotInfoResponse]]: # noqa: E501 + """get_bot_info # noqa: E501 - Get number of units used this month # noqa: E501 + Get bot info # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_aggregation_unit_usage(async_req=True) + >>> thread = api.get_bot_info(async_req=True) >>> result = thread.get() :param async_req: Whether to execute the request asynchronously. @@ -1195,24 +1650,24 @@ def get_aggregation_unit_usage(self, async_req: Optional[bool]=None, **kwargs) - :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: GetAggregationUnitUsageResponse + :rtype: BotInfoResponse """ kwargs['_return_http_data_only'] = True if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_aggregation_unit_usage_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + raise ValueError("Error! Please call the get_bot_info_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") if async_req is not None: kwargs['async_req'] = async_req - return self.get_aggregation_unit_usage_with_http_info(**kwargs) # noqa: E501 + return self.get_bot_info_with_http_info(**kwargs) # noqa: E501 @validate_arguments - def get_aggregation_unit_usage_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """get_aggregation_unit_usage # noqa: E501 + def get_bot_info_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """get_bot_info # noqa: E501 - Get number of units used this month # noqa: E501 + Get bot info # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_aggregation_unit_usage_with_http_info(async_req=True) + >>> thread = api.get_bot_info_with_http_info(async_req=True) >>> result = thread.get() :param async_req: Whether to execute the request asynchronously. @@ -1237,7 +1692,7 @@ def get_aggregation_unit_usage_with_http_info(self, **kwargs) -> ApiResponse: # :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: tuple(GetAggregationUnitUsageResponse, status_code(int), headers(HTTPHeaderDict)) + :rtype: tuple(BotInfoResponse, status_code(int), headers(HTTPHeaderDict)) """ _host = self.line_base_path @@ -1262,7 +1717,7 @@ def get_aggregation_unit_usage_with_http_info(self, **kwargs) -> ApiResponse: # if _key not in _all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_aggregation_unit_usage" % _key + " to method get_bot_info" % _key ) _params[_key] = _val del _params['kwargs'] @@ -1289,11 +1744,11 @@ def get_aggregation_unit_usage_with_http_info(self, **kwargs) -> ApiResponse: # _auth_settings = ['Bearer'] # noqa: E501 _response_types_map = { - '200': "GetAggregationUnitUsageResponse", + '200': "BotInfoResponse", } return self.api_client.call_api( - '/v2/bot/message/aggregation/info', 'GET', + '/v2/bot/info', 'GET', _path_params, _query_params, _header_params, @@ -1311,24 +1766,26 @@ def get_aggregation_unit_usage_with_http_info(self, **kwargs) -> ApiResponse: # _request_auth=_params.get('_request_auth')) @overload - async def get_bot_info(self, **kwargs) -> BotInfoResponse: # noqa: E501 + async def get_coupon_detail(self, coupon_id : StrictStr, **kwargs) -> CouponResponse: # noqa: E501 ... @overload - def get_bot_info(self, async_req: Optional[bool]=True, **kwargs) -> BotInfoResponse: # noqa: E501 + def get_coupon_detail(self, coupon_id : StrictStr, async_req: Optional[bool]=True, **kwargs) -> CouponResponse: # noqa: E501 ... @validate_arguments - def get_bot_info(self, async_req: Optional[bool]=None, **kwargs) -> Union[BotInfoResponse, Awaitable[BotInfoResponse]]: # noqa: E501 - """get_bot_info # noqa: E501 + def get_coupon_detail(self, coupon_id : StrictStr, async_req: Optional[bool]=None, **kwargs) -> Union[CouponResponse, Awaitable[CouponResponse]]: # noqa: E501 + """get_coupon_detail # noqa: E501 - Get bot info # noqa: E501 + Get coupon detail # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_bot_info(async_req=True) + >>> thread = api.get_coupon_detail(coupon_id, async_req=True) >>> result = thread.get() + :param coupon_id: (required) + :type coupon_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one @@ -1338,26 +1795,28 @@ def get_bot_info(self, async_req: Optional[bool]=None, **kwargs) -> Union[BotInf :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: BotInfoResponse + :rtype: CouponResponse """ kwargs['_return_http_data_only'] = True if '_preload_content' in kwargs: - raise ValueError("Error! Please call the get_bot_info_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + raise ValueError("Error! Please call the get_coupon_detail_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") if async_req is not None: kwargs['async_req'] = async_req - return self.get_bot_info_with_http_info(**kwargs) # noqa: E501 + return self.get_coupon_detail_with_http_info(coupon_id, **kwargs) # noqa: E501 @validate_arguments - def get_bot_info_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """get_bot_info # noqa: E501 + def get_coupon_detail_with_http_info(self, coupon_id : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 + """get_coupon_detail # noqa: E501 - Get bot info # noqa: E501 + Get coupon detail # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_bot_info_with_http_info(async_req=True) + >>> thread = api.get_coupon_detail_with_http_info(coupon_id, async_req=True) >>> result = thread.get() + :param coupon_id: (required) + :type coupon_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _preload_content: if False, the ApiResponse.data will @@ -1380,13 +1839,14 @@ def get_bot_info_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: tuple(BotInfoResponse, status_code(int), headers(HTTPHeaderDict)) + :rtype: tuple(CouponResponse, status_code(int), headers(HTTPHeaderDict)) """ _host = self.line_base_path _params = locals() _all_params = [ + 'coupon_id' ] _all_params.extend( [ @@ -1405,7 +1865,7 @@ def get_bot_info_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 if _key not in _all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_bot_info" % _key + " to method get_coupon_detail" % _key ) _params[_key] = _val del _params['kwargs'] @@ -1414,6 +1874,9 @@ def get_bot_info_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 # process the path parameters _path_params = {} + if _params['coupon_id']: + _path_params['couponId'] = _params['coupon_id'] + # process the query parameters _query_params = [] @@ -1432,11 +1895,13 @@ def get_bot_info_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 _auth_settings = ['Bearer'] # noqa: E501 _response_types_map = { - '200': "BotInfoResponse", + '200': "CouponResponse", + '400': "ErrorResponse", + '404': "ErrorResponse", } return self.api_client.call_api( - '/v2/bot/info', 'GET', + '/v2/bot/coupon/{couponId}', 'GET', _path_params, _query_params, _header_params, @@ -6436,6 +6901,175 @@ def link_rich_menu_id_to_users_with_http_info(self, rich_menu_bulk_link_request collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @overload + 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, **kwargs) -> MessagingApiPagerCouponListResponse: # noqa: E501 + ... + + @overload + 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, async_req: Optional[bool]=True, **kwargs) -> MessagingApiPagerCouponListResponse: # noqa: E501 + ... + + @validate_arguments + 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, async_req: Optional[bool]=None, **kwargs) -> Union[MessagingApiPagerCouponListResponse, Awaitable[MessagingApiPagerCouponListResponse]]: # noqa: E501 + """list_coupon # noqa: E501 + + Get a paginated list of coupons. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list_coupon(status, start, limit, async_req=True) + >>> result = thread.get() + + :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 + :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: MessagingApiPagerCouponListResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the list_coupon_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.list_coupon_with_http_info(status, start, limit, **kwargs) # noqa: E501 + + @validate_arguments + 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, **kwargs) -> ApiResponse: # noqa: E501 + """list_coupon # noqa: E501 + + Get a paginated list of coupons. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list_coupon_with_http_info(status, start, limit, async_req=True) + >>> result = thread.get() + + :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 + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(MessagingApiPagerCouponListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'status', + 'start', + 'limit' + ] + _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 list_coupon" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('status') is not None: # noqa: E501 + _query_params.append(('status', _params['status'])) + _collection_formats['status'] = 'multi' + + if _params.get('start') is not None: # noqa: E501 + _query_params.append(('start', _params['start'])) + + if _params.get('limit') is not None: # noqa: E501 + _query_params.append(('limit', _params['limit'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "MessagingApiPagerCouponListResponse", + '400': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/coupon', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + _host=_host, + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @overload async def mark_messages_as_read(self, mark_messages_as_read_request : MarkMessagesAsReadRequest, **kwargs) -> None: # noqa: E501 ... diff --git a/linebot/v3/messaging/api/messaging_api.py b/linebot/v3/messaging/api/messaging_api.py index 74c20f56..646d5e61 100644 --- a/linebot/v3/messaging/api/messaging_api.py +++ b/linebot/v3/messaging/api/messaging_api.py @@ -18,12 +18,15 @@ from pydantic.v1 import validate_arguments, ValidationError from typing_extensions import Annotated -from pydantic.v1 import Field, StrictInt, StrictStr, conint, constr, validator +from pydantic.v1 import Field, StrictInt, StrictStr, conint, conlist, constr, validator from typing import Any, Dict, Optional 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 @@ -39,6 +42,7 @@ 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 @@ -378,6 +382,294 @@ def cancel_default_rich_menu_with_http_info(self, **kwargs) -> ApiResponse: # n collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + def close_coupon(self, coupon_id : StrictStr, **kwargs) -> None: # noqa: E501 + """close_coupon # noqa: E501 + + Close coupon # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.close_coupon(coupon_id, async_req=True) + >>> result = thread.get() + + :param coupon_id: (required) + :type coupon_id: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the close_coupon_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + return self.close_coupon_with_http_info(coupon_id, **kwargs) # noqa: E501 + + @validate_arguments + def close_coupon_with_http_info(self, coupon_id : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 + """close_coupon # noqa: E501 + + Close coupon # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.close_coupon_with_http_info(coupon_id, async_req=True) + >>> result = thread.get() + + :param coupon_id: (required) + :type coupon_id: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'coupon_id' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method close_coupon" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['coupon_id']: + _path_params['couponId'] = _params['coupon_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/v2/bot/coupon/{couponId}/close', 'PUT', + _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 create_coupon(self, coupon_create_request : Optional[CouponCreateRequest] = None, **kwargs) -> CouponCreateResponse: # noqa: E501 + """create_coupon # noqa: E501 + + Create a new coupon. Define coupon details such as type, title, and validity period. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_coupon(coupon_create_request, async_req=True) + >>> result = thread.get() + + :param coupon_create_request: + :type coupon_create_request: CouponCreateRequest + :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: CouponCreateResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the create_coupon_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + return self.create_coupon_with_http_info(coupon_create_request, **kwargs) # noqa: E501 + + @validate_arguments + def create_coupon_with_http_info(self, coupon_create_request : Optional[CouponCreateRequest] = None, **kwargs) -> ApiResponse: # noqa: E501 + """create_coupon # noqa: E501 + + Create a new coupon. Define coupon details such as type, title, and validity period. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_coupon_with_http_info(coupon_create_request, async_req=True) + >>> result = thread.get() + + :param coupon_create_request: + :type coupon_create_request: CouponCreateRequest + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(CouponCreateResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'coupon_create_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 create_coupon" % _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['coupon_create_request'] is not None: + _body_params = _params['coupon_create_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # 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 = { + '200': "CouponCreateResponse", + '400': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/coupon', '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 create_rich_menu(self, rich_menu_request : RichMenuRequest, **kwargs) -> RichMenuIdResponse: # noqa: E501 """create_rich_menu # noqa: E501 @@ -1361,6 +1653,149 @@ def get_bot_info_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + def get_coupon_detail(self, coupon_id : StrictStr, **kwargs) -> CouponResponse: # noqa: E501 + """get_coupon_detail # noqa: E501 + + Get coupon detail # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_coupon_detail(coupon_id, async_req=True) + >>> result = thread.get() + + :param coupon_id: (required) + :type coupon_id: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: CouponResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_coupon_detail_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + return self.get_coupon_detail_with_http_info(coupon_id, **kwargs) # noqa: E501 + + @validate_arguments + def get_coupon_detail_with_http_info(self, coupon_id : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 + """get_coupon_detail # noqa: E501 + + Get coupon detail # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_coupon_detail_with_http_info(coupon_id, async_req=True) + >>> result = thread.get() + + :param coupon_id: (required) + :type coupon_id: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(CouponResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'coupon_id' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_coupon_detail" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['coupon_id']: + _path_params['couponId'] = _params['coupon_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "CouponResponse", + '400': "ErrorResponse", + '404': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/coupon/{couponId}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + _host=_host, + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments def get_default_rich_menu_id(self, **kwargs) -> RichMenuIdResponse: # noqa: E501 """get_default_rich_menu_id # noqa: E501 @@ -6014,6 +6449,165 @@ def link_rich_menu_id_to_users_with_http_info(self, rich_menu_bulk_link_request collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + 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, **kwargs) -> MessagingApiPagerCouponListResponse: # noqa: E501 + """list_coupon # noqa: E501 + + Get a paginated list of coupons. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list_coupon(status, start, limit, async_req=True) + >>> result = thread.get() + + :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 + :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: MessagingApiPagerCouponListResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the list_coupon_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + return self.list_coupon_with_http_info(status, start, limit, **kwargs) # noqa: E501 + + @validate_arguments + 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, **kwargs) -> ApiResponse: # noqa: E501 + """list_coupon # noqa: E501 + + Get a paginated list of coupons. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list_coupon_with_http_info(status, start, limit, async_req=True) + >>> result = thread.get() + + :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 + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(MessagingApiPagerCouponListResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'status', + 'start', + 'limit' + ] + _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 list_coupon" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('status') is not None: # noqa: E501 + _query_params.append(('status', _params['status'])) + _collection_formats['status'] = 'multi' + + if _params.get('start') is not None: # noqa: E501 + _query_params.append(('start', _params['start'])) + + if _params.get('limit') is not None: # noqa: E501 + _query_params.append(('limit', _params['limit'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['Bearer'] # noqa: E501 + + _response_types_map = { + '200': "MessagingApiPagerCouponListResponse", + '400': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/coupon', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + _host=_host, + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments def mark_messages_as_read(self, mark_messages_as_read_request : MarkMessagesAsReadRequest, **kwargs) -> None: # noqa: E501 """mark_messages_as_read # noqa: E501 diff --git a/linebot/v3/messaging/docs/MessagingApi.md b/linebot/v3/messaging/docs/MessagingApi.md index 296798d3..90400038 100644 --- a/linebot/v3/messaging/docs/MessagingApi.md +++ b/linebot/v3/messaging/docs/MessagingApi.md @@ -6,6 +6,8 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**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 | +[**close_coupon**](MessagingApi.md#close_coupon) | **PUT** /v2/bot/coupon/{couponId}/close | +[**create_coupon**](MessagingApi.md#create_coupon) | **POST** /v2/bot/coupon | [**create_rich_menu**](MessagingApi.md#create_rich_menu) | **POST** /v2/bot/richmenu | [**create_rich_menu_alias**](MessagingApi.md#create_rich_menu_alias) | **POST** /v2/bot/richmenu/alias | [**delete_rich_menu**](MessagingApi.md#delete_rich_menu) | **DELETE** /v2/bot/richmenu/{richMenuId} | @@ -13,6 +15,7 @@ Method | HTTP request | Description [**get_aggregation_unit_name_list**](MessagingApi.md#get_aggregation_unit_name_list) | **GET** /v2/bot/message/aggregation/list | [**get_aggregation_unit_usage**](MessagingApi.md#get_aggregation_unit_usage) | **GET** /v2/bot/message/aggregation/info | [**get_bot_info**](MessagingApi.md#get_bot_info) | **GET** /v2/bot/info | +[**get_coupon_detail**](MessagingApi.md#get_coupon_detail) | **GET** /v2/bot/coupon/{couponId} | [**get_default_rich_menu_id**](MessagingApi.md#get_default_rich_menu_id) | **GET** /v2/bot/user/all/richmenu | [**get_followers**](MessagingApi.md#get_followers) | **GET** /v2/bot/followers/ids | [**get_group_member_count**](MessagingApi.md#get_group_member_count) | **GET** /v2/bot/group/{groupId}/members/count | @@ -46,6 +49,7 @@ Method | HTTP request | Description [**leave_room**](MessagingApi.md#leave_room) | **POST** /v2/bot/room/{roomId}/leave | [**link_rich_menu_id_to_user**](MessagingApi.md#link_rich_menu_id_to_user) | **POST** /v2/bot/user/{userId}/richmenu/{richMenuId} | [**link_rich_menu_id_to_users**](MessagingApi.md#link_rich_menu_id_to_users) | **POST** /v2/bot/richmenu/bulk/link | +[**list_coupon**](MessagingApi.md#list_coupon) | **GET** /v2/bot/coupon | [**mark_messages_as_read**](MessagingApi.md#mark_messages_as_read) | **POST** /v2/bot/message/markAsRead | [**multicast**](MessagingApi.md#multicast) | **POST** /v2/bot/message/multicast | [**narrowcast**](MessagingApi.md#narrowcast) | **POST** /v2/bot/message/narrowcast | @@ -218,6 +222,158 @@ void (empty response body) [[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) +# **close_coupon** +> close_coupon(coupon_id) + + + +Close coupon + +### Example + +* Bearer Authentication (Bearer): +```python +import time +import os +import linebot.v3.messaging +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) + coupon_id = 'coupon_id_example' # str | + + try: + api_instance.close_coupon(coupon_id) + except Exception as e: + print("Exception when calling MessagingApi->close_coupon: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **coupon_id** | **str**| | + +### Return type + +void (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | +**404** | Not Found | - | +**410** | Gone | - | + +[[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) + +# **create_coupon** +> CouponCreateResponse create_coupon(coupon_create_request=coupon_create_request) + + + +Create a new coupon. Define coupon details such as type, title, and validity period. + +### Example + +* Bearer Authentication (Bearer): +```python +import time +import os +import linebot.v3.messaging +from linebot.v3.messaging.models.coupon_create_request import CouponCreateRequest +from linebot.v3.messaging.models.coupon_create_response import CouponCreateResponse +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) + coupon_create_request = linebot.v3.messaging.CouponCreateRequest() # CouponCreateRequest | (optional) + + try: + api_response = api_instance.create_coupon(coupon_create_request=coupon_create_request) + print("The response of MessagingApi->create_coupon:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MessagingApi->create_coupon: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **coupon_create_request** | [**CouponCreateRequest**](CouponCreateRequest.md)| | [optional] + +### Return type + +[**CouponCreateResponse**](CouponCreateResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | + +[[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) + # **create_rich_menu** > RichMenuIdResponse create_rich_menu(rich_menu_request) @@ -732,6 +888,83 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **get_coupon_detail** +> CouponResponse get_coupon_detail(coupon_id) + + + +Get coupon detail + +### Example + +* Bearer Authentication (Bearer): +```python +import time +import os +import linebot.v3.messaging +from linebot.v3.messaging.models.coupon_response import CouponResponse +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) + coupon_id = 'coupon_id_example' # str | + + try: + api_response = api_instance.get_coupon_detail(coupon_id) + print("The response of MessagingApi->get_coupon_detail:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MessagingApi->get_coupon_detail: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **coupon_id** | **str**| | + +### Return type + +[**CouponResponse**](CouponResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **get_default_rich_menu_id** > RichMenuIdResponse get_default_rich_menu_id() @@ -3191,6 +3424,86 @@ void (empty response body) [[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) +# **list_coupon** +> MessagingApiPagerCouponListResponse list_coupon(status=status, start=start, limit=limit) + + + +Get a paginated list of coupons. + +### Example + +* Bearer Authentication (Bearer): +```python +import time +import os +import linebot.v3.messaging +from linebot.v3.messaging.models.messaging_api_pager_coupon_list_response import MessagingApiPagerCouponListResponse +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) + status = ['status_example'] # List[str] | Filter coupons by their status. (optional) + start = 'start_example' # str | Pagination token to retrieve the next page of results. (optional) + limit = 20 # int | Maximum number of coupons to return per request. (optional) (default to 20) + + try: + api_response = api_instance.list_coupon(status=status, start=start, limit=limit) + print("The response of MessagingApi->list_coupon:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MessagingApi->list_coupon: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List[str]**](str.md)| Filter coupons by their status. | [optional] + **start** | **str**| Pagination token to retrieve the next page of results. | [optional] + **limit** | **int**| Maximum number of coupons to return per request. | [optional] [default to 20] + +### Return type + +[**MessagingApiPagerCouponListResponse**](MessagingApiPagerCouponListResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | + +[[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) + # **mark_messages_as_read** > mark_messages_as_read(mark_messages_as_read_request) diff --git a/linebot/v3/messaging/models/__init__.py b/linebot/v3/messaging/models/__init__.py index 171373b2..81fb143d 100644 --- a/linebot/v3/messaging/models/__init__.py +++ b/linebot/v3/messaging/models/__init__.py @@ -14,6 +14,8 @@ # import models into model package +from linebot.v3.messaging.models.acquisition_condition_request import AcquisitionConditionRequest +from linebot.v3.messaging.models.acquisition_condition_response import AcquisitionConditionResponse from linebot.v3.messaging.models.action import Action from linebot.v3.messaging.models.age_demographic import AgeDemographic from linebot.v3.messaging.models.age_demographic_filter import AgeDemographicFilter @@ -32,13 +34,44 @@ from linebot.v3.messaging.models.camera_roll_action import CameraRollAction from linebot.v3.messaging.models.carousel_column import CarouselColumn from linebot.v3.messaging.models.carousel_template import CarouselTemplate +from linebot.v3.messaging.models.cash_back_fixed_price_info_request import CashBackFixedPriceInfoRequest +from linebot.v3.messaging.models.cash_back_fixed_price_info_response import CashBackFixedPriceInfoResponse +from linebot.v3.messaging.models.cash_back_percentage_price_info_request import CashBackPercentagePriceInfoRequest +from linebot.v3.messaging.models.cash_back_percentage_price_info_response import CashBackPercentagePriceInfoResponse +from linebot.v3.messaging.models.cash_back_price_info_request import CashBackPriceInfoRequest +from linebot.v3.messaging.models.cash_back_price_info_response import CashBackPriceInfoResponse from linebot.v3.messaging.models.chat_reference import ChatReference from linebot.v3.messaging.models.clipboard_action import ClipboardAction from linebot.v3.messaging.models.clipboard_imagemap_action import ClipboardImagemapAction from linebot.v3.messaging.models.confirm_template import ConfirmTemplate +from linebot.v3.messaging.models.coupon_cash_back_reward_request import CouponCashBackRewardRequest +from linebot.v3.messaging.models.coupon_cash_back_reward_response import CouponCashBackRewardResponse +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_discount_reward_request import CouponDiscountRewardRequest +from linebot.v3.messaging.models.coupon_discount_reward_response import CouponDiscountRewardResponse +from linebot.v3.messaging.models.coupon_free_reward_request import CouponFreeRewardRequest +from linebot.v3.messaging.models.coupon_free_reward_response import CouponFreeRewardResponse +from linebot.v3.messaging.models.coupon_gift_reward_request import CouponGiftRewardRequest +from linebot.v3.messaging.models.coupon_gift_reward_response import CouponGiftRewardResponse +from linebot.v3.messaging.models.coupon_list_response import CouponListResponse +from linebot.v3.messaging.models.coupon_message import CouponMessage +from linebot.v3.messaging.models.coupon_others_reward_request import CouponOthersRewardRequest +from linebot.v3.messaging.models.coupon_others_reward_response import CouponOthersRewardResponse +from linebot.v3.messaging.models.coupon_response import CouponResponse +from linebot.v3.messaging.models.coupon_reward_request import CouponRewardRequest +from linebot.v3.messaging.models.coupon_reward_response import CouponRewardResponse from linebot.v3.messaging.models.create_rich_menu_alias_request import CreateRichMenuAliasRequest from linebot.v3.messaging.models.datetime_picker_action import DatetimePickerAction from linebot.v3.messaging.models.demographic_filter import DemographicFilter +from linebot.v3.messaging.models.discount_explicit_price_info_request import DiscountExplicitPriceInfoRequest +from linebot.v3.messaging.models.discount_explicit_price_info_response import DiscountExplicitPriceInfoResponse +from linebot.v3.messaging.models.discount_fixed_price_info_request import DiscountFixedPriceInfoRequest +from linebot.v3.messaging.models.discount_fixed_price_info_response import DiscountFixedPriceInfoResponse +from linebot.v3.messaging.models.discount_percentage_price_info_request import DiscountPercentagePriceInfoRequest +from linebot.v3.messaging.models.discount_percentage_price_info_response import DiscountPercentagePriceInfoResponse +from linebot.v3.messaging.models.discount_price_info_request import DiscountPriceInfoRequest +from linebot.v3.messaging.models.discount_price_info_response import DiscountPriceInfoResponse from linebot.v3.messaging.models.emoji import Emoji from linebot.v3.messaging.models.emoji_substitution_object import EmojiSubstitutionObject from linebot.v3.messaging.models.error_detail import ErrorDetail @@ -97,6 +130,8 @@ from linebot.v3.messaging.models.limit import Limit from linebot.v3.messaging.models.location_action import LocationAction from linebot.v3.messaging.models.location_message import LocationMessage +from linebot.v3.messaging.models.lottery_acquisition_condition_request import LotteryAcquisitionConditionRequest +from linebot.v3.messaging.models.lottery_acquisition_condition_response import LotteryAcquisitionConditionResponse from linebot.v3.messaging.models.mark_messages_as_read_request import MarkMessagesAsReadRequest from linebot.v3.messaging.models.members_ids_response import MembersIdsResponse from linebot.v3.messaging.models.membership import Membership @@ -107,9 +142,12 @@ from linebot.v3.messaging.models.message_action import MessageAction from linebot.v3.messaging.models.message_imagemap_action import MessageImagemapAction 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.normal_acquisition_condition_request import NormalAcquisitionConditionRequest +from linebot.v3.messaging.models.normal_acquisition_condition_response import NormalAcquisitionConditionResponse from linebot.v3.messaging.models.number_of_messages_response import NumberOfMessagesResponse from linebot.v3.messaging.models.operator_demographic_filter import OperatorDemographicFilter from linebot.v3.messaging.models.operator_recipient import OperatorRecipient @@ -123,6 +161,7 @@ from linebot.v3.messaging.models.quota_type import QuotaType from linebot.v3.messaging.models.recipient import Recipient from linebot.v3.messaging.models.redelivery_recipient import RedeliveryRecipient +from linebot.v3.messaging.models.referral_acquisition_condition_response import ReferralAcquisitionConditionResponse 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 diff --git a/linebot/v3/messaging/models/acquisition_condition_request.py b/linebot/v3/messaging/models/acquisition_condition_request.py new file mode 100644 index 00000000..3e8b0cdc --- /dev/null +++ b/linebot/v3/messaging/models/acquisition_condition_request.py @@ -0,0 +1,89 @@ +# 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 +import linebot.v3.messaging.models + + +from typing import Union +from pydantic.v1 import BaseModel, Field, StrictStr + +class AcquisitionConditionRequest(BaseModel): + """ + AcquisitionConditionRequest + """ + type: StrictStr = Field(..., description="Determines how the coupon is distributed or used.") + + __properties = ["type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + # JSON field name that stores the object type + __discriminator_property_name = 'type' + + # discriminator mappings + __discriminator_value_class_map = { + 'lottery': 'LotteryAcquisitionConditionRequest', + 'normal': 'NormalAcquisitionConditionRequest' + } + + @classmethod + def get_discriminator_value(cls, obj: dict) -> str: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + + 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) -> Union(LotteryAcquisitionConditionRequest, NormalAcquisitionConditionRequest): + """Create an instance of AcquisitionConditionRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Union(LotteryAcquisitionConditionRequest, NormalAcquisitionConditionRequest): + """Create an instance of AcquisitionConditionRequest from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type: + klass = getattr(linebot.v3.messaging.models, object_type) + return klass.from_dict(obj) + else: + raise ValueError("AcquisitionConditionRequest failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + diff --git a/linebot/v3/messaging/models/acquisition_condition_response.py b/linebot/v3/messaging/models/acquisition_condition_response.py new file mode 100644 index 00000000..895ba915 --- /dev/null +++ b/linebot/v3/messaging/models/acquisition_condition_response.py @@ -0,0 +1,90 @@ +# 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 +import linebot.v3.messaging.models + + +from typing import Union +from pydantic.v1 import BaseModel, Field, StrictStr + +class AcquisitionConditionResponse(BaseModel): + """ + AcquisitionConditionResponse + """ + type: StrictStr = Field(..., description="Determines how the coupon is distributed or used.") + + __properties = ["type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + # JSON field name that stores the object type + __discriminator_property_name = 'type' + + # discriminator mappings + __discriminator_value_class_map = { + 'lottery': 'LotteryAcquisitionConditionResponse', + 'normal': 'NormalAcquisitionConditionResponse', + 'referral': 'ReferralAcquisitionConditionResponse' + } + + @classmethod + def get_discriminator_value(cls, obj: dict) -> str: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + + 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) -> Union(LotteryAcquisitionConditionResponse, NormalAcquisitionConditionResponse, ReferralAcquisitionConditionResponse): + """Create an instance of AcquisitionConditionResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Union(LotteryAcquisitionConditionResponse, NormalAcquisitionConditionResponse, ReferralAcquisitionConditionResponse): + """Create an instance of AcquisitionConditionResponse from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type: + klass = getattr(linebot.v3.messaging.models, object_type) + return klass.from_dict(obj) + else: + raise ValueError("AcquisitionConditionResponse failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + diff --git a/linebot/v3/messaging/models/cash_back_fixed_price_info_request.py b/linebot/v3/messaging/models/cash_back_fixed_price_info_request.py new file mode 100644 index 00000000..2b31b638 --- /dev/null +++ b/linebot/v3/messaging/models/cash_back_fixed_price_info_request.py @@ -0,0 +1,74 @@ +# 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 Optional +from pydantic.v1 import Field, StrictInt +from linebot.v3.messaging.models.cash_back_price_info_request import CashBackPriceInfoRequest + +class CashBackFixedPriceInfoRequest(CashBackPriceInfoRequest): + """ + CashBackFixedPriceInfoRequest + """ + fixed_amount: Optional[StrictInt] = Field(None, alias="fixedAmount") + type: str = "fixed" + + __properties = ["type", "fixedAmount"] + + 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) -> CashBackFixedPriceInfoRequest: + """Create an instance of CashBackFixedPriceInfoRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CashBackFixedPriceInfoRequest: + """Create an instance of CashBackFixedPriceInfoRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CashBackFixedPriceInfoRequest.parse_obj(obj) + + _obj = CashBackFixedPriceInfoRequest.parse_obj({ + "type": obj.get("type"), + "fixed_amount": obj.get("fixedAmount") + }) + return _obj + diff --git a/linebot/v3/messaging/models/cash_back_fixed_price_info_response.py b/linebot/v3/messaging/models/cash_back_fixed_price_info_response.py new file mode 100644 index 00000000..49ed6f53 --- /dev/null +++ b/linebot/v3/messaging/models/cash_back_fixed_price_info_response.py @@ -0,0 +1,86 @@ +# 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 Optional +from pydantic.v1 import Field, StrictInt, StrictStr, validator +from linebot.v3.messaging.models.cash_back_price_info_response import CashBackPriceInfoResponse + +class CashBackFixedPriceInfoResponse(CashBackPriceInfoResponse): + """ + CashBackFixedPriceInfoResponse + """ + currency: Optional[StrictStr] = Field(None, description="Currency code (e.g., JPY, THB, TWD).") + fixed_amount: Optional[StrictInt] = Field(None, alias="fixedAmount") + type: str = "fixed" + + __properties = ["type", "currency", "fixedAmount"] + + @validator('currency') + def currency_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('JPY', 'THB', 'TWD'): + raise ValueError("must be one of enum values ('JPY', 'THB', 'TWD')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> CashBackFixedPriceInfoResponse: + """Create an instance of CashBackFixedPriceInfoResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CashBackFixedPriceInfoResponse: + """Create an instance of CashBackFixedPriceInfoResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CashBackFixedPriceInfoResponse.parse_obj(obj) + + _obj = CashBackFixedPriceInfoResponse.parse_obj({ + "type": obj.get("type"), + "currency": obj.get("currency"), + "fixed_amount": obj.get("fixedAmount") + }) + return _obj + diff --git a/linebot/v3/messaging/models/cash_back_percentage_price_info_request.py b/linebot/v3/messaging/models/cash_back_percentage_price_info_request.py new file mode 100644 index 00000000..eb97d1f5 --- /dev/null +++ b/linebot/v3/messaging/models/cash_back_percentage_price_info_request.py @@ -0,0 +1,74 @@ +# 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 Optional +from pydantic.v1 import Field, conint +from linebot.v3.messaging.models.cash_back_price_info_request import CashBackPriceInfoRequest + +class CashBackPercentagePriceInfoRequest(CashBackPriceInfoRequest): + """ + CashBackPercentagePriceInfoRequest + """ + percentage: Optional[conint(strict=True, le=99, ge=1)] = Field(None, description="Specifies the cashback rate as a percentage. Must be an integer between 1 and 99.") + type: str = "percentage" + + __properties = ["type", "percentage"] + + 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) -> CashBackPercentagePriceInfoRequest: + """Create an instance of CashBackPercentagePriceInfoRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CashBackPercentagePriceInfoRequest: + """Create an instance of CashBackPercentagePriceInfoRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CashBackPercentagePriceInfoRequest.parse_obj(obj) + + _obj = CashBackPercentagePriceInfoRequest.parse_obj({ + "type": obj.get("type"), + "percentage": obj.get("percentage") + }) + return _obj + diff --git a/linebot/v3/messaging/models/cash_back_percentage_price_info_response.py b/linebot/v3/messaging/models/cash_back_percentage_price_info_response.py new file mode 100644 index 00000000..eb237752 --- /dev/null +++ b/linebot/v3/messaging/models/cash_back_percentage_price_info_response.py @@ -0,0 +1,74 @@ +# 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 Optional +from pydantic.v1 import StrictInt +from linebot.v3.messaging.models.cash_back_price_info_response import CashBackPriceInfoResponse + +class CashBackPercentagePriceInfoResponse(CashBackPriceInfoResponse): + """ + CashBackPercentagePriceInfoResponse + """ + percentage: Optional[StrictInt] = None + type: str = "percentage" + + __properties = ["type", "percentage"] + + 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) -> CashBackPercentagePriceInfoResponse: + """Create an instance of CashBackPercentagePriceInfoResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CashBackPercentagePriceInfoResponse: + """Create an instance of CashBackPercentagePriceInfoResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CashBackPercentagePriceInfoResponse.parse_obj(obj) + + _obj = CashBackPercentagePriceInfoResponse.parse_obj({ + "type": obj.get("type"), + "percentage": obj.get("percentage") + }) + return _obj + diff --git a/linebot/v3/messaging/models/cash_back_price_info_request.py b/linebot/v3/messaging/models/cash_back_price_info_request.py new file mode 100644 index 00000000..86ac640b --- /dev/null +++ b/linebot/v3/messaging/models/cash_back_price_info_request.py @@ -0,0 +1,89 @@ +# 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 +import linebot.v3.messaging.models + + +from typing import Union +from pydantic.v1 import BaseModel, Field, StrictStr + +class CashBackPriceInfoRequest(BaseModel): + """ + CashBackPriceInfoRequest + """ + type: StrictStr = Field(...) + + __properties = ["type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + # JSON field name that stores the object type + __discriminator_property_name = 'type' + + # discriminator mappings + __discriminator_value_class_map = { + 'fixed': 'CashBackFixedPriceInfoRequest', + 'percentage': 'CashBackPercentagePriceInfoRequest' + } + + @classmethod + def get_discriminator_value(cls, obj: dict) -> str: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + + 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) -> Union(CashBackFixedPriceInfoRequest, CashBackPercentagePriceInfoRequest): + """Create an instance of CashBackPriceInfoRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Union(CashBackFixedPriceInfoRequest, CashBackPercentagePriceInfoRequest): + """Create an instance of CashBackPriceInfoRequest from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type: + klass = getattr(linebot.v3.messaging.models, object_type) + return klass.from_dict(obj) + else: + raise ValueError("CashBackPriceInfoRequest failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + diff --git a/linebot/v3/messaging/models/cash_back_price_info_response.py b/linebot/v3/messaging/models/cash_back_price_info_response.py new file mode 100644 index 00000000..68c72745 --- /dev/null +++ b/linebot/v3/messaging/models/cash_back_price_info_response.py @@ -0,0 +1,89 @@ +# 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 +import linebot.v3.messaging.models + + +from typing import Union +from pydantic.v1 import BaseModel, Field, StrictStr + +class CashBackPriceInfoResponse(BaseModel): + """ + CashBackPriceInfoResponse + """ + type: StrictStr = Field(...) + + __properties = ["type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + # JSON field name that stores the object type + __discriminator_property_name = 'type' + + # discriminator mappings + __discriminator_value_class_map = { + 'fixed': 'CashBackFixedPriceInfoResponse', + 'percentage': 'CashBackPercentagePriceInfoResponse' + } + + @classmethod + def get_discriminator_value(cls, obj: dict) -> str: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + + 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) -> Union(CashBackFixedPriceInfoResponse, CashBackPercentagePriceInfoResponse): + """Create an instance of CashBackPriceInfoResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Union(CashBackFixedPriceInfoResponse, CashBackPercentagePriceInfoResponse): + """Create an instance of CashBackPriceInfoResponse from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type: + klass = getattr(linebot.v3.messaging.models, object_type) + return klass.from_dict(obj) + else: + raise ValueError("CashBackPriceInfoResponse failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + diff --git a/linebot/v3/messaging/models/coupon_cash_back_reward_request.py b/linebot/v3/messaging/models/coupon_cash_back_reward_request.py new file mode 100644 index 00000000..b145cc04 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_cash_back_reward_request.py @@ -0,0 +1,78 @@ +# 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 Optional +from pydantic.v1 import Field +from linebot.v3.messaging.models.cash_back_price_info_request import CashBackPriceInfoRequest +from linebot.v3.messaging.models.coupon_reward_request import CouponRewardRequest + +class CouponCashBackRewardRequest(CouponRewardRequest): + """ + CouponCashBackRewardRequest + """ + price_info: Optional[CashBackPriceInfoRequest] = Field(None, alias="priceInfo") + type: str = "cashBack" + + __properties = ["type", "priceInfo"] + + 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) -> CouponCashBackRewardRequest: + """Create an instance of CouponCashBackRewardRequest 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 price_info + if self.price_info: + _dict['priceInfo'] = self.price_info.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponCashBackRewardRequest: + """Create an instance of CouponCashBackRewardRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponCashBackRewardRequest.parse_obj(obj) + + _obj = CouponCashBackRewardRequest.parse_obj({ + "type": obj.get("type"), + "price_info": CashBackPriceInfoRequest.from_dict(obj.get("priceInfo")) if obj.get("priceInfo") is not None else None + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_cash_back_reward_response.py b/linebot/v3/messaging/models/coupon_cash_back_reward_response.py new file mode 100644 index 00000000..aeae9595 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_cash_back_reward_response.py @@ -0,0 +1,78 @@ +# 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 Optional +from pydantic.v1 import Field +from linebot.v3.messaging.models.cash_back_price_info_response import CashBackPriceInfoResponse +from linebot.v3.messaging.models.coupon_reward_response import CouponRewardResponse + +class CouponCashBackRewardResponse(CouponRewardResponse): + """ + CouponCashBackRewardResponse + """ + price_info: Optional[CashBackPriceInfoResponse] = Field(None, alias="priceInfo") + type: str = "cashBack" + + __properties = ["type", "priceInfo"] + + 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) -> CouponCashBackRewardResponse: + """Create an instance of CouponCashBackRewardResponse 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 price_info + if self.price_info: + _dict['priceInfo'] = self.price_info.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponCashBackRewardResponse: + """Create an instance of CouponCashBackRewardResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponCashBackRewardResponse.parse_obj(obj) + + _obj = CouponCashBackRewardResponse.parse_obj({ + "type": obj.get("type"), + "price_info": CashBackPriceInfoResponse.from_dict(obj.get("priceInfo")) if obj.get("priceInfo") is not None else None + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_create_request.py b/linebot/v3/messaging/models/coupon_create_request.py new file mode 100644 index 00000000..41c51b44 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_create_request.py @@ -0,0 +1,117 @@ +# 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 Optional +from pydantic.v1 import BaseModel, Field, StrictInt, StrictStr, conint, constr, validator +from linebot.v3.messaging.models.acquisition_condition_request import AcquisitionConditionRequest +from linebot.v3.messaging.models.coupon_reward_request import CouponRewardRequest + +class CouponCreateRequest(BaseModel): + """ + Request object for creating a coupon. Contains all configurable coupon properties. + """ + acquisition_condition: AcquisitionConditionRequest = Field(..., alias="acquisitionCondition") + barcode_image_url: Optional[StrictStr] = Field(None, alias="barcodeImageUrl", description="URL of the barcode image associated with the coupon. Used for in-store redemption.") + coupon_code: Optional[StrictStr] = Field(None, alias="couponCode", description="Unique code to be presented by the user to redeem the coupon. Optional.") + description: Optional[constr(strict=True, max_length=1000, min_length=0)] = Field(None, description="Detailed description of the coupon. Displayed to users.") + end_timestamp: StrictInt = Field(..., alias="endTimestamp", description="Coupon expiration time (epoch seconds). Coupon cannot be used after this time.") + image_url: Optional[StrictStr] = Field(None, alias="imageUrl", description="URL of the main image representing the coupon. Displayed in the coupon list.") + max_use_count_per_ticket: conint(strict=True, le=1) = Field(..., alias="maxUseCountPerTicket", description="Maximum number of times a single coupon ticket can be used. Use -1 to indicate no limit.") + start_timestamp: StrictInt = Field(..., alias="startTimestamp", description="Coupon start time (epoch seconds). Coupon can be used from this time.") + title: constr(strict=True, max_length=60, min_length=1) = Field(..., description="Title of the coupon. Displayed in the coupon list.") + usage_condition: Optional[constr(strict=True, max_length=100, min_length=0)] = Field(None, alias="usageCondition", description="Conditions for using the coupon. Shown to users.") + reward: Optional[CouponRewardRequest] = None + visibility: StrictStr = Field(..., description="Visibility of the coupon. Determines who can see or acquire the coupon.") + timezone: StrictStr = Field(..., description="Timezone for interpreting start and end timestamps.") + + __properties = ["acquisitionCondition", "barcodeImageUrl", "couponCode", "description", "endTimestamp", "imageUrl", "maxUseCountPerTicket", "startTimestamp", "title", "usageCondition", "reward", "visibility", "timezone"] + + @validator('visibility') + def visibility_validate_enum(cls, value): + """Validates the enum""" + if value not in ('UNLISTED', 'PUBLIC'): + raise ValueError("must be one of enum values ('UNLISTED', 'PUBLIC')") + return value + + @validator('timezone') + def timezone_validate_enum(cls, value): + """Validates the enum""" + if value not in ('ETC_GMT_MINUS_12', 'ETC_GMT_MINUS_11', 'PACIFIC_HONOLULU', 'AMERICA_ANCHORAGE', 'AMERICA_LOS_ANGELES', 'AMERICA_PHOENIX', 'AMERICA_CHICAGO', 'AMERICA_NEW_YORK', 'AMERICA_CARACAS', 'AMERICA_SANTIAGO', 'AMERICA_ST_JOHNS', 'AMERICA_SAO_PAULO', 'ETC_GMT_MINUS_2', 'ATLANTIC_CAPE_VERDE', 'EUROPE_LONDON', 'EUROPE_PARIS', 'EUROPE_ISTANBUL', 'EUROPE_MOSCOW', 'ASIA_TEHRAN', 'ASIA_TBILISI', 'ASIA_KABUL', 'ASIA_TASHKENT', 'ASIA_COLOMBO', 'ASIA_KATHMANDU', 'ASIA_ALMATY', 'ASIA_RANGOON', 'ASIA_BANGKOK', 'ASIA_TAIPEI', 'ASIA_TOKYO', 'AUSTRALIA_DARWIN', 'AUSTRALIA_SYDNEY', 'ASIA_VLADIVOSTOK', 'ETC_GMT_PLUS_12', 'PACIFIC_TONGATAPU'): + raise ValueError("must be one of enum values ('ETC_GMT_MINUS_12', 'ETC_GMT_MINUS_11', 'PACIFIC_HONOLULU', 'AMERICA_ANCHORAGE', 'AMERICA_LOS_ANGELES', 'AMERICA_PHOENIX', 'AMERICA_CHICAGO', 'AMERICA_NEW_YORK', 'AMERICA_CARACAS', 'AMERICA_SANTIAGO', 'AMERICA_ST_JOHNS', 'AMERICA_SAO_PAULO', 'ETC_GMT_MINUS_2', 'ATLANTIC_CAPE_VERDE', 'EUROPE_LONDON', 'EUROPE_PARIS', 'EUROPE_ISTANBUL', 'EUROPE_MOSCOW', 'ASIA_TEHRAN', 'ASIA_TBILISI', 'ASIA_KABUL', 'ASIA_TASHKENT', 'ASIA_COLOMBO', 'ASIA_KATHMANDU', 'ASIA_ALMATY', 'ASIA_RANGOON', 'ASIA_BANGKOK', 'ASIA_TAIPEI', 'ASIA_TOKYO', 'AUSTRALIA_DARWIN', 'AUSTRALIA_SYDNEY', 'ASIA_VLADIVOSTOK', 'ETC_GMT_PLUS_12', 'PACIFIC_TONGATAPU')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> CouponCreateRequest: + """Create an instance of CouponCreateRequest 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 acquisition_condition + if self.acquisition_condition: + _dict['acquisitionCondition'] = self.acquisition_condition.to_dict() + # override the default output from pydantic.v1 by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponCreateRequest: + """Create an instance of CouponCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponCreateRequest.parse_obj(obj) + + _obj = CouponCreateRequest.parse_obj({ + "acquisition_condition": AcquisitionConditionRequest.from_dict(obj.get("acquisitionCondition")) if obj.get("acquisitionCondition") is not None else None, + "barcode_image_url": obj.get("barcodeImageUrl"), + "coupon_code": obj.get("couponCode"), + "description": obj.get("description"), + "end_timestamp": obj.get("endTimestamp"), + "image_url": obj.get("imageUrl"), + "max_use_count_per_ticket": obj.get("maxUseCountPerTicket"), + "start_timestamp": obj.get("startTimestamp"), + "title": obj.get("title"), + "usage_condition": obj.get("usageCondition"), + "reward": CouponRewardRequest.from_dict(obj.get("reward")) if obj.get("reward") is not None else None, + "visibility": obj.get("visibility"), + "timezone": obj.get("timezone") + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_create_response.py b/linebot/v3/messaging/models/coupon_create_response.py new file mode 100644 index 00000000..5f607074 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_create_response.py @@ -0,0 +1,71 @@ +# coding: utf-8 + +""" + LINE Messaging API + + This document describes LINE Messaging API. # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic.v1 import BaseModel, Field, StrictStr + +class CouponCreateResponse(BaseModel): + """ + Response object returned after creating a coupon. Contains the coupon ID. + """ + coupon_id: StrictStr = Field(..., alias="couponId", description="Unique identifier of the coupon.") + + __properties = ["couponId"] + + 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) -> CouponCreateResponse: + """Create an instance of CouponCreateResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponCreateResponse: + """Create an instance of CouponCreateResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponCreateResponse.parse_obj(obj) + + _obj = CouponCreateResponse.parse_obj({ + "coupon_id": obj.get("couponId") + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_discount_reward_request.py b/linebot/v3/messaging/models/coupon_discount_reward_request.py new file mode 100644 index 00000000..35d71526 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_discount_reward_request.py @@ -0,0 +1,78 @@ +# 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 Optional +from pydantic.v1 import Field +from linebot.v3.messaging.models.coupon_reward_request import CouponRewardRequest +from linebot.v3.messaging.models.discount_price_info_request import DiscountPriceInfoRequest + +class CouponDiscountRewardRequest(CouponRewardRequest): + """ + CouponDiscountRewardRequest + """ + price_info: Optional[DiscountPriceInfoRequest] = Field(None, alias="priceInfo") + type: str = "discount" + + __properties = ["type", "priceInfo"] + + 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) -> CouponDiscountRewardRequest: + """Create an instance of CouponDiscountRewardRequest 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 price_info + if self.price_info: + _dict['priceInfo'] = self.price_info.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponDiscountRewardRequest: + """Create an instance of CouponDiscountRewardRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponDiscountRewardRequest.parse_obj(obj) + + _obj = CouponDiscountRewardRequest.parse_obj({ + "type": obj.get("type"), + "price_info": DiscountPriceInfoRequest.from_dict(obj.get("priceInfo")) if obj.get("priceInfo") is not None else None + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_discount_reward_response.py b/linebot/v3/messaging/models/coupon_discount_reward_response.py new file mode 100644 index 00000000..94fb50f3 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_discount_reward_response.py @@ -0,0 +1,78 @@ +# 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 Optional +from pydantic.v1 import Field +from linebot.v3.messaging.models.coupon_reward_response import CouponRewardResponse +from linebot.v3.messaging.models.discount_price_info_response import DiscountPriceInfoResponse + +class CouponDiscountRewardResponse(CouponRewardResponse): + """ + CouponDiscountRewardResponse + """ + price_info: Optional[DiscountPriceInfoResponse] = Field(None, alias="priceInfo") + type: str = "discount" + + __properties = ["type", "priceInfo"] + + 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) -> CouponDiscountRewardResponse: + """Create an instance of CouponDiscountRewardResponse 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 price_info + if self.price_info: + _dict['priceInfo'] = self.price_info.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponDiscountRewardResponse: + """Create an instance of CouponDiscountRewardResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponDiscountRewardResponse.parse_obj(obj) + + _obj = CouponDiscountRewardResponse.parse_obj({ + "type": obj.get("type"), + "price_info": DiscountPriceInfoResponse.from_dict(obj.get("priceInfo")) if obj.get("priceInfo") is not None else None + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_free_reward_request.py b/linebot/v3/messaging/models/coupon_free_reward_request.py new file mode 100644 index 00000000..521954fd --- /dev/null +++ b/linebot/v3/messaging/models/coupon_free_reward_request.py @@ -0,0 +1,72 @@ +# 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 linebot.v3.messaging.models.coupon_reward_request import CouponRewardRequest + +class CouponFreeRewardRequest(CouponRewardRequest): + """ + CouponFreeRewardRequest + """ + type: str = "free" + + __properties = ["type"] + + 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) -> CouponFreeRewardRequest: + """Create an instance of CouponFreeRewardRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponFreeRewardRequest: + """Create an instance of CouponFreeRewardRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponFreeRewardRequest.parse_obj(obj) + + _obj = CouponFreeRewardRequest.parse_obj({ + "type": obj.get("type") + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_free_reward_response.py b/linebot/v3/messaging/models/coupon_free_reward_response.py new file mode 100644 index 00000000..d1070368 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_free_reward_response.py @@ -0,0 +1,72 @@ +# 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 linebot.v3.messaging.models.coupon_reward_response import CouponRewardResponse + +class CouponFreeRewardResponse(CouponRewardResponse): + """ + CouponFreeRewardResponse + """ + type: str = "free" + + __properties = ["type"] + + 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) -> CouponFreeRewardResponse: + """Create an instance of CouponFreeRewardResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponFreeRewardResponse: + """Create an instance of CouponFreeRewardResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponFreeRewardResponse.parse_obj(obj) + + _obj = CouponFreeRewardResponse.parse_obj({ + "type": obj.get("type") + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_gift_reward_request.py b/linebot/v3/messaging/models/coupon_gift_reward_request.py new file mode 100644 index 00000000..10c989e7 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_gift_reward_request.py @@ -0,0 +1,72 @@ +# 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 linebot.v3.messaging.models.coupon_reward_request import CouponRewardRequest + +class CouponGiftRewardRequest(CouponRewardRequest): + """ + CouponGiftRewardRequest + """ + type: str = "gift" + + __properties = ["type"] + + 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) -> CouponGiftRewardRequest: + """Create an instance of CouponGiftRewardRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponGiftRewardRequest: + """Create an instance of CouponGiftRewardRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponGiftRewardRequest.parse_obj(obj) + + _obj = CouponGiftRewardRequest.parse_obj({ + "type": obj.get("type") + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_gift_reward_response.py b/linebot/v3/messaging/models/coupon_gift_reward_response.py new file mode 100644 index 00000000..268b9a3f --- /dev/null +++ b/linebot/v3/messaging/models/coupon_gift_reward_response.py @@ -0,0 +1,72 @@ +# 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 linebot.v3.messaging.models.coupon_reward_response import CouponRewardResponse + +class CouponGiftRewardResponse(CouponRewardResponse): + """ + CouponGiftRewardResponse + """ + type: str = "gift" + + __properties = ["type"] + + 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) -> CouponGiftRewardResponse: + """Create an instance of CouponGiftRewardResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponGiftRewardResponse: + """Create an instance of CouponGiftRewardResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponGiftRewardResponse.parse_obj(obj) + + _obj = CouponGiftRewardResponse.parse_obj({ + "type": obj.get("type") + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_list_response.py b/linebot/v3/messaging/models/coupon_list_response.py new file mode 100644 index 00000000..7725eb7e --- /dev/null +++ b/linebot/v3/messaging/models/coupon_list_response.py @@ -0,0 +1,73 @@ +# coding: utf-8 + +""" + LINE Messaging API + + This document describes LINE Messaging API. # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic.v1 import BaseModel, Field, StrictStr + +class CouponListResponse(BaseModel): + """ + Summary information about a coupon, used in coupon lists. + """ + coupon_id: StrictStr = Field(..., alias="couponId", description="Unique identifier of the coupon.") + title: StrictStr = Field(..., description="Title of the coupon. Displayed in the coupon list.") + + __properties = ["couponId", "title"] + + 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) -> CouponListResponse: + """Create an instance of CouponListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponListResponse: + """Create an instance of CouponListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponListResponse.parse_obj(obj) + + _obj = CouponListResponse.parse_obj({ + "coupon_id": obj.get("couponId"), + "title": obj.get("title") + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_message.py b/linebot/v3/messaging/models/coupon_message.py new file mode 100644 index 00000000..9d862fc2 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_message.py @@ -0,0 +1,87 @@ +# 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 Optional +from pydantic.v1 import Field, StrictStr, constr +from linebot.v3.messaging.models.message import Message +from linebot.v3.messaging.models.quick_reply import QuickReply +from linebot.v3.messaging.models.sender import Sender + +class CouponMessage(Message): + """ + CouponMessage + https://developers.line.biz/en/reference/messaging-api/#coupon-message + """ + coupon_id: StrictStr = Field(..., alias="couponId", description="Unique identifier of the coupon.") + delivery_tag: Optional[constr(strict=True, max_length=30)] = Field(None, alias="deliveryTag", description="Delivery route tag information. It can be used for analysis in LINE OA Manager.") + type: str = "coupon" + + __properties = ["type", "quickReply", "sender", "couponId", "deliveryTag"] + + 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) -> CouponMessage: + """Create an instance of CouponMessage 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 quick_reply + if self.quick_reply: + _dict['quickReply'] = self.quick_reply.to_dict() + # override the default output from pydantic.v1 by calling `to_dict()` of sender + if self.sender: + _dict['sender'] = self.sender.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponMessage: + """Create an instance of CouponMessage from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponMessage.parse_obj(obj) + + _obj = CouponMessage.parse_obj({ + "type": obj.get("type"), + "quick_reply": QuickReply.from_dict(obj.get("quickReply")) if obj.get("quickReply") is not None else None, + "sender": Sender.from_dict(obj.get("sender")) if obj.get("sender") is not None else None, + "coupon_id": obj.get("couponId"), + "delivery_tag": obj.get("deliveryTag") + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_others_reward_request.py b/linebot/v3/messaging/models/coupon_others_reward_request.py new file mode 100644 index 00000000..81b67db1 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_others_reward_request.py @@ -0,0 +1,72 @@ +# 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 linebot.v3.messaging.models.coupon_reward_request import CouponRewardRequest + +class CouponOthersRewardRequest(CouponRewardRequest): + """ + CouponOthersRewardRequest + """ + type: str = "others" + + __properties = ["type"] + + 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) -> CouponOthersRewardRequest: + """Create an instance of CouponOthersRewardRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponOthersRewardRequest: + """Create an instance of CouponOthersRewardRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponOthersRewardRequest.parse_obj(obj) + + _obj = CouponOthersRewardRequest.parse_obj({ + "type": obj.get("type") + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_others_reward_response.py b/linebot/v3/messaging/models/coupon_others_reward_response.py new file mode 100644 index 00000000..5d75fd2e --- /dev/null +++ b/linebot/v3/messaging/models/coupon_others_reward_response.py @@ -0,0 +1,72 @@ +# 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 linebot.v3.messaging.models.coupon_reward_response import CouponRewardResponse + +class CouponOthersRewardResponse(CouponRewardResponse): + """ + CouponOthersRewardResponse + """ + type: str = "others" + + __properties = ["type"] + + 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) -> CouponOthersRewardResponse: + """Create an instance of CouponOthersRewardResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponOthersRewardResponse: + """Create an instance of CouponOthersRewardResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponOthersRewardResponse.parse_obj(obj) + + _obj = CouponOthersRewardResponse.parse_obj({ + "type": obj.get("type") + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_response.py b/linebot/v3/messaging/models/coupon_response.py new file mode 100644 index 00000000..a90ac5e3 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_response.py @@ -0,0 +1,143 @@ +# 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 Optional +from pydantic.v1 import BaseModel, Field, StrictInt, StrictStr, validator +from linebot.v3.messaging.models.acquisition_condition_response import AcquisitionConditionResponse +from linebot.v3.messaging.models.coupon_reward_response import CouponRewardResponse + +class CouponResponse(BaseModel): + """ + Detailed information about a coupon, including all properties and current status. + """ + acquisition_condition: Optional[AcquisitionConditionResponse] = Field(None, alias="acquisitionCondition") + barcode_image_url: Optional[StrictStr] = Field(None, alias="barcodeImageUrl", description="URL of the barcode image associated with the coupon. Used for in-store redemption.") + coupon_code: Optional[StrictStr] = Field(None, alias="couponCode", description="Unique code to be presented by the user to redeem the coupon.") + description: Optional[StrictStr] = Field(None, description="Detailed description of the coupon. Displayed to users.") + end_timestamp: Optional[StrictInt] = Field(None, alias="endTimestamp", description="Coupon expiration time (epoch seconds). Coupon cannot be used after this time.") + image_url: Optional[StrictStr] = Field(None, alias="imageUrl", description="URL of the main image representing the coupon. Displayed in the coupon list.") + max_acquire_count: Optional[StrictInt] = Field(None, alias="maxAcquireCount", description="Maximum number of coupons that can be issued in total.") + max_use_count_per_ticket: Optional[StrictInt] = Field(None, alias="maxUseCountPerTicket", description="Maximum number of times a single coupon ticket can be used.") + max_ticket_per_user: Optional[StrictInt] = Field(None, alias="maxTicketPerUser", description="Maximum number of coupon tickets a single user can acquire.") + start_timestamp: Optional[StrictInt] = Field(None, alias="startTimestamp", description="Coupon start time (epoch seconds). Coupon can be used from this time.") + title: Optional[StrictStr] = Field(None, description="Title of the coupon. Displayed in the coupon list.") + usage_condition: Optional[StrictStr] = Field(None, alias="usageCondition", description="Conditions for using the coupon. Shown to users.") + reward: Optional[CouponRewardResponse] = None + visibility: Optional[StrictStr] = Field(None, description="Visibility of the coupon. Determines who can see or acquire the coupon.") + timezone: Optional[StrictStr] = Field(None, description="Timezone for interpreting start and end timestamps.") + coupon_id: Optional[StrictStr] = Field(None, alias="couponId", description="Unique identifier of the coupon.") + created_timestamp: Optional[StrictInt] = Field(None, alias="createdTimestamp", description="Created timestamp (seconds) of the coupon.") + status: Optional[StrictStr] = Field(None, description="Current status of the coupon.") + + __properties = ["acquisitionCondition", "barcodeImageUrl", "couponCode", "description", "endTimestamp", "imageUrl", "maxAcquireCount", "maxUseCountPerTicket", "maxTicketPerUser", "startTimestamp", "title", "usageCondition", "reward", "visibility", "timezone", "couponId", "createdTimestamp", "status"] + + @validator('visibility') + def visibility_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('UNLISTED', 'PUBLIC', 'PRIVATE'): + raise ValueError("must be one of enum values ('UNLISTED', 'PUBLIC', 'PRIVATE')") + return value + + @validator('timezone') + def timezone_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('ETC_GMT_MINUS_12', 'ETC_GMT_MINUS_11', 'PACIFIC_HONOLULU', 'AMERICA_ANCHORAGE', 'AMERICA_LOS_ANGELES', 'AMERICA_PHOENIX', 'AMERICA_CHICAGO', 'AMERICA_NEW_YORK', 'AMERICA_CARACAS', 'AMERICA_SANTIAGO', 'AMERICA_ST_JOHNS', 'AMERICA_SAO_PAULO', 'ETC_GMT_MINUS_2', 'ATLANTIC_CAPE_VERDE', 'EUROPE_LONDON', 'EUROPE_PARIS', 'EUROPE_ISTANBUL', 'EUROPE_MOSCOW', 'ASIA_TEHRAN', 'ASIA_TBILISI', 'ASIA_KABUL', 'ASIA_TASHKENT', 'ASIA_COLOMBO', 'ASIA_KATHMANDU', 'ASIA_ALMATY', 'ASIA_RANGOON', 'ASIA_BANGKOK', 'ASIA_TAIPEI', 'ASIA_TOKYO', 'AUSTRALIA_DARWIN', 'AUSTRALIA_SYDNEY', 'ASIA_VLADIVOSTOK', 'ETC_GMT_PLUS_12', 'PACIFIC_TONGATAPU'): + raise ValueError("must be one of enum values ('ETC_GMT_MINUS_12', 'ETC_GMT_MINUS_11', 'PACIFIC_HONOLULU', 'AMERICA_ANCHORAGE', 'AMERICA_LOS_ANGELES', 'AMERICA_PHOENIX', 'AMERICA_CHICAGO', 'AMERICA_NEW_YORK', 'AMERICA_CARACAS', 'AMERICA_SANTIAGO', 'AMERICA_ST_JOHNS', 'AMERICA_SAO_PAULO', 'ETC_GMT_MINUS_2', 'ATLANTIC_CAPE_VERDE', 'EUROPE_LONDON', 'EUROPE_PARIS', 'EUROPE_ISTANBUL', 'EUROPE_MOSCOW', 'ASIA_TEHRAN', 'ASIA_TBILISI', 'ASIA_KABUL', 'ASIA_TASHKENT', 'ASIA_COLOMBO', 'ASIA_KATHMANDU', 'ASIA_ALMATY', 'ASIA_RANGOON', 'ASIA_BANGKOK', 'ASIA_TAIPEI', 'ASIA_TOKYO', 'AUSTRALIA_DARWIN', 'AUSTRALIA_SYDNEY', 'ASIA_VLADIVOSTOK', 'ETC_GMT_PLUS_12', 'PACIFIC_TONGATAPU')") + return value + + @validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('DRAFT', 'RUNNING', 'CLOSED'): + raise ValueError("must be one of enum values ('DRAFT', 'RUNNING', 'CLOSED')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> CouponResponse: + """Create an instance of CouponResponse 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 acquisition_condition + if self.acquisition_condition: + _dict['acquisitionCondition'] = self.acquisition_condition.to_dict() + # override the default output from pydantic.v1 by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CouponResponse: + """Create an instance of CouponResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CouponResponse.parse_obj(obj) + + _obj = CouponResponse.parse_obj({ + "acquisition_condition": AcquisitionConditionResponse.from_dict(obj.get("acquisitionCondition")) if obj.get("acquisitionCondition") is not None else None, + "barcode_image_url": obj.get("barcodeImageUrl"), + "coupon_code": obj.get("couponCode"), + "description": obj.get("description"), + "end_timestamp": obj.get("endTimestamp"), + "image_url": obj.get("imageUrl"), + "max_acquire_count": obj.get("maxAcquireCount"), + "max_use_count_per_ticket": obj.get("maxUseCountPerTicket"), + "max_ticket_per_user": obj.get("maxTicketPerUser"), + "start_timestamp": obj.get("startTimestamp"), + "title": obj.get("title"), + "usage_condition": obj.get("usageCondition"), + "reward": CouponRewardResponse.from_dict(obj.get("reward")) if obj.get("reward") is not None else None, + "visibility": obj.get("visibility"), + "timezone": obj.get("timezone"), + "coupon_id": obj.get("couponId"), + "created_timestamp": obj.get("createdTimestamp"), + "status": obj.get("status") + }) + return _obj + diff --git a/linebot/v3/messaging/models/coupon_reward_request.py b/linebot/v3/messaging/models/coupon_reward_request.py new file mode 100644 index 00000000..20ba3535 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_reward_request.py @@ -0,0 +1,92 @@ +# 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 +import linebot.v3.messaging.models + + +from typing import Union +from pydantic.v1 import BaseModel, Field, StrictStr + +class CouponRewardRequest(BaseModel): + """ + CouponRewardRequest + """ + type: StrictStr = Field(..., description="Type of coupon. Determines the benefit provided.") + + __properties = ["type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + # JSON field name that stores the object type + __discriminator_property_name = 'type' + + # discriminator mappings + __discriminator_value_class_map = { + 'cashBack': 'CouponCashBackRewardRequest', + 'discount': 'CouponDiscountRewardRequest', + 'free': 'CouponFreeRewardRequest', + 'gift': 'CouponGiftRewardRequest', + 'others': 'CouponOthersRewardRequest' + } + + @classmethod + def get_discriminator_value(cls, obj: dict) -> str: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + + 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) -> Union(CouponCashBackRewardRequest, CouponDiscountRewardRequest, CouponFreeRewardRequest, CouponGiftRewardRequest, CouponOthersRewardRequest): + """Create an instance of CouponRewardRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Union(CouponCashBackRewardRequest, CouponDiscountRewardRequest, CouponFreeRewardRequest, CouponGiftRewardRequest, CouponOthersRewardRequest): + """Create an instance of CouponRewardRequest from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type: + klass = getattr(linebot.v3.messaging.models, object_type) + return klass.from_dict(obj) + else: + raise ValueError("CouponRewardRequest failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + diff --git a/linebot/v3/messaging/models/coupon_reward_response.py b/linebot/v3/messaging/models/coupon_reward_response.py new file mode 100644 index 00000000..2e6f9f46 --- /dev/null +++ b/linebot/v3/messaging/models/coupon_reward_response.py @@ -0,0 +1,92 @@ +# 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 +import linebot.v3.messaging.models + + +from typing import Union +from pydantic.v1 import BaseModel, Field, StrictStr + +class CouponRewardResponse(BaseModel): + """ + CouponRewardResponse + """ + type: StrictStr = Field(..., description="Type of coupon. Determines the benefit provided.") + + __properties = ["type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + # JSON field name that stores the object type + __discriminator_property_name = 'type' + + # discriminator mappings + __discriminator_value_class_map = { + 'cashBack': 'CouponCashBackRewardResponse', + 'discount': 'CouponDiscountRewardResponse', + 'free': 'CouponFreeRewardResponse', + 'gift': 'CouponGiftRewardResponse', + 'others': 'CouponOthersRewardResponse' + } + + @classmethod + def get_discriminator_value(cls, obj: dict) -> str: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + + 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) -> Union(CouponCashBackRewardResponse, CouponDiscountRewardResponse, CouponFreeRewardResponse, CouponGiftRewardResponse, CouponOthersRewardResponse): + """Create an instance of CouponRewardResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Union(CouponCashBackRewardResponse, CouponDiscountRewardResponse, CouponFreeRewardResponse, CouponGiftRewardResponse, CouponOthersRewardResponse): + """Create an instance of CouponRewardResponse from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type: + klass = getattr(linebot.v3.messaging.models, object_type) + return klass.from_dict(obj) + else: + raise ValueError("CouponRewardResponse failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + diff --git a/linebot/v3/messaging/models/discount_explicit_price_info_request.py b/linebot/v3/messaging/models/discount_explicit_price_info_request.py new file mode 100644 index 00000000..954c0328 --- /dev/null +++ b/linebot/v3/messaging/models/discount_explicit_price_info_request.py @@ -0,0 +1,76 @@ +# 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 Optional +from pydantic.v1 import Field, StrictInt +from linebot.v3.messaging.models.discount_price_info_request import DiscountPriceInfoRequest + +class DiscountExplicitPriceInfoRequest(DiscountPriceInfoRequest): + """ + DiscountExplicitPriceInfoRequest + """ + price_after_discount: Optional[StrictInt] = Field(None, alias="priceAfterDiscount") + original_price: Optional[StrictInt] = Field(None, alias="originalPrice") + type: str = "explicit" + + __properties = ["type", "priceAfterDiscount", "originalPrice"] + + 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) -> DiscountExplicitPriceInfoRequest: + """Create an instance of DiscountExplicitPriceInfoRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> DiscountExplicitPriceInfoRequest: + """Create an instance of DiscountExplicitPriceInfoRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DiscountExplicitPriceInfoRequest.parse_obj(obj) + + _obj = DiscountExplicitPriceInfoRequest.parse_obj({ + "type": obj.get("type"), + "price_after_discount": obj.get("priceAfterDiscount"), + "original_price": obj.get("originalPrice") + }) + return _obj + diff --git a/linebot/v3/messaging/models/discount_explicit_price_info_response.py b/linebot/v3/messaging/models/discount_explicit_price_info_response.py new file mode 100644 index 00000000..2c83959b --- /dev/null +++ b/linebot/v3/messaging/models/discount_explicit_price_info_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + LINE Messaging API + + This document describes LINE Messaging API. # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic.v1 import Field, StrictInt, StrictStr, validator +from linebot.v3.messaging.models.discount_price_info_response import DiscountPriceInfoResponse + +class DiscountExplicitPriceInfoResponse(DiscountPriceInfoResponse): + """ + DiscountExplicitPriceInfoResponse + """ + currency: Optional[StrictStr] = Field(None, description="Currency code (e.g., JPY, THB, TWD).") + price_after_discount: Optional[StrictInt] = Field(None, alias="priceAfterDiscount") + original_price: Optional[StrictInt] = Field(None, alias="originalPrice") + type: str = "explicit" + + __properties = ["type", "currency", "priceAfterDiscount", "originalPrice"] + + @validator('currency') + def currency_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('JPY', 'THB', 'TWD'): + raise ValueError("must be one of enum values ('JPY', 'THB', 'TWD')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> DiscountExplicitPriceInfoResponse: + """Create an instance of DiscountExplicitPriceInfoResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> DiscountExplicitPriceInfoResponse: + """Create an instance of DiscountExplicitPriceInfoResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DiscountExplicitPriceInfoResponse.parse_obj(obj) + + _obj = DiscountExplicitPriceInfoResponse.parse_obj({ + "type": obj.get("type"), + "currency": obj.get("currency"), + "price_after_discount": obj.get("priceAfterDiscount"), + "original_price": obj.get("originalPrice") + }) + return _obj + diff --git a/linebot/v3/messaging/models/discount_fixed_price_info_request.py b/linebot/v3/messaging/models/discount_fixed_price_info_request.py new file mode 100644 index 00000000..cedb40d1 --- /dev/null +++ b/linebot/v3/messaging/models/discount_fixed_price_info_request.py @@ -0,0 +1,74 @@ +# 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 Optional +from pydantic.v1 import Field, StrictInt +from linebot.v3.messaging.models.discount_price_info_request import DiscountPriceInfoRequest + +class DiscountFixedPriceInfoRequest(DiscountPriceInfoRequest): + """ + DiscountFixedPriceInfoRequest + """ + fixed_amount: Optional[StrictInt] = Field(None, alias="fixedAmount") + type: str = "fixed" + + __properties = ["type", "fixedAmount"] + + 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) -> DiscountFixedPriceInfoRequest: + """Create an instance of DiscountFixedPriceInfoRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> DiscountFixedPriceInfoRequest: + """Create an instance of DiscountFixedPriceInfoRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DiscountFixedPriceInfoRequest.parse_obj(obj) + + _obj = DiscountFixedPriceInfoRequest.parse_obj({ + "type": obj.get("type"), + "fixed_amount": obj.get("fixedAmount") + }) + return _obj + diff --git a/linebot/v3/messaging/models/discount_fixed_price_info_response.py b/linebot/v3/messaging/models/discount_fixed_price_info_response.py new file mode 100644 index 00000000..1d90aa6c --- /dev/null +++ b/linebot/v3/messaging/models/discount_fixed_price_info_response.py @@ -0,0 +1,86 @@ +# 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 Optional +from pydantic.v1 import Field, StrictInt, StrictStr, validator +from linebot.v3.messaging.models.discount_price_info_response import DiscountPriceInfoResponse + +class DiscountFixedPriceInfoResponse(DiscountPriceInfoResponse): + """ + DiscountFixedPriceInfoResponse + """ + currency: Optional[StrictStr] = Field(None, description="Currency code (e.g., JPY, THB, TWD).") + fixed_amount: Optional[StrictInt] = Field(None, alias="fixedAmount") + type: str = "fixed" + + __properties = ["type", "currency", "fixedAmount"] + + @validator('currency') + def currency_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('JPY', 'THB', 'TWD'): + raise ValueError("must be one of enum values ('JPY', 'THB', 'TWD')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> DiscountFixedPriceInfoResponse: + """Create an instance of DiscountFixedPriceInfoResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> DiscountFixedPriceInfoResponse: + """Create an instance of DiscountFixedPriceInfoResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DiscountFixedPriceInfoResponse.parse_obj(obj) + + _obj = DiscountFixedPriceInfoResponse.parse_obj({ + "type": obj.get("type"), + "currency": obj.get("currency"), + "fixed_amount": obj.get("fixedAmount") + }) + return _obj + diff --git a/linebot/v3/messaging/models/discount_percentage_price_info_request.py b/linebot/v3/messaging/models/discount_percentage_price_info_request.py new file mode 100644 index 00000000..6616ebb8 --- /dev/null +++ b/linebot/v3/messaging/models/discount_percentage_price_info_request.py @@ -0,0 +1,74 @@ +# 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 Optional +from pydantic.v1 import Field, conint +from linebot.v3.messaging.models.discount_price_info_request import DiscountPriceInfoRequest + +class DiscountPercentagePriceInfoRequest(DiscountPriceInfoRequest): + """ + DiscountPercentagePriceInfoRequest + """ + percentage: Optional[conint(strict=True, le=99, ge=1)] = Field(None, description="Specifies the discount rate as a percentage. Must be an integer between 1 and 99.") + type: str = "percentage" + + __properties = ["type", "percentage"] + + 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) -> DiscountPercentagePriceInfoRequest: + """Create an instance of DiscountPercentagePriceInfoRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> DiscountPercentagePriceInfoRequest: + """Create an instance of DiscountPercentagePriceInfoRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DiscountPercentagePriceInfoRequest.parse_obj(obj) + + _obj = DiscountPercentagePriceInfoRequest.parse_obj({ + "type": obj.get("type"), + "percentage": obj.get("percentage") + }) + return _obj + diff --git a/linebot/v3/messaging/models/discount_percentage_price_info_response.py b/linebot/v3/messaging/models/discount_percentage_price_info_response.py new file mode 100644 index 00000000..16038da9 --- /dev/null +++ b/linebot/v3/messaging/models/discount_percentage_price_info_response.py @@ -0,0 +1,74 @@ +# 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 Optional +from pydantic.v1 import StrictInt +from linebot.v3.messaging.models.discount_price_info_response import DiscountPriceInfoResponse + +class DiscountPercentagePriceInfoResponse(DiscountPriceInfoResponse): + """ + DiscountPercentagePriceInfoResponse + """ + percentage: Optional[StrictInt] = None + type: str = "percentage" + + __properties = ["type", "percentage"] + + 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) -> DiscountPercentagePriceInfoResponse: + """Create an instance of DiscountPercentagePriceInfoResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> DiscountPercentagePriceInfoResponse: + """Create an instance of DiscountPercentagePriceInfoResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DiscountPercentagePriceInfoResponse.parse_obj(obj) + + _obj = DiscountPercentagePriceInfoResponse.parse_obj({ + "type": obj.get("type"), + "percentage": obj.get("percentage") + }) + return _obj + diff --git a/linebot/v3/messaging/models/discount_price_info_request.py b/linebot/v3/messaging/models/discount_price_info_request.py new file mode 100644 index 00000000..64061896 --- /dev/null +++ b/linebot/v3/messaging/models/discount_price_info_request.py @@ -0,0 +1,90 @@ +# 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 +import linebot.v3.messaging.models + + +from typing import Union +from pydantic.v1 import BaseModel, Field, StrictStr + +class DiscountPriceInfoRequest(BaseModel): + """ + DiscountPriceInfoRequest + """ + type: StrictStr = Field(...) + + __properties = ["type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + # JSON field name that stores the object type + __discriminator_property_name = 'type' + + # discriminator mappings + __discriminator_value_class_map = { + 'explicit': 'DiscountExplicitPriceInfoRequest', + 'fixed': 'DiscountFixedPriceInfoRequest', + 'percentage': 'DiscountPercentagePriceInfoRequest' + } + + @classmethod + def get_discriminator_value(cls, obj: dict) -> str: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + + 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) -> Union(DiscountExplicitPriceInfoRequest, DiscountFixedPriceInfoRequest, DiscountPercentagePriceInfoRequest): + """Create an instance of DiscountPriceInfoRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Union(DiscountExplicitPriceInfoRequest, DiscountFixedPriceInfoRequest, DiscountPercentagePriceInfoRequest): + """Create an instance of DiscountPriceInfoRequest from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type: + klass = getattr(linebot.v3.messaging.models, object_type) + return klass.from_dict(obj) + else: + raise ValueError("DiscountPriceInfoRequest failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + diff --git a/linebot/v3/messaging/models/discount_price_info_response.py b/linebot/v3/messaging/models/discount_price_info_response.py new file mode 100644 index 00000000..df292521 --- /dev/null +++ b/linebot/v3/messaging/models/discount_price_info_response.py @@ -0,0 +1,90 @@ +# 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 +import linebot.v3.messaging.models + + +from typing import Union +from pydantic.v1 import BaseModel, Field, StrictStr + +class DiscountPriceInfoResponse(BaseModel): + """ + DiscountPriceInfoResponse + """ + type: StrictStr = Field(...) + + __properties = ["type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + # JSON field name that stores the object type + __discriminator_property_name = 'type' + + # discriminator mappings + __discriminator_value_class_map = { + 'explicit': 'DiscountExplicitPriceInfoResponse', + 'fixed': 'DiscountFixedPriceInfoResponse', + 'percentage': 'DiscountPercentagePriceInfoResponse' + } + + @classmethod + def get_discriminator_value(cls, obj: dict) -> str: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + + 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) -> Union(DiscountExplicitPriceInfoResponse, DiscountFixedPriceInfoResponse, DiscountPercentagePriceInfoResponse): + """Create an instance of DiscountPriceInfoResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Union(DiscountExplicitPriceInfoResponse, DiscountFixedPriceInfoResponse, DiscountPercentagePriceInfoResponse): + """Create an instance of DiscountPriceInfoResponse from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type: + klass = getattr(linebot.v3.messaging.models, object_type) + return klass.from_dict(obj) + else: + raise ValueError("DiscountPriceInfoResponse failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + diff --git a/linebot/v3/messaging/models/lottery_acquisition_condition_request.py b/linebot/v3/messaging/models/lottery_acquisition_condition_request.py new file mode 100644 index 00000000..7cee2a63 --- /dev/null +++ b/linebot/v3/messaging/models/lottery_acquisition_condition_request.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + LINE Messaging API + + This document describes LINE Messaging API. # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic.v1 import Field, conint +from linebot.v3.messaging.models.acquisition_condition_request import AcquisitionConditionRequest + +class LotteryAcquisitionConditionRequest(AcquisitionConditionRequest): + """ + LotteryAcquisitionConditionRequest + """ + lottery_probability: conint(strict=True, le=99, ge=1) = Field(..., alias="lotteryProbability", description="Probability (1-99) of winning the coupon in lottery-type campaigns.") + max_acquire_count: conint(strict=True, le=999999) = Field(..., alias="maxAcquireCount", description="Maximum number of coupons that can be issued in total. Use -1 to indicate no limit") + type: str = "lottery" + + __properties = ["type", "lotteryProbability", "maxAcquireCount"] + + 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) -> LotteryAcquisitionConditionRequest: + """Create an instance of LotteryAcquisitionConditionRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> LotteryAcquisitionConditionRequest: + """Create an instance of LotteryAcquisitionConditionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return LotteryAcquisitionConditionRequest.parse_obj(obj) + + _obj = LotteryAcquisitionConditionRequest.parse_obj({ + "type": obj.get("type"), + "lottery_probability": obj.get("lotteryProbability"), + "max_acquire_count": obj.get("maxAcquireCount") + }) + return _obj + diff --git a/linebot/v3/messaging/models/lottery_acquisition_condition_response.py b/linebot/v3/messaging/models/lottery_acquisition_condition_response.py new file mode 100644 index 00000000..a1bb80fe --- /dev/null +++ b/linebot/v3/messaging/models/lottery_acquisition_condition_response.py @@ -0,0 +1,76 @@ +# 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 Optional +from pydantic.v1 import Field, StrictInt +from linebot.v3.messaging.models.acquisition_condition_response import AcquisitionConditionResponse + +class LotteryAcquisitionConditionResponse(AcquisitionConditionResponse): + """ + LotteryAcquisitionConditionResponse + """ + lottery_probability: Optional[StrictInt] = Field(None, alias="lotteryProbability") + max_acquire_count: Optional[StrictInt] = Field(None, alias="maxAcquireCount") + type: str = "lottery" + + __properties = ["type", "lotteryProbability", "maxAcquireCount"] + + 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) -> LotteryAcquisitionConditionResponse: + """Create an instance of LotteryAcquisitionConditionResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> LotteryAcquisitionConditionResponse: + """Create an instance of LotteryAcquisitionConditionResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return LotteryAcquisitionConditionResponse.parse_obj(obj) + + _obj = LotteryAcquisitionConditionResponse.parse_obj({ + "type": obj.get("type"), + "lottery_probability": obj.get("lotteryProbability"), + "max_acquire_count": obj.get("maxAcquireCount") + }) + return _obj + diff --git a/linebot/v3/messaging/models/message.py b/linebot/v3/messaging/models/message.py index c792f804..4bfd2a02 100644 --- a/linebot/v3/messaging/models/message.py +++ b/linebot/v3/messaging/models/message.py @@ -46,6 +46,7 @@ class Config: # discriminator mappings __discriminator_value_class_map = { 'audio': 'AudioMessage', + 'coupon': 'CouponMessage', 'flex': 'FlexMessage', 'image': 'ImageMessage', 'imagemap': 'ImagemapMessage', @@ -75,7 +76,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Union(AudioMessage, FlexMessage, ImageMessage, ImagemapMessage, LocationMessage, StickerMessage, TemplateMessage, TextMessage, TextMessageV2, VideoMessage): + def from_json(cls, json_str: str) -> Union(AudioMessage, CouponMessage, FlexMessage, ImageMessage, ImagemapMessage, LocationMessage, StickerMessage, TemplateMessage, TextMessage, TextMessageV2, VideoMessage): """Create an instance of Message from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -94,7 +95,7 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Union(AudioMessage, FlexMessage, ImageMessage, ImagemapMessage, LocationMessage, StickerMessage, TemplateMessage, TextMessage, TextMessageV2, VideoMessage): + def from_dict(cls, obj: dict) -> Union(AudioMessage, CouponMessage, FlexMessage, ImageMessage, ImagemapMessage, LocationMessage, StickerMessage, TemplateMessage, TextMessage, TextMessageV2, VideoMessage): """Create an instance of Message from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) diff --git a/linebot/v3/messaging/models/messaging_api_pager_coupon_list_response.py b/linebot/v3/messaging/models/messaging_api_pager_coupon_list_response.py new file mode 100644 index 00000000..3d999041 --- /dev/null +++ b/linebot/v3/messaging/models/messaging_api_pager_coupon_list_response.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" + LINE Messaging API + + This document describes LINE Messaging API. # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional +from pydantic.v1 import BaseModel, Field, StrictStr, conlist +from linebot.v3.messaging.models.coupon_list_response import CouponListResponse + +class MessagingApiPagerCouponListResponse(BaseModel): + """ + Paginated response object containing a list of coupons. + """ + items: conlist(CouponListResponse) = Field(..., description="List of coupon summary objects.") + next: Optional[StrictStr] = Field(None, description="Token for fetching the next page of results.") + + __properties = ["items", "next"] + + 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) -> MessagingApiPagerCouponListResponse: + """Create an instance of MessagingApiPagerCouponListResponse 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 items (list) + _items = [] + if self.items: + for _item in self.items: + if _item: + _items.append(_item.to_dict()) + _dict['items'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> MessagingApiPagerCouponListResponse: + """Create an instance of MessagingApiPagerCouponListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return MessagingApiPagerCouponListResponse.parse_obj(obj) + + _obj = MessagingApiPagerCouponListResponse.parse_obj({ + "items": [CouponListResponse.from_dict(_item) for _item in obj.get("items")] if obj.get("items") is not None else None, + "next": obj.get("next") + }) + return _obj + diff --git a/linebot/v3/messaging/models/normal_acquisition_condition_request.py b/linebot/v3/messaging/models/normal_acquisition_condition_request.py new file mode 100644 index 00000000..14d0f164 --- /dev/null +++ b/linebot/v3/messaging/models/normal_acquisition_condition_request.py @@ -0,0 +1,72 @@ +# 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 linebot.v3.messaging.models.acquisition_condition_request import AcquisitionConditionRequest + +class NormalAcquisitionConditionRequest(AcquisitionConditionRequest): + """ + NormalAcquisitionConditionRequest + """ + type: str = "normal" + + __properties = ["type"] + + 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) -> NormalAcquisitionConditionRequest: + """Create an instance of NormalAcquisitionConditionRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> NormalAcquisitionConditionRequest: + """Create an instance of NormalAcquisitionConditionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return NormalAcquisitionConditionRequest.parse_obj(obj) + + _obj = NormalAcquisitionConditionRequest.parse_obj({ + "type": obj.get("type") + }) + return _obj + diff --git a/linebot/v3/messaging/models/normal_acquisition_condition_response.py b/linebot/v3/messaging/models/normal_acquisition_condition_response.py new file mode 100644 index 00000000..17c926b1 --- /dev/null +++ b/linebot/v3/messaging/models/normal_acquisition_condition_response.py @@ -0,0 +1,72 @@ +# 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 linebot.v3.messaging.models.acquisition_condition_response import AcquisitionConditionResponse + +class NormalAcquisitionConditionResponse(AcquisitionConditionResponse): + """ + NormalAcquisitionConditionResponse + """ + type: str = "normal" + + __properties = ["type"] + + 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) -> NormalAcquisitionConditionResponse: + """Create an instance of NormalAcquisitionConditionResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> NormalAcquisitionConditionResponse: + """Create an instance of NormalAcquisitionConditionResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return NormalAcquisitionConditionResponse.parse_obj(obj) + + _obj = NormalAcquisitionConditionResponse.parse_obj({ + "type": obj.get("type") + }) + return _obj + diff --git a/linebot/v3/messaging/models/referral_acquisition_condition_response.py b/linebot/v3/messaging/models/referral_acquisition_condition_response.py new file mode 100644 index 00000000..81672b28 --- /dev/null +++ b/linebot/v3/messaging/models/referral_acquisition_condition_response.py @@ -0,0 +1,72 @@ +# 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 linebot.v3.messaging.models.acquisition_condition_response import AcquisitionConditionResponse + +class ReferralAcquisitionConditionResponse(AcquisitionConditionResponse): + """ + ReferralAcquisitionConditionResponse + """ + type: str = "referral" + + __properties = ["type"] + + 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) -> ReferralAcquisitionConditionResponse: + """Create an instance of ReferralAcquisitionConditionResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ReferralAcquisitionConditionResponse: + """Create an instance of ReferralAcquisitionConditionResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ReferralAcquisitionConditionResponse.parse_obj(obj) + + _obj = ReferralAcquisitionConditionResponse.parse_obj({ + "type": obj.get("type") + }) + return _obj + diff --git a/tests/v3/messaging/test_coupon.py b/tests/v3/messaging/test_coupon.py new file mode 100644 index 00000000..271cbd76 --- /dev/null +++ b/tests/v3/messaging/test_coupon.py @@ -0,0 +1,205 @@ +import json +import unittest +from urllib.parse import urlparse, parse_qs +from pytest_httpserver import HTTPServer +from linebot.v3.messaging import ( + Configuration, + ApiClient, + MessagingApi, + CouponCreateRequest, + LotteryAcquisitionConditionRequest, + CouponDiscountRewardRequest, + DiscountFixedPriceInfoRequest, + CouponMessage +) + + +class TestCouponAPI(unittest.TestCase): + + def test_coupon_create(self): + expected_coupon_id = "COUPON123" + expected_response_create = { + "couponId": expected_coupon_id + } + expected_body = { + "acquisitionCondition": { + "type": "lottery", + "lotteryProbability": 50, + "maxAcquireCount": 1000 + }, + "barcodeImageUrl": "https://example.com/barcode.png", + "couponCode": "UNIQUECODE123", + "description": "Get 100 Yen off your purchase", + "endTimestamp": 1700000000, + "imageUrl": "https://example.com/image.png", + "maxUseCountPerTicket": 1, + "startTimestamp": 1600000000, + "title": "100 Yen OFF", + "usageCondition": "Minimum purchase of 500 Yen", + "reward": { + "type": "discount", + "priceInfo": { + "type": "fixed", + "fixedAmount": 100 + } + }, + "visibility": "PUBLIC", + "timezone": "ASIA_TOKYO" + } + + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/coupon", + method="POST", + ).respond_with_json( + expected_response_create, + status=200 + ) + + configuration = Configuration( + access_token="dummy-channel-access-token", + host=httpserver.url_for("/") + ) + + with ApiClient(configuration) as api_client: + line_bot_api = MessagingApi(api_client) + + req = CouponCreateRequest( + acquisitionCondition=LotteryAcquisitionConditionRequest( + lotteryProbability=50, + maxAcquireCount=1000 + ), + barcodeImageUrl="https://example.com/barcode.png", + couponCode="UNIQUECODE123", + description="Get 100 Yen off your purchase", + endTimestamp=1700000000, + imageUrl="https://example.com/image.png", + maxUseCountPerTicket=1, + startTimestamp=1600000000, + title="100 Yen OFF", + usageCondition="Minimum purchase of 500 Yen", + reward=CouponDiscountRewardRequest( + priceInfo=DiscountFixedPriceInfoRequest( + fixedAmount=100 + ) + ), + visibility="PUBLIC", + timezone="ASIA_TOKYO" + ) + + response = line_bot_api.create_coupon(coupon_create_request=req) + + self.assertEqual(response.coupon_id, expected_coupon_id) + self.assertEqual(len(httpserver.log), 1) + + request, _ = httpserver.log[0] + got_body = json.loads(request.data.decode('utf-8')) + self.assertEqual(got_body, expected_body) + + def test_coupon_close(self): + expected_coupon_id = "COUPON123" + + with HTTPServer() as httpserver: + httpserver.expect_request( + uri=f"/v2/bot/coupon/{expected_coupon_id}/close", + method="PUT", + ).respond_with_json({}, status=200) + + configuration = Configuration( + access_token="dummy-channel-access-token", + host=httpserver.url_for("/") + ) + + with ApiClient(configuration) as api_client: + line_bot_api = MessagingApi(api_client) + response = line_bot_api.close_coupon(expected_coupon_id) + + self.assertIsNone(response) + self.assertEqual(len(httpserver.log), 1) + + def test_list_coupon(self): + expected_response_list = { + "items": [ + {"couponId": "COUPON123", "title": "Discount Coupon"}, + {"couponId": "COUPON456", "title": "Special Offer"} + ], + "next": "nextPageToken" + } + + with HTTPServer() as httpserver: + httpserver.expect_request( + uri="/v2/bot/coupon", + method="GET", + ).respond_with_json( + expected_response_list, + status=200 + ) + + configuration = Configuration( + access_token="dummy-channel-access-token", + host=httpserver.url_for("/") + ) + + with ApiClient(configuration) as api_client: + line_bot_api = MessagingApi(api_client) + response = line_bot_api.list_coupon( + status=["RUNNING", "CLOSED"], + limit=10, + ) + + self.assertEqual(len(response.items), 2) + self.assertEqual(response.items[0].coupon_id, "COUPON123") + self.assertEqual(response.items[0].title, "Discount Coupon") + self.assertEqual(response.items[1].coupon_id, "COUPON456") + self.assertEqual(response.items[1].title, "Special Offer") + self.assertEqual(response.next, expected_response_list["next"]) + self.assertEqual(len(httpserver.log), 1) + + request, _ = httpserver.log[0] + parsed_url = urlparse(request.url) + query_params = parse_qs(parsed_url.query) + + self.assertIn("status", query_params) + self.assertIn("limit", query_params) + self.assertEqual(query_params["status"], ["RUNNING", "CLOSED"]) + self.assertEqual(query_params["limit"], ["10"]) + + def test_get_coupon_detail(self): + expected_coupon_id = "COUPON123" + expected_response_detail = { + "couponId": expected_coupon_id, + "title": "Discount Coupon", + "status": "RUNNING" + } + + with HTTPServer() as httpserver: + httpserver.expect_request( + uri=f"/v2/bot/coupon/{expected_coupon_id}", + method="GET", + ).respond_with_json( + expected_response_detail, + status=200 + ) + + configuration = Configuration( + access_token="dummy-channel-access-token", + host=httpserver.url_for("/") + ) + + with ApiClient(configuration) as api_client: + line_bot_api = MessagingApi(api_client) + response = line_bot_api.get_coupon_detail(expected_coupon_id) + + self.assertEqual(response.coupon_id, expected_coupon_id) + self.assertEqual(response.title, expected_response_detail["title"]) + self.assertEqual(len(httpserver.log), 1) + + def test_coupon_message(self): + expected_coupon_id = "COUPON123" + coupon_message = CouponMessage(couponId=expected_coupon_id) + self.assertEqual(coupon_message.to_dict()["couponId"], expected_coupon_id) + self.assertEqual(coupon_message.to_dict()["type"], "coupon") + + +if __name__ == '__main__': + unittest.main()