Skip to content

Commit 07e8016

Browse files
feat(api): api update
1 parent 1aacc56 commit 07e8016

12 files changed

Lines changed: 122 additions & 124 deletions

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 40
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-662e436bab5a74933ca1d08ac370c34ef632285b7aec23d95b1b442b2291d589.yml
3-
openapi_spec_hash: 34399fa7028ac361abee1a0a4f139093
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d31d405927ec58ac97c0a9732130aea18209c65a0f2f0a348aa91c333535305e.yml
3+
openapi_spec_hash: 0ede81f7fd98f41bc6bbc4167300bfb9
44
config_hash: 920678668dd2da6f8966fbf1b8fde4e2

‎src/context/dev/resources/parse.py‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from __future__ import annotations
44

55
import os
6-
from typing import Union
76
from typing_extensions import Literal
87

98
import httpx
@@ -136,13 +135,13 @@ def handle(
136135
"pnm",
137136
]
138137
| Omit = omit,
139-
include_images: Union[bool, Literal["true", "false"]] | Omit = omit,
140-
include_links: Union[bool, Literal["true", "false"]] | Omit = omit,
141-
ocr: Union[bool, Literal["true", "false"]] | Omit = omit,
138+
include_images: bool | Omit = omit,
139+
include_links: bool | Omit = omit,
140+
ocr: bool | Omit = omit,
142141
pdf: parse_handle_params.Pdf | Omit = omit,
143-
shorten_base64_images: Union[bool, Literal["true", "false"]] | Omit = omit,
142+
shorten_base64_images: bool | Omit = omit,
144143
tags: SequenceNotStr[str] | Omit = omit,
145-
use_main_content_only: Union[bool, Literal["true", "false"]] | Omit = omit,
144+
use_main_content_only: bool | Omit = omit,
146145
zdr: Literal["enabled", "disabled"] | Omit = omit,
147146
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
148147
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -321,13 +320,13 @@ async def handle(
321320
"pnm",
322321
]
323322
| Omit = omit,
324-
include_images: Union[bool, Literal["true", "false"]] | Omit = omit,
325-
include_links: Union[bool, Literal["true", "false"]] | Omit = omit,
326-
ocr: Union[bool, Literal["true", "false"]] | Omit = omit,
323+
include_images: bool | Omit = omit,
324+
include_links: bool | Omit = omit,
325+
ocr: bool | Omit = omit,
327326
pdf: parse_handle_params.Pdf | Omit = omit,
328-
shorten_base64_images: Union[bool, Literal["true", "false"]] | Omit = omit,
327+
shorten_base64_images: bool | Omit = omit,
329328
tags: SequenceNotStr[str] | Omit = omit,
330-
use_main_content_only: Union[bool, Literal["true", "false"]] | Omit = omit,
329+
use_main_content_only: bool | Omit = omit,
331330
zdr: Literal["enabled", "disabled"] | Omit = omit,
332331
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
333332
# The extra values given here take precedence over values defined on the client or passed to this method.

‎src/context/dev/resources/web.py‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Union, Iterable, Optional
5+
from typing import Dict, Iterable, Optional
66
from typing_extensions import Literal
77

88
import httpx
@@ -597,7 +597,7 @@ def screenshot(
597597
direct_url: str | Omit = omit,
598598
domain: str | Omit = omit,
599599
full_screenshot: Literal["true", "false"] | Omit = omit,
600-
handle_cookie_popup: Union[bool, Literal["true", "false"]] | Omit = omit,
600+
handle_cookie_popup: bool | Omit = omit,
601601
max_age_ms: Optional[int] | Omit = omit,
602602
page: Literal["login", "signup", "blog", "careers", "pricing", "terms", "privacy", "contact"] | Omit = omit,
603603
scroll_offset: Optional[int] | Omit = omit,
@@ -1599,14 +1599,14 @@ def web_scrape_html(
15991599
| Omit = omit,
16001600
exclude_selectors: Optional[SequenceNotStr[str]] | Omit = omit,
16011601
headers: Dict[str, str] | Omit = omit,
1602-
include_frames: Union[bool, Literal["true", "false"]] | Omit = omit,
1602+
include_frames: bool | Omit = omit,
16031603
include_selectors: Optional[SequenceNotStr[str]] | Omit = omit,
16041604
max_age_ms: Optional[int] | Omit = omit,
16051605
pdf: web_web_scrape_html_params.Pdf | Omit = omit,
1606-
settle_animations: Union[bool, Literal["true", "false"]] | Omit = omit,
1606+
settle_animations: bool | Omit = omit,
16071607
tags: SequenceNotStr[str] | Omit = omit,
16081608
timeout_ms: int | Omit = omit,
1609-
use_main_content_only: Union[bool, Literal["true", "false"]] | Omit = omit,
1609+
use_main_content_only: bool | Omit = omit,
16101610
wait_for_ms: Optional[int] | Omit = omit,
16111611
zdr: Literal["enabled", "disabled"] | Omit = omit,
16121612
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1720,7 +1720,7 @@ def web_scrape_images(
17201720
*,
17211721
url: str,
17221722
actions: Optional[Iterable[web_web_scrape_images_params.Action]] | Omit = omit,
1723-
dedupe: Union[bool, Literal["true", "false"]] | Omit = omit,
1723+
dedupe: bool | Omit = omit,
17241724
enrichment: Optional[web_web_scrape_images_params.Enrichment] | Omit = omit,
17251725
headers: Dict[str, str] | Omit = omit,
17261726
max_age_ms: Optional[int] | Omit = omit,
@@ -2021,18 +2021,18 @@ def web_scrape_md(
20212021
| Omit = omit,
20222022
exclude_selectors: Optional[SequenceNotStr[str]] | Omit = omit,
20232023
headers: Dict[str, str] | Omit = omit,
2024-
include_frames: Union[bool, Literal["true", "false"]] | Omit = omit,
2025-
include_html: Union[bool, Literal["true", "false"]] | Omit = omit,
2026-
include_images: Union[bool, Literal["true", "false"]] | Omit = omit,
2027-
include_links: Union[bool, Literal["true", "false"]] | Omit = omit,
2024+
include_frames: bool | Omit = omit,
2025+
include_html: bool | Omit = omit,
2026+
include_images: bool | Omit = omit,
2027+
include_links: bool | Omit = omit,
20282028
include_selectors: Optional[SequenceNotStr[str]] | Omit = omit,
20292029
max_age_ms: Optional[int] | Omit = omit,
20302030
pdf: web_web_scrape_md_params.Pdf | Omit = omit,
2031-
settle_animations: Union[bool, Literal["true", "false"]] | Omit = omit,
2032-
shorten_base64_images: Union[bool, Literal["true", "false"]] | Omit = omit,
2031+
settle_animations: bool | Omit = omit,
2032+
shorten_base64_images: bool | Omit = omit,
20332033
tags: SequenceNotStr[str] | Omit = omit,
20342034
timeout_ms: int | Omit = omit,
2035-
use_main_content_only: Union[bool, Literal["true", "false"]] | Omit = omit,
2035+
use_main_content_only: bool | Omit = omit,
20362036
wait_for_ms: Optional[int] | Omit = omit,
20372037
zdr: Literal["enabled", "disabled"] | Omit = omit,
20382038
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -2827,7 +2827,7 @@ async def screenshot(
28272827
direct_url: str | Omit = omit,
28282828
domain: str | Omit = omit,
28292829
full_screenshot: Literal["true", "false"] | Omit = omit,
2830-
handle_cookie_popup: Union[bool, Literal["true", "false"]] | Omit = omit,
2830+
handle_cookie_popup: bool | Omit = omit,
28312831
max_age_ms: Optional[int] | Omit = omit,
28322832
page: Literal["login", "signup", "blog", "careers", "pricing", "terms", "privacy", "contact"] | Omit = omit,
28332833
scroll_offset: Optional[int] | Omit = omit,
@@ -3829,14 +3829,14 @@ async def web_scrape_html(
38293829
| Omit = omit,
38303830
exclude_selectors: Optional[SequenceNotStr[str]] | Omit = omit,
38313831
headers: Dict[str, str] | Omit = omit,
3832-
include_frames: Union[bool, Literal["true", "false"]] | Omit = omit,
3832+
include_frames: bool | Omit = omit,
38333833
include_selectors: Optional[SequenceNotStr[str]] | Omit = omit,
38343834
max_age_ms: Optional[int] | Omit = omit,
38353835
pdf: web_web_scrape_html_params.Pdf | Omit = omit,
3836-
settle_animations: Union[bool, Literal["true", "false"]] | Omit = omit,
3836+
settle_animations: bool | Omit = omit,
38373837
tags: SequenceNotStr[str] | Omit = omit,
38383838
timeout_ms: int | Omit = omit,
3839-
use_main_content_only: Union[bool, Literal["true", "false"]] | Omit = omit,
3839+
use_main_content_only: bool | Omit = omit,
38403840
wait_for_ms: Optional[int] | Omit = omit,
38413841
zdr: Literal["enabled", "disabled"] | Omit = omit,
38423842
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -3950,7 +3950,7 @@ async def web_scrape_images(
39503950
*,
39513951
url: str,
39523952
actions: Optional[Iterable[web_web_scrape_images_params.Action]] | Omit = omit,
3953-
dedupe: Union[bool, Literal["true", "false"]] | Omit = omit,
3953+
dedupe: bool | Omit = omit,
39543954
enrichment: Optional[web_web_scrape_images_params.Enrichment] | Omit = omit,
39553955
headers: Dict[str, str] | Omit = omit,
39563956
max_age_ms: Optional[int] | Omit = omit,
@@ -4251,18 +4251,18 @@ async def web_scrape_md(
42514251
| Omit = omit,
42524252
exclude_selectors: Optional[SequenceNotStr[str]] | Omit = omit,
42534253
headers: Dict[str, str] | Omit = omit,
4254-
include_frames: Union[bool, Literal["true", "false"]] | Omit = omit,
4255-
include_html: Union[bool, Literal["true", "false"]] | Omit = omit,
4256-
include_images: Union[bool, Literal["true", "false"]] | Omit = omit,
4257-
include_links: Union[bool, Literal["true", "false"]] | Omit = omit,
4254+
include_frames: bool | Omit = omit,
4255+
include_html: bool | Omit = omit,
4256+
include_images: bool | Omit = omit,
4257+
include_links: bool | Omit = omit,
42584258
include_selectors: Optional[SequenceNotStr[str]] | Omit = omit,
42594259
max_age_ms: Optional[int] | Omit = omit,
42604260
pdf: web_web_scrape_md_params.Pdf | Omit = omit,
4261-
settle_animations: Union[bool, Literal["true", "false"]] | Omit = omit,
4262-
shorten_base64_images: Union[bool, Literal["true", "false"]] | Omit = omit,
4261+
settle_animations: bool | Omit = omit,
4262+
shorten_base64_images: bool | Omit = omit,
42634263
tags: SequenceNotStr[str] | Omit = omit,
42644264
timeout_ms: int | Omit = omit,
4265-
use_main_content_only: Union[bool, Literal["true", "false"]] | Omit = omit,
4265+
use_main_content_only: bool | Omit = omit,
42664266
wait_for_ms: Optional[int] | Omit = omit,
42674267
zdr: Literal["enabled", "disabled"] | Omit = omit,
42684268
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.

‎src/context/dev/types/batch_submit_params.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ class InputScrapeDataMarkdownOptionsPdf(TypedDict, total=False):
8888
start when both are provided.
8989
"""
9090

91-
ocr: Union[bool, Literal["true", "false"]]
91+
ocr: bool
9292
"""
9393
When true, OCR the selected PDF pages that have no usable text layer (scans),
9494
replacing each recovered page's text with the OCR result while pages with a real
9595
text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
9696
of the base request cost. When false, no OCR runs.
9797
"""
9898

99-
should_parse: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="shouldParse")]
99+
should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
100100
"""When true, PDF URLs are fetched and parsed.
101101
102102
When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned.
@@ -419,15 +419,15 @@ class InputScrapeDataHTMLOptionsPdf(TypedDict, total=False):
419419
start when both are provided.
420420
"""
421421

422-
ocr: Union[bool, Literal["true", "false"]]
422+
ocr: bool
423423
"""
424424
When true, OCR the selected PDF pages that have no usable text layer (scans),
425425
replacing each recovered page's text with the OCR result while pages with a real
426426
text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
427427
of the base request cost. When false, no OCR runs.
428428
"""
429429

430-
should_parse: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="shouldParse")]
430+
should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
431431
"""When true, PDF URLs are fetched and parsed.
432432
433433
When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned.
@@ -802,15 +802,15 @@ class InputCrawlDataMarkdownOptionsPdf(TypedDict, total=False):
802802
start when both are provided.
803803
"""
804804

805-
ocr: Union[bool, Literal["true", "false"]]
805+
ocr: bool
806806
"""
807807
When true, OCR the selected PDF pages that have no usable text layer (scans),
808808
replacing each recovered page's text with the OCR result while pages with a real
809809
text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
810810
of the base request cost. When false, no OCR runs.
811811
"""
812812

813-
should_parse: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="shouldParse")]
813+
should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
814814
"""When true, PDF URLs are fetched and parsed.
815815
816816
When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned.
@@ -1185,15 +1185,15 @@ class InputCrawlDataHTMLOptionsPdf(TypedDict, total=False):
11851185
start when both are provided.
11861186
"""
11871187

1188-
ocr: Union[bool, Literal["true", "false"]]
1188+
ocr: bool
11891189
"""
11901190
When true, OCR the selected PDF pages that have no usable text layer (scans),
11911191
replacing each recovered page's text with the OCR result while pages with a real
11921192
text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
11931193
of the base request cost. When false, no OCR runs.
11941194
"""
11951195

1196-
should_parse: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="shouldParse")]
1196+
should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
11971197
"""When true, PDF URLs are fetched and parsed.
11981198
11991199
When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned.

‎src/context/dev/types/parse_handle_params.py‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
65
from typing_extensions import Literal, Annotated, TypedDict
76

87
from .._types import SequenceNotStr
@@ -92,13 +91,13 @@ class ParseHandleParams(TypedDict, total=False):
9291
md, py, rtf, jpg, png, or txt.
9392
"""
9493

95-
include_images: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="includeImages")]
94+
include_images: Annotated[bool, PropertyInfo(alias="includeImages")]
9695
"""Include image references in Markdown output"""
9796

98-
include_links: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="includeLinks")]
97+
include_links: Annotated[bool, PropertyInfo(alias="includeLinks")]
9998
"""Preserve hyperlinks in Markdown output"""
10099

101-
ocr: Union[bool, Literal["true", "false"]]
100+
ocr: bool
102101
"""
103102
When true for PDF inputs, OCR the selected pages that have no usable text layer
104103
(scans), replacing each recovered page's text with the OCR result while pages
@@ -110,7 +109,7 @@ class ParseHandleParams(TypedDict, total=False):
110109
pdf: Pdf
111110
"""PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}."""
112111

113-
shorten_base64_images: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="shortenBase64Images")]
112+
shorten_base64_images: Annotated[bool, PropertyInfo(alias="shortenBase64Images")]
114113
"""Shorten base64-encoded image data in the Markdown output"""
115114

116115
tags: SequenceNotStr[str]
@@ -120,7 +119,7 @@ class ParseHandleParams(TypedDict, total=False):
120119
the dashboard usage page. Up to 20 tags, each 1-50 characters.
121120
"""
122121

123-
use_main_content_only: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="useMainContentOnly")]
122+
use_main_content_only: Annotated[bool, PropertyInfo(alias="useMainContentOnly")]
124123
"""Extract only the main content from HTML-like inputs"""
125124

126125
zdr: Literal["enabled", "disabled"]

‎src/context/dev/types/web_screenshot_params.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union, Optional
5+
from typing import Optional
66
from typing_extensions import Literal, Annotated, TypedDict
77

88
from .._types import SequenceNotStr
@@ -250,7 +250,7 @@ class WebScreenshotParams(TypedDict, total=False):
250250
provided, takes a viewport screenshot (standard browser view).
251251
"""
252252

253-
handle_cookie_popup: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="handleCookiePopup")]
253+
handle_cookie_popup: Annotated[bool, PropertyInfo(alias="handleCookiePopup")]
254254
"""Optional parameter to control cookie/consent popup handling.
255255
256256
If 'true', we dismiss cookie banner before capture. If 'false' or not provided,

‎src/context/dev/types/web_web_scrape_html_params.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class WebWebScrapeHTMLParams(TypedDict, total=False):
247247
is bypassed: the result is neither read from nor written to cache.
248248
"""
249249

250-
include_frames: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="includeFrames")]
250+
include_frames: Annotated[bool, PropertyInfo(alias="includeFrames")]
251251
"""When true, iframes are rendered inline into the returned HTML."""
252252

253253
include_selectors: Annotated[Optional[SequenceNotStr[str]], PropertyInfo(alias="includeSelectors")]
@@ -272,7 +272,7 @@ class WebWebScrapeHTMLParams(TypedDict, total=False):
272272
inclusive 1-based page range.
273273
"""
274274

275-
settle_animations: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="settleAnimations")]
275+
settle_animations: Annotated[bool, PropertyInfo(alias="settleAnimations")]
276276
"""
277277
When true, waits briefly for CSS and transition animations to settle before
278278
extracting HTML. Defaults to false. This adds a bit of latency in exchange for
@@ -293,7 +293,7 @@ class WebWebScrapeHTMLParams(TypedDict, total=False):
293293
status code. Maximum allowed value is 300000ms (5 minutes).
294294
"""
295295

296-
use_main_content_only: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="useMainContentOnly")]
296+
use_main_content_only: Annotated[bool, PropertyInfo(alias="useMainContentOnly")]
297297
"""
298298
When true, return only the page's main content in the HTML response, excluding
299299
headers, footers, sidebars, and navigation when detectable.
@@ -346,15 +346,15 @@ class Pdf(TypedDict, total=False):
346346
start when both are provided.
347347
"""
348348

349-
ocr: Union[bool, Literal["true", "false"]]
349+
ocr: bool
350350
"""
351351
When true, OCR the selected PDF pages that have no usable text layer (scans),
352352
replacing each recovered page's text with the OCR result while pages with a real
353353
text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
354354
of the base request cost. When false, no OCR runs.
355355
"""
356356

357-
should_parse: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="shouldParse")]
357+
should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
358358
"""When true, PDF URLs are fetched and parsed.
359359
360360
When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned.

‎src/context/dev/types/web_web_scrape_images_params.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class WebWebScrapeImagesParams(TypedDict, total=False):
2828
parameter. Maximum: 5 actions.
2929
"""
3030

31-
dedupe: Union[bool, Literal["true", "false"]]
31+
dedupe: bool
3232
"""
3333
When true, visually duplicate images are removed: every image is loaded and
3434
perceptually hashed, and only the highest-resolution copy of each duplicate
@@ -101,10 +101,10 @@ class Enrichment(TypedDict, total=False):
101101
Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true.
102102
"""
103103

104-
classification: Union[bool, Literal["true", "false"]]
104+
classification: bool
105105
"""Classify each image by visual asset type."""
106106

107-
hosted_url: Annotated[Union[bool, Literal["true", "false"]], PropertyInfo(alias="hostedUrl")]
107+
hosted_url: Annotated[bool, PropertyInfo(alias="hostedUrl")]
108108
"""
109109
Host materializable images on the Brand.dev CDN and return their URL and MIME
110110
type.
@@ -113,5 +113,5 @@ class Enrichment(TypedDict, total=False):
113113
max_time_per_ms: Annotated[int, PropertyInfo(alias="maxTimePerMs")]
114114
"""Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000."""
115115

116-
resolution: Union[bool, Literal["true", "false"]]
116+
resolution: bool
117117
"""Measure image width and height when possible."""

0 commit comments

Comments
 (0)