From 1379296e425e60d7d2b0eb9b0ee27a0ad8206456 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 1 Jul 2026 06:16:14 +0000 Subject: [PATCH] Code are generated by openapi generator --- line-openapi | 2 +- linebot/v3/insight/__init__.py | 10 + linebot/v3/insight/api/async_insight.py | 342 +++++++++++++++++- linebot/v3/insight/api/insight.py | 322 ++++++++++++++++- linebot/v3/insight/docs/Insight.md | 166 +++++++++ linebot/v3/insight/models/__init__.py | 10 + .../get_rich_menu_insight_daily_response.py | 121 +++++++ ...rich_menu_insight_daily_response_bounds.py | 77 ++++ ..._rich_menu_insight_daily_response_click.py | 85 +++++ ...nu_insight_daily_response_daily_metrics.py | 82 +++++ ..._menu_insight_daily_response_impression.py | 79 ++++ .../get_rich_menu_insight_summary_response.py | 121 +++++++ ...ch_menu_insight_summary_response_bounds.py | 77 ++++ ...ich_menu_insight_summary_response_click.py | 81 +++++ ...enu_insight_summary_response_impression.py | 75 ++++ ...h_menu_insight_summary_response_metrics.py | 73 ++++ 16 files changed, 1720 insertions(+), 3 deletions(-) create mode 100644 linebot/v3/insight/models/get_rich_menu_insight_daily_response.py create mode 100644 linebot/v3/insight/models/get_rich_menu_insight_daily_response_bounds.py create mode 100644 linebot/v3/insight/models/get_rich_menu_insight_daily_response_click.py create mode 100644 linebot/v3/insight/models/get_rich_menu_insight_daily_response_daily_metrics.py create mode 100644 linebot/v3/insight/models/get_rich_menu_insight_daily_response_impression.py create mode 100644 linebot/v3/insight/models/get_rich_menu_insight_summary_response.py create mode 100644 linebot/v3/insight/models/get_rich_menu_insight_summary_response_bounds.py create mode 100644 linebot/v3/insight/models/get_rich_menu_insight_summary_response_click.py create mode 100644 linebot/v3/insight/models/get_rich_menu_insight_summary_response_impression.py create mode 100644 linebot/v3/insight/models/get_rich_menu_insight_summary_response_metrics.py diff --git a/line-openapi b/line-openapi index 82f108c6a..6e4c2a2a1 160000 --- a/line-openapi +++ b/line-openapi @@ -1 +1 @@ -Subproject commit 82f108c6a38f3b71a1bc9673486357d93fdb6597 +Subproject commit 6e4c2a2a1b7b059ea3920456d4f88d03fd8ef0bb diff --git a/linebot/v3/insight/__init__.py b/linebot/v3/insight/__init__.py index 508dd89c9..648fc139f 100644 --- a/linebot/v3/insight/__init__.py +++ b/linebot/v3/insight/__init__.py @@ -46,6 +46,16 @@ from linebot.v3.insight.models.get_message_event_response_overview import GetMessageEventResponseOverview from linebot.v3.insight.models.get_number_of_followers_response import GetNumberOfFollowersResponse from linebot.v3.insight.models.get_number_of_message_deliveries_response import GetNumberOfMessageDeliveriesResponse +from linebot.v3.insight.models.get_rich_menu_insight_daily_response import GetRichMenuInsightDailyResponse +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_bounds import GetRichMenuInsightDailyResponseBounds +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_click import GetRichMenuInsightDailyResponseClick +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_daily_metrics import GetRichMenuInsightDailyResponseDailyMetrics +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_impression import GetRichMenuInsightDailyResponseImpression +from linebot.v3.insight.models.get_rich_menu_insight_summary_response import GetRichMenuInsightSummaryResponse +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_bounds import GetRichMenuInsightSummaryResponseBounds +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_click import GetRichMenuInsightSummaryResponseClick +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_impression import GetRichMenuInsightSummaryResponseImpression +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_metrics import GetRichMenuInsightSummaryResponseMetrics from linebot.v3.insight.models.get_statistics_per_unit_response import GetStatisticsPerUnitResponse from linebot.v3.insight.models.get_statistics_per_unit_response_click import GetStatisticsPerUnitResponseClick from linebot.v3.insight.models.get_statistics_per_unit_response_message import GetStatisticsPerUnitResponseMessage diff --git a/linebot/v3/insight/api/async_insight.py b/linebot/v3/insight/api/async_insight.py index e8d150988..a2b193d8b 100644 --- a/linebot/v3/insight/api/async_insight.py +++ b/linebot/v3/insight/api/async_insight.py @@ -20,7 +20,7 @@ from typing_extensions import Annotated from typing import overload, Optional, Union, Awaitable -from pydantic.v1 import Field, constr, validator +from pydantic.v1 import Field, StrictStr, constr, validator from typing import Optional @@ -28,6 +28,8 @@ from linebot.v3.insight.models.get_message_event_response import GetMessageEventResponse from linebot.v3.insight.models.get_number_of_followers_response import GetNumberOfFollowersResponse from linebot.v3.insight.models.get_number_of_message_deliveries_response import GetNumberOfMessageDeliveriesResponse +from linebot.v3.insight.models.get_rich_menu_insight_daily_response import GetRichMenuInsightDailyResponse +from linebot.v3.insight.models.get_rich_menu_insight_summary_response import GetRichMenuInsightSummaryResponse from linebot.v3.insight.models.get_statistics_per_unit_response import GetStatisticsPerUnitResponse from linebot.v3.insight.async_api_client import AsyncApiClient @@ -648,6 +650,344 @@ def get_number_of_message_deliveries_with_http_info(self, var_date : Annotated[c collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @overload + async def get_rich_menu_insight_daily(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], **kwargs) -> GetRichMenuInsightDailyResponse: # noqa: E501 + ... + + @overload + def get_rich_menu_insight_daily(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], async_req: Optional[bool]=True, **kwargs) -> GetRichMenuInsightDailyResponse: # noqa: E501 + ... + + @validate_arguments + def get_rich_menu_insight_daily(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], async_req: Optional[bool]=None, **kwargs) -> Union[GetRichMenuInsightDailyResponse, Awaitable[GetRichMenuInsightDailyResponse]]: # noqa: E501 + """Get rich menu insight daily # noqa: E501 + + Gets rich menu statistics broken down by day for the specified period, for a rich menu created via the Messaging API. Returns the daily impression count for the whole rich menu and the daily click count for each tappable area. When the total number of unique clicks during the period is below the privacy threshold, only `richMenuId` is returned and the other fields are omitted. # 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_rich_menu_insight_daily(rich_menu_id, var_from, to, async_req=True) + >>> result = thread.get() + + :param rich_menu_id: ID of the rich menu created via the Messaging API. (required) + :type rich_menu_id: str + :param var_from: Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 (required) + :type to: 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: GetRichMenuInsightDailyResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_rich_menu_insight_daily_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_rich_menu_insight_daily_with_http_info(rich_menu_id, var_from, to, **kwargs) # noqa: E501 + + @validate_arguments + def get_rich_menu_insight_daily_with_http_info(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], **kwargs) -> ApiResponse: # noqa: E501 + """Get rich menu insight daily # noqa: E501 + + Gets rich menu statistics broken down by day for the specified period, for a rich menu created via the Messaging API. Returns the daily impression count for the whole rich menu and the daily click count for each tappable area. When the total number of unique clicks during the period is below the privacy threshold, only `richMenuId` is returned and the other fields are omitted. # 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_rich_menu_insight_daily_with_http_info(rich_menu_id, var_from, to, async_req=True) + >>> result = thread.get() + + :param rich_menu_id: ID of the rich menu created via the Messaging API. (required) + :type rich_menu_id: str + :param var_from: Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 (required) + :type to: 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(GetRichMenuInsightDailyResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'rich_menu_id', + 'var_from', + 'to' + ] + _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_rich_menu_insight_daily" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['rich_menu_id']: + _path_params['richMenuId'] = _params['rich_menu_id'] + + + # process the query parameters + _query_params = [] + if _params.get('var_from') is not None: # noqa: E501 + _query_params.append(('from', _params['var_from'])) + + if _params.get('to') is not None: # noqa: E501 + _query_params.append(('to', _params['to'])) + + # 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': "GetRichMenuInsightDailyResponse", + '400': "ErrorResponse", + '404': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/insight/richmenu/{richMenuId}/daily', '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 get_rich_menu_insight_summary(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], **kwargs) -> GetRichMenuInsightSummaryResponse: # noqa: E501 + ... + + @overload + def get_rich_menu_insight_summary(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], async_req: Optional[bool]=True, **kwargs) -> GetRichMenuInsightSummaryResponse: # noqa: E501 + ... + + @validate_arguments + def get_rich_menu_insight_summary(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], async_req: Optional[bool]=None, **kwargs) -> Union[GetRichMenuInsightSummaryResponse, Awaitable[GetRichMenuInsightSummaryResponse]]: # noqa: E501 + """Get rich menu insight summary # noqa: E501 + + Gets a summary of rich menu statistics for the specified period, for a rich menu created via the Messaging API. Returns the total impression count for the whole rich menu and the click count for each tappable area, aggregated over the entire period as a single result. When the total number of unique clicks during the period is below the privacy threshold, only `richMenuId` is returned and the other fields are omitted. # 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_rich_menu_insight_summary(rich_menu_id, var_from, to, async_req=True) + >>> result = thread.get() + + :param rich_menu_id: ID of the rich menu created via the Messaging API. (required) + :type rich_menu_id: str + :param var_from: Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 (required) + :type to: 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: GetRichMenuInsightSummaryResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_rich_menu_insight_summary_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_rich_menu_insight_summary_with_http_info(rich_menu_id, var_from, to, **kwargs) # noqa: E501 + + @validate_arguments + def get_rich_menu_insight_summary_with_http_info(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], **kwargs) -> ApiResponse: # noqa: E501 + """Get rich menu insight summary # noqa: E501 + + Gets a summary of rich menu statistics for the specified period, for a rich menu created via the Messaging API. Returns the total impression count for the whole rich menu and the click count for each tappable area, aggregated over the entire period as a single result. When the total number of unique clicks during the period is below the privacy threshold, only `richMenuId` is returned and the other fields are omitted. # 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_rich_menu_insight_summary_with_http_info(rich_menu_id, var_from, to, async_req=True) + >>> result = thread.get() + + :param rich_menu_id: ID of the rich menu created via the Messaging API. (required) + :type rich_menu_id: str + :param var_from: Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 (required) + :type to: 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(GetRichMenuInsightSummaryResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'rich_menu_id', + 'var_from', + 'to' + ] + _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_rich_menu_insight_summary" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['rich_menu_id']: + _path_params['richMenuId'] = _params['rich_menu_id'] + + + # process the query parameters + _query_params = [] + if _params.get('var_from') is not None: # noqa: E501 + _query_params.append(('from', _params['var_from'])) + + if _params.get('to') is not None: # noqa: E501 + _query_params.append(('to', _params['to'])) + + # 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': "GetRichMenuInsightSummaryResponse", + '400': "ErrorResponse", + '404': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/insight/richmenu/{richMenuId}/summary', '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 get_statistics_per_unit(self, custom_aggregation_unit : Annotated[constr(strict=True, max_length=30, min_length=1), Field(..., description="Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. ")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ")], **kwargs) -> GetStatisticsPerUnitResponse: # noqa: E501 ... diff --git a/linebot/v3/insight/api/insight.py b/linebot/v3/insight/api/insight.py index fc9dd80ff..572456c7d 100644 --- a/linebot/v3/insight/api/insight.py +++ b/linebot/v3/insight/api/insight.py @@ -18,7 +18,7 @@ from pydantic.v1 import validate_arguments, ValidationError from typing_extensions import Annotated -from pydantic.v1 import Field, constr, validator +from pydantic.v1 import Field, StrictStr, constr, validator from typing import Optional @@ -26,6 +26,8 @@ from linebot.v3.insight.models.get_message_event_response import GetMessageEventResponse from linebot.v3.insight.models.get_number_of_followers_response import GetNumberOfFollowersResponse from linebot.v3.insight.models.get_number_of_message_deliveries_response import GetNumberOfMessageDeliveriesResponse +from linebot.v3.insight.models.get_rich_menu_insight_daily_response import GetRichMenuInsightDailyResponse +from linebot.v3.insight.models.get_rich_menu_insight_summary_response import GetRichMenuInsightSummaryResponse from linebot.v3.insight.models.get_statistics_per_unit_response import GetStatisticsPerUnitResponse from linebot.v3.insight.api_client import ApiClient @@ -606,6 +608,324 @@ def get_number_of_message_deliveries_with_http_info(self, var_date : Annotated[c collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + def get_rich_menu_insight_daily(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], **kwargs) -> GetRichMenuInsightDailyResponse: # noqa: E501 + """Get rich menu insight daily # noqa: E501 + + Gets rich menu statistics broken down by day for the specified period, for a rich menu created via the Messaging API. Returns the daily impression count for the whole rich menu and the daily click count for each tappable area. When the total number of unique clicks during the period is below the privacy threshold, only `richMenuId` is returned and the other fields are omitted. # 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_rich_menu_insight_daily(rich_menu_id, var_from, to, async_req=True) + >>> result = thread.get() + + :param rich_menu_id: ID of the rich menu created via the Messaging API. (required) + :type rich_menu_id: str + :param var_from: Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 (required) + :type to: 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: GetRichMenuInsightDailyResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_rich_menu_insight_daily_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + return self.get_rich_menu_insight_daily_with_http_info(rich_menu_id, var_from, to, **kwargs) # noqa: E501 + + @validate_arguments + def get_rich_menu_insight_daily_with_http_info(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], **kwargs) -> ApiResponse: # noqa: E501 + """Get rich menu insight daily # noqa: E501 + + Gets rich menu statistics broken down by day for the specified period, for a rich menu created via the Messaging API. Returns the daily impression count for the whole rich menu and the daily click count for each tappable area. When the total number of unique clicks during the period is below the privacy threshold, only `richMenuId` is returned and the other fields are omitted. # 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_rich_menu_insight_daily_with_http_info(rich_menu_id, var_from, to, async_req=True) + >>> result = thread.get() + + :param rich_menu_id: ID of the rich menu created via the Messaging API. (required) + :type rich_menu_id: str + :param var_from: Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 (required) + :type to: 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(GetRichMenuInsightDailyResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'rich_menu_id', + 'var_from', + 'to' + ] + _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_rich_menu_insight_daily" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['rich_menu_id']: + _path_params['richMenuId'] = _params['rich_menu_id'] + + + # process the query parameters + _query_params = [] + if _params.get('var_from') is not None: # noqa: E501 + _query_params.append(('from', _params['var_from'])) + + if _params.get('to') is not None: # noqa: E501 + _query_params.append(('to', _params['to'])) + + # 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': "GetRichMenuInsightDailyResponse", + '400': "ErrorResponse", + '404': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/insight/richmenu/{richMenuId}/daily', '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_rich_menu_insight_summary(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], **kwargs) -> GetRichMenuInsightSummaryResponse: # noqa: E501 + """Get rich menu insight summary # noqa: E501 + + Gets a summary of rich menu statistics for the specified period, for a rich menu created via the Messaging API. Returns the total impression count for the whole rich menu and the click count for each tappable area, aggregated over the entire period as a single result. When the total number of unique clicks during the period is below the privacy threshold, only `richMenuId` is returned and the other fields are omitted. # 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_rich_menu_insight_summary(rich_menu_id, var_from, to, async_req=True) + >>> result = thread.get() + + :param rich_menu_id: ID of the rich menu created via the Messaging API. (required) + :type rich_menu_id: str + :param var_from: Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 (required) + :type to: 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: GetRichMenuInsightSummaryResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_rich_menu_insight_summary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") + return self.get_rich_menu_insight_summary_with_http_info(rich_menu_id, var_from, to, **kwargs) # noqa: E501 + + @validate_arguments + def get_rich_menu_insight_summary_with_http_info(self, rich_menu_id : Annotated[StrictStr, Field(..., description="ID of the rich menu created via the Messaging API.")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 ")], **kwargs) -> ApiResponse: # noqa: E501 + """Get rich menu insight summary # noqa: E501 + + Gets a summary of rich menu statistics for the specified period, for a rich menu created via the Messaging API. Returns the total impression count for the whole rich menu and the click count for each tappable area, aggregated over the entire period as a single result. When the total number of unique clicks during the period is below the privacy threshold, only `richMenuId` is returned and the other fields are omitted. # 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_rich_menu_insight_summary_with_http_info(rich_menu_id, var_from, to, async_req=True) + >>> result = thread.get() + + :param rich_menu_id: ID of the rich menu created via the Messaging API. (required) + :type rich_menu_id: str + :param var_from: Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 (required) + :type var_from: str + :param to: End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 (required) + :type to: 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(GetRichMenuInsightSummaryResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _host = self.line_base_path + _params = locals() + + _all_params = [ + 'rich_menu_id', + 'var_from', + 'to' + ] + _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_rich_menu_insight_summary" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['rich_menu_id']: + _path_params['richMenuId'] = _params['rich_menu_id'] + + + # process the query parameters + _query_params = [] + if _params.get('var_from') is not None: # noqa: E501 + _query_params.append(('from', _params['var_from'])) + + if _params.get('to') is not None: # noqa: E501 + _query_params.append(('to', _params['to'])) + + # 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': "GetRichMenuInsightSummaryResponse", + '400': "ErrorResponse", + '404': "ErrorResponse", + } + + return self.api_client.call_api( + '/v2/bot/insight/richmenu/{richMenuId}/summary', '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_statistics_per_unit(self, custom_aggregation_unit : Annotated[constr(strict=True, max_length=30, min_length=1), Field(..., description="Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. ")], var_from : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ")], to : Annotated[constr(strict=True, max_length=8, min_length=8), Field(..., description="End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 ")], **kwargs) -> GetStatisticsPerUnitResponse: # noqa: E501 """get_statistics_per_unit # noqa: E501 diff --git a/linebot/v3/insight/docs/Insight.md b/linebot/v3/insight/docs/Insight.md index 554b5d6af..7b6bf6523 100644 --- a/linebot/v3/insight/docs/Insight.md +++ b/linebot/v3/insight/docs/Insight.md @@ -8,6 +8,8 @@ Method | HTTP request | Description [**get_message_event**](Insight.md#get_message_event) | **GET** /v2/bot/insight/message/event | Get user interaction statistics [**get_number_of_followers**](Insight.md#get_number_of_followers) | **GET** /v2/bot/insight/followers | Get number of followers [**get_number_of_message_deliveries**](Insight.md#get_number_of_message_deliveries) | **GET** /v2/bot/insight/message/delivery | Get number of message deliveries +[**get_rich_menu_insight_daily**](Insight.md#get_rich_menu_insight_daily) | **GET** /v2/bot/insight/richmenu/{richMenuId}/daily | Get rich menu insight daily +[**get_rich_menu_insight_summary**](Insight.md#get_rich_menu_insight_summary) | **GET** /v2/bot/insight/richmenu/{richMenuId}/summary | Get rich menu insight summary [**get_statistics_per_unit**](Insight.md#get_statistics_per_unit) | **GET** /v2/bot/insight/message/event/aggregation | @@ -310,6 +312,170 @@ Name | Type | Description | Notes [[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_rich_menu_insight_daily** +> GetRichMenuInsightDailyResponse get_rich_menu_insight_daily(rich_menu_id, var_from, to) + +Get rich menu insight daily + +Gets rich menu statistics broken down by day for the specified period, for a rich menu created via the Messaging API. Returns the daily impression count for the whole rich menu and the daily click count for each tappable area. When the total number of unique clicks during the period is below the privacy threshold, only `richMenuId` is returned and the other fields are omitted. + +### Example + +* Bearer Authentication (Bearer): +```python +import time +import os +import linebot.v3.insight +from linebot.v3.insight.models.get_rich_menu_insight_daily_response import GetRichMenuInsightDailyResponse +from linebot.v3.insight.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.insight.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.insight.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with linebot.v3.insight.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = linebot.v3.insight.Insight(api_client) + rich_menu_id = 'richmenu-0123456789abcdef0123456789abcdef' # str | ID of the rich menu created via the Messaging API. + var_from = '20260213' # str | Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 + to = '20260215' # str | End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 + + try: + # Get rich menu insight daily + api_response = api_instance.get_rich_menu_insight_daily(rich_menu_id, var_from, to) + print("The response of Insight->get_rich_menu_insight_daily:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling Insight->get_rich_menu_insight_daily: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **rich_menu_id** | **str**| ID of the rich menu created via the Messaging API. | + **var_from** | **str**| Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 | + **to** | **str**| End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 | + +### Return type + +[**GetRichMenuInsightDailyResponse**](GetRichMenuInsightDailyResponse.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. The `from` or `to` parameter is missing or invalid, or the aggregation period exceeds the allowed maximum. | - | +**404** | Not found. The specified rich menu does not exist. | - | + +[[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_rich_menu_insight_summary** +> GetRichMenuInsightSummaryResponse get_rich_menu_insight_summary(rich_menu_id, var_from, to) + +Get rich menu insight summary + +Gets a summary of rich menu statistics for the specified period, for a rich menu created via the Messaging API. Returns the total impression count for the whole rich menu and the click count for each tappable area, aggregated over the entire period as a single result. When the total number of unique clicks during the period is below the privacy threshold, only `richMenuId` is returned and the other fields are omitted. + +### Example + +* Bearer Authentication (Bearer): +```python +import time +import os +import linebot.v3.insight +from linebot.v3.insight.models.get_rich_menu_insight_summary_response import GetRichMenuInsightSummaryResponse +from linebot.v3.insight.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.insight.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.insight.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with linebot.v3.insight.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = linebot.v3.insight.Insight(api_client) + rich_menu_id = 'richmenu-0123456789abcdef0123456789abcdef' # str | ID of the rich menu created via the Messaging API. + var_from = '20260213' # str | Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 + to = '20260215' # str | End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 + + try: + # Get rich menu insight summary + api_response = api_instance.get_rich_menu_insight_summary(rich_menu_id, var_from, to) + print("The response of Insight->get_rich_menu_insight_summary:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling Insight->get_rich_menu_insight_summary: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **rich_menu_id** | **str**| ID of the rich menu created via the Messaging API. | + **var_from** | **str**| Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9 | + **to** | **str**| End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9 | + +### Return type + +[**GetRichMenuInsightSummaryResponse**](GetRichMenuInsightSummaryResponse.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. The `from` or `to` parameter is missing or invalid, or the aggregation period exceeds the allowed maximum. | - | +**404** | Not found. The specified rich menu does not exist. | - | + +[[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_statistics_per_unit** > GetStatisticsPerUnitResponse get_statistics_per_unit(custom_aggregation_unit, var_from, to) diff --git a/linebot/v3/insight/models/__init__.py b/linebot/v3/insight/models/__init__.py index 7cf3d8a41..8d5d72208 100644 --- a/linebot/v3/insight/models/__init__.py +++ b/linebot/v3/insight/models/__init__.py @@ -27,6 +27,16 @@ from linebot.v3.insight.models.get_message_event_response_overview import GetMessageEventResponseOverview from linebot.v3.insight.models.get_number_of_followers_response import GetNumberOfFollowersResponse from linebot.v3.insight.models.get_number_of_message_deliveries_response import GetNumberOfMessageDeliveriesResponse +from linebot.v3.insight.models.get_rich_menu_insight_daily_response import GetRichMenuInsightDailyResponse +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_bounds import GetRichMenuInsightDailyResponseBounds +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_click import GetRichMenuInsightDailyResponseClick +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_daily_metrics import GetRichMenuInsightDailyResponseDailyMetrics +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_impression import GetRichMenuInsightDailyResponseImpression +from linebot.v3.insight.models.get_rich_menu_insight_summary_response import GetRichMenuInsightSummaryResponse +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_bounds import GetRichMenuInsightSummaryResponseBounds +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_click import GetRichMenuInsightSummaryResponseClick +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_impression import GetRichMenuInsightSummaryResponseImpression +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_metrics import GetRichMenuInsightSummaryResponseMetrics from linebot.v3.insight.models.get_statistics_per_unit_response import GetStatisticsPerUnitResponse from linebot.v3.insight.models.get_statistics_per_unit_response_click import GetStatisticsPerUnitResponseClick from linebot.v3.insight.models.get_statistics_per_unit_response_message import GetStatisticsPerUnitResponseMessage diff --git a/linebot/v3/insight/models/get_rich_menu_insight_daily_response.py b/linebot/v3/insight/models/get_rich_menu_insight_daily_response.py new file mode 100644 index 000000000..d9be7caad --- /dev/null +++ b/linebot/v3/insight/models/get_rich_menu_insight_daily_response.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + LINE Messaging API(Insight) + + This document describes LINE Messaging API(Insight). # 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, constr, validator +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_click import GetRichMenuInsightDailyResponseClick +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_impression import GetRichMenuInsightDailyResponseImpression + +class GetRichMenuInsightDailyResponse(BaseModel): + """ + Daily impression and click statistics for a rich menu created via the Messaging API. + """ + rich_menu_id: StrictStr = Field(..., alias="richMenuId", description="Rich menu ID.") + metrics_from: Optional[constr(strict=True)] = Field(None, alias="metricsFrom", description="Start date (JST) of the period actually covered by the returned metrics. Format: yyyyMMdd (e.g. 20260213).") + metrics_to: Optional[constr(strict=True)] = Field(None, alias="metricsTo", description="End date (JST) of the period actually covered by the returned metrics. Format: yyyyMMdd (e.g. 20260215).") + impression: Optional[GetRichMenuInsightDailyResponseImpression] = None + clicks: Optional[conlist(GetRichMenuInsightDailyResponseClick)] = Field(None, description="Daily click metrics for each tappable area of the rich menu.") + + __properties = ["richMenuId", "metricsFrom", "metricsTo", "impression", "clicks"] + + @validator('metrics_from') + def metrics_from_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^[0-9]{8}$", value): + raise ValueError(r"must validate the regular expression /^[0-9]{8}$/") + return value + + @validator('metrics_to') + def metrics_to_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^[0-9]{8}$", value): + raise ValueError(r"must validate the regular expression /^[0-9]{8}$/") + 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) -> GetRichMenuInsightDailyResponse: + """Create an instance of GetRichMenuInsightDailyResponse 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 impression + if self.impression: + _dict['impression'] = self.impression.to_dict() + # override the default output from pydantic.v1 by calling `to_dict()` of each item in clicks (list) + _items = [] + if self.clicks: + for _item in self.clicks: + if _item: + _items.append(_item.to_dict()) + _dict['clicks'] = _items + # set to None if metrics_from (nullable) is None + # and __fields_set__ contains the field + if self.metrics_from is None and "metrics_from" in self.__fields_set__: + _dict['metricsFrom'] = None + + # set to None if metrics_to (nullable) is None + # and __fields_set__ contains the field + if self.metrics_to is None and "metrics_to" in self.__fields_set__: + _dict['metricsTo'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> GetRichMenuInsightDailyResponse: + """Create an instance of GetRichMenuInsightDailyResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetRichMenuInsightDailyResponse.parse_obj(obj) + + _obj = GetRichMenuInsightDailyResponse.parse_obj({ + "rich_menu_id": obj.get("richMenuId"), + "metrics_from": obj.get("metricsFrom"), + "metrics_to": obj.get("metricsTo"), + "impression": GetRichMenuInsightDailyResponseImpression.from_dict(obj.get("impression")) if obj.get("impression") is not None else None, + "clicks": [GetRichMenuInsightDailyResponseClick.from_dict(_item) for _item in obj.get("clicks")] if obj.get("clicks") is not None else None + }) + return _obj + diff --git a/linebot/v3/insight/models/get_rich_menu_insight_daily_response_bounds.py b/linebot/v3/insight/models/get_rich_menu_insight_daily_response_bounds.py new file mode 100644 index 000000000..327bbe956 --- /dev/null +++ b/linebot/v3/insight/models/get_rich_menu_insight_daily_response_bounds.py @@ -0,0 +1,77 @@ +# coding: utf-8 + +""" + LINE Messaging API(Insight) + + This document describes LINE Messaging API(Insight). # 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, StrictInt + +class GetRichMenuInsightDailyResponseBounds(BaseModel): + """ + Target area of the metrics, represented by the top-left coordinate, width, and height. + """ + x: StrictInt = Field(..., description="The x coordinate of the top-left corner of the target area.") + y: StrictInt = Field(..., description="The y coordinate of the top-left corner of the target area.") + width: StrictInt = Field(..., description="The width of the target area.") + height: StrictInt = Field(..., description="The height of the target area.") + + __properties = ["x", "y", "width", "height"] + + 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) -> GetRichMenuInsightDailyResponseBounds: + """Create an instance of GetRichMenuInsightDailyResponseBounds 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) -> GetRichMenuInsightDailyResponseBounds: + """Create an instance of GetRichMenuInsightDailyResponseBounds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetRichMenuInsightDailyResponseBounds.parse_obj(obj) + + _obj = GetRichMenuInsightDailyResponseBounds.parse_obj({ + "x": obj.get("x"), + "y": obj.get("y"), + "width": obj.get("width"), + "height": obj.get("height") + }) + return _obj + diff --git a/linebot/v3/insight/models/get_rich_menu_insight_daily_response_click.py b/linebot/v3/insight/models/get_rich_menu_insight_daily_response_click.py new file mode 100644 index 000000000..d3ab6638a --- /dev/null +++ b/linebot/v3/insight/models/get_rich_menu_insight_daily_response_click.py @@ -0,0 +1,85 @@ +# coding: utf-8 + +""" + LINE Messaging API(Insight) + + This document describes LINE Messaging API(Insight). # 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 +from pydantic.v1 import BaseModel, Field, conlist +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_bounds import GetRichMenuInsightDailyResponseBounds +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_daily_metrics import GetRichMenuInsightDailyResponseDailyMetrics + +class GetRichMenuInsightDailyResponseClick(BaseModel): + """ + Daily click metrics for a single tappable area of the rich menu. + """ + bounds: GetRichMenuInsightDailyResponseBounds = Field(...) + metrics: conlist(GetRichMenuInsightDailyResponseDailyMetrics) = Field(..., description="Per-day click metrics for the target area.") + + __properties = ["bounds", "metrics"] + + 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) -> GetRichMenuInsightDailyResponseClick: + """Create an instance of GetRichMenuInsightDailyResponseClick 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 bounds + if self.bounds: + _dict['bounds'] = self.bounds.to_dict() + # override the default output from pydantic.v1 by calling `to_dict()` of each item in metrics (list) + _items = [] + if self.metrics: + for _item in self.metrics: + if _item: + _items.append(_item.to_dict()) + _dict['metrics'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> GetRichMenuInsightDailyResponseClick: + """Create an instance of GetRichMenuInsightDailyResponseClick from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetRichMenuInsightDailyResponseClick.parse_obj(obj) + + _obj = GetRichMenuInsightDailyResponseClick.parse_obj({ + "bounds": GetRichMenuInsightDailyResponseBounds.from_dict(obj.get("bounds")) if obj.get("bounds") is not None else None, + "metrics": [GetRichMenuInsightDailyResponseDailyMetrics.from_dict(_item) for _item in obj.get("metrics")] if obj.get("metrics") is not None else None + }) + return _obj + diff --git a/linebot/v3/insight/models/get_rich_menu_insight_daily_response_daily_metrics.py b/linebot/v3/insight/models/get_rich_menu_insight_daily_response_daily_metrics.py new file mode 100644 index 000000000..9b8400bc4 --- /dev/null +++ b/linebot/v3/insight/models/get_rich_menu_insight_daily_response_daily_metrics.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + LINE Messaging API(Insight) + + This document describes LINE Messaging API(Insight). # 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, StrictInt, constr, validator + +class GetRichMenuInsightDailyResponseDailyMetrics(BaseModel): + """ + Aggregated number of events and unique users for a single day. + """ + var_date: constr(strict=True) = Field(..., alias="date", description="The date (JST) of these metrics. Format: yyyyMMdd (e.g. 20260213).") + count: StrictInt = Field(..., description="Number of impressions or clicks on this day.") + unique_users: StrictInt = Field(..., alias="uniqueUsers", description="Approximate number of unique users who triggered an impression or click on this day.") + + __properties = ["date", "count", "uniqueUsers"] + + @validator('var_date') + def var_date_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^[0-9]{8}$", value): + raise ValueError(r"must validate the regular expression /^[0-9]{8}$/") + 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) -> GetRichMenuInsightDailyResponseDailyMetrics: + """Create an instance of GetRichMenuInsightDailyResponseDailyMetrics 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) -> GetRichMenuInsightDailyResponseDailyMetrics: + """Create an instance of GetRichMenuInsightDailyResponseDailyMetrics from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetRichMenuInsightDailyResponseDailyMetrics.parse_obj(obj) + + _obj = GetRichMenuInsightDailyResponseDailyMetrics.parse_obj({ + "var_date": obj.get("date"), + "count": obj.get("count"), + "unique_users": obj.get("uniqueUsers") + }) + return _obj + diff --git a/linebot/v3/insight/models/get_rich_menu_insight_daily_response_impression.py b/linebot/v3/insight/models/get_rich_menu_insight_daily_response_impression.py new file mode 100644 index 000000000..af125f2bf --- /dev/null +++ b/linebot/v3/insight/models/get_rich_menu_insight_daily_response_impression.py @@ -0,0 +1,79 @@ +# coding: utf-8 + +""" + LINE Messaging API(Insight) + + This document describes LINE Messaging API(Insight). # 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 +from pydantic.v1 import BaseModel, Field, conlist +from linebot.v3.insight.models.get_rich_menu_insight_daily_response_daily_metrics import GetRichMenuInsightDailyResponseDailyMetrics + +class GetRichMenuInsightDailyResponseImpression(BaseModel): + """ + Daily impression metrics for the whole rich menu. + """ + metrics: conlist(GetRichMenuInsightDailyResponseDailyMetrics) = Field(..., description="Per-day impression metrics.") + + __properties = ["metrics"] + + 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) -> GetRichMenuInsightDailyResponseImpression: + """Create an instance of GetRichMenuInsightDailyResponseImpression 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 metrics (list) + _items = [] + if self.metrics: + for _item in self.metrics: + if _item: + _items.append(_item.to_dict()) + _dict['metrics'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> GetRichMenuInsightDailyResponseImpression: + """Create an instance of GetRichMenuInsightDailyResponseImpression from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetRichMenuInsightDailyResponseImpression.parse_obj(obj) + + _obj = GetRichMenuInsightDailyResponseImpression.parse_obj({ + "metrics": [GetRichMenuInsightDailyResponseDailyMetrics.from_dict(_item) for _item in obj.get("metrics")] if obj.get("metrics") is not None else None + }) + return _obj + diff --git a/linebot/v3/insight/models/get_rich_menu_insight_summary_response.py b/linebot/v3/insight/models/get_rich_menu_insight_summary_response.py new file mode 100644 index 000000000..b76cb25d8 --- /dev/null +++ b/linebot/v3/insight/models/get_rich_menu_insight_summary_response.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + LINE Messaging API(Insight) + + This document describes LINE Messaging API(Insight). # 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, constr, validator +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_click import GetRichMenuInsightSummaryResponseClick +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_impression import GetRichMenuInsightSummaryResponseImpression + +class GetRichMenuInsightSummaryResponse(BaseModel): + """ + Summary of impression and click statistics for a rich menu created via the Messaging API. + """ + rich_menu_id: StrictStr = Field(..., alias="richMenuId", description="Rich menu ID.") + metrics_from: Optional[constr(strict=True)] = Field(None, alias="metricsFrom", description="Start date (JST) of the period actually covered by the returned metrics. Format: yyyyMMdd (e.g. 20260213).") + metrics_to: Optional[constr(strict=True)] = Field(None, alias="metricsTo", description="End date (JST) of the period actually covered by the returned metrics. Format: yyyyMMdd (e.g. 20260215).") + impression: Optional[GetRichMenuInsightSummaryResponseImpression] = None + clicks: Optional[conlist(GetRichMenuInsightSummaryResponseClick)] = Field(None, description="Click metrics for each tappable area of the rich menu.") + + __properties = ["richMenuId", "metricsFrom", "metricsTo", "impression", "clicks"] + + @validator('metrics_from') + def metrics_from_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^[0-9]{8}$", value): + raise ValueError(r"must validate the regular expression /^[0-9]{8}$/") + return value + + @validator('metrics_to') + def metrics_to_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^[0-9]{8}$", value): + raise ValueError(r"must validate the regular expression /^[0-9]{8}$/") + 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) -> GetRichMenuInsightSummaryResponse: + """Create an instance of GetRichMenuInsightSummaryResponse 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 impression + if self.impression: + _dict['impression'] = self.impression.to_dict() + # override the default output from pydantic.v1 by calling `to_dict()` of each item in clicks (list) + _items = [] + if self.clicks: + for _item in self.clicks: + if _item: + _items.append(_item.to_dict()) + _dict['clicks'] = _items + # set to None if metrics_from (nullable) is None + # and __fields_set__ contains the field + if self.metrics_from is None and "metrics_from" in self.__fields_set__: + _dict['metricsFrom'] = None + + # set to None if metrics_to (nullable) is None + # and __fields_set__ contains the field + if self.metrics_to is None and "metrics_to" in self.__fields_set__: + _dict['metricsTo'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> GetRichMenuInsightSummaryResponse: + """Create an instance of GetRichMenuInsightSummaryResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetRichMenuInsightSummaryResponse.parse_obj(obj) + + _obj = GetRichMenuInsightSummaryResponse.parse_obj({ + "rich_menu_id": obj.get("richMenuId"), + "metrics_from": obj.get("metricsFrom"), + "metrics_to": obj.get("metricsTo"), + "impression": GetRichMenuInsightSummaryResponseImpression.from_dict(obj.get("impression")) if obj.get("impression") is not None else None, + "clicks": [GetRichMenuInsightSummaryResponseClick.from_dict(_item) for _item in obj.get("clicks")] if obj.get("clicks") is not None else None + }) + return _obj + diff --git a/linebot/v3/insight/models/get_rich_menu_insight_summary_response_bounds.py b/linebot/v3/insight/models/get_rich_menu_insight_summary_response_bounds.py new file mode 100644 index 000000000..92335ed23 --- /dev/null +++ b/linebot/v3/insight/models/get_rich_menu_insight_summary_response_bounds.py @@ -0,0 +1,77 @@ +# coding: utf-8 + +""" + LINE Messaging API(Insight) + + This document describes LINE Messaging API(Insight). # 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, StrictInt + +class GetRichMenuInsightSummaryResponseBounds(BaseModel): + """ + Target area of the metrics, represented by the top-left coordinate, width, and height. + """ + x: StrictInt = Field(..., description="The x coordinate of the top-left corner of the target area.") + y: StrictInt = Field(..., description="The y coordinate of the top-left corner of the target area.") + width: StrictInt = Field(..., description="The width of the target area.") + height: StrictInt = Field(..., description="The height of the target area.") + + __properties = ["x", "y", "width", "height"] + + 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) -> GetRichMenuInsightSummaryResponseBounds: + """Create an instance of GetRichMenuInsightSummaryResponseBounds 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) -> GetRichMenuInsightSummaryResponseBounds: + """Create an instance of GetRichMenuInsightSummaryResponseBounds from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetRichMenuInsightSummaryResponseBounds.parse_obj(obj) + + _obj = GetRichMenuInsightSummaryResponseBounds.parse_obj({ + "x": obj.get("x"), + "y": obj.get("y"), + "width": obj.get("width"), + "height": obj.get("height") + }) + return _obj + diff --git a/linebot/v3/insight/models/get_rich_menu_insight_summary_response_click.py b/linebot/v3/insight/models/get_rich_menu_insight_summary_response_click.py new file mode 100644 index 000000000..3e78a02d0 --- /dev/null +++ b/linebot/v3/insight/models/get_rich_menu_insight_summary_response_click.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" + LINE Messaging API(Insight) + + This document describes LINE Messaging API(Insight). # 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 +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_bounds import GetRichMenuInsightSummaryResponseBounds +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_metrics import GetRichMenuInsightSummaryResponseMetrics + +class GetRichMenuInsightSummaryResponseClick(BaseModel): + """ + Click metrics for a single tappable area of the rich menu. + """ + bounds: GetRichMenuInsightSummaryResponseBounds = Field(...) + metrics: GetRichMenuInsightSummaryResponseMetrics = Field(...) + + __properties = ["bounds", "metrics"] + + 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) -> GetRichMenuInsightSummaryResponseClick: + """Create an instance of GetRichMenuInsightSummaryResponseClick 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 bounds + if self.bounds: + _dict['bounds'] = self.bounds.to_dict() + # override the default output from pydantic.v1 by calling `to_dict()` of metrics + if self.metrics: + _dict['metrics'] = self.metrics.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> GetRichMenuInsightSummaryResponseClick: + """Create an instance of GetRichMenuInsightSummaryResponseClick from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetRichMenuInsightSummaryResponseClick.parse_obj(obj) + + _obj = GetRichMenuInsightSummaryResponseClick.parse_obj({ + "bounds": GetRichMenuInsightSummaryResponseBounds.from_dict(obj.get("bounds")) if obj.get("bounds") is not None else None, + "metrics": GetRichMenuInsightSummaryResponseMetrics.from_dict(obj.get("metrics")) if obj.get("metrics") is not None else None + }) + return _obj + diff --git a/linebot/v3/insight/models/get_rich_menu_insight_summary_response_impression.py b/linebot/v3/insight/models/get_rich_menu_insight_summary_response_impression.py new file mode 100644 index 000000000..c20b2a7f8 --- /dev/null +++ b/linebot/v3/insight/models/get_rich_menu_insight_summary_response_impression.py @@ -0,0 +1,75 @@ +# coding: utf-8 + +""" + LINE Messaging API(Insight) + + This document describes LINE Messaging API(Insight). # 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 +from linebot.v3.insight.models.get_rich_menu_insight_summary_response_metrics import GetRichMenuInsightSummaryResponseMetrics + +class GetRichMenuInsightSummaryResponseImpression(BaseModel): + """ + Impression metrics for the whole rich menu. + """ + metrics: GetRichMenuInsightSummaryResponseMetrics = Field(...) + + __properties = ["metrics"] + + 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) -> GetRichMenuInsightSummaryResponseImpression: + """Create an instance of GetRichMenuInsightSummaryResponseImpression 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 metrics + if self.metrics: + _dict['metrics'] = self.metrics.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> GetRichMenuInsightSummaryResponseImpression: + """Create an instance of GetRichMenuInsightSummaryResponseImpression from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetRichMenuInsightSummaryResponseImpression.parse_obj(obj) + + _obj = GetRichMenuInsightSummaryResponseImpression.parse_obj({ + "metrics": GetRichMenuInsightSummaryResponseMetrics.from_dict(obj.get("metrics")) if obj.get("metrics") is not None else None + }) + return _obj + diff --git a/linebot/v3/insight/models/get_rich_menu_insight_summary_response_metrics.py b/linebot/v3/insight/models/get_rich_menu_insight_summary_response_metrics.py new file mode 100644 index 000000000..71f2f78d9 --- /dev/null +++ b/linebot/v3/insight/models/get_rich_menu_insight_summary_response_metrics.py @@ -0,0 +1,73 @@ +# coding: utf-8 + +""" + LINE Messaging API(Insight) + + This document describes LINE Messaging API(Insight). # 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, StrictInt + +class GetRichMenuInsightSummaryResponseMetrics(BaseModel): + """ + Aggregated number of events and unique users over the whole period. + """ + count: StrictInt = Field(..., description="Number of impressions or clicks.") + unique_users: StrictInt = Field(..., alias="uniqueUsers", description="Approximate number of unique users who triggered an impression or click.") + + __properties = ["count", "uniqueUsers"] + + 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) -> GetRichMenuInsightSummaryResponseMetrics: + """Create an instance of GetRichMenuInsightSummaryResponseMetrics 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) -> GetRichMenuInsightSummaryResponseMetrics: + """Create an instance of GetRichMenuInsightSummaryResponseMetrics from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return GetRichMenuInsightSummaryResponseMetrics.parse_obj(obj) + + _obj = GetRichMenuInsightSummaryResponseMetrics.parse_obj({ + "count": obj.get("count"), + "unique_users": obj.get("uniqueUsers") + }) + return _obj +