pub struct OpenCodeClient { /* private fields */ }Expand description
Client for OpenCode service
Implementations§
Source§impl OpenCodeClient
impl OpenCodeClient
Sourcepub fn new(config: OpenCodeConfig) -> Result<Self>
pub fn new(config: OpenCodeConfig) -> Result<Self>
Create a new OpenCode client
Sourcepub async fn index_codebase(
&self,
codebase_path: &Path,
) -> Result<IndexResponse>
pub async fn index_codebase( &self, codebase_path: &Path, ) -> Result<IndexResponse>
Index a codebase and wait for completion
This is the main entry point for indexing. It:
- Packages the codebase
- Uploads to OpenCode
- Waits for indexing to complete
- Returns the index ID
Sourcepub async fn wait_for_index(&self, index_id: &str) -> Result<IndexResponse>
pub async fn wait_for_index(&self, index_id: &str) -> Result<IndexResponse>
Wait for an index to become ready
Sourcepub async fn get_index_status(&self, index_id: &str) -> Result<IndexResponse>
pub async fn get_index_status(&self, index_id: &str) -> Result<IndexResponse>
Get status of an index
Sourcepub async fn delete_index(&self, index_id: &str) -> Result<()>
pub async fn delete_index(&self, index_id: &str) -> Result<()>
Delete an index
Sourcepub async fn get_index_stats(&self, index_id: &str) -> Result<IndexStats>
pub async fn get_index_stats(&self, index_id: &str) -> Result<IndexStats>
Get statistics about an index
Sourcepub async fn search(
&self,
index_id: &str,
request: SearchRequest,
) -> Result<SearchResponse>
pub async fn search( &self, index_id: &str, request: SearchRequest, ) -> Result<SearchResponse>
Search for code in an indexed codebase
Sourcepub async fn search_code(
&self,
index_id: &str,
query: &str,
limit: usize,
) -> Result<Vec<CodeChunk>>
pub async fn search_code( &self, index_id: &str, query: &str, limit: usize, ) -> Result<Vec<CodeChunk>>
Simple search with just a query string
Sourcepub async fn search_pattern(
&self,
index_id: &str,
pattern: &str,
extensions: Vec<String>,
) -> Result<Vec<CodeChunk>>
pub async fn search_pattern( &self, index_id: &str, pattern: &str, extensions: Vec<String>, ) -> Result<Vec<CodeChunk>>
Search for specific patterns (webhooks, API calls, etc.)
Sourcepub async fn get_file_context(
&self,
index_id: &str,
file_path: &str,
) -> Result<ContextResponse>
pub async fn get_file_context( &self, index_id: &str, file_path: &str, ) -> Result<ContextResponse>
Get context for a specific file
Sourcepub async fn get_context(
&self,
index_id: &str,
request: ContextRequest,
) -> Result<ContextResponse>
pub async fn get_context( &self, index_id: &str, request: ContextRequest, ) -> Result<ContextResponse>
Get context with custom options
Sourcepub async fn get_file(
&self,
index_id: &str,
file_path: &str,
) -> Result<FileInfo>
pub async fn get_file( &self, index_id: &str, file_path: &str, ) -> Result<FileInfo>
Get a file’s content directly
Sourcepub async fn list_files(&self, index_id: &str) -> Result<Vec<String>>
pub async fn list_files(&self, index_id: &str) -> Result<Vec<String>>
List all files in an index
Sourcepub async fn find_webhooks(&self, index_id: &str) -> Result<Vec<CodeChunk>>
pub async fn find_webhooks(&self, index_id: &str) -> Result<Vec<CodeChunk>>
Search for webhook handlers in the codebase
Sourcepub async fn find_api_calls(&self, index_id: &str) -> Result<Vec<CodeChunk>>
pub async fn find_api_calls(&self, index_id: &str) -> Result<Vec<CodeChunk>>
Search for Shopify API calls
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