Skip to content

Commit 7ae75cc

Browse files
feat(api): update via SDK Studio
1 parent 6359d12 commit 7ae75cc

File tree

7 files changed

+280
-4
lines changed

7 files changed

+280
-4
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 6
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-19b0d17ba368f32827ee322d15a7f4ff7e1f3bbf66606fad227b3465f8ffc5ab.yml
3-
openapi_spec_hash: 4a3cb766898e8a134ef99fe6c4c87736
4-
config_hash: 9018b7ff17f8de1bc3e99a0ae2f2df68
1+
configured_endpoints: 7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-c9d64df733f286f09d2203f4e3d820ce57e8d4c629c5e2db4e2bfac91fbc1598.yml
3+
openapi_spec_hash: fa407611fc566d55f403864fbfaa6c23
4+
config_hash: 7f67c5b95af1e4b39525515240b72275

api.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Apps
22

3+
Types:
4+
5+
```python
6+
from kernel.types import AppListResponse
7+
```
8+
9+
Methods:
10+
11+
- <code title="get /apps">client.apps.<a href="./src/kernel/resources/apps/apps.py">list</a>(\*\*<a href="src/kernel/types/app_list_params.py">params</a>) -> <a href="./src/kernel/types/app_list_response.py">AppListResponse</a></code>
12+
313
## Deployments
414

515
Types:

src/kernel/resources/apps/apps.py

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22

33
from __future__ import annotations
44

5+
import httpx
6+
7+
from ...types import app_list_params
8+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
9+
from ..._utils import maybe_transform, async_maybe_transform
510
from ..._compat import cached_property
611
from ..._resource import SyncAPIResource, AsyncAPIResource
12+
from ..._response import (
13+
to_raw_response_wrapper,
14+
to_streamed_response_wrapper,
15+
async_to_raw_response_wrapper,
16+
async_to_streamed_response_wrapper,
17+
)
718
from .deployments import (
819
DeploymentsResource,
920
AsyncDeploymentsResource,
@@ -20,6 +31,8 @@
2031
InvocationsResourceWithStreamingResponse,
2132
AsyncInvocationsResourceWithStreamingResponse,
2233
)
34+
from ..._base_client import make_request_options
35+
from ...types.app_list_response import AppListResponse
2336

2437
__all__ = ["AppsResource", "AsyncAppsResource"]
2538

@@ -52,6 +65,54 @@ def with_streaming_response(self) -> AppsResourceWithStreamingResponse:
5265
"""
5366
return AppsResourceWithStreamingResponse(self)
5467

68+
def list(
69+
self,
70+
*,
71+
app_name: str | NotGiven = NOT_GIVEN,
72+
version: str | NotGiven = NOT_GIVEN,
73+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
74+
# The extra values given here take precedence over values defined on the client or passed to this method.
75+
extra_headers: Headers | None = None,
76+
extra_query: Query | None = None,
77+
extra_body: Body | None = None,
78+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
79+
) -> AppListResponse:
80+
"""List application versions for the authenticated user.
81+
82+
Optionally filter by app
83+
name and/or version label.
84+
85+
Args:
86+
app_name: Filter results by application name.
87+
88+
version: Filter results by version label.
89+
90+
extra_headers: Send extra headers
91+
92+
extra_query: Add additional query parameters to the request
93+
94+
extra_body: Add additional JSON properties to the request
95+
96+
timeout: Override the client-level default timeout for this request, in seconds
97+
"""
98+
return self._get(
99+
"/apps",
100+
options=make_request_options(
101+
extra_headers=extra_headers,
102+
extra_query=extra_query,
103+
extra_body=extra_body,
104+
timeout=timeout,
105+
query=maybe_transform(
106+
{
107+
"app_name": app_name,
108+
"version": version,
109+
},
110+
app_list_params.AppListParams,
111+
),
112+
),
113+
cast_to=AppListResponse,
114+
)
115+
55116

56117
class AsyncAppsResource(AsyncAPIResource):
57118
@cached_property
@@ -81,11 +142,63 @@ def with_streaming_response(self) -> AsyncAppsResourceWithStreamingResponse:
81142
"""
82143
return AsyncAppsResourceWithStreamingResponse(self)
83144

145+
async def list(
146+
self,
147+
*,
148+
app_name: str | NotGiven = NOT_GIVEN,
149+
version: str | NotGiven = NOT_GIVEN,
150+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
151+
# The extra values given here take precedence over values defined on the client or passed to this method.
152+
extra_headers: Headers | None = None,
153+
extra_query: Query | None = None,
154+
extra_body: Body | None = None,
155+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
156+
) -> AppListResponse:
157+
"""List application versions for the authenticated user.
158+
159+
Optionally filter by app
160+
name and/or version label.
161+
162+
Args:
163+
app_name: Filter results by application name.
164+
165+
version: Filter results by version label.
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+
return await self._get(
176+
"/apps",
177+
options=make_request_options(
178+
extra_headers=extra_headers,
179+
extra_query=extra_query,
180+
extra_body=extra_body,
181+
timeout=timeout,
182+
query=await async_maybe_transform(
183+
{
184+
"app_name": app_name,
185+
"version": version,
186+
},
187+
app_list_params.AppListParams,
188+
),
189+
),
190+
cast_to=AppListResponse,
191+
)
192+
84193

85194
class AppsResourceWithRawResponse:
86195
def __init__(self, apps: AppsResource) -> None:
87196
self._apps = apps
88197

198+
self.list = to_raw_response_wrapper(
199+
apps.list,
200+
)
201+
89202
@cached_property
90203
def deployments(self) -> DeploymentsResourceWithRawResponse:
91204
return DeploymentsResourceWithRawResponse(self._apps.deployments)
@@ -99,6 +212,10 @@ class AsyncAppsResourceWithRawResponse:
99212
def __init__(self, apps: AsyncAppsResource) -> None:
100213
self._apps = apps
101214

215+
self.list = async_to_raw_response_wrapper(
216+
apps.list,
217+
)
218+
102219
@cached_property
103220
def deployments(self) -> AsyncDeploymentsResourceWithRawResponse:
104221
return AsyncDeploymentsResourceWithRawResponse(self._apps.deployments)
@@ -112,6 +229,10 @@ class AppsResourceWithStreamingResponse:
112229
def __init__(self, apps: AppsResource) -> None:
113230
self._apps = apps
114231

232+
self.list = to_streamed_response_wrapper(
233+
apps.list,
234+
)
235+
115236
@cached_property
116237
def deployments(self) -> DeploymentsResourceWithStreamingResponse:
117238
return DeploymentsResourceWithStreamingResponse(self._apps.deployments)
@@ -125,6 +246,10 @@ class AsyncAppsResourceWithStreamingResponse:
125246
def __init__(self, apps: AsyncAppsResource) -> None:
126247
self._apps = apps
127248

249+
self.list = async_to_streamed_response_wrapper(
250+
apps.list,
251+
)
252+
128253
@cached_property
129254
def deployments(self) -> AsyncDeploymentsResourceWithStreamingResponse:
130255
return AsyncDeploymentsResourceWithStreamingResponse(self._apps.deployments)

src/kernel/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
from .app_list_params import AppListParams as AppListParams
6+
from .app_list_response import AppListResponse as AppListResponse
57
from .browser_create_params import BrowserCreateParams as BrowserCreateParams
68
from .browser_create_response import BrowserCreateResponse as BrowserCreateResponse
79
from .browser_retrieve_response import BrowserRetrieveResponse as BrowserRetrieveResponse

src/kernel/types/app_list_params.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import TypedDict
6+
7+
__all__ = ["AppListParams"]
8+
9+
10+
class AppListParams(TypedDict, total=False):
11+
app_name: str
12+
"""Filter results by application name."""
13+
14+
version: str
15+
"""Filter results by version label."""

src/kernel/types/app_list_response.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Dict, List, Optional
4+
from typing_extensions import TypeAlias
5+
6+
from .._models import BaseModel
7+
8+
__all__ = ["AppListResponse", "AppListResponseItem"]
9+
10+
11+
class AppListResponseItem(BaseModel):
12+
id: str
13+
"""Unique identifier for the app version"""
14+
15+
app_name: str
16+
"""Name of the application"""
17+
18+
region: str
19+
"""Deployment region code"""
20+
21+
version: str
22+
"""Version label for the application"""
23+
24+
env_vars: Optional[Dict[str, str]] = None
25+
"""Environment variables configured for this app version"""
26+
27+
28+
AppListResponse: TypeAlias = List[AppListResponseItem]

tests/api_resources/test_apps.py

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
import os
6+
from typing import Any, cast
7+
8+
import pytest
9+
10+
from kernel import Kernel, AsyncKernel
11+
from tests.utils import assert_matches_type
12+
from kernel.types import AppListResponse
13+
14+
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
15+
16+
17+
class TestApps:
18+
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
19+
20+
@pytest.mark.skip()
21+
@parametrize
22+
def test_method_list(self, client: Kernel) -> None:
23+
app = client.apps.list()
24+
assert_matches_type(AppListResponse, app, path=["response"])
25+
26+
@pytest.mark.skip()
27+
@parametrize
28+
def test_method_list_with_all_params(self, client: Kernel) -> None:
29+
app = client.apps.list(
30+
app_name="app_name",
31+
version="version",
32+
)
33+
assert_matches_type(AppListResponse, app, path=["response"])
34+
35+
@pytest.mark.skip()
36+
@parametrize
37+
def test_raw_response_list(self, client: Kernel) -> None:
38+
response = client.apps.with_raw_response.list()
39+
40+
assert response.is_closed is True
41+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
42+
app = response.parse()
43+
assert_matches_type(AppListResponse, app, path=["response"])
44+
45+
@pytest.mark.skip()
46+
@parametrize
47+
def test_streaming_response_list(self, client: Kernel) -> None:
48+
with client.apps.with_streaming_response.list() as response:
49+
assert not response.is_closed
50+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
51+
52+
app = response.parse()
53+
assert_matches_type(AppListResponse, app, path=["response"])
54+
55+
assert cast(Any, response.is_closed) is True
56+
57+
58+
class TestAsyncApps:
59+
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
60+
61+
@pytest.mark.skip()
62+
@parametrize
63+
async def test_method_list(self, async_client: AsyncKernel) -> None:
64+
app = await async_client.apps.list()
65+
assert_matches_type(AppListResponse, app, path=["response"])
66+
67+
@pytest.mark.skip()
68+
@parametrize
69+
async def test_method_list_with_all_params(self, async_client: AsyncKernel) -> None:
70+
app = await async_client.apps.list(
71+
app_name="app_name",
72+
version="version",
73+
)
74+
assert_matches_type(AppListResponse, app, path=["response"])
75+
76+
@pytest.mark.skip()
77+
@parametrize
78+
async def test_raw_response_list(self, async_client: AsyncKernel) -> None:
79+
response = await async_client.apps.with_raw_response.list()
80+
81+
assert response.is_closed is True
82+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
83+
app = await response.parse()
84+
assert_matches_type(AppListResponse, app, path=["response"])
85+
86+
@pytest.mark.skip()
87+
@parametrize
88+
async def test_streaming_response_list(self, async_client: AsyncKernel) -> None:
89+
async with async_client.apps.with_streaming_response.list() as response:
90+
assert not response.is_closed
91+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
92+
93+
app = await response.parse()
94+
assert_matches_type(AppListResponse, app, path=["response"])
95+
96+
assert cast(Any, response.is_closed) is True

0 commit comments

Comments
 (0)