Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion line-openapi
10 changes: 10 additions & 0 deletions linebot/v3/insight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
342 changes: 341 additions & 1 deletion linebot/v3/insight/api/async_insight.py

Large diffs are not rendered by default.

322 changes: 321 additions & 1 deletion linebot/v3/insight/api/insight.py

Large diffs are not rendered by default.

166 changes: 166 additions & 0 deletions linebot/v3/insight/docs/Insight.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |


Expand Down Expand Up @@ -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)

Expand Down
10 changes: 10 additions & 0 deletions linebot/v3/insight/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
121 changes: 121 additions & 0 deletions linebot/v3/insight/models/get_rich_menu_insight_daily_response.py
Original file line number Diff line number Diff line change
@@ -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

Loading