pub trait KrApi: Send + Sync {
// Required method
fn call<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
method: &'life1 str,
path: &'life2 str,
body: Option<&'life3 Value>,
) -> Pin<Box<dyn Future<Output = Result<Value, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
}Expand description
The seam between cart logic and the browser.
Everything above this trait – event construction, validation, the rollback of a
phantom add, error mapping onto MCP – is ordinary logic that has nothing to do
with Chrome. Naming it lets the tests drive that logic against a fake K-Ruoka
instead of a real browser and a live site, which is what makes it possible to
test the signed-in branches at all without a login (see tests/mcp_protocol.rs).
Deliberately narrow: one method, the same shape as the underlying request. A
wider trait would start duplicating crate::browser::basket::Cart.
Required Methods§
Sourcefn call<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
method: &'life1 str,
path: &'life2 str,
body: Option<&'life3 Value>,
) -> Pin<Box<dyn Future<Output = Result<Value, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn call<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
method: &'life1 str,
path: &'life2 str,
body: Option<&'life3 Value>,
) -> Pin<Box<dyn Future<Output = Result<Value, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Named call rather than api so it cannot be confused with, or silently
shadowed by, Session::api.