pub struct ClientRequestHandler { /* private fields */ }
Expand description
Implements request handler for client type actions
Uses the ClientManager
trait for communicating with the home clients
Implementations§
Source§impl ClientRequestHandler
impl ClientRequestHandler
pub fn new(client_manager: Arc<RwLock<dyn ClientManager>>) -> Self
Sourcepub fn get_clients(&self) -> Response
pub fn get_clients(&self) -> Response
Handles the GET method for the /client
route.
Returns an array of client names in the json key data
Provides a success
key as well
Sourcepub fn put_client(&self, name: String, body: ClientPutBody) -> Response
pub fn put_client(&self, name: String, body: ClientPutBody) -> Response
Handles the PUT method for the /client/{client_name}
url with the client name.
Can return a message
key for the output.
Has to return a success
key for the output.
Sourcepub fn remove_client(&self, client_name: String) -> Response
pub fn remove_client(&self, client_name: String) -> Response
Handles the DELETE method for the /client/{client_name}
path.
Returns an error if the client could not be removed
Returns success if it was able to do so
Sourcepub fn call_client_method(
&self,
client_name: String,
method_name: String,
arguments: Value,
) -> Response
pub fn call_client_method( &self, client_name: String, method_name: String, arguments: Value, ) -> Response
Forwards the given arguments to the given client and calls the given method
Will return the response
from the client
Has to provide a success
key to the output
pub fn get_client_script(&self, request: &Request) -> Response
Trait Implementations§
Source§impl RequestHandler for ClientRequestHandler
impl RequestHandler for ClientRequestHandler
fn handle_request(&self, request: &Request) -> Response
impl Send for ClientRequestHandler
impl Sync for ClientRequestHandler
Auto Trait Implementations§
impl Freeze for ClientRequestHandler
impl RefUnwindSafe for ClientRequestHandler
impl Unpin for ClientRequestHandler
impl UnwindSafe for ClientRequestHandler
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
Mutably borrows from an owned value. Read more