22
33from __future__ import annotations
44
5+ from typing_extensions import Literal
6+
7+ import httpx
8+
9+ from .... import _legacy_response
10+ from ...._types import NOT_GIVEN , Body , Query , Headers , NotGiven
11+ from ...._utils import maybe_transform
512from ...._compat import cached_property
613from ...._resource import SyncAPIResource , AsyncAPIResource
14+ from ...._response import to_streamed_response_wrapper , async_to_streamed_response_wrapper
715from .configuration import (
816 Configuration ,
917 AsyncConfiguration ,
1220 ConfigurationWithStreamingResponse ,
1321 AsyncConfigurationWithStreamingResponse ,
1422)
23+ from ...._base_client import (
24+ make_request_options ,
25+ )
26+ from ....types .sandbox import JobCreateResponse , job_create_params
1527
1628__all__ = ["Jobs" , "AsyncJobs" ]
1729
@@ -29,6 +41,41 @@ def with_raw_response(self) -> JobsWithRawResponse:
2941 def with_streaming_response (self ) -> JobsWithStreamingResponse :
3042 return JobsWithStreamingResponse (self )
3143
44+ def create (
45+ self ,
46+ * ,
47+ type : Literal ["data_sync_all" ],
48+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
49+ # The extra values given here take precedence over values defined on the client or passed to this method.
50+ extra_headers : Headers | None = None ,
51+ extra_query : Query | None = None ,
52+ extra_body : Body | None = None ,
53+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
54+ ) -> JobCreateResponse :
55+ """Enqueue a new sandbox job
56+
57+ Args:
58+ type: The type of job to start.
59+
60+ Currently the only supported type is `data_sync_all`
61+
62+ extra_headers: Send extra headers
63+
64+ extra_query: Add additional query parameters to the request
65+
66+ extra_body: Add additional JSON properties to the request
67+
68+ timeout: Override the client-level default timeout for this request, in seconds
69+ """
70+ return self ._post (
71+ "/sandbox/jobs" ,
72+ body = maybe_transform ({"type" : type }, job_create_params .JobCreateParams ),
73+ options = make_request_options (
74+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
75+ ),
76+ cast_to = JobCreateResponse ,
77+ )
78+
3279
3380class AsyncJobs (AsyncAPIResource ):
3481 @cached_property
@@ -43,11 +90,50 @@ def with_raw_response(self) -> AsyncJobsWithRawResponse:
4390 def with_streaming_response (self ) -> AsyncJobsWithStreamingResponse :
4491 return AsyncJobsWithStreamingResponse (self )
4592
93+ async def create (
94+ self ,
95+ * ,
96+ type : Literal ["data_sync_all" ],
97+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
98+ # The extra values given here take precedence over values defined on the client or passed to this method.
99+ extra_headers : Headers | None = None ,
100+ extra_query : Query | None = None ,
101+ extra_body : Body | None = None ,
102+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
103+ ) -> JobCreateResponse :
104+ """Enqueue a new sandbox job
105+
106+ Args:
107+ type: The type of job to start.
108+
109+ Currently the only supported type is `data_sync_all`
110+
111+ extra_headers: Send extra headers
112+
113+ extra_query: Add additional query parameters to the request
114+
115+ extra_body: Add additional JSON properties to the request
116+
117+ timeout: Override the client-level default timeout for this request, in seconds
118+ """
119+ return await self ._post (
120+ "/sandbox/jobs" ,
121+ body = maybe_transform ({"type" : type }, job_create_params .JobCreateParams ),
122+ options = make_request_options (
123+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
124+ ),
125+ cast_to = JobCreateResponse ,
126+ )
127+
46128
47129class JobsWithRawResponse :
48130 def __init__ (self , jobs : Jobs ) -> None :
49131 self ._jobs = jobs
50132
133+ self .create = _legacy_response .to_raw_response_wrapper (
134+ jobs .create ,
135+ )
136+
51137 @cached_property
52138 def configuration (self ) -> ConfigurationWithRawResponse :
53139 return ConfigurationWithRawResponse (self ._jobs .configuration )
@@ -57,6 +143,10 @@ class AsyncJobsWithRawResponse:
57143 def __init__ (self , jobs : AsyncJobs ) -> None :
58144 self ._jobs = jobs
59145
146+ self .create = _legacy_response .async_to_raw_response_wrapper (
147+ jobs .create ,
148+ )
149+
60150 @cached_property
61151 def configuration (self ) -> AsyncConfigurationWithRawResponse :
62152 return AsyncConfigurationWithRawResponse (self ._jobs .configuration )
@@ -66,6 +156,10 @@ class JobsWithStreamingResponse:
66156 def __init__ (self , jobs : Jobs ) -> None :
67157 self ._jobs = jobs
68158
159+ self .create = to_streamed_response_wrapper (
160+ jobs .create ,
161+ )
162+
69163 @cached_property
70164 def configuration (self ) -> ConfigurationWithStreamingResponse :
71165 return ConfigurationWithStreamingResponse (self ._jobs .configuration )
@@ -75,6 +169,10 @@ class AsyncJobsWithStreamingResponse:
75169 def __init__ (self , jobs : AsyncJobs ) -> None :
76170 self ._jobs = jobs
77171
172+ self .create = async_to_streamed_response_wrapper (
173+ jobs .create ,
174+ )
175+
78176 @cached_property
79177 def configuration (self ) -> AsyncConfigurationWithStreamingResponse :
80178 return AsyncConfigurationWithStreamingResponse (self ._jobs .configuration )
0 commit comments