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 {
8484 getNumberOfFollowers(date : string ): Promise <Types .NumberOfFollowersResponse >
8585 getFriendDemographics(): Promise <Types .FriendDemographics >
8686 getUserInteractionStatistics(requestId : string ): Promise <Types .UserInteractionStatistics >
87+ getStatisticsPerUnit(customAggregationUnit : string , from : string , to : string ): Promise <Types .StatisticsPerUnit >
8788
8889 // AudienceGroup
8990 createUploadAudienceGroup(uploadAudienceGroup : {
@@ -751,6 +752,14 @@ It corresponds to the [Get number of followers](https://developers.line.biz/en/r
751752
752753It corresponds to the [ Get friend demographics] ( https://developers.line.biz/en/reference/messaging-api/#get-demographic ) API.
753754
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+
754763### Bot
755764
756765#### ` getBotInfo(): Promise<BotInfoResponse> `
Original file line number Diff line number Diff line change @@ -515,6 +515,17 @@ export default class Client {
515515 return ensureJSON ( res ) ;
516516 }
517517
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+
518529 public async createUploadAudienceGroup ( uploadAudienceGroup : {
519530 description : string ;
520531 isIfaAudience ?: boolean ;
Original file line number Diff line number Diff line change @@ -2518,6 +2518,20 @@ export type UserInteractionStatistics = {
25182518 clicks : UserInteractionStatisticsOfEachURL [ ] ;
25192519} ;
25202520
2521+ /**
2522+ * https://developers.line.biz/en/reference/messaging-api/#get-statistics-per-unit
2523+ */
2524+ export type StatisticsPerUnit = {
2525+ overview : {
2526+ uniqueImpression : number ;
2527+ uniqueClick : number ;
2528+ uniqueMediaPlayed : number ;
2529+ uniqueMediaPlayed100Percent : number ;
2530+ } ;
2531+ messages : UserInteractionStatisticsOfEachMessage [ ] ;
2532+ clicks : UserInteractionStatisticsOfEachURL [ ] ;
2533+ } ;
2534+
25212535type FilterOperatorObject < T > = {
25222536 type : "operator" ;
25232537} & (
Original file line number Diff line number Diff line change @@ -744,6 +744,24 @@ describe("client", () => {
744744 equal ( scope . isDone ( ) , true ) ;
745745 } ) ;
746746
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+
747765 it ( "createUploadAudienceGroup" , async ( ) => {
748766 const requestBody = {
749767 description : "audienceGroupName" ,
You can’t perform that action at this time.
0 commit comments