Skip to content

Commit 085cf7c

Browse files
feat(api): update via SDK Studio
1 parent da4cc1f commit 085cf7c

File tree

5 files changed

+66
-10
lines changed

5 files changed

+66
-10
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 7
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-aa34ccb9b2ee8e81ef56881ff7474ea2d69a059d5c1dbb7d0ec94e28a0b68559.yml
3-
openapi_spec_hash: c573fcd85b195ebe809a1039634652d6
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-39aa058a60035c34a636e7f580b4b9c76b05400ae401ef04a761572b20a5425b.yml
3+
openapi_spec_hash: bb79a204f9edb6b6ccfe783a0a82a423
44
config_hash: 4dfa4d870ce0e23e31ce33ab6a53dd21

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ from kernel.types.apps import DeploymentCreateResponse, DeploymentFollowResponse
2121
Methods:
2222

2323
- <code title="post /deploy">client.apps.deployments.<a href="./src/kernel/resources/apps/deployments.py">create</a>(\*\*<a href="src/kernel/types/apps/deployment_create_params.py">params</a>) -> <a href="./src/kernel/types/apps/deployment_create_response.py">DeploymentCreateResponse</a></code>
24-
- <code title="get /apps/{id}/events">client.apps.deployments.<a href="./src/kernel/resources/apps/deployments.py">follow</a>(id) -> <a href="./src/kernel/types/apps/deployment_follow_response.py">object</a></code>
24+
- <code title="get /apps/{id}/events">client.apps.deployments.<a href="./src/kernel/resources/apps/deployments.py">follow</a>(id) -> <a href="./src/kernel/types/apps/deployment_follow_response.py">DeploymentFollowResponse</a></code>
2525

2626
## Invocations
2727

src/kernel/resources/apps/deployments.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Mapping, cast
5+
from typing import Any, Dict, Mapping, cast
66
from typing_extensions import Literal
77

88
import httpx
@@ -21,6 +21,7 @@
2121
from ...types.apps import deployment_create_params
2222
from ..._base_client import make_request_options
2323
from ...types.apps.deployment_create_response import DeploymentCreateResponse
24+
from ...types.apps.deployment_follow_response import DeploymentFollowResponse
2425

2526
__all__ = ["DeploymentsResource", "AsyncDeploymentsResource"]
2627

@@ -121,7 +122,7 @@ def follow(
121122
extra_query: Query | None = None,
122123
extra_body: Body | None = None,
123124
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
124-
) -> Stream[object]:
125+
) -> Stream[DeploymentFollowResponse]:
125126
"""
126127
Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
127128
status updates for a deployed application. The stream terminates automatically
@@ -144,9 +145,11 @@ def follow(
144145
options=make_request_options(
145146
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
146147
),
147-
cast_to=object,
148+
cast_to=cast(
149+
Any, DeploymentFollowResponse
150+
), # Union types cannot be passed in as arguments in the type system
148151
stream=True,
149-
stream_cls=Stream[object],
152+
stream_cls=Stream[DeploymentFollowResponse],
150153
)
151154

152155

@@ -246,7 +249,7 @@ async def follow(
246249
extra_query: Query | None = None,
247250
extra_body: Body | None = None,
248251
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
249-
) -> AsyncStream[object]:
252+
) -> AsyncStream[DeploymentFollowResponse]:
250253
"""
251254
Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
252255
status updates for a deployed application. The stream terminates automatically
@@ -269,9 +272,11 @@ async def follow(
269272
options=make_request_options(
270273
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
271274
),
272-
cast_to=object,
275+
cast_to=cast(
276+
Any, DeploymentFollowResponse
277+
), # Union types cannot be passed in as arguments in the type system
273278
stream=True,
274-
stream_cls=AsyncStream[object],
279+
stream_cls=AsyncStream[DeploymentFollowResponse],
275280
)
276281

277282

src/kernel/types/apps/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams
66
from .invocation_create_params import InvocationCreateParams as InvocationCreateParams
77
from .deployment_create_response import DeploymentCreateResponse as DeploymentCreateResponse
8+
from .deployment_follow_response import DeploymentFollowResponse as DeploymentFollowResponse
89
from .invocation_create_response import InvocationCreateResponse as InvocationCreateResponse
910
from .invocation_retrieve_response import InvocationRetrieveResponse as InvocationRetrieveResponse
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Union, Optional
4+
from datetime import datetime
5+
from typing_extensions import Literal, Annotated, TypeAlias
6+
7+
from ..._utils import PropertyInfo
8+
from ..._models import BaseModel
9+
10+
__all__ = ["DeploymentFollowResponse", "StateEvent", "StateUpdateEvent", "LogEvent"]
11+
12+
13+
class StateEvent(BaseModel):
14+
event: Literal["state"]
15+
"""Event type identifier (always "state")."""
16+
17+
state: str
18+
"""
19+
Current application state (e.g., "deploying", "running", "succeeded", "failed").
20+
"""
21+
22+
timestamp: Optional[datetime] = None
23+
"""Time the state was reported."""
24+
25+
26+
class StateUpdateEvent(BaseModel):
27+
event: Literal["state_update"]
28+
"""Event type identifier (always "state_update")."""
29+
30+
state: str
31+
"""New application state (e.g., "running", "succeeded", "failed")."""
32+
33+
timestamp: Optional[datetime] = None
34+
"""Time the state change occurred."""
35+
36+
37+
class LogEvent(BaseModel):
38+
event: Literal["log"]
39+
"""Event type identifier (always "log")."""
40+
41+
message: str
42+
"""Log message text."""
43+
44+
timestamp: Optional[datetime] = None
45+
"""Time the log entry was produced."""
46+
47+
48+
DeploymentFollowResponse: TypeAlias = Annotated[
49+
Union[StateEvent, StateUpdateEvent, LogEvent], PropertyInfo(discriminator="event")
50+
]

0 commit comments

Comments
 (0)