File tree Expand file tree Collapse file tree 4 files changed +52
-0
lines changed Expand file tree Collapse file tree 4 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ class Client {
84
84
getNumberOfFollowers(date : string ): Promise <Types .NumberOfFollowersResponse >
85
85
getFriendDemographics(): Promise <Types .FriendDemographics >
86
86
getUserInteractionStatistics(requestId : string ): Promise <Types .UserInteractionStatistics >
87
+ getStatisticsPerUnit(customAggregationUnit : string , from : string , to : string ): Promise <Types .StatisticsPerUnit >
87
88
88
89
// AudienceGroup
89
90
createUploadAudienceGroup(uploadAudienceGroup : {
@@ -751,6 +752,14 @@ It corresponds to the [Get number of followers](https://developers.line.biz/en/r
751
752
752
753
It corresponds to the [ Get friend demographics] ( https://developers.line.biz/en/reference/messaging-api/#get-demographic ) API.
753
754
755
+ #### ` getUserInteractionStatistics(): Promise<Types.UserInteractionStatistics> `
756
+
757
+ It corresponds to the [ Get user interaction statistics] ( https://developers.line.biz/en/reference/messaging-api/#get-message-event ) API.
758
+
759
+ #### ` getStatisticsPerUnit(): Promise<Types.StatisticsPerUnit> `
760
+
761
+ It corresponds to the [ Get statistics per unit] ( https://developers.line.biz/en/reference/messaging-api/#get-statistics-per-unit ) API.
762
+
754
763
### Bot
755
764
756
765
#### ` getBotInfo(): Promise<BotInfoResponse> `
Original file line number Diff line number Diff line change @@ -515,6 +515,17 @@ export default class Client {
515
515
return ensureJSON ( res ) ;
516
516
}
517
517
518
+ public async getStatisticsPerUnit (
519
+ customAggregationUnit : string ,
520
+ from : string ,
521
+ to : string ,
522
+ ) : Promise < Types . StatisticsPerUnit > {
523
+ const res = await this . http . get < Types . StatisticsPerUnit > (
524
+ `${ MESSAGING_API_PREFIX } /insight/message/event/aggregation?customAggregationUnit=${ customAggregationUnit } &from=${ from } &to=${ to } ` ,
525
+ ) ;
526
+ return ensureJSON ( res ) ;
527
+ }
528
+
518
529
public async createUploadAudienceGroup ( uploadAudienceGroup : {
519
530
description : string ;
520
531
isIfaAudience ?: boolean ;
Original file line number Diff line number Diff line change @@ -2499,6 +2499,20 @@ export type UserInteractionStatistics = {
2499
2499
clicks : UserInteractionStatisticsOfEachURL [ ] ;
2500
2500
} ;
2501
2501
2502
+ /**
2503
+ * https://developers.line.biz/en/reference/messaging-api/#get-statistics-per-unit
2504
+ */
2505
+ export type StatisticsPerUnit = {
2506
+ overview : {
2507
+ uniqueImpression : number ;
2508
+ uniqueClick : number ;
2509
+ uniqueMediaPlayed : number ;
2510
+ uniqueMediaPlayed100Percent : number ;
2511
+ } ;
2512
+ messages : UserInteractionStatisticsOfEachMessage [ ] ;
2513
+ clicks : UserInteractionStatisticsOfEachURL [ ] ;
2514
+ } ;
2515
+
2502
2516
type FilterOperatorObject < T > = {
2503
2517
type : "operator" ;
2504
2518
} & (
Original file line number Diff line number Diff line change @@ -744,6 +744,24 @@ describe("client", () => {
744
744
equal ( scope . isDone ( ) , true ) ;
745
745
} ) ;
746
746
747
+ it ( "getStatisticsPerUnit" , async ( ) => {
748
+ const customAggregationUnit = "promotion_a" ;
749
+ const from = "20210301" ;
750
+ const to = "20210331" ;
751
+ const scope = mockGet (
752
+ MESSAGING_API_PREFIX ,
753
+ "/insight/message/event/aggregation" ,
754
+ {
755
+ customAggregationUnit,
756
+ from,
757
+ to,
758
+ } ,
759
+ ) ;
760
+
761
+ await client . getStatisticsPerUnit ( customAggregationUnit , from , to ) ;
762
+ equal ( scope . isDone ( ) , true ) ;
763
+ } ) ;
764
+
747
765
it ( "createUploadAudienceGroup" , async ( ) => {
748
766
const requestBody = {
749
767
description : "audienceGroupName" ,
You can’t perform that action at this time.
0 commit comments