|
| 1 | +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +from __future__ import annotations |
| 4 | + |
| 5 | +from .sessions import ( |
| 6 | + Sessions, |
| 7 | + AsyncSessions, |
| 8 | + SessionsWithRawResponse, |
| 9 | + AsyncSessionsWithRawResponse, |
| 10 | + SessionsWithStreamingResponse, |
| 11 | + AsyncSessionsWithStreamingResponse, |
| 12 | +) |
| 13 | +from ...._compat import cached_property |
| 14 | +from ...._resource import SyncAPIResource, AsyncAPIResource |
| 15 | + |
| 16 | +__all__ = ["Realtime", "AsyncRealtime"] |
| 17 | + |
| 18 | + |
| 19 | +class Realtime(SyncAPIResource): |
| 20 | + @cached_property |
| 21 | + def sessions(self) -> Sessions: |
| 22 | + return Sessions(self._client) |
| 23 | + |
| 24 | + @cached_property |
| 25 | + def with_raw_response(self) -> RealtimeWithRawResponse: |
| 26 | + """ |
| 27 | + This property can be used as a prefix for any HTTP method call to return the |
| 28 | + the raw response object instead of the parsed content. |
| 29 | +
|
| 30 | + For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers |
| 31 | + """ |
| 32 | + return RealtimeWithRawResponse(self) |
| 33 | + |
| 34 | + @cached_property |
| 35 | + def with_streaming_response(self) -> RealtimeWithStreamingResponse: |
| 36 | + """ |
| 37 | + An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 38 | +
|
| 39 | + For more information, see https://www.github.com/openai/openai-python#with_streaming_response |
| 40 | + """ |
| 41 | + return RealtimeWithStreamingResponse(self) |
| 42 | + |
| 43 | + |
| 44 | +class AsyncRealtime(AsyncAPIResource): |
| 45 | + @cached_property |
| 46 | + def sessions(self) -> AsyncSessions: |
| 47 | + return AsyncSessions(self._client) |
| 48 | + |
| 49 | + @cached_property |
| 50 | + def with_raw_response(self) -> AsyncRealtimeWithRawResponse: |
| 51 | + """ |
| 52 | + This property can be used as a prefix for any HTTP method call to return the |
| 53 | + the raw response object instead of the parsed content. |
| 54 | +
|
| 55 | + For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers |
| 56 | + """ |
| 57 | + return AsyncRealtimeWithRawResponse(self) |
| 58 | + |
| 59 | + @cached_property |
| 60 | + def with_streaming_response(self) -> AsyncRealtimeWithStreamingResponse: |
| 61 | + """ |
| 62 | + An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 63 | +
|
| 64 | + For more information, see https://www.github.com/openai/openai-python#with_streaming_response |
| 65 | + """ |
| 66 | + return AsyncRealtimeWithStreamingResponse(self) |
| 67 | + |
| 68 | + |
| 69 | +class RealtimeWithRawResponse: |
| 70 | + def __init__(self, realtime: Realtime) -> None: |
| 71 | + self._realtime = realtime |
| 72 | + |
| 73 | + @cached_property |
| 74 | + def sessions(self) -> SessionsWithRawResponse: |
| 75 | + return SessionsWithRawResponse(self._realtime.sessions) |
| 76 | + |
| 77 | + |
| 78 | +class AsyncRealtimeWithRawResponse: |
| 79 | + def __init__(self, realtime: AsyncRealtime) -> None: |
| 80 | + self._realtime = realtime |
| 81 | + |
| 82 | + @cached_property |
| 83 | + def sessions(self) -> AsyncSessionsWithRawResponse: |
| 84 | + return AsyncSessionsWithRawResponse(self._realtime.sessions) |
| 85 | + |
| 86 | + |
| 87 | +class RealtimeWithStreamingResponse: |
| 88 | + def __init__(self, realtime: Realtime) -> None: |
| 89 | + self._realtime = realtime |
| 90 | + |
| 91 | + @cached_property |
| 92 | + def sessions(self) -> SessionsWithStreamingResponse: |
| 93 | + return SessionsWithStreamingResponse(self._realtime.sessions) |
| 94 | + |
| 95 | + |
| 96 | +class AsyncRealtimeWithStreamingResponse: |
| 97 | + def __init__(self, realtime: AsyncRealtime) -> None: |
| 98 | + self._realtime = realtime |
| 99 | + |
| 100 | + @cached_property |
| 101 | + def sessions(self) -> AsyncSessionsWithStreamingResponse: |
| 102 | + return AsyncSessionsWithStreamingResponse(self._realtime.sessions) |
0 commit comments