use url::Url;
use crate::{
body::{Body, BodyUpdate},
error::ClientError,
state::SapSsrClient,
};
pub mod blocking;
#[cfg(feature = "reqwest")]
pub mod reqwest;
pub trait WebDynproRequests {
fn navigate(
&self,
base_url: &Url,
name: &str,
) -> impl std::future::Future<Output = Result<Body, ClientError>> + Send;
fn send_events(
&self,
base_url: &Url,
ssr_client: &SapSsrClient,
serialized_events: &str,
) -> impl std::future::Future<Output = Result<BodyUpdate, ClientError>> + Send;
}
#[cfg(any(feature = "reqwest", feature = "ureq"))]
fn build_navigation_url(base_url: &Url, name: &str) -> String {
let mut url = base_url.to_string();
if !url.ends_with('/') {
url.push('/');
}
url.push_str(name);
url.push_str("?sap-wd-stableids=X#");
url
}