pub struct OpenCodeBridge { /* private fields */ }Expand description
HTTP client for all OpenCode API endpoints.
Implementations§
Source§impl OpenCodeBridge
impl OpenCodeBridge
Sourcepub fn new(url: &str, port: u16, password: Option<String>) -> Self
pub fn new(url: &str, port: u16, password: Option<String>) -> Self
Creates a new bridge client.
url is typically “http://localhost”, port is the OpenCode server port.
Sourcepub fn get_base_url(&self) -> &str
pub fn get_base_url(&self) -> &str
Returns the base URL (e.g. “http://localhost:4096”).
Sourcepub async fn append_prompt(
&self,
text: &str,
directory: Option<&str>,
workspace: Option<&str>,
) -> Result<()>
pub async fn append_prompt( &self, text: &str, directory: Option<&str>, workspace: Option<&str>, ) -> Result<()>
Injects text into OpenCode’s prompt.
Sourcepub async fn submit_prompt(&self) -> Result<()>
pub async fn submit_prompt(&self) -> Result<()>
Submits the OpenCode prompt.
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Checks if OpenCode is reachable. Never panics.
Sourcepub async fn reply_permission(
&self,
id: &str,
reply: PermissionReply,
message: Option<&str>,
) -> Result<()>
pub async fn reply_permission( &self, id: &str, reply: PermissionReply, message: Option<&str>, ) -> Result<()>
Replies to a permission request.
Sourcepub async fn reply_question(
&self,
id: &str,
answers: Vec<Vec<String>>,
) -> Result<()>
pub async fn reply_question( &self, id: &str, answers: Vec<Vec<String>>, ) -> Result<()>
Replies to a question request with answers.
Sourcepub async fn reject_question(&self, id: &str) -> Result<()>
pub async fn reject_question(&self, id: &str) -> Result<()>
Rejects (dismisses) a question request.
Auto Trait Implementations§
impl Freeze for OpenCodeBridge
impl !RefUnwindSafe for OpenCodeBridge
impl Send for OpenCodeBridge
impl Sync for OpenCodeBridge
impl Unpin for OpenCodeBridge
impl UnsafeUnpin for OpenCodeBridge
impl !UnwindSafe for OpenCodeBridge
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