Skip to main content

lta/get_bus_stops/
json.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::BusStop;
12use super::parts::{GetBusStopsInput, GetBusStopsResponse, get_bus_stops_parts};
13/// Returns detailed information for all bus stops currently being serviced by buses, including bus stop codes and location coordinates.
14///
15/// **Update freq**: Ad-Hoc
16pub fn encode_get_bus_stops(
17    input: GetBusStopsInput,
18) -> Result<http::Request<Vec<u8>>, satay_runtime::Error> {
19    let parts = get_bus_stops_parts(input)?;
20    satay_runtime::into_empty_request(parts)
21}
22pub fn decode_get_bus_stops_response<B: AsRef<[u8]>>(
23    response: satay_runtime::ResponseParts<B>,
24) -> Result<GetBusStopsResponse, satay_runtime::Error> {
25    let status = response.status;
26    match status.as_u16() {
27        200 => {
28            let body = response.body;
29            let value = satay_runtime::from_projected_json_slice::<Vec<BusStop>>(
30                body.as_ref(),
31                "value",
32                None,
33            )?;
34            Ok(GetBusStopsResponse::Ok(value))
35        }
36        _ => {
37            let body = response.body;
38            Ok(GetBusStopsResponse::UnexpectedStatus(
39                status,
40                body.as_ref().to_vec(),
41            ))
42        }
43    }
44}