sonarr_api_rs/apis/
indexer_api.rs

1/*
2 * Sonarr
3 *
4 * Sonarr API docs - The v3 API docs apply to both v3 and v4 versions of Sonarr. Some functionality may only be available in v4 of the Sonarr application.
5 *
6 * The version of the OpenAPI document: 3.0.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`api_v3_indexer_action_name_post`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ApiV3IndexerActionNamePostError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`api_v3_indexer_bulk_delete`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum ApiV3IndexerBulkDeleteError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`api_v3_indexer_bulk_put`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ApiV3IndexerBulkPutError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`api_v3_indexer_get`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum ApiV3IndexerGetError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`api_v3_indexer_id_delete`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ApiV3IndexerIdDeleteError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`api_v3_indexer_id_get`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ApiV3IndexerIdGetError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`api_v3_indexer_id_put`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ApiV3IndexerIdPutError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`api_v3_indexer_post`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum ApiV3IndexerPostError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`api_v3_indexer_schema_get`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ApiV3IndexerSchemaGetError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`api_v3_indexer_test_post`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum ApiV3IndexerTestPostError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`api_v3_indexer_testall_post`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum ApiV3IndexerTestallPostError {
92    UnknownValue(serde_json::Value),
93}
94
95
96pub async fn api_v3_indexer_action_name_post(configuration: &configuration::Configuration, name: &str, indexer_resource: Option<models::IndexerResource>) -> Result<(), Error<ApiV3IndexerActionNamePostError>> {
97    let local_var_configuration = configuration;
98
99    let local_var_client = &local_var_configuration.client;
100
101    let local_var_uri_str = format!("{}/api/v3/indexer/action/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name));
102    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
103
104    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
105        let local_var_key = local_var_apikey.key.clone();
106        let local_var_value = match local_var_apikey.prefix {
107            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
108            None => local_var_key,
109        };
110        local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
111    }
112    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
113        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
114    }
115    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
116        let local_var_key = local_var_apikey.key.clone();
117        let local_var_value = match local_var_apikey.prefix {
118            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
119            None => local_var_key,
120        };
121        local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
122    };
123    local_var_req_builder = local_var_req_builder.json(&indexer_resource);
124
125    let local_var_req = local_var_req_builder.build()?;
126    let local_var_resp = local_var_client.execute(local_var_req).await?;
127
128    let local_var_status = local_var_resp.status();
129    let local_var_content = local_var_resp.text().await?;
130
131    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
132        Ok(())
133    } else {
134        let local_var_entity: Option<ApiV3IndexerActionNamePostError> = serde_json::from_str(&local_var_content).ok();
135        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
136        Err(Error::ResponseError(local_var_error))
137    }
138}
139
140pub async fn api_v3_indexer_bulk_delete(configuration: &configuration::Configuration, indexer_bulk_resource: Option<models::IndexerBulkResource>) -> Result<(), Error<ApiV3IndexerBulkDeleteError>> {
141    let local_var_configuration = configuration;
142
143    let local_var_client = &local_var_configuration.client;
144
145    let local_var_uri_str = format!("{}/api/v3/indexer/bulk", local_var_configuration.base_path);
146    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
147
148    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
149        let local_var_key = local_var_apikey.key.clone();
150        let local_var_value = match local_var_apikey.prefix {
151            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
152            None => local_var_key,
153        };
154        local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
155    }
156    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
157        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
158    }
159    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
160        let local_var_key = local_var_apikey.key.clone();
161        let local_var_value = match local_var_apikey.prefix {
162            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
163            None => local_var_key,
164        };
165        local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
166    };
167    local_var_req_builder = local_var_req_builder.json(&indexer_bulk_resource);
168
169    let local_var_req = local_var_req_builder.build()?;
170    let local_var_resp = local_var_client.execute(local_var_req).await?;
171
172    let local_var_status = local_var_resp.status();
173    let local_var_content = local_var_resp.text().await?;
174
175    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
176        Ok(())
177    } else {
178        let local_var_entity: Option<ApiV3IndexerBulkDeleteError> = serde_json::from_str(&local_var_content).ok();
179        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
180        Err(Error::ResponseError(local_var_error))
181    }
182}
183
184pub async fn api_v3_indexer_bulk_put(configuration: &configuration::Configuration, indexer_bulk_resource: Option<models::IndexerBulkResource>) -> Result<models::IndexerResource, Error<ApiV3IndexerBulkPutError>> {
185    let local_var_configuration = configuration;
186
187    let local_var_client = &local_var_configuration.client;
188
189    let local_var_uri_str = format!("{}/api/v3/indexer/bulk", local_var_configuration.base_path);
190    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
191
192    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
193        let local_var_key = local_var_apikey.key.clone();
194        let local_var_value = match local_var_apikey.prefix {
195            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
196            None => local_var_key,
197        };
198        local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
199    }
200    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
201        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
202    }
203    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
204        let local_var_key = local_var_apikey.key.clone();
205        let local_var_value = match local_var_apikey.prefix {
206            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
207            None => local_var_key,
208        };
209        local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
210    };
211    local_var_req_builder = local_var_req_builder.json(&indexer_bulk_resource);
212
213    let local_var_req = local_var_req_builder.build()?;
214    let local_var_resp = local_var_client.execute(local_var_req).await?;
215
216    let local_var_status = local_var_resp.status();
217    let local_var_content = local_var_resp.text().await?;
218
219    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
220        serde_json::from_str(&local_var_content).map_err(Error::from)
221    } else {
222        let local_var_entity: Option<ApiV3IndexerBulkPutError> = serde_json::from_str(&local_var_content).ok();
223        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
224        Err(Error::ResponseError(local_var_error))
225    }
226}
227
228pub async fn api_v3_indexer_get(configuration: &configuration::Configuration, ) -> Result<Vec<models::IndexerResource>, Error<ApiV3IndexerGetError>> {
229    let local_var_configuration = configuration;
230
231    let local_var_client = &local_var_configuration.client;
232
233    let local_var_uri_str = format!("{}/api/v3/indexer", local_var_configuration.base_path);
234    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
235
236    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
237        let local_var_key = local_var_apikey.key.clone();
238        let local_var_value = match local_var_apikey.prefix {
239            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
240            None => local_var_key,
241        };
242        local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
243    }
244    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
245        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
246    }
247    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
248        let local_var_key = local_var_apikey.key.clone();
249        let local_var_value = match local_var_apikey.prefix {
250            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
251            None => local_var_key,
252        };
253        local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
254    };
255
256    let local_var_req = local_var_req_builder.build()?;
257    let local_var_resp = local_var_client.execute(local_var_req).await?;
258
259    let local_var_status = local_var_resp.status();
260    let local_var_content = local_var_resp.text().await?;
261
262    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
263        serde_json::from_str(&local_var_content).map_err(Error::from)
264    } else {
265        let local_var_entity: Option<ApiV3IndexerGetError> = serde_json::from_str(&local_var_content).ok();
266        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
267        Err(Error::ResponseError(local_var_error))
268    }
269}
270
271pub async fn api_v3_indexer_id_delete(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<ApiV3IndexerIdDeleteError>> {
272    let local_var_configuration = configuration;
273
274    let local_var_client = &local_var_configuration.client;
275
276    let local_var_uri_str = format!("{}/api/v3/indexer/{id}", local_var_configuration.base_path, id=id);
277    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
278
279    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
280        let local_var_key = local_var_apikey.key.clone();
281        let local_var_value = match local_var_apikey.prefix {
282            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
283            None => local_var_key,
284        };
285        local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
286    }
287    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
288        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
289    }
290    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
291        let local_var_key = local_var_apikey.key.clone();
292        let local_var_value = match local_var_apikey.prefix {
293            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
294            None => local_var_key,
295        };
296        local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
297    };
298
299    let local_var_req = local_var_req_builder.build()?;
300    let local_var_resp = local_var_client.execute(local_var_req).await?;
301
302    let local_var_status = local_var_resp.status();
303    let local_var_content = local_var_resp.text().await?;
304
305    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
306        Ok(())
307    } else {
308        let local_var_entity: Option<ApiV3IndexerIdDeleteError> = serde_json::from_str(&local_var_content).ok();
309        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
310        Err(Error::ResponseError(local_var_error))
311    }
312}
313
314pub async fn api_v3_indexer_id_get(configuration: &configuration::Configuration, id: i32) -> Result<models::IndexerResource, Error<ApiV3IndexerIdGetError>> {
315    let local_var_configuration = configuration;
316
317    let local_var_client = &local_var_configuration.client;
318
319    let local_var_uri_str = format!("{}/api/v3/indexer/{id}", local_var_configuration.base_path, id=id);
320    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
321
322    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
323        let local_var_key = local_var_apikey.key.clone();
324        let local_var_value = match local_var_apikey.prefix {
325            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
326            None => local_var_key,
327        };
328        local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
329    }
330    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
331        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
332    }
333    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
334        let local_var_key = local_var_apikey.key.clone();
335        let local_var_value = match local_var_apikey.prefix {
336            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
337            None => local_var_key,
338        };
339        local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
340    };
341
342    let local_var_req = local_var_req_builder.build()?;
343    let local_var_resp = local_var_client.execute(local_var_req).await?;
344
345    let local_var_status = local_var_resp.status();
346    let local_var_content = local_var_resp.text().await?;
347
348    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
349        serde_json::from_str(&local_var_content).map_err(Error::from)
350    } else {
351        let local_var_entity: Option<ApiV3IndexerIdGetError> = serde_json::from_str(&local_var_content).ok();
352        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
353        Err(Error::ResponseError(local_var_error))
354    }
355}
356
357pub async fn api_v3_indexer_id_put(configuration: &configuration::Configuration, id: &str, force_save: Option<bool>, indexer_resource: Option<models::IndexerResource>) -> Result<models::IndexerResource, Error<ApiV3IndexerIdPutError>> {
358    let local_var_configuration = configuration;
359
360    let local_var_client = &local_var_configuration.client;
361
362    let local_var_uri_str = format!("{}/api/v3/indexer/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id));
363    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
364
365    if let Some(ref local_var_str) = force_save {
366        local_var_req_builder = local_var_req_builder.query(&[("forceSave", &local_var_str.to_string())]);
367    }
368    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
369        let local_var_key = local_var_apikey.key.clone();
370        let local_var_value = match local_var_apikey.prefix {
371            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
372            None => local_var_key,
373        };
374        local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
375    }
376    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
377        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
378    }
379    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
380        let local_var_key = local_var_apikey.key.clone();
381        let local_var_value = match local_var_apikey.prefix {
382            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
383            None => local_var_key,
384        };
385        local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
386    };
387    local_var_req_builder = local_var_req_builder.json(&indexer_resource);
388
389    let local_var_req = local_var_req_builder.build()?;
390    let local_var_resp = local_var_client.execute(local_var_req).await?;
391
392    let local_var_status = local_var_resp.status();
393    let local_var_content = local_var_resp.text().await?;
394
395    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
396        serde_json::from_str(&local_var_content).map_err(Error::from)
397    } else {
398        let local_var_entity: Option<ApiV3IndexerIdPutError> = serde_json::from_str(&local_var_content).ok();
399        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
400        Err(Error::ResponseError(local_var_error))
401    }
402}
403
404pub async fn api_v3_indexer_post(configuration: &configuration::Configuration, force_save: Option<bool>, indexer_resource: Option<models::IndexerResource>) -> Result<models::IndexerResource, Error<ApiV3IndexerPostError>> {
405    let local_var_configuration = configuration;
406
407    let local_var_client = &local_var_configuration.client;
408
409    let local_var_uri_str = format!("{}/api/v3/indexer", local_var_configuration.base_path);
410    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
411
412    if let Some(ref local_var_str) = force_save {
413        local_var_req_builder = local_var_req_builder.query(&[("forceSave", &local_var_str.to_string())]);
414    }
415    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
416        let local_var_key = local_var_apikey.key.clone();
417        let local_var_value = match local_var_apikey.prefix {
418            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
419            None => local_var_key,
420        };
421        local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
422    }
423    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
424        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
425    }
426    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
427        let local_var_key = local_var_apikey.key.clone();
428        let local_var_value = match local_var_apikey.prefix {
429            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
430            None => local_var_key,
431        };
432        local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
433    };
434    local_var_req_builder = local_var_req_builder.json(&indexer_resource);
435
436    let local_var_req = local_var_req_builder.build()?;
437    let local_var_resp = local_var_client.execute(local_var_req).await?;
438
439    let local_var_status = local_var_resp.status();
440    let local_var_content = local_var_resp.text().await?;
441
442    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
443        serde_json::from_str(&local_var_content).map_err(Error::from)
444    } else {
445        let local_var_entity: Option<ApiV3IndexerPostError> = serde_json::from_str(&local_var_content).ok();
446        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
447        Err(Error::ResponseError(local_var_error))
448    }
449}
450
451pub async fn api_v3_indexer_schema_get(configuration: &configuration::Configuration, ) -> Result<Vec<models::IndexerResource>, Error<ApiV3IndexerSchemaGetError>> {
452    let local_var_configuration = configuration;
453
454    let local_var_client = &local_var_configuration.client;
455
456    let local_var_uri_str = format!("{}/api/v3/indexer/schema", local_var_configuration.base_path);
457    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
458
459    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
460        let local_var_key = local_var_apikey.key.clone();
461        let local_var_value = match local_var_apikey.prefix {
462            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
463            None => local_var_key,
464        };
465        local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
466    }
467    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
468        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
469    }
470    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
471        let local_var_key = local_var_apikey.key.clone();
472        let local_var_value = match local_var_apikey.prefix {
473            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
474            None => local_var_key,
475        };
476        local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
477    };
478
479    let local_var_req = local_var_req_builder.build()?;
480    let local_var_resp = local_var_client.execute(local_var_req).await?;
481
482    let local_var_status = local_var_resp.status();
483    let local_var_content = local_var_resp.text().await?;
484
485    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
486        serde_json::from_str(&local_var_content).map_err(Error::from)
487    } else {
488        let local_var_entity: Option<ApiV3IndexerSchemaGetError> = serde_json::from_str(&local_var_content).ok();
489        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
490        Err(Error::ResponseError(local_var_error))
491    }
492}
493
494pub async fn api_v3_indexer_test_post(configuration: &configuration::Configuration, force_test: Option<bool>, indexer_resource: Option<models::IndexerResource>) -> Result<(), Error<ApiV3IndexerTestPostError>> {
495    let local_var_configuration = configuration;
496
497    let local_var_client = &local_var_configuration.client;
498
499    let local_var_uri_str = format!("{}/api/v3/indexer/test", local_var_configuration.base_path);
500    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
501
502    if let Some(ref local_var_str) = force_test {
503        local_var_req_builder = local_var_req_builder.query(&[("forceTest", &local_var_str.to_string())]);
504    }
505    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
506        let local_var_key = local_var_apikey.key.clone();
507        let local_var_value = match local_var_apikey.prefix {
508            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
509            None => local_var_key,
510        };
511        local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
512    }
513    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
514        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
515    }
516    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
517        let local_var_key = local_var_apikey.key.clone();
518        let local_var_value = match local_var_apikey.prefix {
519            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
520            None => local_var_key,
521        };
522        local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
523    };
524    local_var_req_builder = local_var_req_builder.json(&indexer_resource);
525
526    let local_var_req = local_var_req_builder.build()?;
527    let local_var_resp = local_var_client.execute(local_var_req).await?;
528
529    let local_var_status = local_var_resp.status();
530    let local_var_content = local_var_resp.text().await?;
531
532    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
533        Ok(())
534    } else {
535        let local_var_entity: Option<ApiV3IndexerTestPostError> = serde_json::from_str(&local_var_content).ok();
536        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
537        Err(Error::ResponseError(local_var_error))
538    }
539}
540
541pub async fn api_v3_indexer_testall_post(configuration: &configuration::Configuration, ) -> Result<(), Error<ApiV3IndexerTestallPostError>> {
542    let local_var_configuration = configuration;
543
544    let local_var_client = &local_var_configuration.client;
545
546    let local_var_uri_str = format!("{}/api/v3/indexer/testall", local_var_configuration.base_path);
547    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
548
549    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
550        let local_var_key = local_var_apikey.key.clone();
551        let local_var_value = match local_var_apikey.prefix {
552            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
553            None => local_var_key,
554        };
555        local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
556    }
557    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
558        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
559    }
560    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
561        let local_var_key = local_var_apikey.key.clone();
562        let local_var_value = match local_var_apikey.prefix {
563            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
564            None => local_var_key,
565        };
566        local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
567    };
568
569    let local_var_req = local_var_req_builder.build()?;
570    let local_var_resp = local_var_client.execute(local_var_req).await?;
571
572    let local_var_status = local_var_resp.status();
573    let local_var_content = local_var_resp.text().await?;
574
575    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
576        Ok(())
577    } else {
578        let local_var_entity: Option<ApiV3IndexerTestallPostError> = serde_json::from_str(&local_var_content).ok();
579        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
580        Err(Error::ResponseError(local_var_error))
581    }
582}
583