Skip to content

Commit b635a05

Browse files
feat(api): api update
1 parent f7a3ee5 commit b635a05

8 files changed

Lines changed: 83 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 36
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-66a3bf68b47ba61c9b61406d36f614a079ff752b8964a8df8062e485391d5598.yml
3-
openapi_spec_hash: b17d6cfe3710dd0605078f3907a1a419
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d71b08e421ccdda9a2754c307e97df0ee7444926306a00624dca2bc7d56548ac.yml
3+
openapi_spec_hash: ebfbed20b5837ccf8db8bb40ab23baac
44
config_hash: 7ec4851ee8d93177947e95df5ae897b5

src/ServiceContracts/WebContract.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ public function search(
213213
* @param int $maxDepth Maximum link depth from the starting URL (0 = only the starting page)
214214
* @param int $maxPages Maximum number of pages to crawl. Hard cap: 500.
215215
* @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
216+
* @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
216217
* @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output
217218
* @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s).
218219
* @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).
@@ -238,6 +239,7 @@ public function webCrawlMd(
238239
\ContextDev\Web\WebWebCrawlMdParams\Pdf|array $pdf = [
239240
'shouldParse' => true,
240241
],
242+
bool $settleAnimations = false,
241243
bool $shortenBase64Images = true,
242244
int $stopAfterMs = 80000,
243245
?int $timeoutMs = null,
@@ -258,6 +260,7 @@ public function webCrawlMd(
258260
* @param list<string> $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]".
259261
* @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
260262
* @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
263+
* @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
261264
* @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).
262265
* @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable
263266
* @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds).
@@ -276,6 +279,7 @@ public function webScrapeHTML(
276279
\ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [
277280
'shouldParse' => true,
278281
],
282+
bool $settleAnimations = false,
279283
?int $timeoutMs = null,
280284
bool $useMainContentOnly = false,
281285
?int $waitForMs = null,
@@ -318,6 +322,7 @@ public function webScrapeImages(
318322
* @param list<string> $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]".
319323
* @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
320324
* @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
325+
* @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
321326
* @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output
322327
* @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).
323328
* @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation
@@ -339,6 +344,7 @@ public function webScrapeMd(
339344
\ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [
340345
'shouldParse' => true,
341346
],
347+
bool $settleAnimations = false,
342348
bool $shortenBase64Images = true,
343349
?int $timeoutMs = null,
344350
bool $useMainContentOnly = false,

src/Services/WebRawService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ public function search(
321321
* maxDepth?: int,
322322
* maxPages?: int,
323323
* pdf?: WebWebCrawlMdParams\Pdf|PdfShape1,
324+
* settleAnimations?: bool,
324325
* shortenBase64Images?: bool,
325326
* stopAfterMs?: int,
326327
* timeoutMs?: int,
@@ -367,6 +368,7 @@ public function webCrawlMd(
367368
* includeSelectors?: list<string>,
368369
* maxAgeMs?: int,
369370
* pdf?: WebWebScrapeHTMLParams\Pdf|PdfShape2,
371+
* settleAnimations?: bool,
370372
* timeoutMs?: int,
371373
* useMainContentOnly?: bool,
372374
* waitForMs?: int,
@@ -450,6 +452,7 @@ public function webScrapeImages(
450452
* includeSelectors?: list<string>,
451453
* maxAgeMs?: int,
452454
* pdf?: WebWebScrapeMdParams\Pdf|PdfShape3,
455+
* settleAnimations?: bool,
453456
* shortenBase64Images?: bool,
454457
* timeoutMs?: int,
455458
* useMainContentOnly?: bool,

src/Services/WebService.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ public function search(
349349
* @param int $maxDepth Maximum link depth from the starting URL (0 = only the starting page)
350350
* @param int $maxPages Maximum number of pages to crawl. Hard cap: 500.
351351
* @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
352+
* @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
352353
* @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output
353354
* @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s).
354355
* @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).
@@ -374,6 +375,7 @@ public function webCrawlMd(
374375
\ContextDev\Web\WebWebCrawlMdParams\Pdf|array $pdf = [
375376
'shouldParse' => true,
376377
],
378+
bool $settleAnimations = false,
377379
bool $shortenBase64Images = true,
378380
int $stopAfterMs = 80000,
379381
?int $timeoutMs = null,
@@ -396,6 +398,7 @@ public function webCrawlMd(
396398
'maxDepth' => $maxDepth,
397399
'maxPages' => $maxPages,
398400
'pdf' => $pdf,
401+
'settleAnimations' => $settleAnimations,
399402
'shortenBase64Images' => $shortenBase64Images,
400403
'stopAfterMs' => $stopAfterMs,
401404
'timeoutMs' => $timeoutMs,
@@ -424,6 +427,7 @@ public function webCrawlMd(
424427
* @param list<string> $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]".
425428
* @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
426429
* @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
430+
* @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
427431
* @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).
428432
* @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable
429433
* @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds).
@@ -442,6 +446,7 @@ public function webScrapeHTML(
442446
\ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [
443447
'shouldParse' => true,
444448
],
449+
bool $settleAnimations = false,
445450
?int $timeoutMs = null,
446451
bool $useMainContentOnly = false,
447452
?int $waitForMs = null,
@@ -457,6 +462,7 @@ public function webScrapeHTML(
457462
'includeSelectors' => $includeSelectors,
458463
'maxAgeMs' => $maxAgeMs,
459464
'pdf' => $pdf,
465+
'settleAnimations' => $settleAnimations,
460466
'timeoutMs' => $timeoutMs,
461467
'useMainContentOnly' => $useMainContentOnly,
462468
'waitForMs' => $waitForMs,
@@ -525,6 +531,7 @@ public function webScrapeImages(
525531
* @param list<string> $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]".
526532
* @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
527533
* @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
534+
* @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
528535
* @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output
529536
* @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).
530537
* @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation
@@ -546,6 +553,7 @@ public function webScrapeMd(
546553
\ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [
547554
'shouldParse' => true,
548555
],
556+
bool $settleAnimations = false,
549557
bool $shortenBase64Images = true,
550558
?int $timeoutMs = null,
551559
bool $useMainContentOnly = false,
@@ -564,6 +572,7 @@ public function webScrapeMd(
564572
'includeSelectors' => $includeSelectors,
565573
'maxAgeMs' => $maxAgeMs,
566574
'pdf' => $pdf,
575+
'settleAnimations' => $settleAnimations,
567576
'shortenBase64Images' => $shortenBase64Images,
568577
'timeoutMs' => $timeoutMs,
569578
'useMainContentOnly' => $useMainContentOnly,

src/Web/WebWebCrawlMdParams.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
* maxDepth?: int|null,
3333
* maxPages?: int|null,
3434
* pdf?: null|Pdf|PdfShape,
35+
* settleAnimations?: bool|null,
3536
* shortenBase64Images?: bool|null,
3637
* stopAfterMs?: int|null,
3738
* timeoutMs?: int|null,
@@ -124,6 +125,12 @@ final class WebWebCrawlMdParams implements BaseModel
124125
#[Optional]
125126
public ?Pdf $pdf;
126127

128+
/**
129+
* When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
130+
*/
131+
#[Optional]
132+
public ?bool $settleAnimations;
133+
127134
/**
128135
* Truncate base64-encoded image data in the Markdown output.
129136
*/
@@ -202,6 +209,7 @@ public static function with(
202209
?int $maxDepth = null,
203210
?int $maxPages = null,
204211
Pdf|array|null $pdf = null,
212+
?bool $settleAnimations = null,
205213
?bool $shortenBase64Images = null,
206214
?int $stopAfterMs = null,
207215
?int $timeoutMs = null,
@@ -224,6 +232,7 @@ public static function with(
224232
null !== $maxDepth && $self['maxDepth'] = $maxDepth;
225233
null !== $maxPages && $self['maxPages'] = $maxPages;
226234
null !== $pdf && $self['pdf'] = $pdf;
235+
null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations;
227236
null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images;
228237
null !== $stopAfterMs && $self['stopAfterMs'] = $stopAfterMs;
229238
null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs;
@@ -374,6 +383,17 @@ public function withPdf(Pdf|array $pdf): self
374383
return $self;
375384
}
376385

386+
/**
387+
* When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
388+
*/
389+
public function withSettleAnimations(bool $settleAnimations): self
390+
{
391+
$self = clone $this;
392+
$self['settleAnimations'] = $settleAnimations;
393+
394+
return $self;
395+
}
396+
377397
/**
378398
* Truncate base64-encoded image data in the Markdown output.
379399
*/

src/Web/WebWebScrapeHTMLParams.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* includeSelectors?: list<string>|null,
2929
* maxAgeMs?: int|null,
3030
* pdf?: null|Pdf|PdfShape,
31+
* settleAnimations?: bool|null,
3132
* timeoutMs?: int|null,
3233
* useMainContentOnly?: bool|null,
3334
* waitForMs?: int|null,
@@ -95,6 +96,12 @@ final class WebWebScrapeHTMLParams implements BaseModel
9596
#[Optional]
9697
public ?Pdf $pdf;
9798

99+
/**
100+
* When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
101+
*/
102+
#[Optional]
103+
public ?bool $settleAnimations;
104+
98105
/**
99106
* Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).
100107
*/
@@ -152,6 +159,7 @@ public static function with(
152159
?array $includeSelectors = null,
153160
?int $maxAgeMs = null,
154161
Pdf|array|null $pdf = null,
162+
?bool $settleAnimations = null,
155163
?int $timeoutMs = null,
156164
?bool $useMainContentOnly = null,
157165
?int $waitForMs = null,
@@ -167,6 +175,7 @@ public static function with(
167175
null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors;
168176
null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs;
169177
null !== $pdf && $self['pdf'] = $pdf;
178+
null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations;
170179
null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs;
171180
null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly;
172181
null !== $waitForMs && $self['waitForMs'] = $waitForMs;
@@ -272,6 +281,17 @@ public function withPdf(Pdf|array $pdf): self
272281
return $self;
273282
}
274283

284+
/**
285+
* When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
286+
*/
287+
public function withSettleAnimations(bool $settleAnimations): self
288+
{
289+
$self = clone $this;
290+
$self['settleAnimations'] = $settleAnimations;
291+
292+
return $self;
293+
}
294+
275295
/**
276296
* Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).
277297
*/

src/Web/WebWebScrapeMdParams.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* includeSelectors?: list<string>|null,
3131
* maxAgeMs?: int|null,
3232
* pdf?: null|Pdf|PdfShape,
33+
* settleAnimations?: bool|null,
3334
* shortenBase64Images?: bool|null,
3435
* timeoutMs?: int|null,
3536
* useMainContentOnly?: bool|null,
@@ -110,6 +111,12 @@ final class WebWebScrapeMdParams implements BaseModel
110111
#[Optional]
111112
public ?Pdf $pdf;
112113

114+
/**
115+
* When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
116+
*/
117+
#[Optional]
118+
public ?bool $settleAnimations;
119+
113120
/**
114121
* Shorten base64-encoded image data in the Markdown output.
115122
*/
@@ -175,6 +182,7 @@ public static function with(
175182
?array $includeSelectors = null,
176183
?int $maxAgeMs = null,
177184
Pdf|array|null $pdf = null,
185+
?bool $settleAnimations = null,
178186
?bool $shortenBase64Images = null,
179187
?int $timeoutMs = null,
180188
?bool $useMainContentOnly = null,
@@ -193,6 +201,7 @@ public static function with(
193201
null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors;
194202
null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs;
195203
null !== $pdf && $self['pdf'] = $pdf;
204+
null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations;
196205
null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images;
197206
null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs;
198207
null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly;
@@ -321,6 +330,17 @@ public function withPdf(Pdf|array $pdf): self
321330
return $self;
322331
}
323332

333+
/**
334+
* When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.
335+
*/
336+
public function withSettleAnimations(bool $settleAnimations): self
337+
{
338+
$self = clone $this;
339+
$self['settleAnimations'] = $settleAnimations;
340+
341+
return $self;
342+
}
343+
324344
/**
325345
* Shorten base64-encoded image data in the Markdown output.
326346
*/

0 commit comments

Comments
 (0)