9
9
from ..._compat import cached_property
10
10
from ..._resource import SyncAPIResource , AsyncAPIResource
11
11
from ..._response import (
12
+ BinaryAPIResponse ,
13
+ AsyncBinaryAPIResponse ,
14
+ StreamedBinaryAPIResponse ,
15
+ AsyncStreamedBinaryAPIResponse ,
12
16
to_raw_response_wrapper ,
13
17
to_streamed_response_wrapper ,
14
18
async_to_raw_response_wrapper ,
19
+ to_custom_raw_response_wrapper ,
15
20
async_to_streamed_response_wrapper ,
21
+ to_custom_streamed_response_wrapper ,
22
+ async_to_custom_raw_response_wrapper ,
23
+ async_to_custom_streamed_response_wrapper ,
16
24
)
17
25
from ...pagination import SyncBenchmarkRunsCursorIDPage , AsyncBenchmarkRunsCursorIDPage
18
26
from ..._exceptions import RunloopError
@@ -213,6 +221,48 @@ def complete(
213
221
cast_to = ScenarioRunView ,
214
222
)
215
223
224
+ def download_logs (
225
+ self ,
226
+ id : str ,
227
+ * ,
228
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
229
+ # The extra values given here take precedence over values defined on the client or passed to this method.
230
+ extra_headers : Headers | None = None ,
231
+ extra_query : Query | None = None ,
232
+ extra_body : Body | None = None ,
233
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
234
+ idempotency_key : str | None = None ,
235
+ ) -> BinaryAPIResponse :
236
+ """
237
+ Download a zip file containing all logs for a Scenario run from the associated
238
+ devbox.
239
+
240
+ Args:
241
+ extra_headers: Send extra headers
242
+
243
+ extra_query: Add additional query parameters to the request
244
+
245
+ extra_body: Add additional JSON properties to the request
246
+
247
+ timeout: Override the client-level default timeout for this request, in seconds
248
+
249
+ idempotency_key: Specify a custom idempotency key for this request
250
+ """
251
+ if not id :
252
+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
253
+ extra_headers = {"Accept" : "application/zip" , ** (extra_headers or {})}
254
+ return self ._post (
255
+ f"/v1/scenarios/runs/{ id } /download_logs" ,
256
+ options = make_request_options (
257
+ extra_headers = extra_headers ,
258
+ extra_query = extra_query ,
259
+ extra_body = extra_body ,
260
+ timeout = timeout ,
261
+ idempotency_key = idempotency_key ,
262
+ ),
263
+ cast_to = BinaryAPIResponse ,
264
+ )
265
+
216
266
def score (
217
267
self ,
218
268
id : str ,
@@ -583,6 +633,48 @@ async def complete(
583
633
cast_to = ScenarioRunView ,
584
634
)
585
635
636
+ async def download_logs (
637
+ self ,
638
+ id : str ,
639
+ * ,
640
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
641
+ # The extra values given here take precedence over values defined on the client or passed to this method.
642
+ extra_headers : Headers | None = None ,
643
+ extra_query : Query | None = None ,
644
+ extra_body : Body | None = None ,
645
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
646
+ idempotency_key : str | None = None ,
647
+ ) -> AsyncBinaryAPIResponse :
648
+ """
649
+ Download a zip file containing all logs for a Scenario run from the associated
650
+ devbox.
651
+
652
+ Args:
653
+ extra_headers: Send extra headers
654
+
655
+ extra_query: Add additional query parameters to the request
656
+
657
+ extra_body: Add additional JSON properties to the request
658
+
659
+ timeout: Override the client-level default timeout for this request, in seconds
660
+
661
+ idempotency_key: Specify a custom idempotency key for this request
662
+ """
663
+ if not id :
664
+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
665
+ extra_headers = {"Accept" : "application/zip" , ** (extra_headers or {})}
666
+ return await self ._post (
667
+ f"/v1/scenarios/runs/{ id } /download_logs" ,
668
+ options = make_request_options (
669
+ extra_headers = extra_headers ,
670
+ extra_query = extra_query ,
671
+ extra_body = extra_body ,
672
+ timeout = timeout ,
673
+ idempotency_key = idempotency_key ,
674
+ ),
675
+ cast_to = AsyncBinaryAPIResponse ,
676
+ )
677
+
586
678
async def score (
587
679
self ,
588
680
id : str ,
@@ -782,6 +874,10 @@ def __init__(self, runs: RunsResource) -> None:
782
874
self .complete = to_raw_response_wrapper (
783
875
runs .complete ,
784
876
)
877
+ self .download_logs = to_custom_raw_response_wrapper (
878
+ runs .download_logs ,
879
+ BinaryAPIResponse ,
880
+ )
785
881
self .score = to_raw_response_wrapper (
786
882
runs .score ,
787
883
)
@@ -803,6 +899,10 @@ def __init__(self, runs: AsyncRunsResource) -> None:
803
899
self .complete = async_to_raw_response_wrapper (
804
900
runs .complete ,
805
901
)
902
+ self .download_logs = async_to_custom_raw_response_wrapper (
903
+ runs .download_logs ,
904
+ AsyncBinaryAPIResponse ,
905
+ )
806
906
self .score = async_to_raw_response_wrapper (
807
907
runs .score ,
808
908
)
@@ -824,6 +924,10 @@ def __init__(self, runs: RunsResource) -> None:
824
924
self .complete = to_streamed_response_wrapper (
825
925
runs .complete ,
826
926
)
927
+ self .download_logs = to_custom_streamed_response_wrapper (
928
+ runs .download_logs ,
929
+ StreamedBinaryAPIResponse ,
930
+ )
827
931
self .score = to_streamed_response_wrapper (
828
932
runs .score ,
829
933
)
@@ -845,6 +949,10 @@ def __init__(self, runs: AsyncRunsResource) -> None:
845
949
self .complete = async_to_streamed_response_wrapper (
846
950
runs .complete ,
847
951
)
952
+ self .download_logs = async_to_custom_streamed_response_wrapper (
953
+ runs .download_logs ,
954
+ AsyncStreamedBinaryAPIResponse ,
955
+ )
848
956
self .score = async_to_streamed_response_wrapper (
849
957
runs .score ,
850
958
)
0 commit comments