Skip to content

Commit 20160d0

Browse files
feat(api): api update
1 parent 99ec714 commit 20160d0

6 files changed

Lines changed: 93 additions & 14 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 39
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-45efcdf3e5ccffb6e94a86be505b24b7b4ff05d8f1a2978c2a281729af68cb82.yml
3-
openapi_spec_hash: 9a7724672b05d44888d67b6ed0ffc7ca
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-725a0defba4d776777ef33053c239c1e41128f48fffe1dd2b27076a353ec8486.yml
3+
openapi_spec_hash: e02416b4dc63a92be8b82ca5fbc02d73
44
config_hash: dce4dea59023b0a00890fa654fbfffb4

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Methods:
7171
- <code title="get /v1/sessions">client.sessions.<a href="./src/steel/resources/sessions/sessions.py">list</a>(\*\*<a href="src/steel/types/session_list_params.py">params</a>) -> SyncSessionsCursor[Session]</code>
7272
- <code title="post /v1/sessions/{sessionId}/computer">client.sessions.<a href="./src/steel/resources/sessions/sessions.py">computer</a>(session_id, \*\*<a href="src/steel/types/session_computer_params.py">params</a>) -> <a href="./src/steel/types/session_computer_response.py">SessionComputerResponse</a></code>
7373
- <code title="get /v1/sessions/{id}/context">client.sessions.<a href="./src/steel/resources/sessions/sessions.py">context</a>(id) -> <a href="./src/steel/types/session_context.py">SessionContext</a></code>
74-
- <code title="get /v1/sessions/{id}/events">client.sessions.<a href="./src/steel/resources/sessions/sessions.py">events</a>(id) -> <a href="./src/steel/types/session_events_response.py">SessionEventsResponse</a></code>
74+
- <code title="get /v1/sessions/{id}/events">client.sessions.<a href="./src/steel/resources/sessions/sessions.py">events</a>(id, \*\*<a href="src/steel/types/session_events_params.py">params</a>) -> <a href="./src/steel/types/session_events_response.py">SessionEventsResponse</a></code>
7575
- <code title="get /v1/sessions/{id}/live-details">client.sessions.<a href="./src/steel/resources/sessions/sessions.py">live_details</a>(id) -> <a href="./src/steel/types/session_live_details_response.py">SessionLiveDetailsResponse</a></code>
7676
- <code title="post /v1/sessions/{id}/release">client.sessions.<a href="./src/steel/resources/sessions/sessions.py">release</a>(id) -> <a href="./src/steel/types/session_release_response.py">SessionReleaseResponse</a></code>
7777
- <code title="post /v1/sessions/release">client.sessions.<a href="./src/steel/resources/sessions/sessions.py">release_all</a>() -> <a href="./src/steel/types/session_release_all_response.py">SessionReleaseAllResponse</a></code>

src/steel/resources/sessions/sessions.py

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
FilesResourceWithStreamingResponse,
1616
AsyncFilesResourceWithStreamingResponse,
1717
)
18-
from ...types import session_list_params, session_create_params, session_computer_params
18+
from ...types import session_list_params, session_create_params, session_events_params, session_computer_params
1919
from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
2020
from ..._utils import required_args, maybe_transform, async_maybe_transform
2121
from .captchas import (
@@ -716,6 +716,9 @@ def events(
716716
self,
717717
id: str,
718718
*,
719+
compressed: bool | Omit = omit,
720+
limit: int | Omit = omit,
721+
pointer: str | Omit = omit,
719722
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
720723
# The extra values given here take precedence over values defined on the client or passed to this method.
721724
extra_headers: Headers | None = None,
@@ -727,6 +730,12 @@ def events(
727730
This endpoint allows you to get the recorded session events in the RRWeb format
728731
729732
Args:
733+
compressed: Compress the events
734+
735+
limit: Optional pagination limit
736+
737+
pointer: Pagination pointer
738+
730739
extra_headers: Send extra headers
731740
732741
extra_query: Add additional query parameters to the request
@@ -740,7 +749,18 @@ def events(
740749
return self._get(
741750
f"/v1/sessions/{id}/events",
742751
options=make_request_options(
743-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
752+
extra_headers=extra_headers,
753+
extra_query=extra_query,
754+
extra_body=extra_body,
755+
timeout=timeout,
756+
query=maybe_transform(
757+
{
758+
"compressed": compressed,
759+
"limit": limit,
760+
"pointer": pointer,
761+
},
762+
session_events_params.SessionEventsParams,
763+
),
744764
),
745765
cast_to=SessionEventsResponse,
746766
)
@@ -1499,6 +1519,9 @@ async def events(
14991519
self,
15001520
id: str,
15011521
*,
1522+
compressed: bool | Omit = omit,
1523+
limit: int | Omit = omit,
1524+
pointer: str | Omit = omit,
15021525
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
15031526
# The extra values given here take precedence over values defined on the client or passed to this method.
15041527
extra_headers: Headers | None = None,
@@ -1510,6 +1533,12 @@ async def events(
15101533
This endpoint allows you to get the recorded session events in the RRWeb format
15111534
15121535
Args:
1536+
compressed: Compress the events
1537+
1538+
limit: Optional pagination limit
1539+
1540+
pointer: Pagination pointer
1541+
15131542
extra_headers: Send extra headers
15141543
15151544
extra_query: Add additional query parameters to the request
@@ -1523,7 +1552,18 @@ async def events(
15231552
return await self._get(
15241553
f"/v1/sessions/{id}/events",
15251554
options=make_request_options(
1526-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1555+
extra_headers=extra_headers,
1556+
extra_query=extra_query,
1557+
extra_body=extra_body,
1558+
timeout=timeout,
1559+
query=await async_maybe_transform(
1560+
{
1561+
"compressed": compressed,
1562+
"limit": limit,
1563+
"pointer": pointer,
1564+
},
1565+
session_events_params.SessionEventsParams,
1566+
),
15271567
),
15281568
cast_to=SessionEventsResponse,
15291569
)

src/steel/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from .profile_list_response import ProfileListResponse as ProfileListResponse
2020
from .profile_update_params import ProfileUpdateParams as ProfileUpdateParams
2121
from .session_create_params import SessionCreateParams as SessionCreateParams
22+
from .session_events_params import SessionEventsParams as SessionEventsParams
2223
from .credential_list_params import CredentialListParams as CredentialListParams
2324
from .extension_list_response import ExtensionListResponse as ExtensionListResponse
2425
from .extension_update_params import ExtensionUpdateParams as ExtensionUpdateParams
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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__ = ["SessionEventsParams"]
8+
9+
10+
class SessionEventsParams(TypedDict, total=False):
11+
compressed: bool
12+
"""Compress the events"""
13+
14+
limit: int
15+
"""Optional pagination limit"""
16+
17+
pointer: str
18+
"""Pagination pointer"""

tests/api_resources/test_sessions.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -747,14 +747,24 @@ def test_path_params_context(self, client: Steel) -> None:
747747
@parametrize
748748
def test_method_events(self, client: Steel) -> None:
749749
session = client.sessions.events(
750-
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
750+
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
751+
)
752+
assert_matches_type(SessionEventsResponse, session, path=["response"])
753+
754+
@parametrize
755+
def test_method_events_with_all_params(self, client: Steel) -> None:
756+
session = client.sessions.events(
757+
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
758+
compressed=True,
759+
limit=-9007199254740991,
760+
pointer="pointer",
751761
)
752762
assert_matches_type(SessionEventsResponse, session, path=["response"])
753763

754764
@parametrize
755765
def test_raw_response_events(self, client: Steel) -> None:
756766
response = client.sessions.with_raw_response.events(
757-
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
767+
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
758768
)
759769

760770
assert response.is_closed is True
@@ -765,7 +775,7 @@ def test_raw_response_events(self, client: Steel) -> None:
765775
@parametrize
766776
def test_streaming_response_events(self, client: Steel) -> None:
767777
with client.sessions.with_streaming_response.events(
768-
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
778+
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
769779
) as response:
770780
assert not response.is_closed
771781
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -779,7 +789,7 @@ def test_streaming_response_events(self, client: Steel) -> None:
779789
def test_path_params_events(self, client: Steel) -> None:
780790
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
781791
client.sessions.with_raw_response.events(
782-
"",
792+
id="",
783793
)
784794

785795
@parametrize
@@ -1608,14 +1618,24 @@ async def test_path_params_context(self, async_client: AsyncSteel) -> None:
16081618
@parametrize
16091619
async def test_method_events(self, async_client: AsyncSteel) -> None:
16101620
session = await async_client.sessions.events(
1611-
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1621+
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1622+
)
1623+
assert_matches_type(SessionEventsResponse, session, path=["response"])
1624+
1625+
@parametrize
1626+
async def test_method_events_with_all_params(self, async_client: AsyncSteel) -> None:
1627+
session = await async_client.sessions.events(
1628+
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1629+
compressed=True,
1630+
limit=-9007199254740991,
1631+
pointer="pointer",
16121632
)
16131633
assert_matches_type(SessionEventsResponse, session, path=["response"])
16141634

16151635
@parametrize
16161636
async def test_raw_response_events(self, async_client: AsyncSteel) -> None:
16171637
response = await async_client.sessions.with_raw_response.events(
1618-
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1638+
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
16191639
)
16201640

16211641
assert response.is_closed is True
@@ -1626,7 +1646,7 @@ async def test_raw_response_events(self, async_client: AsyncSteel) -> None:
16261646
@parametrize
16271647
async def test_streaming_response_events(self, async_client: AsyncSteel) -> None:
16281648
async with async_client.sessions.with_streaming_response.events(
1629-
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1649+
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
16301650
) as response:
16311651
assert not response.is_closed
16321652
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -1640,7 +1660,7 @@ async def test_streaming_response_events(self, async_client: AsyncSteel) -> None
16401660
async def test_path_params_events(self, async_client: AsyncSteel) -> None:
16411661
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
16421662
await async_client.sessions.with_raw_response.events(
1643-
"",
1663+
id="",
16441664
)
16451665

16461666
@parametrize

0 commit comments

Comments
 (0)