pub struct OpenCodeClient { /* private fields */ }Expand description
HTTP client for OpenCode Server API
Implementations§
Source§impl OpenCodeClient
impl OpenCodeClient
Sourcepub async fn health_check(&self) -> Result<bool>
pub async fn health_check(&self) -> Result<bool>
Check if server is ready
Sourcepub async fn server_info(&self) -> Result<ServerInfo>
pub async fn server_info(&self) -> Result<ServerInfo>
Get server info
Sourcepub async fn create_session(&self, title: &str) -> Result<Session>
pub async fn create_session(&self, title: &str) -> Result<Session>
Create a new session
Sourcepub async fn send_message(
&self,
session_id: &str,
text: &str,
model: Option<(&str, &str)>,
) -> Result<()>
pub async fn send_message( &self, session_id: &str, text: &str, model: Option<(&str, &str)>, ) -> Result<()>
Send a message/prompt to a session
Sourcepub async fn get_session_status(
&self,
session_id: &str,
) -> Result<SessionStatus>
pub async fn get_session_status( &self, session_id: &str, ) -> Result<SessionStatus>
Get session status
Sourcepub async fn abort_session(&self, session_id: &str) -> Result<()>
pub async fn abort_session(&self, session_id: &str) -> Result<()>
Abort/cancel a running session
Sourcepub async fn delete_session(&self, session_id: &str) -> Result<()>
pub async fn delete_session(&self, session_id: &str) -> Result<()>
Delete a session
Sourcepub async fn list_sessions(&self) -> Result<Vec<Session>>
pub async fn list_sessions(&self) -> Result<Vec<Session>>
List all sessions
Sourcepub fn event_stream_url(&self) -> String
pub fn event_stream_url(&self) -> String
Get the SSE event stream URL
Auto Trait Implementations§
impl Freeze for OpenCodeClient
impl !RefUnwindSafe for OpenCodeClient
impl Send for OpenCodeClient
impl Sync for OpenCodeClient
impl Unpin for OpenCodeClient
impl !UnwindSafe for OpenCodeClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more