pub struct BrowserRuntimeClient { /* private fields */ }Expand description
Authenticated HTTP client for the Bobby Browser /v1 runtime interface.
Construct with BrowserRuntimeClient::new. base_url is the runtime
origin; a trailing slash and a trailing /v1 are stripped.
Implementations§
Source§impl BrowserRuntimeClient
impl BrowserRuntimeClient
Sourcepub fn new(
base_url: impl Into<String>,
bearer_token: impl Into<String>,
) -> Result<Self, ClientError>
pub fn new( base_url: impl Into<String>, bearer_token: impl Into<String>, ) -> Result<Self, ClientError>
Create a client.
base_url is the runtime origin (http://127.0.0.1:7777 or …/v1).
Returns ClientError::Protocol when base_url or bearer_token is empty.
Sourcepub async fn runtime_info(
&self,
options: Option<RequestOptions>,
) -> Result<RuntimeInfo, ClientError>
pub async fn runtime_info( &self, options: Option<RequestOptions>, ) -> Result<RuntimeInfo, ClientError>
GET /v1/runtime — version, capabilities, and load counters.
Sourcepub async fn create_session(
&self,
input: &CreateSessionRequest,
options: Option<RequestOptions>,
) -> Result<SessionState, ClientError>
pub async fn create_session( &self, input: &CreateSessionRequest, options: Option<RequestOptions>, ) -> Result<SessionState, ClientError>
POST /v1/sessions — create a browser session.
Sourcepub async fn list_sessions(
&self,
options: Option<RequestOptions>,
) -> Result<Vec<SessionState>, ClientError>
pub async fn list_sessions( &self, options: Option<RequestOptions>, ) -> Result<Vec<SessionState>, ClientError>
GET /v1/sessions — list active sessions.
Sourcepub async fn delete_session(
&self,
session_id: &SessionId,
options: Option<RequestOptions>,
) -> Result<(), ClientError>
pub async fn delete_session( &self, session_id: &SessionId, options: Option<RequestOptions>, ) -> Result<(), ClientError>
DELETE /v1/sessions/{id} — tear down a session (204 on success).
Sourcepub async fn open_page(
&self,
input: &OpenPageRequest,
options: Option<RequestOptions>,
) -> Result<PageState, ClientError>
pub async fn open_page( &self, input: &OpenPageRequest, options: Option<RequestOptions>, ) -> Result<PageState, ClientError>
POST /v1/pages — open a page in a session.
Sourcepub async fn submit(
&self,
input: &CommandEnvelope,
options: Option<RequestOptions>,
) -> Result<CommandOutcome, ClientError>
pub async fn submit( &self, input: &CommandEnvelope, options: Option<RequestOptions>, ) -> Result<CommandOutcome, ClientError>
POST /v1/commands — submit a command envelope (primitive or intent).
Trait Implementations§
Source§impl Clone for BrowserRuntimeClient
impl Clone for BrowserRuntimeClient
Source§fn clone(&self) -> BrowserRuntimeClient
fn clone(&self) -> BrowserRuntimeClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 !RefUnwindSafe for BrowserRuntimeClient
impl !UnwindSafe for BrowserRuntimeClient
impl Freeze for BrowserRuntimeClient
impl Send for BrowserRuntimeClient
impl Sync for BrowserRuntimeClient
impl Unpin for BrowserRuntimeClient
impl UnsafeUnpin for BrowserRuntimeClient
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