MCPcopy Create free account
hub / github.com/anomalyco/opencode-sdk-python / AsyncSessionResource

Class AsyncSessionResource

src/opencode_ai/resources/session.py:478–920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476
477
478class AsyncSessionResource(AsyncAPIResource):
479 @cached_property
480 def with_raw_response(self) -> AsyncSessionResourceWithRawResponse:
481 """
482 This property can be used as a prefix for any HTTP method call to return
483 the raw response object instead of the parsed content.
484
485 For more information, see https://www.github.com/sst/opencode-sdk-python#accessing-raw-response-data-eg-headers
486 """
487 return AsyncSessionResourceWithRawResponse(self)
488
489 @cached_property
490 def with_streaming_response(self) -> AsyncSessionResourceWithStreamingResponse:
491 """
492 An alternative to `.with_raw_response` that doesn't eagerly read the response body.
493
494 For more information, see https://www.github.com/sst/opencode-sdk-python#with_streaming_response
495 """
496 return AsyncSessionResourceWithStreamingResponse(self)
497
498 async def create(
499 self,
500 *,
501 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
502 # The extra values given here take precedence over values defined on the client or passed to this method.
503 extra_headers: Headers | None = None,
504 extra_query: Query | None = None,
505 extra_body: Body | None = None,
506 timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
507 ) -> Session:
508 """Create a new session"""
509 return await self._post(
510 "/session",
511 options=make_request_options(
512 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
513 ),
514 cast_to=Session,
515 )
516
517 async def list(
518 self,
519 *,
520 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
521 # The extra values given here take precedence over values defined on the client or passed to this method.
522 extra_headers: Headers | None = None,
523 extra_query: Query | None = None,
524 extra_body: Body | None = None,
525 timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
526 ) -> SessionListResponse:
527 """List all sessions"""
528 return await self._get(
529 "/session",
530 options=make_request_options(
531 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
532 ),
533 cast_to=SessionListResponse,
534 )
535

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected