22
33from __future__ import annotations
44
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- )
155from ..._compat import cached_property
166from ..._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- )
237from .test_results import (
248 TestResultsResource ,
259 AsyncTestResultsResource ,
2812 TestResultsResourceWithStreamingResponse ,
2913 AsyncTestResultsResourceWithStreamingResponse ,
3014)
31- from ..._base_client import make_request_options
32- from ...types .commit_create_response import CommitCreateResponse
3315
3416__all__ = ["CommitsResource" , "AsyncCommitsResource" ]
3517
@@ -58,60 +40,6 @@ def with_streaming_response(self) -> CommitsResourceWithStreamingResponse:
5840 """
5941 return CommitsResourceWithStreamingResponse (self )
6042
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-
11543
11644class AsyncCommitsResource (AsyncAPIResource ):
11745 @cached_property
@@ -137,69 +65,11 @@ def with_streaming_response(self) -> AsyncCommitsResourceWithStreamingResponse:
13765 """
13866 return AsyncCommitsResourceWithStreamingResponse (self )
13967
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-
19468
19569class CommitsResourceWithRawResponse :
19670 def __init__ (self , commits : CommitsResource ) -> None :
19771 self ._commits = commits
19872
199- self .create = to_raw_response_wrapper (
200- commits .create ,
201- )
202-
20373 @cached_property
20474 def test_results (self ) -> TestResultsResourceWithRawResponse :
20575 return TestResultsResourceWithRawResponse (self ._commits .test_results )
@@ -209,10 +79,6 @@ class AsyncCommitsResourceWithRawResponse:
20979 def __init__ (self , commits : AsyncCommitsResource ) -> None :
21080 self ._commits = commits
21181
212- self .create = async_to_raw_response_wrapper (
213- commits .create ,
214- )
215-
21682 @cached_property
21783 def test_results (self ) -> AsyncTestResultsResourceWithRawResponse :
21884 return AsyncTestResultsResourceWithRawResponse (self ._commits .test_results )
@@ -222,10 +88,6 @@ class CommitsResourceWithStreamingResponse:
22288 def __init__ (self , commits : CommitsResource ) -> None :
22389 self ._commits = commits
22490
225- self .create = to_streamed_response_wrapper (
226- commits .create ,
227- )
228-
22991 @cached_property
23092 def test_results (self ) -> TestResultsResourceWithStreamingResponse :
23193 return TestResultsResourceWithStreamingResponse (self ._commits .test_results )
@@ -235,10 +97,6 @@ class AsyncCommitsResourceWithStreamingResponse:
23597 def __init__ (self , commits : AsyncCommitsResource ) -> None :
23698 self ._commits = commits
23799
238- self .create = async_to_streamed_response_wrapper (
239- commits .create ,
240- )
241-
242100 @cached_property
243101 def test_results (self ) -> AsyncTestResultsResourceWithStreamingResponse :
244102 return AsyncTestResultsResourceWithStreamingResponse (self ._commits .test_results )
0 commit comments