Skip to content

Commit 2c62976

Browse files
feat(client): add raw methods
1 parent 7ea4904 commit 2c62976

28 files changed

+568
-52
lines changed

src/Crawl/CrawlGetResultsResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* taskID?: string,
1818
* traceback?: string|null,
1919
* }
20-
* When used in a response, this type parameter can be used to define a $rawResponse property.
20+
* When used in a response, this type parameter can define a $rawResponse property.
2121
* @template TRawResponse of object = object{}
2222
*
2323
* @mixin TRawResponse

src/Crawl/CrawlStartResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
/**
1212
* @phpstan-type crawl_start_response = array{taskID?: string}
13-
* When used in a response, this type parameter can be used to define a $rawResponse property.
13+
* When used in a response, this type parameter can define a $rawResponse property.
1414
* @template TRawResponse of object = object{}
1515
*
1616
* @mixin TRawResponse

src/Credits/CreditGetResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @phpstan-type credit_get_response = array{
1313
* remainingCredits?: int, totalCreditsUsed?: int
1414
* }
15-
* When used in a response, this type parameter can be used to define a $rawResponse property.
15+
* When used in a response, this type parameter can define a $rawResponse property.
1616
* @template TRawResponse of object = object{}
1717
*
1818
* @mixin TRawResponse

src/Feedback/FeedbackSubmitResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* message?: string,
1616
* requestID?: string,
1717
* }
18-
* When used in a response, this type parameter can be used to define a $rawResponse property.
18+
* When used in a response, this type parameter can define a $rawResponse property.
1919
* @template TRawResponse of object = object{}
2020
*
2121
* @mixin TRawResponse

src/GenerateSchema/GenerateSchemaNewResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* status?: value-of<Status>,
1919
* userPrompt?: string,
2020
* }
21-
* When used in a response, this type parameter can be used to define a $rawResponse property.
21+
* When used in a response, this type parameter can define a $rawResponse property.
2222
* @template TRawResponse of object = object{}
2323
*
2424
* @mixin TRawResponse

src/Healthz/HealthzCheckResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @phpstan-type healthz_check_response = array{
1313
* services?: array<string, string>, status?: string
1414
* }
15-
* When used in a response, this type parameter can be used to define a $rawResponse property.
15+
* When used in a response, this type parameter can define a $rawResponse property.
1616
* @template TRawResponse of object = object{}
1717
*
1818
* @mixin TRawResponse

src/Markdownify/CompletedMarkdownify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* status?: value-of<Status>,
1818
* websiteURL?: string,
1919
* }
20-
* When used in a response, this type parameter can be used to define a $rawResponse property.
20+
* When used in a response, this type parameter can define a $rawResponse property.
2121
* @template TRawResponse of object = object{}
2222
*
2323
* @mixin TRawResponse

src/Searchscraper/CompletedSearchScraper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* status?: value-of<Status>,
2020
* userPrompt?: string,
2121
* }
22-
* When used in a response, this type parameter can be used to define a $rawResponse property.
22+
* When used in a response, this type parameter can define a $rawResponse property.
2323
* @template TRawResponse of object = object{}
2424
*
2525
* @mixin TRawResponse

src/ServiceContracts/CrawlContract.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Scrapegraphai\ServiceContracts;
66

7+
use Scrapegraphai\Core\Exceptions\APIException;
78
use Scrapegraphai\Core\Implementation\HasRawResponse;
89
use Scrapegraphai\Crawl\CrawlGetResultsResponse;
910
use Scrapegraphai\Crawl\CrawlStartParams\Rules;
@@ -18,12 +19,27 @@ interface CrawlContract
1819
* @api
1920
*
2021
* @return CrawlGetResultsResponse<HasRawResponse>
22+
*
23+
* @throws APIException
2124
*/
2225
public function retrieveResults(
2326
string $taskID,
2427
?RequestOptions $requestOptions = null
2528
): CrawlGetResultsResponse;
2629

30+
/**
31+
* @api
32+
*
33+
* @return CrawlGetResultsResponse<HasRawResponse>
34+
*
35+
* @throws APIException
36+
*/
37+
public function retrieveResultsRaw(
38+
string $taskID,
39+
mixed $params,
40+
?RequestOptions $requestOptions = null
41+
): CrawlGetResultsResponse;
42+
2743
/**
2844
* @api
2945
*
@@ -38,6 +54,8 @@ public function retrieveResults(
3854
* @param bool $sitemap Use sitemap for crawling
3955
*
4056
* @return CrawlStartResponse<HasRawResponse>
57+
*
58+
* @throws APIException
4159
*/
4260
public function start(
4361
$url,
@@ -51,4 +69,18 @@ public function start(
5169
$sitemap = omit,
5270
?RequestOptions $requestOptions = null,
5371
): CrawlStartResponse;
72+
73+
/**
74+
* @api
75+
*
76+
* @param array<string, mixed> $params
77+
*
78+
* @return CrawlStartResponse<HasRawResponse>
79+
*
80+
* @throws APIException
81+
*/
82+
public function startRaw(
83+
array $params,
84+
?RequestOptions $requestOptions = null
85+
): CrawlStartResponse;
5486
}

src/ServiceContracts/CreditsContract.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Scrapegraphai\ServiceContracts;
66

7+
use Scrapegraphai\Core\Exceptions\APIException;
78
use Scrapegraphai\Core\Implementation\HasRawResponse;
89
use Scrapegraphai\Credits\CreditGetResponse;
910
use Scrapegraphai\RequestOptions;
@@ -14,8 +15,22 @@ interface CreditsContract
1415
* @api
1516
*
1617
* @return CreditGetResponse<HasRawResponse>
18+
*
19+
* @throws APIException
1720
*/
1821
public function retrieve(
1922
?RequestOptions $requestOptions = null
2023
): CreditGetResponse;
24+
25+
/**
26+
* @api
27+
*
28+
* @return CreditGetResponse<HasRawResponse>
29+
*
30+
* @throws APIException
31+
*/
32+
public function retrieveRaw(
33+
mixed $params,
34+
?RequestOptions $requestOptions = null
35+
): CreditGetResponse;
2136
}

0 commit comments

Comments
 (0)