2
2
3
3
from __future__ import annotations
4
4
5
- from typing import Optional
6
-
7
- import httpx
8
-
9
- from ...types import commit_create_params
10
- from ..._types import NOT_GIVEN , Body , Query , Headers , NotGiven
11
- from ..._utils import (
12
- maybe_transform ,
13
- async_maybe_transform ,
14
- )
15
5
from ..._compat import cached_property
16
6
from ..._resource import SyncAPIResource , AsyncAPIResource
17
- from ..._response import (
18
- to_raw_response_wrapper ,
19
- to_streamed_response_wrapper ,
20
- async_to_raw_response_wrapper ,
21
- async_to_streamed_response_wrapper ,
22
- )
23
7
from .test_results import (
24
8
TestResultsResource ,
25
9
AsyncTestResultsResource ,
28
12
TestResultsResourceWithStreamingResponse ,
29
13
AsyncTestResultsResourceWithStreamingResponse ,
30
14
)
31
- from ..._base_client import make_request_options
32
- from ...types .commit_create_response import CommitCreateResponse
33
15
34
16
__all__ = ["CommitsResource" , "AsyncCommitsResource" ]
35
17
@@ -58,60 +40,6 @@ def with_streaming_response(self) -> CommitsResourceWithStreamingResponse:
58
40
"""
59
41
return CommitsResourceWithStreamingResponse (self )
60
42
61
- def create (
62
- self ,
63
- project_id : str ,
64
- * ,
65
- commit : commit_create_params .Commit ,
66
- storage_uri : str ,
67
- archived : Optional [bool ] | NotGiven = NOT_GIVEN ,
68
- deployment_status : str | NotGiven = NOT_GIVEN ,
69
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
70
- # The extra values given here take precedence over values defined on the client or passed to this method.
71
- extra_headers : Headers | None = None ,
72
- extra_query : Query | None = None ,
73
- extra_body : Body | None = None ,
74
- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
75
- ) -> CommitCreateResponse :
76
- """
77
- Create a new commit (project version) in a project.
78
-
79
- Args:
80
- commit: The details of a commit (project version).
81
-
82
- storage_uri: The storage URI where the commit bundle is stored.
83
-
84
- archived: Whether the commit is archived.
85
-
86
- deployment_status: The deployment status associated with the commit's model.
87
-
88
- extra_headers: Send extra headers
89
-
90
- extra_query: Add additional query parameters to the request
91
-
92
- extra_body: Add additional JSON properties to the request
93
-
94
- timeout: Override the client-level default timeout for this request, in seconds
95
- """
96
- if not project_id :
97
- raise ValueError (f"Expected a non-empty value for `project_id` but received { project_id !r} " )
98
- return self ._post (
99
- f"/projects/{ project_id } /versions" ,
100
- body = maybe_transform (
101
- {
102
- "commit" : commit ,
103
- "storage_uri" : storage_uri ,
104
- "archived" : archived ,
105
- "deployment_status" : deployment_status ,
106
- },
107
- commit_create_params .CommitCreateParams ,
108
- ),
109
- options = make_request_options (
110
- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
111
- ),
112
- cast_to = CommitCreateResponse ,
113
- )
114
-
115
43
116
44
class AsyncCommitsResource (AsyncAPIResource ):
117
45
@cached_property
@@ -137,69 +65,11 @@ def with_streaming_response(self) -> AsyncCommitsResourceWithStreamingResponse:
137
65
"""
138
66
return AsyncCommitsResourceWithStreamingResponse (self )
139
67
140
- async def create (
141
- self ,
142
- project_id : str ,
143
- * ,
144
- commit : commit_create_params .Commit ,
145
- storage_uri : str ,
146
- archived : Optional [bool ] | NotGiven = NOT_GIVEN ,
147
- deployment_status : str | NotGiven = NOT_GIVEN ,
148
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
149
- # The extra values given here take precedence over values defined on the client or passed to this method.
150
- extra_headers : Headers | None = None ,
151
- extra_query : Query | None = None ,
152
- extra_body : Body | None = None ,
153
- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
154
- ) -> CommitCreateResponse :
155
- """
156
- Create a new commit (project version) in a project.
157
-
158
- Args:
159
- commit: The details of a commit (project version).
160
-
161
- storage_uri: The storage URI where the commit bundle is stored.
162
-
163
- archived: Whether the commit is archived.
164
-
165
- deployment_status: The deployment status associated with the commit's model.
166
-
167
- extra_headers: Send extra headers
168
-
169
- extra_query: Add additional query parameters to the request
170
-
171
- extra_body: Add additional JSON properties to the request
172
-
173
- timeout: Override the client-level default timeout for this request, in seconds
174
- """
175
- if not project_id :
176
- raise ValueError (f"Expected a non-empty value for `project_id` but received { project_id !r} " )
177
- return await self ._post (
178
- f"/projects/{ project_id } /versions" ,
179
- body = await async_maybe_transform (
180
- {
181
- "commit" : commit ,
182
- "storage_uri" : storage_uri ,
183
- "archived" : archived ,
184
- "deployment_status" : deployment_status ,
185
- },
186
- commit_create_params .CommitCreateParams ,
187
- ),
188
- options = make_request_options (
189
- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
190
- ),
191
- cast_to = CommitCreateResponse ,
192
- )
193
-
194
68
195
69
class CommitsResourceWithRawResponse :
196
70
def __init__ (self , commits : CommitsResource ) -> None :
197
71
self ._commits = commits
198
72
199
- self .create = to_raw_response_wrapper (
200
- commits .create ,
201
- )
202
-
203
73
@cached_property
204
74
def test_results (self ) -> TestResultsResourceWithRawResponse :
205
75
return TestResultsResourceWithRawResponse (self ._commits .test_results )
@@ -209,10 +79,6 @@ class AsyncCommitsResourceWithRawResponse:
209
79
def __init__ (self , commits : AsyncCommitsResource ) -> None :
210
80
self ._commits = commits
211
81
212
- self .create = async_to_raw_response_wrapper (
213
- commits .create ,
214
- )
215
-
216
82
@cached_property
217
83
def test_results (self ) -> AsyncTestResultsResourceWithRawResponse :
218
84
return AsyncTestResultsResourceWithRawResponse (self ._commits .test_results )
@@ -222,10 +88,6 @@ class CommitsResourceWithStreamingResponse:
222
88
def __init__ (self , commits : CommitsResource ) -> None :
223
89
self ._commits = commits
224
90
225
- self .create = to_streamed_response_wrapper (
226
- commits .create ,
227
- )
228
-
229
91
@cached_property
230
92
def test_results (self ) -> TestResultsResourceWithStreamingResponse :
231
93
return TestResultsResourceWithStreamingResponse (self ._commits .test_results )
@@ -235,10 +97,6 @@ class AsyncCommitsResourceWithStreamingResponse:
235
97
def __init__ (self , commits : AsyncCommitsResource ) -> None :
236
98
self ._commits = commits
237
99
238
- self .create = async_to_streamed_response_wrapper (
239
- commits .create ,
240
- )
241
-
242
100
@cached_property
243
101
def test_results (self ) -> AsyncTestResultsResourceWithStreamingResponse :
244
102
return AsyncTestResultsResourceWithStreamingResponse (self ._commits .test_results )
0 commit comments