1use crate::api::*;
3use actix_web::http;
4use serde::{Deserialize, Serialize};
5
6pub struct UpdateConfigEP {}
12impl EndpointDetails for UpdateConfigEP {
13 type RequestType = Signed<UpdateConfigReq>;
14 type ResponseType = Result<UpdateConfigResp>;
15
16 const METHOD: http::Method = http::Method::POST;
17 const PATH: &'static str = ".ph/admin/update-config";
18}
19
20#[derive(Serialize, Deserialize, Debug, Clone)]
21#[serde(deny_unknown_fields)]
22pub struct UpdateConfigReq {
23 pub pointer: String,
27
28 pub new_value: serde_json::Value,
29}
30
31#[derive(Serialize, Deserialize, Debug, Clone)]
33#[serde(deny_unknown_fields)]
34#[must_use]
35pub enum UpdateConfigResp {
36 ResignRequest,
38
39 InvalidAdminKey,
41
42 Success,
44}
45
46having_message_code!(UpdateConfigReq, AdminUpdateConfigReq);
47
48pub struct InfoEP {}
54impl EndpointDetails for InfoEP {
55 type RequestType = Signed<InfoReq>;
56 type ResponseType = Result<InfoResp>;
57
58 const METHOD: http::Method = http::Method::POST;
59 const PATH: &'static str = ".ph/admin/info";
60}
61
62#[derive(Serialize, Deserialize, Debug, Clone)]
64#[serde(deny_unknown_fields)]
65pub struct InfoReq {}
66
67having_message_code!(InfoReq, AdminInfoReq);
68
69#[derive(Serialize, Deserialize, Debug, Clone)]
71#[serde(deny_unknown_fields)]
72#[must_use]
73pub enum InfoResp {
74 ResignRequest,
76
77 InvalidAdminKey,
79
80 Success {
82 config: Box<crate::servers::Config>,
84 },
85}