Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.6.0"
".": "0.6.1"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-5d4e11bc46eeecee7363d56a9dfe946acee997d5b352c2b0a50c20e742c54d2d.yml
openapi_spec_hash: 333e53ad9c706296b9afdb8ff73bec8f
config_hash: 0fdf285ddd8dee229fd84ea57df9080f
configured_endpoints: 16
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-b019e469425a59061f37c5fdc7a131a5291c66134ef0627db4f06bb1f4af0b15.yml
openapi_spec_hash: f66a3c2efddb168db9539ba2507b10b8
config_hash: aae6721b2be9ec8565dfc8f7eadfe105
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.6.1 (2025-06-18)

Full Changelog: [v0.6.0...v0.6.1](https://github.com/onkernel/kernel-python-sdk/compare/v0.6.0...v0.6.1)

### Features

* **api:** add delete_browsers endpoint ([1d378d3](https://github.com/onkernel/kernel-python-sdk/commit/1d378d3a505c2bce7453a7da3fc70ce78f8349cf))

## 0.6.0 (2025-06-18)

Full Changelog: [v0.5.0...v0.6.0](https://github.com/onkernel/kernel-python-sdk/compare/v0.5.0...v0.6.0)
Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Methods:
- <code title="post /invocations">client.invocations.<a href="./src/kernel/resources/invocations.py">create</a>(\*\*<a href="src/kernel/types/invocation_create_params.py">params</a>) -> <a href="./src/kernel/types/invocation_create_response.py">InvocationCreateResponse</a></code>
- <code title="get /invocations/{id}">client.invocations.<a href="./src/kernel/resources/invocations.py">retrieve</a>(id) -> <a href="./src/kernel/types/invocation_retrieve_response.py">InvocationRetrieveResponse</a></code>
- <code title="patch /invocations/{id}">client.invocations.<a href="./src/kernel/resources/invocations.py">update</a>(id, \*\*<a href="src/kernel/types/invocation_update_params.py">params</a>) -> <a href="./src/kernel/types/invocation_update_response.py">InvocationUpdateResponse</a></code>
- <code title="delete /invocations/{id}/browsers">client.invocations.<a href="./src/kernel/resources/invocations.py">delete_browsers</a>(id) -> None</code>
- <code title="get /invocations/{id}/events">client.invocations.<a href="./src/kernel/resources/invocations.py">follow</a>(id) -> <a href="./src/kernel/types/invocation_follow_response.py">InvocationFollowResponse</a></code>

# Browsers
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "kernel"
version = "0.6.0"
version = "0.6.1"
description = "The official Python library for the kernel API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "kernel"
__version__ = "0.6.0" # x-release-please-version
__version__ = "0.6.1" # x-release-please-version
82 changes: 81 additions & 1 deletion src/kernel/resources/invocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import httpx

from ..types import invocation_create_params, invocation_update_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
from .._utils import maybe_transform, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
Expand Down Expand Up @@ -183,6 +183,40 @@ def update(
cast_to=InvocationUpdateResponse,
)

def delete_browsers(
self,
id: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Delete all browser sessions created within the specified invocation.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._delete(
f"/invocations/{id}/browsers",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=NoneType,
)

def follow(
self,
id: str,
Expand Down Expand Up @@ -379,6 +413,40 @@ async def update(
cast_to=InvocationUpdateResponse,
)

async def delete_browsers(
self,
id: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Delete all browser sessions created within the specified invocation.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._delete(
f"/invocations/{id}/browsers",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=NoneType,
)

async def follow(
self,
id: str,
Expand Down Expand Up @@ -433,6 +501,9 @@ def __init__(self, invocations: InvocationsResource) -> None:
self.update = to_raw_response_wrapper(
invocations.update,
)
self.delete_browsers = to_raw_response_wrapper(
invocations.delete_browsers,
)
self.follow = to_raw_response_wrapper(
invocations.follow,
)
Expand All @@ -451,6 +522,9 @@ def __init__(self, invocations: AsyncInvocationsResource) -> None:
self.update = async_to_raw_response_wrapper(
invocations.update,
)
self.delete_browsers = async_to_raw_response_wrapper(
invocations.delete_browsers,
)
self.follow = async_to_raw_response_wrapper(
invocations.follow,
)
Expand All @@ -469,6 +543,9 @@ def __init__(self, invocations: InvocationsResource) -> None:
self.update = to_streamed_response_wrapper(
invocations.update,
)
self.delete_browsers = to_streamed_response_wrapper(
invocations.delete_browsers,
)
self.follow = to_streamed_response_wrapper(
invocations.follow,
)
Expand All @@ -487,6 +564,9 @@ def __init__(self, invocations: AsyncInvocationsResource) -> None:
self.update = async_to_streamed_response_wrapper(
invocations.update,
)
self.delete_browsers = async_to_streamed_response_wrapper(
invocations.delete_browsers,
)
self.follow = async_to_streamed_response_wrapper(
invocations.follow,
)
84 changes: 84 additions & 0 deletions tests/api_resources/test_invocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,48 @@ def test_path_params_update(self, client: Kernel) -> None:
status="succeeded",
)

@pytest.mark.skip()
@parametrize
def test_method_delete_browsers(self, client: Kernel) -> None:
invocation = client.invocations.delete_browsers(
"id",
)
assert invocation is None

@pytest.mark.skip()
@parametrize
def test_raw_response_delete_browsers(self, client: Kernel) -> None:
response = client.invocations.with_raw_response.delete_browsers(
"id",
)

assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
invocation = response.parse()
assert invocation is None

@pytest.mark.skip()
@parametrize
def test_streaming_response_delete_browsers(self, client: Kernel) -> None:
with client.invocations.with_streaming_response.delete_browsers(
"id",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

invocation = response.parse()
assert invocation is None

assert cast(Any, response.is_closed) is True

@pytest.mark.skip()
@parametrize
def test_path_params_delete_browsers(self, client: Kernel) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
client.invocations.with_raw_response.delete_browsers(
"",
)

@pytest.mark.skip(
reason="currently no good way to test endpoints with content type text/event-stream, Prism mock server will fail"
)
Expand Down Expand Up @@ -374,6 +416,48 @@ async def test_path_params_update(self, async_client: AsyncKernel) -> None:
status="succeeded",
)

@pytest.mark.skip()
@parametrize
async def test_method_delete_browsers(self, async_client: AsyncKernel) -> None:
invocation = await async_client.invocations.delete_browsers(
"id",
)
assert invocation is None

@pytest.mark.skip()
@parametrize
async def test_raw_response_delete_browsers(self, async_client: AsyncKernel) -> None:
response = await async_client.invocations.with_raw_response.delete_browsers(
"id",
)

assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
invocation = await response.parse()
assert invocation is None

@pytest.mark.skip()
@parametrize
async def test_streaming_response_delete_browsers(self, async_client: AsyncKernel) -> None:
async with async_client.invocations.with_streaming_response.delete_browsers(
"id",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

invocation = await response.parse()
assert invocation is None

assert cast(Any, response.is_closed) is True

@pytest.mark.skip()
@parametrize
async def test_path_params_delete_browsers(self, async_client: AsyncKernel) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
await async_client.invocations.with_raw_response.delete_browsers(
"",
)

@pytest.mark.skip(
reason="currently no good way to test endpoints with content type text/event-stream, Prism mock server will fail"
)
Expand Down