2
2
3
3
from __future__ import annotations
4
4
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
5
12
from ...._compat import cached_property
6
13
from ...._resource import SyncAPIResource , AsyncAPIResource
14
+ from ...._response import to_streamed_response_wrapper , async_to_streamed_response_wrapper
7
15
from .configuration import (
8
16
Configuration ,
9
17
AsyncConfiguration ,
12
20
ConfigurationWithStreamingResponse ,
13
21
AsyncConfigurationWithStreamingResponse ,
14
22
)
23
+ from ...._base_client import (
24
+ make_request_options ,
25
+ )
26
+ from ....types .sandbox import JobCreateResponse , job_create_params
15
27
16
28
__all__ = ["Jobs" , "AsyncJobs" ]
17
29
@@ -29,6 +41,41 @@ def with_raw_response(self) -> JobsWithRawResponse:
29
41
def with_streaming_response (self ) -> JobsWithStreamingResponse :
30
42
return JobsWithStreamingResponse (self )
31
43
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
+
32
79
33
80
class AsyncJobs (AsyncAPIResource ):
34
81
@cached_property
@@ -43,11 +90,50 @@ def with_raw_response(self) -> AsyncJobsWithRawResponse:
43
90
def with_streaming_response (self ) -> AsyncJobsWithStreamingResponse :
44
91
return AsyncJobsWithStreamingResponse (self )
45
92
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
+
46
128
47
129
class JobsWithRawResponse :
48
130
def __init__ (self , jobs : Jobs ) -> None :
49
131
self ._jobs = jobs
50
132
133
+ self .create = _legacy_response .to_raw_response_wrapper (
134
+ jobs .create ,
135
+ )
136
+
51
137
@cached_property
52
138
def configuration (self ) -> ConfigurationWithRawResponse :
53
139
return ConfigurationWithRawResponse (self ._jobs .configuration )
@@ -57,6 +143,10 @@ class AsyncJobsWithRawResponse:
57
143
def __init__ (self , jobs : AsyncJobs ) -> None :
58
144
self ._jobs = jobs
59
145
146
+ self .create = _legacy_response .async_to_raw_response_wrapper (
147
+ jobs .create ,
148
+ )
149
+
60
150
@cached_property
61
151
def configuration (self ) -> AsyncConfigurationWithRawResponse :
62
152
return AsyncConfigurationWithRawResponse (self ._jobs .configuration )
@@ -66,6 +156,10 @@ class JobsWithStreamingResponse:
66
156
def __init__ (self , jobs : Jobs ) -> None :
67
157
self ._jobs = jobs
68
158
159
+ self .create = to_streamed_response_wrapper (
160
+ jobs .create ,
161
+ )
162
+
69
163
@cached_property
70
164
def configuration (self ) -> ConfigurationWithStreamingResponse :
71
165
return ConfigurationWithStreamingResponse (self ._jobs .configuration )
@@ -75,6 +169,10 @@ class AsyncJobsWithStreamingResponse:
75
169
def __init__ (self , jobs : AsyncJobs ) -> None :
76
170
self ._jobs = jobs
77
171
172
+ self .create = async_to_streamed_response_wrapper (
173
+ jobs .create ,
174
+ )
175
+
78
176
@cached_property
79
177
def configuration (self ) -> AsyncConfigurationWithStreamingResponse :
80
178
return AsyncConfigurationWithStreamingResponse (self ._jobs .configuration )
0 commit comments