Skip to main content

azisaba_graph/apis/
punishments_api.rs

1/*
2 * Azisaba Graph API
3 *
4 * An API for connecting and sharing data across the Azisaba Network.
5 *
6 * The version of the OpenAPI document: 0.0.1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17/// struct for passing parameters to the method [`create_punishment`]
18#[derive(Clone, Debug)]
19pub struct CreatePunishmentParams {
20    pub create_punishment_request: models::CreatePunishmentRequest
21}
22
23/// struct for passing parameters to the method [`create_punishment_proof`]
24#[derive(Clone, Debug)]
25pub struct CreatePunishmentProofParams {
26    /// The unique identifier of the punishment.
27    pub punishment_id: u64,
28    pub create_punishment_proof_request: models::CreatePunishmentProofRequest
29}
30
31/// struct for passing parameters to the method [`delete_punishment_by_id`]
32#[derive(Clone, Debug)]
33pub struct DeletePunishmentByIdParams {
34    /// The unique identifier of the punishment.
35    pub punishment_id: u64,
36    pub delete_punishment_by_id_request: models::DeletePunishmentByIdRequest
37}
38
39/// struct for passing parameters to the method [`delete_punishment_proof_by_id`]
40#[derive(Clone, Debug)]
41pub struct DeletePunishmentProofByIdParams {
42    /// The unique identifier of the punishment.
43    pub punishment_id: u64,
44    /// The unique identifier of the proof.
45    pub proof_id: u64
46}
47
48/// struct for passing parameters to the method [`get_punishment_by_id`]
49#[derive(Clone, Debug)]
50pub struct GetPunishmentByIdParams {
51    /// The unique identifier of the punishment.
52    pub punishment_id: u64
53}
54
55/// struct for passing parameters to the method [`get_punishment_proof_by_id`]
56#[derive(Clone, Debug)]
57pub struct GetPunishmentProofByIdParams {
58    /// The unique identifier of the punishment.
59    pub punishment_id: u64,
60    /// The unique identifier of the proof.
61    pub proof_id: u64
62}
63
64/// struct for passing parameters to the method [`list_punishment_proofs`]
65#[derive(Clone, Debug)]
66pub struct ListPunishmentProofsParams {
67    /// The unique identifier of the punishment.
68    pub punishment_id: u64
69}
70
71/// struct for passing parameters to the method [`list_punishments`]
72#[derive(Clone, Debug)]
73pub struct ListPunishmentsParams {
74    /// The maximum number of punishments to return.
75    pub limit: Option<u8>,
76    /// The cursor returned by the previous request.
77    pub cursor: Option<String>,
78    /// The target identifier used to filter punishments.
79    pub target: Option<String>,
80    /// The punishment type used to filter punishments.
81    pub r#type: Option<String>,
82    /// The server used to filter punishments.
83    pub server: Option<String>,
84    /// The active status used to filter punishments.
85    pub active: Option<bool>
86}
87
88/// struct for passing parameters to the method [`update_punishment_by_id`]
89#[derive(Clone, Debug)]
90pub struct UpdatePunishmentByIdParams {
91    /// The unique identifier of the punishment.
92    pub punishment_id: u64,
93    pub update_punishment_by_id_request: models::UpdatePunishmentByIdRequest
94}
95
96/// struct for passing parameters to the method [`update_punishment_proof_by_id`]
97#[derive(Clone, Debug)]
98pub struct UpdatePunishmentProofByIdParams {
99    /// The unique identifier of the punishment.
100    pub punishment_id: u64,
101    /// The unique identifier of the proof.
102    pub proof_id: u64,
103    pub update_punishment_proof_by_id_request: models::UpdatePunishmentProofByIdRequest
104}
105
106
107/// struct for typed errors of method [`create_punishment`]
108#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum CreatePunishmentError {
111    Status400(),
112    Status401(),
113    Status403(),
114    Status409(),
115    UnknownValue(serde_json::Value),
116}
117
118/// struct for typed errors of method [`create_punishment_proof`]
119#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum CreatePunishmentProofError {
122    Status400(),
123    Status401(),
124    Status403(),
125    Status404(),
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`delete_punishment_by_id`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum DeletePunishmentByIdError {
133    Status400(),
134    Status401(),
135    Status403(),
136    Status404(),
137    UnknownValue(serde_json::Value),
138}
139
140/// struct for typed errors of method [`delete_punishment_proof_by_id`]
141#[derive(Debug, Clone, Serialize, Deserialize)]
142#[serde(untagged)]
143pub enum DeletePunishmentProofByIdError {
144    Status401(),
145    Status403(),
146    Status404(),
147    UnknownValue(serde_json::Value),
148}
149
150/// struct for typed errors of method [`get_punishment_by_id`]
151#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum GetPunishmentByIdError {
154    Status401(),
155    Status403(),
156    Status404(),
157    UnknownValue(serde_json::Value),
158}
159
160/// struct for typed errors of method [`get_punishment_proof_by_id`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum GetPunishmentProofByIdError {
164    Status401(),
165    Status403(),
166    Status404(),
167    UnknownValue(serde_json::Value),
168}
169
170/// struct for typed errors of method [`list_punishment_proofs`]
171#[derive(Debug, Clone, Serialize, Deserialize)]
172#[serde(untagged)]
173pub enum ListPunishmentProofsError {
174    Status401(),
175    Status403(),
176    Status404(),
177    UnknownValue(serde_json::Value),
178}
179
180/// struct for typed errors of method [`list_punishments`]
181#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum ListPunishmentsError {
184    Status400(),
185    Status401(),
186    Status403(),
187    UnknownValue(serde_json::Value),
188}
189
190/// struct for typed errors of method [`update_punishment_by_id`]
191#[derive(Debug, Clone, Serialize, Deserialize)]
192#[serde(untagged)]
193pub enum UpdatePunishmentByIdError {
194    Status400(),
195    Status401(),
196    Status403(),
197    Status404(),
198    UnknownValue(serde_json::Value),
199}
200
201/// struct for typed errors of method [`update_punishment_proof_by_id`]
202#[derive(Debug, Clone, Serialize, Deserialize)]
203#[serde(untagged)]
204pub enum UpdatePunishmentProofByIdError {
205    Status400(),
206    Status401(),
207    Status403(),
208    Status404(),
209    UnknownValue(serde_json::Value),
210}
211
212
213/// Creates a new punishment.
214pub async fn create_punishment(configuration: &configuration::Configuration, params: CreatePunishmentParams) -> Result<models::Punishment, Error<CreatePunishmentError>> {
215
216    let uri_str = format!("{}/punishments", configuration.base_path);
217    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
218
219    if let Some(ref user_agent) = configuration.user_agent {
220        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
221    }
222    if let Some(ref token) = configuration.bearer_access_token {
223        req_builder = req_builder.bearer_auth(token.to_owned());
224    };
225    req_builder = req_builder.json(&params.create_punishment_request);
226
227    let req = req_builder.build()?;
228    let resp = configuration.client.execute(req).await?;
229
230    let status = resp.status();
231    let content_type = resp
232        .headers()
233        .get("content-type")
234        .and_then(|v| v.to_str().ok())
235        .unwrap_or("application/octet-stream");
236    let content_type = super::ContentType::from(content_type);
237
238    if !status.is_client_error() && !status.is_server_error() {
239        let content = resp.text().await?;
240        match content_type {
241            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
242            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Punishment`"))),
243            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Punishment`")))),
244        }
245    } else {
246        let content = resp.text().await?;
247        let entity: Option<CreatePunishmentError> = serde_json::from_str(&content).ok();
248        Err(Error::ResponseError(ResponseContent { status, content, entity }))
249    }
250}
251
252/// Creates a proof for the specified active punishment.
253pub async fn create_punishment_proof(configuration: &configuration::Configuration, params: CreatePunishmentProofParams) -> Result<models::Proof, Error<CreatePunishmentProofError>> {
254
255    let uri_str = format!("{}/punishments/{punishmentId}/proofs", configuration.base_path, punishmentId=params.punishment_id);
256    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
257
258    if let Some(ref user_agent) = configuration.user_agent {
259        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
260    }
261    if let Some(ref token) = configuration.bearer_access_token {
262        req_builder = req_builder.bearer_auth(token.to_owned());
263    };
264    req_builder = req_builder.json(&params.create_punishment_proof_request);
265
266    let req = req_builder.build()?;
267    let resp = configuration.client.execute(req).await?;
268
269    let status = resp.status();
270    let content_type = resp
271        .headers()
272        .get("content-type")
273        .and_then(|v| v.to_str().ok())
274        .unwrap_or("application/octet-stream");
275    let content_type = super::ContentType::from(content_type);
276
277    if !status.is_client_error() && !status.is_server_error() {
278        let content = resp.text().await?;
279        match content_type {
280            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
281            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Proof`"))),
282            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Proof`")))),
283        }
284    } else {
285        let content = resp.text().await?;
286        let entity: Option<CreatePunishmentProofError> = serde_json::from_str(&content).ok();
287        Err(Error::ResponseError(ResponseContent { status, content, entity }))
288    }
289}
290
291/// Revokes the active punishment with the specified ID.
292pub async fn delete_punishment_by_id(configuration: &configuration::Configuration, params: DeletePunishmentByIdParams) -> Result<(), Error<DeletePunishmentByIdError>> {
293
294    let uri_str = format!("{}/punishments/{punishmentId}", configuration.base_path, punishmentId=params.punishment_id);
295    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
296
297    if let Some(ref user_agent) = configuration.user_agent {
298        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
299    }
300    if let Some(ref token) = configuration.bearer_access_token {
301        req_builder = req_builder.bearer_auth(token.to_owned());
302    };
303    req_builder = req_builder.json(&params.delete_punishment_by_id_request);
304
305    let req = req_builder.build()?;
306    let resp = configuration.client.execute(req).await?;
307
308    let status = resp.status();
309
310    if !status.is_client_error() && !status.is_server_error() {
311        Ok(())
312    } else {
313        let content = resp.text().await?;
314        let entity: Option<DeletePunishmentByIdError> = serde_json::from_str(&content).ok();
315        Err(Error::ResponseError(ResponseContent { status, content, entity }))
316    }
317}
318
319/// Deletes the specified proof from the specified punishment.
320pub async fn delete_punishment_proof_by_id(configuration: &configuration::Configuration, params: DeletePunishmentProofByIdParams) -> Result<(), Error<DeletePunishmentProofByIdError>> {
321
322    let uri_str = format!("{}/punishments/{punishmentId}/proofs/{proofId}", configuration.base_path, punishmentId=params.punishment_id, proofId=params.proof_id);
323    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
324
325    if let Some(ref user_agent) = configuration.user_agent {
326        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
327    }
328    if let Some(ref token) = configuration.bearer_access_token {
329        req_builder = req_builder.bearer_auth(token.to_owned());
330    };
331
332    let req = req_builder.build()?;
333    let resp = configuration.client.execute(req).await?;
334
335    let status = resp.status();
336
337    if !status.is_client_error() && !status.is_server_error() {
338        Ok(())
339    } else {
340        let content = resp.text().await?;
341        let entity: Option<DeletePunishmentProofByIdError> = serde_json::from_str(&content).ok();
342        Err(Error::ResponseError(ResponseContent { status, content, entity }))
343    }
344}
345
346/// Returns the punishment with the specified ID.
347pub async fn get_punishment_by_id(configuration: &configuration::Configuration, params: GetPunishmentByIdParams) -> Result<models::Punishment, Error<GetPunishmentByIdError>> {
348
349    let uri_str = format!("{}/punishments/{punishmentId}", configuration.base_path, punishmentId=params.punishment_id);
350    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
351
352    if let Some(ref user_agent) = configuration.user_agent {
353        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
354    }
355    if let Some(ref token) = configuration.bearer_access_token {
356        req_builder = req_builder.bearer_auth(token.to_owned());
357    };
358
359    let req = req_builder.build()?;
360    let resp = configuration.client.execute(req).await?;
361
362    let status = resp.status();
363    let content_type = resp
364        .headers()
365        .get("content-type")
366        .and_then(|v| v.to_str().ok())
367        .unwrap_or("application/octet-stream");
368    let content_type = super::ContentType::from(content_type);
369
370    if !status.is_client_error() && !status.is_server_error() {
371        let content = resp.text().await?;
372        match content_type {
373            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
374            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Punishment`"))),
375            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Punishment`")))),
376        }
377    } else {
378        let content = resp.text().await?;
379        let entity: Option<GetPunishmentByIdError> = serde_json::from_str(&content).ok();
380        Err(Error::ResponseError(ResponseContent { status, content, entity }))
381    }
382}
383
384/// Returns the specified proof for the specified punishment.
385pub async fn get_punishment_proof_by_id(configuration: &configuration::Configuration, params: GetPunishmentProofByIdParams) -> Result<models::Proof, Error<GetPunishmentProofByIdError>> {
386
387    let uri_str = format!("{}/punishments/{punishmentId}/proofs/{proofId}", configuration.base_path, punishmentId=params.punishment_id, proofId=params.proof_id);
388    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
389
390    if let Some(ref user_agent) = configuration.user_agent {
391        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
392    }
393    if let Some(ref token) = configuration.bearer_access_token {
394        req_builder = req_builder.bearer_auth(token.to_owned());
395    };
396
397    let req = req_builder.build()?;
398    let resp = configuration.client.execute(req).await?;
399
400    let status = resp.status();
401    let content_type = resp
402        .headers()
403        .get("content-type")
404        .and_then(|v| v.to_str().ok())
405        .unwrap_or("application/octet-stream");
406    let content_type = super::ContentType::from(content_type);
407
408    if !status.is_client_error() && !status.is_server_error() {
409        let content = resp.text().await?;
410        match content_type {
411            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
412            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Proof`"))),
413            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Proof`")))),
414        }
415    } else {
416        let content = resp.text().await?;
417        let entity: Option<GetPunishmentProofByIdError> = serde_json::from_str(&content).ok();
418        Err(Error::ResponseError(ResponseContent { status, content, entity }))
419    }
420}
421
422/// Returns proofs attached to the specified punishment.
423pub async fn list_punishment_proofs(configuration: &configuration::Configuration, params: ListPunishmentProofsParams) -> Result<Vec<models::Proof>, Error<ListPunishmentProofsError>> {
424
425    let uri_str = format!("{}/punishments/{punishmentId}/proofs", configuration.base_path, punishmentId=params.punishment_id);
426    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
427
428    if let Some(ref user_agent) = configuration.user_agent {
429        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
430    }
431    if let Some(ref token) = configuration.bearer_access_token {
432        req_builder = req_builder.bearer_auth(token.to_owned());
433    };
434
435    let req = req_builder.build()?;
436    let resp = configuration.client.execute(req).await?;
437
438    let status = resp.status();
439    let content_type = resp
440        .headers()
441        .get("content-type")
442        .and_then(|v| v.to_str().ok())
443        .unwrap_or("application/octet-stream");
444    let content_type = super::ContentType::from(content_type);
445
446    if !status.is_client_error() && !status.is_server_error() {
447        let content = resp.text().await?;
448        match content_type {
449            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
450            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Proof&gt;`"))),
451            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Proof&gt;`")))),
452        }
453    } else {
454        let content = resp.text().await?;
455        let entity: Option<ListPunishmentProofsError> = serde_json::from_str(&content).ok();
456        Err(Error::ResponseError(ResponseContent { status, content, entity }))
457    }
458}
459
460/// Returns a list of punishments.
461pub async fn list_punishments(configuration: &configuration::Configuration, params: ListPunishmentsParams) -> Result<models::ListPunishments200Response, Error<ListPunishmentsError>> {
462
463    let uri_str = format!("{}/punishments", configuration.base_path);
464    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
465
466    if let Some(ref param_value) = params.limit {
467        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
468    }
469    if let Some(ref param_value) = params.cursor {
470        req_builder = req_builder.query(&[("cursor", &param_value.to_string())]);
471    }
472    if let Some(ref param_value) = params.target {
473        req_builder = req_builder.query(&[("target", &param_value.to_string())]);
474    }
475    if let Some(ref param_value) = params.r#type {
476        req_builder = req_builder.query(&[("type", &param_value.to_string())]);
477    }
478    if let Some(ref param_value) = params.server {
479        req_builder = req_builder.query(&[("server", &param_value.to_string())]);
480    }
481    if let Some(ref param_value) = params.active {
482        req_builder = req_builder.query(&[("active", &param_value.to_string())]);
483    }
484    if let Some(ref user_agent) = configuration.user_agent {
485        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
486    }
487    if let Some(ref token) = configuration.bearer_access_token {
488        req_builder = req_builder.bearer_auth(token.to_owned());
489    };
490
491    let req = req_builder.build()?;
492    let resp = configuration.client.execute(req).await?;
493
494    let status = resp.status();
495    let content_type = resp
496        .headers()
497        .get("content-type")
498        .and_then(|v| v.to_str().ok())
499        .unwrap_or("application/octet-stream");
500    let content_type = super::ContentType::from(content_type);
501
502    if !status.is_client_error() && !status.is_server_error() {
503        let content = resp.text().await?;
504        match content_type {
505            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
506            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListPunishments200Response`"))),
507            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListPunishments200Response`")))),
508        }
509    } else {
510        let content = resp.text().await?;
511        let entity: Option<ListPunishmentsError> = serde_json::from_str(&content).ok();
512        Err(Error::ResponseError(ResponseContent { status, content, entity }))
513    }
514}
515
516/// Updates the active punishment with the specified ID.
517pub async fn update_punishment_by_id(configuration: &configuration::Configuration, params: UpdatePunishmentByIdParams) -> Result<models::Punishment, Error<UpdatePunishmentByIdError>> {
518
519    let uri_str = format!("{}/punishments/{punishmentId}", configuration.base_path, punishmentId=params.punishment_id);
520    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
521
522    if let Some(ref user_agent) = configuration.user_agent {
523        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
524    }
525    if let Some(ref token) = configuration.bearer_access_token {
526        req_builder = req_builder.bearer_auth(token.to_owned());
527    };
528    req_builder = req_builder.json(&params.update_punishment_by_id_request);
529
530    let req = req_builder.build()?;
531    let resp = configuration.client.execute(req).await?;
532
533    let status = resp.status();
534    let content_type = resp
535        .headers()
536        .get("content-type")
537        .and_then(|v| v.to_str().ok())
538        .unwrap_or("application/octet-stream");
539    let content_type = super::ContentType::from(content_type);
540
541    if !status.is_client_error() && !status.is_server_error() {
542        let content = resp.text().await?;
543        match content_type {
544            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
545            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Punishment`"))),
546            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Punishment`")))),
547        }
548    } else {
549        let content = resp.text().await?;
550        let entity: Option<UpdatePunishmentByIdError> = serde_json::from_str(&content).ok();
551        Err(Error::ResponseError(ResponseContent { status, content, entity }))
552    }
553}
554
555/// Updates the specified proof for the specified punishment.
556pub async fn update_punishment_proof_by_id(configuration: &configuration::Configuration, params: UpdatePunishmentProofByIdParams) -> Result<models::Proof, Error<UpdatePunishmentProofByIdError>> {
557
558    let uri_str = format!("{}/punishments/{punishmentId}/proofs/{proofId}", configuration.base_path, punishmentId=params.punishment_id, proofId=params.proof_id);
559    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
560
561    if let Some(ref user_agent) = configuration.user_agent {
562        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
563    }
564    if let Some(ref token) = configuration.bearer_access_token {
565        req_builder = req_builder.bearer_auth(token.to_owned());
566    };
567    req_builder = req_builder.json(&params.update_punishment_proof_by_id_request);
568
569    let req = req_builder.build()?;
570    let resp = configuration.client.execute(req).await?;
571
572    let status = resp.status();
573    let content_type = resp
574        .headers()
575        .get("content-type")
576        .and_then(|v| v.to_str().ok())
577        .unwrap_or("application/octet-stream");
578    let content_type = super::ContentType::from(content_type);
579
580    if !status.is_client_error() && !status.is_server_error() {
581        let content = resp.text().await?;
582        match content_type {
583            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
584            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Proof`"))),
585            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Proof`")))),
586        }
587    } else {
588        let content = resp.text().await?;
589        let entity: Option<UpdatePunishmentProofByIdError> = serde_json::from_str(&content).ok();
590        Err(Error::ResponseError(ResponseContent { status, content, entity }))
591    }
592}
593