66use Google \Analytics \Data \V1beta \Dimension ;
77use Google \Analytics \Data \V1beta \FilterExpression ;
88use Google \Analytics \Data \V1beta \Metric ;
9+ use Google \Analytics \Data \V1beta \RunRealtimeReportRequest ;
910use Google \Analytics \Data \V1beta \RunRealtimeReportResponse ;
11+ use Google \Analytics \Data \V1beta \RunReportRequest ;
1012use Google \Analytics \Data \V1beta \RunReportResponse ;
1113use Illuminate \Contracts \Cache \Repository ;
1214use Illuminate \Support \Collection ;
@@ -43,17 +45,17 @@ public function get(
4345
4446 $ response = $ this ->runReport ([
4547 'property ' => "properties/ {$ propertyId }" ,
46- 'dateRanges ' => [
48+ 'date_ranges ' => [
4749 $ period ->toDateRange (),
4850 ],
4951 'metrics ' => $ this ->getFormattedMetrics ($ metrics ),
5052 'dimensions ' => $ this ->getFormattedDimensions ($ dimensions ),
5153 'limit ' => $ maxResults ,
5254 'offset ' => $ offset ,
53- 'orderBys ' => $ orderBy ,
54- 'dimensionFilter ' => $ dimensionFilter ,
55- 'keepEmptyRows ' => $ keepEmptyRows ,
56- 'metricFilter ' => $ metricFilter ,
55+ 'order_bys ' => $ orderBy ,
56+ 'dimension_filter ' => $ dimensionFilter ,
57+ 'keep_empty_rows ' => $ keepEmptyRows ,
58+ 'metric_filter ' => $ metricFilter ,
5759 ]);
5860
5961 $ result = collect ();
@@ -93,17 +95,17 @@ public function getRealtime(
9395
9496 $ response = $ this ->runRealtimeReport ([
9597 'property ' => "properties/ {$ propertyId }" ,
96- 'dateRanges ' => [
98+ 'date_ranges ' => [
9799 $ period ->toDateRange (),
98100 ],
99101 'metrics ' => $ this ->getFormattedMetrics ($ metrics ),
100102 'dimensions ' => $ this ->getFormattedDimensions ($ dimensions ),
101103 'limit ' => $ maxResults ,
102104 'offset ' => $ offset ,
103- 'orderBys ' => $ orderBy ,
104- 'dimensionFilter ' => $ dimensionFilter ,
105- 'keepEmptyRows ' => $ keepEmptyRows ,
106- 'metricFilter ' => $ metricFilter ,
105+ 'order_bys ' => $ orderBy ,
106+ 'dimension_filter ' => $ dimensionFilter ,
107+ 'keep_empty_rows ' => $ keepEmptyRows ,
108+ 'metric_filter ' => $ metricFilter ,
107109 ]);
108110
109111 $ result = collect ();
@@ -138,7 +140,7 @@ public function runReport(array $request): RunReportResponse
138140 return $ this ->cache ->remember (
139141 $ cacheName ,
140142 $ this ->cacheLifeTimeInMinutes ,
141- fn () => $ this ->service ->runReport ($ request ),
143+ fn () => $ this ->service ->runReport (new RunReportRequest ( $ request) ),
142144 );
143145 }
144146
@@ -153,7 +155,7 @@ public function runRealtimeReport(array $request): RunRealtimeReportResponse
153155 return $ this ->cache ->remember (
154156 $ cacheName ,
155157 $ this ->cacheLifeTimeInMinutes ,
156- fn () => $ this ->service ->runRealtimeReport ($ request ),
158+ fn () => $ this ->service ->runRealtimeReport (new RunRealtimeReportRequest ( $ request) ),
157159 );
158160 }
159161
0 commit comments