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
10 changes: 10 additions & 0 deletions lib/insight/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ model/getMessageEventResponseMessage.ts
model/getMessageEventResponseOverview.ts
model/getNumberOfFollowersResponse.ts
model/getNumberOfMessageDeliveriesResponse.ts
model/getRichMenuInsightDailyResponse.ts
model/getRichMenuInsightDailyResponseBounds.ts
model/getRichMenuInsightDailyResponseClick.ts
model/getRichMenuInsightDailyResponseDailyMetrics.ts
model/getRichMenuInsightDailyResponseImpression.ts
model/getRichMenuInsightSummaryResponse.ts
model/getRichMenuInsightSummaryResponseBounds.ts
model/getRichMenuInsightSummaryResponseClick.ts
model/getRichMenuInsightSummaryResponseImpression.ts
model/getRichMenuInsightSummaryResponseMetrics.ts
model/getStatisticsPerUnitResponse.ts
model/getStatisticsPerUnitResponseClick.ts
model/getStatisticsPerUnitResponseMessage.ts
Expand Down
111 changes: 111 additions & 0 deletions lib/insight/api/insightClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
*/

/* tslint:disable:no-unused-locals */
import { ErrorResponse } from "../model/errorResponse.js";
import { GetFriendsDemographicsResponse } from "../model/getFriendsDemographicsResponse.js";
import { GetMessageEventResponse } from "../model/getMessageEventResponse.js";
import { GetNumberOfFollowersResponse } from "../model/getNumberOfFollowersResponse.js";
import { GetNumberOfMessageDeliveriesResponse } from "../model/getNumberOfMessageDeliveriesResponse.js";
import { GetRichMenuInsightDailyResponse } from "../model/getRichMenuInsightDailyResponse.js";
import { GetRichMenuInsightSummaryResponse } from "../model/getRichMenuInsightSummaryResponse.js";
import { GetStatisticsPerUnitResponse } from "../model/getStatisticsPerUnitResponse.js";

import * as Types from "../../types.js";
Expand Down Expand Up @@ -225,6 +228,114 @@ export class InsightClient {
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* 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.
* Calls `GET https://api.line.me/v2/bot/insight/richmenu/{richMenuId}/daily`.
* To inspect the HTTP status code or response headers, use {@link getRichMenuInsightDailyWithHttpInfo}.
* @summary Get rich menu insight daily
* @param richMenuId ID of the rich menu created via the Messaging API.
* @param 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
* @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
* @returns A promise resolving to the response body.
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-insight-daily">LINE Developers documentation</a>
*/
public async getRichMenuInsightDaily(
richMenuId: string,
from: string,
to: string,
): Promise<GetRichMenuInsightDailyResponse> {
return (
await this.getRichMenuInsightDailyWithHttpInfo(richMenuId, from, to)
).body;
}

/**
* 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.
* Calls `GET https://api.line.me/v2/bot/insight/richmenu/{richMenuId}/daily`.
* This method returns the response body together with the underlying `httpResponse`.
* @summary Get rich menu insight daily
* @param richMenuId ID of the rich menu created via the Messaging API.
* @param 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
* @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
* @returns A promise resolving to the response body together with the underlying `httpResponse`.
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-insight-daily">LINE Developers documentation</a>
*/
public async getRichMenuInsightDailyWithHttpInfo(
richMenuId: string,
from: string,
to: string,
): Promise<Types.ApiResponseType<GetRichMenuInsightDailyResponse>> {
const requestPath = buildPath(
"/v2/bot/insight/richmenu/{richMenuId}/daily",
{
richMenuId: richMenuId,
},
);

const queryParams = {
from: from,
to: to,
};

const res = await this.httpClient.get(requestPath, queryParams);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* 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.
* Calls `GET https://api.line.me/v2/bot/insight/richmenu/{richMenuId}/summary`.
* To inspect the HTTP status code or response headers, use {@link getRichMenuInsightSummaryWithHttpInfo}.
* @summary Get rich menu insight summary
* @param richMenuId ID of the rich menu created via the Messaging API.
* @param 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
* @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
* @returns A promise resolving to the response body.
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-insight-summary">LINE Developers documentation</a>
*/
public async getRichMenuInsightSummary(
richMenuId: string,
from: string,
to: string,
): Promise<GetRichMenuInsightSummaryResponse> {
return (
await this.getRichMenuInsightSummaryWithHttpInfo(richMenuId, from, to)
).body;
}

/**
* 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.
* Calls `GET https://api.line.me/v2/bot/insight/richmenu/{richMenuId}/summary`.
* This method returns the response body together with the underlying `httpResponse`.
* @summary Get rich menu insight summary
* @param richMenuId ID of the rich menu created via the Messaging API.
* @param 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
* @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
* @returns A promise resolving to the response body together with the underlying `httpResponse`.
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-insight-summary">LINE Developers documentation</a>
*/
public async getRichMenuInsightSummaryWithHttpInfo(
richMenuId: string,
from: string,
to: string,
): Promise<Types.ApiResponseType<GetRichMenuInsightSummaryResponse>> {
const requestPath = buildPath(
"/v2/bot/insight/richmenu/{richMenuId}/summary",
{
richMenuId: richMenuId,
},
);

const queryParams = {
from: from,
to: to,
};

const res = await this.httpClient.get(requestPath, queryParams);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account.
* Calls `GET https://api.line.me/v2/bot/insight/message/event/aggregation`.
Expand Down
39 changes: 39 additions & 0 deletions lib/insight/model/getRichMenuInsightDailyResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* LINE Messaging API(Insight)
* This document describes LINE Messaging API(Insight).
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { GetRichMenuInsightDailyResponseClick } from "./getRichMenuInsightDailyResponseClick.js";
import { GetRichMenuInsightDailyResponseImpression } from "./getRichMenuInsightDailyResponseImpression.js";

/**
* Daily impression and click statistics for a rich menu created via the Messaging API.
*/
export type GetRichMenuInsightDailyResponse = {
/**
* Rich menu ID.
*/
richMenuId: string;
/**
* Start date (JST) of the period actually covered by the returned metrics. Format: yyyyMMdd (e.g. 20260213).
* Pattern: /^[0-9]{8}$/
*/
metricsFrom?: string | null;
/**
* End date (JST) of the period actually covered by the returned metrics. Format: yyyyMMdd (e.g. 20260215).
* Pattern: /^[0-9]{8}$/
*/
metricsTo?: string | null;
impression?: GetRichMenuInsightDailyResponseImpression;
/**
* Daily click metrics for each tappable area of the rich menu.
*/
clicks?: Array<GetRichMenuInsightDailyResponseClick>;
};
33 changes: 33 additions & 0 deletions lib/insight/model/getRichMenuInsightDailyResponseBounds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* LINE Messaging API(Insight)
* This document describes LINE Messaging API(Insight).
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

/**
* Target area of the metrics, represented by the top-left coordinate, width, and height.
*/
export type GetRichMenuInsightDailyResponseBounds = {
/**
* The x coordinate of the top-left corner of the target area.
*/
x: number;
/**
* The y coordinate of the top-left corner of the target area.
*/
y: number;
/**
* The width of the target area.
*/
width: number;
/**
* The height of the target area.
*/
height: number;
};
25 changes: 25 additions & 0 deletions lib/insight/model/getRichMenuInsightDailyResponseClick.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* LINE Messaging API(Insight)
* This document describes LINE Messaging API(Insight).
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { GetRichMenuInsightDailyResponseBounds } from "./getRichMenuInsightDailyResponseBounds.js";
import { GetRichMenuInsightDailyResponseDailyMetrics } from "./getRichMenuInsightDailyResponseDailyMetrics.js";

/**
* Daily click metrics for a single tappable area of the rich menu.
*/
export type GetRichMenuInsightDailyResponseClick = {
bounds: GetRichMenuInsightDailyResponseBounds;
/**
* Per-day click metrics for the target area.
*/
metrics: Array<GetRichMenuInsightDailyResponseDailyMetrics>;
};
30 changes: 30 additions & 0 deletions lib/insight/model/getRichMenuInsightDailyResponseDailyMetrics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* LINE Messaging API(Insight)
* This document describes LINE Messaging API(Insight).
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

/**
* Aggregated number of events and unique users for a single day.
*/
export type GetRichMenuInsightDailyResponseDailyMetrics = {
/**
* The date (JST) of these metrics. Format: yyyyMMdd (e.g. 20260213).
* Pattern: /^[0-9]{8}$/
*/
date: string;
/**
* Number of impressions or clicks on this day.
*/
count: number;
/**
* Approximate number of unique users who triggered an impression or click on this day.
*/
uniqueUsers: number;
};
23 changes: 23 additions & 0 deletions lib/insight/model/getRichMenuInsightDailyResponseImpression.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* LINE Messaging API(Insight)
* This document describes LINE Messaging API(Insight).
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { GetRichMenuInsightDailyResponseDailyMetrics } from "./getRichMenuInsightDailyResponseDailyMetrics.js";

/**
* Daily impression metrics for the whole rich menu.
*/
export type GetRichMenuInsightDailyResponseImpression = {
/**
* Per-day impression metrics.
*/
metrics: Array<GetRichMenuInsightDailyResponseDailyMetrics>;
};
39 changes: 39 additions & 0 deletions lib/insight/model/getRichMenuInsightSummaryResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* LINE Messaging API(Insight)
* This document describes LINE Messaging API(Insight).
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { GetRichMenuInsightSummaryResponseClick } from "./getRichMenuInsightSummaryResponseClick.js";
import { GetRichMenuInsightSummaryResponseImpression } from "./getRichMenuInsightSummaryResponseImpression.js";

/**
* Summary of impression and click statistics for a rich menu created via the Messaging API.
*/
export type GetRichMenuInsightSummaryResponse = {
/**
* Rich menu ID.
*/
richMenuId: string;
/**
* Start date (JST) of the period actually covered by the returned metrics. Format: yyyyMMdd (e.g. 20260213).
* Pattern: /^[0-9]{8}$/
*/
metricsFrom?: string | null;
/**
* End date (JST) of the period actually covered by the returned metrics. Format: yyyyMMdd (e.g. 20260215).
* Pattern: /^[0-9]{8}$/
*/
metricsTo?: string | null;
impression?: GetRichMenuInsightSummaryResponseImpression;
/**
* Click metrics for each tappable area of the rich menu.
*/
clicks?: Array<GetRichMenuInsightSummaryResponseClick>;
};
33 changes: 33 additions & 0 deletions lib/insight/model/getRichMenuInsightSummaryResponseBounds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* LINE Messaging API(Insight)
* This document describes LINE Messaging API(Insight).
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

/**
* Target area of the metrics, represented by the top-left coordinate, width, and height.
*/
export type GetRichMenuInsightSummaryResponseBounds = {
/**
* The x coordinate of the top-left corner of the target area.
*/
x: number;
/**
* The y coordinate of the top-left corner of the target area.
*/
y: number;
/**
* The width of the target area.
*/
width: number;
/**
* The height of the target area.
*/
height: number;
};
22 changes: 22 additions & 0 deletions lib/insight/model/getRichMenuInsightSummaryResponseClick.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* LINE Messaging API(Insight)
* This document describes LINE Messaging API(Insight).
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { GetRichMenuInsightSummaryResponseBounds } from "./getRichMenuInsightSummaryResponseBounds.js";
import { GetRichMenuInsightSummaryResponseMetrics } from "./getRichMenuInsightSummaryResponseMetrics.js";

/**
* Click metrics for a single tappable area of the rich menu.
*/
export type GetRichMenuInsightSummaryResponseClick = {
bounds: GetRichMenuInsightSummaryResponseBounds;
metrics: GetRichMenuInsightSummaryResponseMetrics;
};
Loading