Struct ClientRequestHandler

Source
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

Source

pub fn new(client_manager: Arc<RwLock<dyn ClientManager>>) -> Self

Source

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

Source

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.

Source

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

Source

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

Source

pub fn get_client_script(&self, request: &Request) -> Response

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.