Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.12.0"
".": "2.13.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -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-dc61df29e1b6282f9df685fadd65f3683afe352deccae94d0c080092e0eae4b3.yml
openapi_spec_hash: 258caa98cd0de5f7149f6937d071c912
config_hash: 0fb0ceca5946298c416cec0cca5260c7
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Or to pin the version:
<!-- x-release-please-start-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'
```

<!-- x-release-please-end -->
Expand Down Expand Up @@ -73,7 +73,7 @@ func main() {
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", brand.Brand)
fmt.Printf("%+v\n", brand.CacheMetadata)
}

```
Expand Down
70 changes: 66 additions & 4 deletions ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -187,17 +218,22 @@ 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"`
// Array of products extracted from the website
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:"-"`
}

Expand All @@ -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 {
Expand Down
113 changes: 89 additions & 24 deletions batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand All @@ -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:"-"`
}

Expand Down Expand Up @@ -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.
Expand All @@ -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)
}

Expand Down Expand Up @@ -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"`
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading
Loading