Skip to main content

lta/get_traffic_incidents/
parts.rs

1// @generated by satay. Do not edit by hand.
2#![allow(
3    clippy::doc_markdown,
4    clippy::missing_errors_doc,
5    clippy::must_use_candidate,
6    clippy::needless_pass_by_value,
7    clippy::return_self_not_must_use,
8    clippy::single_match_else
9)]
10
11use super::super::types::TrafficIncident;
12/// Returns incidents currently happening on the roads, such as Accidents, Vehicle Breakdowns, Road Blocks, Traffic Diversions etc.
13/// **Update freq**: 2 min
14#[derive(Debug, Clone, PartialEq)]
15pub struct GetTrafficIncidentsInput {
16    /// Number of records to skip for pagination.
17    pub skip: Option<u32>,
18}
19impl GetTrafficIncidentsInput {
20    pub fn new() -> Self {
21        Self { skip: None }
22    }
23    pub fn skip(mut self, skip: u32) -> Self {
24        self.skip = Some(skip);
25        self
26    }
27}
28impl Default for GetTrafficIncidentsInput {
29    fn default() -> Self {
30        Self::new()
31    }
32}
33/// Returns incidents currently happening on the roads, such as Accidents, Vehicle Breakdowns, Road Blocks, Traffic Diversions etc.
34/// **Update freq**: 2 min
35#[derive(Debug, Clone, PartialEq)]
36pub enum GetTrafficIncidentsResponse {
37    /// Successful Traffic Incidents response.
38    Ok(Vec<TrafficIncident>),
39    UnexpectedStatus(http::StatusCode, Vec<u8>),
40}
41/// Returns incidents currently happening on the roads, such as Accidents, Vehicle Breakdowns, Road Blocks, Traffic Diversions etc.
42/// **Update freq**: 2 min
43pub fn get_traffic_incidents_parts(
44    input: GetTrafficIncidentsInput,
45) -> Result<satay_runtime::RequestParts<()>, satay_runtime::Error> {
46    let mut uri = String::with_capacity(17);
47    uri.push_str("/TrafficIncidents");
48    let mut first_query = true;
49    if let Some(value) = &input.skip {
50        satay_runtime::append_query_pair(&mut uri, &mut first_query, "$skip", &value.to_string());
51    }
52    let headers = http::HeaderMap::new();
53    Ok(satay_runtime::RequestParts {
54        method: http::Method::GET,
55        uri,
56        headers,
57        body: (),
58    })
59}