Skip to content

Commit d79ffc9

Browse files
feat!: pagination field rename, and basic streaming docs
1 parent d905655 commit d79ffc9

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
@@ -55,6 +55,7 @@ $client = new Client(
5555
$completedSmartscraper = $client->smartscraper->create(
5656
userPrompt: "Extract the product name, price, and description"
5757
);
58+
5859
var_dump($completedSmartscraper->request_id);
5960
```
6061

@@ -123,6 +124,7 @@ use Scrapegraphai\RequestOptions;
123124
$client = new Client(maxRetries: 0);
124125

125126
// Or, configure per-request:
127+
126128
$result = $client->smartscraper->create(
127129
userPrompt: "Extract the product name, price, and description",
128130
new RequestOptions(maxRetries: 5),

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)