pub struct MessagesApi { /* private fields */ }Expand description
Messages API client.
Implementations§
Source§impl MessagesApi
impl MessagesApi
Sourcepub fn new(http: HttpClient) -> Self
pub fn new(http: HttpClient) -> Self
Create a new Messages API client.
Sourcepub async fn prompt_async(
&self,
session_id: &str,
req: &PromptRequest,
) -> Result<()>
pub async fn prompt_async( &self, session_id: &str, req: &PromptRequest, ) -> Result<()>
Send a prompt asynchronously (returns immediately).
Unlike prompt, this endpoint returns immediately and the response
is streamed via SSE events. The server returns an empty body on success.
§Errors
Returns an error if the request fails.
Sourcepub async fn send_text_async(
&self,
session_id: &str,
text: impl Into<String>,
model: Option<ModelRef>,
) -> Result<()>
pub async fn send_text_async( &self, session_id: &str, text: impl Into<String>, model: Option<ModelRef>, ) -> Result<()>
Send a plain text prompt asynchronously.
This convenience helper wraps Self::prompt_async.
The server returns an empty body on success.
§Errors
Returns an error if the request fails.
Sourcepub async fn command(
&self,
session_id: &str,
req: &CommandRequest,
) -> Result<CommandResponse>
pub async fn command( &self, session_id: &str, req: &CommandRequest, ) -> Result<CommandResponse>
Sourcepub async fn shell(
&self,
session_id: &str,
req: &ShellRequest,
) -> Result<ShellResponse>
pub async fn shell( &self, session_id: &str, req: &ShellRequest, ) -> Result<ShellResponse>
Trait Implementations§
Source§impl Clone for MessagesApi
impl Clone for MessagesApi
Source§fn clone(&self) -> MessagesApi
fn clone(&self) -> MessagesApi
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MessagesApi
impl !RefUnwindSafe for MessagesApi
impl Send for MessagesApi
impl Sync for MessagesApi
impl Unpin for MessagesApi
impl !UnwindSafe for MessagesApi
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