16
16
)
17
17
from ...pagination import SyncBenchmarkRunsCursorIDPage , AsyncBenchmarkRunsCursorIDPage
18
18
from ..._base_client import AsyncPaginator , make_request_options
19
- from ...types .benchmarks import run_list_params
19
+ from ...types .benchmarks import run_list_params , run_list_scenario_runs_params
20
+ from ...types .scenario_run_view import ScenarioRunView
20
21
from ...types .benchmark_run_view import BenchmarkRunView
21
22
22
23
__all__ = ["RunsResource" , "AsyncRunsResource" ]
@@ -206,6 +207,56 @@ def complete(
206
207
cast_to = BenchmarkRunView ,
207
208
)
208
209
210
+ def list_scenario_runs (
211
+ self ,
212
+ id : str ,
213
+ * ,
214
+ limit : int | NotGiven = NOT_GIVEN ,
215
+ starting_after : str | NotGiven = NOT_GIVEN ,
216
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
217
+ # The extra values given here take precedence over values defined on the client or passed to this method.
218
+ extra_headers : Headers | None = None ,
219
+ extra_query : Query | None = None ,
220
+ extra_body : Body | None = None ,
221
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
222
+ ) -> SyncBenchmarkRunsCursorIDPage [ScenarioRunView ]:
223
+ """
224
+ List started scenario runs for a benchmark run.
225
+
226
+ Args:
227
+ limit: The limit of items to return. Default is 20.
228
+
229
+ starting_after: Load the next page of data starting after the item with the given ID.
230
+
231
+ extra_headers: Send extra headers
232
+
233
+ extra_query: Add additional query parameters to the request
234
+
235
+ extra_body: Add additional JSON properties to the request
236
+
237
+ timeout: Override the client-level default timeout for this request, in seconds
238
+ """
239
+ if not id :
240
+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
241
+ return self ._get_api_list (
242
+ f"/v1/benchmarks/runs/{ id } /scenario_runs" ,
243
+ page = SyncBenchmarkRunsCursorIDPage [ScenarioRunView ],
244
+ options = make_request_options (
245
+ extra_headers = extra_headers ,
246
+ extra_query = extra_query ,
247
+ extra_body = extra_body ,
248
+ timeout = timeout ,
249
+ query = maybe_transform (
250
+ {
251
+ "limit" : limit ,
252
+ "starting_after" : starting_after ,
253
+ },
254
+ run_list_scenario_runs_params .RunListScenarioRunsParams ,
255
+ ),
256
+ ),
257
+ model = ScenarioRunView ,
258
+ )
259
+
209
260
210
261
class AsyncRunsResource (AsyncAPIResource ):
211
262
@cached_property
@@ -391,6 +442,56 @@ async def complete(
391
442
cast_to = BenchmarkRunView ,
392
443
)
393
444
445
+ def list_scenario_runs (
446
+ self ,
447
+ id : str ,
448
+ * ,
449
+ limit : int | NotGiven = NOT_GIVEN ,
450
+ starting_after : str | NotGiven = NOT_GIVEN ,
451
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
452
+ # The extra values given here take precedence over values defined on the client or passed to this method.
453
+ extra_headers : Headers | None = None ,
454
+ extra_query : Query | None = None ,
455
+ extra_body : Body | None = None ,
456
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
457
+ ) -> AsyncPaginator [ScenarioRunView , AsyncBenchmarkRunsCursorIDPage [ScenarioRunView ]]:
458
+ """
459
+ List started scenario runs for a benchmark run.
460
+
461
+ Args:
462
+ limit: The limit of items to return. Default is 20.
463
+
464
+ starting_after: Load the next page of data starting after the item with the given ID.
465
+
466
+ extra_headers: Send extra headers
467
+
468
+ extra_query: Add additional query parameters to the request
469
+
470
+ extra_body: Add additional JSON properties to the request
471
+
472
+ timeout: Override the client-level default timeout for this request, in seconds
473
+ """
474
+ if not id :
475
+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
476
+ return self ._get_api_list (
477
+ f"/v1/benchmarks/runs/{ id } /scenario_runs" ,
478
+ page = AsyncBenchmarkRunsCursorIDPage [ScenarioRunView ],
479
+ options = make_request_options (
480
+ extra_headers = extra_headers ,
481
+ extra_query = extra_query ,
482
+ extra_body = extra_body ,
483
+ timeout = timeout ,
484
+ query = maybe_transform (
485
+ {
486
+ "limit" : limit ,
487
+ "starting_after" : starting_after ,
488
+ },
489
+ run_list_scenario_runs_params .RunListScenarioRunsParams ,
490
+ ),
491
+ ),
492
+ model = ScenarioRunView ,
493
+ )
494
+
394
495
395
496
class RunsResourceWithRawResponse :
396
497
def __init__ (self , runs : RunsResource ) -> None :
@@ -408,6 +509,9 @@ def __init__(self, runs: RunsResource) -> None:
408
509
self .complete = to_raw_response_wrapper (
409
510
runs .complete ,
410
511
)
512
+ self .list_scenario_runs = to_raw_response_wrapper (
513
+ runs .list_scenario_runs ,
514
+ )
411
515
412
516
413
517
class AsyncRunsResourceWithRawResponse :
@@ -426,6 +530,9 @@ def __init__(self, runs: AsyncRunsResource) -> None:
426
530
self .complete = async_to_raw_response_wrapper (
427
531
runs .complete ,
428
532
)
533
+ self .list_scenario_runs = async_to_raw_response_wrapper (
534
+ runs .list_scenario_runs ,
535
+ )
429
536
430
537
431
538
class RunsResourceWithStreamingResponse :
@@ -444,6 +551,9 @@ def __init__(self, runs: RunsResource) -> None:
444
551
self .complete = to_streamed_response_wrapper (
445
552
runs .complete ,
446
553
)
554
+ self .list_scenario_runs = to_streamed_response_wrapper (
555
+ runs .list_scenario_runs ,
556
+ )
447
557
448
558
449
559
class AsyncRunsResourceWithStreamingResponse :
@@ -462,3 +572,6 @@ def __init__(self, runs: AsyncRunsResource) -> None:
462
572
self .complete = async_to_streamed_response_wrapper (
463
573
runs .complete ,
464
574
)
575
+ self .list_scenario_runs = async_to_streamed_response_wrapper (
576
+ runs .list_scenario_runs ,
577
+ )
0 commit comments