Struct crud_api_endpoint::EndpointBuilder
source · pub struct EndpointBuilder { /* private fields */ }Expand description
Builder for Endpoint.
Implementations§
source§impl EndpointBuilder
impl EndpointBuilder
sourcepub fn route<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn route<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
Absolute route as format template
Variables are written in curly braces {}.
Examples:
/root/{id}/sub/{arg}
pub fn method<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn payload_struct<VALUE: Into<Option<String>>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn query_struct<VALUE: Into<Option<String>>>(
&mut self,
value: VALUE
) -> &mut Self
sourcepub fn result_ok_status<VALUE: Into<String>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn result_ok_status<VALUE: Into<String>>(
&mut self,
value: VALUE
) -> &mut Self
Expected status if query is ok
pub fn result_ko_status<VALUE: Into<Vec<EndpointStatus>>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn result_struct<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
sourcepub fn result_multiple<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn result_multiple<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
returns a list of results
sourcepub fn result_is_stream<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn result_is_stream<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
returns a stream of bytes for this endpoint
This flag generates the --output arguments.
This flag disables the --format arguments.
sourcepub fn cli_route<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn cli_route<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
clap route separated by slash (/)
Variables should match the variables declared in the route configuration.
/command/{id}/subcommand/{arg}
sourcepub fn cli_help<VALUE: Into<Option<String>>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn cli_help<VALUE: Into<Option<String>>>(
&mut self,
value: VALUE
) -> &mut Self
Short help string for this endpoint
sourcepub fn cli_long_help<VALUE: Into<Option<String>>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn cli_long_help<VALUE: Into<Option<String>>>(
&mut self,
value: VALUE
) -> &mut Self
Long help string for this endpoint.
pub fn cli_visible_aliases<VALUE: Into<Option<VecStringWrapper>>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn cli_long_flag_aliases<VALUE: Into<Option<VecStringWrapper>>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn cli_aliases<VALUE: Into<Option<VecStringWrapper>>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn cli_short_flag_aliases<VALUE: Into<Option<VecStringWrapper>>>(
&mut self,
value: VALUE
) -> &mut Self
sourcepub fn cli_no_output<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn cli_no_output<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
This empty have no output to display.
It can be combined with the EmptyResponse result structure.
Examples:
endpoint(
result_ok_status = "NO_CONTENT",
cli_no_output,
result_struct = "EmptyResponse",
route = "...",
cli_route = "...",
),
pub fn cli_output_formats<VALUE: Into<Option<VecStringWrapper>>>(
&mut self,
value: VALUE
) -> &mut Self
sourcepub fn cli_force_output_format<VALUE: Into<bool>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn cli_force_output_format<VALUE: Into<bool>>(
&mut self,
value: VALUE
) -> &mut Self
Force the generation of ‘–format’ args in variable sub command. There’s cases where the arg is not generated automatically.
Example:
/route/{var}'
By default, {var} don’t generate --format.
If route is just a passthrough, you need the cli_force_output_format to generate
the --format args.
pub fn config<VALUE: Into<Vec<ApiInputConfig>>>(
&mut self,
value: VALUE
) -> &mut Self
Trait Implementations§
source§impl Clone for EndpointBuilder
impl Clone for EndpointBuilder
source§fn clone(&self) -> EndpointBuilder
fn clone(&self) -> EndpointBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more