From 1c89adacba0cc4f3d35bfd7a4a295297420b59df Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 03:45:35 +0000 Subject: [PATCH 1/7] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c2cc39a..6f63fc8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ecb277557634e2f0838ea196e2b21f11924f65e133c7977e8c2e1a603b8df466.yml -openapi_spec_hash: 798ce4cb042389a1179bf9af6fc1173d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-de547897d4a30447212ce36430a932cf186efd91844bd8ea0757a1cde4ce40e1.yml +openapi_spec_hash: efa1b29865560c7817495b20c1b62fad config_hash: ff35e224e809656528c44163aa41bebd From cea1ee4604ca3c5510d57f47afddc0c2f04a13bd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 23:21:48 +0000 Subject: [PATCH 2/7] feat(api): api update --- .stats.yml | 4 ++-- monitor.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6f63fc8..a9bd7b9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-de547897d4a30447212ce36430a932cf186efd91844bd8ea0757a1cde4ce40e1.yml -openapi_spec_hash: efa1b29865560c7817495b20c1b62fad +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-e3b1fd2a6aecb6cac87a0a2f4f811dedc261ae162cceced0841b5184ba609308.yml +openapi_spec_hash: 28e4c0d0599e1f7153838a465f9cf5b5 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/monitor.go b/monitor.go index db6c705..1c2f0e4 100644 --- a/monitor.go +++ b/monitor.go @@ -3020,7 +3020,7 @@ func (r *MonitorListRunsResponseDataWebhookDeliveryError) UnmarshalJSON(data []b // `change_detection_type` describe the change, and which optional fields are // present depends on them (page: `diff` + excerpts; sitemap: // `added_urls`/`removed_urls`; semantic: -// `query`/`confidence`/`importance`/`evidence`/`matched_urls`). +// `confidence`/`importance`/`evidence`/`matched_urls`). type MonitorGetChangeResponse struct { ID string `json:"id" api:"required"` // Any of "exact", "semantic". @@ -3035,6 +3035,8 @@ type MonitorGetChangeResponse struct { // The run that detected this change. RunID string `json:"run_id" api:"required"` Summary string `json:"summary" api:"required"` + // User-defined tags for grouping and filtering monitors and their changes. + Tags []string `json:"tags" api:"required"` // Any of "page", "sitemap", "extract". TargetType MonitorGetChangeResponseTargetType `json:"target_type" api:"required"` Title string `json:"title" api:"required"` @@ -3056,8 +3058,6 @@ type MonitorGetChangeResponse struct { RemovedURLCount int64 `json:"removed_url_count"` // At most 500 URLs are included; the corresponding count field is always exact. RemovedURLs []string `json:"removed_urls" format:"uri"` - // User-defined tags for grouping and filtering monitors and their changes. - Tags []string `json:"tags"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -3067,6 +3067,7 @@ type MonitorGetChangeResponse struct { MonitorID respjson.Field RunID respjson.Field Summary respjson.Field + Tags respjson.Field TargetType respjson.Field Title respjson.Field URL respjson.Field @@ -3082,7 +3083,6 @@ type MonitorGetChangeResponse struct { MatchedURLs respjson.Field RemovedURLCount respjson.Field RemovedURLs respjson.Field - Tags respjson.Field ExtraFields map[string]respjson.Field raw string } `json:"-"` From 28e740f468b39810f2f5ca477e67bbcab358ae11 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 02:22:21 +0000 Subject: [PATCH 3/7] feat(api): api update --- .stats.yml | 4 +- monitor.go | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a9bd7b9..c1de7fe 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-e3b1fd2a6aecb6cac87a0a2f4f811dedc261ae162cceced0841b5184ba609308.yml -openapi_spec_hash: 28e4c0d0599e1f7153838a465f9cf5b5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d60fed3d26479d1ee76b77df8415390504542522e7188792a23bf77b9f37ed63.yml +openapi_spec_hash: 263672c59d9b01c50f7d2307fbd82ec0 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/monitor.go b/monitor.go index 1c2f0e4..d8e6bf2 100644 --- a/monitor.go +++ b/monitor.go @@ -209,6 +209,10 @@ type MonitorNewResponse struct { // User-defined tags for grouping and filtering monitors and their changes. Tags []string `json:"tags"` Webhook MonitorNewResponseWebhook `json:"webhook" api:"nullable"` + // Present while webhook deliveries are failing consecutively; null when deliveries + // are healthy or no webhook is configured. Cleared on the next successful delivery + // and when the webhook URL changes. + WebhookFailure MonitorNewResponseWebhookFailure `json:"webhook_failure" api:"nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -227,6 +231,7 @@ type MonitorNewResponse struct { NextRunAt respjson.Field Tags respjson.Field Webhook respjson.Field + WebhookFailure respjson.Field ExtraFields map[string]respjson.Field raw string } `json:"-"` @@ -759,6 +764,38 @@ func (r *MonitorNewResponseWebhook) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Present while webhook deliveries are failing consecutively; null when deliveries +// are healthy or no webhook is configured. Cleared on the next successful delivery +// and when the webhook URL changes. +type MonitorNewResponseWebhookFailure struct { + // Number of consecutive delivery attempts that did not succeed. + ConsecutiveFailures int64 `json:"consecutive_failures" api:"required"` + LastFailedAt time.Time `json:"last_failed_at" api:"required" format:"date-time"` + // Human-readable description of the most recent failure. + LastMessage string `json:"last_message" api:"required"` + // Outcome of the most recent failed delivery. 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 "rejected", "failed", "skipped_unsafe_url". + LastStatus string `json:"last_status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + ConsecutiveFailures respjson.Field + LastFailedAt respjson.Field + LastMessage respjson.Field + LastStatus respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r MonitorNewResponseWebhookFailure) RawJSON() string { return r.JSON.raw } +func (r *MonitorNewResponseWebhookFailure) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + // A web monitor. `mode` is the constant `web`; behavior is described by `target` // (page/sitemap/extract) and `change_detection` (exact/semantic). type MonitorGetResponse struct { @@ -801,6 +838,10 @@ type MonitorGetResponse struct { // User-defined tags for grouping and filtering monitors and their changes. Tags []string `json:"tags"` Webhook MonitorGetResponseWebhook `json:"webhook" api:"nullable"` + // Present while webhook deliveries are failing consecutively; null when deliveries + // are healthy or no webhook is configured. Cleared on the next successful delivery + // and when the webhook URL changes. + WebhookFailure MonitorGetResponseWebhookFailure `json:"webhook_failure" api:"nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -819,6 +860,7 @@ type MonitorGetResponse struct { NextRunAt respjson.Field Tags respjson.Field Webhook respjson.Field + WebhookFailure respjson.Field ExtraFields map[string]respjson.Field raw string } `json:"-"` @@ -1351,6 +1393,38 @@ func (r *MonitorGetResponseWebhook) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Present while webhook deliveries are failing consecutively; null when deliveries +// are healthy or no webhook is configured. Cleared on the next successful delivery +// and when the webhook URL changes. +type MonitorGetResponseWebhookFailure struct { + // Number of consecutive delivery attempts that did not succeed. + ConsecutiveFailures int64 `json:"consecutive_failures" api:"required"` + LastFailedAt time.Time `json:"last_failed_at" api:"required" format:"date-time"` + // Human-readable description of the most recent failure. + LastMessage string `json:"last_message" api:"required"` + // Outcome of the most recent failed delivery. 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 "rejected", "failed", "skipped_unsafe_url". + LastStatus string `json:"last_status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + ConsecutiveFailures respjson.Field + LastFailedAt respjson.Field + LastMessage respjson.Field + LastStatus respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r MonitorGetResponseWebhookFailure) RawJSON() string { return r.JSON.raw } +func (r *MonitorGetResponseWebhookFailure) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + // A web monitor. `mode` is the constant `web`; behavior is described by `target` // (page/sitemap/extract) and `change_detection` (exact/semantic). type MonitorUpdateResponse struct { @@ -1393,6 +1467,10 @@ type MonitorUpdateResponse struct { // User-defined tags for grouping and filtering monitors and their changes. Tags []string `json:"tags"` Webhook MonitorUpdateResponseWebhook `json:"webhook" api:"nullable"` + // Present while webhook deliveries are failing consecutively; null when deliveries + // are healthy or no webhook is configured. Cleared on the next successful delivery + // and when the webhook URL changes. + WebhookFailure MonitorUpdateResponseWebhookFailure `json:"webhook_failure" api:"nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -1411,6 +1489,7 @@ type MonitorUpdateResponse struct { NextRunAt respjson.Field Tags respjson.Field Webhook respjson.Field + WebhookFailure respjson.Field ExtraFields map[string]respjson.Field raw string } `json:"-"` @@ -1944,6 +2023,38 @@ func (r *MonitorUpdateResponseWebhook) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Present while webhook deliveries are failing consecutively; null when deliveries +// are healthy or no webhook is configured. Cleared on the next successful delivery +// and when the webhook URL changes. +type MonitorUpdateResponseWebhookFailure struct { + // Number of consecutive delivery attempts that did not succeed. + ConsecutiveFailures int64 `json:"consecutive_failures" api:"required"` + LastFailedAt time.Time `json:"last_failed_at" api:"required" format:"date-time"` + // Human-readable description of the most recent failure. + LastMessage string `json:"last_message" api:"required"` + // Outcome of the most recent failed delivery. 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 "rejected", "failed", "skipped_unsafe_url". + LastStatus string `json:"last_status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + ConsecutiveFailures respjson.Field + LastFailedAt respjson.Field + LastMessage respjson.Field + LastStatus respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r MonitorUpdateResponseWebhookFailure) RawJSON() string { return r.JSON.raw } +func (r *MonitorUpdateResponseWebhookFailure) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + type MonitorListResponse struct { Data []MonitorListResponseData `json:"data" api:"required"` HasMore bool `json:"has_more" api:"required"` @@ -2006,6 +2117,10 @@ type MonitorListResponseData struct { // User-defined tags for grouping and filtering monitors and their changes. Tags []string `json:"tags"` Webhook MonitorListResponseDataWebhook `json:"webhook" api:"nullable"` + // Present while webhook deliveries are failing consecutively; null when deliveries + // are healthy or no webhook is configured. Cleared on the next successful delivery + // and when the webhook URL changes. + WebhookFailure MonitorListResponseDataWebhookFailure `json:"webhook_failure" api:"nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -2024,6 +2139,7 @@ type MonitorListResponseData struct { NextRunAt respjson.Field Tags respjson.Field Webhook respjson.Field + WebhookFailure respjson.Field ExtraFields map[string]respjson.Field raw string } `json:"-"` @@ -2538,6 +2654,38 @@ func (r *MonitorListResponseDataWebhook) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// Present while webhook deliveries are failing consecutively; null when deliveries +// are healthy or no webhook is configured. Cleared on the next successful delivery +// and when the webhook URL changes. +type MonitorListResponseDataWebhookFailure struct { + // Number of consecutive delivery attempts that did not succeed. + ConsecutiveFailures int64 `json:"consecutive_failures" api:"required"` + LastFailedAt time.Time `json:"last_failed_at" api:"required" format:"date-time"` + // Human-readable description of the most recent failure. + LastMessage string `json:"last_message" api:"required"` + // Outcome of the most recent failed delivery. 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 "rejected", "failed", "skipped_unsafe_url". + LastStatus string `json:"last_status" api:"required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + ConsecutiveFailures respjson.Field + LastFailedAt respjson.Field + LastMessage respjson.Field + LastStatus respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r MonitorListResponseDataWebhookFailure) RawJSON() string { return r.JSON.raw } +func (r *MonitorListResponseDataWebhookFailure) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + type MonitorDeleteResponse struct { ID string `json:"id" api:"required"` Deleted bool `json:"deleted" api:"required"` From a689b94cc1913c2521c6e8932cfe4cb35e07fff1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 22:00:23 +0000 Subject: [PATCH 4/7] feat(api): api update --- .stats.yml | 4 ++-- web.go | 36 ++++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index c1de7fe..a5e7807 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d60fed3d26479d1ee76b77df8415390504542522e7188792a23bf77b9f37ed63.yml -openapi_spec_hash: 263672c59d9b01c50f7d2307fbd82ec0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-adab8df19dce27396e4a0e698287f083e1f932e63b85fd8dd4d54f80f0e0b5a8.yml +openapi_spec_hash: 717fea46f446ff97bad627f200963fd7 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/web.go b/web.go index 45f3900..ed01767 100644 --- a/web.go +++ b/web.go @@ -116,7 +116,22 @@ func (r *WebService) WebScrapeImages(ctx context.Context, query WebWebScrapeImag return res, err } -// Scrapes the given URL into LLM usable Markdown. +// Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON +// responses from a recognized API key; use error_code to distinguish stable +// failure categories. +// +// ### 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 | 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" @@ -1996,6 +2011,10 @@ func (r *WebWebScrapeImagesResponseKeyMetadata) UnmarshalJSON(data []byte) error } type WebWebScrapeMdResponse struct { + // 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. + ContentLength int64 `json:"contentLength" api:"required"` // Page content converted to GitHub Flavored Markdown Markdown string `json:"markdown" api:"required"` // Metadata extracted from the scraped page HTML. @@ -2011,13 +2030,14 @@ type WebWebScrapeMdResponse struct { KeyMetadata WebWebScrapeMdResponseKeyMetadata `json:"key_metadata"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { - Markdown respjson.Field - Metadata respjson.Field - Success respjson.Field - URL respjson.Field - KeyMetadata respjson.Field - ExtraFields map[string]respjson.Field - raw string + ContentLength respjson.Field + Markdown respjson.Field + Metadata respjson.Field + Success respjson.Field + URL respjson.Field + KeyMetadata respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } From 94c865717ba0322cfb6978f30451cedbc83024d3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 22:21:20 +0000 Subject: [PATCH 5/7] feat(api): api update --- .stats.yml | 4 +- client.go | 5 ++- monitor.go | 107 +++++++++++++++++++++++++++++++++++++++--------- monitor_test.go | 6 ++- 4 files changed, 96 insertions(+), 26 deletions(-) diff --git a/.stats.yml b/.stats.yml index a5e7807..951a04e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-adab8df19dce27396e4a0e698287f083e1f932e63b85fd8dd4d54f80f0e0b5a8.yml -openapi_spec_hash: 717fea46f446ff97bad627f200963fd7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ecf38e27f0c2544a8965f6cee827927343a926e1ab511aa7b34e8aa7d1866c8e.yml +openapi_spec_hash: c5767791a19b95c52ef073902fa5da77 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/client.go b/client.go index 5962fbc..0381cc7 100644 --- a/client.go +++ b/client.go @@ -24,8 +24,9 @@ type Client struct { Industry IndustryService Utility UtilityService // Monitor pages, sitemaps, and extracted website data for exact or semantic - // changes. The change.detected webhook payload is documented by the - // MonitorsChangeDetectedWebhookPayload schema. + // changes. Webhook payloads are documented by the + // MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload + // schemas. Monitors MonitorService } diff --git a/monitor.go b/monitor.go index d8e6bf2..4716c81 100644 --- a/monitor.go +++ b/monitor.go @@ -22,8 +22,9 @@ import ( ) // Monitor pages, sitemaps, and extracted website data for exact or semantic -// changes. The change.detected webhook payload is documented by the -// MonitorsChangeDetectedWebhookPayload schema. +// changes. Webhook payloads are documented by the +// MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload +// schemas. // // MonitorService contains methods and other services that help with interacting // with the context.dev API. @@ -741,8 +742,15 @@ func (r *MonitorNewResponseLastError) UnmarshalJSON(data []byte) error { } type MonitorNewResponseWebhook struct { - // Webhook URL called when a change is detected. + // Webhook URL events are delivered to. URL string `json:"url" api:"required" format:"uri"` + // Events delivered to this endpoint. `change.detected` fires only when a run + // detects a change; `run.completed` fires on every completed run — including runs + // that detected no change — and embeds the change when one was detected. Defaults + // to `["change.detected"]` when omitted. + // + // Any of "change.detected", "run.completed". + Events []string `json:"events"` // Signing secret used to verify webhook authenticity. Each delivery includes an // `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over // `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time @@ -752,6 +760,7 @@ type MonitorNewResponseWebhook struct { // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { URL respjson.Field + Events respjson.Field Secret respjson.Field ExtraFields map[string]respjson.Field raw string @@ -1370,8 +1379,15 @@ func (r *MonitorGetResponseLastError) UnmarshalJSON(data []byte) error { } type MonitorGetResponseWebhook struct { - // Webhook URL called when a change is detected. + // Webhook URL events are delivered to. URL string `json:"url" api:"required" format:"uri"` + // Events delivered to this endpoint. `change.detected` fires only when a run + // detects a change; `run.completed` fires on every completed run — including runs + // that detected no change — and embeds the change when one was detected. Defaults + // to `["change.detected"]` when omitted. + // + // Any of "change.detected", "run.completed". + Events []string `json:"events"` // Signing secret used to verify webhook authenticity. Each delivery includes an // `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over // `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time @@ -1381,6 +1397,7 @@ type MonitorGetResponseWebhook struct { // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { URL respjson.Field + Events respjson.Field Secret respjson.Field ExtraFields map[string]respjson.Field raw string @@ -2000,8 +2017,15 @@ func (r *MonitorUpdateResponseLastError) UnmarshalJSON(data []byte) error { } type MonitorUpdateResponseWebhook struct { - // Webhook URL called when a change is detected. + // Webhook URL events are delivered to. URL string `json:"url" api:"required" format:"uri"` + // Events delivered to this endpoint. `change.detected` fires only when a run + // detects a change; `run.completed` fires on every completed run — including runs + // that detected no change — and embeds the change when one was detected. Defaults + // to `["change.detected"]` when omitted. + // + // Any of "change.detected", "run.completed". + Events []string `json:"events"` // Signing secret used to verify webhook authenticity. Each delivery includes an // `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over // `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time @@ -2011,6 +2035,7 @@ type MonitorUpdateResponseWebhook struct { // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { URL respjson.Field + Events respjson.Field Secret respjson.Field ExtraFields map[string]respjson.Field raw string @@ -2631,8 +2656,15 @@ func (r *MonitorListResponseDataLastError) UnmarshalJSON(data []byte) error { } type MonitorListResponseDataWebhook struct { - // Webhook URL called when a change is detected. + // Webhook URL events are delivered to. URL string `json:"url" api:"required" format:"uri"` + // Events delivered to this endpoint. `change.detected` fires only when a run + // detects a change; `run.completed` fires on every completed run — including runs + // that detected no change — and embeds the change when one was detected. Defaults + // to `["change.detected"]` when omitted. + // + // Any of "change.detected", "run.completed". + Events []string `json:"events"` // Signing secret used to verify webhook authenticity. Each delivery includes an // `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over // `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time @@ -2642,6 +2674,7 @@ type MonitorListResponseDataWebhook struct { // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { URL respjson.Field + Events respjson.Field Secret respjson.Field ExtraFields map[string]respjson.Field raw string @@ -2831,9 +2864,15 @@ type MonitorListAccountRunsResponseData struct { // Any of "insufficient_credits", "monitor_paused", "superseded". SkipReason string `json:"skip_reason" api:"nullable"` StartedAt time.Time `json:"started_at" api:"nullable" format:"date-time"` - // The webhook delivery attempted for a change detected by this run. Omitted when - // no webhook was attempted, including historical runs created before delivery - // tracking was added. + // 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"` + // 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"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { @@ -2851,6 +2890,7 @@ type MonitorListAccountRunsResponseData struct { Error respjson.Field SkipReason respjson.Field StartedAt respjson.Field + WebhookDeliveries respjson.Field WebhookDelivery respjson.Field ExtraFields map[string]respjson.Field raw string @@ -2881,12 +2921,14 @@ func (r *MonitorListAccountRunsResponseDataError) UnmarshalJSON(data []byte) err return apijson.UnmarshalRoot(data, r) } -// The webhook delivery attempted for a change detected by this run. Omitted when -// no webhook was attempted, including historical runs created before delivery -// tracking was added. 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 @@ -2902,6 +2944,7 @@ type MonitorListAccountRunsResponseDataWebhookDelivery struct { JSON struct { AttemptedAt respjson.Field Error respjson.Field + Event respjson.Field EventID respjson.Field HTTPStatus respjson.Field Status respjson.Field @@ -3061,9 +3104,15 @@ type MonitorListRunsResponseData struct { // Any of "insufficient_credits", "monitor_paused", "superseded". SkipReason string `json:"skip_reason" api:"nullable"` StartedAt time.Time `json:"started_at" api:"nullable" format:"date-time"` - // The webhook delivery attempted for a change detected by this run. Omitted when - // no webhook was attempted, including historical runs created before delivery - // tracking was added. + // 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"` + // 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"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { @@ -3081,6 +3130,7 @@ type MonitorListRunsResponseData struct { Error respjson.Field SkipReason respjson.Field StartedAt respjson.Field + WebhookDeliveries respjson.Field WebhookDelivery respjson.Field ExtraFields map[string]respjson.Field raw string @@ -3111,12 +3161,14 @@ func (r *MonitorListRunsResponseDataError) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } -// The webhook delivery attempted for a change detected by this run. Omitted when -// no webhook was attempted, including historical runs created before delivery -// tracking was added. 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 @@ -3132,6 +3184,7 @@ type MonitorListRunsResponseDataWebhookDelivery struct { JSON struct { AttemptedAt respjson.Field Error respjson.Field + Event respjson.Field EventID respjson.Field HTTPStatus respjson.Field Status respjson.Field @@ -3574,8 +3627,15 @@ const ( // The property URL is required. type MonitorNewParamsWebhook struct { - // Webhook URL called when a change is detected. + // Webhook URL events are delivered to. URL string `json:"url" api:"required" format:"uri"` + // Events delivered to this endpoint. `change.detected` fires only when a run + // detects a change; `run.completed` fires on every completed run — including runs + // that detected no change — and embeds the change when one was detected. Defaults + // to `["change.detected"]` when omitted. + // + // Any of "change.detected", "run.completed". + Events []string `json:"events,omitzero"` paramObj } @@ -3842,8 +3902,15 @@ func (r *MonitorUpdateParamsTargetExtract) UnmarshalJSON(data []byte) error { // // The property URL is required. type MonitorUpdateParamsWebhook struct { - // Webhook URL called when a change is detected. + // Webhook URL events are delivered to. URL string `json:"url" api:"required" format:"uri"` + // Events delivered to this endpoint. `change.detected` fires only when a run + // detects a change; `run.completed` fires on every completed run — including runs + // that detected no change — and embeds the change when one was detected. Defaults + // to `["change.detected"]` when omitted. + // + // Any of "change.detected", "run.completed". + Events []string `json:"events,omitzero"` paramObj } diff --git a/monitor_test.go b/monitor_test.go index fbded67..d6689a9 100644 --- a/monitor_test.go +++ b/monitor_test.go @@ -46,7 +46,8 @@ func TestMonitorNewWithOptionalParams(t *testing.T) { Mode: contextdev.MonitorNewParamsModeWeb, Tags: []string{"pricing", "competitor"}, Webhook: contextdev.MonitorNewParamsWebhook{ - URL: "https://example.com/webhook", + URL: "https://example.com/webhook", + Events: []string{"change.detected", "run.completed"}, }, }) if err != nil { @@ -116,7 +117,8 @@ func TestMonitorUpdateWithOptionalParams(t *testing.T) { }, }, Webhook: contextdev.MonitorUpdateParamsWebhook{ - URL: "https://example.com/webhook", + URL: "https://example.com/webhook", + Events: []string{"change.detected", "run.completed"}, }, }, ) From 9faa60b1af7766e722379125890f50b7faa79f12 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 23:27:14 +0000 Subject: [PATCH 6/7] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 951a04e..26e1f0f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ecf38e27f0c2544a8965f6cee827927343a926e1ab511aa7b34e8aa7d1866c8e.yml -openapi_spec_hash: c5767791a19b95c52ef073902fa5da77 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-21b399a0388f04e48b9d8d95f51f622088c5b15b1e17d2988c38583902b9f685.yml +openapi_spec_hash: 6952c95545d272388a655652fc8e7662 config_hash: ff35e224e809656528c44163aa41bebd From 6d75a496f94f64936f20da434a254384444aa5be Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 23:27:33 +0000 Subject: [PATCH 7/7] release: 2.3.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 11 +++++++++++ README.md | 2 +- internal/version.go | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bfc26f9..75ec52f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.2.0" + ".": "2.3.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 25ef7ce..472c741 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 2.3.0 (2026-07-11) + +Full Changelog: [v2.2.0...v2.3.0](https://github.com/context-dot-dev/context-go-sdk/compare/v2.2.0...v2.3.0) + +### Features + +* **api:** api update ([94c8657](https://github.com/context-dot-dev/context-go-sdk/commit/94c865717ba0322cfb6978f30451cedbc83024d3)) +* **api:** api update ([a689b94](https://github.com/context-dot-dev/context-go-sdk/commit/a689b94cc1913c2521c6e8932cfe4cb35e07fff1)) +* **api:** api update ([28e740f](https://github.com/context-dot-dev/context-go-sdk/commit/28e740f468b39810f2f5ca477e67bbcab358ae11)) +* **api:** api update ([cea1ee4](https://github.com/context-dot-dev/context-go-sdk/commit/cea1ee4604ca3c5510d57f47afddc0c2f04a13bd)) + ## 2.2.0 (2026-07-10) Full Changelog: [v2.1.0...v2.2.0](https://github.com/context-dot-dev/context-go-sdk/compare/v2.1.0...v2.2.0) diff --git a/README.md b/README.md index b76c087..7d81aba 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.2.0' +go get -u 'github.com/context-dot-dev/context-go-sdk@v2.3.0' ``` diff --git a/internal/version.go b/internal/version.go index 0759deb..ebb76be 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "2.2.0" // x-release-please-version +const PackageVersion = "2.3.0" // x-release-please-version