melvin_ob/http_handler/http_request/
modify_objective_put.rs

1use super::modify_objective;
2use super::request_common::{HTTPRequestMethod, HTTPRequestType, JSONBodyHTTPRequestType};
3use crate::http_handler::common::{BeaconObjective, ImageObjective};
4
5/// Request type for the /objective endpoint -> PUT.
6#[derive(serde::Serialize, Debug)]
7#[cfg(debug_assertions)]
8pub(crate) struct ModifyObjectiveRequest {
9    /// `Vec` of changed/newly created `ImageObjective` objects.
10    pub(crate) zoned_objectives: Vec<ImageObjective>,
11    /// `Vec` of changed/newly created `BeaconObjective` objects.
12    pub(crate) beacon_objectives: Vec<BeaconObjective>,
13}
14
15impl JSONBodyHTTPRequestType for ModifyObjectiveRequest {
16    /// The type that is serializable into a json body.
17    type Body = Self;
18    /// Returns the body object to be serialized.
19    fn body(&self) -> &Self::Body { self }
20}
21
22impl HTTPRequestType for ModifyObjectiveRequest {
23    /// Type of the expected response.
24    type Response = modify_objective::ModifyObjectiveResponse;
25    /// `str` object representing the specific endpoint.
26    fn endpoint(&self) -> &'static str { "/objective" }
27    /// The corresponding HTTP Request Method.
28    fn request_method(&self) -> HTTPRequestMethod { HTTPRequestMethod::Put }
29}