pub struct SoapClient { /* private fields */ }Expand description
HTTP transport client for the Yuki SOAP API.
Implementations§
Source§impl SoapClient
impl SoapClient
Sourcepub fn new(base_url: &str) -> Self
pub fn new(base_url: &str) -> Self
Create a transport with its own default HTTP client. Convenient for short-lived consumers such as the CLI, where each invocation is fresh.
Sourcepub fn with_client(base_url: &str, http: Client) -> Self
pub fn with_client(base_url: &str, http: Client) -> Self
Create a transport over a caller-provided HTTP client. Long-running consumers (e.g. a server) should pass a single shared, pooled client rather than constructing one per request.
pub fn with_session(self, session_id: &str) -> Self
pub fn session_id(&self) -> Option<&str>
Sourcepub fn soap_action(_service: &str, operation: &str) -> String
pub fn soap_action(_service: &str, operation: &str) -> String
Build the SOAPAction header value for a given operation.
Sourcepub async fn call(
&self,
operation: &str,
envelope: String,
) -> Result<String, YukiError>
pub async fn call( &self, operation: &str, envelope: String, ) -> Result<String, YukiError>
POST a SOAP envelope and return the raw response body.
Sourcepub async fn authenticate(&mut self, api_key: &str) -> Result<String, YukiError>
pub async fn authenticate(&mut self, api_key: &str) -> Result<String, YukiError>
Authenticate with an API key, storing the returned session ID.
Sourcepub fn parse_single_result(
xml: &str,
result_tag: &str,
) -> Result<String, YukiError>
pub fn parse_single_result( xml: &str, result_tag: &str, ) -> Result<String, YukiError>
Extract the text content of a single named element from a SOAP response.
Returns an error if a SOAP fault is found or the element is missing.
Sourcepub fn parse_soap_fault(xml: &str) -> Option<YukiError>
pub fn parse_soap_fault(xml: &str) -> Option<YukiError>
Detect a SOAP fault in the response and return it as a YukiError.
Returns None if no fault is present.