Skip to main content

clientapi_pbs/apis/
config_notifications_api.rs

1/*
2 * Proxmox Backup Server API
3 *
4 * Generated from apidoc.js. NOT an official Proxmox specification. See https://pbs.proxmox.com/docs/api-viewer/ for the upstream documentation.
5 *
6 * The version of the OpenAPI document: 9.x
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
18/// struct for typed errors of method [`config_notifications_create_gotify`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ConfigNotificationsCreateGotifyError {
22    Status400(models::PbsError),
23    Status401(models::PbsError),
24    Status403(models::PbsError),
25    Status404(models::PbsError),
26    Status500(models::PbsError),
27    Status501(models::PbsError),
28    Status503(models::PbsError),
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`config_notifications_create_matchers`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ConfigNotificationsCreateMatchersError {
36    Status400(models::PbsError),
37    Status401(models::PbsError),
38    Status403(models::PbsError),
39    Status404(models::PbsError),
40    Status500(models::PbsError),
41    Status501(models::PbsError),
42    Status503(models::PbsError),
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`config_notifications_create_sendmail`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ConfigNotificationsCreateSendmailError {
50    Status400(models::PbsError),
51    Status401(models::PbsError),
52    Status403(models::PbsError),
53    Status404(models::PbsError),
54    Status500(models::PbsError),
55    Status501(models::PbsError),
56    Status503(models::PbsError),
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`config_notifications_create_smtp`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ConfigNotificationsCreateSmtpError {
64    Status400(models::PbsError),
65    Status401(models::PbsError),
66    Status403(models::PbsError),
67    Status404(models::PbsError),
68    Status500(models::PbsError),
69    Status501(models::PbsError),
70    Status503(models::PbsError),
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`config_notifications_create_test`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ConfigNotificationsCreateTestError {
78    Status400(models::PbsError),
79    Status401(models::PbsError),
80    Status403(models::PbsError),
81    Status404(models::PbsError),
82    Status500(models::PbsError),
83    Status501(models::PbsError),
84    Status503(models::PbsError),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`config_notifications_create_webhook`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum ConfigNotificationsCreateWebhookError {
92    Status400(models::PbsError),
93    Status401(models::PbsError),
94    Status403(models::PbsError),
95    Status404(models::PbsError),
96    Status500(models::PbsError),
97    Status501(models::PbsError),
98    Status503(models::PbsError),
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`config_notifications_delete_gotify`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum ConfigNotificationsDeleteGotifyError {
106    Status400(models::PbsError),
107    Status401(models::PbsError),
108    Status403(models::PbsError),
109    Status404(models::PbsError),
110    Status500(models::PbsError),
111    Status501(models::PbsError),
112    Status503(models::PbsError),
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`config_notifications_delete_matchers`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum ConfigNotificationsDeleteMatchersError {
120    Status400(models::PbsError),
121    Status401(models::PbsError),
122    Status403(models::PbsError),
123    Status404(models::PbsError),
124    Status500(models::PbsError),
125    Status501(models::PbsError),
126    Status503(models::PbsError),
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`config_notifications_delete_sendmail`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum ConfigNotificationsDeleteSendmailError {
134    Status400(models::PbsError),
135    Status401(models::PbsError),
136    Status403(models::PbsError),
137    Status404(models::PbsError),
138    Status500(models::PbsError),
139    Status501(models::PbsError),
140    Status503(models::PbsError),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`config_notifications_delete_smtp`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum ConfigNotificationsDeleteSmtpError {
148    Status400(models::PbsError),
149    Status401(models::PbsError),
150    Status403(models::PbsError),
151    Status404(models::PbsError),
152    Status500(models::PbsError),
153    Status501(models::PbsError),
154    Status503(models::PbsError),
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`config_notifications_delete_webhook`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum ConfigNotificationsDeleteWebhookError {
162    Status400(models::PbsError),
163    Status401(models::PbsError),
164    Status403(models::PbsError),
165    Status404(models::PbsError),
166    Status500(models::PbsError),
167    Status501(models::PbsError),
168    Status503(models::PbsError),
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`config_notifications_get_config_notifications_endpoints_gotify_by_name`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum ConfigNotificationsGetConfigNotificationsEndpointsGotifyByNameError {
176    Status400(models::PbsError),
177    Status401(models::PbsError),
178    Status403(models::PbsError),
179    Status404(models::PbsError),
180    Status500(models::PbsError),
181    Status501(models::PbsError),
182    Status503(models::PbsError),
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`config_notifications_get_config_notifications_endpoints_sendmail_by_name`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum ConfigNotificationsGetConfigNotificationsEndpointsSendmailByNameError {
190    Status400(models::PbsError),
191    Status401(models::PbsError),
192    Status403(models::PbsError),
193    Status404(models::PbsError),
194    Status500(models::PbsError),
195    Status501(models::PbsError),
196    Status503(models::PbsError),
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`config_notifications_get_config_notifications_endpoints_smtp_by_name`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum ConfigNotificationsGetConfigNotificationsEndpointsSmtpByNameError {
204    Status400(models::PbsError),
205    Status401(models::PbsError),
206    Status403(models::PbsError),
207    Status404(models::PbsError),
208    Status500(models::PbsError),
209    Status501(models::PbsError),
210    Status503(models::PbsError),
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`config_notifications_get_config_notifications_endpoints_webhook_by_name`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum ConfigNotificationsGetConfigNotificationsEndpointsWebhookByNameError {
218    Status400(models::PbsError),
219    Status401(models::PbsError),
220    Status403(models::PbsError),
221    Status404(models::PbsError),
222    Status500(models::PbsError),
223    Status501(models::PbsError),
224    Status503(models::PbsError),
225    UnknownValue(serde_json::Value),
226}
227
228/// struct for typed errors of method [`config_notifications_get_config_notifications_matchers_by_name`]
229#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum ConfigNotificationsGetConfigNotificationsMatchersByNameError {
232    Status400(models::PbsError),
233    Status401(models::PbsError),
234    Status403(models::PbsError),
235    Status404(models::PbsError),
236    Status500(models::PbsError),
237    Status501(models::PbsError),
238    Status503(models::PbsError),
239    UnknownValue(serde_json::Value),
240}
241
242/// struct for typed errors of method [`config_notifications_get_config_notifications_targets_by_name`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum ConfigNotificationsGetConfigNotificationsTargetsByNameError {
246    Status400(models::PbsError),
247    Status401(models::PbsError),
248    Status403(models::PbsError),
249    Status404(models::PbsError),
250    Status500(models::PbsError),
251    Status501(models::PbsError),
252    Status503(models::PbsError),
253    UnknownValue(serde_json::Value),
254}
255
256/// struct for typed errors of method [`config_notifications_get_endpoints`]
257#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum ConfigNotificationsGetEndpointsError {
260    Status400(models::PbsError),
261    Status401(models::PbsError),
262    Status403(models::PbsError),
263    Status404(models::PbsError),
264    Status500(models::PbsError),
265    Status501(models::PbsError),
266    Status503(models::PbsError),
267    UnknownValue(serde_json::Value),
268}
269
270/// struct for typed errors of method [`config_notifications_get_gotify`]
271#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum ConfigNotificationsGetGotifyError {
274    Status400(models::PbsError),
275    Status401(models::PbsError),
276    Status403(models::PbsError),
277    Status404(models::PbsError),
278    Status500(models::PbsError),
279    Status501(models::PbsError),
280    Status503(models::PbsError),
281    UnknownValue(serde_json::Value),
282}
283
284/// struct for typed errors of method [`config_notifications_get_matcher_field_values`]
285#[derive(Debug, Clone, Serialize, Deserialize)]
286#[serde(untagged)]
287pub enum ConfigNotificationsGetMatcherFieldValuesError {
288    Status400(models::PbsError),
289    Status401(models::PbsError),
290    Status403(models::PbsError),
291    Status404(models::PbsError),
292    Status500(models::PbsError),
293    Status501(models::PbsError),
294    Status503(models::PbsError),
295    UnknownValue(serde_json::Value),
296}
297
298/// struct for typed errors of method [`config_notifications_get_matcher_fields`]
299#[derive(Debug, Clone, Serialize, Deserialize)]
300#[serde(untagged)]
301pub enum ConfigNotificationsGetMatcherFieldsError {
302    Status400(models::PbsError),
303    Status401(models::PbsError),
304    Status403(models::PbsError),
305    Status404(models::PbsError),
306    Status500(models::PbsError),
307    Status501(models::PbsError),
308    Status503(models::PbsError),
309    UnknownValue(serde_json::Value),
310}
311
312/// struct for typed errors of method [`config_notifications_get_matchers`]
313#[derive(Debug, Clone, Serialize, Deserialize)]
314#[serde(untagged)]
315pub enum ConfigNotificationsGetMatchersError {
316    Status400(models::PbsError),
317    Status401(models::PbsError),
318    Status403(models::PbsError),
319    Status404(models::PbsError),
320    Status500(models::PbsError),
321    Status501(models::PbsError),
322    Status503(models::PbsError),
323    UnknownValue(serde_json::Value),
324}
325
326/// struct for typed errors of method [`config_notifications_get_notifications`]
327#[derive(Debug, Clone, Serialize, Deserialize)]
328#[serde(untagged)]
329pub enum ConfigNotificationsGetNotificationsError {
330    Status400(models::PbsError),
331    Status401(models::PbsError),
332    Status403(models::PbsError),
333    Status404(models::PbsError),
334    Status500(models::PbsError),
335    Status501(models::PbsError),
336    Status503(models::PbsError),
337    UnknownValue(serde_json::Value),
338}
339
340/// struct for typed errors of method [`config_notifications_get_sendmail`]
341#[derive(Debug, Clone, Serialize, Deserialize)]
342#[serde(untagged)]
343pub enum ConfigNotificationsGetSendmailError {
344    Status400(models::PbsError),
345    Status401(models::PbsError),
346    Status403(models::PbsError),
347    Status404(models::PbsError),
348    Status500(models::PbsError),
349    Status501(models::PbsError),
350    Status503(models::PbsError),
351    UnknownValue(serde_json::Value),
352}
353
354/// struct for typed errors of method [`config_notifications_get_smtp`]
355#[derive(Debug, Clone, Serialize, Deserialize)]
356#[serde(untagged)]
357pub enum ConfigNotificationsGetSmtpError {
358    Status400(models::PbsError),
359    Status401(models::PbsError),
360    Status403(models::PbsError),
361    Status404(models::PbsError),
362    Status500(models::PbsError),
363    Status501(models::PbsError),
364    Status503(models::PbsError),
365    UnknownValue(serde_json::Value),
366}
367
368/// struct for typed errors of method [`config_notifications_get_targets`]
369#[derive(Debug, Clone, Serialize, Deserialize)]
370#[serde(untagged)]
371pub enum ConfigNotificationsGetTargetsError {
372    Status400(models::PbsError),
373    Status401(models::PbsError),
374    Status403(models::PbsError),
375    Status404(models::PbsError),
376    Status500(models::PbsError),
377    Status501(models::PbsError),
378    Status503(models::PbsError),
379    UnknownValue(serde_json::Value),
380}
381
382/// struct for typed errors of method [`config_notifications_get_webhook`]
383#[derive(Debug, Clone, Serialize, Deserialize)]
384#[serde(untagged)]
385pub enum ConfigNotificationsGetWebhookError {
386    Status400(models::PbsError),
387    Status401(models::PbsError),
388    Status403(models::PbsError),
389    Status404(models::PbsError),
390    Status500(models::PbsError),
391    Status501(models::PbsError),
392    Status503(models::PbsError),
393    UnknownValue(serde_json::Value),
394}
395
396/// struct for typed errors of method [`config_notifications_update_gotify`]
397#[derive(Debug, Clone, Serialize, Deserialize)]
398#[serde(untagged)]
399pub enum ConfigNotificationsUpdateGotifyError {
400    Status400(models::PbsError),
401    Status401(models::PbsError),
402    Status403(models::PbsError),
403    Status404(models::PbsError),
404    Status500(models::PbsError),
405    Status501(models::PbsError),
406    Status503(models::PbsError),
407    UnknownValue(serde_json::Value),
408}
409
410/// struct for typed errors of method [`config_notifications_update_matchers`]
411#[derive(Debug, Clone, Serialize, Deserialize)]
412#[serde(untagged)]
413pub enum ConfigNotificationsUpdateMatchersError {
414    Status400(models::PbsError),
415    Status401(models::PbsError),
416    Status403(models::PbsError),
417    Status404(models::PbsError),
418    Status500(models::PbsError),
419    Status501(models::PbsError),
420    Status503(models::PbsError),
421    UnknownValue(serde_json::Value),
422}
423
424/// struct for typed errors of method [`config_notifications_update_sendmail`]
425#[derive(Debug, Clone, Serialize, Deserialize)]
426#[serde(untagged)]
427pub enum ConfigNotificationsUpdateSendmailError {
428    Status400(models::PbsError),
429    Status401(models::PbsError),
430    Status403(models::PbsError),
431    Status404(models::PbsError),
432    Status500(models::PbsError),
433    Status501(models::PbsError),
434    Status503(models::PbsError),
435    UnknownValue(serde_json::Value),
436}
437
438/// struct for typed errors of method [`config_notifications_update_smtp`]
439#[derive(Debug, Clone, Serialize, Deserialize)]
440#[serde(untagged)]
441pub enum ConfigNotificationsUpdateSmtpError {
442    Status400(models::PbsError),
443    Status401(models::PbsError),
444    Status403(models::PbsError),
445    Status404(models::PbsError),
446    Status500(models::PbsError),
447    Status501(models::PbsError),
448    Status503(models::PbsError),
449    UnknownValue(serde_json::Value),
450}
451
452/// struct for typed errors of method [`config_notifications_update_webhook`]
453#[derive(Debug, Clone, Serialize, Deserialize)]
454#[serde(untagged)]
455pub enum ConfigNotificationsUpdateWebhookError {
456    Status400(models::PbsError),
457    Status401(models::PbsError),
458    Status403(models::PbsError),
459    Status404(models::PbsError),
460    Status500(models::PbsError),
461    Status501(models::PbsError),
462    Status503(models::PbsError),
463    UnknownValue(serde_json::Value),
464}
465
466
467/// Add a new gotify endpoint.
468pub async fn config_notifications_create_gotify(configuration: &configuration::Configuration, config_notifications_create_gotify_request: models::ConfigNotificationsCreateGotifyRequest) -> Result<models::ConfigNotificationsCreateGotifyResponse, Error<ConfigNotificationsCreateGotifyError>> {
469    // add a prefix to parameters to efficiently prevent name collisions
470    let p_body_config_notifications_create_gotify_request = config_notifications_create_gotify_request;
471
472    let uri_str = format!("{}/config/notifications/endpoints/gotify", configuration.base_path);
473    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
474
475    if let Some(ref user_agent) = configuration.user_agent {
476        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
477    }
478    if let Some(ref apikey) = configuration.api_key {
479        let key = apikey.key.clone();
480        let value = match apikey.prefix {
481            Some(ref prefix) => format!("{} {}", prefix, key),
482            None => key,
483        };
484        req_builder = req_builder.header("Authorization", value);
485    };
486    if let Some(ref apikey) = configuration.api_key {
487        let key = apikey.key.clone();
488        let value = match apikey.prefix {
489            Some(ref prefix) => format!("{} {}", prefix, key),
490            None => key,
491        };
492        req_builder = req_builder.header("CSRFPreventionToken", value);
493    };
494    req_builder = req_builder.json(&p_body_config_notifications_create_gotify_request);
495
496    let req = req_builder.build()?;
497    let resp = configuration.client.execute(req).await?;
498
499    let status = resp.status();
500    let content_type = resp
501        .headers()
502        .get("content-type")
503        .and_then(|v| v.to_str().ok())
504        .unwrap_or("application/octet-stream");
505    let content_type = super::ContentType::from(content_type);
506
507    if !status.is_client_error() && !status.is_server_error() {
508        let content = resp.text().await?;
509        match content_type {
510            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
511            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsCreateGotifyResponse`"))),
512            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::ConfigNotificationsCreateGotifyResponse`")))),
513        }
514    } else {
515        let content = resp.text().await?;
516        let entity: Option<ConfigNotificationsCreateGotifyError> = serde_json::from_str(&content).ok();
517        Err(Error::ResponseError(ResponseContent { status, content, entity }))
518    }
519}
520
521/// Add a new notification matcher.
522pub async fn config_notifications_create_matchers(configuration: &configuration::Configuration, config_notifications_create_matchers_request: models::ConfigNotificationsCreateMatchersRequest) -> Result<models::ConfigNotificationsCreateMatchersResponse, Error<ConfigNotificationsCreateMatchersError>> {
523    // add a prefix to parameters to efficiently prevent name collisions
524    let p_body_config_notifications_create_matchers_request = config_notifications_create_matchers_request;
525
526    let uri_str = format!("{}/config/notifications/matchers", configuration.base_path);
527    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
528
529    if let Some(ref user_agent) = configuration.user_agent {
530        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
531    }
532    if let Some(ref apikey) = configuration.api_key {
533        let key = apikey.key.clone();
534        let value = match apikey.prefix {
535            Some(ref prefix) => format!("{} {}", prefix, key),
536            None => key,
537        };
538        req_builder = req_builder.header("Authorization", value);
539    };
540    if let Some(ref apikey) = configuration.api_key {
541        let key = apikey.key.clone();
542        let value = match apikey.prefix {
543            Some(ref prefix) => format!("{} {}", prefix, key),
544            None => key,
545        };
546        req_builder = req_builder.header("CSRFPreventionToken", value);
547    };
548    req_builder = req_builder.json(&p_body_config_notifications_create_matchers_request);
549
550    let req = req_builder.build()?;
551    let resp = configuration.client.execute(req).await?;
552
553    let status = resp.status();
554    let content_type = resp
555        .headers()
556        .get("content-type")
557        .and_then(|v| v.to_str().ok())
558        .unwrap_or("application/octet-stream");
559    let content_type = super::ContentType::from(content_type);
560
561    if !status.is_client_error() && !status.is_server_error() {
562        let content = resp.text().await?;
563        match content_type {
564            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
565            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsCreateMatchersResponse`"))),
566            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::ConfigNotificationsCreateMatchersResponse`")))),
567        }
568    } else {
569        let content = resp.text().await?;
570        let entity: Option<ConfigNotificationsCreateMatchersError> = serde_json::from_str(&content).ok();
571        Err(Error::ResponseError(ResponseContent { status, content, entity }))
572    }
573}
574
575/// Add a new sendmail endpoint.
576pub async fn config_notifications_create_sendmail(configuration: &configuration::Configuration, config_notifications_create_sendmail_request: models::ConfigNotificationsCreateSendmailRequest) -> Result<models::ConfigNotificationsCreateSendmailResponse, Error<ConfigNotificationsCreateSendmailError>> {
577    // add a prefix to parameters to efficiently prevent name collisions
578    let p_body_config_notifications_create_sendmail_request = config_notifications_create_sendmail_request;
579
580    let uri_str = format!("{}/config/notifications/endpoints/sendmail", configuration.base_path);
581    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
582
583    if let Some(ref user_agent) = configuration.user_agent {
584        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
585    }
586    if let Some(ref apikey) = configuration.api_key {
587        let key = apikey.key.clone();
588        let value = match apikey.prefix {
589            Some(ref prefix) => format!("{} {}", prefix, key),
590            None => key,
591        };
592        req_builder = req_builder.header("Authorization", value);
593    };
594    if let Some(ref apikey) = configuration.api_key {
595        let key = apikey.key.clone();
596        let value = match apikey.prefix {
597            Some(ref prefix) => format!("{} {}", prefix, key),
598            None => key,
599        };
600        req_builder = req_builder.header("CSRFPreventionToken", value);
601    };
602    req_builder = req_builder.json(&p_body_config_notifications_create_sendmail_request);
603
604    let req = req_builder.build()?;
605    let resp = configuration.client.execute(req).await?;
606
607    let status = resp.status();
608    let content_type = resp
609        .headers()
610        .get("content-type")
611        .and_then(|v| v.to_str().ok())
612        .unwrap_or("application/octet-stream");
613    let content_type = super::ContentType::from(content_type);
614
615    if !status.is_client_error() && !status.is_server_error() {
616        let content = resp.text().await?;
617        match content_type {
618            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
619            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsCreateSendmailResponse`"))),
620            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::ConfigNotificationsCreateSendmailResponse`")))),
621        }
622    } else {
623        let content = resp.text().await?;
624        let entity: Option<ConfigNotificationsCreateSendmailError> = serde_json::from_str(&content).ok();
625        Err(Error::ResponseError(ResponseContent { status, content, entity }))
626    }
627}
628
629/// Add a new smtp endpoint.
630pub async fn config_notifications_create_smtp(configuration: &configuration::Configuration, config_notifications_create_smtp_request: models::ConfigNotificationsCreateSmtpRequest) -> Result<models::ConfigNotificationsCreateSmtpResponse, Error<ConfigNotificationsCreateSmtpError>> {
631    // add a prefix to parameters to efficiently prevent name collisions
632    let p_body_config_notifications_create_smtp_request = config_notifications_create_smtp_request;
633
634    let uri_str = format!("{}/config/notifications/endpoints/smtp", configuration.base_path);
635    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
636
637    if let Some(ref user_agent) = configuration.user_agent {
638        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
639    }
640    if let Some(ref apikey) = configuration.api_key {
641        let key = apikey.key.clone();
642        let value = match apikey.prefix {
643            Some(ref prefix) => format!("{} {}", prefix, key),
644            None => key,
645        };
646        req_builder = req_builder.header("Authorization", value);
647    };
648    if let Some(ref apikey) = configuration.api_key {
649        let key = apikey.key.clone();
650        let value = match apikey.prefix {
651            Some(ref prefix) => format!("{} {}", prefix, key),
652            None => key,
653        };
654        req_builder = req_builder.header("CSRFPreventionToken", value);
655    };
656    req_builder = req_builder.json(&p_body_config_notifications_create_smtp_request);
657
658    let req = req_builder.build()?;
659    let resp = configuration.client.execute(req).await?;
660
661    let status = resp.status();
662    let content_type = resp
663        .headers()
664        .get("content-type")
665        .and_then(|v| v.to_str().ok())
666        .unwrap_or("application/octet-stream");
667    let content_type = super::ContentType::from(content_type);
668
669    if !status.is_client_error() && !status.is_server_error() {
670        let content = resp.text().await?;
671        match content_type {
672            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
673            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsCreateSmtpResponse`"))),
674            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::ConfigNotificationsCreateSmtpResponse`")))),
675        }
676    } else {
677        let content = resp.text().await?;
678        let entity: Option<ConfigNotificationsCreateSmtpError> = serde_json::from_str(&content).ok();
679        Err(Error::ResponseError(ResponseContent { status, content, entity }))
680    }
681}
682
683/// Test a given notification target.
684pub async fn config_notifications_create_test(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsCreateTestResponse, Error<ConfigNotificationsCreateTestError>> {
685    // add a prefix to parameters to efficiently prevent name collisions
686    let p_path_name = name;
687
688    let uri_str = format!("{}/config/notifications/targets/{name}/test", configuration.base_path, name=crate::apis::urlencode(p_path_name));
689    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
690
691    if let Some(ref user_agent) = configuration.user_agent {
692        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
693    }
694    if let Some(ref apikey) = configuration.api_key {
695        let key = apikey.key.clone();
696        let value = match apikey.prefix {
697            Some(ref prefix) => format!("{} {}", prefix, key),
698            None => key,
699        };
700        req_builder = req_builder.header("Authorization", value);
701    };
702    if let Some(ref apikey) = configuration.api_key {
703        let key = apikey.key.clone();
704        let value = match apikey.prefix {
705            Some(ref prefix) => format!("{} {}", prefix, key),
706            None => key,
707        };
708        req_builder = req_builder.header("CSRFPreventionToken", value);
709    };
710
711    let req = req_builder.build()?;
712    let resp = configuration.client.execute(req).await?;
713
714    let status = resp.status();
715    let content_type = resp
716        .headers()
717        .get("content-type")
718        .and_then(|v| v.to_str().ok())
719        .unwrap_or("application/octet-stream");
720    let content_type = super::ContentType::from(content_type);
721
722    if !status.is_client_error() && !status.is_server_error() {
723        let content = resp.text().await?;
724        match content_type {
725            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
726            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsCreateTestResponse`"))),
727            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::ConfigNotificationsCreateTestResponse`")))),
728        }
729    } else {
730        let content = resp.text().await?;
731        let entity: Option<ConfigNotificationsCreateTestError> = serde_json::from_str(&content).ok();
732        Err(Error::ResponseError(ResponseContent { status, content, entity }))
733    }
734}
735
736/// Add a new webhook endpoint.
737pub async fn config_notifications_create_webhook(configuration: &configuration::Configuration, config_notifications_create_webhook_request: models::ConfigNotificationsCreateWebhookRequest) -> Result<models::ConfigNotificationsCreateWebhookResponse, Error<ConfigNotificationsCreateWebhookError>> {
738    // add a prefix to parameters to efficiently prevent name collisions
739    let p_body_config_notifications_create_webhook_request = config_notifications_create_webhook_request;
740
741    let uri_str = format!("{}/config/notifications/endpoints/webhook", configuration.base_path);
742    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
743
744    if let Some(ref user_agent) = configuration.user_agent {
745        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
746    }
747    if let Some(ref apikey) = configuration.api_key {
748        let key = apikey.key.clone();
749        let value = match apikey.prefix {
750            Some(ref prefix) => format!("{} {}", prefix, key),
751            None => key,
752        };
753        req_builder = req_builder.header("Authorization", value);
754    };
755    if let Some(ref apikey) = configuration.api_key {
756        let key = apikey.key.clone();
757        let value = match apikey.prefix {
758            Some(ref prefix) => format!("{} {}", prefix, key),
759            None => key,
760        };
761        req_builder = req_builder.header("CSRFPreventionToken", value);
762    };
763    req_builder = req_builder.json(&p_body_config_notifications_create_webhook_request);
764
765    let req = req_builder.build()?;
766    let resp = configuration.client.execute(req).await?;
767
768    let status = resp.status();
769    let content_type = resp
770        .headers()
771        .get("content-type")
772        .and_then(|v| v.to_str().ok())
773        .unwrap_or("application/octet-stream");
774    let content_type = super::ContentType::from(content_type);
775
776    if !status.is_client_error() && !status.is_server_error() {
777        let content = resp.text().await?;
778        match content_type {
779            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
780            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsCreateWebhookResponse`"))),
781            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::ConfigNotificationsCreateWebhookResponse`")))),
782        }
783    } else {
784        let content = resp.text().await?;
785        let entity: Option<ConfigNotificationsCreateWebhookError> = serde_json::from_str(&content).ok();
786        Err(Error::ResponseError(ResponseContent { status, content, entity }))
787    }
788}
789
790/// Delete gotify endpoint.
791pub async fn config_notifications_delete_gotify(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsDeleteGotifyResponse, Error<ConfigNotificationsDeleteGotifyError>> {
792    // add a prefix to parameters to efficiently prevent name collisions
793    let p_path_name = name;
794
795    let uri_str = format!("{}/config/notifications/endpoints/gotify/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
796    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
797
798    if let Some(ref user_agent) = configuration.user_agent {
799        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
800    }
801    if let Some(ref apikey) = configuration.api_key {
802        let key = apikey.key.clone();
803        let value = match apikey.prefix {
804            Some(ref prefix) => format!("{} {}", prefix, key),
805            None => key,
806        };
807        req_builder = req_builder.header("Authorization", value);
808    };
809    if let Some(ref apikey) = configuration.api_key {
810        let key = apikey.key.clone();
811        let value = match apikey.prefix {
812            Some(ref prefix) => format!("{} {}", prefix, key),
813            None => key,
814        };
815        req_builder = req_builder.header("CSRFPreventionToken", value);
816    };
817
818    let req = req_builder.build()?;
819    let resp = configuration.client.execute(req).await?;
820
821    let status = resp.status();
822    let content_type = resp
823        .headers()
824        .get("content-type")
825        .and_then(|v| v.to_str().ok())
826        .unwrap_or("application/octet-stream");
827    let content_type = super::ContentType::from(content_type);
828
829    if !status.is_client_error() && !status.is_server_error() {
830        let content = resp.text().await?;
831        match content_type {
832            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
833            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsDeleteGotifyResponse`"))),
834            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::ConfigNotificationsDeleteGotifyResponse`")))),
835        }
836    } else {
837        let content = resp.text().await?;
838        let entity: Option<ConfigNotificationsDeleteGotifyError> = serde_json::from_str(&content).ok();
839        Err(Error::ResponseError(ResponseContent { status, content, entity }))
840    }
841}
842
843/// Delete notification matcher.
844pub async fn config_notifications_delete_matchers(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsDeleteMatchersResponse, Error<ConfigNotificationsDeleteMatchersError>> {
845    // add a prefix to parameters to efficiently prevent name collisions
846    let p_path_name = name;
847
848    let uri_str = format!("{}/config/notifications/matchers/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
849    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
850
851    if let Some(ref user_agent) = configuration.user_agent {
852        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
853    }
854    if let Some(ref apikey) = configuration.api_key {
855        let key = apikey.key.clone();
856        let value = match apikey.prefix {
857            Some(ref prefix) => format!("{} {}", prefix, key),
858            None => key,
859        };
860        req_builder = req_builder.header("Authorization", value);
861    };
862    if let Some(ref apikey) = configuration.api_key {
863        let key = apikey.key.clone();
864        let value = match apikey.prefix {
865            Some(ref prefix) => format!("{} {}", prefix, key),
866            None => key,
867        };
868        req_builder = req_builder.header("CSRFPreventionToken", value);
869    };
870
871    let req = req_builder.build()?;
872    let resp = configuration.client.execute(req).await?;
873
874    let status = resp.status();
875    let content_type = resp
876        .headers()
877        .get("content-type")
878        .and_then(|v| v.to_str().ok())
879        .unwrap_or("application/octet-stream");
880    let content_type = super::ContentType::from(content_type);
881
882    if !status.is_client_error() && !status.is_server_error() {
883        let content = resp.text().await?;
884        match content_type {
885            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
886            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsDeleteMatchersResponse`"))),
887            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::ConfigNotificationsDeleteMatchersResponse`")))),
888        }
889    } else {
890        let content = resp.text().await?;
891        let entity: Option<ConfigNotificationsDeleteMatchersError> = serde_json::from_str(&content).ok();
892        Err(Error::ResponseError(ResponseContent { status, content, entity }))
893    }
894}
895
896/// Delete sendmail endpoint.
897pub async fn config_notifications_delete_sendmail(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsDeleteSendmailResponse, Error<ConfigNotificationsDeleteSendmailError>> {
898    // add a prefix to parameters to efficiently prevent name collisions
899    let p_path_name = name;
900
901    let uri_str = format!("{}/config/notifications/endpoints/sendmail/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
902    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
903
904    if let Some(ref user_agent) = configuration.user_agent {
905        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
906    }
907    if let Some(ref apikey) = configuration.api_key {
908        let key = apikey.key.clone();
909        let value = match apikey.prefix {
910            Some(ref prefix) => format!("{} {}", prefix, key),
911            None => key,
912        };
913        req_builder = req_builder.header("Authorization", value);
914    };
915    if let Some(ref apikey) = configuration.api_key {
916        let key = apikey.key.clone();
917        let value = match apikey.prefix {
918            Some(ref prefix) => format!("{} {}", prefix, key),
919            None => key,
920        };
921        req_builder = req_builder.header("CSRFPreventionToken", value);
922    };
923
924    let req = req_builder.build()?;
925    let resp = configuration.client.execute(req).await?;
926
927    let status = resp.status();
928    let content_type = resp
929        .headers()
930        .get("content-type")
931        .and_then(|v| v.to_str().ok())
932        .unwrap_or("application/octet-stream");
933    let content_type = super::ContentType::from(content_type);
934
935    if !status.is_client_error() && !status.is_server_error() {
936        let content = resp.text().await?;
937        match content_type {
938            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
939            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsDeleteSendmailResponse`"))),
940            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::ConfigNotificationsDeleteSendmailResponse`")))),
941        }
942    } else {
943        let content = resp.text().await?;
944        let entity: Option<ConfigNotificationsDeleteSendmailError> = serde_json::from_str(&content).ok();
945        Err(Error::ResponseError(ResponseContent { status, content, entity }))
946    }
947}
948
949/// Delete smtp endpoint.
950pub async fn config_notifications_delete_smtp(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsDeleteSmtpResponse, Error<ConfigNotificationsDeleteSmtpError>> {
951    // add a prefix to parameters to efficiently prevent name collisions
952    let p_path_name = name;
953
954    let uri_str = format!("{}/config/notifications/endpoints/smtp/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
955    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
956
957    if let Some(ref user_agent) = configuration.user_agent {
958        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
959    }
960    if let Some(ref apikey) = configuration.api_key {
961        let key = apikey.key.clone();
962        let value = match apikey.prefix {
963            Some(ref prefix) => format!("{} {}", prefix, key),
964            None => key,
965        };
966        req_builder = req_builder.header("Authorization", value);
967    };
968    if let Some(ref apikey) = configuration.api_key {
969        let key = apikey.key.clone();
970        let value = match apikey.prefix {
971            Some(ref prefix) => format!("{} {}", prefix, key),
972            None => key,
973        };
974        req_builder = req_builder.header("CSRFPreventionToken", value);
975    };
976
977    let req = req_builder.build()?;
978    let resp = configuration.client.execute(req).await?;
979
980    let status = resp.status();
981    let content_type = resp
982        .headers()
983        .get("content-type")
984        .and_then(|v| v.to_str().ok())
985        .unwrap_or("application/octet-stream");
986    let content_type = super::ContentType::from(content_type);
987
988    if !status.is_client_error() && !status.is_server_error() {
989        let content = resp.text().await?;
990        match content_type {
991            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
992            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsDeleteSmtpResponse`"))),
993            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::ConfigNotificationsDeleteSmtpResponse`")))),
994        }
995    } else {
996        let content = resp.text().await?;
997        let entity: Option<ConfigNotificationsDeleteSmtpError> = serde_json::from_str(&content).ok();
998        Err(Error::ResponseError(ResponseContent { status, content, entity }))
999    }
1000}
1001
1002/// Delete webhook endpoint.
1003pub async fn config_notifications_delete_webhook(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsDeleteWebhookResponse, Error<ConfigNotificationsDeleteWebhookError>> {
1004    // add a prefix to parameters to efficiently prevent name collisions
1005    let p_path_name = name;
1006
1007    let uri_str = format!("{}/config/notifications/endpoints/webhook/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1008    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1009
1010    if let Some(ref user_agent) = configuration.user_agent {
1011        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1012    }
1013    if let Some(ref apikey) = configuration.api_key {
1014        let key = apikey.key.clone();
1015        let value = match apikey.prefix {
1016            Some(ref prefix) => format!("{} {}", prefix, key),
1017            None => key,
1018        };
1019        req_builder = req_builder.header("Authorization", value);
1020    };
1021    if let Some(ref apikey) = configuration.api_key {
1022        let key = apikey.key.clone();
1023        let value = match apikey.prefix {
1024            Some(ref prefix) => format!("{} {}", prefix, key),
1025            None => key,
1026        };
1027        req_builder = req_builder.header("CSRFPreventionToken", value);
1028    };
1029
1030    let req = req_builder.build()?;
1031    let resp = configuration.client.execute(req).await?;
1032
1033    let status = resp.status();
1034    let content_type = resp
1035        .headers()
1036        .get("content-type")
1037        .and_then(|v| v.to_str().ok())
1038        .unwrap_or("application/octet-stream");
1039    let content_type = super::ContentType::from(content_type);
1040
1041    if !status.is_client_error() && !status.is_server_error() {
1042        let content = resp.text().await?;
1043        match content_type {
1044            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1045            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsDeleteWebhookResponse`"))),
1046            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::ConfigNotificationsDeleteWebhookResponse`")))),
1047        }
1048    } else {
1049        let content = resp.text().await?;
1050        let entity: Option<ConfigNotificationsDeleteWebhookError> = serde_json::from_str(&content).ok();
1051        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1052    }
1053}
1054
1055/// Get a gotify endpoint.
1056pub async fn config_notifications_get_config_notifications_endpoints_gotify_by_name(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsGetConfigNotificationsEndpointsGotifyByNameResponse, Error<ConfigNotificationsGetConfigNotificationsEndpointsGotifyByNameError>> {
1057    // add a prefix to parameters to efficiently prevent name collisions
1058    let p_path_name = name;
1059
1060    let uri_str = format!("{}/config/notifications/endpoints/gotify/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1061    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1062
1063    if let Some(ref user_agent) = configuration.user_agent {
1064        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1065    }
1066    if let Some(ref apikey) = configuration.api_key {
1067        let key = apikey.key.clone();
1068        let value = match apikey.prefix {
1069            Some(ref prefix) => format!("{} {}", prefix, key),
1070            None => key,
1071        };
1072        req_builder = req_builder.header("Authorization", value);
1073    };
1074    if let Some(ref apikey) = configuration.api_key {
1075        let key = apikey.key.clone();
1076        let value = match apikey.prefix {
1077            Some(ref prefix) => format!("{} {}", prefix, key),
1078            None => key,
1079        };
1080        req_builder = req_builder.header("CSRFPreventionToken", value);
1081    };
1082
1083    let req = req_builder.build()?;
1084    let resp = configuration.client.execute(req).await?;
1085
1086    let status = resp.status();
1087    let content_type = resp
1088        .headers()
1089        .get("content-type")
1090        .and_then(|v| v.to_str().ok())
1091        .unwrap_or("application/octet-stream");
1092    let content_type = super::ContentType::from(content_type);
1093
1094    if !status.is_client_error() && !status.is_server_error() {
1095        let content = resp.text().await?;
1096        match content_type {
1097            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1098            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetConfigNotificationsEndpointsGotifyByNameResponse`"))),
1099            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::ConfigNotificationsGetConfigNotificationsEndpointsGotifyByNameResponse`")))),
1100        }
1101    } else {
1102        let content = resp.text().await?;
1103        let entity: Option<ConfigNotificationsGetConfigNotificationsEndpointsGotifyByNameError> = serde_json::from_str(&content).ok();
1104        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1105    }
1106}
1107
1108/// Get a sendmail endpoint.
1109pub async fn config_notifications_get_config_notifications_endpoints_sendmail_by_name(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsGetConfigNotificationsEndpointsSendmailByNameResponse, Error<ConfigNotificationsGetConfigNotificationsEndpointsSendmailByNameError>> {
1110    // add a prefix to parameters to efficiently prevent name collisions
1111    let p_path_name = name;
1112
1113    let uri_str = format!("{}/config/notifications/endpoints/sendmail/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1114    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1115
1116    if let Some(ref user_agent) = configuration.user_agent {
1117        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1118    }
1119    if let Some(ref apikey) = configuration.api_key {
1120        let key = apikey.key.clone();
1121        let value = match apikey.prefix {
1122            Some(ref prefix) => format!("{} {}", prefix, key),
1123            None => key,
1124        };
1125        req_builder = req_builder.header("Authorization", value);
1126    };
1127    if let Some(ref apikey) = configuration.api_key {
1128        let key = apikey.key.clone();
1129        let value = match apikey.prefix {
1130            Some(ref prefix) => format!("{} {}", prefix, key),
1131            None => key,
1132        };
1133        req_builder = req_builder.header("CSRFPreventionToken", value);
1134    };
1135
1136    let req = req_builder.build()?;
1137    let resp = configuration.client.execute(req).await?;
1138
1139    let status = resp.status();
1140    let content_type = resp
1141        .headers()
1142        .get("content-type")
1143        .and_then(|v| v.to_str().ok())
1144        .unwrap_or("application/octet-stream");
1145    let content_type = super::ContentType::from(content_type);
1146
1147    if !status.is_client_error() && !status.is_server_error() {
1148        let content = resp.text().await?;
1149        match content_type {
1150            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1151            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetConfigNotificationsEndpointsSendmailByNameResponse`"))),
1152            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::ConfigNotificationsGetConfigNotificationsEndpointsSendmailByNameResponse`")))),
1153        }
1154    } else {
1155        let content = resp.text().await?;
1156        let entity: Option<ConfigNotificationsGetConfigNotificationsEndpointsSendmailByNameError> = serde_json::from_str(&content).ok();
1157        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1158    }
1159}
1160
1161/// Get a smtp endpoint.
1162pub async fn config_notifications_get_config_notifications_endpoints_smtp_by_name(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsGetConfigNotificationsEndpointsSmtpByNameResponse, Error<ConfigNotificationsGetConfigNotificationsEndpointsSmtpByNameError>> {
1163    // add a prefix to parameters to efficiently prevent name collisions
1164    let p_path_name = name;
1165
1166    let uri_str = format!("{}/config/notifications/endpoints/smtp/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1167    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1168
1169    if let Some(ref user_agent) = configuration.user_agent {
1170        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1171    }
1172    if let Some(ref apikey) = configuration.api_key {
1173        let key = apikey.key.clone();
1174        let value = match apikey.prefix {
1175            Some(ref prefix) => format!("{} {}", prefix, key),
1176            None => key,
1177        };
1178        req_builder = req_builder.header("Authorization", value);
1179    };
1180    if let Some(ref apikey) = configuration.api_key {
1181        let key = apikey.key.clone();
1182        let value = match apikey.prefix {
1183            Some(ref prefix) => format!("{} {}", prefix, key),
1184            None => key,
1185        };
1186        req_builder = req_builder.header("CSRFPreventionToken", value);
1187    };
1188
1189    let req = req_builder.build()?;
1190    let resp = configuration.client.execute(req).await?;
1191
1192    let status = resp.status();
1193    let content_type = resp
1194        .headers()
1195        .get("content-type")
1196        .and_then(|v| v.to_str().ok())
1197        .unwrap_or("application/octet-stream");
1198    let content_type = super::ContentType::from(content_type);
1199
1200    if !status.is_client_error() && !status.is_server_error() {
1201        let content = resp.text().await?;
1202        match content_type {
1203            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1204            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetConfigNotificationsEndpointsSmtpByNameResponse`"))),
1205            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::ConfigNotificationsGetConfigNotificationsEndpointsSmtpByNameResponse`")))),
1206        }
1207    } else {
1208        let content = resp.text().await?;
1209        let entity: Option<ConfigNotificationsGetConfigNotificationsEndpointsSmtpByNameError> = serde_json::from_str(&content).ok();
1210        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1211    }
1212}
1213
1214/// Get a webhook endpoint.
1215pub async fn config_notifications_get_config_notifications_endpoints_webhook_by_name(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsGetConfigNotificationsEndpointsWebhookByNameResponse, Error<ConfigNotificationsGetConfigNotificationsEndpointsWebhookByNameError>> {
1216    // add a prefix to parameters to efficiently prevent name collisions
1217    let p_path_name = name;
1218
1219    let uri_str = format!("{}/config/notifications/endpoints/webhook/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1220    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1221
1222    if let Some(ref user_agent) = configuration.user_agent {
1223        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1224    }
1225    if let Some(ref apikey) = configuration.api_key {
1226        let key = apikey.key.clone();
1227        let value = match apikey.prefix {
1228            Some(ref prefix) => format!("{} {}", prefix, key),
1229            None => key,
1230        };
1231        req_builder = req_builder.header("Authorization", value);
1232    };
1233    if let Some(ref apikey) = configuration.api_key {
1234        let key = apikey.key.clone();
1235        let value = match apikey.prefix {
1236            Some(ref prefix) => format!("{} {}", prefix, key),
1237            None => key,
1238        };
1239        req_builder = req_builder.header("CSRFPreventionToken", value);
1240    };
1241
1242    let req = req_builder.build()?;
1243    let resp = configuration.client.execute(req).await?;
1244
1245    let status = resp.status();
1246    let content_type = resp
1247        .headers()
1248        .get("content-type")
1249        .and_then(|v| v.to_str().ok())
1250        .unwrap_or("application/octet-stream");
1251    let content_type = super::ContentType::from(content_type);
1252
1253    if !status.is_client_error() && !status.is_server_error() {
1254        let content = resp.text().await?;
1255        match content_type {
1256            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1257            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetConfigNotificationsEndpointsWebhookByNameResponse`"))),
1258            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::ConfigNotificationsGetConfigNotificationsEndpointsWebhookByNameResponse`")))),
1259        }
1260    } else {
1261        let content = resp.text().await?;
1262        let entity: Option<ConfigNotificationsGetConfigNotificationsEndpointsWebhookByNameError> = serde_json::from_str(&content).ok();
1263        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1264    }
1265}
1266
1267/// Get a notification matcher.
1268pub async fn config_notifications_get_config_notifications_matchers_by_name(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsGetConfigNotificationsMatchersByNameResponse, Error<ConfigNotificationsGetConfigNotificationsMatchersByNameError>> {
1269    // add a prefix to parameters to efficiently prevent name collisions
1270    let p_path_name = name;
1271
1272    let uri_str = format!("{}/config/notifications/matchers/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1273    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1274
1275    if let Some(ref user_agent) = configuration.user_agent {
1276        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1277    }
1278    if let Some(ref apikey) = configuration.api_key {
1279        let key = apikey.key.clone();
1280        let value = match apikey.prefix {
1281            Some(ref prefix) => format!("{} {}", prefix, key),
1282            None => key,
1283        };
1284        req_builder = req_builder.header("Authorization", value);
1285    };
1286    if let Some(ref apikey) = configuration.api_key {
1287        let key = apikey.key.clone();
1288        let value = match apikey.prefix {
1289            Some(ref prefix) => format!("{} {}", prefix, key),
1290            None => key,
1291        };
1292        req_builder = req_builder.header("CSRFPreventionToken", value);
1293    };
1294
1295    let req = req_builder.build()?;
1296    let resp = configuration.client.execute(req).await?;
1297
1298    let status = resp.status();
1299    let content_type = resp
1300        .headers()
1301        .get("content-type")
1302        .and_then(|v| v.to_str().ok())
1303        .unwrap_or("application/octet-stream");
1304    let content_type = super::ContentType::from(content_type);
1305
1306    if !status.is_client_error() && !status.is_server_error() {
1307        let content = resp.text().await?;
1308        match content_type {
1309            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1310            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetConfigNotificationsMatchersByNameResponse`"))),
1311            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::ConfigNotificationsGetConfigNotificationsMatchersByNameResponse`")))),
1312        }
1313    } else {
1314        let content = resp.text().await?;
1315        let entity: Option<ConfigNotificationsGetConfigNotificationsMatchersByNameError> = serde_json::from_str(&content).ok();
1316        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1317    }
1318}
1319
1320/// Directory index.
1321pub async fn config_notifications_get_config_notifications_targets_by_name(configuration: &configuration::Configuration, name: &str) -> Result<models::ConfigNotificationsGetConfigNotificationsTargetsByNameResponse, Error<ConfigNotificationsGetConfigNotificationsTargetsByNameError>> {
1322    // add a prefix to parameters to efficiently prevent name collisions
1323    let p_path_name = name;
1324
1325    let uri_str = format!("{}/config/notifications/targets/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1326    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1327
1328    if let Some(ref user_agent) = configuration.user_agent {
1329        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1330    }
1331    if let Some(ref apikey) = configuration.api_key {
1332        let key = apikey.key.clone();
1333        let value = match apikey.prefix {
1334            Some(ref prefix) => format!("{} {}", prefix, key),
1335            None => key,
1336        };
1337        req_builder = req_builder.header("Authorization", value);
1338    };
1339    if let Some(ref apikey) = configuration.api_key {
1340        let key = apikey.key.clone();
1341        let value = match apikey.prefix {
1342            Some(ref prefix) => format!("{} {}", prefix, key),
1343            None => key,
1344        };
1345        req_builder = req_builder.header("CSRFPreventionToken", value);
1346    };
1347
1348    let req = req_builder.build()?;
1349    let resp = configuration.client.execute(req).await?;
1350
1351    let status = resp.status();
1352    let content_type = resp
1353        .headers()
1354        .get("content-type")
1355        .and_then(|v| v.to_str().ok())
1356        .unwrap_or("application/octet-stream");
1357    let content_type = super::ContentType::from(content_type);
1358
1359    if !status.is_client_error() && !status.is_server_error() {
1360        let content = resp.text().await?;
1361        match content_type {
1362            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1363            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetConfigNotificationsTargetsByNameResponse`"))),
1364            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::ConfigNotificationsGetConfigNotificationsTargetsByNameResponse`")))),
1365        }
1366    } else {
1367        let content = resp.text().await?;
1368        let entity: Option<ConfigNotificationsGetConfigNotificationsTargetsByNameError> = serde_json::from_str(&content).ok();
1369        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1370    }
1371}
1372
1373/// Directory index.
1374pub async fn config_notifications_get_endpoints(configuration: &configuration::Configuration, ) -> Result<models::ConfigNotificationsGetEndpointsResponse, Error<ConfigNotificationsGetEndpointsError>> {
1375
1376    let uri_str = format!("{}/config/notifications/endpoints", configuration.base_path);
1377    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1378
1379    if let Some(ref user_agent) = configuration.user_agent {
1380        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1381    }
1382    if let Some(ref apikey) = configuration.api_key {
1383        let key = apikey.key.clone();
1384        let value = match apikey.prefix {
1385            Some(ref prefix) => format!("{} {}", prefix, key),
1386            None => key,
1387        };
1388        req_builder = req_builder.header("Authorization", value);
1389    };
1390    if let Some(ref apikey) = configuration.api_key {
1391        let key = apikey.key.clone();
1392        let value = match apikey.prefix {
1393            Some(ref prefix) => format!("{} {}", prefix, key),
1394            None => key,
1395        };
1396        req_builder = req_builder.header("CSRFPreventionToken", value);
1397    };
1398
1399    let req = req_builder.build()?;
1400    let resp = configuration.client.execute(req).await?;
1401
1402    let status = resp.status();
1403    let content_type = resp
1404        .headers()
1405        .get("content-type")
1406        .and_then(|v| v.to_str().ok())
1407        .unwrap_or("application/octet-stream");
1408    let content_type = super::ContentType::from(content_type);
1409
1410    if !status.is_client_error() && !status.is_server_error() {
1411        let content = resp.text().await?;
1412        match content_type {
1413            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1414            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetEndpointsResponse`"))),
1415            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::ConfigNotificationsGetEndpointsResponse`")))),
1416        }
1417    } else {
1418        let content = resp.text().await?;
1419        let entity: Option<ConfigNotificationsGetEndpointsError> = serde_json::from_str(&content).ok();
1420        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1421    }
1422}
1423
1424/// List all gotify endpoints.
1425pub async fn config_notifications_get_gotify(configuration: &configuration::Configuration, ) -> Result<models::ConfigNotificationsGetGotifyResponse, Error<ConfigNotificationsGetGotifyError>> {
1426
1427    let uri_str = format!("{}/config/notifications/endpoints/gotify", configuration.base_path);
1428    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1429
1430    if let Some(ref user_agent) = configuration.user_agent {
1431        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1432    }
1433    if let Some(ref apikey) = configuration.api_key {
1434        let key = apikey.key.clone();
1435        let value = match apikey.prefix {
1436            Some(ref prefix) => format!("{} {}", prefix, key),
1437            None => key,
1438        };
1439        req_builder = req_builder.header("Authorization", value);
1440    };
1441    if let Some(ref apikey) = configuration.api_key {
1442        let key = apikey.key.clone();
1443        let value = match apikey.prefix {
1444            Some(ref prefix) => format!("{} {}", prefix, key),
1445            None => key,
1446        };
1447        req_builder = req_builder.header("CSRFPreventionToken", value);
1448    };
1449
1450    let req = req_builder.build()?;
1451    let resp = configuration.client.execute(req).await?;
1452
1453    let status = resp.status();
1454    let content_type = resp
1455        .headers()
1456        .get("content-type")
1457        .and_then(|v| v.to_str().ok())
1458        .unwrap_or("application/octet-stream");
1459    let content_type = super::ContentType::from(content_type);
1460
1461    if !status.is_client_error() && !status.is_server_error() {
1462        let content = resp.text().await?;
1463        match content_type {
1464            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1465            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetGotifyResponse`"))),
1466            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::ConfigNotificationsGetGotifyResponse`")))),
1467        }
1468    } else {
1469        let content = resp.text().await?;
1470        let entity: Option<ConfigNotificationsGetGotifyError> = serde_json::from_str(&content).ok();
1471        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1472    }
1473}
1474
1475/// List all known, matchable metadata field values.
1476pub async fn config_notifications_get_matcher_field_values(configuration: &configuration::Configuration, ) -> Result<models::ConfigNotificationsGetMatcherFieldValuesResponse, Error<ConfigNotificationsGetMatcherFieldValuesError>> {
1477
1478    let uri_str = format!("{}/config/notifications/matcher-field-values", configuration.base_path);
1479    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1480
1481    if let Some(ref user_agent) = configuration.user_agent {
1482        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1483    }
1484    if let Some(ref apikey) = configuration.api_key {
1485        let key = apikey.key.clone();
1486        let value = match apikey.prefix {
1487            Some(ref prefix) => format!("{} {}", prefix, key),
1488            None => key,
1489        };
1490        req_builder = req_builder.header("Authorization", value);
1491    };
1492    if let Some(ref apikey) = configuration.api_key {
1493        let key = apikey.key.clone();
1494        let value = match apikey.prefix {
1495            Some(ref prefix) => format!("{} {}", prefix, key),
1496            None => key,
1497        };
1498        req_builder = req_builder.header("CSRFPreventionToken", value);
1499    };
1500
1501    let req = req_builder.build()?;
1502    let resp = configuration.client.execute(req).await?;
1503
1504    let status = resp.status();
1505    let content_type = resp
1506        .headers()
1507        .get("content-type")
1508        .and_then(|v| v.to_str().ok())
1509        .unwrap_or("application/octet-stream");
1510    let content_type = super::ContentType::from(content_type);
1511
1512    if !status.is_client_error() && !status.is_server_error() {
1513        let content = resp.text().await?;
1514        match content_type {
1515            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1516            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetMatcherFieldValuesResponse`"))),
1517            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::ConfigNotificationsGetMatcherFieldValuesResponse`")))),
1518        }
1519    } else {
1520        let content = resp.text().await?;
1521        let entity: Option<ConfigNotificationsGetMatcherFieldValuesError> = serde_json::from_str(&content).ok();
1522        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1523    }
1524}
1525
1526/// Get all known metadata fields.
1527pub async fn config_notifications_get_matcher_fields(configuration: &configuration::Configuration, ) -> Result<models::ConfigNotificationsGetMatcherFieldsResponse, Error<ConfigNotificationsGetMatcherFieldsError>> {
1528
1529    let uri_str = format!("{}/config/notifications/matcher-fields", configuration.base_path);
1530    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1531
1532    if let Some(ref user_agent) = configuration.user_agent {
1533        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1534    }
1535    if let Some(ref apikey) = configuration.api_key {
1536        let key = apikey.key.clone();
1537        let value = match apikey.prefix {
1538            Some(ref prefix) => format!("{} {}", prefix, key),
1539            None => key,
1540        };
1541        req_builder = req_builder.header("Authorization", value);
1542    };
1543    if let Some(ref apikey) = configuration.api_key {
1544        let key = apikey.key.clone();
1545        let value = match apikey.prefix {
1546            Some(ref prefix) => format!("{} {}", prefix, key),
1547            None => key,
1548        };
1549        req_builder = req_builder.header("CSRFPreventionToken", value);
1550    };
1551
1552    let req = req_builder.build()?;
1553    let resp = configuration.client.execute(req).await?;
1554
1555    let status = resp.status();
1556    let content_type = resp
1557        .headers()
1558        .get("content-type")
1559        .and_then(|v| v.to_str().ok())
1560        .unwrap_or("application/octet-stream");
1561    let content_type = super::ContentType::from(content_type);
1562
1563    if !status.is_client_error() && !status.is_server_error() {
1564        let content = resp.text().await?;
1565        match content_type {
1566            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1567            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetMatcherFieldsResponse`"))),
1568            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::ConfigNotificationsGetMatcherFieldsResponse`")))),
1569        }
1570    } else {
1571        let content = resp.text().await?;
1572        let entity: Option<ConfigNotificationsGetMatcherFieldsError> = serde_json::from_str(&content).ok();
1573        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1574    }
1575}
1576
1577/// List all notification matchers.
1578pub async fn config_notifications_get_matchers(configuration: &configuration::Configuration, ) -> Result<models::ConfigNotificationsGetMatchersResponse, Error<ConfigNotificationsGetMatchersError>> {
1579
1580    let uri_str = format!("{}/config/notifications/matchers", configuration.base_path);
1581    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1582
1583    if let Some(ref user_agent) = configuration.user_agent {
1584        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1585    }
1586    if let Some(ref apikey) = configuration.api_key {
1587        let key = apikey.key.clone();
1588        let value = match apikey.prefix {
1589            Some(ref prefix) => format!("{} {}", prefix, key),
1590            None => key,
1591        };
1592        req_builder = req_builder.header("Authorization", value);
1593    };
1594    if let Some(ref apikey) = configuration.api_key {
1595        let key = apikey.key.clone();
1596        let value = match apikey.prefix {
1597            Some(ref prefix) => format!("{} {}", prefix, key),
1598            None => key,
1599        };
1600        req_builder = req_builder.header("CSRFPreventionToken", value);
1601    };
1602
1603    let req = req_builder.build()?;
1604    let resp = configuration.client.execute(req).await?;
1605
1606    let status = resp.status();
1607    let content_type = resp
1608        .headers()
1609        .get("content-type")
1610        .and_then(|v| v.to_str().ok())
1611        .unwrap_or("application/octet-stream");
1612    let content_type = super::ContentType::from(content_type);
1613
1614    if !status.is_client_error() && !status.is_server_error() {
1615        let content = resp.text().await?;
1616        match content_type {
1617            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1618            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetMatchersResponse`"))),
1619            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::ConfigNotificationsGetMatchersResponse`")))),
1620        }
1621    } else {
1622        let content = resp.text().await?;
1623        let entity: Option<ConfigNotificationsGetMatchersError> = serde_json::from_str(&content).ok();
1624        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1625    }
1626}
1627
1628/// Directory index.
1629pub async fn config_notifications_get_notifications(configuration: &configuration::Configuration, ) -> Result<models::ConfigNotificationsGetNotificationsResponse, Error<ConfigNotificationsGetNotificationsError>> {
1630
1631    let uri_str = format!("{}/config/notifications", configuration.base_path);
1632    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1633
1634    if let Some(ref user_agent) = configuration.user_agent {
1635        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1636    }
1637    if let Some(ref apikey) = configuration.api_key {
1638        let key = apikey.key.clone();
1639        let value = match apikey.prefix {
1640            Some(ref prefix) => format!("{} {}", prefix, key),
1641            None => key,
1642        };
1643        req_builder = req_builder.header("Authorization", value);
1644    };
1645    if let Some(ref apikey) = configuration.api_key {
1646        let key = apikey.key.clone();
1647        let value = match apikey.prefix {
1648            Some(ref prefix) => format!("{} {}", prefix, key),
1649            None => key,
1650        };
1651        req_builder = req_builder.header("CSRFPreventionToken", value);
1652    };
1653
1654    let req = req_builder.build()?;
1655    let resp = configuration.client.execute(req).await?;
1656
1657    let status = resp.status();
1658    let content_type = resp
1659        .headers()
1660        .get("content-type")
1661        .and_then(|v| v.to_str().ok())
1662        .unwrap_or("application/octet-stream");
1663    let content_type = super::ContentType::from(content_type);
1664
1665    if !status.is_client_error() && !status.is_server_error() {
1666        let content = resp.text().await?;
1667        match content_type {
1668            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1669            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetNotificationsResponse`"))),
1670            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::ConfigNotificationsGetNotificationsResponse`")))),
1671        }
1672    } else {
1673        let content = resp.text().await?;
1674        let entity: Option<ConfigNotificationsGetNotificationsError> = serde_json::from_str(&content).ok();
1675        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1676    }
1677}
1678
1679/// List all sendmail endpoints.
1680pub async fn config_notifications_get_sendmail(configuration: &configuration::Configuration, ) -> Result<models::ConfigNotificationsGetSendmailResponse, Error<ConfigNotificationsGetSendmailError>> {
1681
1682    let uri_str = format!("{}/config/notifications/endpoints/sendmail", configuration.base_path);
1683    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1684
1685    if let Some(ref user_agent) = configuration.user_agent {
1686        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1687    }
1688    if let Some(ref apikey) = configuration.api_key {
1689        let key = apikey.key.clone();
1690        let value = match apikey.prefix {
1691            Some(ref prefix) => format!("{} {}", prefix, key),
1692            None => key,
1693        };
1694        req_builder = req_builder.header("Authorization", value);
1695    };
1696    if let Some(ref apikey) = configuration.api_key {
1697        let key = apikey.key.clone();
1698        let value = match apikey.prefix {
1699            Some(ref prefix) => format!("{} {}", prefix, key),
1700            None => key,
1701        };
1702        req_builder = req_builder.header("CSRFPreventionToken", value);
1703    };
1704
1705    let req = req_builder.build()?;
1706    let resp = configuration.client.execute(req).await?;
1707
1708    let status = resp.status();
1709    let content_type = resp
1710        .headers()
1711        .get("content-type")
1712        .and_then(|v| v.to_str().ok())
1713        .unwrap_or("application/octet-stream");
1714    let content_type = super::ContentType::from(content_type);
1715
1716    if !status.is_client_error() && !status.is_server_error() {
1717        let content = resp.text().await?;
1718        match content_type {
1719            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1720            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetSendmailResponse`"))),
1721            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::ConfigNotificationsGetSendmailResponse`")))),
1722        }
1723    } else {
1724        let content = resp.text().await?;
1725        let entity: Option<ConfigNotificationsGetSendmailError> = serde_json::from_str(&content).ok();
1726        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1727    }
1728}
1729
1730/// List all smtp endpoints.
1731pub async fn config_notifications_get_smtp(configuration: &configuration::Configuration, ) -> Result<models::ConfigNotificationsGetSmtpResponse, Error<ConfigNotificationsGetSmtpError>> {
1732
1733    let uri_str = format!("{}/config/notifications/endpoints/smtp", configuration.base_path);
1734    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1735
1736    if let Some(ref user_agent) = configuration.user_agent {
1737        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1738    }
1739    if let Some(ref apikey) = configuration.api_key {
1740        let key = apikey.key.clone();
1741        let value = match apikey.prefix {
1742            Some(ref prefix) => format!("{} {}", prefix, key),
1743            None => key,
1744        };
1745        req_builder = req_builder.header("Authorization", value);
1746    };
1747    if let Some(ref apikey) = configuration.api_key {
1748        let key = apikey.key.clone();
1749        let value = match apikey.prefix {
1750            Some(ref prefix) => format!("{} {}", prefix, key),
1751            None => key,
1752        };
1753        req_builder = req_builder.header("CSRFPreventionToken", value);
1754    };
1755
1756    let req = req_builder.build()?;
1757    let resp = configuration.client.execute(req).await?;
1758
1759    let status = resp.status();
1760    let content_type = resp
1761        .headers()
1762        .get("content-type")
1763        .and_then(|v| v.to_str().ok())
1764        .unwrap_or("application/octet-stream");
1765    let content_type = super::ContentType::from(content_type);
1766
1767    if !status.is_client_error() && !status.is_server_error() {
1768        let content = resp.text().await?;
1769        match content_type {
1770            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1771            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetSmtpResponse`"))),
1772            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::ConfigNotificationsGetSmtpResponse`")))),
1773        }
1774    } else {
1775        let content = resp.text().await?;
1776        let entity: Option<ConfigNotificationsGetSmtpError> = serde_json::from_str(&content).ok();
1777        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1778    }
1779}
1780
1781/// List all notification targets.
1782pub async fn config_notifications_get_targets(configuration: &configuration::Configuration, ) -> Result<models::ConfigNotificationsGetTargetsResponse, Error<ConfigNotificationsGetTargetsError>> {
1783
1784    let uri_str = format!("{}/config/notifications/targets", configuration.base_path);
1785    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1786
1787    if let Some(ref user_agent) = configuration.user_agent {
1788        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1789    }
1790    if let Some(ref apikey) = configuration.api_key {
1791        let key = apikey.key.clone();
1792        let value = match apikey.prefix {
1793            Some(ref prefix) => format!("{} {}", prefix, key),
1794            None => key,
1795        };
1796        req_builder = req_builder.header("Authorization", value);
1797    };
1798    if let Some(ref apikey) = configuration.api_key {
1799        let key = apikey.key.clone();
1800        let value = match apikey.prefix {
1801            Some(ref prefix) => format!("{} {}", prefix, key),
1802            None => key,
1803        };
1804        req_builder = req_builder.header("CSRFPreventionToken", value);
1805    };
1806
1807    let req = req_builder.build()?;
1808    let resp = configuration.client.execute(req).await?;
1809
1810    let status = resp.status();
1811    let content_type = resp
1812        .headers()
1813        .get("content-type")
1814        .and_then(|v| v.to_str().ok())
1815        .unwrap_or("application/octet-stream");
1816    let content_type = super::ContentType::from(content_type);
1817
1818    if !status.is_client_error() && !status.is_server_error() {
1819        let content = resp.text().await?;
1820        match content_type {
1821            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1822            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetTargetsResponse`"))),
1823            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::ConfigNotificationsGetTargetsResponse`")))),
1824        }
1825    } else {
1826        let content = resp.text().await?;
1827        let entity: Option<ConfigNotificationsGetTargetsError> = serde_json::from_str(&content).ok();
1828        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1829    }
1830}
1831
1832/// List all webhook endpoints.
1833pub async fn config_notifications_get_webhook(configuration: &configuration::Configuration, ) -> Result<models::ConfigNotificationsGetWebhookResponse, Error<ConfigNotificationsGetWebhookError>> {
1834
1835    let uri_str = format!("{}/config/notifications/endpoints/webhook", configuration.base_path);
1836    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1837
1838    if let Some(ref user_agent) = configuration.user_agent {
1839        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1840    }
1841    if let Some(ref apikey) = configuration.api_key {
1842        let key = apikey.key.clone();
1843        let value = match apikey.prefix {
1844            Some(ref prefix) => format!("{} {}", prefix, key),
1845            None => key,
1846        };
1847        req_builder = req_builder.header("Authorization", value);
1848    };
1849    if let Some(ref apikey) = configuration.api_key {
1850        let key = apikey.key.clone();
1851        let value = match apikey.prefix {
1852            Some(ref prefix) => format!("{} {}", prefix, key),
1853            None => key,
1854        };
1855        req_builder = req_builder.header("CSRFPreventionToken", value);
1856    };
1857
1858    let req = req_builder.build()?;
1859    let resp = configuration.client.execute(req).await?;
1860
1861    let status = resp.status();
1862    let content_type = resp
1863        .headers()
1864        .get("content-type")
1865        .and_then(|v| v.to_str().ok())
1866        .unwrap_or("application/octet-stream");
1867    let content_type = super::ContentType::from(content_type);
1868
1869    if !status.is_client_error() && !status.is_server_error() {
1870        let content = resp.text().await?;
1871        match content_type {
1872            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1873            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsGetWebhookResponse`"))),
1874            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::ConfigNotificationsGetWebhookResponse`")))),
1875        }
1876    } else {
1877        let content = resp.text().await?;
1878        let entity: Option<ConfigNotificationsGetWebhookError> = serde_json::from_str(&content).ok();
1879        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1880    }
1881}
1882
1883/// Update gotify endpoint.
1884pub async fn config_notifications_update_gotify(configuration: &configuration::Configuration, name: &str, config_notifications_update_gotify_request: Option<models::ConfigNotificationsUpdateGotifyRequest>) -> Result<models::ConfigNotificationsUpdateGotifyResponse, Error<ConfigNotificationsUpdateGotifyError>> {
1885    // add a prefix to parameters to efficiently prevent name collisions
1886    let p_path_name = name;
1887    let p_body_config_notifications_update_gotify_request = config_notifications_update_gotify_request;
1888
1889    let uri_str = format!("{}/config/notifications/endpoints/gotify/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1890    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1891
1892    if let Some(ref user_agent) = configuration.user_agent {
1893        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1894    }
1895    if let Some(ref apikey) = configuration.api_key {
1896        let key = apikey.key.clone();
1897        let value = match apikey.prefix {
1898            Some(ref prefix) => format!("{} {}", prefix, key),
1899            None => key,
1900        };
1901        req_builder = req_builder.header("Authorization", value);
1902    };
1903    if let Some(ref apikey) = configuration.api_key {
1904        let key = apikey.key.clone();
1905        let value = match apikey.prefix {
1906            Some(ref prefix) => format!("{} {}", prefix, key),
1907            None => key,
1908        };
1909        req_builder = req_builder.header("CSRFPreventionToken", value);
1910    };
1911    req_builder = req_builder.json(&p_body_config_notifications_update_gotify_request);
1912
1913    let req = req_builder.build()?;
1914    let resp = configuration.client.execute(req).await?;
1915
1916    let status = resp.status();
1917    let content_type = resp
1918        .headers()
1919        .get("content-type")
1920        .and_then(|v| v.to_str().ok())
1921        .unwrap_or("application/octet-stream");
1922    let content_type = super::ContentType::from(content_type);
1923
1924    if !status.is_client_error() && !status.is_server_error() {
1925        let content = resp.text().await?;
1926        match content_type {
1927            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1928            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsUpdateGotifyResponse`"))),
1929            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::ConfigNotificationsUpdateGotifyResponse`")))),
1930        }
1931    } else {
1932        let content = resp.text().await?;
1933        let entity: Option<ConfigNotificationsUpdateGotifyError> = serde_json::from_str(&content).ok();
1934        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1935    }
1936}
1937
1938/// Update notification matcher.
1939pub async fn config_notifications_update_matchers(configuration: &configuration::Configuration, name: &str, config_notifications_update_matchers_request: Option<models::ConfigNotificationsUpdateMatchersRequest>) -> Result<models::ConfigNotificationsUpdateMatchersResponse, Error<ConfigNotificationsUpdateMatchersError>> {
1940    // add a prefix to parameters to efficiently prevent name collisions
1941    let p_path_name = name;
1942    let p_body_config_notifications_update_matchers_request = config_notifications_update_matchers_request;
1943
1944    let uri_str = format!("{}/config/notifications/matchers/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1945    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1946
1947    if let Some(ref user_agent) = configuration.user_agent {
1948        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1949    }
1950    if let Some(ref apikey) = configuration.api_key {
1951        let key = apikey.key.clone();
1952        let value = match apikey.prefix {
1953            Some(ref prefix) => format!("{} {}", prefix, key),
1954            None => key,
1955        };
1956        req_builder = req_builder.header("Authorization", value);
1957    };
1958    if let Some(ref apikey) = configuration.api_key {
1959        let key = apikey.key.clone();
1960        let value = match apikey.prefix {
1961            Some(ref prefix) => format!("{} {}", prefix, key),
1962            None => key,
1963        };
1964        req_builder = req_builder.header("CSRFPreventionToken", value);
1965    };
1966    req_builder = req_builder.json(&p_body_config_notifications_update_matchers_request);
1967
1968    let req = req_builder.build()?;
1969    let resp = configuration.client.execute(req).await?;
1970
1971    let status = resp.status();
1972    let content_type = resp
1973        .headers()
1974        .get("content-type")
1975        .and_then(|v| v.to_str().ok())
1976        .unwrap_or("application/octet-stream");
1977    let content_type = super::ContentType::from(content_type);
1978
1979    if !status.is_client_error() && !status.is_server_error() {
1980        let content = resp.text().await?;
1981        match content_type {
1982            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1983            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsUpdateMatchersResponse`"))),
1984            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::ConfigNotificationsUpdateMatchersResponse`")))),
1985        }
1986    } else {
1987        let content = resp.text().await?;
1988        let entity: Option<ConfigNotificationsUpdateMatchersError> = serde_json::from_str(&content).ok();
1989        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1990    }
1991}
1992
1993/// Update sendmail endpoint.
1994pub async fn config_notifications_update_sendmail(configuration: &configuration::Configuration, name: &str, config_notifications_update_sendmail_request: Option<models::ConfigNotificationsUpdateSendmailRequest>) -> Result<models::ConfigNotificationsUpdateSendmailResponse, Error<ConfigNotificationsUpdateSendmailError>> {
1995    // add a prefix to parameters to efficiently prevent name collisions
1996    let p_path_name = name;
1997    let p_body_config_notifications_update_sendmail_request = config_notifications_update_sendmail_request;
1998
1999    let uri_str = format!("{}/config/notifications/endpoints/sendmail/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2000    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2001
2002    if let Some(ref user_agent) = configuration.user_agent {
2003        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2004    }
2005    if let Some(ref apikey) = configuration.api_key {
2006        let key = apikey.key.clone();
2007        let value = match apikey.prefix {
2008            Some(ref prefix) => format!("{} {}", prefix, key),
2009            None => key,
2010        };
2011        req_builder = req_builder.header("Authorization", value);
2012    };
2013    if let Some(ref apikey) = configuration.api_key {
2014        let key = apikey.key.clone();
2015        let value = match apikey.prefix {
2016            Some(ref prefix) => format!("{} {}", prefix, key),
2017            None => key,
2018        };
2019        req_builder = req_builder.header("CSRFPreventionToken", value);
2020    };
2021    req_builder = req_builder.json(&p_body_config_notifications_update_sendmail_request);
2022
2023    let req = req_builder.build()?;
2024    let resp = configuration.client.execute(req).await?;
2025
2026    let status = resp.status();
2027    let content_type = resp
2028        .headers()
2029        .get("content-type")
2030        .and_then(|v| v.to_str().ok())
2031        .unwrap_or("application/octet-stream");
2032    let content_type = super::ContentType::from(content_type);
2033
2034    if !status.is_client_error() && !status.is_server_error() {
2035        let content = resp.text().await?;
2036        match content_type {
2037            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2038            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsUpdateSendmailResponse`"))),
2039            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::ConfigNotificationsUpdateSendmailResponse`")))),
2040        }
2041    } else {
2042        let content = resp.text().await?;
2043        let entity: Option<ConfigNotificationsUpdateSendmailError> = serde_json::from_str(&content).ok();
2044        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2045    }
2046}
2047
2048/// Update smtp endpoint.
2049pub async fn config_notifications_update_smtp(configuration: &configuration::Configuration, name: &str, config_notifications_update_smtp_request: Option<models::ConfigNotificationsUpdateSmtpRequest>) -> Result<models::ConfigNotificationsUpdateSmtpResponse, Error<ConfigNotificationsUpdateSmtpError>> {
2050    // add a prefix to parameters to efficiently prevent name collisions
2051    let p_path_name = name;
2052    let p_body_config_notifications_update_smtp_request = config_notifications_update_smtp_request;
2053
2054    let uri_str = format!("{}/config/notifications/endpoints/smtp/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2055    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2056
2057    if let Some(ref user_agent) = configuration.user_agent {
2058        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2059    }
2060    if let Some(ref apikey) = configuration.api_key {
2061        let key = apikey.key.clone();
2062        let value = match apikey.prefix {
2063            Some(ref prefix) => format!("{} {}", prefix, key),
2064            None => key,
2065        };
2066        req_builder = req_builder.header("Authorization", value);
2067    };
2068    if let Some(ref apikey) = configuration.api_key {
2069        let key = apikey.key.clone();
2070        let value = match apikey.prefix {
2071            Some(ref prefix) => format!("{} {}", prefix, key),
2072            None => key,
2073        };
2074        req_builder = req_builder.header("CSRFPreventionToken", value);
2075    };
2076    req_builder = req_builder.json(&p_body_config_notifications_update_smtp_request);
2077
2078    let req = req_builder.build()?;
2079    let resp = configuration.client.execute(req).await?;
2080
2081    let status = resp.status();
2082    let content_type = resp
2083        .headers()
2084        .get("content-type")
2085        .and_then(|v| v.to_str().ok())
2086        .unwrap_or("application/octet-stream");
2087    let content_type = super::ContentType::from(content_type);
2088
2089    if !status.is_client_error() && !status.is_server_error() {
2090        let content = resp.text().await?;
2091        match content_type {
2092            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2093            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsUpdateSmtpResponse`"))),
2094            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::ConfigNotificationsUpdateSmtpResponse`")))),
2095        }
2096    } else {
2097        let content = resp.text().await?;
2098        let entity: Option<ConfigNotificationsUpdateSmtpError> = serde_json::from_str(&content).ok();
2099        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2100    }
2101}
2102
2103/// Update webhook endpoint.
2104pub async fn config_notifications_update_webhook(configuration: &configuration::Configuration, name: &str, config_notifications_update_webhook_request: Option<models::ConfigNotificationsUpdateWebhookRequest>) -> Result<models::ConfigNotificationsUpdateWebhookResponse, Error<ConfigNotificationsUpdateWebhookError>> {
2105    // add a prefix to parameters to efficiently prevent name collisions
2106    let p_path_name = name;
2107    let p_body_config_notifications_update_webhook_request = config_notifications_update_webhook_request;
2108
2109    let uri_str = format!("{}/config/notifications/endpoints/webhook/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2110    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2111
2112    if let Some(ref user_agent) = configuration.user_agent {
2113        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2114    }
2115    if let Some(ref apikey) = configuration.api_key {
2116        let key = apikey.key.clone();
2117        let value = match apikey.prefix {
2118            Some(ref prefix) => format!("{} {}", prefix, key),
2119            None => key,
2120        };
2121        req_builder = req_builder.header("Authorization", value);
2122    };
2123    if let Some(ref apikey) = configuration.api_key {
2124        let key = apikey.key.clone();
2125        let value = match apikey.prefix {
2126            Some(ref prefix) => format!("{} {}", prefix, key),
2127            None => key,
2128        };
2129        req_builder = req_builder.header("CSRFPreventionToken", value);
2130    };
2131    req_builder = req_builder.json(&p_body_config_notifications_update_webhook_request);
2132
2133    let req = req_builder.build()?;
2134    let resp = configuration.client.execute(req).await?;
2135
2136    let status = resp.status();
2137    let content_type = resp
2138        .headers()
2139        .get("content-type")
2140        .and_then(|v| v.to_str().ok())
2141        .unwrap_or("application/octet-stream");
2142    let content_type = super::ContentType::from(content_type);
2143
2144    if !status.is_client_error() && !status.is_server_error() {
2145        let content = resp.text().await?;
2146        match content_type {
2147            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2148            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigNotificationsUpdateWebhookResponse`"))),
2149            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::ConfigNotificationsUpdateWebhookResponse`")))),
2150        }
2151    } else {
2152        let content = resp.text().await?;
2153        let entity: Option<ConfigNotificationsUpdateWebhookError> = serde_json::from_str(&content).ok();
2154        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2155    }
2156}
2157