From d58b30faedbb676b274b8d015be903e9413963d3 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 13 Jul 2026 01:22:15 +0000
Subject: [PATCH 01/13] feat(api): api update
---
.stats.yml | 4 ++--
ai.go | 12 ++++++++++++
ai_test.go | 2 ++
brand.go | 28 ++++++++++++++++++++++++++++
brand_test.go | 2 ++
industry.go | 8 ++++++++
industry_test.go | 2 ++
parse.go | 4 ++++
parse_test.go | 1 +
utility.go | 4 ++++
utility_test.go | 1 +
web.go | 44 ++++++++++++++++++++++++++++++++++++++++++++
web_test.go | 11 +++++++++++
13 files changed, 121 insertions(+), 2 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 7cfdbba..8e4b560 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 30
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-fb56935a194e69348fecd985f7cf8b249795b46af2fb32f6c5c8ef648cf10c15.yml
-openapi_spec_hash: 7260a560474283b7ad6ac5d426058ac9
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-98c2abed2e726f7e5006cd4ef2ce9a56e84470d1fead500f7f3d46ed47f5af8b.yml
+openapi_spec_hash: 921fc4db282f59e416e3c95d14d534f2
config_hash: daabb160675d86b354711da1e77e5129
diff --git a/ai.go b/ai.go
index b63260c..8b56cfd 100644
--- a/ai.go
+++ b/ai.go
@@ -288,6 +288,10 @@ type AIExtractProductParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
paramObj
}
@@ -334,6 +338,10 @@ type AIExtractProductsParamsBodyByDomain struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
paramObj
}
@@ -360,6 +368,10 @@ type AIExtractProductsParamsBodyByDirectURL struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
paramObj
}
diff --git a/ai_test.go b/ai_test.go
index 81b1d67..ae34082 100644
--- a/ai_test.go
+++ b/ai_test.go
@@ -29,6 +29,7 @@ func TestAIExtractProductWithOptionalParams(t *testing.T) {
_, err := client.AI.ExtractProduct(context.TODO(), contextdev.AIExtractProductParams{
URL: "https://example.com",
MaxAgeMs: contextdev.Int(0),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
})
if err != nil {
@@ -58,6 +59,7 @@ func TestAIExtractProductsWithOptionalParams(t *testing.T) {
Domain: "domain",
MaxAgeMs: contextdev.Int(0),
MaxProducts: contextdev.Int(1),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
},
})
diff --git a/brand.go b/brand.go
index f57c146..e87d830 100644
--- a/brand.go
+++ b/brand.go
@@ -949,6 +949,10 @@ type BrandGetParamsBodyByDomain struct {
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
// Discriminator for domain-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_domain".
@@ -1012,6 +1016,10 @@ type BrandGetParamsBodyByName struct {
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
// Discriminator for name-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_name".
@@ -1073,6 +1081,10 @@ type BrandGetParamsBodyByEmail struct {
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
// Discriminator for email-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_email".
@@ -1135,6 +1147,10 @@ type BrandGetParamsBodyByTicker struct {
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
// Discriminator for ticker-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_ticker".
@@ -1172,6 +1188,10 @@ type BrandGetParamsBodyByDirectURL struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
// Discriminator for direct-URL-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_direct_url".
@@ -1234,6 +1254,10 @@ type BrandGetParamsBodyByTransaction struct {
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
// Discriminator for transaction-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_transaction".
@@ -1267,6 +1291,10 @@ type BrandGetSimplifiedParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
paramObj
}
diff --git a/brand_test.go b/brand_test.go
index c371726..f6b2bb8 100644
--- a/brand_test.go
+++ b/brand_test.go
@@ -32,6 +32,7 @@ func TestBrandGetWithOptionalParams(t *testing.T) {
ForceLanguage: "afrikaans",
MaxAgeMs: contextdev.Int(0),
MaxSpeed: contextdev.Bool(true),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
},
})
@@ -60,6 +61,7 @@ func TestBrandGetSimplifiedWithOptionalParams(t *testing.T) {
_, err := client.Brand.GetSimplified(context.TODO(), contextdev.BrandGetSimplifiedParams{
Domain: "domain",
MaxAgeMs: contextdev.Int(86400000),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
})
if err != nil {
diff --git a/industry.go b/industry.go
index 2c4100c..dd012f0 100644
--- a/industry.go
+++ b/industry.go
@@ -248,6 +248,10 @@ type IndustryGetNaicsParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
paramObj
}
@@ -272,6 +276,10 @@ type IndustryGetSicParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
// Which SIC dataset to classify against. `original_sic` uses the 1987 Standard
// Industrial Classification system; `latest_sec` uses the current SIC list as
// published by the SEC. Defaults to `original_sic`.
diff --git a/industry_test.go b/industry_test.go
index 129da80..a8390a9 100644
--- a/industry_test.go
+++ b/industry_test.go
@@ -30,6 +30,7 @@ func TestIndustryGetNaicsWithOptionalParams(t *testing.T) {
Input: "input",
MaxResults: contextdev.Int(1),
MinResults: contextdev.Int(1),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
})
if err != nil {
@@ -58,6 +59,7 @@ func TestIndustryGetSicWithOptionalParams(t *testing.T) {
Input: "input",
MaxResults: contextdev.Int(1),
MinResults: contextdev.Int(1),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
Type: contextdev.IndustryGetSicParamsTypeOriginalSic,
})
diff --git a/parse.go b/parse.go
index 69c162d..beabdb7 100644
--- a/parse.go
+++ b/parse.go
@@ -186,6 +186,10 @@ type ParseHandleParams struct {
// PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true)
// to an inclusive 1-based page range.
Pdf ParseHandleParamsPdf `query:"pdf,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
paramObj
}
diff --git a/parse_test.go b/parse_test.go
index 4c04262..a08db6b 100644
--- a/parse_test.go
+++ b/parse_test.go
@@ -41,6 +41,7 @@ func TestParseHandleWithOptionalParams(t *testing.T) {
Start: contextdev.Int(1),
},
ShortenBase64Images: contextdev.Bool(true),
+ Tags: []string{"production", "team-alpha"},
UseMainContentOnly: contextdev.Bool(true),
},
)
diff --git a/utility.go b/utility.go
index 4a4dd64..03978c2 100644
--- a/utility.go
+++ b/utility.go
@@ -118,6 +118,10 @@ type UtilityPrefetchParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
paramObj
}
diff --git a/utility_test.go b/utility_test.go
index 0a2ce19..920f8cc 100644
--- a/utility_test.go
+++ b/utility_test.go
@@ -33,6 +33,7 @@ func TestUtilityPrefetchWithOptionalParams(t *testing.T) {
},
},
Type: contextdev.UtilityPrefetchParamsTypeBrand,
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
})
if err != nil {
diff --git a/web.go b/web.go
index 60d030a..bda863f 100644
--- a/web.go
+++ b/web.go
@@ -2398,6 +2398,10 @@ type WebExtractParams struct {
// crawled page.
WaitForMs param.Opt[int64] `json:"waitForMs,omitzero"`
Pdf WebExtractParamsPdf `json:"pdf,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
paramObj
}
@@ -2438,6 +2442,10 @@ type WebExtractCompetitorsParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
paramObj
}
@@ -2468,6 +2476,10 @@ type WebExtractFontsParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
paramObj
}
@@ -2503,6 +2515,10 @@ type WebExtractStyleguideParams struct {
//
// Any of "light", "dark".
ColorScheme WebExtractStyleguideParamsColorScheme `query:"colorScheme,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
paramObj
}
@@ -2598,6 +2614,10 @@ type WebScreenshotParams struct {
// Any of "login", "signup", "blog", "careers", "pricing", "terms", "privacy",
// "contact".
Page WebScreenshotParamsPage `query:"page,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
// Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
Viewport WebScreenshotParamsViewport `query:"viewport,omitzero" json:"-"`
paramObj
@@ -2934,6 +2954,10 @@ type WebSearchParams struct {
IncludeDomains []string `json:"includeDomains,omitzero"`
// Inline Markdown scraping for each result. Set `enabled: true` to activate.
MarkdownOptions WebSearchParamsMarkdownOptions `json:"markdownOptions,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
paramObj
}
@@ -3336,6 +3360,10 @@ type WebWebCrawlMdParams struct {
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf WebWebCrawlMdParamsPdf `json:"pdf,omitzero"`
+ // Optional 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.
+ Tags []string `json:"tags,omitzero"`
paramObj
}
@@ -3643,6 +3671,10 @@ type WebWebScrapeHTMLParams struct {
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf WebWebScrapeHTMLParamsPdf `query:"pdf,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
paramObj
}
@@ -3917,6 +3949,10 @@ type WebWebScrapeImagesParams struct {
// 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.
Headers map[string]string `query:"headers,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
paramObj
}
@@ -4018,6 +4054,10 @@ type WebWebScrapeMdParams struct {
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf WebWebScrapeMdParamsPdf `query:"pdf,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
paramObj
}
@@ -4284,6 +4324,10 @@ type WebWebScrapeSitemapParams struct {
// 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.
Headers map[string]string `query:"headers,omitzero" json:"-"`
+ // 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.
+ Tags []string `query:"tags,omitzero" json:"-"`
paramObj
}
diff --git a/web_test.go b/web_test.go
index 8981173..556fb5a 100644
--- a/web_test.go
+++ b/web_test.go
@@ -47,6 +47,7 @@ func TestWebExtractWithOptionalParams(t *testing.T) {
Start: contextdev.Int(1),
},
StopAfterMs: contextdev.Int(10000),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
WaitForMs: contextdev.Int(0),
})
@@ -75,6 +76,7 @@ func TestWebExtractCompetitorsWithOptionalParams(t *testing.T) {
_, err := client.Web.ExtractCompetitors(context.TODO(), contextdev.WebExtractCompetitorsParams{
Domain: "xxx",
NumCompetitors: contextdev.Int(1),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
})
if err != nil {
@@ -103,6 +105,7 @@ func TestWebExtractFontsWithOptionalParams(t *testing.T) {
DirectURL: contextdev.String("https://example.com"),
Domain: contextdev.String("domain"),
MaxAgeMs: contextdev.Int(86400000),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
})
if err != nil {
@@ -132,6 +135,7 @@ func TestWebExtractStyleguideWithOptionalParams(t *testing.T) {
DirectURL: contextdev.String("https://example.com"),
Domain: contextdev.String("domain"),
MaxAgeMs: contextdev.Int(86400000),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
})
if err != nil {
@@ -166,6 +170,7 @@ func TestWebScreenshotWithOptionalParams(t *testing.T) {
MaxAgeMs: contextdev.Int(0),
Page: contextdev.WebScreenshotParamsPageLogin,
ScrollOffset: contextdev.Int(0),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
Viewport: contextdev.WebScreenshotParamsViewport{
Height: contextdev.Int(240),
@@ -219,6 +224,7 @@ func TestWebSearchWithOptionalParams(t *testing.T) {
},
NumResults: contextdev.Int(10),
QueryFanout: contextdev.Bool(true),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
})
if err != nil {
@@ -264,6 +270,7 @@ func TestWebWebCrawlMdWithOptionalParams(t *testing.T) {
SettleAnimations: contextdev.Bool(true),
ShortenBase64Images: contextdev.Bool(true),
StopAfterMs: contextdev.Int(10000),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
URLRegex: contextdev.String("^https?://[^/]+/blog/"),
UseMainContentOnly: contextdev.Bool(true),
@@ -308,6 +315,7 @@ func TestWebWebScrapeHTMLWithOptionalParams(t *testing.T) {
Start: contextdev.Int(1),
},
SettleAnimations: contextdev.Bool(true),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
UseMainContentOnly: contextdev.Bool(true),
WaitForMs: contextdev.Int(0),
@@ -347,6 +355,7 @@ func TestWebWebScrapeImagesWithOptionalParams(t *testing.T) {
"foo": "J!",
},
MaxAgeMs: contextdev.Int(0),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
WaitForMs: contextdev.Int(0),
})
@@ -392,6 +401,7 @@ func TestWebWebScrapeMdWithOptionalParams(t *testing.T) {
},
SettleAnimations: contextdev.Bool(true),
ShortenBase64Images: contextdev.Bool(true),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
UseMainContentOnly: contextdev.Bool(true),
WaitForMs: contextdev.Int(0),
@@ -424,6 +434,7 @@ func TestWebWebScrapeSitemapWithOptionalParams(t *testing.T) {
"foo": "J!",
},
MaxLinks: contextdev.Int(1),
+ Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
URLRegex: contextdev.String("^https?://[^/]+/blog/"),
})
From 315e06525a23999f3f827eb370df436958ef79a5 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 14 Jul 2026 00:10:40 +0000
Subject: [PATCH 02/13] feat(api): api update
---
.stats.yml | 4 +-
api.md | 1 -
brand.go | 119 +++++++----
brand_test.go | 5 +-
industry_test.go | 4 +-
monitor.go | 280 ++++++++++++++----------
monitor_test.go | 12 +-
parse.go | 139 +++++++++---
parse_test.go | 25 ++-
utility_test.go | 2 +-
web.go | 541 +++++++++++++++++++++++++++++++++++++----------
web_test.go | 145 ++++++++-----
12 files changed, 912 insertions(+), 365 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 8e4b560..b9d1d30 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 30
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-98c2abed2e726f7e5006cd4ef2ce9a56e84470d1fead500f7f3d46ed47f5af8b.yml
-openapi_spec_hash: 921fc4db282f59e416e3c95d14d534f2
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d49b84cf1125618f171698ff1ee4ff9a8d04151619cb4a56d650103869834465.yml
+openapi_spec_hash: 49b7a6f59dcdff1e2bf88feb6474a562
config_hash: daabb160675d86b354711da1e77e5129
diff --git a/api.md b/api.md
index e3e1ca1..cae32ac 100644
--- a/api.md
+++ b/api.md
@@ -88,7 +88,6 @@ Methods:
Response Types:
-- contextdev.WebhookDelivery
- contextdev.MonitorNewResponse
- contextdev.MonitorGetResponse
- contextdev.MonitorUpdateResponse
diff --git a/brand.go b/brand.go
index e87d830..079d55f 100644
--- a/brand.go
+++ b/brand.go
@@ -109,8 +109,7 @@ type BrandGetResponseBrand struct {
Logos []BrandGetResponseBrandLogo `json:"logos"`
// Company phone number
Phone string `json:"phone"`
- // The primary language of the brand's website content. Detected from the HTML lang
- // tag, page content analysis, or social media descriptions.
+ // Language to force for the retrieved brand data.
//
// Any of "afrikaans", "albanian", "amharic", "arabic", "armenian", "assamese",
// "aymara", "azeri", "basque", "belarusian", "bengali", "bosnian", "bulgarian",
@@ -344,37 +343,37 @@ type BrandGetResponseBrandIndustriesEic struct {
// & Infrastructure", "Subscription & Membership Commerce", "Social Commerce &
// Influencer Platforms", "Fashion & Apparel Retail", "Food, Beverage & Grocery
// E-commerce", "Streaming Platforms (Video, Music, Audio)", "Gaming & Interactive
- // Entertainment", "Creator Economy & Influencer Platforms", "Advertising, Adtech &
- // Media Buying", "Film, TV & Production Studios", "Events, Venues & Live
- // Entertainment", "Virtual Worlds & Metaverse Experiences", "K-12 Education
- // Platforms & Tools", "Higher Education & University Tech", "Online Learning &
- // MOOCs", "Test Prep & Certification", "Corporate Training & Upskilling",
- // "Tutoring & Supplemental Learning", "Education Management Systems (LMS/SIS)",
- // "Language Learning", "Creator-Led & Cohort-Based Courses", "Special Education &
- // Accessibility Tools", "Government Technology & Digital Services", "Civic
- // Engagement & Policy Platforms", "International Development & Humanitarian Aid",
- // "Philanthropy & Grantmaking", "Nonprofit Operations & Fundraising Tools",
- // "Public Health & Social Services", "Education & Youth Development Programs",
- // "Environmental & Climate Action Organizations", "Legal Aid & Social Justice
- // Advocacy", "Municipal & Infrastructure Services", "Manufacturing & Industrial
- // Automation", "Energy Production (Oil, Gas, Nuclear)", "Renewable Energy &
- // Cleantech", "Utilities & Grid Infrastructure", "Industrial IoT & Monitoring
- // Systems", "Construction & Heavy Equipment", "Mining & Natural Resources",
- // "Environmental Engineering & Sustainability", "Energy Storage & Battery
- // Technology", "Automotive OEMs & Vehicle Manufacturing", "Electric Vehicles (EVs)
- // & Charging Infrastructure", "Mobility-as-a-Service (MaaS)", "Fleet Management",
- // "Public Transit & Urban Mobility", "Autonomous Vehicles & ADAS", "Aftermarket
- // Parts & Services", "Telematics & Vehicle Connectivity", "Aviation & Aerospace
- // Transport", "Maritime Shipping", "Fitness & Wellness", "Beauty & Personal Care",
- // "Home & Living", "Dating & Relationships", "Hobbies, Crafts & DIY", "Outdoor &
- // Recreational Gear", "Events, Experiences & Ticketing Platforms", "Designer &
- // Luxury Apparel", "Accessories, Jewelry & Watches", "Footwear & Leather Goods",
- // "Beauty, Fragrance & Skincare", "Fashion Marketplaces & Retail Platforms",
- // "Sustainable & Ethical Fashion", "Resale, Vintage & Circular Fashion", "Fashion
- // Tech & Virtual Try-Ons", "Streetwear & Emerging Luxury", "Couture &
- // Made-to-Measure", "News Publishing & Journalism", "Digital Media & Content
- // Platforms", "Broadcasting (TV & Radio)", "Podcasting & Audio Media", "News
- // Aggregators & Curation Tools", "Independent & Creator-Led Media", "Newsletters &
+ // Entertainment", "Creator Economy & Influencer Platforms", "Film, TV & Production
+ // Studios", "Events, Venues & Live Entertainment", "Virtual Worlds & Metaverse
+ // Experiences", "K-12 Education Platforms & Tools", "Higher Education & University
+ // Tech", "Online Learning & MOOCs", "Test Prep & Certification", "Corporate
+ // Training & Upskilling", "Tutoring & Supplemental Learning", "Education
+ // Management Systems (LMS/SIS)", "Language Learning", "Creator-Led & Cohort-Based
+ // Courses", "Special Education & Accessibility Tools", "Government Technology &
+ // Digital Services", "Civic Engagement & Policy Platforms", "International
+ // Development & Humanitarian Aid", "Philanthropy & Grantmaking", "Nonprofit
+ // Operations & Fundraising Tools", "Public Health & Social Services", "Education &
+ // Youth Development Programs", "Environmental & Climate Action Organizations",
+ // "Legal Aid & Social Justice Advocacy", "Municipal & Infrastructure Services",
+ // "Manufacturing & Industrial Automation", "Energy Production (Oil, Gas,
+ // Nuclear)", "Renewable Energy & Cleantech", "Utilities & Grid Infrastructure",
+ // "Industrial IoT & Monitoring Systems", "Construction & Heavy Equipment", "Mining
+ // & Natural Resources", "Environmental Engineering & Sustainability", "Energy
+ // Storage & Battery Technology", "Automotive OEMs & Vehicle Manufacturing",
+ // "Electric Vehicles (EVs) & Charging Infrastructure", "Mobility-as-a-Service
+ // (MaaS)", "Fleet Management", "Public Transit & Urban Mobility", "Autonomous
+ // Vehicles & ADAS", "Aftermarket Parts & Services", "Telematics & Vehicle
+ // Connectivity", "Aviation & Aerospace Transport", "Maritime Shipping", "Fitness &
+ // Wellness", "Beauty & Personal Care", "Home & Living", "Dating & Relationships",
+ // "Hobbies, Crafts & DIY", "Outdoor & Recreational Gear", "Events, Experiences &
+ // Ticketing Platforms", "Designer & Luxury Apparel", "Accessories, Jewelry &
+ // Watches", "Footwear & Leather Goods", "Beauty, Fragrance & Skincare", "Fashion
+ // Marketplaces & Retail Platforms", "Sustainable & Ethical Fashion", "Resale,
+ // Vintage & Circular Fashion", "Fashion Tech & Virtual Try-Ons", "Streetwear &
+ // Emerging Luxury", "Couture & Made-to-Measure", "News Publishing & Journalism",
+ // "Advertising, Adtech & Media Buying", "Digital Media & Content Platforms",
+ // "Broadcasting (TV & Radio)", "Podcasting & Audio Media", "News Aggregators &
+ // Curation Tools", "Independent & Creator-Led Media", "Newsletters &
// Substack-Style Platforms", "Political & Investigative Media", "Trade & Niche
// Publications", "Media Monitoring & Analytics", "Professional Teams & Leagues",
// "Sports Media & Broadcasting", "Sports Betting & Fantasy Sports", "Fitness &
@@ -1226,11 +1225,6 @@ type BrandGetParamsBodyByTransaction struct {
// the API will skip time-consuming operations for faster response at the cost of
// less comprehensive data.
MaxSpeed param.Opt[bool] `json:"maxSpeed,omitzero"`
- // Optional Merchant Category Code (MCC) to help identify the business category or
- // industry.
- Mcc param.Opt[int64] `json:"mcc,omitzero"`
- // Optional phone number from the transaction to help verify brand match.
- Phone param.Opt[float64] `json:"phone,omitzero"`
// 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).
@@ -1254,6 +1248,11 @@ type BrandGetParamsBodyByTransaction struct {
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
+ // Optional Merchant Category Code (MCC) to help identify the business category or
+ // industry.
+ Mcc BrandGetParamsBodyByTransactionMccUnion `json:"mcc,omitzero"`
+ // Optional phone number from the transaction to help verify brand match.
+ Phone BrandGetParamsBodyByTransactionPhoneUnion `json:"phone,omitzero"`
// Optional 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.
@@ -1279,6 +1278,38 @@ func init() {
)
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BrandGetParamsBodyByTransactionMccUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BrandGetParamsBodyByTransactionMccUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfFloat)
+}
+func (u *BrandGetParamsBodyByTransactionMccUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BrandGetParamsBodyByTransactionPhoneUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BrandGetParamsBodyByTransactionPhoneUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfFloat)
+}
+func (u *BrandGetParamsBodyByTransactionPhoneUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
type BrandGetSimplifiedParams struct {
// Domain name to retrieve simplified brand data for
Domain string `query:"domain" api:"required" json:"-"`
@@ -1295,6 +1326,10 @@ type BrandGetSimplifiedParams struct {
// 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.
Tags []string `query:"tags,omitzero" json:"-"`
+ // Optional theme preference used when selecting brand assets.
+ //
+ // Any of "light", "dark".
+ Theme BrandGetSimplifiedParamsTheme `query:"theme,omitzero" json:"-"`
paramObj
}
@@ -1306,3 +1341,11 @@ func (r BrandGetSimplifiedParams) URLQuery() (v url.Values, err error) {
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
+
+// Optional theme preference used when selecting brand assets.
+type BrandGetSimplifiedParamsTheme string
+
+const (
+ BrandGetSimplifiedParamsThemeLight BrandGetSimplifiedParamsTheme = "light"
+ BrandGetSimplifiedParamsThemeDark BrandGetSimplifiedParamsTheme = "dark"
+)
diff --git a/brand_test.go b/brand_test.go
index f6b2bb8..591643e 100644
--- a/brand_test.go
+++ b/brand_test.go
@@ -59,9 +59,10 @@ func TestBrandGetSimplifiedWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Brand.GetSimplified(context.TODO(), contextdev.BrandGetSimplifiedParams{
- Domain: "domain",
- MaxAgeMs: contextdev.Int(86400000),
+ Domain: "xxx",
+ MaxAgeMs: contextdev.Int(0),
Tags: []string{"production", "team-alpha"},
+ Theme: contextdev.BrandGetSimplifiedParamsThemeLight,
TimeoutMs: contextdev.Int(1000),
})
if err != nil {
diff --git a/industry_test.go b/industry_test.go
index a8390a9..6d326bc 100644
--- a/industry_test.go
+++ b/industry_test.go
@@ -27,7 +27,7 @@ func TestIndustryGetNaicsWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Industry.GetNaics(context.TODO(), contextdev.IndustryGetNaicsParams{
- Input: "input",
+ Input: "xxxx",
MaxResults: contextdev.Int(1),
MinResults: contextdev.Int(1),
Tags: []string{"production", "team-alpha"},
@@ -56,7 +56,7 @@ func TestIndustryGetSicWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Industry.GetSic(context.TODO(), contextdev.IndustryGetSicParams{
- Input: "input",
+ Input: "xxxx",
MaxResults: contextdev.Int(1),
MinResults: contextdev.Int(1),
Tags: []string{"production", "team-alpha"},
diff --git a/monitor.go b/monitor.go
index 2a06cee..5ec8250 100644
--- a/monitor.go
+++ b/monitor.go
@@ -168,83 +168,6 @@ func (r *MonitorService) Run(ctx context.Context, monitorID string, opts ...opti
return res, err
}
-type WebhookDelivery struct {
- AttemptedAt time.Time `json:"attempted_at" api:"required" format:"date-time"`
- Error WebhookDeliveryError `json:"error" api:"required"`
- // The event this delivery carried. Deliveries recorded before event selection
- // existed report change.detected.
- //
- // Any of "change.detected", "run.completed".
- Event WebhookDeliveryEvent `json:"event" api:"required"`
- // Identifier sent in the X-Context-Id header.
- EventID string `json:"event_id" api:"required"`
- // The endpoint's final HTTP response status, or null when no response was
- // received.
- HTTPStatus int64 `json:"http_status" api:"required"`
- // Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
- // response; failed means no HTTP response was received; skipped_unsafe_url means
- // the URL failed the public-endpoint safety check.
- //
- // Any of "delivered", "rejected", "failed", "skipped_unsafe_url".
- Status WebhookDeliveryStatus `json:"status" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- AttemptedAt respjson.Field
- Error respjson.Field
- Event respjson.Field
- EventID respjson.Field
- HTTPStatus respjson.Field
- Status respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r WebhookDelivery) RawJSON() string { return r.JSON.raw }
-func (r *WebhookDelivery) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type WebhookDeliveryError struct {
- Code string `json:"code" api:"required"`
- Message string `json:"message" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Code respjson.Field
- Message respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r WebhookDeliveryError) RawJSON() string { return r.JSON.raw }
-func (r *WebhookDeliveryError) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// The event this delivery carried. Deliveries recorded before event selection
-// existed report change.detected.
-type WebhookDeliveryEvent string
-
-const (
- WebhookDeliveryEventChangeDetected WebhookDeliveryEvent = "change.detected"
- WebhookDeliveryEventRunCompleted WebhookDeliveryEvent = "run.completed"
-)
-
-// Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
-// response; failed means no HTTP response was received; skipped_unsafe_url means
-// the URL failed the public-endpoint safety check.
-type WebhookDeliveryStatus string
-
-const (
- WebhookDeliveryStatusDelivered WebhookDeliveryStatus = "delivered"
- WebhookDeliveryStatusRejected WebhookDeliveryStatus = "rejected"
- WebhookDeliveryStatusFailed WebhookDeliveryStatus = "failed"
- WebhookDeliveryStatusSkippedUnsafeURL WebhookDeliveryStatus = "skipped_unsafe_url"
-)
-
// A web monitor. `mode` is the constant `web`; behavior is described by `target`
// (page/sitemap/extract) and `change_detection` (exact/semantic).
type MonitorNewResponse struct {
@@ -2944,13 +2867,13 @@ type MonitorListAccountRunsResponseData struct {
// All webhook deliveries attempted by this run — one per subscribed event that
// fired. Omitted when no webhook was attempted, including runs created before
// event selection was added.
- WebhookDeliveries []WebhookDelivery `json:"webhook_deliveries"`
+ WebhookDeliveries []MonitorListAccountRunsResponseDataWebhookDelivery `json:"webhook_deliveries"`
// Deprecated: use `webhook_deliveries`, which records every attempt now that a run
// can deliver multiple events. Omitted when no webhook was attempted, including
// historical runs created before delivery tracking was added.
//
// Deprecated: deprecated
- WebhookDelivery WebhookDelivery `json:"webhook_delivery"`
+ WebhookDelivery MonitorListAccountRunsResponseDataWebhookDelivery `json:"webhook_delivery"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
@@ -2998,6 +2921,62 @@ func (r *MonitorListAccountRunsResponseDataError) UnmarshalJSON(data []byte) err
return apijson.UnmarshalRoot(data, r)
}
+type MonitorListAccountRunsResponseDataWebhookDelivery struct {
+ AttemptedAt time.Time `json:"attempted_at" api:"required" format:"date-time"`
+ Error MonitorListAccountRunsResponseDataWebhookDeliveryError `json:"error" api:"required"`
+ // The event this delivery carried. Deliveries recorded before event selection
+ // existed report change.detected.
+ //
+ // Any of "change.detected", "run.completed".
+ Event string `json:"event" api:"required"`
+ // Identifier sent in the X-Context-Id header.
+ EventID string `json:"event_id" api:"required"`
+ // The endpoint's final HTTP response status, or null when no response was
+ // received.
+ HTTPStatus int64 `json:"http_status" api:"required"`
+ // Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
+ // response; failed means no HTTP response was received; skipped_unsafe_url means
+ // the URL failed the public-endpoint safety check.
+ //
+ // Any of "delivered", "rejected", "failed", "skipped_unsafe_url".
+ Status string `json:"status" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AttemptedAt respjson.Field
+ Error respjson.Field
+ Event respjson.Field
+ EventID respjson.Field
+ HTTPStatus respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r MonitorListAccountRunsResponseDataWebhookDelivery) RawJSON() string { return r.JSON.raw }
+func (r *MonitorListAccountRunsResponseDataWebhookDelivery) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type MonitorListAccountRunsResponseDataWebhookDeliveryError struct {
+ Code string `json:"code" api:"required"`
+ Message string `json:"message" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r MonitorListAccountRunsResponseDataWebhookDeliveryError) RawJSON() string { return r.JSON.raw }
+func (r *MonitorListAccountRunsResponseDataWebhookDeliveryError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type MonitorListChangesResponse struct {
Data []MonitorListChangesResponseData `json:"data" api:"required"`
HasMore bool `json:"has_more" api:"required"`
@@ -3128,13 +3107,13 @@ type MonitorListRunsResponseData struct {
// All webhook deliveries attempted by this run — one per subscribed event that
// fired. Omitted when no webhook was attempted, including runs created before
// event selection was added.
- WebhookDeliveries []WebhookDelivery `json:"webhook_deliveries"`
+ WebhookDeliveries []MonitorListRunsResponseDataWebhookDelivery `json:"webhook_deliveries"`
// Deprecated: use `webhook_deliveries`, which records every attempt now that a run
// can deliver multiple events. Omitted when no webhook was attempted, including
// historical runs created before delivery tracking was added.
//
// Deprecated: deprecated
- WebhookDelivery WebhookDelivery `json:"webhook_delivery"`
+ WebhookDelivery MonitorListRunsResponseDataWebhookDelivery `json:"webhook_delivery"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
@@ -3182,6 +3161,62 @@ func (r *MonitorListRunsResponseDataError) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+type MonitorListRunsResponseDataWebhookDelivery struct {
+ AttemptedAt time.Time `json:"attempted_at" api:"required" format:"date-time"`
+ Error MonitorListRunsResponseDataWebhookDeliveryError `json:"error" api:"required"`
+ // The event this delivery carried. Deliveries recorded before event selection
+ // existed report change.detected.
+ //
+ // Any of "change.detected", "run.completed".
+ Event string `json:"event" api:"required"`
+ // Identifier sent in the X-Context-Id header.
+ EventID string `json:"event_id" api:"required"`
+ // The endpoint's final HTTP response status, or null when no response was
+ // received.
+ HTTPStatus int64 `json:"http_status" api:"required"`
+ // Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
+ // response; failed means no HTTP response was received; skipped_unsafe_url means
+ // the URL failed the public-endpoint safety check.
+ //
+ // Any of "delivered", "rejected", "failed", "skipped_unsafe_url".
+ Status string `json:"status" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AttemptedAt respjson.Field
+ Error respjson.Field
+ Event respjson.Field
+ EventID respjson.Field
+ HTTPStatus respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r MonitorListRunsResponseDataWebhookDelivery) RawJSON() string { return r.JSON.raw }
+func (r *MonitorListRunsResponseDataWebhookDelivery) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type MonitorListRunsResponseDataWebhookDeliveryError struct {
+ Code string `json:"code" api:"required"`
+ Message string `json:"message" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r MonitorListRunsResponseDataWebhookDeliveryError) RawJSON() string { return r.JSON.raw }
+func (r *MonitorListRunsResponseDataWebhookDeliveryError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A detected change. `mode` is the constant `web`; `target_type` and
// `change_detection_type` describe the change, and which optional fields are
// present depends on them (page: `diff` + excerpts; sitemap:
@@ -3888,34 +3923,36 @@ func (r *MonitorUpdateParamsWebhook) UnmarshalJSON(data []byte) error {
}
type MonitorListParams struct {
+ // Opaque pagination cursor from a previous response.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
+ // Maximum number of items to return per page (1-100). Defaults to 25.
+ Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Free-text search term, matched against the fields named in `search_by`.
Q param.Opt[string] `query:"q,omitzero" json:"-"`
// Filter to items that have this tag.
Tag param.Opt[string] `query:"tag,omitzero" json:"-"`
- // Any of "exact", "semantic".
- ChangeDetectionType MonitorListParamsChangeDetectionType `query:"change_detection_type,omitzero" json:"-"`
// Comma-separated fields to search with `q`. Defaults to all of them. Note
// `instructions` only exists on extract monitors.
//
// Any of "name", "url", "instructions", "tags".
SearchBy []string `query:"search_by,omitzero" json:"-"`
+ // Comma-separated list of tags to filter by (matches monitors having any of them).
+ Tags []string `query:"tags,omitzero" json:"-"`
+ // Filter by change detection type.
+ //
+ // Any of "exact", "semantic".
+ ChangeDetectionType MonitorListParamsChangeDetectionType `query:"change_detection_type,omitzero" json:"-"`
// `prefix` for as-you-type prefix matching (default), `exact` for full-token
// matching.
//
// Any of "exact", "prefix".
SearchType MonitorListParamsSearchType `query:"search_type,omitzero" json:"-"`
- // Monitor lifecycle status. `failed` means the most recent run failed (see the
- // monitor's `last_error`); failed monitors keep running on schedule and flip back
- // to `active` on the next successful run. Monitors are auto-`paused` after
- // repeated consecutive failures or insufficient-credit skips; resume by PATCHing
- // status to `active`.
+ // Filter monitors by lifecycle status.
//
// Any of "active", "paused", "failed".
Status MonitorListParamsStatus `query:"status,omitzero" json:"-"`
- // Comma-separated list of tags to filter by (matches monitors having any of them).
- Tags []string `query:"tags,omitzero" json:"-"`
+ // Filter by target type.
+ //
// Any of "page", "sitemap", "extract".
TargetType MonitorListParamsTargetType `query:"target_type,omitzero" json:"-"`
paramObj
@@ -3929,6 +3966,7 @@ func (r MonitorListParams) URLQuery() (v url.Values, err error) {
})
}
+// Filter by change detection type.
type MonitorListParamsChangeDetectionType string
const (
@@ -3945,11 +3983,7 @@ const (
MonitorListParamsSearchTypePrefix MonitorListParamsSearchType = "prefix"
)
-// Monitor lifecycle status. `failed` means the most recent run failed (see the
-// monitor's `last_error`); failed monitors keep running on schedule and flip back
-// to `active` on the next successful run. Monitors are auto-`paused` after
-// repeated consecutive failures or insufficient-credit skips; resume by PATCHing
-// status to `active`.
+// Filter monitors by lifecycle status.
type MonitorListParamsStatus string
const (
@@ -3958,6 +3992,7 @@ const (
MonitorListParamsStatusFailed MonitorListParamsStatus = "failed"
)
+// Filter by target type.
type MonitorListParamsTargetType string
const (
@@ -3967,15 +4002,24 @@ const (
)
type MonitorListAccountChangesParams struct {
- Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
- MonitorID param.Opt[string] `query:"monitor_id,omitzero" json:"-"`
- Since param.Opt[time.Time] `query:"since,omitzero" format:"date-time" json:"-"`
+ // Opaque pagination cursor from a previous response.
+ Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
+ // Maximum number of items to return per page (1-100). Defaults to 25.
+ Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
+ // Filter changes to a single monitor.
+ MonitorID param.Opt[string] `query:"monitor_id,omitzero" json:"-"`
+ // Only include items at or after this ISO 8601 timestamp.
+ Since param.Opt[time.Time] `query:"since,omitzero" format:"date-time" json:"-"`
// Filter to items that have this tag.
- Tag param.Opt[string] `query:"tag,omitzero" json:"-"`
+ Tag param.Opt[string] `query:"tag,omitzero" json:"-"`
+ // Only include items before this ISO 8601 timestamp.
Until param.Opt[time.Time] `query:"until,omitzero" format:"date-time" json:"-"`
+ // Filter by change detection type.
+ //
// Any of "exact", "semantic".
ChangeDetectionType MonitorListAccountChangesParamsChangeDetectionType `query:"change_detection_type,omitzero" json:"-"`
+ // Filter by target type.
+ //
// Any of "page", "sitemap", "extract".
TargetType MonitorListAccountChangesParamsTargetType `query:"target_type,omitzero" json:"-"`
paramObj
@@ -3990,6 +4034,7 @@ func (r MonitorListAccountChangesParams) URLQuery() (v url.Values, err error) {
})
}
+// Filter by change detection type.
type MonitorListAccountChangesParamsChangeDetectionType string
const (
@@ -3997,6 +4042,7 @@ const (
MonitorListAccountChangesParamsChangeDetectionTypeSemantic MonitorListAccountChangesParamsChangeDetectionType = "semantic"
)
+// Filter by target type.
type MonitorListAccountChangesParamsTargetType string
const (
@@ -4006,10 +4052,11 @@ const (
)
type MonitorListAccountRunsParams struct {
+ // Opaque pagination cursor from a previous response.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
- // Lifecycle status of a run. `skipped` runs never executed — see `skip_reason`
- // (insufficient credits, monitor paused, or superseded by a concurrent run).
+ // Maximum number of items to return per page (1-100). Defaults to 25.
+ Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
+ // Filter runs by lifecycle status.
//
// Any of "queued", "running", "completed", "failed", "skipped".
Status MonitorListAccountRunsParamsStatus `query:"status,omitzero" json:"-"`
@@ -4025,8 +4072,7 @@ func (r MonitorListAccountRunsParams) URLQuery() (v url.Values, err error) {
})
}
-// Lifecycle status of a run. `skipped` runs never executed — see `skip_reason`
-// (insufficient credits, monitor paused, or superseded by a concurrent run).
+// Filter runs by lifecycle status.
type MonitorListAccountRunsParamsStatus string
const (
@@ -4038,11 +4084,15 @@ const (
)
type MonitorListChangesParams struct {
- Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
- Since param.Opt[time.Time] `query:"since,omitzero" format:"date-time" json:"-"`
+ // Opaque pagination cursor from a previous response.
+ Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
+ // Maximum number of items to return per page (1-100). Defaults to 25.
+ Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
+ // Only include items at or after this ISO 8601 timestamp.
+ Since param.Opt[time.Time] `query:"since,omitzero" format:"date-time" json:"-"`
// Filter to items that have this tag.
- Tag param.Opt[string] `query:"tag,omitzero" json:"-"`
+ Tag param.Opt[string] `query:"tag,omitzero" json:"-"`
+ // Only include items before this ISO 8601 timestamp.
Until param.Opt[time.Time] `query:"until,omitzero" format:"date-time" json:"-"`
paramObj
}
@@ -4057,10 +4107,11 @@ func (r MonitorListChangesParams) URLQuery() (v url.Values, err error) {
}
type MonitorListRunsParams struct {
+ // Opaque pagination cursor from a previous response.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
- // Lifecycle status of a run. `skipped` runs never executed — see `skip_reason`
- // (insufficient credits, monitor paused, or superseded by a concurrent run).
+ // Maximum number of items to return per page (1-100). Defaults to 25.
+ Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
+ // Filter runs by lifecycle status.
//
// Any of "queued", "running", "completed", "failed", "skipped".
Status MonitorListRunsParamsStatus `query:"status,omitzero" json:"-"`
@@ -4075,8 +4126,7 @@ func (r MonitorListRunsParams) URLQuery() (v url.Values, err error) {
})
}
-// Lifecycle status of a run. `skipped` runs never executed — see `skip_reason`
-// (insufficient credits, monitor paused, or superseded by a concurrent run).
+// Filter runs by lifecycle status.
type MonitorListRunsParamsStatus string
const (
diff --git a/monitor_test.go b/monitor_test.go
index d6689a9..ce8f60d 100644
--- a/monitor_test.go
+++ b/monitor_test.go
@@ -148,12 +148,12 @@ func TestMonitorListWithOptionalParams(t *testing.T) {
ChangeDetectionType: contextdev.MonitorListParamsChangeDetectionTypeExact,
Cursor: contextdev.String("cursor"),
Limit: contextdev.Int(1),
- Q: contextdev.String("q"),
+ Q: contextdev.String("pricing"),
SearchBy: []string{"name"},
SearchType: contextdev.MonitorListParamsSearchTypeExact,
Status: contextdev.MonitorListParamsStatusActive,
- Tag: contextdev.String("tag"),
- Tags: []string{"string"},
+ Tag: contextdev.String("pricing"),
+ Tags: []string{"x"},
TargetType: contextdev.MonitorListParamsTargetTypePage,
})
if err != nil {
@@ -205,9 +205,9 @@ func TestMonitorListAccountChangesWithOptionalParams(t *testing.T) {
ChangeDetectionType: contextdev.MonitorListAccountChangesParamsChangeDetectionTypeExact,
Cursor: contextdev.String("cursor"),
Limit: contextdev.Int(1),
- MonitorID: contextdev.String("monitor_id"),
+ MonitorID: contextdev.String("mon_123"),
Since: contextdev.Time(time.Now()),
- Tag: contextdev.String("tag"),
+ Tag: contextdev.String("pricing"),
TargetType: contextdev.MonitorListAccountChangesParamsTargetTypePage,
Until: contextdev.Time(time.Now()),
})
@@ -267,7 +267,7 @@ func TestMonitorListChangesWithOptionalParams(t *testing.T) {
Cursor: contextdev.String("cursor"),
Limit: contextdev.Int(1),
Since: contextdev.Time(time.Now()),
- Tag: contextdev.String("tag"),
+ Tag: contextdev.String("pricing"),
Until: contextdev.Time(time.Now()),
},
)
diff --git a/parse.go b/parse.go
index beabdb7..3af9979 100644
--- a/parse.go
+++ b/parse.go
@@ -40,9 +40,7 @@ func NewParseService(opts ...option.RequestOption) (r ParseService) {
}
// Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes
-// into LLM-usable Markdown. The base request costs 1 credit. When OCR runs
-// (requires ocr=true), the entire call costs 5 credits; ocr=true requests where no
-// OCR ends up running still cost 1 credit.
+// into LLM-usable Markdown.
func (r *ParseService) Handle(ctx context.Context, body io.Reader, params ParseHandleParams, opts ...option.RequestOption) (res *ParseHandleResponse, err error) {
opts = slices.Concat(r.options, opts)
opts = append([]option.RequestOption{option.WithRequestBody("application/octet-stream", body)}, opts...)
@@ -156,24 +154,10 @@ func (r *ParseHandleResponseKeyMetadata) UnmarshalJSON(data []byte) error {
}
type ParseHandleParams struct {
- // Include image references in Markdown output
- IncludeImages param.Opt[bool] `query:"includeImages,omitzero" json:"-"`
- // Preserve hyperlinks in Markdown output
- IncludeLinks param.Opt[bool] `query:"includeLinks,omitzero" json:"-"`
- // Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted
- // at each image's position in page reading order, preserving the text layer;
- // pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get
- // full-document OCR, and raster images get their visible text transcribed. When
- // false, no OCR runs: scanned PDFs may yield no content and images return only
- // format/dimension metadata. Calls where OCR actually runs cost 5 credits instead
- // of 1.
- Ocr param.Opt[bool] `query:"ocr,omitzero" json:"-"`
- // Shorten base64-encoded image data in the Markdown output
- ShortenBase64Images param.Opt[bool] `query:"shortenBase64Images,omitzero" json:"-"`
- // Extract only the main content from HTML-like inputs
- UseMainContentOnly param.Opt[bool] `query:"useMainContentOnly,omitzero" json:"-"`
- // Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g.
- // ".pdf").
+ // Optional client identifier used for usage attribution.
+ Client param.Opt[string] `query:"client,omitzero" json:"-"`
+ // Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv,
+ // md, py, rtf, jpg, png, or txt.
//
// Any of "txt", "text", "md", "markdown", "html", "htm", "xhtml", "xml", "rss",
// "atom", "csv", "tsv", "yaml", "yml", "py", "java", "js", "jsx", "mjs", "cjs",
@@ -183,13 +167,25 @@ type ParseHandleParams struct {
// "ppsx", "ppsm", "potx", "potm", "ppt", "pps", "pot", "jpg", "jpeg", "jpe",
// "png", "gif", "bmp", "tiff", "tif", "webp", "ppm", "pbm", "pgm", "pnm".
Extension ParseHandleParamsExtension `query:"extension,omitzero" json:"-"`
- // PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true)
- // to an inclusive 1-based page range.
+ // Include image references in Markdown output
+ IncludeImages ParseHandleParamsIncludeImagesUnion `query:"includeImages,omitzero" json:"-"`
+ // Preserve hyperlinks in Markdown output
+ IncludeLinks ParseHandleParamsIncludeLinksUnion `query:"includeLinks,omitzero" json:"-"`
+ // When true for PDF inputs, detect and OCR images embedded in the selected pages,
+ // inserting recognized text at each image's position in page reading order while
+ // preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range.
+ // When false, all OCR is disabled, including the automatic scanned-PDF fallback.
+ Ocr ParseHandleParamsOcrUnion `query:"ocr,omitzero" json:"-"`
+ // PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}.
Pdf ParseHandleParamsPdf `query:"pdf,omitzero" json:"-"`
+ // Shorten base64-encoded image data in the Markdown output
+ ShortenBase64Images ParseHandleParamsShortenBase64ImagesUnion `query:"shortenBase64Images,omitzero" json:"-"`
// 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.
Tags []string `query:"tags,omitzero" json:"-"`
+ // Extract only the main content from HTML-like inputs
+ UseMainContentOnly ParseHandleParamsUseMainContentOnlyUnion `query:"useMainContentOnly,omitzero" json:"-"`
paramObj
}
@@ -219,8 +215,8 @@ func (r ParseHandleParams) URLQuery() (v url.Values, err error) {
})
}
-// Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g.
-// ".pdf").
+// Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv,
+// md, py, rtf, jpg, png, or txt.
type ParseHandleParamsExtension string
const (
@@ -296,8 +292,61 @@ const (
ParseHandleParamsExtensionPnm ParseHandleParamsExtension = "pnm"
)
-// PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true)
-// to an inclusive 1-based page range.
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ParseHandleParamsIncludeImagesUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfParseHandlesIncludeImagesString)
+ OfParseHandlesIncludeImagesString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type ParseHandleParamsIncludeImagesString string
+
+const (
+ ParseHandleParamsIncludeImagesStringTrue ParseHandleParamsIncludeImagesString = "true"
+ ParseHandleParamsIncludeImagesStringFalse ParseHandleParamsIncludeImagesString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ParseHandleParamsIncludeLinksUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfParseHandlesIncludeLinksString)
+ OfParseHandlesIncludeLinksString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type ParseHandleParamsIncludeLinksString string
+
+const (
+ ParseHandleParamsIncludeLinksStringTrue ParseHandleParamsIncludeLinksString = "true"
+ ParseHandleParamsIncludeLinksStringFalse ParseHandleParamsIncludeLinksString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ParseHandleParamsOcrUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfParseHandlesOcrString)
+ OfParseHandlesOcrString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type ParseHandleParamsOcrString string
+
+const (
+ ParseHandleParamsOcrStringTrue ParseHandleParamsOcrString = "true"
+ ParseHandleParamsOcrStringFalse ParseHandleParamsOcrString = "false"
+)
+
+// PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}.
type ParseHandleParamsPdf struct {
// 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.
@@ -314,3 +363,39 @@ func (r ParseHandleParamsPdf) URLQuery() (v url.Values, err error) {
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ParseHandleParamsShortenBase64ImagesUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfParseHandlesShortenBase64ImagesString)
+ OfParseHandlesShortenBase64ImagesString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type ParseHandleParamsShortenBase64ImagesString string
+
+const (
+ ParseHandleParamsShortenBase64ImagesStringTrue ParseHandleParamsShortenBase64ImagesString = "true"
+ ParseHandleParamsShortenBase64ImagesStringFalse ParseHandleParamsShortenBase64ImagesString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ParseHandleParamsUseMainContentOnlyUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfParseHandlesUseMainContentOnlyString)
+ OfParseHandlesUseMainContentOnlyString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type ParseHandleParamsUseMainContentOnlyString string
+
+const (
+ ParseHandleParamsUseMainContentOnlyStringTrue ParseHandleParamsUseMainContentOnlyString = "true"
+ ParseHandleParamsUseMainContentOnlyStringFalse ParseHandleParamsUseMainContentOnlyString = "false"
+)
diff --git a/parse_test.go b/parse_test.go
index a08db6b..d8f7329 100644
--- a/parse_test.go
+++ b/parse_test.go
@@ -32,17 +32,28 @@ func TestParseHandleWithOptionalParams(t *testing.T) {
context.TODO(),
io.Reader(bytes.NewBuffer([]byte("Example data"))),
contextdev.ParseHandleParams{
- Extension: contextdev.ParseHandleParamsExtensionTxt,
- IncludeImages: contextdev.Bool(true),
- IncludeLinks: contextdev.Bool(true),
- Ocr: contextdev.Bool(true),
+ Client: contextdev.String("x"),
+ Extension: contextdev.ParseHandleParamsExtensionTxt,
+ IncludeImages: contextdev.ParseHandleParamsIncludeImagesUnion{
+ OfParseHandlesIncludeImagesString: contextdev.String("true"),
+ },
+ IncludeLinks: contextdev.ParseHandleParamsIncludeLinksUnion{
+ OfParseHandlesIncludeLinksString: contextdev.String("true"),
+ },
+ Ocr: contextdev.ParseHandleParamsOcrUnion{
+ OfParseHandlesOcrString: contextdev.String("true"),
+ },
Pdf: contextdev.ParseHandleParamsPdf{
End: contextdev.Int(1),
Start: contextdev.Int(1),
},
- ShortenBase64Images: contextdev.Bool(true),
- Tags: []string{"production", "team-alpha"},
- UseMainContentOnly: contextdev.Bool(true),
+ ShortenBase64Images: contextdev.ParseHandleParamsShortenBase64ImagesUnion{
+ OfParseHandlesShortenBase64ImagesString: contextdev.String("true"),
+ },
+ Tags: []string{"production", "team-alpha"},
+ UseMainContentOnly: contextdev.ParseHandleParamsUseMainContentOnlyUnion{
+ OfParseHandlesUseMainContentOnlyString: contextdev.String("true"),
+ },
},
)
if err != nil {
diff --git a/utility_test.go b/utility_test.go
index 920f8cc..1cc2df8 100644
--- a/utility_test.go
+++ b/utility_test.go
@@ -29,7 +29,7 @@ func TestUtilityPrefetchWithOptionalParams(t *testing.T) {
_, err := client.Utility.Prefetch(context.TODO(), contextdev.UtilityPrefetchParams{
Identifier: contextdev.UtilityPrefetchParamsIdentifierUnion{
OfByDomain: &contextdev.UtilityPrefetchParamsIdentifierByDomain{
- Domain: "domain",
+ Domain: "xxx",
},
},
Type: contextdev.UtilityPrefetchParamsTypeBrand,
diff --git a/web.go b/web.go
index bda863f..2269118 100644
--- a/web.go
+++ b/web.go
@@ -2459,6 +2459,11 @@ func (r WebExtractCompetitorsParams) URLQuery() (v url.Values, err error) {
}
type WebExtractFontsParams struct {
+ // Maximum age in milliseconds for cached brand data before the API performs a hard
+ // refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
+ // are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
+ // year.
+ MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
// A specific URL to fetch fonts from directly, bypassing domain resolution (e.g.,
// 'https://example.com/design-system'). When provided, fonts are extracted from
// this exact URL. You must provide either 'domain' or 'directUrl', but not both.
@@ -2467,11 +2472,6 @@ type WebExtractFontsParams struct {
// domain will be automatically normalized and validated. You must provide either
// 'domain' or 'directUrl', but not both.
Domain param.Opt[string] `query:"domain,omitzero" json:"-"`
- // Maximum age in milliseconds for cached data before the API performs a hard
- // refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
- // are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
- // year.
- MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
// 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).
@@ -2492,6 +2492,11 @@ func (r WebExtractFontsParams) URLQuery() (v url.Values, err error) {
}
type WebExtractStyleguideParams struct {
+ // Maximum age in milliseconds for cached brand data before the API performs a hard
+ // refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
+ // are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
+ // year.
+ MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
// A specific URL to fetch the styleguide from directly, bypassing domain
// resolution (e.g., 'https://example.com/design-system'). When provided, the
// styleguide is extracted from this exact URL. You must provide either 'domain' or
@@ -2501,11 +2506,6 @@ type WebExtractStyleguideParams struct {
// domain will be automatically normalized and validated. You must provide either
// 'domain' or 'directUrl', but not both.
Domain param.Opt[string] `query:"domain,omitzero" json:"-"`
- // Maximum age in milliseconds for cached data before the API performs a hard
- // refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
- // are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
- // year.
- MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
// 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).
@@ -2541,14 +2541,6 @@ const (
)
type WebScreenshotParams struct {
- // A specific URL to screenshot directly, bypassing domain resolution (e.g.,
- // 'https://example.com/pricing'). When provided, the screenshot is taken of this
- // exact URL. You must provide either 'domain' or 'directUrl', but not both.
- DirectURL param.Opt[string] `query:"directUrl,omitzero" format:"uri" json:"-"`
- // Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
- // domain will be automatically normalized and validated. You must provide either
- // 'domain' or 'directUrl', but not both.
- Domain param.Opt[string] `query:"domain,omitzero" json:"-"`
// Return a cached screenshot if a prior screenshot 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 capture fresh.
@@ -2560,21 +2552,30 @@ type WebScreenshotParams struct {
// top to bottom). The final slice may be shorter than the viewport height. Takes
// precedence over fullScreenshot. Max: 100000.
ScrollOffset param.Opt[int64] `query:"scrollOffset,omitzero" json:"-"`
- // 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).
- TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Optional browser wait time in milliseconds after initial page load before taking
// the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when
// omitted.
WaitForMs param.Opt[int64] `query:"waitForMs,omitzero" json:"-"`
+ // A specific URL to screenshot directly, bypassing domain resolution (e.g.,
+ // 'https://example.com/pricing'). When provided, the screenshot is taken of this
+ // exact URL. You must provide either 'domain' or 'directUrl', but not both.
+ DirectURL param.Opt[string] `query:"directUrl,omitzero" format:"uri" json:"-"`
+ // Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
+ // domain will be automatically normalized and validated. You must provide either
+ // 'domain' or 'directUrl', but not both.
+ Domain param.Opt[string] `query:"domain,omitzero" json:"-"`
+ // 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).
+ TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Optional parameter to choose the site's visual theme in the screenshot. Use
// 'light' or 'dark' when the site offers both appearances.
//
// Any of "light", "dark".
ColorScheme WebScreenshotParamsColorScheme `query:"colorScheme,omitzero" json:"-"`
- // Two-letter ISO 3166-1 alpha-2 country code for the website request location.
- // When provided, Context.dev fetches the target page from that country.
+ // Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
+ // residential proxy exit location. Must be one of Context.dev's supported
+ // countries. When provided, Context.dev fetches the target page from that country.
//
// Any of "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "ar", "at", "au", "aw",
// "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
@@ -2602,9 +2603,7 @@ type WebScreenshotParams struct {
// 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.
- //
- // Any of "true", "false".
- HandleCookiePopup WebScreenshotParamsHandleCookiePopup `query:"handleCookiePopup,omitzero" json:"-"`
+ HandleCookiePopup WebScreenshotParamsHandleCookiePopupUnion `query:"handleCookiePopup,omitzero" json:"-"`
// Optional parameter to specify which page type to screenshot. If provided, the
// system will scrape the domain's links and use heuristics to find the most
// appropriate URL for the specified page type (30 supported languages). If not
@@ -2640,8 +2639,9 @@ const (
WebScreenshotParamsColorSchemeDark WebScreenshotParamsColorScheme = "dark"
)
-// Two-letter ISO 3166-1 alpha-2 country code for the website request location.
-// When provided, Context.dev fetches the target page from that country.
+// Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
+// residential proxy exit location. Must be one of Context.dev's supported
+// countries. When provided, Context.dev fetches the target page from that country.
type WebScreenshotParamsCountry string
const (
@@ -2861,14 +2861,22 @@ const (
WebScreenshotParamsFullScreenshotFalse WebScreenshotParamsFullScreenshot = "false"
)
-// 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.
-type WebScreenshotParamsHandleCookiePopup string
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebScreenshotParamsHandleCookiePopupUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebScreenshotsHandleCookiePopupString)
+ OfWebScreenshotsHandleCookiePopupString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebScreenshotParamsHandleCookiePopupString string
const (
- WebScreenshotParamsHandleCookiePopupTrue WebScreenshotParamsHandleCookiePopup = "true"
- WebScreenshotParamsHandleCookiePopupFalse WebScreenshotParamsHandleCookiePopup = "false"
+ WebScreenshotParamsHandleCookiePopupStringTrue WebScreenshotParamsHandleCookiePopupString = "true"
+ WebScreenshotParamsHandleCookiePopupStringFalse WebScreenshotParamsHandleCookiePopupString = "false"
)
// Optional parameter to specify which page type to screenshot. If provided, the
@@ -3616,28 +3624,28 @@ func (r *WebWebCrawlMdParamsPdf) UnmarshalJSON(data []byte) error {
type WebWebScrapeHTMLParams struct {
// Full URL to scrape (must include http:// or https:// protocol)
URL string `query:"url" api:"required" format:"uri" json:"-"`
- // When true, iframes are rendered inline into the returned HTML.
- IncludeFrames param.Opt[bool] `query:"includeFrames,omitzero" json:"-"`
// 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.
MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
- // 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.
- SettleAnimations param.Opt[bool] `query:"settleAnimations,omitzero" json:"-"`
+ // Optional browser wait time in milliseconds after initial page load. Min: 0. Max:
+ // 30000 (30 seconds).
+ WaitForMs param.Opt[int64] `query:"waitForMs,omitzero" json:"-"`
// 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).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
- // When true, return only the page's main content in the HTML response, excluding
- // headers, footers, sidebars, and navigation when detectable.
- UseMainContentOnly param.Opt[bool] `query:"useMainContentOnly,omitzero" json:"-"`
- // Optional browser wait time in milliseconds after initial page load. Min: 0. Max:
- // 30000 (30 seconds).
- WaitForMs param.Opt[int64] `query:"waitForMs,omitzero" json:"-"`
- // Two-letter ISO 3166-1 alpha-2 country code for the website request location.
- // When provided, Context.dev fetches the target page from that country.
+ // CSS selectors to remove from the result. Applied after includeSelectors.
+ // Exclusion takes precedence: an element matching both is removed. Examples:
+ // "nav", "footer", ".ad-banner", "[aria-hidden=true]".
+ ExcludeSelectors []string `query:"excludeSelectors,omitzero" json:"-"`
+ // 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]".
+ IncludeSelectors []string `query:"includeSelectors,omitzero" json:"-"`
+ // Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
+ // residential proxy exit location. Must be one of Context.dev's supported
+ // countries. When provided, Context.dev fetches the target page from that country.
//
// Any of "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "ar", "at", "au", "aw",
// "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
@@ -3656,25 +3664,26 @@ type WebWebScrapeHTMLParams struct {
// "tj", "tl", "tm", "tn", "tr", "tt", "tw", "tz", "ua", "ug", "us", "uy", "uz",
// "vc", "ve", "vg", "vi", "vn", "ye", "yt", "za", "zm", "zw".
Country WebWebScrapeHTMLParamsCountry `query:"country,omitzero" json:"-"`
- // CSS selectors to remove from the result. Applied after includeSelectors.
- // Exclusion takes precedence: an element matching both is removed. Examples:
- // "nav", "footer", ".ad-banner", "[aria-hidden=true]".
- ExcludeSelectors []string `query:"excludeSelectors,omitzero" json:"-"`
// 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.
Headers map[string]string `query:"headers,omitzero" json:"-"`
- // 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]".
- IncludeSelectors []string `query:"includeSelectors,omitzero" json:"-"`
+ // When true, iframes are rendered inline into the returned HTML.
+ IncludeFrames WebWebScrapeHTMLParamsIncludeFramesUnion `query:"includeFrames,omitzero" json:"-"`
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf WebWebScrapeHTMLParamsPdf `query:"pdf,omitzero" json:"-"`
+ // 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.
+ SettleAnimations WebWebScrapeHTMLParamsSettleAnimationsUnion `query:"settleAnimations,omitzero" json:"-"`
// 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.
Tags []string `query:"tags,omitzero" json:"-"`
+ // When true, return only the page's main content in the HTML response, excluding
+ // headers, footers, sidebars, and navigation when detectable.
+ UseMainContentOnly WebWebScrapeHTMLParamsUseMainContentOnlyUnion `query:"useMainContentOnly,omitzero" json:"-"`
paramObj
}
@@ -3686,8 +3695,9 @@ func (r WebWebScrapeHTMLParams) URLQuery() (v url.Values, err error) {
})
}
-// Two-letter ISO 3166-1 alpha-2 country code for the website request location.
-// When provided, Context.dev fetches the target page from that country.
+// Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
+// residential proxy exit location. Must be one of Context.dev's supported
+// countries. When provided, Context.dev fetches the target page from that country.
type WebWebScrapeHTMLParamsCountry string
const (
@@ -3897,21 +3907,39 @@ const (
WebWebScrapeHTMLParamsCountryZw WebWebScrapeHTMLParamsCountry = "zw"
)
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeHTMLParamsIncludeFramesUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeHTMLsIncludeFramesString)
+ OfWebWebScrapeHTMLsIncludeFramesString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeHTMLParamsIncludeFramesString string
+
+const (
+ WebWebScrapeHTMLParamsIncludeFramesStringTrue WebWebScrapeHTMLParamsIncludeFramesString = "true"
+ WebWebScrapeHTMLParamsIncludeFramesStringFalse WebWebScrapeHTMLParamsIncludeFramesString = "false"
+)
+
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
type WebWebScrapeHTMLParamsPdf struct {
// 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.
End param.Opt[int64] `query:"end,omitzero" json:"-"`
+ // First 1-based PDF page to parse. When omitted, parsing starts at the first page.
+ Start param.Opt[int64] `query:"start,omitzero" json:"-"`
// When true, detect and OCR images embedded in the selected PDF pages, inserting
// recognized text at each image's position in page reading order while preserving
// the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
- Ocr param.Opt[bool] `query:"ocr,omitzero" json:"-"`
+ Ocr WebWebScrapeHTMLParamsPdfOcrUnion `query:"ocr,omitzero" json:"-"`
// When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
// a 400 WEBSITE_ACCESS_ERROR is returned.
- ShouldParse param.Opt[bool] `query:"shouldParse,omitzero" json:"-"`
- // First 1-based PDF page to parse. When omitted, parsing starts at the first page.
- Start param.Opt[int64] `query:"start,omitzero" json:"-"`
+ ShouldParse WebWebScrapeHTMLParamsPdfShouldParseUnion `query:"shouldParse,omitzero" json:"-"`
paramObj
}
@@ -3924,27 +3952,99 @@ func (r WebWebScrapeHTMLParamsPdf) URLQuery() (v url.Values, err error) {
})
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeHTMLParamsPdfOcrUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeHTMLsPdfOcrString)
+ OfWebWebScrapeHTMLsPdfOcrString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeHTMLParamsPdfOcrString string
+
+const (
+ WebWebScrapeHTMLParamsPdfOcrStringTrue WebWebScrapeHTMLParamsPdfOcrString = "true"
+ WebWebScrapeHTMLParamsPdfOcrStringFalse WebWebScrapeHTMLParamsPdfOcrString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeHTMLParamsPdfShouldParseUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeHTMLsPdfShouldParseString)
+ OfWebWebScrapeHTMLsPdfShouldParseString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeHTMLParamsPdfShouldParseString string
+
+const (
+ WebWebScrapeHTMLParamsPdfShouldParseStringTrue WebWebScrapeHTMLParamsPdfShouldParseString = "true"
+ WebWebScrapeHTMLParamsPdfShouldParseStringFalse WebWebScrapeHTMLParamsPdfShouldParseString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeHTMLParamsSettleAnimationsUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeHTMLsSettleAnimationsString)
+ OfWebWebScrapeHTMLsSettleAnimationsString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeHTMLParamsSettleAnimationsString string
+
+const (
+ WebWebScrapeHTMLParamsSettleAnimationsStringTrue WebWebScrapeHTMLParamsSettleAnimationsString = "true"
+ WebWebScrapeHTMLParamsSettleAnimationsStringFalse WebWebScrapeHTMLParamsSettleAnimationsString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeHTMLParamsUseMainContentOnlyUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeHTMLsUseMainContentOnlyString)
+ OfWebWebScrapeHTMLsUseMainContentOnlyString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeHTMLParamsUseMainContentOnlyString string
+
+const (
+ WebWebScrapeHTMLParamsUseMainContentOnlyStringTrue WebWebScrapeHTMLParamsUseMainContentOnlyString = "true"
+ WebWebScrapeHTMLParamsUseMainContentOnlyStringFalse WebWebScrapeHTMLParamsUseMainContentOnlyString = "false"
+)
+
type WebWebScrapeImagesParams struct {
// Page URL to inspect. Must include http:// or https://.
URL string `query:"url" api:"required" format:"uri" json:"-"`
- // 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.
- Dedupe param.Opt[bool] `query:"dedupe,omitzero" json:"-"`
// Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1
// day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days).
MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
+ // Optional browser wait time in milliseconds after initial page load before
+ // collecting images. Min: 0. Max: 30000 (30 seconds).
+ WaitForMs param.Opt[int64] `query:"waitForMs,omitzero" json:"-"`
// 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).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
- // Optional browser wait time in milliseconds after initial page load before
- // collecting images. Min: 0. Max: 30000 (30 seconds).
- WaitForMs param.Opt[int64] `query:"waitForMs,omitzero" json:"-"`
// Optional per-image processing, sent as deep-object query params such as
// enrichment[resolution]=true.
Enrichment WebWebScrapeImagesParamsEnrichment `query:"enrichment,omitzero" json:"-"`
+ // 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.
+ Dedupe WebWebScrapeImagesParamsDedupeUnion `query:"dedupe,omitzero" json:"-"`
// 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.
@@ -3965,18 +4065,36 @@ func (r WebWebScrapeImagesParams) URLQuery() (v url.Values, err error) {
})
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeImagesParamsDedupeUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeImagessDedupeString)
+ OfWebWebScrapeImagessDedupeString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeImagesParamsDedupeString string
+
+const (
+ WebWebScrapeImagesParamsDedupeStringTrue WebWebScrapeImagesParamsDedupeString = "true"
+ WebWebScrapeImagesParamsDedupeStringFalse WebWebScrapeImagesParamsDedupeString = "false"
+)
+
// Optional per-image processing, sent as deep-object query params such as
// enrichment[resolution]=true.
type WebWebScrapeImagesParamsEnrichment struct {
+ // Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000.
+ MaxTimePerMs param.Opt[int64] `query:"maxTimePerMs,omitzero" json:"-"`
// Classify each image by visual asset type.
- Classification param.Opt[bool] `query:"classification,omitzero" json:"-"`
+ Classification WebWebScrapeImagesParamsEnrichmentClassificationUnion `query:"classification,omitzero" json:"-"`
// Host materializable images on the Brand.dev CDN and return their URL and MIME
// type.
- HostedURL param.Opt[bool] `query:"hostedUrl,omitzero" json:"-"`
- // Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000.
- MaxTimePerMs param.Opt[int64] `query:"maxTimePerMs,omitzero" json:"-"`
+ HostedURL WebWebScrapeImagesParamsEnrichmentHostedURLUnion `query:"hostedUrl,omitzero" json:"-"`
// Measure image width and height when possible.
- Resolution param.Opt[bool] `query:"resolution,omitzero" json:"-"`
+ Resolution WebWebScrapeImagesParamsEnrichmentResolutionUnion `query:"resolution,omitzero" json:"-"`
paramObj
}
@@ -3989,38 +4107,86 @@ func (r WebWebScrapeImagesParamsEnrichment) URLQuery() (v url.Values, err error)
})
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeImagesParamsEnrichmentClassificationUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeImagessEnrichmentClassificationString)
+ OfWebWebScrapeImagessEnrichmentClassificationString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeImagesParamsEnrichmentClassificationString string
+
+const (
+ WebWebScrapeImagesParamsEnrichmentClassificationStringTrue WebWebScrapeImagesParamsEnrichmentClassificationString = "true"
+ WebWebScrapeImagesParamsEnrichmentClassificationStringFalse WebWebScrapeImagesParamsEnrichmentClassificationString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeImagesParamsEnrichmentHostedURLUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeImagessEnrichmentHostedURLString)
+ OfWebWebScrapeImagessEnrichmentHostedURLString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeImagesParamsEnrichmentHostedURLString string
+
+const (
+ WebWebScrapeImagesParamsEnrichmentHostedURLStringTrue WebWebScrapeImagesParamsEnrichmentHostedURLString = "true"
+ WebWebScrapeImagesParamsEnrichmentHostedURLStringFalse WebWebScrapeImagesParamsEnrichmentHostedURLString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeImagesParamsEnrichmentResolutionUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeImagessEnrichmentResolutionString)
+ OfWebWebScrapeImagessEnrichmentResolutionString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeImagesParamsEnrichmentResolutionString string
+
+const (
+ WebWebScrapeImagesParamsEnrichmentResolutionStringTrue WebWebScrapeImagesParamsEnrichmentResolutionString = "true"
+ WebWebScrapeImagesParamsEnrichmentResolutionStringFalse WebWebScrapeImagesParamsEnrichmentResolutionString = "false"
+)
+
type WebWebScrapeMdParams struct {
// Full URL to scrape into LLM usable Markdown (must include http:// or https://
// protocol)
URL string `query:"url" api:"required" format:"uri" json:"-"`
- // When true, the contents of iframes are rendered to Markdown.
- IncludeFrames param.Opt[bool] `query:"includeFrames,omitzero" json:"-"`
- // Include image references in Markdown output
- IncludeImages param.Opt[bool] `query:"includeImages,omitzero" json:"-"`
- // Preserve hyperlinks in Markdown output
- IncludeLinks param.Opt[bool] `query:"includeLinks,omitzero" json:"-"`
// 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.
MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
- // 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.
- SettleAnimations param.Opt[bool] `query:"settleAnimations,omitzero" json:"-"`
- // Shorten base64-encoded image data in the Markdown output
- ShortenBase64Images param.Opt[bool] `query:"shortenBase64Images,omitzero" json:"-"`
+ // Optional browser wait time in milliseconds after initial page load before
+ // converting the page to Markdown. Min: 0. Max: 30000 (30 seconds).
+ WaitForMs param.Opt[int64] `query:"waitForMs,omitzero" json:"-"`
// 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).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
- // Extract only the main content of the page, excluding headers, footers, sidebars,
- // and navigation
- UseMainContentOnly param.Opt[bool] `query:"useMainContentOnly,omitzero" json:"-"`
- // Optional browser wait time in milliseconds after initial page load before
- // converting the page to Markdown. Min: 0. Max: 30000 (30 seconds).
- WaitForMs param.Opt[int64] `query:"waitForMs,omitzero" json:"-"`
- // Two-letter ISO 3166-1 alpha-2 country code for the website request location.
- // When provided, Context.dev fetches the target page from that country.
+ // CSS selectors to remove before conversion to Markdown. Applied after
+ // includeSelectors. Exclusion takes precedence: an element matching both is
+ // removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".
+ ExcludeSelectors []string `query:"excludeSelectors,omitzero" json:"-"`
+ // 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]".
+ IncludeSelectors []string `query:"includeSelectors,omitzero" json:"-"`
+ // Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
+ // residential proxy exit location. Must be one of Context.dev's supported
+ // countries. When provided, Context.dev fetches the target page from that country.
//
// Any of "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "ar", "at", "au", "aw",
// "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
@@ -4039,25 +4205,32 @@ type WebWebScrapeMdParams struct {
// "tj", "tl", "tm", "tn", "tr", "tt", "tw", "tz", "ua", "ug", "us", "uy", "uz",
// "vc", "ve", "vg", "vi", "vn", "ye", "yt", "za", "zm", "zw".
Country WebWebScrapeMdParamsCountry `query:"country,omitzero" json:"-"`
- // CSS selectors to remove before conversion to Markdown. Applied after
- // includeSelectors. Exclusion takes precedence: an element matching both is
- // removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".
- ExcludeSelectors []string `query:"excludeSelectors,omitzero" json:"-"`
// 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.
Headers map[string]string `query:"headers,omitzero" json:"-"`
- // 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]".
- IncludeSelectors []string `query:"includeSelectors,omitzero" json:"-"`
+ // When true, the contents of iframes are rendered to Markdown.
+ IncludeFrames WebWebScrapeMdParamsIncludeFramesUnion `query:"includeFrames,omitzero" json:"-"`
+ // Include image references in Markdown output
+ IncludeImages WebWebScrapeMdParamsIncludeImagesUnion `query:"includeImages,omitzero" json:"-"`
+ // Preserve hyperlinks in Markdown output
+ IncludeLinks WebWebScrapeMdParamsIncludeLinksUnion `query:"includeLinks,omitzero" json:"-"`
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf WebWebScrapeMdParamsPdf `query:"pdf,omitzero" json:"-"`
+ // 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.
+ SettleAnimations WebWebScrapeMdParamsSettleAnimationsUnion `query:"settleAnimations,omitzero" json:"-"`
+ // Shorten base64-encoded image data in the Markdown output
+ ShortenBase64Images WebWebScrapeMdParamsShortenBase64ImagesUnion `query:"shortenBase64Images,omitzero" json:"-"`
// 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.
Tags []string `query:"tags,omitzero" json:"-"`
+ // Extract only the main content of the page, excluding headers, footers, sidebars,
+ // and navigation
+ UseMainContentOnly WebWebScrapeMdParamsUseMainContentOnlyUnion `query:"useMainContentOnly,omitzero" json:"-"`
paramObj
}
@@ -4069,8 +4242,9 @@ func (r WebWebScrapeMdParams) URLQuery() (v url.Values, err error) {
})
}
-// Two-letter ISO 3166-1 alpha-2 country code for the website request location.
-// When provided, Context.dev fetches the target page from that country.
+// Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
+// residential proxy exit location. Must be one of Context.dev's supported
+// countries. When provided, Context.dev fetches the target page from that country.
type WebWebScrapeMdParamsCountry string
const (
@@ -4280,21 +4454,75 @@ const (
WebWebScrapeMdParamsCountryZw WebWebScrapeMdParamsCountry = "zw"
)
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeMdParamsIncludeFramesUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeMdsIncludeFramesString)
+ OfWebWebScrapeMdsIncludeFramesString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeMdParamsIncludeFramesString string
+
+const (
+ WebWebScrapeMdParamsIncludeFramesStringTrue WebWebScrapeMdParamsIncludeFramesString = "true"
+ WebWebScrapeMdParamsIncludeFramesStringFalse WebWebScrapeMdParamsIncludeFramesString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeMdParamsIncludeImagesUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeMdsIncludeImagesString)
+ OfWebWebScrapeMdsIncludeImagesString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeMdParamsIncludeImagesString string
+
+const (
+ WebWebScrapeMdParamsIncludeImagesStringTrue WebWebScrapeMdParamsIncludeImagesString = "true"
+ WebWebScrapeMdParamsIncludeImagesStringFalse WebWebScrapeMdParamsIncludeImagesString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeMdParamsIncludeLinksUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeMdsIncludeLinksString)
+ OfWebWebScrapeMdsIncludeLinksString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeMdParamsIncludeLinksString string
+
+const (
+ WebWebScrapeMdParamsIncludeLinksStringTrue WebWebScrapeMdParamsIncludeLinksString = "true"
+ WebWebScrapeMdParamsIncludeLinksStringFalse WebWebScrapeMdParamsIncludeLinksString = "false"
+)
+
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
type WebWebScrapeMdParamsPdf struct {
// 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.
End param.Opt[int64] `query:"end,omitzero" json:"-"`
+ // First 1-based PDF page to parse. When omitted, parsing starts at the first page.
+ Start param.Opt[int64] `query:"start,omitzero" json:"-"`
// When true, detect and OCR images embedded in the selected PDF pages, inserting
// recognized text at each image's position in page reading order while preserving
// the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
- Ocr param.Opt[bool] `query:"ocr,omitzero" json:"-"`
+ Ocr WebWebScrapeMdParamsPdfOcrUnion `query:"ocr,omitzero" json:"-"`
// When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
// a 400 WEBSITE_ACCESS_ERROR is returned.
- ShouldParse param.Opt[bool] `query:"shouldParse,omitzero" json:"-"`
- // First 1-based PDF page to parse. When omitted, parsing starts at the first page.
- Start param.Opt[int64] `query:"start,omitzero" json:"-"`
+ ShouldParse WebWebScrapeMdParamsPdfShouldParseUnion `query:"shouldParse,omitzero" json:"-"`
paramObj
}
@@ -4307,12 +4535,105 @@ func (r WebWebScrapeMdParamsPdf) URLQuery() (v url.Values, err error) {
})
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeMdParamsPdfOcrUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeMdsPdfOcrString)
+ OfWebWebScrapeMdsPdfOcrString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeMdParamsPdfOcrString string
+
+const (
+ WebWebScrapeMdParamsPdfOcrStringTrue WebWebScrapeMdParamsPdfOcrString = "true"
+ WebWebScrapeMdParamsPdfOcrStringFalse WebWebScrapeMdParamsPdfOcrString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeMdParamsPdfShouldParseUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeMdsPdfShouldParseString)
+ OfWebWebScrapeMdsPdfShouldParseString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeMdParamsPdfShouldParseString string
+
+const (
+ WebWebScrapeMdParamsPdfShouldParseStringTrue WebWebScrapeMdParamsPdfShouldParseString = "true"
+ WebWebScrapeMdParamsPdfShouldParseStringFalse WebWebScrapeMdParamsPdfShouldParseString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeMdParamsSettleAnimationsUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeMdsSettleAnimationsString)
+ OfWebWebScrapeMdsSettleAnimationsString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeMdParamsSettleAnimationsString string
+
+const (
+ WebWebScrapeMdParamsSettleAnimationsStringTrue WebWebScrapeMdParamsSettleAnimationsString = "true"
+ WebWebScrapeMdParamsSettleAnimationsStringFalse WebWebScrapeMdParamsSettleAnimationsString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeMdParamsShortenBase64ImagesUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeMdsShortenBase64ImagesString)
+ OfWebWebScrapeMdsShortenBase64ImagesString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeMdParamsShortenBase64ImagesString string
+
+const (
+ WebWebScrapeMdParamsShortenBase64ImagesStringTrue WebWebScrapeMdParamsShortenBase64ImagesString = "true"
+ WebWebScrapeMdParamsShortenBase64ImagesStringFalse WebWebScrapeMdParamsShortenBase64ImagesString = "false"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeMdParamsUseMainContentOnlyUnion struct {
+ OfBool param.Opt[bool] `query:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfWebWebScrapeMdsUseMainContentOnlyString)
+ OfWebWebScrapeMdsUseMainContentOnlyString param.Opt[string] `query:",omitzero,inline"`
+ paramUnion
+}
+
+type WebWebScrapeMdParamsUseMainContentOnlyString string
+
+const (
+ WebWebScrapeMdParamsUseMainContentOnlyStringTrue WebWebScrapeMdParamsUseMainContentOnlyString = "true"
+ WebWebScrapeMdParamsUseMainContentOnlyStringFalse WebWebScrapeMdParamsUseMainContentOnlyString = "false"
+)
+
type WebWebScrapeSitemapParams struct {
// Domain to build a sitemap for
Domain string `query:"domain" api:"required" json:"-"`
// Maximum number of links to return from the sitemap crawl. Defaults to 10,000.
// Minimum is 1, maximum is 100,000.
MaxLinks param.Opt[int64] `query:"maxLinks,omitzero" json:"-"`
+ // Optional explicit sitemap URL. When provided, exactly this sitemap is crawled
+ // instead of discovering the domain's sitemaps.
+ SitemapURL param.Opt[string] `query:"sitemapUrl,omitzero" format:"uri" json:"-"`
// 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).
diff --git a/web_test.go b/web_test.go
index 556fb5a..516ee1b 100644
--- a/web_test.go
+++ b/web_test.go
@@ -103,8 +103,8 @@ func TestWebExtractFontsWithOptionalParams(t *testing.T) {
)
_, err := client.Web.ExtractFonts(context.TODO(), contextdev.WebExtractFontsParams{
DirectURL: contextdev.String("https://example.com"),
- Domain: contextdev.String("domain"),
- MaxAgeMs: contextdev.Int(86400000),
+ Domain: contextdev.String("xxx"),
+ MaxAgeMs: contextdev.Int(0),
Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
})
@@ -133,8 +133,8 @@ func TestWebExtractStyleguideWithOptionalParams(t *testing.T) {
_, err := client.Web.ExtractStyleguide(context.TODO(), contextdev.WebExtractStyleguideParams{
ColorScheme: contextdev.WebExtractStyleguideParamsColorSchemeLight,
DirectURL: contextdev.String("https://example.com"),
- Domain: contextdev.String("domain"),
- MaxAgeMs: contextdev.Int(86400000),
+ Domain: contextdev.String("xxx"),
+ MaxAgeMs: contextdev.Int(0),
Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1000),
})
@@ -161,17 +161,19 @@ func TestWebScreenshotWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Web.Screenshot(context.TODO(), contextdev.WebScreenshotParams{
- ColorScheme: contextdev.WebScreenshotParamsColorSchemeLight,
- Country: contextdev.WebScreenshotParamsCountryDe,
- DirectURL: contextdev.String("https://example.com"),
- Domain: contextdev.String("domain"),
- FullScreenshot: contextdev.WebScreenshotParamsFullScreenshotTrue,
- HandleCookiePopup: contextdev.WebScreenshotParamsHandleCookiePopupTrue,
- MaxAgeMs: contextdev.Int(0),
- Page: contextdev.WebScreenshotParamsPageLogin,
- ScrollOffset: contextdev.Int(0),
- Tags: []string{"production", "team-alpha"},
- TimeoutMs: contextdev.Int(1000),
+ ColorScheme: contextdev.WebScreenshotParamsColorSchemeLight,
+ Country: contextdev.WebScreenshotParamsCountryDe,
+ DirectURL: contextdev.String("https://example.com"),
+ Domain: contextdev.String("xxx"),
+ FullScreenshot: contextdev.WebScreenshotParamsFullScreenshotTrue,
+ HandleCookiePopup: contextdev.WebScreenshotParamsHandleCookiePopupUnion{
+ OfWebScreenshotsHandleCookiePopupString: contextdev.String("true"),
+ },
+ MaxAgeMs: contextdev.Int(0),
+ Page: contextdev.WebScreenshotParamsPageLogin,
+ ScrollOffset: contextdev.Int(0),
+ Tags: []string{"production", "team-alpha"},
+ TimeoutMs: contextdev.Int(1),
Viewport: contextdev.WebScreenshotParamsViewport{
Height: contextdev.Int(240),
Width: contextdev.Int(240),
@@ -301,24 +303,34 @@ func TestWebWebScrapeHTMLWithOptionalParams(t *testing.T) {
_, err := client.Web.WebScrapeHTML(context.TODO(), contextdev.WebWebScrapeHTMLParams{
URL: "https://example.com",
Country: contextdev.WebWebScrapeHTMLParamsCountryDe,
- ExcludeSelectors: []string{"string"},
+ ExcludeSelectors: []string{"x"},
Headers: map[string]string{
"foo": "J!",
},
- IncludeFrames: contextdev.Bool(true),
- IncludeSelectors: []string{"string"},
+ IncludeFrames: contextdev.WebWebScrapeHTMLParamsIncludeFramesUnion{
+ OfWebWebScrapeHTMLsIncludeFramesString: contextdev.String("true"),
+ },
+ IncludeSelectors: []string{"x"},
MaxAgeMs: contextdev.Int(0),
Pdf: contextdev.WebWebScrapeHTMLParamsPdf{
- End: contextdev.Int(1),
- Ocr: contextdev.Bool(true),
- ShouldParse: contextdev.Bool(true),
- Start: contextdev.Int(1),
+ End: contextdev.Int(1),
+ Ocr: contextdev.WebWebScrapeHTMLParamsPdfOcrUnion{
+ OfWebWebScrapeHTMLsPdfOcrString: contextdev.String("true"),
+ },
+ ShouldParse: contextdev.WebWebScrapeHTMLParamsPdfShouldParseUnion{
+ OfWebWebScrapeHTMLsPdfShouldParseString: contextdev.String("true"),
+ },
+ Start: contextdev.Int(1),
},
- SettleAnimations: contextdev.Bool(true),
- Tags: []string{"production", "team-alpha"},
- TimeoutMs: contextdev.Int(1000),
- UseMainContentOnly: contextdev.Bool(true),
- WaitForMs: contextdev.Int(0),
+ SettleAnimations: contextdev.WebWebScrapeHTMLParamsSettleAnimationsUnion{
+ OfWebWebScrapeHTMLsSettleAnimationsString: contextdev.String("true"),
+ },
+ Tags: []string{"production", "team-alpha"},
+ TimeoutMs: contextdev.Int(1),
+ UseMainContentOnly: contextdev.WebWebScrapeHTMLParamsUseMainContentOnlyUnion{
+ OfWebWebScrapeHTMLsUseMainContentOnlyString: contextdev.String("true"),
+ },
+ WaitForMs: contextdev.Int(0),
})
if err != nil {
var apierr *contextdev.Error
@@ -343,20 +355,28 @@ func TestWebWebScrapeImagesWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Web.WebScrapeImages(context.TODO(), contextdev.WebWebScrapeImagesParams{
- URL: "https://example.com",
- Dedupe: contextdev.Bool(true),
+ URL: "https://example.com",
+ Dedupe: contextdev.WebWebScrapeImagesParamsDedupeUnion{
+ OfWebWebScrapeImagessDedupeString: contextdev.String("true"),
+ },
Enrichment: contextdev.WebWebScrapeImagesParamsEnrichment{
- Classification: contextdev.Bool(true),
- HostedURL: contextdev.Bool(true),
- MaxTimePerMs: contextdev.Int(1),
- Resolution: contextdev.Bool(true),
+ Classification: contextdev.WebWebScrapeImagesParamsEnrichmentClassificationUnion{
+ OfWebWebScrapeImagessEnrichmentClassificationString: contextdev.String("true"),
+ },
+ HostedURL: contextdev.WebWebScrapeImagesParamsEnrichmentHostedURLUnion{
+ OfWebWebScrapeImagessEnrichmentHostedURLString: contextdev.String("true"),
+ },
+ MaxTimePerMs: contextdev.Int(1),
+ Resolution: contextdev.WebWebScrapeImagesParamsEnrichmentResolutionUnion{
+ OfWebWebScrapeImagessEnrichmentResolutionString: contextdev.String("true"),
+ },
},
Headers: map[string]string{
"foo": "J!",
},
MaxAgeMs: contextdev.Int(0),
Tags: []string{"production", "team-alpha"},
- TimeoutMs: contextdev.Int(1000),
+ TimeoutMs: contextdev.Int(1),
WaitForMs: contextdev.Int(0),
})
if err != nil {
@@ -384,27 +404,43 @@ func TestWebWebScrapeMdWithOptionalParams(t *testing.T) {
_, err := client.Web.WebScrapeMd(context.TODO(), contextdev.WebWebScrapeMdParams{
URL: "https://example.com",
Country: contextdev.WebWebScrapeMdParamsCountryDe,
- ExcludeSelectors: []string{"string"},
+ ExcludeSelectors: []string{"x"},
Headers: map[string]string{
"foo": "J!",
},
- IncludeFrames: contextdev.Bool(true),
- IncludeImages: contextdev.Bool(true),
- IncludeLinks: contextdev.Bool(true),
- IncludeSelectors: []string{"string"},
+ IncludeFrames: contextdev.WebWebScrapeMdParamsIncludeFramesUnion{
+ OfWebWebScrapeMdsIncludeFramesString: contextdev.String("true"),
+ },
+ IncludeImages: contextdev.WebWebScrapeMdParamsIncludeImagesUnion{
+ OfWebWebScrapeMdsIncludeImagesString: contextdev.String("true"),
+ },
+ IncludeLinks: contextdev.WebWebScrapeMdParamsIncludeLinksUnion{
+ OfWebWebScrapeMdsIncludeLinksString: contextdev.String("true"),
+ },
+ IncludeSelectors: []string{"x"},
MaxAgeMs: contextdev.Int(0),
Pdf: contextdev.WebWebScrapeMdParamsPdf{
- End: contextdev.Int(1),
- Ocr: contextdev.Bool(true),
- ShouldParse: contextdev.Bool(true),
- Start: contextdev.Int(1),
+ End: contextdev.Int(1),
+ Ocr: contextdev.WebWebScrapeMdParamsPdfOcrUnion{
+ OfWebWebScrapeMdsPdfOcrString: contextdev.String("true"),
+ },
+ ShouldParse: contextdev.WebWebScrapeMdParamsPdfShouldParseUnion{
+ OfWebWebScrapeMdsPdfShouldParseString: contextdev.String("true"),
+ },
+ Start: contextdev.Int(1),
},
- SettleAnimations: contextdev.Bool(true),
- ShortenBase64Images: contextdev.Bool(true),
- Tags: []string{"production", "team-alpha"},
- TimeoutMs: contextdev.Int(1000),
- UseMainContentOnly: contextdev.Bool(true),
- WaitForMs: contextdev.Int(0),
+ SettleAnimations: contextdev.WebWebScrapeMdParamsSettleAnimationsUnion{
+ OfWebWebScrapeMdsSettleAnimationsString: contextdev.String("true"),
+ },
+ ShortenBase64Images: contextdev.WebWebScrapeMdParamsShortenBase64ImagesUnion{
+ OfWebWebScrapeMdsShortenBase64ImagesString: contextdev.String("true"),
+ },
+ Tags: []string{"production", "team-alpha"},
+ TimeoutMs: contextdev.Int(1),
+ UseMainContentOnly: contextdev.WebWebScrapeMdParamsUseMainContentOnlyUnion{
+ OfWebWebScrapeMdsUseMainContentOnlyString: contextdev.String("true"),
+ },
+ WaitForMs: contextdev.Int(0),
})
if err != nil {
var apierr *contextdev.Error
@@ -429,14 +465,15 @@ func TestWebWebScrapeSitemapWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Web.WebScrapeSitemap(context.TODO(), contextdev.WebWebScrapeSitemapParams{
- Domain: "domain",
+ Domain: "xxx",
Headers: map[string]string{
"foo": "J!",
},
- MaxLinks: contextdev.Int(1),
- Tags: []string{"production", "team-alpha"},
- TimeoutMs: contextdev.Int(1000),
- URLRegex: contextdev.String("^https?://[^/]+/blog/"),
+ MaxLinks: contextdev.Int(1),
+ SitemapURL: contextdev.String("https://example.com"),
+ Tags: []string{"production", "team-alpha"},
+ TimeoutMs: contextdev.Int(1),
+ URLRegex: contextdev.String("^https?://[^/]+/blog/"),
})
if err != nil {
var apierr *contextdev.Error
From d1d221e22674292de1ba5e39d5ec6f4adf156850 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 18 Jul 2026 02:02:45 +0000
Subject: [PATCH 03/13] feat(stlc): configurable CI runner and
private-production-repo support in workflow templates
---
.github/workflows/ci.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2e524f2..2bcb4cf 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -21,7 +21,7 @@ jobs:
permissions:
contents: read
id-token: write
- runs-on: ${{ github.repository == 'stainless-sdks/context.dev-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/context.dev-go' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
@@ -49,7 +49,7 @@ jobs:
lint:
timeout-minutes: 10
name: lint
- runs-on: ${{ github.repository == 'stainless-sdks/context.dev-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
@@ -65,7 +65,7 @@ jobs:
test:
timeout-minutes: 10
name: test
- runs-on: ${{ github.repository == 'stainless-sdks/context.dev-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
From 533ef0c9994e843f48bc3a73e5aca2247de860b1 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sun, 19 Jul 2026 19:35:51 +0000
Subject: [PATCH 04/13] feat(api): api update
---
.stats.yml | 4 ++--
ai.go | 12 +++---------
brand.go | 24 ++++++------------------
utility.go | 4 +---
web.go | 16 +++++++---------
web_test.go | 9 +++++----
6 files changed, 24 insertions(+), 45 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index b9d1d30..91b45dc 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 30
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d49b84cf1125618f171698ff1ee4ff9a8d04151619cb4a56d650103869834465.yml
-openapi_spec_hash: 49b7a6f59dcdff1e2bf88feb6474a562
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8cd70a2b5bd380b75e5f94dc376bd8c704ee0431bdfe8af1b017facc2b883097.yml
+openapi_spec_hash: bb1d32ae5c46be85ee8bb3b13f5b1150
config_hash: daabb160675d86b354711da1e77e5129
diff --git a/ai.go b/ai.go
index 8b56cfd..fd7bc1b 100644
--- a/ai.go
+++ b/ai.go
@@ -288,9 +288,7 @@ type AIExtractProductParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
paramObj
}
@@ -338,9 +336,7 @@ type AIExtractProductsParamsBodyByDomain struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
paramObj
}
@@ -368,9 +364,7 @@ type AIExtractProductsParamsBodyByDirectURL struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
paramObj
}
diff --git a/brand.go b/brand.go
index 079d55f..431d9e6 100644
--- a/brand.go
+++ b/brand.go
@@ -948,9 +948,7 @@ type BrandGetParamsBodyByDomain struct {
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for domain-based brand retrieval.
//
@@ -1015,9 +1013,7 @@ type BrandGetParamsBodyByName struct {
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for name-based brand retrieval.
//
@@ -1080,9 +1076,7 @@ type BrandGetParamsBodyByEmail struct {
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for email-based brand retrieval.
//
@@ -1146,9 +1140,7 @@ type BrandGetParamsBodyByTicker struct {
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for ticker-based brand retrieval.
//
@@ -1187,9 +1179,7 @@ type BrandGetParamsBodyByDirectURL struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for direct-URL-based brand retrieval.
//
@@ -1253,9 +1243,7 @@ type BrandGetParamsBodyByTransaction struct {
Mcc BrandGetParamsBodyByTransactionMccUnion `json:"mcc,omitzero"`
// Optional phone number from the transaction to help verify brand match.
Phone BrandGetParamsBodyByTransactionPhoneUnion `json:"phone,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for transaction-based brand retrieval.
//
diff --git a/utility.go b/utility.go
index 03978c2..1945e43 100644
--- a/utility.go
+++ b/utility.go
@@ -118,9 +118,7 @@ type UtilityPrefetchParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
paramObj
}
diff --git a/web.go b/web.go
index 2269118..3158c7a 100644
--- a/web.go
+++ b/web.go
@@ -2387,6 +2387,10 @@ type WebExtractParams struct {
MaxDepth param.Opt[int64] `json:"maxDepth,omitzero"`
// Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5.
MaxPages param.Opt[int64] `json:"maxPages,omitzero"`
+ // 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.
+ SettleAnimations param.Opt[bool] `json:"settleAnimations,omitzero"`
// Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000
// (110s). Default: 80000 (80s).
StopAfterMs param.Opt[int64] `json:"stopAfterMs,omitzero"`
@@ -2398,9 +2402,7 @@ type WebExtractParams struct {
// crawled page.
WaitForMs param.Opt[int64] `json:"waitForMs,omitzero"`
Pdf WebExtractParamsPdf `json:"pdf,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
paramObj
}
@@ -2962,9 +2964,7 @@ type WebSearchParams struct {
IncludeDomains []string `json:"includeDomains,omitzero"`
// Inline Markdown scraping for each result. Set `enabled: true` to activate.
MarkdownOptions WebSearchParamsMarkdownOptions `json:"markdownOptions,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
paramObj
}
@@ -3368,9 +3368,7 @@ type WebWebCrawlMdParams struct {
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf WebWebCrawlMdParamsPdf `json:"pdf,omitzero"`
- // Optional 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.
+ // Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
paramObj
}
diff --git a/web_test.go b/web_test.go
index 516ee1b..1fdc6f9 100644
--- a/web_test.go
+++ b/web_test.go
@@ -46,10 +46,11 @@ func TestWebExtractWithOptionalParams(t *testing.T) {
ShouldParse: contextdev.Bool(true),
Start: contextdev.Int(1),
},
- StopAfterMs: contextdev.Int(10000),
- Tags: []string{"production", "team-alpha"},
- TimeoutMs: contextdev.Int(1000),
- WaitForMs: contextdev.Int(0),
+ SettleAnimations: contextdev.Bool(true),
+ StopAfterMs: contextdev.Int(10000),
+ Tags: []string{"production", "team-alpha"},
+ TimeoutMs: contextdev.Int(1000),
+ WaitForMs: contextdev.Int(0),
})
if err != nil {
var apierr *contextdev.Error
From 9440d43b6b1e207d22d7bb97d2eb2306495136ee Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 21 Jul 2026 17:28:02 +0000
Subject: [PATCH 05/13] feat(api): api update
---
.stats.yml | 4 +--
parse.go | 18 ++++++++++
parse_test.go | 1 +
web.go | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++-
web_test.go | 5 +++
5 files changed, 118 insertions(+), 3 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 91b45dc..231a6da 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 30
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8cd70a2b5bd380b75e5f94dc376bd8c704ee0431bdfe8af1b017facc2b883097.yml
-openapi_spec_hash: bb1d32ae5c46be85ee8bb3b13f5b1150
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-42c531dcf60b5d35e3996c1a669a3fe2de19d8caedf2bfd69e4864a1041c9bfa.yml
+openapi_spec_hash: e43dd84c75e6d710c7346b9f12c34738
config_hash: daabb160675d86b354711da1e77e5129
diff --git a/parse.go b/parse.go
index 3af9979..8fc2cbc 100644
--- a/parse.go
+++ b/parse.go
@@ -186,6 +186,13 @@ type ParseHandleParams struct {
Tags []string `query:"tags,omitzero" json:"-"`
// Extract only the main content from HTML-like inputs
UseMainContentOnly ParseHandleParamsUseMainContentOnlyUnion `query:"useMainContentOnly,omitzero" json:"-"`
+ // 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.
+ //
+ // Any of "enabled", "disabled".
+ Zdr ParseHandleParamsZdr `query:"zdr,omitzero" json:"-"`
paramObj
}
@@ -399,3 +406,14 @@ const (
ParseHandleParamsUseMainContentOnlyStringTrue ParseHandleParamsUseMainContentOnlyString = "true"
ParseHandleParamsUseMainContentOnlyStringFalse ParseHandleParamsUseMainContentOnlyString = "false"
)
+
+// 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.
+type ParseHandleParamsZdr string
+
+const (
+ ParseHandleParamsZdrEnabled ParseHandleParamsZdr = "enabled"
+ ParseHandleParamsZdrDisabled ParseHandleParamsZdr = "disabled"
+)
diff --git a/parse_test.go b/parse_test.go
index d8f7329..63cee25 100644
--- a/parse_test.go
+++ b/parse_test.go
@@ -54,6 +54,7 @@ func TestParseHandleWithOptionalParams(t *testing.T) {
UseMainContentOnly: contextdev.ParseHandleParamsUseMainContentOnlyUnion{
OfParseHandlesUseMainContentOnlyString: contextdev.String("true"),
},
+ Zdr: contextdev.ParseHandleParamsZdrEnabled,
},
)
if err != nil {
diff --git a/web.go b/web.go
index 3158c7a..b68658d 100644
--- a/web.go
+++ b/web.go
@@ -1125,7 +1125,8 @@ type WebScreenshotResponse struct {
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebScreenshotResponseKeyMetadata `json:"key_metadata"`
- // Public URL of the uploaded screenshot image
+ // Public image URL for standard requests, or an in-memory data URL when ZDR is
+ // enabled.
Screenshot string `json:"screenshot"`
// Type of screenshot that was captured
//
@@ -2621,6 +2622,13 @@ type WebScreenshotParams struct {
Tags []string `query:"tags,omitzero" json:"-"`
// Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
Viewport WebScreenshotParamsViewport `query:"viewport,omitzero" json:"-"`
+ // 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.
+ //
+ // Any of "enabled", "disabled".
+ Zdr WebScreenshotParamsZdr `query:"zdr,omitzero" json:"-"`
paramObj
}
@@ -2917,6 +2925,17 @@ func (r WebScreenshotParamsViewport) URLQuery() (v url.Values, err error) {
})
}
+// 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.
+type WebScreenshotParamsZdr string
+
+const (
+ WebScreenshotParamsZdrEnabled WebScreenshotParamsZdr = "enabled"
+ WebScreenshotParamsZdrDisabled WebScreenshotParamsZdr = "disabled"
+)
+
type WebSearchParams struct {
// Search query. Accepts natural language as well as Google-style search operators
// such as `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`.
@@ -3370,6 +3389,13 @@ type WebWebCrawlMdParams struct {
Pdf WebWebCrawlMdParamsPdf `json:"pdf,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
+ // 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.
+ //
+ // Any of "enabled", "disabled".
+ Zdr WebWebCrawlMdParamsZdr `json:"zdr,omitzero"`
paramObj
}
@@ -3619,6 +3645,17 @@ func (r *WebWebCrawlMdParamsPdf) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// 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.
+type WebWebCrawlMdParamsZdr string
+
+const (
+ WebWebCrawlMdParamsZdrEnabled WebWebCrawlMdParamsZdr = "enabled"
+ WebWebCrawlMdParamsZdrDisabled WebWebCrawlMdParamsZdr = "disabled"
+)
+
type WebWebScrapeHTMLParams struct {
// Full URL to scrape (must include http:// or https:// protocol)
URL string `query:"url" api:"required" format:"uri" json:"-"`
@@ -3682,6 +3719,13 @@ type WebWebScrapeHTMLParams struct {
// When true, return only the page's main content in the HTML response, excluding
// headers, footers, sidebars, and navigation when detectable.
UseMainContentOnly WebWebScrapeHTMLParamsUseMainContentOnlyUnion `query:"useMainContentOnly,omitzero" json:"-"`
+ // 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.
+ //
+ // Any of "enabled", "disabled".
+ Zdr WebWebScrapeHTMLParamsZdr `query:"zdr,omitzero" json:"-"`
paramObj
}
@@ -4022,6 +4066,17 @@ const (
WebWebScrapeHTMLParamsUseMainContentOnlyStringFalse WebWebScrapeHTMLParamsUseMainContentOnlyString = "false"
)
+// 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.
+type WebWebScrapeHTMLParamsZdr string
+
+const (
+ WebWebScrapeHTMLParamsZdrEnabled WebWebScrapeHTMLParamsZdr = "enabled"
+ WebWebScrapeHTMLParamsZdrDisabled WebWebScrapeHTMLParamsZdr = "disabled"
+)
+
type WebWebScrapeImagesParams struct {
// Page URL to inspect. Must include http:// or https://.
URL string `query:"url" api:"required" format:"uri" json:"-"`
@@ -4229,6 +4284,13 @@ type WebWebScrapeMdParams struct {
// Extract only the main content of the page, excluding headers, footers, sidebars,
// and navigation
UseMainContentOnly WebWebScrapeMdParamsUseMainContentOnlyUnion `query:"useMainContentOnly,omitzero" json:"-"`
+ // 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.
+ //
+ // Any of "enabled", "disabled".
+ Zdr WebWebScrapeMdParamsZdr `query:"zdr,omitzero" json:"-"`
paramObj
}
@@ -4623,6 +4685,17 @@ const (
WebWebScrapeMdParamsUseMainContentOnlyStringFalse WebWebScrapeMdParamsUseMainContentOnlyString = "false"
)
+// 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.
+type WebWebScrapeMdParamsZdr string
+
+const (
+ WebWebScrapeMdParamsZdrEnabled WebWebScrapeMdParamsZdr = "enabled"
+ WebWebScrapeMdParamsZdrDisabled WebWebScrapeMdParamsZdr = "disabled"
+)
+
type WebWebScrapeSitemapParams struct {
// Domain to build a sitemap for
Domain string `query:"domain" api:"required" json:"-"`
@@ -4647,6 +4720,13 @@ type WebWebScrapeSitemapParams struct {
// 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.
Tags []string `query:"tags,omitzero" json:"-"`
+ // 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.
+ //
+ // Any of "enabled", "disabled".
+ Zdr WebWebScrapeSitemapParamsZdr `query:"zdr,omitzero" json:"-"`
paramObj
}
@@ -4658,3 +4738,14 @@ func (r WebWebScrapeSitemapParams) URLQuery() (v url.Values, err error) {
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
+
+// 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.
+type WebWebScrapeSitemapParamsZdr string
+
+const (
+ WebWebScrapeSitemapParamsZdrEnabled WebWebScrapeSitemapParamsZdr = "enabled"
+ WebWebScrapeSitemapParamsZdrDisabled WebWebScrapeSitemapParamsZdr = "disabled"
+)
diff --git a/web_test.go b/web_test.go
index 1fdc6f9..f384844 100644
--- a/web_test.go
+++ b/web_test.go
@@ -180,6 +180,7 @@ func TestWebScreenshotWithOptionalParams(t *testing.T) {
Width: contextdev.Int(240),
},
WaitForMs: contextdev.Int(0),
+ Zdr: contextdev.WebScreenshotParamsZdrEnabled,
})
if err != nil {
var apierr *contextdev.Error
@@ -278,6 +279,7 @@ func TestWebWebCrawlMdWithOptionalParams(t *testing.T) {
URLRegex: contextdev.String("^https?://[^/]+/blog/"),
UseMainContentOnly: contextdev.Bool(true),
WaitForMs: contextdev.Int(0),
+ Zdr: contextdev.WebWebCrawlMdParamsZdrEnabled,
})
if err != nil {
var apierr *contextdev.Error
@@ -332,6 +334,7 @@ func TestWebWebScrapeHTMLWithOptionalParams(t *testing.T) {
OfWebWebScrapeHTMLsUseMainContentOnlyString: contextdev.String("true"),
},
WaitForMs: contextdev.Int(0),
+ Zdr: contextdev.WebWebScrapeHTMLParamsZdrEnabled,
})
if err != nil {
var apierr *contextdev.Error
@@ -442,6 +445,7 @@ func TestWebWebScrapeMdWithOptionalParams(t *testing.T) {
OfWebWebScrapeMdsUseMainContentOnlyString: contextdev.String("true"),
},
WaitForMs: contextdev.Int(0),
+ Zdr: contextdev.WebWebScrapeMdParamsZdrEnabled,
})
if err != nil {
var apierr *contextdev.Error
@@ -475,6 +479,7 @@ func TestWebWebScrapeSitemapWithOptionalParams(t *testing.T) {
Tags: []string{"production", "team-alpha"},
TimeoutMs: contextdev.Int(1),
URLRegex: contextdev.String("^https?://[^/]+/blog/"),
+ Zdr: contextdev.WebWebScrapeSitemapParamsZdrEnabled,
})
if err != nil {
var apierr *contextdev.Error
From 239344498e2419e37533abde86f3bdbd71de4cd9 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 22 Jul 2026 08:05:24 +0000
Subject: [PATCH 06/13] feat(api): manual updates
---
.stats.yml | 6 +--
api.md | 4 ++
monitor.go | 114 ++++++++++++++++++++++++++++++++++++++++++++++++
monitor_test.go | 49 +++++++++++++++++++++
4 files changed, 170 insertions(+), 3 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 231a6da..674523c 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 30
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-42c531dcf60b5d35e3996c1a669a3fe2de19d8caedf2bfd69e4864a1041c9bfa.yml
+configured_endpoints: 32
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d25300a20809f87d2069c1f4417b158b2e2d1cef3ca9b6bf7653e02233deba2c.yml
openapi_spec_hash: e43dd84c75e6d710c7346b9f12c34738
-config_hash: daabb160675d86b354711da1e77e5129
+config_hash: 70e7e80b5e87f94981bee396c6cd41e8
diff --git a/api.md b/api.md
index cae32ac..c4c1be1 100644
--- a/api.md
+++ b/api.md
@@ -93,6 +93,8 @@ Response Types:
- contextdev.MonitorUpdateResponse
- contextdev.MonitorListResponse
- contextdev.MonitorDeleteResponse
+- contextdev.MonitorGetCreditUsageResponse
+- contextdev.MonitorGetLimitsResponse
- contextdev.MonitorListAccountChangesResponse
- contextdev.MonitorListAccountRunsResponse
- contextdev.MonitorListChangesResponse
@@ -107,6 +109,8 @@ Methods:
- client.Monitors.Update(ctx context.Context, monitorID string, body contextdev.MonitorUpdateParams) (\*contextdev.MonitorUpdateResponse, error)
- client.Monitors.List(ctx context.Context, query contextdev.MonitorListParams) (\*contextdev.MonitorListResponse, error)
- client.Monitors.Delete(ctx context.Context, monitorID string) (\*contextdev.MonitorDeleteResponse, error)
+- client.Monitors.GetCreditUsage(ctx context.Context, query contextdev.MonitorGetCreditUsageParams) (\*contextdev.MonitorGetCreditUsageResponse, error)
+- client.Monitors.GetLimits(ctx context.Context) (\*contextdev.MonitorGetLimitsResponse, error)
- client.Monitors.ListAccountChanges(ctx context.Context, query contextdev.MonitorListAccountChangesParams) (\*contextdev.MonitorListAccountChangesResponse, error)
- client.Monitors.ListAccountRuns(ctx context.Context, query contextdev.MonitorListAccountRunsParams) (\*contextdev.MonitorListAccountRunsResponse, error)
- client.Monitors.ListChanges(ctx context.Context, monitorID string, query contextdev.MonitorListChangesParams) (\*contextdev.MonitorListChangesResponse, error)
diff --git a/monitor.go b/monitor.go
index 5ec8250..ff56ea2 100644
--- a/monitor.go
+++ b/monitor.go
@@ -103,6 +103,23 @@ func (r *MonitorService) Delete(ctx context.Context, monitorID string, opts ...o
return res, err
}
+// Returns credits charged per monitor over an optional [since, until] window,
+// newest spenders first.
+func (r *MonitorService) GetCreditUsage(ctx context.Context, query MonitorGetCreditUsageParams, opts ...option.RequestOption) (res *MonitorGetCreditUsageResponse, err error) {
+ opts = slices.Concat(r.options, opts)
+ path := "monitors/credit-usage"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
+ return res, err
+}
+
+// Returns how many monitors the account has and the maximum it allows.
+func (r *MonitorService) GetLimits(ctx context.Context, opts ...option.RequestOption) (res *MonitorGetLimitsResponse, err error) {
+ opts = slices.Concat(r.options, opts)
+ path := "monitors/limits"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
// Returns an account-wide feed of detected changes across monitors.
func (r *MonitorService) ListAccountChanges(ctx context.Context, query MonitorListAccountChangesParams, opts ...option.RequestOption) (res *MonitorListAccountChangesResponse, err error) {
opts = slices.Concat(r.options, opts)
@@ -2737,6 +2754,86 @@ func (r *MonitorDeleteResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+type MonitorGetCreditUsageResponse struct {
+ Data []MonitorGetCreditUsageResponseData `json:"data" api:"required"`
+ // Sum of credits across all monitors in the window.
+ TotalCredits int64 `json:"total_credits" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Data respjson.Field
+ TotalCredits respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r MonitorGetCreditUsageResponse) RawJSON() string { return r.JSON.raw }
+func (r *MonitorGetCreditUsageResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type MonitorGetCreditUsageResponseData struct {
+ // Credits charged to this monitor over the window.
+ Credits int64 `json:"credits" api:"required"`
+ MonitorID string `json:"monitor_id" api:"required"`
+ // Monitor name (falls back to the id when the monitor was deleted).
+ Name string `json:"name" api:"required"`
+ // Number of billed runs over the window.
+ Runs int64 `json:"runs" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Credits respjson.Field
+ MonitorID respjson.Field
+ Name respjson.Field
+ Runs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r MonitorGetCreditUsageResponseData) RawJSON() string { return r.JSON.raw }
+func (r *MonitorGetCreditUsageResponseData) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type MonitorGetLimitsResponse struct {
+ // Maximum number of monitors allowed for the account. Defaults to the plan
+ // allowance unless a custom limit is set for the organization.
+ MonitorsLimit int64 `json:"monitors_limit" api:"required"`
+ // Number of monitors the account currently has.
+ MonitorsUsed int64 `json:"monitors_used" api:"required"`
+ // The plan tier the limit was resolved from.
+ //
+ // Any of "free", "starter", "pro", "scale".
+ Plan MonitorGetLimitsResponsePlan `json:"plan" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ MonitorsLimit respjson.Field
+ MonitorsUsed respjson.Field
+ Plan respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r MonitorGetLimitsResponse) RawJSON() string { return r.JSON.raw }
+func (r *MonitorGetLimitsResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The plan tier the limit was resolved from.
+type MonitorGetLimitsResponsePlan string
+
+const (
+ MonitorGetLimitsResponsePlanFree MonitorGetLimitsResponsePlan = "free"
+ MonitorGetLimitsResponsePlanStarter MonitorGetLimitsResponsePlan = "starter"
+ MonitorGetLimitsResponsePlanPro MonitorGetLimitsResponsePlan = "pro"
+ MonitorGetLimitsResponsePlanScale MonitorGetLimitsResponsePlan = "scale"
+)
+
type MonitorListAccountChangesResponse struct {
Data []MonitorListAccountChangesResponseData `json:"data" api:"required"`
HasMore bool `json:"has_more" api:"required"`
@@ -4001,6 +4098,23 @@ const (
MonitorListParamsTargetTypeExtract MonitorListParamsTargetType = "extract"
)
+type MonitorGetCreditUsageParams struct {
+ // Only include items at or after this ISO 8601 timestamp.
+ Since param.Opt[time.Time] `query:"since,omitzero" format:"date-time" json:"-"`
+ // Only include items before this ISO 8601 timestamp.
+ Until param.Opt[time.Time] `query:"until,omitzero" format:"date-time" json:"-"`
+ paramObj
+}
+
+// URLQuery serializes [MonitorGetCreditUsageParams]'s query parameters as
+// `url.Values`.
+func (r MonitorGetCreditUsageParams) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
type MonitorListAccountChangesParams struct {
// Opaque pagination cursor from a previous response.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
diff --git a/monitor_test.go b/monitor_test.go
index ce8f60d..a3815bb 100644
--- a/monitor_test.go
+++ b/monitor_test.go
@@ -188,6 +188,55 @@ func TestMonitorDelete(t *testing.T) {
}
}
+func TestMonitorGetCreditUsageWithOptionalParams(t *testing.T) {
+ t.Skip("Mock server tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := contextdev.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("My API Key"),
+ )
+ _, err := client.Monitors.GetCreditUsage(context.TODO(), contextdev.MonitorGetCreditUsageParams{
+ Since: contextdev.Time(time.Now()),
+ Until: contextdev.Time(time.Now()),
+ })
+ if err != nil {
+ var apierr *contextdev.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestMonitorGetLimits(t *testing.T) {
+ t.Skip("Mock server tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := contextdev.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("My API Key"),
+ )
+ _, err := client.Monitors.GetLimits(context.TODO())
+ if err != nil {
+ var apierr *contextdev.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
func TestMonitorListAccountChangesWithOptionalParams(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
From 84373e15127ca042d019eb10a8e98bae8374af7d Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 22 Jul 2026 08:18:01 +0000
Subject: [PATCH 07/13] codegen metadata
---
.stats.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 674523c..1a4b898 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 32
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d25300a20809f87d2069c1f4417b158b2e2d1cef3ca9b6bf7653e02233deba2c.yml
-openapi_spec_hash: e43dd84c75e6d710c7346b9f12c34738
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-65d8d9d461368f72da68cd7606e0498cde07b586235769d8e3e04b7a3c42858d.yml
+openapi_spec_hash: 048da2b1bfe8095b6c2e805c515e20e2
config_hash: 70e7e80b5e87f94981bee396c6cd41e8
From 7d5e26434fa5c61c25197e247e4469fcc8e80d34 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 22 Jul 2026 08:31:49 +0000
Subject: [PATCH 08/13] feat(api): api update
---
.stats.yml | 4 ++--
monitor.go | 33 +++++++++++++++++++++------------
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 1a4b898..d1ed301 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 32
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-65d8d9d461368f72da68cd7606e0498cde07b586235769d8e3e04b7a3c42858d.yml
-openapi_spec_hash: 048da2b1bfe8095b6c2e805c515e20e2
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-48449a9e476c712dc65557934c8b97ac9708b06b7f96fa5c22d135037eeb9ce5.yml
+openapi_spec_hash: 6a0575b3dc2ea3e5d47c4961f0251213
config_hash: 70e7e80b5e87f94981bee396c6cd41e8
diff --git a/monitor.go b/monitor.go
index ff56ea2..db8204e 100644
--- a/monitor.go
+++ b/monitor.go
@@ -225,6 +225,7 @@ type MonitorNewResponse struct {
// When the next scheduled run is due.
NextRunAt time.Time `json:"next_run_at" api:"nullable" format:"date-time"`
// User-defined tags for grouping and filtering monitors and their changes.
+ // Duplicates are removed.
Tags []string `json:"tags"`
Webhook MonitorNewResponseWebhook `json:"webhook" api:"nullable"`
// Present while webhook deliveries are failing consecutively; null when deliveries
@@ -544,9 +545,9 @@ type MonitorNewResponseTargetSitemap struct {
Type constant.Sitemap `json:"type" default:"sitemap"`
// Sitemap URL to monitor.
URL string `json:"url" api:"required" format:"uri"`
- // URL path patterns to exclude.
+ // URL path patterns to exclude (max 50).
Exclude []string `json:"exclude"`
- // URL path patterns to include.
+ // URL path patterns to include (max 50).
Include []string `json:"include"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs int64 `json:"max_urls"`
@@ -862,6 +863,7 @@ type MonitorGetResponse struct {
// When the next scheduled run is due.
NextRunAt time.Time `json:"next_run_at" api:"nullable" format:"date-time"`
// User-defined tags for grouping and filtering monitors and their changes.
+ // Duplicates are removed.
Tags []string `json:"tags"`
Webhook MonitorGetResponseWebhook `json:"webhook" api:"nullable"`
// Present while webhook deliveries are failing consecutively; null when deliveries
@@ -1181,9 +1183,9 @@ type MonitorGetResponseTargetSitemap struct {
Type constant.Sitemap `json:"type" default:"sitemap"`
// Sitemap URL to monitor.
URL string `json:"url" api:"required" format:"uri"`
- // URL path patterns to exclude.
+ // URL path patterns to exclude (max 50).
Exclude []string `json:"exclude"`
- // URL path patterns to include.
+ // URL path patterns to include (max 50).
Include []string `json:"include"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs int64 `json:"max_urls"`
@@ -1499,6 +1501,7 @@ type MonitorUpdateResponse struct {
// When the next scheduled run is due.
NextRunAt time.Time `json:"next_run_at" api:"nullable" format:"date-time"`
// User-defined tags for grouping and filtering monitors and their changes.
+ // Duplicates are removed.
Tags []string `json:"tags"`
Webhook MonitorUpdateResponseWebhook `json:"webhook" api:"nullable"`
// Present while webhook deliveries are failing consecutively; null when deliveries
@@ -1819,9 +1822,9 @@ type MonitorUpdateResponseTargetSitemap struct {
Type constant.Sitemap `json:"type" default:"sitemap"`
// Sitemap URL to monitor.
URL string `json:"url" api:"required" format:"uri"`
- // URL path patterns to exclude.
+ // URL path patterns to exclude (max 50).
Exclude []string `json:"exclude"`
- // URL path patterns to include.
+ // URL path patterns to include (max 50).
Include []string `json:"include"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs int64 `json:"max_urls"`
@@ -2157,6 +2160,7 @@ type MonitorListResponseData struct {
// When the next scheduled run is due.
NextRunAt time.Time `json:"next_run_at" api:"nullable" format:"date-time"`
// User-defined tags for grouping and filtering monitors and their changes.
+ // Duplicates are removed.
Tags []string `json:"tags"`
Webhook MonitorListResponseDataWebhook `json:"webhook" api:"nullable"`
// Present while webhook deliveries are failing consecutively; null when deliveries
@@ -2458,9 +2462,9 @@ type MonitorListResponseDataTargetSitemap struct {
Type constant.Sitemap `json:"type" default:"sitemap"`
// Sitemap URL to monitor.
URL string `json:"url" api:"required" format:"uri"`
- // URL path patterns to exclude.
+ // URL path patterns to exclude (max 50).
Exclude []string `json:"exclude"`
- // URL path patterns to include.
+ // URL path patterns to include (max 50).
Include []string `json:"include"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs int64 `json:"max_urls"`
@@ -2882,6 +2886,7 @@ type MonitorListAccountChangesResponseData struct {
MatchedURLCount int64 `json:"matched_url_count"`
RemovedURLCount int64 `json:"removed_url_count"`
// User-defined tags for grouping and filtering monitors and their changes.
+ // Duplicates are removed.
Tags []string `json:"tags"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
@@ -3122,6 +3127,7 @@ type MonitorListChangesResponseData struct {
MatchedURLCount int64 `json:"matched_url_count"`
RemovedURLCount int64 `json:"removed_url_count"`
// User-defined tags for grouping and filtering monitors and their changes.
+ // Duplicates are removed.
Tags []string `json:"tags"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
@@ -3334,6 +3340,7 @@ type MonitorGetChangeResponse struct {
RunID string `json:"run_id" api:"required"`
Summary string `json:"summary" api:"required"`
// User-defined tags for grouping and filtering monitors and their changes.
+ // Duplicates are removed.
Tags []string `json:"tags" api:"required"`
// Any of "page", "sitemap", "extract".
TargetType MonitorGetChangeResponseTargetType `json:"target_type" api:"required"`
@@ -3485,6 +3492,7 @@ type MonitorNewParams struct {
// Any of "web".
Mode MonitorNewParamsMode `json:"mode,omitzero"`
// User-defined tags for grouping and filtering monitors and their changes.
+ // Duplicates are removed.
Tags []string `json:"tags,omitzero"`
paramObj
}
@@ -3657,9 +3665,9 @@ type MonitorNewParamsTargetSitemap struct {
URL string `json:"url" api:"required" format:"uri"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs param.Opt[int64] `json:"max_urls,omitzero"`
- // URL path patterns to exclude.
+ // URL path patterns to exclude (max 50).
Exclude []string `json:"exclude,omitzero"`
- // URL path patterns to include.
+ // URL path patterns to include (max 50).
Include []string `json:"include,omitzero"`
// This field can be elided, and will marshal its zero value as "sitemap".
Type constant.Sitemap `json:"type" default:"sitemap"`
@@ -3757,6 +3765,7 @@ type MonitorUpdateParams struct {
// Any of "active", "paused".
Status MonitorUpdateParamsStatus `json:"status,omitzero"`
// User-defined tags for grouping and filtering monitors and their changes.
+ // Duplicates are removed.
Tags []string `json:"tags,omitzero"`
// Discriminated union describing what the monitor watches.
Target MonitorUpdateParamsTargetUnion `json:"target,omitzero"`
@@ -3938,9 +3947,9 @@ type MonitorUpdateParamsTargetSitemap struct {
URL string `json:"url" api:"required" format:"uri"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs param.Opt[int64] `json:"max_urls,omitzero"`
- // URL path patterns to exclude.
+ // URL path patterns to exclude (max 50).
Exclude []string `json:"exclude,omitzero"`
- // URL path patterns to include.
+ // URL path patterns to include (max 50).
Include []string `json:"include,omitzero"`
// This field can be elided, and will marshal its zero value as "sitemap".
Type constant.Sitemap `json:"type" default:"sitemap"`
From 5f8b3b88b5fc7303a9fd2470ef9f1722e4c83350 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 22 Jul 2026 08:55:47 +0000
Subject: [PATCH 09/13] feat(api): api update
---
.stats.yml | 4 +-
shared/constant/constants.go | 6 +
web.go | 206 ++++++++++++++++++++++++++++++++---
web_test.go | 19 +++-
4 files changed, 218 insertions(+), 17 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index d1ed301..f41ab2e 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 32
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-48449a9e476c712dc65557934c8b97ac9708b06b7f96fa5c22d135037eeb9ce5.yml
-openapi_spec_hash: 6a0575b3dc2ea3e5d47c4961f0251213
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1ad134d4ef2ddefee790dc464dd2da3e4c0614652620b25fbb1379d8f5676526.yml
+openapi_spec_hash: 24809b018c6869838112f064e5558509
config_hash: 70e7e80b5e87f94981bee396c6cd41e8
diff --git a/shared/constant/constants.go b/shared/constant/constants.go
index b43d0b6..25a8648 100644
--- a/shared/constant/constants.go
+++ b/shared/constant/constants.go
@@ -27,8 +27,10 @@ type ByTransaction string // Always "by_transaction"
type Exact string // Always "exact"
type Extract string // Always "extract"
type Page string // Always "page"
+type Perform string // Always "perform"
type Semantic string // Always "semantic"
type Sitemap string // Always "sitemap"
+type Wait string // Always "wait"
func (c ByDirectURL) Default() ByDirectURL { return "by_direct_url" }
func (c ByDomain) Default() ByDomain { return "by_domain" }
@@ -39,8 +41,10 @@ func (c ByTransaction) Default() ByTransaction { return "by_transaction" }
func (c Exact) Default() Exact { return "exact" }
func (c Extract) Default() Extract { return "extract" }
func (c Page) Default() Page { return "page" }
+func (c Perform) Default() Perform { return "perform" }
func (c Semantic) Default() Semantic { return "semantic" }
func (c Sitemap) Default() Sitemap { return "sitemap" }
+func (c Wait) Default() Wait { return "wait" }
func (c ByDirectURL) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ByDomain) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -51,8 +55,10 @@ func (c ByTransaction) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Exact) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Extract) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Page) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Perform) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Semantic) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Sitemap) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Wait) MarshalJSON() ([]byte, error) { return marshalString(c) }
type constant[T any] interface {
Constant[T]
diff --git a/web.go b/web.go
index b68658d..6a67bd1 100644
--- a/web.go
+++ b/web.go
@@ -15,6 +15,7 @@ import (
"github.com/context-dot-dev/context-go-sdk/v2/option"
"github.com/context-dot-dev/context-go-sdk/v2/packages/param"
"github.com/context-dot-dev/context-go-sdk/v2/packages/respjson"
+ "github.com/context-dot-dev/context-go-sdk/v2/shared/constant"
)
// WebService contains methods and other services that help with interacting with
@@ -97,7 +98,8 @@ func (r *WebService) WebCrawlMd(ctx context.Context, body WebWebCrawlMdParams, o
return res, err
}
-// Scrapes the given URL and returns the raw HTML content of the page.
+// Scrapes the given URL and returns the raw HTML content of the page. The base
+// request costs 1 credit; requests with browser actions cost 2 credits.
func (r *WebService) WebScrapeHTML(ctx context.Context, query WebWebScrapeHTMLParams, opts ...option.RequestOption) (res *WebWebScrapeHTMLResponse, err error) {
opts = slices.Concat(r.options, opts)
path := "web/scrape/html"
@@ -107,8 +109,9 @@ func (r *WebService) WebScrapeHTML(ctx context.Context, query WebWebScrapeHTMLPa
// Extract image assets from a web page, including standard URLs, inline SVGs, data
// URIs, responsive image sources, metadata, CSS backgrounds, video posters, and
-// embeds. The base request costs 1 credit. When enrichment is enabled, the entire
-// call costs 5 credits.
+// embeds. The base request costs 1 credit, or 2 credits with browser actions. When
+// enrichment is enabled, the entire call costs 5 credits, including requests that
+// also use actions.
func (r *WebService) WebScrapeImages(ctx context.Context, query WebWebScrapeImagesParams, opts ...option.RequestOption) (res *WebWebScrapeImagesResponse, err error) {
opts = slices.Concat(r.options, opts)
path := "web/scrape/images"
@@ -122,16 +125,16 @@ func (r *WebService) WebScrapeImages(ctx context.Context, query WebWebScrapeImag
//
// ### Billing & errors
//
-// | HTTP status | Billed? | Meaning |
-// | ----------- | -------------- | ---------------------------------------------------------------------------------------- |
-// | 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing |
-// | 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
-// | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
-// | 404 | No | Target page returned or fingerprinted as not found |
-// | 408 | No | Request timed out |
-// | 415 | No | Unsupported content type |
-// | 429 | No | Per-minute rate limit exceeded; honor Retry-After |
-// | 500 | No | Internal error |
+// | HTTP status | Billed? | Meaning |
+// | ----------- | ----------------------------------------- | ---------------------------------------------------------------------------------------- |
+// | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing |
+// | 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
+// | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
+// | 404 | No | Target page returned or fingerprinted as not found |
+// | 408 | No | Request timed out |
+// | 415 | No | Unsupported content type |
+// | 429 | No | Per-minute rate limit exceeded; honor Retry-After |
+// | 500 | No | Internal error |
func (r *WebService) WebScrapeMd(ctx context.Context, query WebWebScrapeMdParams, opts ...option.RequestOption) (res *WebWebScrapeMdResponse, err error) {
opts = slices.Concat(r.options, opts)
path := "web/scrape/markdown"
@@ -3670,6 +3673,10 @@ type WebWebScrapeHTMLParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
+ // 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.
+ Actions []WebWebScrapeHTMLParamsActionUnion `query:"actions,omitzero" json:"-"`
// CSS selectors to remove from the result. Applied after includeSelectors.
// Exclusion takes precedence: an element matching both is removed. Examples:
// "nav", "footer", ".ad-banner", "[aria-hidden=true]".
@@ -3737,6 +3744,61 @@ func (r WebWebScrapeHTMLParams) URLQuery() (v url.Values, err error) {
})
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeHTMLParamsActionUnion struct {
+ OfWait *WebWebScrapeHTMLParamsActionWait `query:",omitzero,inline"`
+ OfPerform *WebWebScrapeHTMLParamsActionPerform `query:",omitzero,inline"`
+ paramUnion
+}
+
+func init() {
+ apijson.RegisterUnion[WebWebScrapeHTMLParamsActionUnion](
+ "do",
+ apijson.Discriminator[WebWebScrapeHTMLParamsActionWait]("wait"),
+ apijson.Discriminator[WebWebScrapeHTMLParamsActionPerform]("perform"),
+ )
+}
+
+// Pause for a fixed number of milliseconds before continuing to the next action.
+//
+// The properties Do, TimeMs are required.
+type WebWebScrapeHTMLParamsActionWait struct {
+ TimeMs int64 `query:"timeMs" api:"required" json:"-"`
+ // This field can be elided, and will marshal its zero value as "wait".
+ Do constant.Wait `query:"do" json:"-" default:"wait"`
+ paramObj
+}
+
+// URLQuery serializes [WebWebScrapeHTMLParamsActionWait]'s query parameters as
+// `url.Values`.
+func (r WebWebScrapeHTMLParamsActionWait) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+// Resolve and perform one natural-language browser action.
+//
+// The properties Action, Do are required.
+type WebWebScrapeHTMLParamsActionPerform struct {
+ Action string `query:"action" api:"required" json:"-"`
+ // This field can be elided, and will marshal its zero value as "perform".
+ Do constant.Perform `query:"do" json:"-" default:"perform"`
+ paramObj
+}
+
+// URLQuery serializes [WebWebScrapeHTMLParamsActionPerform]'s query parameters as
+// `url.Values`.
+func (r WebWebScrapeHTMLParamsActionPerform) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
// Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
// residential proxy exit location. Must be one of Context.dev's supported
// countries. When provided, Context.dev fetches the target page from that country.
@@ -4090,6 +4152,10 @@ type WebWebScrapeImagesParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
+ // 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.
+ Actions []WebWebScrapeImagesParamsActionUnion `query:"actions,omitzero" json:"-"`
// Optional per-image processing, sent as deep-object query params such as
// enrichment[resolution]=true.
Enrichment WebWebScrapeImagesParamsEnrichment `query:"enrichment,omitzero" json:"-"`
@@ -4118,6 +4184,61 @@ func (r WebWebScrapeImagesParams) URLQuery() (v url.Values, err error) {
})
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeImagesParamsActionUnion struct {
+ OfWait *WebWebScrapeImagesParamsActionWait `query:",omitzero,inline"`
+ OfPerform *WebWebScrapeImagesParamsActionPerform `query:",omitzero,inline"`
+ paramUnion
+}
+
+func init() {
+ apijson.RegisterUnion[WebWebScrapeImagesParamsActionUnion](
+ "do",
+ apijson.Discriminator[WebWebScrapeImagesParamsActionWait]("wait"),
+ apijson.Discriminator[WebWebScrapeImagesParamsActionPerform]("perform"),
+ )
+}
+
+// Pause for a fixed number of milliseconds before continuing to the next action.
+//
+// The properties Do, TimeMs are required.
+type WebWebScrapeImagesParamsActionWait struct {
+ TimeMs int64 `query:"timeMs" api:"required" json:"-"`
+ // This field can be elided, and will marshal its zero value as "wait".
+ Do constant.Wait `query:"do" json:"-" default:"wait"`
+ paramObj
+}
+
+// URLQuery serializes [WebWebScrapeImagesParamsActionWait]'s query parameters as
+// `url.Values`.
+func (r WebWebScrapeImagesParamsActionWait) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+// Resolve and perform one natural-language browser action.
+//
+// The properties Action, Do are required.
+type WebWebScrapeImagesParamsActionPerform struct {
+ Action string `query:"action" api:"required" json:"-"`
+ // This field can be elided, and will marshal its zero value as "perform".
+ Do constant.Perform `query:"do" json:"-" default:"perform"`
+ paramObj
+}
+
+// URLQuery serializes [WebWebScrapeImagesParamsActionPerform]'s query parameters
+// as `url.Values`.
+func (r WebWebScrapeImagesParamsActionPerform) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
@@ -4229,6 +4350,10 @@ type WebWebScrapeMdParams struct {
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
+ // 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.
+ Actions []WebWebScrapeMdParamsActionUnion `query:"actions,omitzero" json:"-"`
// CSS selectors to remove before conversion to Markdown. Applied after
// includeSelectors. Exclusion takes precedence: an element matching both is
// removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".
@@ -4302,6 +4427,61 @@ func (r WebWebScrapeMdParams) URLQuery() (v url.Values, err error) {
})
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type WebWebScrapeMdParamsActionUnion struct {
+ OfWait *WebWebScrapeMdParamsActionWait `query:",omitzero,inline"`
+ OfPerform *WebWebScrapeMdParamsActionPerform `query:",omitzero,inline"`
+ paramUnion
+}
+
+func init() {
+ apijson.RegisterUnion[WebWebScrapeMdParamsActionUnion](
+ "do",
+ apijson.Discriminator[WebWebScrapeMdParamsActionWait]("wait"),
+ apijson.Discriminator[WebWebScrapeMdParamsActionPerform]("perform"),
+ )
+}
+
+// Pause for a fixed number of milliseconds before continuing to the next action.
+//
+// The properties Do, TimeMs are required.
+type WebWebScrapeMdParamsActionWait struct {
+ TimeMs int64 `query:"timeMs" api:"required" json:"-"`
+ // This field can be elided, and will marshal its zero value as "wait".
+ Do constant.Wait `query:"do" json:"-" default:"wait"`
+ paramObj
+}
+
+// URLQuery serializes [WebWebScrapeMdParamsActionWait]'s query parameters as
+// `url.Values`.
+func (r WebWebScrapeMdParamsActionWait) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+// Resolve and perform one natural-language browser action.
+//
+// The properties Action, Do are required.
+type WebWebScrapeMdParamsActionPerform struct {
+ Action string `query:"action" api:"required" json:"-"`
+ // This field can be elided, and will marshal its zero value as "perform".
+ Do constant.Perform `query:"do" json:"-" default:"perform"`
+ paramObj
+}
+
+// URLQuery serializes [WebWebScrapeMdParamsActionPerform]'s query parameters as
+// `url.Values`.
+func (r WebWebScrapeMdParamsActionPerform) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
// Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
// residential proxy exit location. Must be one of Context.dev's supported
// countries. When provided, Context.dev fetches the target page from that country.
diff --git a/web_test.go b/web_test.go
index f384844..11779f3 100644
--- a/web_test.go
+++ b/web_test.go
@@ -304,7 +304,12 @@ func TestWebWebScrapeHTMLWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Web.WebScrapeHTML(context.TODO(), contextdev.WebWebScrapeHTMLParams{
- URL: "https://example.com",
+ URL: "https://example.com",
+ Actions: []contextdev.WebWebScrapeHTMLParamsActionUnion{{
+ OfWait: &contextdev.WebWebScrapeHTMLParamsActionWait{
+ TimeMs: 0,
+ },
+ }},
Country: contextdev.WebWebScrapeHTMLParamsCountryDe,
ExcludeSelectors: []string{"x"},
Headers: map[string]string{
@@ -360,6 +365,11 @@ func TestWebWebScrapeImagesWithOptionalParams(t *testing.T) {
)
_, err := client.Web.WebScrapeImages(context.TODO(), contextdev.WebWebScrapeImagesParams{
URL: "https://example.com",
+ Actions: []contextdev.WebWebScrapeImagesParamsActionUnion{{
+ OfWait: &contextdev.WebWebScrapeImagesParamsActionWait{
+ TimeMs: 0,
+ },
+ }},
Dedupe: contextdev.WebWebScrapeImagesParamsDedupeUnion{
OfWebWebScrapeImagessDedupeString: contextdev.String("true"),
},
@@ -406,7 +416,12 @@ func TestWebWebScrapeMdWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Web.WebScrapeMd(context.TODO(), contextdev.WebWebScrapeMdParams{
- URL: "https://example.com",
+ URL: "https://example.com",
+ Actions: []contextdev.WebWebScrapeMdParamsActionUnion{{
+ OfWait: &contextdev.WebWebScrapeMdParamsActionWait{
+ TimeMs: 0,
+ },
+ }},
Country: contextdev.WebWebScrapeMdParamsCountryDe,
ExcludeSelectors: []string{"x"},
Headers: map[string]string{
From 3baa0cfa214e2d9faa11d7dbdfa39181251dd58e Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 22 Jul 2026 09:18:01 +0000
Subject: [PATCH 10/13] codegen metadata
---
.stats.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index f41ab2e..dd88a66 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 32
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1ad134d4ef2ddefee790dc464dd2da3e4c0614652620b25fbb1379d8f5676526.yml
-openapi_spec_hash: 24809b018c6869838112f064e5558509
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4dea765de04ef16556290055d83312b58e0dc16586e9a717d378dc451f068113.yml
+openapi_spec_hash: e4c702985962f8e35fffffcc821700b6
config_hash: 70e7e80b5e87f94981bee396c6cd41e8
From 86887cdaae4594901cf9fafcfb3236a1ae53226a Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 22 Jul 2026 18:06:15 +0000
Subject: [PATCH 11/13] codegen metadata
---
.stats.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index dd88a66..53999f4 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 32
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4dea765de04ef16556290055d83312b58e0dc16586e9a717d378dc451f068113.yml
-openapi_spec_hash: e4c702985962f8e35fffffcc821700b6
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ce19e3abfe1f07d4a615d2fb35666e99f7918b821dfc270b38bfd9c0de39fc4e.yml
+openapi_spec_hash: 71623548f792037a7f13fb693b41e217
config_hash: 70e7e80b5e87f94981bee396c6cd41e8
From 6a1114374f33686faefa43314e5ab5eb9910b684 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 22 Jul 2026 18:45:31 +0000
Subject: [PATCH 12/13] feat(api): api update
---
.stats.yml | 4 +-
api.md | 1 +
monitor.go | 197 ++++++++++++++++++++++-------------------------------
3 files changed, 84 insertions(+), 118 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 53999f4..0ac1eb3 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 32
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ce19e3abfe1f07d4a615d2fb35666e99f7918b821dfc270b38bfd9c0de39fc4e.yml
-openapi_spec_hash: 71623548f792037a7f13fb693b41e217
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-242450ea46eb8c3e843fd6c4bf87e73192b5f62f6da697cd091d13c6aa7a991b.yml
+openapi_spec_hash: c1c561976de1abcacede71fd5ab9b3d9
config_hash: 70e7e80b5e87f94981bee396c6cd41e8
diff --git a/api.md b/api.md
index c4c1be1..a249d25 100644
--- a/api.md
+++ b/api.md
@@ -88,6 +88,7 @@ Methods:
Response Types:
+- contextdev.WebhookDelivery
- contextdev.MonitorNewResponse
- contextdev.MonitorGetResponse
- contextdev.MonitorUpdateResponse
diff --git a/monitor.go b/monitor.go
index db8204e..30e4f69 100644
--- a/monitor.go
+++ b/monitor.go
@@ -185,6 +185,83 @@ func (r *MonitorService) Run(ctx context.Context, monitorID string, opts ...opti
return res, err
}
+type WebhookDelivery struct {
+ AttemptedAt time.Time `json:"attempted_at" api:"required" format:"date-time"`
+ Error WebhookDeliveryError `json:"error" api:"required"`
+ // The event this delivery carried. Deliveries recorded before event selection
+ // existed report change.detected.
+ //
+ // Any of "change.detected", "run.completed".
+ Event WebhookDeliveryEvent `json:"event" api:"required"`
+ // Identifier sent in the X-Context-Id header.
+ EventID string `json:"event_id" api:"required"`
+ // The endpoint's final HTTP response status, or null when no response was
+ // received.
+ HTTPStatus int64 `json:"http_status" api:"required"`
+ // Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
+ // response; failed means no HTTP response was received; skipped_unsafe_url means
+ // the URL failed the public-endpoint safety check.
+ //
+ // Any of "delivered", "rejected", "failed", "skipped_unsafe_url".
+ Status WebhookDeliveryStatus `json:"status" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AttemptedAt respjson.Field
+ Error respjson.Field
+ Event respjson.Field
+ EventID respjson.Field
+ HTTPStatus respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r WebhookDelivery) RawJSON() string { return r.JSON.raw }
+func (r *WebhookDelivery) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type WebhookDeliveryError struct {
+ Code string `json:"code" api:"required"`
+ Message string `json:"message" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r WebhookDeliveryError) RawJSON() string { return r.JSON.raw }
+func (r *WebhookDeliveryError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The event this delivery carried. Deliveries recorded before event selection
+// existed report change.detected.
+type WebhookDeliveryEvent string
+
+const (
+ WebhookDeliveryEventChangeDetected WebhookDeliveryEvent = "change.detected"
+ WebhookDeliveryEventRunCompleted WebhookDeliveryEvent = "run.completed"
+)
+
+// Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
+// response; failed means no HTTP response was received; skipped_unsafe_url means
+// the URL failed the public-endpoint safety check.
+type WebhookDeliveryStatus string
+
+const (
+ WebhookDeliveryStatusDelivered WebhookDeliveryStatus = "delivered"
+ WebhookDeliveryStatusRejected WebhookDeliveryStatus = "rejected"
+ WebhookDeliveryStatusFailed WebhookDeliveryStatus = "failed"
+ WebhookDeliveryStatusSkippedUnsafeURL WebhookDeliveryStatus = "skipped_unsafe_url"
+)
+
// A web monitor. `mode` is the constant `web`; behavior is described by `target`
// (page/sitemap/extract) and `change_detection` (exact/semantic).
type MonitorNewResponse struct {
@@ -2969,13 +3046,13 @@ type MonitorListAccountRunsResponseData struct {
// All webhook deliveries attempted by this run — one per subscribed event that
// fired. Omitted when no webhook was attempted, including runs created before
// event selection was added.
- WebhookDeliveries []MonitorListAccountRunsResponseDataWebhookDelivery `json:"webhook_deliveries"`
+ WebhookDeliveries []WebhookDelivery `json:"webhook_deliveries"`
// Deprecated: use `webhook_deliveries`, which records every attempt now that a run
// can deliver multiple events. Omitted when no webhook was attempted, including
// historical runs created before delivery tracking was added.
//
// Deprecated: deprecated
- WebhookDelivery MonitorListAccountRunsResponseDataWebhookDelivery `json:"webhook_delivery"`
+ WebhookDelivery WebhookDelivery `json:"webhook_delivery"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
@@ -3023,62 +3100,6 @@ func (r *MonitorListAccountRunsResponseDataError) UnmarshalJSON(data []byte) err
return apijson.UnmarshalRoot(data, r)
}
-type MonitorListAccountRunsResponseDataWebhookDelivery struct {
- AttemptedAt time.Time `json:"attempted_at" api:"required" format:"date-time"`
- Error MonitorListAccountRunsResponseDataWebhookDeliveryError `json:"error" api:"required"`
- // The event this delivery carried. Deliveries recorded before event selection
- // existed report change.detected.
- //
- // Any of "change.detected", "run.completed".
- Event string `json:"event" api:"required"`
- // Identifier sent in the X-Context-Id header.
- EventID string `json:"event_id" api:"required"`
- // The endpoint's final HTTP response status, or null when no response was
- // received.
- HTTPStatus int64 `json:"http_status" api:"required"`
- // Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
- // response; failed means no HTTP response was received; skipped_unsafe_url means
- // the URL failed the public-endpoint safety check.
- //
- // Any of "delivered", "rejected", "failed", "skipped_unsafe_url".
- Status string `json:"status" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- AttemptedAt respjson.Field
- Error respjson.Field
- Event respjson.Field
- EventID respjson.Field
- HTTPStatus respjson.Field
- Status respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r MonitorListAccountRunsResponseDataWebhookDelivery) RawJSON() string { return r.JSON.raw }
-func (r *MonitorListAccountRunsResponseDataWebhookDelivery) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type MonitorListAccountRunsResponseDataWebhookDeliveryError struct {
- Code string `json:"code" api:"required"`
- Message string `json:"message" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Code respjson.Field
- Message respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r MonitorListAccountRunsResponseDataWebhookDeliveryError) RawJSON() string { return r.JSON.raw }
-func (r *MonitorListAccountRunsResponseDataWebhookDeliveryError) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type MonitorListChangesResponse struct {
Data []MonitorListChangesResponseData `json:"data" api:"required"`
HasMore bool `json:"has_more" api:"required"`
@@ -3210,13 +3231,13 @@ type MonitorListRunsResponseData struct {
// All webhook deliveries attempted by this run — one per subscribed event that
// fired. Omitted when no webhook was attempted, including runs created before
// event selection was added.
- WebhookDeliveries []MonitorListRunsResponseDataWebhookDelivery `json:"webhook_deliveries"`
+ WebhookDeliveries []WebhookDelivery `json:"webhook_deliveries"`
// Deprecated: use `webhook_deliveries`, which records every attempt now that a run
// can deliver multiple events. Omitted when no webhook was attempted, including
// historical runs created before delivery tracking was added.
//
// Deprecated: deprecated
- WebhookDelivery MonitorListRunsResponseDataWebhookDelivery `json:"webhook_delivery"`
+ WebhookDelivery WebhookDelivery `json:"webhook_delivery"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
@@ -3264,62 +3285,6 @@ func (r *MonitorListRunsResponseDataError) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type MonitorListRunsResponseDataWebhookDelivery struct {
- AttemptedAt time.Time `json:"attempted_at" api:"required" format:"date-time"`
- Error MonitorListRunsResponseDataWebhookDeliveryError `json:"error" api:"required"`
- // The event this delivery carried. Deliveries recorded before event selection
- // existed report change.detected.
- //
- // Any of "change.detected", "run.completed".
- Event string `json:"event" api:"required"`
- // Identifier sent in the X-Context-Id header.
- EventID string `json:"event_id" api:"required"`
- // The endpoint's final HTTP response status, or null when no response was
- // received.
- HTTPStatus int64 `json:"http_status" api:"required"`
- // Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
- // response; failed means no HTTP response was received; skipped_unsafe_url means
- // the URL failed the public-endpoint safety check.
- //
- // Any of "delivered", "rejected", "failed", "skipped_unsafe_url".
- Status string `json:"status" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- AttemptedAt respjson.Field
- Error respjson.Field
- Event respjson.Field
- EventID respjson.Field
- HTTPStatus respjson.Field
- Status respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r MonitorListRunsResponseDataWebhookDelivery) RawJSON() string { return r.JSON.raw }
-func (r *MonitorListRunsResponseDataWebhookDelivery) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type MonitorListRunsResponseDataWebhookDeliveryError struct {
- Code string `json:"code" api:"required"`
- Message string `json:"message" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Code respjson.Field
- Message respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r MonitorListRunsResponseDataWebhookDeliveryError) RawJSON() string { return r.JSON.raw }
-func (r *MonitorListRunsResponseDataWebhookDeliveryError) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// A detected change. `mode` is the constant `web`; `target_type` and
// `change_detection_type` describe the change, and which optional fields are
// present depends on them (page: `diff` + excerpts; sitemap:
From 4919b2e7adebda06973c29a858a2bd2fd9c20dfe Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 22 Jul 2026 18:45:52 +0000
Subject: [PATCH 13/13] release: 2.5.0
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 16 ++++++++++++++++
README.md | 2 +-
internal/version.go | 2 +-
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index b44b287..4dedeae 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "2.4.0"
+ ".": "2.5.0"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4fa1d96..6617357 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,21 @@
# Changelog
+## 2.5.0 (2026-07-22)
+
+Full Changelog: [v2.4.0...v2.5.0](https://github.com/context-dot-dev/context-go-sdk/compare/v2.4.0...v2.5.0)
+
+### Features
+
+* **api:** api update ([6a11143](https://github.com/context-dot-dev/context-go-sdk/commit/6a1114374f33686faefa43314e5ab5eb9910b684))
+* **api:** api update ([5f8b3b8](https://github.com/context-dot-dev/context-go-sdk/commit/5f8b3b88b5fc7303a9fd2470ef9f1722e4c83350))
+* **api:** api update ([7d5e264](https://github.com/context-dot-dev/context-go-sdk/commit/7d5e26434fa5c61c25197e247e4469fcc8e80d34))
+* **api:** api update ([9440d43](https://github.com/context-dot-dev/context-go-sdk/commit/9440d43b6b1e207d22d7bb97d2eb2306495136ee))
+* **api:** api update ([533ef0c](https://github.com/context-dot-dev/context-go-sdk/commit/533ef0c9994e843f48bc3a73e5aca2247de860b1))
+* **api:** api update ([315e065](https://github.com/context-dot-dev/context-go-sdk/commit/315e06525a23999f3f827eb370df436958ef79a5))
+* **api:** api update ([d58b30f](https://github.com/context-dot-dev/context-go-sdk/commit/d58b30faedbb676b274b8d015be903e9413963d3))
+* **api:** manual updates ([2393444](https://github.com/context-dot-dev/context-go-sdk/commit/239344498e2419e37533abde86f3bdbd71de4cd9))
+* **stlc:** configurable CI runner and private-production-repo support in workflow templates ([d1d221e](https://github.com/context-dot-dev/context-go-sdk/commit/d1d221e22674292de1ba5e39d5ec6f4adf156850))
+
## 2.4.0 (2026-07-12)
Full Changelog: [v2.3.0...v2.4.0](https://github.com/context-dot-dev/context-go-sdk/compare/v2.3.0...v2.4.0)
diff --git a/README.md b/README.md
index 3c45934..27d1523 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@ Or to pin the version:
```sh
-go get -u 'github.com/context-dot-dev/context-go-sdk@v2.4.0'
+go get -u 'github.com/context-dot-dev/context-go-sdk@v2.5.0'
```
diff --git a/internal/version.go b/internal/version.go
index eaba12d..0d6e599 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "2.4.0" // x-release-please-version
+const PackageVersion = "2.5.0" // x-release-please-version