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

Method revert

src/opencode_ai/resources/session.py:292–332  ·  view source on GitHub ↗

Revert a message 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 requ

(
        self,
        id: str,
        *,
        message_id: str,
        part_id: str | NotGiven = NOT_GIVEN,
        # 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,
    )

Source from the content-addressed store, hash-verified

290 )
291
292 def revert(
293 self,
294 id: str,
295 *,
296 message_id: str,
297 part_id: str | NotGiven = NOT_GIVEN,
298 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
299 # The extra values given here take precedence over values defined on the client or passed to this method.
300 extra_headers: Headers | None = None,
301 extra_query: Query | None = None,
302 extra_body: Body | None = None,
303 timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
304 ) -> Session:
305 """
306 Revert a message
307
308 Args:
309 extra_headers: Send extra headers
310
311 extra_query: Add additional query parameters to the request
312
313 extra_body: Add additional JSON properties to the request
314
315 timeout: Override the client-level default timeout for this request, in seconds
316 """
317 if not id:
318 raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
319 return self._post(
320 f"/session/{id}/revert",
321 body=maybe_transform(
322 {
323 "message_id": message_id,
324 "part_id": part_id,
325 },
326 session_revert_params.SessionRevertParams,
327 ),
328 options=make_request_options(
329 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
330 ),
331 cast_to=Session,
332 )
333
334 def share(
335 self,

Calls 2

maybe_transformFunction · 0.85
make_request_optionsFunction · 0.85