Skip to content

Commit e1fc5b0

Browse files
author
stlc-bot
committed
fix(openapi): keep legacy batch inputs in the spec as deprecated (#2225)
feat(access-policies): limit which websites API requests can reach (#2213) Stainless-Generated-From: e233a5d0cea50cb9e7a58233cab4164ad91cd8cc
1 parent 1e9f41e commit e1fc5b0

31 files changed

Lines changed: 234 additions & 0 deletions

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ def submit(
290290
self,
291291
*,
292292
input: batch_submit_params.Input,
293+
policies: SequenceNotStr[str] | Omit = omit,
293294
tags: SequenceNotStr[str] | Omit = omit,
294295
webhook: batch_submit_params.Webhook | Omit = omit,
295296
webhook_url: str | Omit = omit,
@@ -310,6 +311,8 @@ def submit(
310311
Args:
311312
input: Choose a URL list or a site crawl.
312313
314+
policies: Access policy IDs to apply to every page. A URL must pass every policy.
315+
313316
tags: Tags stored on the batch. Filter the batch list by them later.
314317
315318
webhook: Where to send the batch's final-status event. Omit `retry` for one attempt; `{}`
@@ -335,6 +338,7 @@ def submit(
335338
body=maybe_transform(
336339
{
337340
"input": input,
341+
"policies": policies,
338342
"tags": tags,
339343
"webhook": webhook,
340344
"webhook_url": webhook_url,
@@ -609,6 +613,7 @@ async def submit(
609613
self,
610614
*,
611615
input: batch_submit_params.Input,
616+
policies: SequenceNotStr[str] | Omit = omit,
612617
tags: SequenceNotStr[str] | Omit = omit,
613618
webhook: batch_submit_params.Webhook | Omit = omit,
614619
webhook_url: str | Omit = omit,
@@ -629,6 +634,8 @@ async def submit(
629634
Args:
630635
input: Choose a URL list or a site crawl.
631636
637+
policies: Access policy IDs to apply to every page. A URL must pass every policy.
638+
632639
tags: Tags stored on the batch. Filter the batch list by them later.
633640
634641
webhook: Where to send the batch's final-status event. Omit `retry` for one attempt; `{}`
@@ -654,6 +661,7 @@ async def submit(
654661
body=await async_maybe_transform(
655662
{
656663
"input": input,
664+
"policies": policies,
657665
"tags": tags,
658666
"webhook": webhook,
659667
"webhook_url": webhook_url,

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def retrieve(
178178
| Omit = omit,
179179
max_age_ms: int | Omit = omit,
180180
max_speed: bool | Omit = omit,
181+
policies: SequenceNotStr[str] | Omit = omit,
181182
tags: SequenceNotStr[str] | Omit = omit,
182183
timeout_opts: brand_retrieve_params.BrandRetrieveByDomainRequestTimeoutOpts | Omit = omit,
183184
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -203,6 +204,8 @@ def retrieve(
203204
the API will skip time-consuming operations for faster response at the cost of
204205
less comprehensive data.
205206
207+
policies: Access policy IDs to apply. A URL must pass every policy.
208+
206209
tags: Labels for filtering usage in the dashboard.
207210
208211
timeout_opts: Request deadline and what to return when it passes.
@@ -592,6 +595,7 @@ def retrieve(
592595
| Omit = omit,
593596
max_age_ms: int | Omit = omit,
594597
max_speed: bool | Omit = omit,
598+
policies: SequenceNotStr[str] | Omit = omit,
595599
tags: SequenceNotStr[str] | Omit = omit,
596600
timeout_opts: brand_retrieve_params.BrandRetrieveByNameRequestTimeoutOpts | Omit = omit,
597601
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -620,6 +624,8 @@ def retrieve(
620624
the API will skip time-consuming operations for faster response at the cost of
621625
less comprehensive data.
622626
627+
policies: Access policy IDs to apply. A URL must pass every policy.
628+
623629
tags: Labels for filtering usage in the dashboard.
624630
625631
timeout_opts: Request deadline and what to return when it passes.
@@ -767,6 +773,7 @@ def retrieve(
767773
| Omit = omit,
768774
max_age_ms: int | Omit = omit,
769775
max_speed: bool | Omit = omit,
776+
policies: SequenceNotStr[str] | Omit = omit,
770777
tags: SequenceNotStr[str] | Omit = omit,
771778
timeout_opts: brand_retrieve_params.BrandRetrieveByEmailRequestTimeoutOpts | Omit = omit,
772779
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -792,6 +799,8 @@ def retrieve(
792799
the API will skip time-consuming operations for faster response at the cost of
793800
less comprehensive data.
794801
802+
policies: Access policy IDs to apply. A URL must pass every policy.
803+
795804
tags: Labels for filtering usage in the dashboard.
796805
797806
timeout_opts: Request deadline and what to return when it passes.
@@ -939,6 +948,7 @@ def retrieve(
939948
| Omit = omit,
940949
max_age_ms: int | Omit = omit,
941950
max_speed: bool | Omit = omit,
951+
policies: SequenceNotStr[str] | Omit = omit,
942952
tags: SequenceNotStr[str] | Omit = omit,
943953
ticker_exchange: Literal[
944954
"AMEX",
@@ -1039,6 +1049,8 @@ def retrieve(
10391049
the API will skip time-consuming operations for faster response at the cost of
10401050
less comprehensive data.
10411051
1052+
policies: Access policy IDs to apply. A URL must pass every policy.
1053+
10421054
tags: Labels for filtering usage in the dashboard.
10431055
10441056
ticker_exchange: Stock exchange code.
@@ -1061,6 +1073,7 @@ def retrieve(
10611073
*,
10621074
direct_url: str,
10631075
type: Literal["by_direct_url"],
1076+
policies: SequenceNotStr[str] | Omit = omit,
10641077
tags: SequenceNotStr[str] | Omit = omit,
10651078
timeout_opts: brand_retrieve_params.BrandRetrieveByDirectURLRequestTimeoutOpts | Omit = omit,
10661079
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1081,6 +1094,8 @@ def retrieve(
10811094
10821095
type: Discriminator for direct-URL-based brand retrieval.
10831096
1097+
policies: Access policy IDs to apply. A URL must pass every policy.
1098+
10841099
tags: Labels for filtering usage in the dashboard.
10851100
10861101
timeout_opts: Request deadline and what to return when it passes.
@@ -1473,6 +1488,7 @@ def retrieve(
14731488
max_speed: bool | Omit = omit,
14741489
mcc: Union[str, float] | Omit = omit,
14751490
phone: Union[str, float] | Omit = omit,
1491+
policies: SequenceNotStr[str] | Omit = omit,
14761492
tags: SequenceNotStr[str] | Omit = omit,
14771493
timeout_opts: brand_retrieve_params.BrandRetrieveFromTransactionRequestTimeoutOpts | Omit = omit,
14781494
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1508,6 +1524,8 @@ def retrieve(
15081524
15091525
phone: Optional phone number from the transaction to help verify brand match.
15101526
1527+
policies: Access policy IDs to apply. A URL must pass every policy.
1528+
15111529
tags: Labels for filtering usage in the dashboard.
15121530
15131531
timeout_opts: Request deadline and what to return when it passes.
@@ -1667,6 +1685,7 @@ def retrieve(
16671685
| Omit = omit,
16681686
max_age_ms: int | Omit = omit,
16691687
max_speed: bool | Omit = omit,
1688+
policies: SequenceNotStr[str] | Omit = omit,
16701689
tags: SequenceNotStr[str] | Omit = omit,
16711690
timeout_opts: brand_retrieve_params.BrandRetrieveByDomainRequestTimeoutOpts
16721691
| brand_retrieve_params.BrandRetrieveByNameRequestTimeoutOpts
@@ -2017,6 +2036,7 @@ def retrieve(
20172036
"force_language": force_language,
20182037
"max_age_ms": max_age_ms,
20192038
"max_speed": max_speed,
2039+
"policies": policies,
20202040
"tags": tags,
20212041
"timeout_opts": timeout_opts,
20222042
"name": name,
@@ -2641,6 +2661,7 @@ async def retrieve(
26412661
| Omit = omit,
26422662
max_age_ms: int | Omit = omit,
26432663
max_speed: bool | Omit = omit,
2664+
policies: SequenceNotStr[str] | Omit = omit,
26442665
tags: SequenceNotStr[str] | Omit = omit,
26452666
timeout_opts: brand_retrieve_params.BrandRetrieveByDomainRequestTimeoutOpts | Omit = omit,
26462667
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -2666,6 +2687,8 @@ async def retrieve(
26662687
the API will skip time-consuming operations for faster response at the cost of
26672688
less comprehensive data.
26682689
2690+
policies: Access policy IDs to apply. A URL must pass every policy.
2691+
26692692
tags: Labels for filtering usage in the dashboard.
26702693
26712694
timeout_opts: Request deadline and what to return when it passes.
@@ -3055,6 +3078,7 @@ async def retrieve(
30553078
| Omit = omit,
30563079
max_age_ms: int | Omit = omit,
30573080
max_speed: bool | Omit = omit,
3081+
policies: SequenceNotStr[str] | Omit = omit,
30583082
tags: SequenceNotStr[str] | Omit = omit,
30593083
timeout_opts: brand_retrieve_params.BrandRetrieveByNameRequestTimeoutOpts | Omit = omit,
30603084
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -3083,6 +3107,8 @@ async def retrieve(
30833107
the API will skip time-consuming operations for faster response at the cost of
30843108
less comprehensive data.
30853109
3110+
policies: Access policy IDs to apply. A URL must pass every policy.
3111+
30863112
tags: Labels for filtering usage in the dashboard.
30873113
30883114
timeout_opts: Request deadline and what to return when it passes.
@@ -3230,6 +3256,7 @@ async def retrieve(
32303256
| Omit = omit,
32313257
max_age_ms: int | Omit = omit,
32323258
max_speed: bool | Omit = omit,
3259+
policies: SequenceNotStr[str] | Omit = omit,
32333260
tags: SequenceNotStr[str] | Omit = omit,
32343261
timeout_opts: brand_retrieve_params.BrandRetrieveByEmailRequestTimeoutOpts | Omit = omit,
32353262
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -3255,6 +3282,8 @@ async def retrieve(
32553282
the API will skip time-consuming operations for faster response at the cost of
32563283
less comprehensive data.
32573284
3285+
policies: Access policy IDs to apply. A URL must pass every policy.
3286+
32583287
tags: Labels for filtering usage in the dashboard.
32593288
32603289
timeout_opts: Request deadline and what to return when it passes.
@@ -3402,6 +3431,7 @@ async def retrieve(
34023431
| Omit = omit,
34033432
max_age_ms: int | Omit = omit,
34043433
max_speed: bool | Omit = omit,
3434+
policies: SequenceNotStr[str] | Omit = omit,
34053435
tags: SequenceNotStr[str] | Omit = omit,
34063436
ticker_exchange: Literal[
34073437
"AMEX",
@@ -3502,6 +3532,8 @@ async def retrieve(
35023532
the API will skip time-consuming operations for faster response at the cost of
35033533
less comprehensive data.
35043534
3535+
policies: Access policy IDs to apply. A URL must pass every policy.
3536+
35053537
tags: Labels for filtering usage in the dashboard.
35063538
35073539
ticker_exchange: Stock exchange code.
@@ -3524,6 +3556,7 @@ async def retrieve(
35243556
*,
35253557
direct_url: str,
35263558
type: Literal["by_direct_url"],
3559+
policies: SequenceNotStr[str] | Omit = omit,
35273560
tags: SequenceNotStr[str] | Omit = omit,
35283561
timeout_opts: brand_retrieve_params.BrandRetrieveByDirectURLRequestTimeoutOpts | Omit = omit,
35293562
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -3544,6 +3577,8 @@ async def retrieve(
35443577
35453578
type: Discriminator for direct-URL-based brand retrieval.
35463579
3580+
policies: Access policy IDs to apply. A URL must pass every policy.
3581+
35473582
tags: Labels for filtering usage in the dashboard.
35483583
35493584
timeout_opts: Request deadline and what to return when it passes.
@@ -3936,6 +3971,7 @@ async def retrieve(
39363971
max_speed: bool | Omit = omit,
39373972
mcc: Union[str, float] | Omit = omit,
39383973
phone: Union[str, float] | Omit = omit,
3974+
policies: SequenceNotStr[str] | Omit = omit,
39393975
tags: SequenceNotStr[str] | Omit = omit,
39403976
timeout_opts: brand_retrieve_params.BrandRetrieveFromTransactionRequestTimeoutOpts | Omit = omit,
39413977
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -3971,6 +4007,8 @@ async def retrieve(
39714007
39724008
phone: Optional phone number from the transaction to help verify brand match.
39734009
4010+
policies: Access policy IDs to apply. A URL must pass every policy.
4011+
39744012
tags: Labels for filtering usage in the dashboard.
39754013
39764014
timeout_opts: Request deadline and what to return when it passes.
@@ -4130,6 +4168,7 @@ async def retrieve(
41304168
| Omit = omit,
41314169
max_age_ms: int | Omit = omit,
41324170
max_speed: bool | Omit = omit,
4171+
policies: SequenceNotStr[str] | Omit = omit,
41334172
tags: SequenceNotStr[str] | Omit = omit,
41344173
timeout_opts: brand_retrieve_params.BrandRetrieveByDomainRequestTimeoutOpts
41354174
| brand_retrieve_params.BrandRetrieveByNameRequestTimeoutOpts
@@ -4480,6 +4519,7 @@ async def retrieve(
44804519
"force_language": force_language,
44814520
"max_age_ms": max_age_ms,
44824521
"max_speed": max_speed,
4522+
"policies": policies,
44834523
"tags": tags,
44844524
"timeout_opts": timeout_opts,
44854525
"name": name,

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def create(
7777
target: monitor_create_params.Target,
7878
change_detection: monitor_create_params.ChangeDetection | Omit = omit,
7979
mode: Literal["web"] | Omit = omit,
80+
policies: SequenceNotStr[str] | Omit = omit,
8081
schedule: monitor_create_params.Schedule | Omit = omit,
8182
tags: SequenceNotStr[str] | Omit = omit,
8283
webhook: Optional[monitor_create_params.Webhook] | Omit = omit,
@@ -102,6 +103,8 @@ def create(
102103
103104
mode: Always `web`. Optional.
104105
106+
policies: Access policy IDs to apply to every run.
107+
105108
schedule: Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
106109
every 6 hours or every 2 days. The total interval (frequency × unit) must be
107110
between 10 minutes and 1 year.
@@ -126,6 +129,7 @@ def create(
126129
"target": target,
127130
"change_detection": change_detection,
128131
"mode": mode,
132+
"policies": policies,
129133
"schedule": schedule,
130134
"tags": tags,
131135
"webhook": webhook,
@@ -179,6 +183,7 @@ def update(
179183
*,
180184
change_detection: monitor_update_params.ChangeDetection | Omit = omit,
181185
name: str | Omit = omit,
186+
policies: SequenceNotStr[str] | Omit = omit,
182187
schedule: monitor_update_params.Schedule | Omit = omit,
183188
status: Literal["active", "paused"] | Omit = omit,
184189
tags: SequenceNotStr[str] | Omit = omit,
@@ -204,6 +209,8 @@ def update(
204209
205210
name: Display name for the monitor.
206211
212+
policies: Access policy IDs to apply to every run. Send an empty list to remove them.
213+
207214
schedule: Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
208215
every 6 hours or every 2 days. The total interval (frequency × unit) must be
209216
between 10 minutes and 1 year.
@@ -232,6 +239,7 @@ def update(
232239
{
233240
"change_detection": change_detection,
234241
"name": name,
242+
"policies": policies,
235243
"schedule": schedule,
236244
"status": status,
237245
"tags": tags,
@@ -843,6 +851,7 @@ async def create(
843851
target: monitor_create_params.Target,
844852
change_detection: monitor_create_params.ChangeDetection | Omit = omit,
845853
mode: Literal["web"] | Omit = omit,
854+
policies: SequenceNotStr[str] | Omit = omit,
846855
schedule: monitor_create_params.Schedule | Omit = omit,
847856
tags: SequenceNotStr[str] | Omit = omit,
848857
webhook: Optional[monitor_create_params.Webhook] | Omit = omit,
@@ -868,6 +877,8 @@ async def create(
868877
869878
mode: Always `web`. Optional.
870879
880+
policies: Access policy IDs to apply to every run.
881+
871882
schedule: Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
872883
every 6 hours or every 2 days. The total interval (frequency × unit) must be
873884
between 10 minutes and 1 year.
@@ -892,6 +903,7 @@ async def create(
892903
"target": target,
893904
"change_detection": change_detection,
894905
"mode": mode,
906+
"policies": policies,
895907
"schedule": schedule,
896908
"tags": tags,
897909
"webhook": webhook,
@@ -945,6 +957,7 @@ async def update(
945957
*,
946958
change_detection: monitor_update_params.ChangeDetection | Omit = omit,
947959
name: str | Omit = omit,
960+
policies: SequenceNotStr[str] | Omit = omit,
948961
schedule: monitor_update_params.Schedule | Omit = omit,
949962
status: Literal["active", "paused"] | Omit = omit,
950963
tags: SequenceNotStr[str] | Omit = omit,
@@ -970,6 +983,8 @@ async def update(
970983
971984
name: Display name for the monitor.
972985
986+
policies: Access policy IDs to apply to every run. Send an empty list to remove them.
987+
973988
schedule: Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
974989
every 6 hours or every 2 days. The total interval (frequency × unit) must be
975990
between 10 minutes and 1 year.
@@ -998,6 +1013,7 @@ async def update(
9981013
{
9991014
"change_detection": change_detection,
10001015
"name": name,
1016+
"policies": policies,
10011017
"schedule": schedule,
10021018
"status": status,
10031019
"tags": tags,

0 commit comments

Comments
 (0)