Skip to content

Commit

Permalink
Add offset param to get method.
Browse files Browse the repository at this point in the history
  • Loading branch information
timvandijck committed May 17, 2023
1 parent c95a404 commit e45c330
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public function get(
array $dimensions = [],
int $maxResults = 10,
array $orderBy = [],
int $offset = 0,
): Collection {
return $this->client->get(
$this->propertyId,
Expand All @@ -179,6 +180,7 @@ public function get(
$dimensions,
$maxResults,
$orderBy,
$offset,
);
}
}
2 changes: 2 additions & 0 deletions src/AnalyticsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function get(
array $dimensions = [],
int $maxResults = 10,
array $orderBy = [],
int $offset = 0,
): Collection {
$typeCaster = resolve(TypeCaster::class);

Expand All @@ -44,6 +45,7 @@ public function get(
'metrics' => $this->getFormattedMetrics($metrics),
'dimensions' => $this->getFormattedDimensions($dimensions),
'limit' => $maxResults,
'offset' => $offset,
'orderBys' => $orderBy,
]);

Expand Down
6 changes: 6 additions & 0 deletions tests/AnalyticsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
['pageTitle'],
10,
[],
0,
];

$this
Expand Down Expand Up @@ -68,6 +69,7 @@
[
OrderBy::dimension('date', true),
],
0,
];

$this
Expand Down Expand Up @@ -107,6 +109,7 @@
[
OrderBy::dimension('date', true),
],
0,
];

$this
Expand Down Expand Up @@ -147,6 +150,7 @@
[
OrderBy::metric('screenPageViews', true),
],
0,
];

$this
Expand Down Expand Up @@ -188,6 +192,7 @@
[
OrderBy::metric('screenPageViews', true),
],
0,
];

$this
Expand Down Expand Up @@ -225,6 +230,7 @@
[
OrderBy::metric('screenPageViews', true),
],
0,
];

$this
Expand Down

0 comments on commit e45c330

Please sign in to comment.