Skip to content

Commit 3e75380

Browse files
feat(api): api update
1 parent 3b9e64f commit 3e75380

12 files changed

Lines changed: 116 additions & 40 deletions

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 29
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-adab8df19dce27396e4a0e698287f083e1f932e63b85fd8dd4d54f80f0e0b5a8.yml
3-
openapi_spec_hash: 717fea46f446ff97bad627f200963fd7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ecf38e27f0c2544a8965f6cee827927343a926e1ab511aa7b34e8aa7d1866c8e.yml
3+
openapi_spec_hash: c5767791a19b95c52ef073902fa5da77
44
config_hash: ff35e224e809656528c44163aa41bebd

‎src/context/dev/_client.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def utility(self) -> UtilityResource:
152152
@cached_property
153153
def monitors(self) -> MonitorsResource:
154154
"""
155-
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. The change.detected webhook payload is documented by the MonitorsChangeDetectedWebhookPayload schema.
155+
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas.
156156
"""
157157
from .resources.monitors import MonitorsResource
158158

@@ -368,7 +368,7 @@ def utility(self) -> AsyncUtilityResource:
368368
@cached_property
369369
def monitors(self) -> AsyncMonitorsResource:
370370
"""
371-
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. The change.detected webhook payload is documented by the MonitorsChangeDetectedWebhookPayload schema.
371+
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas.
372372
"""
373373
from .resources.monitors import AsyncMonitorsResource
374374

@@ -526,7 +526,7 @@ def utility(self) -> utility.UtilityResourceWithRawResponse:
526526
@cached_property
527527
def monitors(self) -> monitors.MonitorsResourceWithRawResponse:
528528
"""
529-
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. The change.detected webhook payload is documented by the MonitorsChangeDetectedWebhookPayload schema.
529+
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas.
530530
"""
531531
from .resources.monitors import MonitorsResourceWithRawResponse
532532

@@ -572,7 +572,7 @@ def utility(self) -> utility.AsyncUtilityResourceWithRawResponse:
572572
@cached_property
573573
def monitors(self) -> monitors.AsyncMonitorsResourceWithRawResponse:
574574
"""
575-
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. The change.detected webhook payload is documented by the MonitorsChangeDetectedWebhookPayload schema.
575+
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas.
576576
"""
577577
from .resources.monitors import AsyncMonitorsResourceWithRawResponse
578578

@@ -618,7 +618,7 @@ def utility(self) -> utility.UtilityResourceWithStreamingResponse:
618618
@cached_property
619619
def monitors(self) -> monitors.MonitorsResourceWithStreamingResponse:
620620
"""
621-
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. The change.detected webhook payload is documented by the MonitorsChangeDetectedWebhookPayload schema.
621+
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas.
622622
"""
623623
from .resources.monitors import MonitorsResourceWithStreamingResponse
624624

@@ -664,7 +664,7 @@ def utility(self) -> utility.AsyncUtilityResourceWithStreamingResponse:
664664
@cached_property
665665
def monitors(self) -> monitors.AsyncMonitorsResourceWithStreamingResponse:
666666
"""
667-
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. The change.detected webhook payload is documented by the MonitorsChangeDetectedWebhookPayload schema.
667+
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas.
668668
"""
669669
from .resources.monitors import AsyncMonitorsResourceWithStreamingResponse
670670

‎src/context/dev/resources/monitors.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
class MonitorsResource(SyncAPIResource):
4747
"""
48-
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. The change.detected webhook payload is documented by the MonitorsChangeDetectedWebhookPayload schema.
48+
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas.
4949
"""
5050

5151
@cached_property
@@ -622,7 +622,7 @@ def run(
622622

623623
class AsyncMonitorsResource(AsyncAPIResource):
624624
"""
625-
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. The change.detected webhook payload is documented by the MonitorsChangeDetectedWebhookPayload schema.
625+
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas.
626626
"""
627627

628628
@cached_property

‎src/context/dev/types/monitor_create_params.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Union, Optional
5+
from typing import Dict, List, Union, Optional
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

88
from .._types import SequenceNotStr
@@ -168,4 +168,12 @@ class TargetMonitorsExtractTarget(TypedDict, total=False):
168168

169169
class Webhook(TypedDict, total=False):
170170
url: Required[str]
171-
"""Webhook URL called when a change is detected."""
171+
"""Webhook URL events are delivered to."""
172+
173+
events: List[Literal["change.detected", "run.completed"]]
174+
"""Events delivered to this endpoint.
175+
176+
`change.detected` fires only when a run detects a change; `run.completed` fires
177+
on every completed run — including runs that detected no change — and embeds the
178+
change when one was detected. Defaults to `["change.detected"]` when omitted.
179+
"""

‎src/context/dev/types/monitor_create_response.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,15 @@ class LastError(BaseModel):
209209

210210
class Webhook(BaseModel):
211211
url: str
212-
"""Webhook URL called when a change is detected."""
212+
"""Webhook URL events are delivered to."""
213+
214+
events: Optional[List[Literal["change.detected", "run.completed"]]] = None
215+
"""Events delivered to this endpoint.
216+
217+
`change.detected` fires only when a run detects a change; `run.completed` fires
218+
on every completed run — including runs that detected no change — and embeds the
219+
change when one was detected. Defaults to `["change.detected"]` when omitted.
220+
"""
213221

214222
secret: Optional[str] = None
215223
"""Signing secret used to verify webhook authenticity.

‎src/context/dev/types/monitor_list_account_runs_response.py‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ class DataWebhookDeliveryError(BaseModel):
2222

2323

2424
class DataWebhookDelivery(BaseModel):
25-
"""The webhook delivery attempted for a change detected by this run.
26-
27-
Omitted when no webhook was attempted, including historical runs created before delivery tracking was added.
28-
"""
29-
3025
attempted_at: datetime
3126

3227
error: Optional[DataWebhookDeliveryError] = None
3328

29+
event: Literal["change.detected", "run.completed"]
30+
"""The event this delivery carried.
31+
32+
Deliveries recorded before event selection existed report change.detected.
33+
"""
34+
3435
event_id: str
3536
"""Identifier sent in the X-Context-Id header."""
3637

@@ -90,11 +91,18 @@ class Data(BaseModel):
9091

9192
started_at: Optional[datetime] = None
9293

93-
webhook_delivery: Optional[DataWebhookDelivery] = None
94-
"""The webhook delivery attempted for a change detected by this run.
94+
webhook_deliveries: Optional[List[DataWebhookDelivery]] = None
95+
"""
96+
All webhook deliveries attempted by this run — one per subscribed event that
97+
fired. Omitted when no webhook was attempted, including runs created before
98+
event selection was added.
99+
"""
95100

96-
Omitted when no webhook was attempted, including historical runs created before
97-
delivery tracking was added.
101+
webhook_delivery: Optional[DataWebhookDelivery] = None
102+
"""
103+
Deprecated: use `webhook_deliveries`, which records every attempt now that a run
104+
can deliver multiple events. Omitted when no webhook was attempted, including
105+
historical runs created before delivery tracking was added.
98106
"""
99107

100108

‎src/context/dev/types/monitor_list_response.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,15 @@ class DataLastError(BaseModel):
210210

211211
class DataWebhook(BaseModel):
212212
url: str
213-
"""Webhook URL called when a change is detected."""
213+
"""Webhook URL events are delivered to."""
214+
215+
events: Optional[List[Literal["change.detected", "run.completed"]]] = None
216+
"""Events delivered to this endpoint.
217+
218+
`change.detected` fires only when a run detects a change; `run.completed` fires
219+
on every completed run — including runs that detected no change — and embeds the
220+
change when one was detected. Defaults to `["change.detected"]` when omitted.
221+
"""
214222

215223
secret: Optional[str] = None
216224
"""Signing secret used to verify webhook authenticity.

‎src/context/dev/types/monitor_list_runs_response.py‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ class DataWebhookDeliveryError(BaseModel):
2222

2323

2424
class DataWebhookDelivery(BaseModel):
25-
"""The webhook delivery attempted for a change detected by this run.
26-
27-
Omitted when no webhook was attempted, including historical runs created before delivery tracking was added.
28-
"""
29-
3025
attempted_at: datetime
3126

3227
error: Optional[DataWebhookDeliveryError] = None
3328

29+
event: Literal["change.detected", "run.completed"]
30+
"""The event this delivery carried.
31+
32+
Deliveries recorded before event selection existed report change.detected.
33+
"""
34+
3435
event_id: str
3536
"""Identifier sent in the X-Context-Id header."""
3637

@@ -90,11 +91,18 @@ class Data(BaseModel):
9091

9192
started_at: Optional[datetime] = None
9293

93-
webhook_delivery: Optional[DataWebhookDelivery] = None
94-
"""The webhook delivery attempted for a change detected by this run.
94+
webhook_deliveries: Optional[List[DataWebhookDelivery]] = None
95+
"""
96+
All webhook deliveries attempted by this run — one per subscribed event that
97+
fired. Omitted when no webhook was attempted, including runs created before
98+
event selection was added.
99+
"""
95100

96-
Omitted when no webhook was attempted, including historical runs created before
97-
delivery tracking was added.
101+
webhook_delivery: Optional[DataWebhookDelivery] = None
102+
"""
103+
Deprecated: use `webhook_deliveries`, which records every attempt now that a run
104+
can deliver multiple events. Omitted when no webhook was attempted, including
105+
historical runs created before delivery tracking was added.
98106
"""
99107

100108

‎src/context/dev/types/monitor_retrieve_response.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,15 @@ class LastError(BaseModel):
209209

210210
class Webhook(BaseModel):
211211
url: str
212-
"""Webhook URL called when a change is detected."""
212+
"""Webhook URL events are delivered to."""
213+
214+
events: Optional[List[Literal["change.detected", "run.completed"]]] = None
215+
"""Events delivered to this endpoint.
216+
217+
`change.detected` fires only when a run detects a change; `run.completed` fires
218+
on every completed run — including runs that detected no change — and embeds the
219+
change when one was detected. Defaults to `["change.detected"]` when omitted.
220+
"""
213221

214222
secret: Optional[str] = None
215223
"""Signing secret used to verify webhook authenticity.

‎src/context/dev/types/monitor_update_params.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Union, Optional
5+
from typing import Dict, List, Union, Optional
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

88
from .._types import SequenceNotStr
@@ -166,4 +166,12 @@ class Webhook(TypedDict, total=False):
166166
"""Set to null to remove the webhook."""
167167

168168
url: Required[str]
169-
"""Webhook URL called when a change is detected."""
169+
"""Webhook URL events are delivered to."""
170+
171+
events: List[Literal["change.detected", "run.completed"]]
172+
"""Events delivered to this endpoint.
173+
174+
`change.detected` fires only when a run detects a change; `run.completed` fires
175+
on every completed run — including runs that detected no change — and embeds the
176+
change when one was detected. Defaults to `["change.detected"]` when omitted.
177+
"""

0 commit comments

Comments
 (0)