pub struct ClientBuilder<Version = DefaultVersion, ACB = ()> { /* private fields */ }
Expand description
Builder for the Client
Implementations§
Source§impl<V, ACB> ClientBuilder<V, ACB>where
V: FhirVersion,
impl<V, ACB> ClientBuilder<V, ACB>where
V: FhirVersion,
Sourcepub fn user_agent(self, user_agent: String) -> Self
pub fn user_agent(self, user_agent: String) -> Self
User agent to use for requests. This is ignored if a Reqwest client is passed to the builder using the client() method.
Sourcepub fn request_settings(self, settings: RequestSettings) -> Self
pub fn request_settings(self, settings: RequestSettings) -> Self
Request settings.
Sourcepub fn auth_callback<LM>(self, login_manager: LM) -> ClientBuilder<V, LM>where
LM: LoginManager + 'static,
pub fn auth_callback<LM>(self, login_manager: LM) -> ClientBuilder<V, LM>where
LM: LoginManager + 'static,
Set an authorization callback to be called every time the server returns
unauthorized. Should return the header value for the Authorization
header.
Valid login managers are:
- Async functions
async fn my_auth_callback(client: reqwest::Client) -> Result<HeaderValue, MyError>
- Async closures
|client: reqwest::Client| async move { ... }
- Types that implement LoginManager
Calling this with unit type ()
will panic on auth_callback called.
()
is allowed at compile time for convenience reasons (generics
stuff).
Sourcepub const fn allow_version_mismatch(self) -> Self
pub const fn allow_version_mismatch(self) -> Self
Disable errors if the server responds with a different major FHIR version.
Sourcepub const fn allow_origin_mismatch(self) -> Self
pub const fn allow_origin_mismatch(self) -> Self
Disable errors blocking to send a request to a different server than is configured in the base URL. Also not applies to custom requests! Reasoning is to avoid search results and references to resources on other servers when this is not wanted.