From 4e4df8e2f000111498e12811d0aebc254cfe6e2a Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 28 Jan 2019 17:18:42 +0100 Subject: [PATCH] api/router.rs: add new 'protected' flag to ApiMethod --- src/api/router.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/api/router.rs b/src/api/router.rs index 9d737252..82345525 100644 --- a/src/api/router.rs +++ b/src/api/router.rs @@ -39,6 +39,7 @@ type ApiHandlerFn = fn(Value, &ApiMethod, &mut dyn RpcEnvironment) -> Result Result; pub struct ApiMethod { + pub protected: bool, pub parameters: ObjectSchema, pub returns: Arc, pub handler: ApiHandlerFn, @@ -51,6 +52,7 @@ impl ApiMethod { parameters, handler, returns: Arc::new(Schema::Null), + protected: false, } } @@ -60,6 +62,13 @@ impl ApiMethod { self } + + pub fn protected(mut self, protected: bool) -> Self { + + self.protected = protected; + + self + } } pub struct ApiAsyncMethod {