Skip to content

Commit 5f2e61b

Browse files
feat(api): api update
1 parent e21218b commit 5f2e61b

5 files changed

Lines changed: 52 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: 30
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8cd70a2b5bd380b75e5f94dc376bd8c704ee0431bdfe8af1b017facc2b883097.yml
3-
openapi_spec_hash: bb1d32ae5c46be85ee8bb3b13f5b1150
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-42c531dcf60b5d35e3996c1a669a3fe2de19d8caedf2bfd69e4864a1041c9bfa.yml
3+
openapi_spec_hash: e43dd84c75e6d710c7346b9f12c34738
44
config_hash: daabb160675d86b354711da1e77e5129

pkg/cmd/parse.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{
7878
Default: false,
7979
QueryPath: "useMainContentOnly",
8080
},
81+
&requestflag.Flag[string]{
82+
Name: "zdr",
83+
Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.",
84+
Default: "disabled",
85+
QueryPath: "zdr",
86+
},
8187
},
8288
Action: handleParseHandle,
8389
HideHelpCommand: true,

pkg/cmd/parse_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func TestParseHandle(t *testing.T) {
2727
"--tag", "production",
2828
"--tag", "team-alpha",
2929
"--use-main-content-only", "'true'",
30+
"--zdr", "enabled",
3031
)
3132
})
3233

@@ -51,6 +52,7 @@ func TestParseHandle(t *testing.T) {
5152
"--tag", "production",
5253
"--tag", "team-alpha",
5354
"--use-main-content-only", "'true'",
55+
"--zdr", "enabled",
5456
)
5557
})
5658

@@ -71,6 +73,7 @@ func TestParseHandle(t *testing.T) {
7173
"--tag", "production",
7274
"--tag", "team-alpha",
7375
"--use-main-content-only", "'true'",
76+
"--zdr", "enabled",
7477
)
7578
})
7679
}

pkg/cmd/web.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,12 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{
309309
Default: requestflag.Ptr[int64](3000),
310310
QueryPath: "waitForMs",
311311
},
312+
&requestflag.Flag[string]{
313+
Name: "zdr",
314+
Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.",
315+
Default: "disabled",
316+
QueryPath: "zdr",
317+
},
312318
},
313319
Action: handleWebScreenshot,
314320
HideHelpCommand: true,
@@ -559,6 +565,12 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{
559565
Usage: "Optional browser wait time in milliseconds after initial page load for each crawled page. Min: 0. Max: 30000 (30 seconds). ",
560566
BodyPath: "waitForMs",
561567
},
568+
&requestflag.Flag[string]{
569+
Name: "zdr",
570+
Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.",
571+
Default: "disabled",
572+
BodyPath: "zdr",
573+
},
562574
},
563575
Action: handleWebWebCrawlMd,
564576
HideHelpCommand: true,
@@ -663,6 +675,12 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{
663675
Usage: "Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds).",
664676
QueryPath: "waitForMs",
665677
},
678+
&requestflag.Flag[string]{
679+
Name: "zdr",
680+
Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.",
681+
Default: "disabled",
682+
QueryPath: "zdr",
683+
},
666684
},
667685
Action: handleWebWebScrapeHTML,
668686
HideHelpCommand: true,
@@ -861,6 +879,12 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{
861879
Usage: "Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds).",
862880
QueryPath: "waitForMs",
863881
},
882+
&requestflag.Flag[string]{
883+
Name: "zdr",
884+
Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.",
885+
Default: "disabled",
886+
QueryPath: "zdr",
887+
},
864888
},
865889
Action: handleWebWebScrapeMd,
866890
HideHelpCommand: true,
@@ -931,6 +955,12 @@ var webWebScrapeSitemap = cli.Command{
931955
Usage: "Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks.",
932956
QueryPath: "urlRegex",
933957
},
958+
&requestflag.Flag[string]{
959+
Name: "zdr",
960+
Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.",
961+
Default: "disabled",
962+
QueryPath: "zdr",
963+
},
934964
},
935965
Action: handleWebWebScrapeSitemap,
936966
HideHelpCommand: true,

pkg/cmd/web_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func TestWebScreenshot(t *testing.T) {
172172
"--timeout-ms", "1",
173173
"--viewport", "{height: 240, width: 240}",
174174
"--wait-for-ms", "0",
175+
"--zdr", "enabled",
175176
)
176177
})
177178

@@ -199,6 +200,7 @@ func TestWebScreenshot(t *testing.T) {
199200
"--viewport.height", "240",
200201
"--viewport.width", "240",
201202
"--wait-for-ms", "0",
203+
"--zdr", "enabled",
202204
)
203205
})
204206
}
@@ -322,6 +324,7 @@ func TestWebWebCrawlMd(t *testing.T) {
322324
"--url-regex", "^https?://[^/]+/blog/",
323325
"--use-main-content-only=true",
324326
"--wait-for-ms", "0",
327+
"--zdr", "enabled",
325328
)
326329
})
327330

@@ -358,6 +361,7 @@ func TestWebWebCrawlMd(t *testing.T) {
358361
"--url-regex", "^https?://[^/]+/blog/",
359362
"--use-main-content-only=true",
360363
"--wait-for-ms", "0",
364+
"--zdr", "enabled",
361365
)
362366
})
363367

@@ -391,7 +395,8 @@ func TestWebWebCrawlMd(t *testing.T) {
391395
"timeoutMS: 1000\n" +
392396
"urlRegex: ^https?://[^/]+/blog/\n" +
393397
"useMainContentOnly: true\n" +
394-
"waitForMs: 0\n")
398+
"waitForMs: 0\n" +
399+
"zdr: enabled\n")
395400
mocktest.TestRunMockTestWithPipeAndFlags(
396401
t, pipeData,
397402
"--api-key", "string",
@@ -421,6 +426,7 @@ func TestWebWebScrapeHTML(t *testing.T) {
421426
"--timeout-ms", "1",
422427
"--use-main-content-only", "'true'",
423428
"--wait-for-ms", "0",
429+
"--zdr", "enabled",
424430
)
425431
})
426432

@@ -450,6 +456,7 @@ func TestWebWebScrapeHTML(t *testing.T) {
450456
"--timeout-ms", "1",
451457
"--use-main-content-only", "'true'",
452458
"--wait-for-ms", "0",
459+
"--zdr", "enabled",
453460
)
454461
})
455462
}
@@ -522,6 +529,7 @@ func TestWebWebScrapeMd(t *testing.T) {
522529
"--timeout-ms", "1",
523530
"--use-main-content-only", "'true'",
524531
"--wait-for-ms", "0",
532+
"--zdr", "enabled",
525533
)
526534
})
527535

@@ -554,6 +562,7 @@ func TestWebWebScrapeMd(t *testing.T) {
554562
"--timeout-ms", "1",
555563
"--use-main-content-only", "'true'",
556564
"--wait-for-ms", "0",
565+
"--zdr", "enabled",
557566
)
558567
})
559568
}
@@ -573,6 +582,7 @@ func TestWebWebScrapeSitemap(t *testing.T) {
573582
"--tag", "team-alpha",
574583
"--timeout-ms", "1",
575584
"--url-regex", "^https?://[^/]+/blog/",
585+
"--zdr", "enabled",
576586
)
577587
})
578588
}

0 commit comments

Comments
 (0)