pub struct Client<F> { /* private fields */ }
Expand description
A client that implements the API by making HTTP calls out to a server.
Implementations§
Source§impl Client<ResponseFuture>
impl Client<ResponseFuture>
Sourcepub fn try_new_with_connector<C>(
base_path: &str,
protocol: Option<&'static str>,
connector: C,
) -> Result<Self, ClientInitError>
pub fn try_new_with_connector<C>( base_path: &str, protocol: Option<&'static str>, connector: C, ) -> Result<Self, ClientInitError>
Create a client with a custom implementation of hyper::client::Connect.
Intended for use with custom implementations of connect for e.g. protocol logging
or similar functionality which requires wrapping the transport layer. When wrapping a TCP connection,
this function should be used in conjunction with swagger::Connector::builder()
.
For ordinary tcp connections, prefer the use of try_new_http
, try_new_https
and try_new_https_mutual
, to avoid introducing a dependency on the underlying transport layer.
§Arguments
base_path
- base path of the client API, i.e. “www.my-api-implementation.com”protocol
- Which protocol to use when constructing the request url, e.g.Some("http")
connector
- Implementation ofhyper::client::Connect
to use for the client
Sourcepub fn try_new_http(base_path: &str) -> Result<Self, ClientInitError>
pub fn try_new_http(base_path: &str) -> Result<Self, ClientInitError>
Create an HTTP client.
§Arguments
base_path
- base path of the client API, i.e. “www.my-api-implementation.com”
Sourcepub fn try_new_https(base_path: &str) -> Result<Self, ClientInitError>
pub fn try_new_https(base_path: &str) -> Result<Self, ClientInitError>
Create a client with a TLS connection to the server
§Arguments
base_path
- base path of the client API, i.e. “www.my-api-implementation.com”
Sourcepub fn try_new_https_pinned<CA>(
base_path: &str,
ca_certificate: CA,
) -> Result<Self, ClientInitError>
pub fn try_new_https_pinned<CA>( base_path: &str, ca_certificate: CA, ) -> Result<Self, ClientInitError>
Create a client with a TLS connection to the server using a pinned certificate
§Arguments
base_path
- base path of the client API, i.e. “www.my-api-implementation.com”ca_certificate
- Path to CA certificate used to authenticate the server
Sourcepub fn try_new_https_mutual<CA, K, D>(
base_path: &str,
ca_certificate: CA,
client_key: K,
client_certificate: D,
) -> Result<Self, ClientInitError>
pub fn try_new_https_mutual<CA, K, D>( base_path: &str, ca_certificate: CA, client_key: K, client_certificate: D, ) -> Result<Self, ClientInitError>
Create a client with a mutually authenticated TLS connection to the server.
§Arguments
base_path
- base path of the client API, i.e. “www.my-api-implementation.com”ca_certificate
- Path to CA certificate used to authenticate the serverclient_key
- Path to the client private keyclient_certificate
- Path to the client’s public certificate associated with the private key
Source§impl<F> Client<F>
impl<F> Client<F>
Sourcepub fn try_new_with_client_service(
client_service: Arc<Box<dyn Service<ReqBody = Body, Future = F> + Send + Sync>>,
base_path: &str,
) -> Result<Self, ClientInitError>
pub fn try_new_with_client_service( client_service: Arc<Box<dyn Service<ReqBody = Body, Future = F> + Send + Sync>>, base_path: &str, ) -> Result<Self, ClientInitError>
Constructor for creating a Client
by passing in a pre-made swagger::Service
This allows adding custom wrappers around the underlying transport, for example for logging.
Trait Implementations§
Source§impl<C, F> Api<C> for Client<F>
impl<C, F> Api<C> for Client<F>
fn clear_error( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = ClearErrorResponse, Error = ApiError> + Send>
fn get_addr_enabled( &self, param_bus_id: i32, param_addr: i32, param_num: i32, context: &C, ) -> Box<dyn Future<Item = GetAddrEnabledResponse, Error = ApiError> + Send>
fn get_addr_info( &self, param_bus_id: i32, param_addr: i32, param_num: i32, context: &C, ) -> Box<dyn Future<Item = GetAddrInfoResponse, Error = ApiError> + Send>
fn get_addr_value( &self, param_bus_id: i32, param_addr: i32, param_num: i32, context: &C, ) -> Box<dyn Future<Item = GetAddrValueResponse, Error = ApiError> + Send>
fn get_api( &self, context: &C, ) -> Box<dyn Future<Item = GetApiResponse, Error = ApiError> + Send>
fn get_config( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetConfigResponse, Error = ApiError> + Send>
fn get_current( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetCurrentResponse, Error = ApiError> + Send>
fn get_error( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetErrorResponse, Error = ApiError> + Send>
fn get_errors( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetErrorsResponse, Error = ApiError> + Send>
fn get_freq( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetFreqResponse, Error = ApiError> + Send>
fn get_group( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetGroupResponse, Error = ApiError> + Send>
fn get_led_current( &self, param_bus_id: i32, param_addr: i32, param_led: i32, context: &C, ) -> Box<dyn Future<Item = GetLedCurrentResponse, Error = ApiError> + Send>
fn get_led_error( &self, param_bus_id: i32, param_addr: i32, param_led: i32, context: &C, ) -> Box<dyn Future<Item = GetLedErrorResponse, Error = ApiError> + Send>
fn get_led_info( &self, param_bus_id: i32, param_addr: i32, param_led: i32, context: &C, ) -> Box<dyn Future<Item = GetLedInfoResponse, Error = ApiError> + Send>
fn get_led_info_all( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetLedInfoAllResponse, Error = ApiError> + Send>
fn get_led_pwm( &self, param_bus_id: i32, param_addr: i32, param_led: i32, context: &C, ) -> Box<dyn Future<Item = GetLedPwmResponse, Error = ApiError> + Send>
fn get_led_state( &self, param_bus_id: i32, param_addr: i32, param_led: i32, context: &C, ) -> Box<dyn Future<Item = GetLedStateResponse, Error = ApiError> + Send>
fn get_offset( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetOffsetResponse, Error = ApiError> + Send>
fn get_output_change( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetOutputChangeResponse, Error = ApiError> + Send>
fn get_over_temp( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetOverTempResponse, Error = ApiError> + Send>
fn get_pwm( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetPwmResponse, Error = ApiError> + Send>
fn get_sleep( &self, param_bus_id: i32, param_addr: i32, context: &C, ) -> Box<dyn Future<Item = GetSleepResponse, Error = ApiError> + Send>
fn reset( &self, param_bus_id: i32, context: &C, ) -> Box<dyn Future<Item = ResetResponse, Error = ApiError> + Send>
fn set_addr_enabled( &self, param_bus_id: i32, param_addr: i32, param_num: i32, param_enabled: bool, context: &C, ) -> Box<dyn Future<Item = SetAddrEnabledResponse, Error = ApiError> + Send>
fn set_addr_value( &self, param_bus_id: i32, param_addr: i32, param_num: i32, param_addr_val: i32, context: &C, ) -> Box<dyn Future<Item = SetAddrValueResponse, Error = ApiError> + Send>
fn set_config( &self, param_bus_id: i32, param_addr: i32, param_config: Config, context: &C, ) -> Box<dyn Future<Item = SetConfigResponse, Error = ApiError> + Send>
fn set_current( &self, param_bus_id: i32, param_addr: i32, param_current: i32, context: &C, ) -> Box<dyn Future<Item = SetCurrentResponse, Error = ApiError> + Send>
fn set_freq( &self, param_bus_id: i32, param_addr: i32, param_freq: i32, context: &C, ) -> Box<dyn Future<Item = SetFreqResponse, Error = ApiError> + Send>
fn set_group( &self, param_bus_id: i32, param_addr: i32, param_group: Group, context: &C, ) -> Box<dyn Future<Item = SetGroupResponse, Error = ApiError> + Send>
fn set_led_current( &self, param_bus_id: i32, param_addr: i32, param_led: i32, param_current: i32, context: &C, ) -> Box<dyn Future<Item = SetLedCurrentResponse, Error = ApiError> + Send>
fn set_led_error( &self, param_bus_id: i32, param_addr: i32, param_led: i32, param_error: LedError, context: &C, ) -> Box<dyn Future<Item = SetLedErrorResponse, Error = ApiError> + Send>
fn set_led_info( &self, param_bus_id: i32, param_addr: i32, param_led: i32, param_led_info: LedInfo, context: &C, ) -> Box<dyn Future<Item = SetLedInfoResponse, Error = ApiError> + Send>
fn set_led_info_all( &self, param_bus_id: i32, param_addr: i32, param_led_info_array: LedInfoArray, context: &C, ) -> Box<dyn Future<Item = SetLedInfoAllResponse, Error = ApiError> + Send>
fn set_led_pwm( &self, param_bus_id: i32, param_addr: i32, param_led: i32, param_pwm: i32, context: &C, ) -> Box<dyn Future<Item = SetLedPwmResponse, Error = ApiError> + Send>
fn set_led_state( &self, param_bus_id: i32, param_addr: i32, param_led: i32, param_state: LedState, context: &C, ) -> Box<dyn Future<Item = SetLedStateResponse, Error = ApiError> + Send>
fn set_offset( &self, param_bus_id: i32, param_addr: i32, param_offset: i32, context: &C, ) -> Box<dyn Future<Item = SetOffsetResponse, Error = ApiError> + Send>
fn set_output_change( &self, param_bus_id: i32, param_addr: i32, param_output_change: OutputChange, context: &C, ) -> Box<dyn Future<Item = SetOutputChangeResponse, Error = ApiError> + Send>
fn set_pwm( &self, param_bus_id: i32, param_addr: i32, param_pwm: i32, context: &C, ) -> Box<dyn Future<Item = SetPwmResponse, Error = ApiError> + Send>
fn set_sleep( &self, param_bus_id: i32, param_addr: i32, param_sleep: bool, context: &C, ) -> Box<dyn Future<Item = SetSleepResponse, Error = ApiError> + Send>
Auto Trait Implementations§
impl<F> Freeze for Client<F>
impl<F> !RefUnwindSafe for Client<F>
impl<F> Send for Client<F>
impl<F> Sync for Client<F>
impl<F> Unpin for Client<F>
impl<F> !UnwindSafe for Client<F>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'a, T, C> ContextWrapperExt<'a, C> for Twhere
T: Api<C>,
impl<'a, T, C> ContextWrapperExt<'a, C> for Twhere
T: Api<C>,
Source§fn with_context(&'a self, context: C) -> ContextWrapper<'a, T, C>
fn with_context(&'a self, context: C) -> ContextWrapper<'a, T, C>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more