@@ -12,12 +12,17 @@ export class ReportsResource {
1212 /**
1313 * Generate an aggregation report
1414 *
15+ * This endpoints's response does not match the API documentation.
16+ * As such, we're using the type for what actually gets returned.
17+ * This may break in the future if the API changes.
18+ *
19+ * @link https://usefathom.com/api#aggregation
1520 * @param params - Aggregation parameters
1621 * @returns Promise with aggregation data
1722 */
18- async aggregation < T = Record < string , any > > ( params : AggregationParams ) : Promise < { object : 'list' , url : string , has_more : boolean , data : T [ ] } > {
23+ async aggregation < T = Record < string , any > > ( params : AggregationParams ) : Promise < Array < T > > {
1924 const validatedParams = validate ( aggregationSchema , params ) ;
20- return this . http . get < { object : 'list' , url : string , has_more : boolean , data : T [ ] } > ( '/v1/aggregations' , validatedParams ) ;
25+ return this . http . get < Array < T > > ( '/v1/aggregations' , validatedParams ) ;
2126 }
2227
2328 /**
@@ -47,14 +52,14 @@ export class ReportsResource {
4752 groupBy ?: 'day' | 'month' | 'year' | 'hour' ;
4853 limit ?: number ;
4954 } = { }
50- ) : Promise < { object : 'list' , url : string , has_more : boolean , data : Array < {
55+ ) : Promise < Array < {
5156 date : string ;
5257 visits : number ;
5358 uniques : number ;
5459 pageviews : number ;
5560 bounce_rate : number ;
5661 avg_duration : number ;
57- } > } > {
62+ } > > {
5863 return this . aggregation ( {
5964 entity : 'pageview' ,
6065 entity_id : siteId ,
@@ -82,14 +87,14 @@ export class ReportsResource {
8287 timezone ?: string ;
8388 limit ?: number ;
8489 } = { }
85- ) : Promise < { object : 'list' , url : string , has_more : boolean , data : Array < {
90+ ) : Promise < Array < {
8691 pathname : string ;
8792 visits : number ;
8893 uniques : number ;
8994 pageviews : number ;
9095 bounce_rate : number ;
9196 avg_duration : number ;
92- } > } > {
97+ } > > {
9398 return this . aggregation ( {
9499 entity : 'pageview' ,
95100 entity_id : siteId ,
@@ -118,11 +123,11 @@ export class ReportsResource {
118123 timezone ?: string ;
119124 limit ?: number ;
120125 } = { }
121- ) : Promise < { object : 'list' , url : string , has_more : boolean , data : Array < {
126+ ) : Promise < Array < {
122127 referrer_hostname : string ;
123128 visits : number ;
124129 uniques : number ;
125- } > } > {
130+ } > > {
126131 return this . aggregation ( {
127132 entity : 'pageview' ,
128133 entity_id : siteId ,
@@ -153,11 +158,11 @@ export class ReportsResource {
153158 timezone ?: string ;
154159 groupBy ?: 'day' | 'month' | 'year' | 'hour' ;
155160 } = { }
156- ) : Promise < { object : 'list' , url : string , has_more : boolean , data : Array < {
161+ ) : Promise < Array < {
157162 date : string ;
158163 conversions : number ;
159164 unique_conversions : number ;
160- } > } > {
165+ } > > {
161166 return this . aggregation ( {
162167 entity : 'event' ,
163168 entity_id : eventId ,
0 commit comments