Skip to content

Commit 4b1a78e

Browse files
feat(api): api update (#105)
1 parent 8aa7f5d commit 4b1a78e

7 files changed

Lines changed: 361 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 9
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-52530c249d6af17095f89d698ba795846df15a0cada81db021d8919e25d6d9d5.yml
1+
configured_endpoints: 11
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-eeb1e8ae03bb1dd924b05f4a631d38d5f1fdeb8926168ce63b95d8445df2d359.yml

api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ from steel.types import (
2121
Session,
2222
SessionContext,
2323
Sessionslist,
24+
SessionEventsResponse,
25+
SessionLiveDetailsResponse,
2426
SessionReleaseResponse,
2527
SessionReleaseAllResponse,
2628
)
@@ -32,5 +34,7 @@ Methods:
3234
- <code title="get /v1/sessions/{id}">client.sessions.<a href="./src/steel/resources/sessions.py">retrieve</a>(id) -> <a href="./src/steel/types/session.py">Session</a></code>
3335
- <code title="get /v1/sessions">client.sessions.<a href="./src/steel/resources/sessions.py">list</a>(\*\*<a href="src/steel/types/session_list_params.py">params</a>) -> SyncSessionsCursor[Session]</code>
3436
- <code title="get /v1/sessions/{id}/context">client.sessions.<a href="./src/steel/resources/sessions.py">context</a>(id) -> <a href="./src/steel/types/session_context.py">SessionContext</a></code>
37+
- <code title="get /v1/sessions/{id}/events">client.sessions.<a href="./src/steel/resources/sessions.py">events</a>(id) -> <a href="./src/steel/types/session_events_response.py">SessionEventsResponse</a></code>
38+
- <code title="get /v1/sessions/{id}/live-details">client.sessions.<a href="./src/steel/resources/sessions.py">live_details</a>(id) -> <a href="./src/steel/types/session_live_details_response.py">SessionLiveDetailsResponse</a></code>
3539
- <code title="post /v1/sessions/{id}/release">client.sessions.<a href="./src/steel/resources/sessions.py">release</a>(id) -> <a href="./src/steel/types/session_release_response.py">SessionReleaseResponse</a></code>
3640
- <code title="post /v1/sessions/release">client.sessions.<a href="./src/steel/resources/sessions.py">release_all</a>() -> <a href="./src/steel/types/session_release_all_response.py">SessionReleaseAllResponse</a></code>

src/steel/resources/sessions.py

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
from ..types.session import Session as TypesSession
2626
from ..types.sessionslist import Session as SessionslistSession
2727
from ..types.session_context import SessionContext
28+
from ..types.session_events_response import SessionEventsResponse
2829
from ..types.session_release_response import SessionReleaseResponse
2930
from ..types.session_release_all_response import SessionReleaseAllResponse
31+
from ..types.session_live_details_response import SessionLiveDetailsResponse
3032

3133
__all__ = ["SessionsResource", "AsyncSessionsResource"]
3234

@@ -252,6 +254,72 @@ def context(
252254
cast_to=SessionContext,
253255
)
254256

257+
def events(
258+
self,
259+
id: str,
260+
*,
261+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
262+
# The extra values given here take precedence over values defined on the client or passed to this method.
263+
extra_headers: Headers | None = None,
264+
extra_query: Query | None = None,
265+
extra_body: Body | None = None,
266+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
267+
) -> SessionEventsResponse:
268+
"""
269+
This endpoint allows you to get the recorded session events in the RRWeb format
270+
271+
Args:
272+
extra_headers: Send extra headers
273+
274+
extra_query: Add additional query parameters to the request
275+
276+
extra_body: Add additional JSON properties to the request
277+
278+
timeout: Override the client-level default timeout for this request, in seconds
279+
"""
280+
if not id:
281+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
282+
return self._get(
283+
f"/v1/sessions/{id}/events",
284+
options=make_request_options(
285+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
286+
),
287+
cast_to=SessionEventsResponse,
288+
)
289+
290+
def live_details(
291+
self,
292+
id: str,
293+
*,
294+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
295+
# The extra values given here take precedence over values defined on the client or passed to this method.
296+
extra_headers: Headers | None = None,
297+
extra_query: Query | None = None,
298+
extra_body: Body | None = None,
299+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
300+
) -> SessionLiveDetailsResponse:
301+
"""
302+
Returns the live state of the session, including pages, tabs, and browser state
303+
304+
Args:
305+
extra_headers: Send extra headers
306+
307+
extra_query: Add additional query parameters to the request
308+
309+
extra_body: Add additional JSON properties to the request
310+
311+
timeout: Override the client-level default timeout for this request, in seconds
312+
"""
313+
if not id:
314+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
315+
return self._get(
316+
f"/v1/sessions/{id}/live-details",
317+
options=make_request_options(
318+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
319+
),
320+
cast_to=SessionLiveDetailsResponse,
321+
)
322+
255323
def release(
256324
self,
257325
id: str,
@@ -526,6 +594,72 @@ async def context(
526594
cast_to=SessionContext,
527595
)
528596

597+
async def events(
598+
self,
599+
id: str,
600+
*,
601+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
602+
# The extra values given here take precedence over values defined on the client or passed to this method.
603+
extra_headers: Headers | None = None,
604+
extra_query: Query | None = None,
605+
extra_body: Body | None = None,
606+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
607+
) -> SessionEventsResponse:
608+
"""
609+
This endpoint allows you to get the recorded session events in the RRWeb format
610+
611+
Args:
612+
extra_headers: Send extra headers
613+
614+
extra_query: Add additional query parameters to the request
615+
616+
extra_body: Add additional JSON properties to the request
617+
618+
timeout: Override the client-level default timeout for this request, in seconds
619+
"""
620+
if not id:
621+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
622+
return await self._get(
623+
f"/v1/sessions/{id}/events",
624+
options=make_request_options(
625+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
626+
),
627+
cast_to=SessionEventsResponse,
628+
)
629+
630+
async def live_details(
631+
self,
632+
id: str,
633+
*,
634+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
635+
# The extra values given here take precedence over values defined on the client or passed to this method.
636+
extra_headers: Headers | None = None,
637+
extra_query: Query | None = None,
638+
extra_body: Body | None = None,
639+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
640+
) -> SessionLiveDetailsResponse:
641+
"""
642+
Returns the live state of the session, including pages, tabs, and browser state
643+
644+
Args:
645+
extra_headers: Send extra headers
646+
647+
extra_query: Add additional query parameters to the request
648+
649+
extra_body: Add additional JSON properties to the request
650+
651+
timeout: Override the client-level default timeout for this request, in seconds
652+
"""
653+
if not id:
654+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
655+
return await self._get(
656+
f"/v1/sessions/{id}/live-details",
657+
options=make_request_options(
658+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
659+
),
660+
cast_to=SessionLiveDetailsResponse,
661+
)
662+
529663
async def release(
530664
self,
531665
id: str,
@@ -595,6 +729,12 @@ def __init__(self, sessions: SessionsResource) -> None:
595729
self.context = to_raw_response_wrapper(
596730
sessions.context,
597731
)
732+
self.events = to_raw_response_wrapper(
733+
sessions.events,
734+
)
735+
self.live_details = to_raw_response_wrapper(
736+
sessions.live_details,
737+
)
598738
self.release = to_raw_response_wrapper(
599739
sessions.release,
600740
)
@@ -619,6 +759,12 @@ def __init__(self, sessions: AsyncSessionsResource) -> None:
619759
self.context = async_to_raw_response_wrapper(
620760
sessions.context,
621761
)
762+
self.events = async_to_raw_response_wrapper(
763+
sessions.events,
764+
)
765+
self.live_details = async_to_raw_response_wrapper(
766+
sessions.live_details,
767+
)
622768
self.release = async_to_raw_response_wrapper(
623769
sessions.release,
624770
)
@@ -643,6 +789,12 @@ def __init__(self, sessions: SessionsResource) -> None:
643789
self.context = to_streamed_response_wrapper(
644790
sessions.context,
645791
)
792+
self.events = to_streamed_response_wrapper(
793+
sessions.events,
794+
)
795+
self.live_details = to_streamed_response_wrapper(
796+
sessions.live_details,
797+
)
646798
self.release = to_streamed_response_wrapper(
647799
sessions.release,
648800
)
@@ -667,6 +819,12 @@ def __init__(self, sessions: AsyncSessionsResource) -> None:
667819
self.context = async_to_streamed_response_wrapper(
668820
sessions.context,
669821
)
822+
self.events = async_to_streamed_response_wrapper(
823+
sessions.events,
824+
)
825+
self.live_details = async_to_streamed_response_wrapper(
826+
sessions.live_details,
827+
)
670828
self.release = async_to_streamed_response_wrapper(
671829
sessions.release,
672830
)

src/steel/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from .session_list_params import SessionListParams as SessionListParams
1313
from .client_scrape_params import ClientScrapeParams as ClientScrapeParams
1414
from .session_create_params import SessionCreateParams as SessionCreateParams
15+
from .session_events_response import SessionEventsResponse as SessionEventsResponse
1516
from .client_screenshot_params import ClientScreenshotParams as ClientScreenshotParams
1617
from .session_release_response import SessionReleaseResponse as SessionReleaseResponse
1718
from .session_release_all_response import SessionReleaseAllResponse as SessionReleaseAllResponse
19+
from .session_live_details_response import SessionLiveDetailsResponse as SessionLiveDetailsResponse
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Dict, List
4+
from typing_extensions import TypeAlias
5+
6+
__all__ = ["SessionEventsResponse"]
7+
8+
SessionEventsResponse: TypeAlias = List[Dict[str, object]]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
5+
from pydantic import Field as FieldInfo
6+
7+
from .._models import BaseModel
8+
9+
__all__ = ["SessionLiveDetailsResponse", "Page"]
10+
11+
12+
class Page(BaseModel):
13+
id: str
14+
15+
favicon: Optional[str] = None
16+
17+
session_viewer_fullscreen_url: str = FieldInfo(alias="sessionViewerFullscreenUrl")
18+
19+
session_viewer_url: str = FieldInfo(alias="sessionViewerUrl")
20+
21+
title: str
22+
23+
url: str
24+
25+
26+
class SessionLiveDetailsResponse(BaseModel):
27+
pages: List[Page]
28+
29+
session_viewer_fullscreen_url: str = FieldInfo(alias="sessionViewerFullscreenUrl")
30+
31+
session_viewer_url: str = FieldInfo(alias="sessionViewerUrl")
32+
33+
ws_url: str = FieldInfo(alias="wsUrl")

0 commit comments

Comments
 (0)