1717 async_to_raw_response_wrapper ,
1818 async_to_streamed_response_wrapper ,
1919)
20+ from ..._streaming import Stream , AsyncStream
2021from ...types .apps import deployment_create_params
2122from ..._base_client import make_request_options
2223from ...types .apps .deployment_create_response import DeploymentCreateResponse
24+ from ...types .apps .deployment_follow_response import DeploymentFollowResponse
2325
2426__all__ = ["DeploymentsResource" , "AsyncDeploymentsResource" ]
2527
@@ -110,6 +112,44 @@ def create(
110112 cast_to = DeploymentCreateResponse ,
111113 )
112114
115+ def follow (
116+ self ,
117+ id : str ,
118+ * ,
119+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
120+ # The extra values given here take precedence over values defined on the client or passed to this method.
121+ extra_headers : Headers | None = None ,
122+ extra_query : Query | None = None ,
123+ extra_body : Body | None = None ,
124+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
125+ ) -> Stream [DeploymentFollowResponse ]:
126+ """
127+ Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
128+ status updates for a deployed application. The stream terminates automatically
129+ once the application reaches a terminal state.
130+
131+ Args:
132+ extra_headers: Send extra headers
133+
134+ extra_query: Add additional query parameters to the request
135+
136+ extra_body: Add additional JSON properties to the request
137+
138+ timeout: Override the client-level default timeout for this request, in seconds
139+ """
140+ if not id :
141+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
142+ extra_headers = {"Accept" : "text/event-stream" , ** (extra_headers or {})}
143+ return self ._get (
144+ f"/apps/{ id } /events" ,
145+ options = make_request_options (
146+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
147+ ),
148+ cast_to = DeploymentFollowResponse ,
149+ stream = True ,
150+ stream_cls = Stream [DeploymentFollowResponse ],
151+ )
152+
113153
114154class AsyncDeploymentsResource (AsyncAPIResource ):
115155 @cached_property
@@ -197,6 +237,44 @@ async def create(
197237 cast_to = DeploymentCreateResponse ,
198238 )
199239
240+ async def follow (
241+ self ,
242+ id : str ,
243+ * ,
244+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
245+ # The extra values given here take precedence over values defined on the client or passed to this method.
246+ extra_headers : Headers | None = None ,
247+ extra_query : Query | None = None ,
248+ extra_body : Body | None = None ,
249+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
250+ ) -> AsyncStream [DeploymentFollowResponse ]:
251+ """
252+ Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
253+ status updates for a deployed application. The stream terminates automatically
254+ once the application reaches a terminal state.
255+
256+ Args:
257+ extra_headers: Send extra headers
258+
259+ extra_query: Add additional query parameters to the request
260+
261+ extra_body: Add additional JSON properties to the request
262+
263+ timeout: Override the client-level default timeout for this request, in seconds
264+ """
265+ if not id :
266+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
267+ extra_headers = {"Accept" : "text/event-stream" , ** (extra_headers or {})}
268+ return await self ._get (
269+ f"/apps/{ id } /events" ,
270+ options = make_request_options (
271+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
272+ ),
273+ cast_to = DeploymentFollowResponse ,
274+ stream = True ,
275+ stream_cls = AsyncStream [DeploymentFollowResponse ],
276+ )
277+
200278
201279class DeploymentsResourceWithRawResponse :
202280 def __init__ (self , deployments : DeploymentsResource ) -> None :
@@ -205,6 +283,9 @@ def __init__(self, deployments: DeploymentsResource) -> None:
205283 self .create = to_raw_response_wrapper (
206284 deployments .create ,
207285 )
286+ self .follow = to_raw_response_wrapper (
287+ deployments .follow ,
288+ )
208289
209290
210291class AsyncDeploymentsResourceWithRawResponse :
@@ -214,6 +295,9 @@ def __init__(self, deployments: AsyncDeploymentsResource) -> None:
214295 self .create = async_to_raw_response_wrapper (
215296 deployments .create ,
216297 )
298+ self .follow = async_to_raw_response_wrapper (
299+ deployments .follow ,
300+ )
217301
218302
219303class DeploymentsResourceWithStreamingResponse :
@@ -223,6 +307,9 @@ def __init__(self, deployments: DeploymentsResource) -> None:
223307 self .create = to_streamed_response_wrapper (
224308 deployments .create ,
225309 )
310+ self .follow = to_streamed_response_wrapper (
311+ deployments .follow ,
312+ )
226313
227314
228315class AsyncDeploymentsResourceWithStreamingResponse :
@@ -232,3 +319,6 @@ def __init__(self, deployments: AsyncDeploymentsResource) -> None:
232319 self .create = async_to_streamed_response_wrapper (
233320 deployments .create ,
234321 )
322+ self .follow = async_to_streamed_response_wrapper (
323+ deployments .follow ,
324+ )
0 commit comments