Skip to content

Commit f70791f

Browse files
feat(deps-dev): Bump @seamapi/nextlove-sdk-generator from 1.18.0 to 1.18.1 in the seam group (#298)
* feat(deps-dev): Bump @seamapi/nextlove-sdk-generator in the seam group Bumps the seam group with 1 update: [@seamapi/nextlove-sdk-generator](https://github.com/seamapi/nextlove-sdk-generator). Updates `@seamapi/nextlove-sdk-generator` from 1.18.0 to 1.18.1 - [Commits](https://github.com/seamapi/nextlove-sdk-generator/commits) --- updated-dependencies: - dependency-name: "@seamapi/nextlove-sdk-generator" dependency-version: 1.18.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: seam ... Signed-off-by: dependabot[bot] <support@github.com> * ci: Generate code --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Seam Bot <seambot@getseam.com>
1 parent 4824c41 commit f70791f

File tree

4 files changed

+47
-162
lines changed

4 files changed

+47
-162
lines changed

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"devDependencies": {
1414
"@prettier/plugin-php": "^0.22.1",
15-
"@seamapi/nextlove-sdk-generator": "1.18.0",
15+
"@seamapi/nextlove-sdk-generator": "1.18.1",
1616
"@seamapi/types": "1.384.0",
1717
"del": "^7.1.0",
1818
"prettier": "^3.0.0"

src/Paginator.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,41 @@
44

55
class Paginator
66
{
7-
private $callable;
7+
private $request;
88
private $params;
99
private $pagination_cache = [];
1010
private const FIRST_PAGE = "FIRST_PAGE";
1111

12-
public function __construct(callable $callable, array $params = [])
12+
public function __construct(callable $request, array $params = [])
1313
{
14-
$this->callable = $callable;
14+
$this->request = $request;
1515
$this->params = $params;
1616
}
1717

1818
public function firstPage(): array
1919
{
20-
$callable = $this->callable;
20+
$request = $this->request;
2121
$params = $this->params;
2222

2323
$params["on_response"] = fn($response) => $this->cachePagination(
2424
$response,
2525
self::FIRST_PAGE
2626
);
2727

28-
$data = $callable($params);
28+
$data = $request($params);
2929

3030
return [$data, $this->pagination_cache[self::FIRST_PAGE]];
3131
}
3232

3333
public function nextPage(string $next_page_cursor): array
3434
{
35-
$callable = $this->callable;
35+
if ($next_page_cursor === null) {
36+
throw new \InvalidArgumentException(
37+
"Cannot get the next page with a null next_page_cursor"
38+
);
39+
}
40+
41+
$request = $this->request;
3642
$params = $this->params;
3743

3844
$params["page_cursor"] = $next_page_cursor;
@@ -41,7 +47,7 @@ public function nextPage(string $next_page_cursor): array
4147
$next_page_cursor
4248
);
4349

44-
$data = $callable($params);
50+
$data = $request($params);
4551

4652
return [$data, $this->pagination_cache[$next_page_cursor]];
4753
}

0 commit comments

Comments
 (0)