Struct aide::transform::TransformOperation
source · pub struct TransformOperation<'t> { /* private fields */ }
Expand description
A transform helper that wraps Operation
.
Implementations§
source§impl<'t> TransformOperation<'t>
impl<'t> TransformOperation<'t>
sourcepub fn description(self, desc: &str) -> Self
pub fn description(self, desc: &str) -> Self
Provide a description for the operation.
Hide the operation from the documentation.
This is taken into account by generators provided by this library.
Hiding an item causes it to be ignored completely, there is no way to restore or “unhide” it afterwards.
sourcepub fn input<T: OperationInput>(self) -> Self
pub fn input<T: OperationInput>(self) -> Self
Add input (parameters or request body) to the operation.
The type parameter can be a single type
or a tuple of types that implement OperationInput
.
This function is automatically called for request handlers of supported web frameworks.
sourcepub fn parameter<T, F>(self, name: &str, transform: F) -> Selfwhere
T: Serialize,
F: FnOnce(TransformParameter<'_, T>) -> TransformParameter<'_, T>,
pub fn parameter<T, F>(self, name: &str, transform: F) -> Selfwhere T: Serialize, F: FnOnce(TransformParameter<'_, T>) -> TransformParameter<'_, T>,
Modify a parameter of the operation.
sourcepub fn parameter_untyped<F>(self, name: &str, transform: F) -> Selfwhere
F: FnOnce(TransformParameter<'_, ()>) -> TransformParameter<'_, ()>,
pub fn parameter_untyped<F>(self, name: &str, transform: F) -> Selfwhere F: FnOnce(TransformParameter<'_, ()>) -> TransformParameter<'_, ()>,
Modify a parameter of the operation without knowing a type.
The type ()
will be used instead.
sourcepub fn default_response<R>(self) -> Selfwhere
R: OperationOutput,
pub fn default_response<R>(self) -> Selfwhere R: OperationOutput,
Set a default response for the operation if it does not already have one.
sourcepub fn default_response_with<R, F>(self, transform: F) -> Selfwhere
R: OperationOutput,
F: FnOnce(TransformResponse<'_, R::Inner>) -> TransformResponse<'_, R::Inner>,
pub fn default_response_with<R, F>(self, transform: F) -> Selfwhere R: OperationOutput, F: FnOnce(TransformResponse<'_, R::Inner>) -> TransformResponse<'_, R::Inner>,
Set a default response for the operation if it does not already have one.
This method additionally accepts a transform function to modify the generated documentation.
sourcepub fn response<const N: u16, R>(self) -> Selfwhere
R: OperationOutput,
pub fn response<const N: u16, R>(self) -> Selfwhere R: OperationOutput,
Add a response to the operation with the given status code.
sourcepub fn response_with<const N: u16, R, F>(self, transform: F) -> Selfwhere
R: OperationOutput,
F: FnOnce(TransformResponse<'_, R::Inner>) -> TransformResponse<'_, R::Inner>,
pub fn response_with<const N: u16, R, F>(self, transform: F) -> Selfwhere R: OperationOutput, F: FnOnce(TransformResponse<'_, R::Inner>) -> TransformResponse<'_, R::Inner>,
Add a response to the operation with the given status code.
This method additionally accepts a transform function to modify the generated documentation.
sourcepub fn response_range<const N: u16, R>(self) -> Selfwhere
R: OperationOutput,
pub fn response_range<const N: u16, R>(self) -> Selfwhere R: OperationOutput,
Add a response to the operation with the given status code range (e.g. 2xx).
Note that the range is 100
-based, so for the range 2xx
, 2
must be provided.
sourcepub fn response_range_with<const N: u16, R, F>(self, transform: F) -> Selfwhere
R: OperationOutput,
F: FnOnce(TransformResponse<'_, R::Inner>) -> TransformResponse<'_, R::Inner>,
pub fn response_range_with<const N: u16, R, F>(self, transform: F) -> Selfwhere R: OperationOutput, F: FnOnce(TransformResponse<'_, R::Inner>) -> TransformResponse<'_, R::Inner>,
Add a response to the operation with the given status code range (e.g. 2xx).
Note that the range is 100
-based, so for the range 2xx
, 2
must be provided.
This method additionally accepts a transform function to modify the generated documentation.
sourcepub fn callback(
self,
callback_name: &str,
callback_url: &str,
callback_transform: impl FnOnce(TransformCallback<'_>) -> TransformCallback<'_>
) -> Self
pub fn callback( self, callback_name: &str, callback_url: &str, callback_transform: impl FnOnce(TransformCallback<'_>) -> TransformCallback<'_> ) -> Self
Add a callback to the operation.
sourcepub fn security_requirement(self, security_scheme: &str) -> Self
pub fn security_requirement(self, security_scheme: &str) -> Self
Add a security requirement to the operation.
sourcepub fn security_requirement_multi<'a, I>(self, security_schemes: I) -> Selfwhere
I: IntoIterator<Item = &'a str> + Clone,
pub fn security_requirement_multi<'a, I>(self, security_schemes: I) -> Selfwhere I: IntoIterator<Item = &'a str> + Clone,
Add multi security requirement to the operation.
sourcepub fn security_requirement_scopes<I, S>(
self,
security_scheme: &str,
scopes: I
) -> Selfwhere
I: IntoIterator<Item = S>,
S: Into<String>,
pub fn security_requirement_scopes<I, S>( self, security_scheme: &str, scopes: I ) -> Selfwhere I: IntoIterator<Item = S>, S: Into<String>,
Add required scopes to a security requirement.
If the scheme requirement does not exist, it will be added.
sourcepub fn security_requirement_multi_scopes<'a, I, IS, S>(
self,
security_schemes: I,
scopes: IS
) -> Selfwhere
I: IntoIterator<Item = &'a str> + Clone,
IS: IntoIterator<Item = S>,
S: Into<String>,
pub fn security_requirement_multi_scopes<'a, I, IS, S>( self, security_schemes: I, scopes: IS ) -> Selfwhere I: IntoIterator<Item = &'a str> + Clone, IS: IntoIterator<Item = S>, S: Into<String>,
Add required scopes to multi security requirement.
If the scheme requirement does not exist, it will be added.