Skip to content

Commit 4d548b6

Browse files
feat: [feat]: add ignoreSelectors to extract()
1 parent eb093f7 commit 4d548b6

2 files changed

Lines changed: 30 additions & 3 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: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-dbbff1a35360850898f7d60588e257faeac145a73cfcae634cfeb1b70109b6af.yml
3-
openapi_spec_hash: 28c4b734a5309067c39bb4c4b709b9ab
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-7182c741edd5e22cda9bd855d31ca7e60a97a409222bb887edf87b9ce15dd493.yml
3+
openapi_spec_hash: 174581867a9191c491b22855b64c4f19
44
config_hash: a962ae71493deb11a1c903256fb25386

src/Sessions/SessionExtractParams/Options.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,25 @@
1414
* @phpstan-import-type ModelShape from \Stagehand\Sessions\SessionExtractParams\Options\Model
1515
*
1616
* @phpstan-type OptionsShape = array{
17-
* model?: ModelShape|null, selector?: string|null, timeout?: float|null
17+
* ignoreSelectors?: list<string>|null,
18+
* model?: ModelShape|null,
19+
* selector?: string|null,
20+
* timeout?: float|null,
1821
* }
1922
*/
2023
final class Options implements BaseModel
2124
{
2225
/** @use SdkModel<OptionsShape> */
2326
use SdkModel;
2427

28+
/**
29+
* Selectors for elements and subtrees that should be excluded from extraction.
30+
*
31+
* @var list<string>|null $ignoreSelectors
32+
*/
33+
#[Optional(list: 'string')]
34+
public ?array $ignoreSelectors;
35+
2536
/**
2637
* Model configuration object or model name string (e.g., 'openai/gpt-5-nano').
2738
*
@@ -52,22 +63,38 @@ public function __construct()
5263
*
5364
* You must use named parameters to construct any parameters with a default value.
5465
*
66+
* @param list<string>|null $ignoreSelectors
5567
* @param ModelShape|null $model
5668
*/
5769
public static function with(
70+
?array $ignoreSelectors = null,
5871
string|ModelConfig|array|null $model = null,
5972
?string $selector = null,
6073
?float $timeout = null,
6174
): self {
6275
$self = new self;
6376

77+
null !== $ignoreSelectors && $self['ignoreSelectors'] = $ignoreSelectors;
6478
null !== $model && $self['model'] = $model;
6579
null !== $selector && $self['selector'] = $selector;
6680
null !== $timeout && $self['timeout'] = $timeout;
6781

6882
return $self;
6983
}
7084

85+
/**
86+
* Selectors for elements and subtrees that should be excluded from extraction.
87+
*
88+
* @param list<string> $ignoreSelectors
89+
*/
90+
public function withIgnoreSelectors(array $ignoreSelectors): self
91+
{
92+
$self = clone $this;
93+
$self['ignoreSelectors'] = $ignoreSelectors;
94+
95+
return $self;
96+
}
97+
7198
/**
7299
* Model configuration object or model name string (e.g., 'openai/gpt-5-nano').
73100
*

0 commit comments

Comments
 (0)