authentik_client/apis/
tasks_api.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.8.3
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16/// struct for typed errors of method [`tasks_schedules_list`]
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum TasksSchedulesListError {
20    Status400(models::ValidationError),
21    Status403(models::GenericError),
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`tasks_schedules_partial_update`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum TasksSchedulesPartialUpdateError {
29    Status400(models::ValidationError),
30    Status403(models::GenericError),
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`tasks_schedules_retrieve`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum TasksSchedulesRetrieveError {
38    Status400(models::ValidationError),
39    Status403(models::GenericError),
40    UnknownValue(serde_json::Value),
41}
42
43/// struct for typed errors of method [`tasks_schedules_send_create`]
44#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum TasksSchedulesSendCreateError {
47    Status404(),
48    Status500(),
49    Status400(models::ValidationError),
50    Status403(models::GenericError),
51    UnknownValue(serde_json::Value),
52}
53
54/// struct for typed errors of method [`tasks_schedules_update`]
55#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum TasksSchedulesUpdateError {
58    Status400(models::ValidationError),
59    Status403(models::GenericError),
60    UnknownValue(serde_json::Value),
61}
62
63/// struct for typed errors of method [`tasks_tasks_list`]
64#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum TasksTasksListError {
67    Status400(models::ValidationError),
68    Status403(models::GenericError),
69    UnknownValue(serde_json::Value),
70}
71
72/// struct for typed errors of method [`tasks_tasks_retrieve`]
73#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum TasksTasksRetrieveError {
76    Status400(models::ValidationError),
77    Status403(models::GenericError),
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`tasks_tasks_retry_create`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum TasksTasksRetryCreateError {
85    Status400(),
86    Status404(),
87    Status403(models::GenericError),
88    UnknownValue(serde_json::Value),
89}
90
91/// struct for typed errors of method [`tasks_workers_list`]
92#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(untagged)]
94pub enum TasksWorkersListError {
95    Status400(models::ValidationError),
96    Status403(models::GenericError),
97    UnknownValue(serde_json::Value),
98}
99
100pub async fn tasks_schedules_list(
101    configuration: &configuration::Configuration,
102    actor_name: Option<&str>,
103    ordering: Option<&str>,
104    page: Option<i32>,
105    page_size: Option<i32>,
106    paused: Option<bool>,
107    rel_obj_content_type__app_label: Option<&str>,
108    rel_obj_content_type__model: Option<&str>,
109    rel_obj_id: Option<&str>,
110    rel_obj_id__isnull: Option<bool>,
111    search: Option<&str>,
112) -> Result<models::PaginatedScheduleList, Error<TasksSchedulesListError>> {
113    // add a prefix to parameters to efficiently prevent name collisions
114    let p_query_actor_name = actor_name;
115    let p_query_ordering = ordering;
116    let p_query_page = page;
117    let p_query_page_size = page_size;
118    let p_query_paused = paused;
119    let p_query_rel_obj_content_type__app_label = rel_obj_content_type__app_label;
120    let p_query_rel_obj_content_type__model = rel_obj_content_type__model;
121    let p_query_rel_obj_id = rel_obj_id;
122    let p_query_rel_obj_id__isnull = rel_obj_id__isnull;
123    let p_query_search = search;
124
125    let uri_str = format!("{}/tasks/schedules/", configuration.base_path);
126    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
127
128    if let Some(ref param_value) = p_query_actor_name {
129        req_builder = req_builder.query(&[("actor_name", &param_value.to_string())]);
130    }
131    if let Some(ref param_value) = p_query_ordering {
132        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
133    }
134    if let Some(ref param_value) = p_query_page {
135        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
136    }
137    if let Some(ref param_value) = p_query_page_size {
138        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
139    }
140    if let Some(ref param_value) = p_query_paused {
141        req_builder = req_builder.query(&[("paused", &param_value.to_string())]);
142    }
143    if let Some(ref param_value) = p_query_rel_obj_content_type__app_label {
144        req_builder = req_builder.query(&[("rel_obj_content_type__app_label", &param_value.to_string())]);
145    }
146    if let Some(ref param_value) = p_query_rel_obj_content_type__model {
147        req_builder = req_builder.query(&[("rel_obj_content_type__model", &param_value.to_string())]);
148    }
149    if let Some(ref param_value) = p_query_rel_obj_id {
150        req_builder = req_builder.query(&[("rel_obj_id", &param_value.to_string())]);
151    }
152    if let Some(ref param_value) = p_query_rel_obj_id__isnull {
153        req_builder = req_builder.query(&[("rel_obj_id__isnull", &param_value.to_string())]);
154    }
155    if let Some(ref param_value) = p_query_search {
156        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
157    }
158    if let Some(ref user_agent) = configuration.user_agent {
159        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
160    }
161    if let Some(ref token) = configuration.bearer_access_token {
162        req_builder = req_builder.bearer_auth(token.to_owned());
163    };
164
165    let req = req_builder.build()?;
166    let resp = configuration.client.execute(req).await?;
167
168    let status = resp.status();
169    let content_type = resp
170        .headers()
171        .get("content-type")
172        .and_then(|v| v.to_str().ok())
173        .unwrap_or("application/octet-stream");
174    let content_type = super::ContentType::from(content_type);
175
176    if !status.is_client_error() && !status.is_server_error() {
177        let content = resp.text().await?;
178        match content_type {
179            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
180            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedScheduleList`"))),
181            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::PaginatedScheduleList`")))),
182        }
183    } else {
184        let content = resp.text().await?;
185        let entity: Option<TasksSchedulesListError> = serde_json::from_str(&content).ok();
186        Err(Error::ResponseError(ResponseContent {
187            status,
188            content,
189            entity,
190        }))
191    }
192}
193
194pub async fn tasks_schedules_partial_update(
195    configuration: &configuration::Configuration,
196    id: &str,
197    patched_schedule_request: Option<models::PatchedScheduleRequest>,
198) -> Result<models::Schedule, Error<TasksSchedulesPartialUpdateError>> {
199    // add a prefix to parameters to efficiently prevent name collisions
200    let p_path_id = id;
201    let p_body_patched_schedule_request = patched_schedule_request;
202
203    let uri_str = format!(
204        "{}/tasks/schedules/{id}/",
205        configuration.base_path,
206        id = crate::apis::urlencode(p_path_id)
207    );
208    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
209
210    if let Some(ref user_agent) = configuration.user_agent {
211        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
212    }
213    if let Some(ref token) = configuration.bearer_access_token {
214        req_builder = req_builder.bearer_auth(token.to_owned());
215    };
216    req_builder = req_builder.json(&p_body_patched_schedule_request);
217
218    let req = req_builder.build()?;
219    let resp = configuration.client.execute(req).await?;
220
221    let status = resp.status();
222    let content_type = resp
223        .headers()
224        .get("content-type")
225        .and_then(|v| v.to_str().ok())
226        .unwrap_or("application/octet-stream");
227    let content_type = super::ContentType::from(content_type);
228
229    if !status.is_client_error() && !status.is_server_error() {
230        let content = resp.text().await?;
231        match content_type {
232            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
233            ContentType::Text => {
234                return Err(Error::from(serde_json::Error::custom(
235                    "Received `text/plain` content type response that cannot be converted to `models::Schedule`",
236                )))
237            }
238            ContentType::Unsupported(unknown_type) => {
239                return Err(Error::from(serde_json::Error::custom(format!(
240                    "Received `{unknown_type}` content type response that cannot be converted to `models::Schedule`"
241                ))))
242            }
243        }
244    } else {
245        let content = resp.text().await?;
246        let entity: Option<TasksSchedulesPartialUpdateError> = serde_json::from_str(&content).ok();
247        Err(Error::ResponseError(ResponseContent {
248            status,
249            content,
250            entity,
251        }))
252    }
253}
254
255pub async fn tasks_schedules_retrieve(
256    configuration: &configuration::Configuration,
257    id: &str,
258) -> Result<models::Schedule, Error<TasksSchedulesRetrieveError>> {
259    // add a prefix to parameters to efficiently prevent name collisions
260    let p_path_id = id;
261
262    let uri_str = format!(
263        "{}/tasks/schedules/{id}/",
264        configuration.base_path,
265        id = crate::apis::urlencode(p_path_id)
266    );
267    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
268
269    if let Some(ref user_agent) = configuration.user_agent {
270        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
271    }
272    if let Some(ref token) = configuration.bearer_access_token {
273        req_builder = req_builder.bearer_auth(token.to_owned());
274    };
275
276    let req = req_builder.build()?;
277    let resp = configuration.client.execute(req).await?;
278
279    let status = resp.status();
280    let content_type = resp
281        .headers()
282        .get("content-type")
283        .and_then(|v| v.to_str().ok())
284        .unwrap_or("application/octet-stream");
285    let content_type = super::ContentType::from(content_type);
286
287    if !status.is_client_error() && !status.is_server_error() {
288        let content = resp.text().await?;
289        match content_type {
290            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
291            ContentType::Text => {
292                return Err(Error::from(serde_json::Error::custom(
293                    "Received `text/plain` content type response that cannot be converted to `models::Schedule`",
294                )))
295            }
296            ContentType::Unsupported(unknown_type) => {
297                return Err(Error::from(serde_json::Error::custom(format!(
298                    "Received `{unknown_type}` content type response that cannot be converted to `models::Schedule`"
299                ))))
300            }
301        }
302    } else {
303        let content = resp.text().await?;
304        let entity: Option<TasksSchedulesRetrieveError> = serde_json::from_str(&content).ok();
305        Err(Error::ResponseError(ResponseContent {
306            status,
307            content,
308            entity,
309        }))
310    }
311}
312
313/// Trigger this schedule now
314pub async fn tasks_schedules_send_create(
315    configuration: &configuration::Configuration,
316    id: &str,
317) -> Result<(), Error<TasksSchedulesSendCreateError>> {
318    // add a prefix to parameters to efficiently prevent name collisions
319    let p_path_id = id;
320
321    let uri_str = format!(
322        "{}/tasks/schedules/{id}/send/",
323        configuration.base_path,
324        id = crate::apis::urlencode(p_path_id)
325    );
326    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
327
328    if let Some(ref user_agent) = configuration.user_agent {
329        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
330    }
331    if let Some(ref token) = configuration.bearer_access_token {
332        req_builder = req_builder.bearer_auth(token.to_owned());
333    };
334
335    let req = req_builder.build()?;
336    let resp = configuration.client.execute(req).await?;
337
338    let status = resp.status();
339
340    if !status.is_client_error() && !status.is_server_error() {
341        Ok(())
342    } else {
343        let content = resp.text().await?;
344        let entity: Option<TasksSchedulesSendCreateError> = serde_json::from_str(&content).ok();
345        Err(Error::ResponseError(ResponseContent {
346            status,
347            content,
348            entity,
349        }))
350    }
351}
352
353pub async fn tasks_schedules_update(
354    configuration: &configuration::Configuration,
355    id: &str,
356    schedule_request: models::ScheduleRequest,
357) -> Result<models::Schedule, Error<TasksSchedulesUpdateError>> {
358    // add a prefix to parameters to efficiently prevent name collisions
359    let p_path_id = id;
360    let p_body_schedule_request = schedule_request;
361
362    let uri_str = format!(
363        "{}/tasks/schedules/{id}/",
364        configuration.base_path,
365        id = crate::apis::urlencode(p_path_id)
366    );
367    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
368
369    if let Some(ref user_agent) = configuration.user_agent {
370        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
371    }
372    if let Some(ref token) = configuration.bearer_access_token {
373        req_builder = req_builder.bearer_auth(token.to_owned());
374    };
375    req_builder = req_builder.json(&p_body_schedule_request);
376
377    let req = req_builder.build()?;
378    let resp = configuration.client.execute(req).await?;
379
380    let status = resp.status();
381    let content_type = resp
382        .headers()
383        .get("content-type")
384        .and_then(|v| v.to_str().ok())
385        .unwrap_or("application/octet-stream");
386    let content_type = super::ContentType::from(content_type);
387
388    if !status.is_client_error() && !status.is_server_error() {
389        let content = resp.text().await?;
390        match content_type {
391            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
392            ContentType::Text => {
393                return Err(Error::from(serde_json::Error::custom(
394                    "Received `text/plain` content type response that cannot be converted to `models::Schedule`",
395                )))
396            }
397            ContentType::Unsupported(unknown_type) => {
398                return Err(Error::from(serde_json::Error::custom(format!(
399                    "Received `{unknown_type}` content type response that cannot be converted to `models::Schedule`"
400                ))))
401            }
402        }
403    } else {
404        let content = resp.text().await?;
405        let entity: Option<TasksSchedulesUpdateError> = serde_json::from_str(&content).ok();
406        Err(Error::ResponseError(ResponseContent {
407            status,
408            content,
409            entity,
410        }))
411    }
412}
413
414pub async fn tasks_tasks_list(
415    configuration: &configuration::Configuration,
416    actor_name: Option<&str>,
417    aggregated_status: Option<Vec<String>>,
418    ordering: Option<&str>,
419    page: Option<i32>,
420    page_size: Option<i32>,
421    queue_name: Option<&str>,
422    rel_obj_content_type__app_label: Option<&str>,
423    rel_obj_content_type__model: Option<&str>,
424    rel_obj_id: Option<&str>,
425    rel_obj_id__isnull: Option<bool>,
426    search: Option<&str>,
427    state: Option<&str>,
428) -> Result<models::PaginatedTaskList, Error<TasksTasksListError>> {
429    // add a prefix to parameters to efficiently prevent name collisions
430    let p_query_actor_name = actor_name;
431    let p_query_aggregated_status = aggregated_status;
432    let p_query_ordering = ordering;
433    let p_query_page = page;
434    let p_query_page_size = page_size;
435    let p_query_queue_name = queue_name;
436    let p_query_rel_obj_content_type__app_label = rel_obj_content_type__app_label;
437    let p_query_rel_obj_content_type__model = rel_obj_content_type__model;
438    let p_query_rel_obj_id = rel_obj_id;
439    let p_query_rel_obj_id__isnull = rel_obj_id__isnull;
440    let p_query_search = search;
441    let p_query_state = state;
442
443    let uri_str = format!("{}/tasks/tasks/", configuration.base_path);
444    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
445
446    if let Some(ref param_value) = p_query_actor_name {
447        req_builder = req_builder.query(&[("actor_name", &param_value.to_string())]);
448    }
449    if let Some(ref param_value) = p_query_aggregated_status {
450        req_builder = match "multi" {
451            "multi" => req_builder.query(
452                &param_value
453                    .into_iter()
454                    .map(|p| ("aggregated_status".to_owned(), p.to_string()))
455                    .collect::<Vec<(std::string::String, std::string::String)>>(),
456            ),
457            _ => req_builder.query(&[(
458                "aggregated_status",
459                &param_value
460                    .into_iter()
461                    .map(|p| p.to_string())
462                    .collect::<Vec<String>>()
463                    .join(",")
464                    .to_string(),
465            )]),
466        };
467    }
468    if let Some(ref param_value) = p_query_ordering {
469        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
470    }
471    if let Some(ref param_value) = p_query_page {
472        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
473    }
474    if let Some(ref param_value) = p_query_page_size {
475        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
476    }
477    if let Some(ref param_value) = p_query_queue_name {
478        req_builder = req_builder.query(&[("queue_name", &param_value.to_string())]);
479    }
480    if let Some(ref param_value) = p_query_rel_obj_content_type__app_label {
481        req_builder = req_builder.query(&[("rel_obj_content_type__app_label", &param_value.to_string())]);
482    }
483    if let Some(ref param_value) = p_query_rel_obj_content_type__model {
484        req_builder = req_builder.query(&[("rel_obj_content_type__model", &param_value.to_string())]);
485    }
486    if let Some(ref param_value) = p_query_rel_obj_id {
487        req_builder = req_builder.query(&[("rel_obj_id", &param_value.to_string())]);
488    }
489    if let Some(ref param_value) = p_query_rel_obj_id__isnull {
490        req_builder = req_builder.query(&[("rel_obj_id__isnull", &param_value.to_string())]);
491    }
492    if let Some(ref param_value) = p_query_search {
493        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
494    }
495    if let Some(ref param_value) = p_query_state {
496        req_builder = req_builder.query(&[("state", &param_value.to_string())]);
497    }
498    if let Some(ref user_agent) = configuration.user_agent {
499        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
500    }
501    if let Some(ref token) = configuration.bearer_access_token {
502        req_builder = req_builder.bearer_auth(token.to_owned());
503    };
504
505    let req = req_builder.build()?;
506    let resp = configuration.client.execute(req).await?;
507
508    let status = resp.status();
509    let content_type = resp
510        .headers()
511        .get("content-type")
512        .and_then(|v| v.to_str().ok())
513        .unwrap_or("application/octet-stream");
514    let content_type = super::ContentType::from(content_type);
515
516    if !status.is_client_error() && !status.is_server_error() {
517        let content = resp.text().await?;
518        match content_type {
519            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
520            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedTaskList`"))),
521            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::PaginatedTaskList`")))),
522        }
523    } else {
524        let content = resp.text().await?;
525        let entity: Option<TasksTasksListError> = serde_json::from_str(&content).ok();
526        Err(Error::ResponseError(ResponseContent {
527            status,
528            content,
529            entity,
530        }))
531    }
532}
533
534pub async fn tasks_tasks_retrieve(
535    configuration: &configuration::Configuration,
536    message_id: &str,
537) -> Result<models::Task, Error<TasksTasksRetrieveError>> {
538    // add a prefix to parameters to efficiently prevent name collisions
539    let p_path_message_id = message_id;
540
541    let uri_str = format!(
542        "{}/tasks/tasks/{message_id}/",
543        configuration.base_path,
544        message_id = crate::apis::urlencode(p_path_message_id)
545    );
546    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
547
548    if let Some(ref user_agent) = configuration.user_agent {
549        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
550    }
551    if let Some(ref token) = configuration.bearer_access_token {
552        req_builder = req_builder.bearer_auth(token.to_owned());
553    };
554
555    let req = req_builder.build()?;
556    let resp = configuration.client.execute(req).await?;
557
558    let status = resp.status();
559    let content_type = resp
560        .headers()
561        .get("content-type")
562        .and_then(|v| v.to_str().ok())
563        .unwrap_or("application/octet-stream");
564    let content_type = super::ContentType::from(content_type);
565
566    if !status.is_client_error() && !status.is_server_error() {
567        let content = resp.text().await?;
568        match content_type {
569            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
570            ContentType::Text => {
571                return Err(Error::from(serde_json::Error::custom(
572                    "Received `text/plain` content type response that cannot be converted to `models::Task`",
573                )))
574            }
575            ContentType::Unsupported(unknown_type) => {
576                return Err(Error::from(serde_json::Error::custom(format!(
577                    "Received `{unknown_type}` content type response that cannot be converted to `models::Task`"
578                ))))
579            }
580        }
581    } else {
582        let content = resp.text().await?;
583        let entity: Option<TasksTasksRetrieveError> = serde_json::from_str(&content).ok();
584        Err(Error::ResponseError(ResponseContent {
585            status,
586            content,
587            entity,
588        }))
589    }
590}
591
592/// Retry task
593pub async fn tasks_tasks_retry_create(
594    configuration: &configuration::Configuration,
595    message_id: &str,
596) -> Result<(), Error<TasksTasksRetryCreateError>> {
597    // add a prefix to parameters to efficiently prevent name collisions
598    let p_path_message_id = message_id;
599
600    let uri_str = format!(
601        "{}/tasks/tasks/{message_id}/retry/",
602        configuration.base_path,
603        message_id = crate::apis::urlencode(p_path_message_id)
604    );
605    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
606
607    if let Some(ref user_agent) = configuration.user_agent {
608        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
609    }
610    if let Some(ref token) = configuration.bearer_access_token {
611        req_builder = req_builder.bearer_auth(token.to_owned());
612    };
613
614    let req = req_builder.build()?;
615    let resp = configuration.client.execute(req).await?;
616
617    let status = resp.status();
618
619    if !status.is_client_error() && !status.is_server_error() {
620        Ok(())
621    } else {
622        let content = resp.text().await?;
623        let entity: Option<TasksTasksRetryCreateError> = serde_json::from_str(&content).ok();
624        Err(Error::ResponseError(ResponseContent {
625            status,
626            content,
627            entity,
628        }))
629    }
630}
631
632/// Get currently connected worker count.
633pub async fn tasks_workers_list(
634    configuration: &configuration::Configuration,
635) -> Result<Vec<models::Worker>, Error<TasksWorkersListError>> {
636    let uri_str = format!("{}/tasks/workers", configuration.base_path);
637    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
638
639    if let Some(ref user_agent) = configuration.user_agent {
640        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
641    }
642    if let Some(ref token) = configuration.bearer_access_token {
643        req_builder = req_builder.bearer_auth(token.to_owned());
644    };
645
646    let req = req_builder.build()?;
647    let resp = configuration.client.execute(req).await?;
648
649    let status = resp.status();
650    let content_type = resp
651        .headers()
652        .get("content-type")
653        .and_then(|v| v.to_str().ok())
654        .unwrap_or("application/octet-stream");
655    let content_type = super::ContentType::from(content_type);
656
657    if !status.is_client_error() && !status.is_server_error() {
658        let content = resp.text().await?;
659        match content_type {
660            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
661            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Worker&gt;`"))),
662            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Worker&gt;`")))),
663        }
664    } else {
665        let content = resp.text().await?;
666        let entity: Option<TasksWorkersListError> = serde_json::from_str(&content).ok();
667        Err(Error::ResponseError(ResponseContent {
668            status,
669            content,
670            entity,
671        }))
672    }
673}