pub struct ClientBuilder { /* private fields */ }Expand description
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn key(self, key: impl Into<String>) -> Self
pub fn key(self, key: impl Into<String>) -> Self
An API key, sent in the api-key header (see key_header).
Sourcepub fn token(self, token: impl Into<String>) -> Self
pub fn token(self, token: impl Into<String>) -> Self
A company sign-in token, sent as Authorization: Bearer <token>
(see token_header).
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
The per-request timeout; 30 seconds by default.
Sourcepub fn allow_http(self, allow: bool) -> Self
pub fn allow_http(self, allow: bool) -> Self
Send a key or token over plain http:// to a host that is not this
machine. Off by default: such a client refuses to be made.
Sourcepub fn key_header(self, name: impl Into<String>) -> Self
pub fn key_header(self, name: impl Into<String>) -> Self
The header the key goes in; api-key by default. A gateway may want
its own (Ocp-Apim-Subscription-Key).
Sourcepub fn token_header(self, name: impl Into<String>) -> Self
pub fn token_header(self, name: impl Into<String>) -> Self
The header a sign-in token goes in, always as Bearer <token>;
authorization by default.
Sourcepub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
An extra header sent on every request, for a gateway that wants a
subscription key as well as the person’s token. It never replaces
user-agent or the key or token header.
Sourcepub fn prefix(self, prefix: impl Into<String>) -> Self
pub fn prefix(self, prefix: impl Into<String>) -> Self
The path every route lives under at the gateway (/acme).
Sourcepub fn gateway_paths(self, paths: impl Into<GatewayPaths>) -> Self
pub fn gateway_paths(self, paths: impl Into<GatewayPaths>) -> Self
Each route’s own gateway path, as the gateway team hands them over:
"api/v1=/files/search, auth=/files/auth", or a map of the same.
A request goes to <gateway path><prefix><route>, the gateway path
being that of the longest name the route falls under.
Sourcepub fn ca_certificate(self, pem: &[u8]) -> Self
pub fn ca_certificate(self, pem: &[u8]) -> Self
Trust a private CA as well as the usual roots: a PEM certificate, or a bundle of them. Certificates are always checked; there is no way to turn that off.
Sourcepub fn identity(self, pem: &[u8]) -> Self
pub fn identity(self, pem: &[u8]) -> Self
A client certificate for a gateway that asks for one: the certificate and its private key, PEM, in one buffer.