Skip to content

Commit eb22b56

Browse files
feat(api): api update
1 parent fbc0794 commit eb22b56

6 files changed

Lines changed: 78 additions & 78 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: 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

‎pkg/cmd/batch_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func TestBatchSubmit(t *testing.T) {
8282
t,
8383
"--api-key", "string",
8484
"batch", "submit",
85-
"--input", "{data: {format: markdown, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], options: {country: de, excludeSelectors: [x], includeHTML: true, includeImages: true, includeLinks: true, includeSelectors: [x], maxAgeMs: 0, pdf: {end: 1, ocr: 'true', shouldParse: 'true', start: 1}, settleAnimations: true, shortenBase64Images: true, useMainContentOnly: true, waitForMs: 0}}, mode: scrape}",
85+
"--input", "{data: {format: markdown, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], options: {country: de, excludeSelectors: [x], includeHTML: true, includeImages: true, includeLinks: true, includeSelectors: [x], maxAgeMs: 0, pdf: {end: 1, ocr: true, shouldParse: true, start: 1}, settleAnimations: true, shortenBase64Images: true, useMainContentOnly: true, waitForMs: 0}}, mode: scrape}",
8686
"--tag", "docs",
8787
"--tag", "competitor",
8888
"--webhook-url", "webhookUrl",
@@ -117,8 +117,8 @@ func TestBatchSubmit(t *testing.T) {
117117
" maxAgeMs: 0\n" +
118118
" pdf:\n" +
119119
" end: 1\n" +
120-
" ocr: 'true'\n" +
121-
" shouldParse: 'true'\n" +
120+
" ocr: true\n" +
121+
" shouldParse: true\n" +
122122
" start: 1\n" +
123123
" settleAnimations: true\n" +
124124
" shortenBase64Images: true\n" +

‎pkg/cmd/parse.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{
3737
Usage: "Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt.",
3838
QueryPath: "extension",
3939
},
40-
&requestflag.Flag[any]{
40+
&requestflag.Flag[bool]{
4141
Name: "include-images",
4242
Usage: "Include image references in Markdown output",
4343
Default: false,
4444
QueryPath: "includeImages",
4545
},
46-
&requestflag.Flag[any]{
46+
&requestflag.Flag[bool]{
4747
Name: "include-links",
4848
Usage: "Preserve hyperlinks in Markdown output",
4949
Default: true,
5050
QueryPath: "includeLinks",
5151
},
52-
&requestflag.Flag[any]{
52+
&requestflag.Flag[bool]{
5353
Name: "ocr",
5454
Usage: "When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs.",
5555
Default: false,
@@ -61,7 +61,7 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{
6161
Default: map[string]any{},
6262
QueryPath: "pdf",
6363
},
64-
&requestflag.Flag[any]{
64+
&requestflag.Flag[bool]{
6565
Name: "shorten-base64-images",
6666
Usage: "Shorten base64-encoded image data in the Markdown output",
6767
Default: true,
@@ -72,7 +72,7 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{
7272
Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.",
7373
QueryPath: "tags",
7474
},
75-
&requestflag.Flag[any]{
75+
&requestflag.Flag[bool]{
7676
Name: "use-main-content-only",
7777
Usage: "Extract only the main content from HTML-like inputs",
7878
Default: false,

‎pkg/cmd/parse_test.go‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ func TestParseHandle(t *testing.T) {
1919
"--body", mocktest.TestFile(t, "Example data"),
2020
"--client", "x",
2121
"--extension", "txt",
22-
"--include-images", "'true'",
23-
"--include-links", "'true'",
24-
"--ocr", "'true'",
22+
"--include-images=true",
23+
"--include-links=true",
24+
"--ocr=true",
2525
"--pdf", "{end: 1, start: 1}",
26-
"--shorten-base64-images", "'true'",
26+
"--shorten-base64-images=true",
2727
"--tag", "production",
2828
"--tag", "team-alpha",
29-
"--use-main-content-only", "'true'",
29+
"--use-main-content-only=true",
3030
"--zdr", "enabled",
3131
)
3232
})
@@ -43,15 +43,15 @@ func TestParseHandle(t *testing.T) {
4343
"--body", mocktest.TestFile(t, "Example data"),
4444
"--client", "x",
4545
"--extension", "txt",
46-
"--include-images", "'true'",
47-
"--include-links", "'true'",
48-
"--ocr", "'true'",
46+
"--include-images=true",
47+
"--include-links=true",
48+
"--ocr=true",
4949
"--pdf.end", "1",
5050
"--pdf.start", "1",
51-
"--shorten-base64-images", "'true'",
51+
"--shorten-base64-images=true",
5252
"--tag", "production",
5353
"--tag", "team-alpha",
54-
"--use-main-content-only", "'true'",
54+
"--use-main-content-only=true",
5555
"--zdr", "enabled",
5656
)
5757
})
@@ -65,14 +65,14 @@ func TestParseHandle(t *testing.T) {
6565
"parse", "handle",
6666
"--client", "x",
6767
"--extension", "txt",
68-
"--include-images", "'true'",
69-
"--include-links", "'true'",
70-
"--ocr", "'true'",
68+
"--include-images=true",
69+
"--include-links=true",
70+
"--ocr=true",
7171
"--pdf", "{end: 1, start: 1}",
72-
"--shorten-base64-images", "'true'",
72+
"--shorten-base64-images=true",
7373
"--tag", "production",
7474
"--tag", "team-alpha",
75-
"--use-main-content-only", "'true'",
75+
"--use-main-content-only=true",
7676
"--zdr", "enabled",
7777
)
7878
})

‎pkg/cmd/web.go‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{
265265
Usage: "Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view).",
266266
QueryPath: "fullScreenshot",
267267
},
268-
&requestflag.Flag[any]{
268+
&requestflag.Flag[bool]{
269269
Name: "handle-cookie-popup",
270270
Usage: "Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step.",
271271
Default: false,
@@ -630,7 +630,7 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{
630630
Usage: "Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache.",
631631
QueryPath: "headers",
632632
},
633-
&requestflag.Flag[any]{
633+
&requestflag.Flag[bool]{
634634
Name: "include-frames",
635635
Usage: "When true, iframes are rendered inline into the returned HTML.",
636636
Default: false,
@@ -653,7 +653,7 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{
653653
Default: map[string]any{"shouldParse": true, "ocr": false},
654654
QueryPath: "pdf",
655655
},
656-
&requestflag.Flag[any]{
656+
&requestflag.Flag[bool]{
657657
Name: "settle-animations",
658658
Usage: "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.",
659659
Default: false,
@@ -669,7 +669,7 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{
669669
Usage: "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).",
670670
QueryPath: "timeoutMS",
671671
},
672-
&requestflag.Flag[any]{
672+
&requestflag.Flag[bool]{
673673
Name: "use-main-content-only",
674674
Usage: "When true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable.",
675675
Default: false,
@@ -696,12 +696,12 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{
696696
Usage: "Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided.",
697697
InnerField: "end",
698698
},
699-
&requestflag.InnerFlag[any]{
699+
&requestflag.InnerFlag[bool]{
700700
Name: "pdf.ocr",
701701
Usage: "When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs.",
702702
InnerField: "ocr",
703703
},
704-
&requestflag.InnerFlag[any]{
704+
&requestflag.InnerFlag[bool]{
705705
Name: "pdf.should-parse",
706706
Usage: "When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned.",
707707
InnerField: "shouldParse",
@@ -730,7 +730,7 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{
730730
Usage: "Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions.",
731731
QueryPath: "actions",
732732
},
733-
&requestflag.Flag[any]{
733+
&requestflag.Flag[bool]{
734734
Name: "dedupe",
735735
Usage: "When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false.",
736736
Default: false,
@@ -772,12 +772,12 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{
772772
HideHelpCommand: true,
773773
}, map[string][]requestflag.HasOuterFlag{
774774
"enrichment": {
775-
&requestflag.InnerFlag[any]{
775+
&requestflag.InnerFlag[bool]{
776776
Name: "enrichment.classification",
777777
Usage: "Classify each image by visual asset type.",
778778
InnerField: "classification",
779779
},
780-
&requestflag.InnerFlag[any]{
780+
&requestflag.InnerFlag[bool]{
781781
Name: "enrichment.hosted-url",
782782
Usage: "Host materializable images on the Brand.dev CDN and return their URL and MIME type.",
783783
InnerField: "hostedUrl",
@@ -787,7 +787,7 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{
787787
Usage: "Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000.",
788788
InnerField: "maxTimePerMs",
789789
},
790-
&requestflag.InnerFlag[any]{
790+
&requestflag.InnerFlag[bool]{
791791
Name: "enrichment.resolution",
792792
Usage: "Measure image width and height when possible.",
793793
InnerField: "resolution",
@@ -826,25 +826,25 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{
826826
Usage: "Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache.",
827827
QueryPath: "headers",
828828
},
829-
&requestflag.Flag[any]{
829+
&requestflag.Flag[bool]{
830830
Name: "include-frames",
831831
Usage: "When true, the contents of iframes are rendered to Markdown.",
832832
Default: false,
833833
QueryPath: "includeFrames",
834834
},
835-
&requestflag.Flag[any]{
835+
&requestflag.Flag[bool]{
836836
Name: "include-html",
837837
Usage: "When true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request.",
838838
Default: false,
839839
QueryPath: "includeHTML",
840840
},
841-
&requestflag.Flag[any]{
841+
&requestflag.Flag[bool]{
842842
Name: "include-images",
843843
Usage: "Include image references in Markdown output",
844844
Default: false,
845845
QueryPath: "includeImages",
846846
},
847-
&requestflag.Flag[any]{
847+
&requestflag.Flag[bool]{
848848
Name: "include-links",
849849
Usage: "Preserve hyperlinks in Markdown output",
850850
Default: true,
@@ -867,13 +867,13 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{
867867
Default: map[string]any{"shouldParse": true, "ocr": false},
868868
QueryPath: "pdf",
869869
},
870-
&requestflag.Flag[any]{
870+
&requestflag.Flag[bool]{
871871
Name: "settle-animations",
872872
Usage: "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.",
873873
Default: false,
874874
QueryPath: "settleAnimations",
875875
},
876-
&requestflag.Flag[any]{
876+
&requestflag.Flag[bool]{
877877
Name: "shorten-base64-images",
878878
Usage: "Shorten base64-encoded image data in the Markdown output",
879879
Default: true,
@@ -889,7 +889,7 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{
889889
Usage: "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).",
890890
QueryPath: "timeoutMS",
891891
},
892-
&requestflag.Flag[any]{
892+
&requestflag.Flag[bool]{
893893
Name: "use-main-content-only",
894894
Usage: "Extract only the main content of the page, excluding headers, footers, sidebars, and navigation",
895895
Default: false,
@@ -916,12 +916,12 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{
916916
Usage: "Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided.",
917917
InnerField: "end",
918918
},
919-
&requestflag.InnerFlag[any]{
919+
&requestflag.InnerFlag[bool]{
920920
Name: "pdf.ocr",
921921
Usage: "When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs.",
922922
InnerField: "ocr",
923923
},
924-
&requestflag.InnerFlag[any]{
924+
&requestflag.InnerFlag[bool]{
925925
Name: "pdf.should-parse",
926926
Usage: "When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned.",
927927
InnerField: "shouldParse",

0 commit comments

Comments
 (0)