pub struct Route {Show 14 fields
pub id: &'static str,
pub service: &'static str,
pub method: Method,
pub path: &'static str,
pub pattern: &'static str,
pub resource: &'static str,
pub resource_type: &'static str,
pub params: &'static [RouteParam],
pub idempotent: bool,
pub readonly: bool,
pub html: bool,
pub empty_on: &'static [u16],
pub pagination: Pagination,
pub retry: Retry,
}Expand description
One API operation: its method, its path template and the behaviour the Smithy model
attaches to it. Every route the SDK knows lives in crate::routes.
Fields§
§id: &'static strThe operation as the model names it: ListBoxes, GetTopic.
service: &'static strThe service handle whose method sends this route, as every HEY SDK names it:
Boxes, TimeTracks.
method: MethodThe HTTP method the route is sent with.
path: &'static strThe path as HEY serves it, {param} placeholders included.
pattern: &'static strThe path without a .json suffix, for recognizing pasted URLs.
resource: &'static strThe part of HEY the route belongs to, as the model titles it: Boxes,
Calendar Time Tracks.
resource_type: &'static strThe kind of record the route acts on, in snake_case: box, box_group.
params: &'static [RouteParam]The path parameters, in the order they appear in Route::path.
idempotent: boolThe route may be sent again after a failure without doing its work twice.
readonly: boolThe route only reads; nothing it does changes anything.
html: boolThe route answers a page as HTML rather than a JSON document, so it is asked for as
written — no .json suffix — with Accept: text/html.
empty_on: &'static [u16]The statuses that mean HEY has nothing for this route rather than that it failed — a 404 for a record that may simply not be there. Such an answer is empty, not an error.
pagination: PaginationHow the route pages, when it does.
retry: RetryThe retry policy the model attaches to the route.
Implementations§
Source§impl Route
impl Route
Sourcepub fn fill(&self, values: &[&dyn Display]) -> String
pub fn fill(&self, values: &[&dyn Display]) -> String
Substitutes the path parameters, in order, percent-encoding each value.
§Panics
When values is not exactly as long as Route::params. A short list would leave
a {param} in the path and send it to HEY as written, which is worse than stopping;
every generated caller passes the right count, so reaching this means the call was
built by hand and built wrong.