pub struct OriginClient { /* private fields */ }Expand description
HTTP client for the Origin REST API.
Implementations§
Source§impl OriginClient
impl OriginClient
pub fn new(base_url: String) -> Self
Sourcepub fn with_agent_name(self, name: String) -> Self
pub fn with_agent_name(self, name: String) -> Self
Set the agent name to be sent as x-agent-name header on every request.
Sourcepub async fn get<R: DeserializeOwned>(
&self,
path: &str,
) -> Result<R, OriginError>
pub async fn get<R: DeserializeOwned>( &self, path: &str, ) -> Result<R, OriginError>
GET request, deserialize JSON response.
Sourcepub async fn post<B: Serialize, R: DeserializeOwned>(
&self,
path: &str,
body: &B,
) -> Result<R, OriginError>
pub async fn post<B: Serialize, R: DeserializeOwned>( &self, path: &str, body: &B, ) -> Result<R, OriginError>
POST request with JSON body, deserialize JSON response.
Sourcepub async fn post_empty<R: DeserializeOwned>(
&self,
path: &str,
) -> Result<R, OriginError>
pub async fn post_empty<R: DeserializeOwned>( &self, path: &str, ) -> Result<R, OriginError>
POST request with empty body, deserialize JSON response. Used for mutate endpoints where the id is in the path and no body is needed.
Sourcepub async fn delete<R: DeserializeOwned>(
&self,
path: &str,
) -> Result<R, OriginError>
pub async fn delete<R: DeserializeOwned>( &self, path: &str, ) -> Result<R, OriginError>
DELETE request, deserialize JSON response.
Sourcepub async fn put<B: Serialize, R: DeserializeOwned>(
&self,
path: &str,
body: &B,
) -> Result<R, OriginError>
pub async fn put<B: Serialize, R: DeserializeOwned>( &self, path: &str, body: &B, ) -> Result<R, OriginError>
PUT request with JSON body, deserialize JSON response.
Sourcepub async fn version_handshake(&self) -> Option<String>
pub async fn version_handshake(&self) -> Option<String>
Query the daemon’s /api/health, compare versions, and return a human-readable warning if origin-mcp is older than the daemon’s minor. Returns None if compatible OR if the daemon is unreachable / response can’t be parsed (handshake never blocks startup).
Trait Implementations§
Source§impl Clone for OriginClient
impl Clone for OriginClient
Source§fn clone(&self) -> OriginClient
fn clone(&self) -> OriginClient
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 Freeze for OriginClient
impl !RefUnwindSafe for OriginClient
impl Send for OriginClient
impl Sync for OriginClient
impl Unpin for OriginClient
impl UnsafeUnpin for OriginClient
impl !UnwindSafe for OriginClient
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