Struct crud_api_endpoint::Endpoint
source · pub struct Endpoint {Show 20 fields
pub route: String,
pub method: String,
pub payload_struct: Option<String>,
pub query_struct: Option<String>,
pub result_ok_status: String,
pub result_ko_status: Vec<EndpointStatus>,
pub result_struct: String,
pub result_multiple: bool,
pub result_is_stream: bool,
pub cli_route: String,
pub cli_help: Option<String>,
pub cli_long_help: Option<String>,
pub cli_visible_aliases: Option<VecStringWrapper>,
pub cli_long_flag_aliases: Option<VecStringWrapper>,
pub cli_aliases: Option<VecStringWrapper>,
pub cli_short_flag_aliases: Option<VecStringWrapper>,
pub cli_no_output: bool,
pub cli_output_formats: Option<VecStringWrapper>,
pub cli_force_output_format: bool,
pub config: Vec<ApiInputConfig>,
}Expand description
Specify an Http endpoint
Fields§
§route: StringAbsolute route as format template
Variables are written in curly braces {}.
Examples:
/root/{id}/sub/{arg}
method: String§payload_struct: Option<String>§query_struct: Option<String>§result_ok_status: StringExpected status if query is ok
result_ko_status: Vec<EndpointStatus>§result_struct: String§result_multiple: boolreturns a list of results
result_is_stream: boolreturns a stream of bytes for this endpoint
This flag generates the --output arguments.
This flag disables the --format arguments.
cli_route: Stringclap route separated by slash (/)
Variables should match the variables declared in the route configuration.
/command/{id}/subcommand/{arg}
cli_help: Option<String>Short help string for this endpoint
cli_long_help: Option<String>Long help string for this endpoint.
cli_visible_aliases: Option<VecStringWrapper>§cli_long_flag_aliases: Option<VecStringWrapper>§cli_aliases: Option<VecStringWrapper>§cli_short_flag_aliases: Option<VecStringWrapper>§cli_no_output: boolThis 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 = "...",
),
cli_output_formats: Option<VecStringWrapper>§cli_force_output_format: boolForce 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.
config: Vec<ApiInputConfig>Trait Implementations§
source§impl<'de> Deserialize<'de> for Endpoint
impl<'de> Deserialize<'de> for Endpoint
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl FromMeta for Endpoint
impl FromMeta for Endpoint
source§fn from_list(__items: &[NestedMeta]) -> Result<Self>
fn from_list(__items: &[NestedMeta]) -> Result<Self>
fn from_nested_meta(item: &NestedMeta) -> Result<Self, Error>
§fn from_meta(item: &Meta) -> Result<Self, Error>
fn from_meta(item: &Meta) -> Result<Self, Error>
syn::Meta by dispatching to the format-appropriate
trait function. This generally should not be overridden by implementers. Read more§fn from_none() -> Option<Self>
fn from_none() -> Option<Self>
from_none is used to attempt
recovery before a missing field error is generated. Read more§fn from_word() -> Result<Self, Error>
fn from_word() -> Result<Self, Error>
§fn from_value(value: &Lit) -> Result<Self, Error>
fn from_value(value: &Lit) -> Result<Self, Error>
foo = "bar" or foo("bar").
This dispatches to the appropriate method based on the type of literal encountered,
and generally should not be overridden by implementers. Read more