Skip to content

Commit 2810c5c

Browse files
feat(api): update via SDK Studio
1 parent e14b049 commit 2810c5c

File tree

6 files changed

+198
-4
lines changed

6 files changed

+198
-4
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 3
1+
configured_endpoints: 4
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-d168b58fcf39dbd0458d132091793d3e2d0930070b7dda2d5f7f1baff20dd31b.yml
33
openapi_spec_hash: b7e0fd7ee1656d7dbad57209d1584d92
4-
config_hash: 9139d1eb064baf60fd2265aac382f097
4+
config_hash: eab40627b734534462ae3b8ccd8b263b

api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
Types:
44

55
```python
6-
from kernel.types import AppDeployResponse, AppInvokeResponse
6+
from kernel.types import AppDeployResponse, AppInvokeResponse, AppRetrieveInvocationResponse
77
```
88

99
Methods:
1010

1111
- <code title="post /apps/deploy">client.apps.<a href="./src/kernel/resources/apps.py">deploy</a>(\*\*<a href="src/kernel/types/app_deploy_params.py">params</a>) -> <a href="./src/kernel/types/app_deploy_response.py">AppDeployResponse</a></code>
1212
- <code title="post /apps/invoke">client.apps.<a href="./src/kernel/resources/apps.py">invoke</a>(\*\*<a href="src/kernel/types/app_invoke_params.py">params</a>) -> <a href="./src/kernel/types/app_invoke_response.py">AppInvokeResponse</a></code>
13+
- <code title="get /apps/invocations/{id}">client.apps.<a href="./src/kernel/resources/apps.py">retrieve_invocation</a>(id) -> <a href="./src/kernel/types/app_retrieve_invocation_response.py">AppRetrieveInvocationResponse</a></code>
1314

1415
# Browser
1516

src/kernel/resources/apps.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from .._base_client import make_request_options
2121
from ..types.app_deploy_response import AppDeployResponse
2222
from ..types.app_invoke_response import AppInvokeResponse
23+
from ..types.app_retrieve_invocation_response import AppRetrieveInvocationResponse
2324

2425
__all__ = ["AppsResource", "AsyncAppsResource"]
2526

@@ -152,6 +153,39 @@ def invoke(
152153
cast_to=AppInvokeResponse,
153154
)
154155

156+
def retrieve_invocation(
157+
self,
158+
id: str,
159+
*,
160+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
161+
# The extra values given here take precedence over values defined on the client or passed to this method.
162+
extra_headers: Headers | None = None,
163+
extra_query: Query | None = None,
164+
extra_body: Body | None = None,
165+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
166+
) -> AppRetrieveInvocationResponse:
167+
"""
168+
Get an app invocation by id
169+
170+
Args:
171+
extra_headers: Send extra headers
172+
173+
extra_query: Add additional query parameters to the request
174+
175+
extra_body: Add additional JSON properties to the request
176+
177+
timeout: Override the client-level default timeout for this request, in seconds
178+
"""
179+
if not id:
180+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
181+
return self._get(
182+
f"/apps/invocations/{id}",
183+
options=make_request_options(
184+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
185+
),
186+
cast_to=AppRetrieveInvocationResponse,
187+
)
188+
155189

156190
class AsyncAppsResource(AsyncAPIResource):
157191
@cached_property
@@ -281,6 +315,39 @@ async def invoke(
281315
cast_to=AppInvokeResponse,
282316
)
283317

318+
async def retrieve_invocation(
319+
self,
320+
id: str,
321+
*,
322+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
323+
# The extra values given here take precedence over values defined on the client or passed to this method.
324+
extra_headers: Headers | None = None,
325+
extra_query: Query | None = None,
326+
extra_body: Body | None = None,
327+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
328+
) -> AppRetrieveInvocationResponse:
329+
"""
330+
Get an app invocation by id
331+
332+
Args:
333+
extra_headers: Send extra headers
334+
335+
extra_query: Add additional query parameters to the request
336+
337+
extra_body: Add additional JSON properties to the request
338+
339+
timeout: Override the client-level default timeout for this request, in seconds
340+
"""
341+
if not id:
342+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
343+
return await self._get(
344+
f"/apps/invocations/{id}",
345+
options=make_request_options(
346+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
347+
),
348+
cast_to=AppRetrieveInvocationResponse,
349+
)
350+
284351

285352
class AppsResourceWithRawResponse:
286353
def __init__(self, apps: AppsResource) -> None:
@@ -292,6 +359,9 @@ def __init__(self, apps: AppsResource) -> None:
292359
self.invoke = to_raw_response_wrapper(
293360
apps.invoke,
294361
)
362+
self.retrieve_invocation = to_raw_response_wrapper(
363+
apps.retrieve_invocation,
364+
)
295365

296366

297367
class AsyncAppsResourceWithRawResponse:
@@ -304,6 +374,9 @@ def __init__(self, apps: AsyncAppsResource) -> None:
304374
self.invoke = async_to_raw_response_wrapper(
305375
apps.invoke,
306376
)
377+
self.retrieve_invocation = async_to_raw_response_wrapper(
378+
apps.retrieve_invocation,
379+
)
307380

308381

309382
class AppsResourceWithStreamingResponse:
@@ -316,6 +389,9 @@ def __init__(self, apps: AppsResource) -> None:
316389
self.invoke = to_streamed_response_wrapper(
317390
apps.invoke,
318391
)
392+
self.retrieve_invocation = to_streamed_response_wrapper(
393+
apps.retrieve_invocation,
394+
)
319395

320396

321397
class AsyncAppsResourceWithStreamingResponse:
@@ -328,3 +404,6 @@ def __init__(self, apps: AsyncAppsResource) -> None:
328404
self.invoke = async_to_streamed_response_wrapper(
329405
apps.invoke,
330406
)
407+
self.retrieve_invocation = async_to_streamed_response_wrapper(
408+
apps.retrieve_invocation,
409+
)

src/kernel/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
from .app_deploy_response import AppDeployResponse as AppDeployResponse
88
from .app_invoke_response import AppInvokeResponse as AppInvokeResponse
99
from .browser_create_session_response import BrowserCreateSessionResponse as BrowserCreateSessionResponse
10+
from .app_retrieve_invocation_response import AppRetrieveInvocationResponse as AppRetrieveInvocationResponse
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
5+
from pydantic import Field as FieldInfo
6+
7+
from .._models import BaseModel
8+
9+
__all__ = ["AppRetrieveInvocationResponse"]
10+
11+
12+
class AppRetrieveInvocationResponse(BaseModel):
13+
id: str
14+
15+
app_name: str = FieldInfo(alias="appName")
16+
17+
finished_at: Optional[str] = FieldInfo(alias="finishedAt", default=None)
18+
19+
input: str
20+
21+
output: str
22+
23+
started_at: str = FieldInfo(alias="startedAt")
24+
25+
status: str

tests/api_resources/test_apps.py

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99

1010
from kernel import Kernel, AsyncKernel
1111
from tests.utils import assert_matches_type
12-
from kernel.types import AppDeployResponse, AppInvokeResponse
12+
from kernel.types import (
13+
AppDeployResponse,
14+
AppInvokeResponse,
15+
AppRetrieveInvocationResponse,
16+
)
1317

1418
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
1519

@@ -111,6 +115,48 @@ def test_streaming_response_invoke(self, client: Kernel) -> None:
111115

112116
assert cast(Any, response.is_closed) is True
113117

118+
@pytest.mark.skip()
119+
@parametrize
120+
def test_method_retrieve_invocation(self, client: Kernel) -> None:
121+
app = client.apps.retrieve_invocation(
122+
"id",
123+
)
124+
assert_matches_type(AppRetrieveInvocationResponse, app, path=["response"])
125+
126+
@pytest.mark.skip()
127+
@parametrize
128+
def test_raw_response_retrieve_invocation(self, client: Kernel) -> None:
129+
response = client.apps.with_raw_response.retrieve_invocation(
130+
"id",
131+
)
132+
133+
assert response.is_closed is True
134+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
135+
app = response.parse()
136+
assert_matches_type(AppRetrieveInvocationResponse, app, path=["response"])
137+
138+
@pytest.mark.skip()
139+
@parametrize
140+
def test_streaming_response_retrieve_invocation(self, client: Kernel) -> None:
141+
with client.apps.with_streaming_response.retrieve_invocation(
142+
"id",
143+
) as response:
144+
assert not response.is_closed
145+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
146+
147+
app = response.parse()
148+
assert_matches_type(AppRetrieveInvocationResponse, app, path=["response"])
149+
150+
assert cast(Any, response.is_closed) is True
151+
152+
@pytest.mark.skip()
153+
@parametrize
154+
def test_path_params_retrieve_invocation(self, client: Kernel) -> None:
155+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
156+
client.apps.with_raw_response.retrieve_invocation(
157+
"",
158+
)
159+
114160

115161
class TestAsyncApps:
116162
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -208,3 +254,45 @@ async def test_streaming_response_invoke(self, async_client: AsyncKernel) -> Non
208254
assert_matches_type(AppInvokeResponse, app, path=["response"])
209255

210256
assert cast(Any, response.is_closed) is True
257+
258+
@pytest.mark.skip()
259+
@parametrize
260+
async def test_method_retrieve_invocation(self, async_client: AsyncKernel) -> None:
261+
app = await async_client.apps.retrieve_invocation(
262+
"id",
263+
)
264+
assert_matches_type(AppRetrieveInvocationResponse, app, path=["response"])
265+
266+
@pytest.mark.skip()
267+
@parametrize
268+
async def test_raw_response_retrieve_invocation(self, async_client: AsyncKernel) -> None:
269+
response = await async_client.apps.with_raw_response.retrieve_invocation(
270+
"id",
271+
)
272+
273+
assert response.is_closed is True
274+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
275+
app = await response.parse()
276+
assert_matches_type(AppRetrieveInvocationResponse, app, path=["response"])
277+
278+
@pytest.mark.skip()
279+
@parametrize
280+
async def test_streaming_response_retrieve_invocation(self, async_client: AsyncKernel) -> None:
281+
async with async_client.apps.with_streaming_response.retrieve_invocation(
282+
"id",
283+
) as response:
284+
assert not response.is_closed
285+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
286+
287+
app = await response.parse()
288+
assert_matches_type(AppRetrieveInvocationResponse, app, path=["response"])
289+
290+
assert cast(Any, response.is_closed) is True
291+
292+
@pytest.mark.skip()
293+
@parametrize
294+
async def test_path_params_retrieve_invocation(self, async_client: AsyncKernel) -> None:
295+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
296+
await async_client.apps.with_raw_response.retrieve_invocation(
297+
"",
298+
)

0 commit comments

Comments
 (0)