api/router.rs: add new 'protected' flag to ApiMethod
This commit is contained in:
parent
5bb3398171
commit
4e4df8e2f0
@ -39,6 +39,7 @@ type ApiHandlerFn = fn(Value, &ApiMethod, &mut dyn RpcEnvironment) -> Result<Val
|
||||
type ApiAsyncHandlerFn = fn(Parts, Body, Value, &ApiAsyncMethod, &mut dyn RpcEnvironment) -> Result<BoxFut, Error>;
|
||||
|
||||
pub struct ApiMethod {
|
||||
pub protected: bool,
|
||||
pub parameters: ObjectSchema,
|
||||
pub returns: Arc<Schema>,
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user