From 3b1baa304001d8c24dea89451a4a8dec1f9164ef Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2026 16:11:21 +0000 Subject: [PATCH 1/4] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ad6cd80..60019de 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2c3f4e4b357ca78c019a3aacd006e2bb8b332d4172a300ee6c46c076a216ed3f.yml -openapi_spec_hash: b89be415cf6ee594b521885a9deb25ac +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-05ba8ca01ab3b765bfdca4cdc99248d3169cf4fef049d0ddcf11a807cbf72a08.yml +openapi_spec_hash: 565724dda1e870c0d0469953514ca767 config_hash: 0fb0ceca5946298c416cec0cca5260c7 From e1a54e55ccde50fcea3fc4bbe1e97b5d2162c115 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2026 22:06:07 +0000 Subject: [PATCH 2/4] feat(api): api update --- .stats.yml | 4 ++-- brand.go | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 60019de..56757d6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-05ba8ca01ab3b765bfdca4cdc99248d3169cf4fef049d0ddcf11a807cbf72a08.yml -openapi_spec_hash: 565724dda1e870c0d0469953514ca767 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8be9b7cfe70702af909241420da1c61ba6b248345c5faec3b472df540bc6a553.yml +openapi_spec_hash: f98fb82a9ad562fc04d32f7063182de8 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/brand.go b/brand.go index 5306aa2..69c2a1b 100644 --- a/brand.go +++ b/brand.go @@ -115,7 +115,9 @@ type BrandGetResponseBrand struct { IsNsfw bool `json:"is_nsfw"` // Important website links for the brand Links BrandGetResponseBrandLinks `json:"links"` - // An array of logos associated with the brand + // An array of logos associated with the brand. When a similarly shaped SVG variant + // exists, it is returned ahead of its raster equivalent; otherwise relevance order + // is preserved Logos []BrandGetResponseBrandLogo `json:"logos"` // Company phone number Phone string `json:"phone"` From c233a908067726773a2121685f4846fb7cb6a338 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2026 02:55:21 +0000 Subject: [PATCH 3/4] feat(api): api update --- .stats.yml | 4 +- README.md | 2 +- ai.go | 70 +++++++++- batch.go | 113 +++++++++++++---- brand.go | 82 ++++++++++-- usage_test.go | 2 +- web.go | 345 +++++++++++++++++++++++++++++++++++++++++++++----- 7 files changed, 543 insertions(+), 75 deletions(-) diff --git a/.stats.yml b/.stats.yml index 56757d6..9aabd7d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8be9b7cfe70702af909241420da1c61ba6b248345c5faec3b472df540bc6a553.yml -openapi_spec_hash: f98fb82a9ad562fc04d32f7063182de8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-dc61df29e1b6282f9df685fadd65f3683afe352deccae94d0c080092e0eae4b3.yml +openapi_spec_hash: 258caa98cd0de5f7149f6937d071c912 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/README.md b/README.md index 22c70eb..8282754 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ func main() { if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", brand.Brand) + fmt.Printf("%+v\n", brand.CacheMetadata) } ``` diff --git a/ai.go b/ai.go index b6ec0be..6b679e8 100644 --- a/ai.go +++ b/ai.go @@ -53,6 +53,10 @@ func (r *AIService) ExtractProducts(ctx context.Context, body AIExtractProductsP } type AIExtractProductResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata AIExtractProductResponseCacheMetadata `json:"cache_metadata" api:"required"` // Whether the given URL is a product detail page IsProductPage bool `json:"is_product_page"` // Metadata about the API key used for the request. Included in every response @@ -66,6 +70,7 @@ type AIExtractProductResponse struct { Product AIExtractProductResponseProduct `json:"product" api:"nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { + CacheMetadata respjson.Field IsProductPage respjson.Field KeyMetadata respjson.Field Platform respjson.Field @@ -81,6 +86,32 @@ func (r *AIExtractProductResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type AIExtractProductResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r AIExtractProductResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *AIExtractProductResponseCacheMetadata) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + // 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. type AIExtractProductResponseKeyMetadata struct { @@ -187,6 +218,10 @@ func (r *AIExtractProductResponseProduct) UnmarshalJSON(data []byte) error { } type AIExtractProductsResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata AIExtractProductsResponseCacheMetadata `json:"cache_metadata" api:"required"` // 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 AIExtractProductsResponseKeyMetadata `json:"key_metadata"` @@ -194,10 +229,11 @@ type AIExtractProductsResponse struct { Products []AIExtractProductsResponseProduct `json:"products"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - KeyMetadata respjson.Field - Products respjson.Field - ExtraFields map[string]respjson.Field - raw string + CacheMetadata respjson.Field + KeyMetadata respjson.Field + Products respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -207,6 +243,32 @@ func (r *AIExtractProductsResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type AIExtractProductsResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r AIExtractProductsResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *AIExtractProductsResponseCacheMetadata) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + // 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. type AIExtractProductsResponseKeyMetadata struct { diff --git a/batch.go b/batch.go index ef55257..6785066 100644 --- a/batch.go +++ b/batch.go @@ -1054,6 +1054,8 @@ func (r *BatchGetResultsResponse) UnmarshalJSON(data []byte) error { // // Use the methods beginning with 'As' to cast the union to one of its variants. type BatchGetResultsResponseDataUnion struct { + // This field is from variant [BatchGetResultsResponseDataOk]. + CacheMetadata BatchGetResultsResponseDataOkCacheMetadata `json:"cache_metadata"` // This field is from variant [BatchGetResultsResponseDataOk]. FinalURL string `json:"final_url"` // This field is from variant [BatchGetResultsResponseDataOk]. @@ -1076,19 +1078,20 @@ type BatchGetResultsResponseDataUnion struct { // This field is from variant [BatchGetResultsResponseDataError]. Message string `json:"message"` JSON struct { - FinalURL respjson.Field - HTTPStatus respjson.Field - Metadata respjson.Field - Status respjson.Field - URL respjson.Field - HTML respjson.Field - ItemID respjson.Field - Markdown respjson.Field - Meta respjson.Field - OcrPages respjson.Field - ErrorCode respjson.Field - Message respjson.Field - raw string + CacheMetadata respjson.Field + FinalURL respjson.Field + HTTPStatus respjson.Field + Metadata respjson.Field + Status respjson.Field + URL respjson.Field + HTML respjson.Field + ItemID respjson.Field + Markdown respjson.Field + Meta respjson.Field + OcrPages respjson.Field + ErrorCode respjson.Field + Message respjson.Field + raw string } `json:"-"` } @@ -1139,6 +1142,10 @@ func (r *BatchGetResultsResponseDataUnion) UnmarshalJSON(data []byte) error { // A page the batch fetched successfully. type BatchGetResultsResponseDataOk struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata BatchGetResultsResponseDataOkCacheMetadata `json:"cache_metadata" api:"required"` // URL the content was read from, after redirects. FinalURL string `json:"final_url" api:"required"` // HTTP status of the final response, when known. @@ -1163,24 +1170,51 @@ type BatchGetResultsResponseDataOk struct { OcrPages int64 `json:"ocr_pages"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - FinalURL respjson.Field - HTTPStatus respjson.Field - Metadata respjson.Field + CacheMetadata respjson.Field + FinalURL respjson.Field + HTTPStatus respjson.Field + Metadata respjson.Field + Status respjson.Field + URL respjson.Field + HTML respjson.Field + ItemID respjson.Field + Markdown respjson.Field + Meta respjson.Field + OcrPages respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r BatchGetResultsResponseDataOk) RawJSON() string { return r.JSON.raw } +func (r *BatchGetResultsResponseDataOk) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type BatchGetResultsResponseDataOkCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field Status respjson.Field - URL respjson.Field - HTML respjson.Field - ItemID respjson.Field - Markdown respjson.Field - Meta respjson.Field - OcrPages respjson.Field ExtraFields map[string]respjson.Field raw string } `json:"-"` } // Returns the unmodified JSON received from the API -func (r BatchGetResultsResponseDataOk) RawJSON() string { return r.JSON.raw } -func (r *BatchGetResultsResponseDataOk) UnmarshalJSON(data []byte) error { +func (r BatchGetResultsResponseDataOkCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *BatchGetResultsResponseDataOkCacheMetadata) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } @@ -1473,6 +1507,10 @@ func (r *BatchGetResultsResponseKeyMetadata) UnmarshalJSON(data []byte) error { type BatchSubmitResponse struct { // Batch ID. Poll GET /batch/{batch_id} with it. ID string `json:"id" api:"required"` + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata BatchSubmitResponseCacheMetadata `json:"cache_metadata" api:"required"` // The crawl controls as submitted, so the limits requested can be compared against // what the crawl reached. Crawl CrawlControls `json:"crawl" api:"required"` @@ -1506,6 +1544,7 @@ type BatchSubmitResponse struct { // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field + CacheMetadata respjson.Field Crawl respjson.Field CreatedAt respjson.Field Credits respjson.Field @@ -1528,6 +1567,32 @@ func (r *BatchSubmitResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type BatchSubmitResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r BatchSubmitResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *BatchSubmitResponseCacheMetadata) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + // What accepting this batch cost. type BatchSubmitResponseCredits struct { // Credits just debited from your balance. Whatever the batch does not spend is diff --git a/brand.go b/brand.go index 69c2a1b..5f2ddde 100644 --- a/brand.go +++ b/brand.go @@ -67,6 +67,10 @@ func (r *BrandService) Search(ctx context.Context, query BrandSearchParams, opts } type BrandGetResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata BrandGetResponseCacheMetadata `json:"cache_metadata" api:"required"` // Detailed brand information Brand BrandGetResponseBrand `json:"brand"` // HTTP status code @@ -78,9 +82,36 @@ type BrandGetResponse struct { Status string `json:"status"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Brand respjson.Field - Code respjson.Field - KeyMetadata respjson.Field + CacheMetadata respjson.Field + Brand respjson.Field + Code respjson.Field + KeyMetadata respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r BrandGetResponse) RawJSON() string { return r.JSON.raw } +func (r *BrandGetResponse) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type BrandGetResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field Status respjson.Field ExtraFields map[string]respjson.Field raw string @@ -88,8 +119,8 @@ type BrandGetResponse struct { } // Returns the unmodified JSON received from the API -func (r BrandGetResponse) RawJSON() string { return r.JSON.raw } -func (r *BrandGetResponse) UnmarshalJSON(data []byte) error { +func (r BrandGetResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *BrandGetResponseCacheMetadata) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } @@ -661,6 +692,10 @@ func (r *BrandGetResponseKeyMetadata) UnmarshalJSON(data []byte) error { } type BrandGetSimplifiedResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata BrandGetSimplifiedResponseCacheMetadata `json:"cache_metadata" api:"required"` // Simplified brand information Brand BrandGetSimplifiedResponseBrand `json:"brand"` // HTTP status code of the response @@ -672,9 +707,36 @@ type BrandGetSimplifiedResponse struct { Status string `json:"status"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Brand respjson.Field - Code respjson.Field - KeyMetadata respjson.Field + CacheMetadata respjson.Field + Brand respjson.Field + Code respjson.Field + KeyMetadata respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r BrandGetSimplifiedResponse) RawJSON() string { return r.JSON.raw } +func (r *BrandGetSimplifiedResponse) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type BrandGetSimplifiedResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field Status respjson.Field ExtraFields map[string]respjson.Field raw string @@ -682,8 +744,8 @@ type BrandGetSimplifiedResponse struct { } // Returns the unmodified JSON received from the API -func (r BrandGetSimplifiedResponse) RawJSON() string { return r.JSON.raw } -func (r *BrandGetSimplifiedResponse) UnmarshalJSON(data []byte) error { +func (r BrandGetSimplifiedResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *BrandGetSimplifiedResponseCacheMetadata) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } diff --git a/usage_test.go b/usage_test.go index 1ef31ae..3ca3fb4 100644 --- a/usage_test.go +++ b/usage_test.go @@ -33,5 +33,5 @@ func TestUsage(t *testing.T) { if err != nil { t.Fatalf("err should be nil: %s", err.Error()) } - t.Logf("%+v\n", brand.Brand) + t.Logf("%+v\n", brand.CacheMetadata) } diff --git a/web.go b/web.go index 9a8f6f2..900674a 100644 --- a/web.go +++ b/web.go @@ -168,6 +168,10 @@ func (r *WebService) WebScrapeSitemap(ctx context.Context, query WebWebScrapeSit } type WebExtractResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata WebExtractResponseCacheMetadata `json:"cache_metadata" api:"required"` // Extracted data matching the request schema Data map[string]any `json:"data" api:"required"` Metadata WebExtractResponseMetadata `json:"metadata" api:"required"` @@ -182,14 +186,15 @@ type WebExtractResponse struct { KeyMetadata WebExtractResponseKeyMetadata `json:"key_metadata"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Data respjson.Field - Metadata respjson.Field - Status respjson.Field - URL respjson.Field - URLsAnalyzed respjson.Field - KeyMetadata respjson.Field - ExtraFields map[string]respjson.Field - raw string + CacheMetadata respjson.Field + Data respjson.Field + Metadata respjson.Field + Status respjson.Field + URL respjson.Field + URLsAnalyzed respjson.Field + KeyMetadata respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -199,6 +204,32 @@ func (r *WebExtractResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type WebExtractResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r WebExtractResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *WebExtractResponseCacheMetadata) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + type WebExtractResponseMetadata struct { MaxCrawlDepth int64 `json:"maxCrawlDepth" api:"required"` // Number of crawled pages excluded because they were anti-bot challenges, error @@ -408,6 +439,10 @@ func (r *WebExtractCompetitorsResponseKeyMetadata) UnmarshalJSON(data []byte) er } type WebExtractFontsResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata WebExtractFontsResponseCacheMetadata `json:"cache_metadata" api:"required"` // HTTP status code, e.g., 200 Code int64 `json:"code" api:"required"` // The normalized domain that was processed @@ -425,20 +460,47 @@ type WebExtractFontsResponse struct { KeyMetadata WebExtractFontsResponseKeyMetadata `json:"key_metadata"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Code respjson.Field - Domain respjson.Field - Fonts respjson.Field + CacheMetadata respjson.Field + Code respjson.Field + Domain respjson.Field + Fonts respjson.Field + Status respjson.Field + FontLinks respjson.Field + KeyMetadata respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r WebExtractFontsResponse) RawJSON() string { return r.JSON.raw } +func (r *WebExtractFontsResponse) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type WebExtractFontsResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field Status respjson.Field - FontLinks respjson.Field - KeyMetadata respjson.Field ExtraFields map[string]respjson.Field raw string } `json:"-"` } // Returns the unmodified JSON received from the API -func (r WebExtractFontsResponse) RawJSON() string { return r.JSON.raw } -func (r *WebExtractFontsResponse) UnmarshalJSON(data []byte) error { +func (r WebExtractFontsResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *WebExtractFontsResponseCacheMetadata) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } @@ -530,6 +592,10 @@ func (r *WebExtractFontsResponseKeyMetadata) UnmarshalJSON(data []byte) error { } type WebExtractStyleguideResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata WebExtractStyleguideResponseCacheMetadata `json:"cache_metadata" api:"required"` // HTTP status code Code int64 `json:"code"` // The normalized domain that was processed @@ -543,19 +609,46 @@ type WebExtractStyleguideResponse struct { Styleguide WebExtractStyleguideResponseStyleguide `json:"styleguide"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Code respjson.Field - Domain respjson.Field - KeyMetadata respjson.Field + CacheMetadata respjson.Field + Code respjson.Field + Domain respjson.Field + KeyMetadata respjson.Field + Status respjson.Field + Styleguide respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r WebExtractStyleguideResponse) RawJSON() string { return r.JSON.raw } +func (r *WebExtractStyleguideResponse) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type WebExtractStyleguideResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field Status respjson.Field - Styleguide respjson.Field ExtraFields map[string]respjson.Field raw string } `json:"-"` } // Returns the unmodified JSON received from the API -func (r WebExtractStyleguideResponse) RawJSON() string { return r.JSON.raw } -func (r *WebExtractStyleguideResponse) UnmarshalJSON(data []byte) error { +func (r WebExtractStyleguideResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *WebExtractStyleguideResponseCacheMetadata) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } @@ -1172,6 +1265,10 @@ func (r *WebExtractStyleguideResponseStyleguideTypographyP) UnmarshalJSON(data [ } type WebScreenshotResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata WebScreenshotResponseCacheMetadata `json:"cache_metadata" api:"required"` // HTTP status code Code int64 `json:"code"` // The normalized domain that was processed @@ -1194,6 +1291,7 @@ type WebScreenshotResponse struct { Width int64 `json:"width"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { + CacheMetadata respjson.Field Code respjson.Field Domain respjson.Field Height respjson.Field @@ -1213,6 +1311,32 @@ func (r *WebScreenshotResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type WebScreenshotResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r WebScreenshotResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *WebScreenshotResponseCacheMetadata) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + // 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. type WebScreenshotResponseKeyMetadata struct { @@ -1244,6 +1368,10 @@ const ( ) type WebSearchResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata WebSearchResponseCacheMetadata `json:"cache_metadata" api:"required"` // Echo of the original query (useful when fanout was enabled). Query string `json:"query" api:"required"` Results []WebSearchResponseResult `json:"results" api:"required"` @@ -1252,11 +1380,12 @@ type WebSearchResponse struct { KeyMetadata WebSearchResponseKeyMetadata `json:"key_metadata"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Query respjson.Field - Results respjson.Field - KeyMetadata respjson.Field - ExtraFields map[string]respjson.Field - raw string + CacheMetadata respjson.Field + Query respjson.Field + Results respjson.Field + KeyMetadata respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -1266,6 +1395,32 @@ func (r *WebSearchResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type WebSearchResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r WebSearchResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *WebSearchResponseCacheMetadata) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + type WebSearchResponseResult struct { // Snippet excerpt from the page. Description string `json:"description" api:"required"` @@ -1345,18 +1500,23 @@ func (r *WebSearchResponseKeyMetadata) UnmarshalJSON(data []byte) error { } type WebWebCrawlMdResponse struct { - Metadata WebWebCrawlMdResponseMetadata `json:"metadata" api:"required"` - Results []WebWebCrawlMdResponseResult `json:"results" api:"required"` + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata WebWebCrawlMdResponseCacheMetadata `json:"cache_metadata" api:"required"` + Metadata WebWebCrawlMdResponseMetadata `json:"metadata" api:"required"` + Results []WebWebCrawlMdResponseResult `json:"results" api:"required"` // 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 WebWebCrawlMdResponseKeyMetadata `json:"key_metadata"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Metadata respjson.Field - Results respjson.Field - KeyMetadata respjson.Field - ExtraFields map[string]respjson.Field - raw string + CacheMetadata respjson.Field + Metadata respjson.Field + Results respjson.Field + KeyMetadata respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -1366,6 +1526,32 @@ func (r *WebWebCrawlMdResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type WebWebCrawlMdResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r WebWebCrawlMdResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *WebWebCrawlMdResponseCacheMetadata) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + type WebWebCrawlMdResponseMetadata struct { // Maximum crawl depth reached during the crawl MaxCrawlDepth int64 `json:"maxCrawlDepth" api:"required"` @@ -1680,6 +1866,10 @@ func (r *WebWebCrawlMdResponseKeyMetadata) UnmarshalJSON(data []byte) error { } type WebWebScrapeHTMLResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata WebWebScrapeHTMLResponseCacheMetadata `json:"cache_metadata" api:"required"` // The scraped content of the page. For normal pages this is the raw HTML. When the // page is a sitemap or feed served behind an XSL stylesheet (which browsers render // into HTML), this is the underlying XML instead — see the `type` field. @@ -1710,6 +1900,7 @@ type WebWebScrapeHTMLResponse struct { KeyMetadata WebWebScrapeHTMLResponseKeyMetadata `json:"key_metadata"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { + CacheMetadata respjson.Field HTML respjson.Field Metadata respjson.Field Success respjson.Field @@ -1729,6 +1920,32 @@ func (r *WebWebScrapeHTMLResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type WebWebScrapeHTMLResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r WebWebScrapeHTMLResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *WebWebScrapeHTMLResponseCacheMetadata) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + // Metadata extracted from the scraped page HTML. type WebWebScrapeHTMLResponseMetadata struct { // Final URL scraped after redirects or scraper fallback, when known. Falls back to @@ -2039,6 +2256,10 @@ func (r *WebWebScrapeHTMLResponseKeyMetadata) UnmarshalJSON(data []byte) error { } type WebWebScrapeImagesResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata WebWebScrapeImagesResponseCacheMetadata `json:"cache_metadata" api:"required"` // Images found on the page. Images []WebWebScrapeImagesResponseImage `json:"images" api:"required"` // Always true on success. @@ -2054,6 +2275,7 @@ type WebWebScrapeImagesResponse struct { KeyMetadata WebWebScrapeImagesResponseKeyMetadata `json:"key_metadata"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { + CacheMetadata respjson.Field Images respjson.Field Success respjson.Field URL respjson.Field @@ -2070,6 +2292,32 @@ func (r *WebWebScrapeImagesResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type WebWebScrapeImagesResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r WebWebScrapeImagesResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *WebWebScrapeImagesResponseCacheMetadata) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + type WebWebScrapeImagesResponseImage struct { // Image alt text, or null when unavailable. Alt string `json:"alt" api:"required"` @@ -2193,6 +2441,10 @@ func (r *WebWebScrapeImagesResponseKeyMetadata) UnmarshalJSON(data []byte) error } type WebWebScrapeMdResponse struct { + // Cache outcome for this response. Composite responses are hits only when every + // cache-controlled fetch contributing to the output was a hit; age_ms is the + // oldest contributing hit. + CacheMetadata WebWebScrapeMdResponseCacheMetadata `json:"cache_metadata" api:"required"` // UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result // and compare small values against your workload's minimum useful-content // threshold. @@ -2221,6 +2473,7 @@ type WebWebScrapeMdResponse struct { KeyMetadata WebWebScrapeMdResponseKeyMetadata `json:"key_metadata"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { + CacheMetadata respjson.Field ContentLength respjson.Field Markdown respjson.Field Metadata respjson.Field @@ -2241,6 +2494,32 @@ func (r *WebWebScrapeMdResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Cache outcome for this response. Composite responses are hits only when every +// cache-controlled fetch contributing to the output was a hit; age_ms is the +// oldest contributing hit. +type WebWebScrapeMdResponseCacheMetadata struct { + // Age of the cached data in milliseconds. Zero for miss and zdr responses. + AgeMs int64 `json:"age_ms" api:"required"` + // Whether the response was served from cache, required fresh work, or honored + // zero-data-retention cache bypass. + // + // Any of "hit", "miss", "zdr". + Status string `json:"status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + AgeMs respjson.Field + Status respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r WebWebScrapeMdResponseCacheMetadata) RawJSON() string { return r.JSON.raw } +func (r *WebWebScrapeMdResponseCacheMetadata) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + // Metadata extracted from the scraped page HTML. type WebWebScrapeMdResponseMetadata struct { // Final URL scraped after redirects or scraper fallback, when known. Falls back to From 1a4d82c0a5ad2d3e998e35a651baaf2923a80de4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2026 02:55:45 +0000 Subject: [PATCH 4/4] release: 2.13.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ README.md | 2 +- internal/version.go | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0746cbe..e6eadb4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.12.0" + ".": "2.13.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a62f69..2282095 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 2.13.0 (2026-08-27) + +Full Changelog: [v2.12.0...v2.13.0](https://github.com/context-dot-dev/context-go-sdk/compare/v2.12.0...v2.13.0) + +### Features + +* **api:** api update ([c233a90](https://github.com/context-dot-dev/context-go-sdk/commit/c233a908067726773a2121685f4846fb7cb6a338)) +* **api:** api update ([e1a54e5](https://github.com/context-dot-dev/context-go-sdk/commit/e1a54e55ccde50fcea3fc4bbe1e97b5d2162c115)) + ## 2.12.0 (2026-08-23) Full Changelog: [v2.11.0...v2.12.0](https://github.com/context-dot-dev/context-go-sdk/compare/v2.11.0...v2.12.0) diff --git a/README.md b/README.md index 8282754..7d4ff48 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.12.0' +go get -u 'github.com/context-dot-dev/context-go-sdk@v2.13.0' ``` diff --git a/internal/version.go b/internal/version.go index d2db0fd..795ad9b 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "2.12.0" // x-release-please-version +const PackageVersion = "2.13.0" // x-release-please-version