Skip to content

Commit 961e540

Browse files
feat!: pagination field rename, and basic streaming docs
1 parent 2e13643 commit 961e540

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ use CasParser\Client;
5050
$client = new Client(apiKey: getenv("CAS_PARSER_API_KEY") ?: "My API Key");
5151

5252
$unifiedResponse = $client->casParser->smartParse();
53+
5354
var_dump($unifiedResponse->demat_accounts);
5455
```
5556

@@ -116,6 +117,7 @@ use CasParser\RequestOptions;
116117
$client = new Client(maxRetries: 0);
117118

118119
// Or, configure per-request:
120+
119121
$result = $client->casParser->smartParse(new RequestOptions(maxRetries: 5));
120122
```
121123

src/Core/Concerns/SdkPage.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ trait SdkPage
3333
/**
3434
* @return list<Item>
3535
*/
36-
abstract public function getPaginatedItems(): array;
36+
abstract public function getItems(): array;
3737

3838
public function hasNextPage(): bool
3939
{
40-
$items = $this->getPaginatedItems();
40+
$items = $this->getItems();
4141
if (empty($items)) {
4242
return false;
4343
}
@@ -66,7 +66,7 @@ public function getNextPage(): static
6666
[$req, $opts] = $next;
6767

6868
// @phpstan-ignore-next-line
69-
return $this->client->request(...$req, convert: $this->convert, page: $this, options: $opts);
69+
return $this->client->request(...$req, convert: $this->convert, page: $this::class, options: $opts);
7070
}
7171

7272
/**
@@ -94,7 +94,7 @@ public function getIterator(): \Generator
9494
public function pagingEachItem(): \Generator
9595
{
9696
foreach ($this as $page) {
97-
foreach ($page->getPaginatedItems() as $item) {
97+
foreach ($page->getItems() as $item) {
9898
yield $item;
9999
}
100100
}

src/Core/Contracts/BasePage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function hasNextPage(): bool;
4545
/**
4646
* @return list<Item>
4747
*/
48-
public function getPaginatedItems(): array;
48+
public function getItems(): array;
4949

5050
/**
5151
* @return static<Item>

0 commit comments

Comments
 (0)