MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / create_session

Method create_session

crates/opencode-tui/src/api.rs:264–278  ·  view source on GitHub ↗
(&self, parent_id: Option<String>)

Source from the content-addressed store, hash-verified

262 }
263
264 pub fn create_session(&self, parent_id: Option<String>) -> anyhow::Result<SessionInfo> {
265 let url = format!("{}/session", self.base_url);
266 let request = CreateSessionRequest { parent_id };
267
268 let response = self.client.post(&url).json(&request).send()?;
269
270 if !response.status().is_success() {
271 let status = response.status();
272 let text = response.text().unwrap_or_default();
273 anyhow::bail!("Failed to create session: {} - {}", status, text);
274 }
275
276 let session: SessionInfo = response.json()?;
277 Ok(session)
278 }
279
280 pub fn get_session(&self, session_id: &str) -> anyhow::Result<SessionInfo> {
281 let url = format!("{}/session/{}", self.base_url, session_id);

Callers

nothing calls this directly

Calls 3

sendMethod · 0.45
statusMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected