1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetAllBooksDeprecatedError {
22 Status400(models::ValidationErrorResponse),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum GetAuthorsDeprecatedError {
30 Status400(models::ValidationErrorResponse),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum GetBooksBySeriesIdError {
38 Status400(models::ValidationErrorResponse),
39 UnknownValue(serde_json::Value),
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum GetSeriesAlphabeticalGroupsDeprecatedError {
46 Status400(models::ValidationErrorResponse),
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum GetSeriesDeprecatedError {
54 Status400(models::ValidationErrorResponse),
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum UpdateLibraryByIdDeprecatedError {
62 Status400(models::ValidationErrorResponse),
63 UnknownValue(serde_json::Value),
64}
65
66
67pub async fn get_all_books_deprecated(configuration: &configuration::Configuration, search: Option<&str>, library_id: Option<Vec<String>>, media_status: Option<Vec<String>>, read_status: Option<Vec<String>>, released_after: Option<String>, tag: Option<Vec<String>>, unpaged: Option<bool>, page: Option<i32>, size: Option<i32>, sort: Option<Vec<String>>) -> Result<models::PageBookDto, Error<GetAllBooksDeprecatedError>> {
69 let p_query_search = search;
71 let p_query_library_id = library_id;
72 let p_query_media_status = media_status;
73 let p_query_read_status = read_status;
74 let p_query_released_after = released_after;
75 let p_query_tag = tag;
76 let p_query_unpaged = unpaged;
77 let p_query_page = page;
78 let p_query_size = size;
79 let p_query_sort = sort;
80
81 let uri_str = format!("{}/api/v1/books", configuration.base_path);
82 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
83
84 if let Some(ref param_value) = p_query_search {
85 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
86 }
87 if let Some(ref param_value) = p_query_library_id {
88 req_builder = match "multi" {
89 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("library_id".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
90 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
91 };
92 }
93 if let Some(ref param_value) = p_query_media_status {
94 req_builder = match "multi" {
95 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("media_status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
96 _ => req_builder.query(&[("media_status", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
97 };
98 }
99 if let Some(ref param_value) = p_query_read_status {
100 req_builder = match "multi" {
101 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("read_status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
102 _ => req_builder.query(&[("read_status", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
103 };
104 }
105 if let Some(ref param_value) = p_query_released_after {
106 req_builder = req_builder.query(&[("released_after", ¶m_value.to_string())]);
107 }
108 if let Some(ref param_value) = p_query_tag {
109 req_builder = match "multi" {
110 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("tag".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
111 _ => req_builder.query(&[("tag", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
112 };
113 }
114 if let Some(ref param_value) = p_query_unpaged {
115 req_builder = req_builder.query(&[("unpaged", ¶m_value.to_string())]);
116 }
117 if let Some(ref param_value) = p_query_page {
118 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
119 }
120 if let Some(ref param_value) = p_query_size {
121 req_builder = req_builder.query(&[("size", ¶m_value.to_string())]);
122 }
123 if let Some(ref param_value) = p_query_sort {
124 req_builder = match "multi" {
125 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("sort".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
126 _ => req_builder.query(&[("sort", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
127 };
128 }
129 if let Some(ref user_agent) = configuration.user_agent {
130 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
131 }
132 if let Some(ref apikey) = configuration.api_key {
133 let key = apikey.key.clone();
134 let value = match apikey.prefix {
135 Some(ref prefix) => format!("{} {}", prefix, key),
136 None => key,
137 };
138 req_builder = req_builder.header("X-API-Key", value);
139 };
140 if let Some(ref auth_conf) = configuration.basic_auth {
141 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
142 };
143
144 let req = req_builder.build()?;
145 let resp = configuration.client.execute(req).await?;
146
147 let status = resp.status();
148 let content_type = resp
149 .headers()
150 .get("content-type")
151 .and_then(|v| v.to_str().ok())
152 .unwrap_or("application/octet-stream");
153 let content_type = super::ContentType::from(content_type);
154
155 if !status.is_client_error() && !status.is_server_error() {
156 let content = resp.text().await?;
157 match content_type {
158 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
159 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PageBookDto`"))),
160 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::PageBookDto`")))),
161 }
162 } else {
163 let content = resp.text().await?;
164 let entity: Option<GetAllBooksDeprecatedError> = serde_json::from_str(&content).ok();
165 Err(Error::ResponseError(ResponseContent { status, content, entity }))
166 }
167}
168
169pub async fn get_authors_deprecated(configuration: &configuration::Configuration, search: Option<&str>, library_id: Option<&str>, collection_id: Option<&str>, series_id: Option<&str>) -> Result<Vec<models::AuthorDto>, Error<GetAuthorsDeprecatedError>> {
171 let p_query_search = search;
173 let p_query_library_id = library_id;
174 let p_query_collection_id = collection_id;
175 let p_query_series_id = series_id;
176
177 let uri_str = format!("{}/api/v1/authors", configuration.base_path);
178 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
179
180 if let Some(ref param_value) = p_query_search {
181 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
182 }
183 if let Some(ref param_value) = p_query_library_id {
184 req_builder = req_builder.query(&[("library_id", ¶m_value.to_string())]);
185 }
186 if let Some(ref param_value) = p_query_collection_id {
187 req_builder = req_builder.query(&[("collection_id", ¶m_value.to_string())]);
188 }
189 if let Some(ref param_value) = p_query_series_id {
190 req_builder = req_builder.query(&[("series_id", ¶m_value.to_string())]);
191 }
192 if let Some(ref user_agent) = configuration.user_agent {
193 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
194 }
195 if let Some(ref apikey) = configuration.api_key {
196 let key = apikey.key.clone();
197 let value = match apikey.prefix {
198 Some(ref prefix) => format!("{} {}", prefix, key),
199 None => key,
200 };
201 req_builder = req_builder.header("X-API-Key", value);
202 };
203 if let Some(ref auth_conf) = configuration.basic_auth {
204 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
205 };
206
207 let req = req_builder.build()?;
208 let resp = configuration.client.execute(req).await?;
209
210 let status = resp.status();
211 let content_type = resp
212 .headers()
213 .get("content-type")
214 .and_then(|v| v.to_str().ok())
215 .unwrap_or("application/octet-stream");
216 let content_type = super::ContentType::from(content_type);
217
218 if !status.is_client_error() && !status.is_server_error() {
219 let content = resp.text().await?;
220 match content_type {
221 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
222 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::AuthorDto>`"))),
223 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<models::AuthorDto>`")))),
224 }
225 } else {
226 let content = resp.text().await?;
227 let entity: Option<GetAuthorsDeprecatedError> = serde_json::from_str(&content).ok();
228 Err(Error::ResponseError(ResponseContent { status, content, entity }))
229 }
230}
231
232pub async fn get_books_by_series_id(configuration: &configuration::Configuration, series_id: &str, media_status: Option<Vec<String>>, read_status: Option<Vec<String>>, tag: Option<Vec<String>>, deleted: Option<bool>, unpaged: Option<bool>, page: Option<i32>, size: Option<i32>, sort: Option<Vec<String>>, author: Option<Vec<String>>) -> Result<models::PageBookDto, Error<GetBooksBySeriesIdError>> {
234 let p_path_series_id = series_id;
236 let p_query_media_status = media_status;
237 let p_query_read_status = read_status;
238 let p_query_tag = tag;
239 let p_query_deleted = deleted;
240 let p_query_unpaged = unpaged;
241 let p_query_page = page;
242 let p_query_size = size;
243 let p_query_sort = sort;
244 let p_query_author = author;
245
246 let uri_str = format!("{}/api/v1/series/{seriesId}/books", configuration.base_path, seriesId=crate::apis::urlencode(p_path_series_id));
247 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
248
249 if let Some(ref param_value) = p_query_media_status {
250 req_builder = match "multi" {
251 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("media_status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
252 _ => req_builder.query(&[("media_status", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
253 };
254 }
255 if let Some(ref param_value) = p_query_read_status {
256 req_builder = match "multi" {
257 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("read_status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
258 _ => req_builder.query(&[("read_status", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
259 };
260 }
261 if let Some(ref param_value) = p_query_tag {
262 req_builder = match "multi" {
263 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("tag".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
264 _ => req_builder.query(&[("tag", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
265 };
266 }
267 if let Some(ref param_value) = p_query_deleted {
268 req_builder = req_builder.query(&[("deleted", ¶m_value.to_string())]);
269 }
270 if let Some(ref param_value) = p_query_unpaged {
271 req_builder = req_builder.query(&[("unpaged", ¶m_value.to_string())]);
272 }
273 if let Some(ref param_value) = p_query_page {
274 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
275 }
276 if let Some(ref param_value) = p_query_size {
277 req_builder = req_builder.query(&[("size", ¶m_value.to_string())]);
278 }
279 if let Some(ref param_value) = p_query_sort {
280 req_builder = match "multi" {
281 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("sort".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
282 _ => req_builder.query(&[("sort", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
283 };
284 }
285 if let Some(ref param_value) = p_query_author {
286 req_builder = match "multi" {
287 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("author".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
288 _ => req_builder.query(&[("author", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
289 };
290 }
291 if let Some(ref user_agent) = configuration.user_agent {
292 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
293 }
294 if let Some(ref apikey) = configuration.api_key {
295 let key = apikey.key.clone();
296 let value = match apikey.prefix {
297 Some(ref prefix) => format!("{} {}", prefix, key),
298 None => key,
299 };
300 req_builder = req_builder.header("X-API-Key", value);
301 };
302 if let Some(ref auth_conf) = configuration.basic_auth {
303 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
304 };
305
306 let req = req_builder.build()?;
307 let resp = configuration.client.execute(req).await?;
308
309 let status = resp.status();
310 let content_type = resp
311 .headers()
312 .get("content-type")
313 .and_then(|v| v.to_str().ok())
314 .unwrap_or("application/octet-stream");
315 let content_type = super::ContentType::from(content_type);
316
317 if !status.is_client_error() && !status.is_server_error() {
318 let content = resp.text().await?;
319 match content_type {
320 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
321 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PageBookDto`"))),
322 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::PageBookDto`")))),
323 }
324 } else {
325 let content = resp.text().await?;
326 let entity: Option<GetBooksBySeriesIdError> = serde_json::from_str(&content).ok();
327 Err(Error::ResponseError(ResponseContent { status, content, entity }))
328 }
329}
330
331pub async fn get_series_alphabetical_groups_deprecated(configuration: &configuration::Configuration, search: Option<&str>, library_id: Option<Vec<String>>, collection_id: Option<Vec<String>>, status: Option<Vec<String>>, read_status: Option<Vec<String>>, publisher: Option<Vec<String>>, language: Option<Vec<String>>, genre: Option<Vec<String>>, tag: Option<Vec<String>>, age_rating: Option<Vec<String>>, release_year: Option<Vec<String>>, sharing_label: Option<Vec<String>>, deleted: Option<bool>, complete: Option<bool>, oneshot: Option<bool>, search_regex: Option<&str>, author: Option<Vec<String>>) -> Result<Vec<models::GroupCountDto>, Error<GetSeriesAlphabeticalGroupsDeprecatedError>> {
333 let p_query_search = search;
335 let p_query_library_id = library_id;
336 let p_query_collection_id = collection_id;
337 let p_query_status = status;
338 let p_query_read_status = read_status;
339 let p_query_publisher = publisher;
340 let p_query_language = language;
341 let p_query_genre = genre;
342 let p_query_tag = tag;
343 let p_query_age_rating = age_rating;
344 let p_query_release_year = release_year;
345 let p_query_sharing_label = sharing_label;
346 let p_query_deleted = deleted;
347 let p_query_complete = complete;
348 let p_query_oneshot = oneshot;
349 let p_query_search_regex = search_regex;
350 let p_query_author = author;
351
352 let uri_str = format!("{}/api/v1/series/alphabetical-groups", configuration.base_path);
353 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
354
355 if let Some(ref param_value) = p_query_search {
356 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
357 }
358 if let Some(ref param_value) = p_query_library_id {
359 req_builder = match "multi" {
360 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("library_id".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
361 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
362 };
363 }
364 if let Some(ref param_value) = p_query_collection_id {
365 req_builder = match "multi" {
366 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("collection_id".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
367 _ => req_builder.query(&[("collection_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
368 };
369 }
370 if let Some(ref param_value) = p_query_status {
371 req_builder = match "multi" {
372 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
373 _ => req_builder.query(&[("status", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
374 };
375 }
376 if let Some(ref param_value) = p_query_read_status {
377 req_builder = match "multi" {
378 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("read_status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
379 _ => req_builder.query(&[("read_status", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
380 };
381 }
382 if let Some(ref param_value) = p_query_publisher {
383 req_builder = match "multi" {
384 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("publisher".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
385 _ => req_builder.query(&[("publisher", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
386 };
387 }
388 if let Some(ref param_value) = p_query_language {
389 req_builder = match "multi" {
390 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("language".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
391 _ => req_builder.query(&[("language", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
392 };
393 }
394 if let Some(ref param_value) = p_query_genre {
395 req_builder = match "multi" {
396 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("genre".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
397 _ => req_builder.query(&[("genre", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
398 };
399 }
400 if let Some(ref param_value) = p_query_tag {
401 req_builder = match "multi" {
402 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("tag".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
403 _ => req_builder.query(&[("tag", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
404 };
405 }
406 if let Some(ref param_value) = p_query_age_rating {
407 req_builder = match "multi" {
408 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("age_rating".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
409 _ => req_builder.query(&[("age_rating", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
410 };
411 }
412 if let Some(ref param_value) = p_query_release_year {
413 req_builder = match "multi" {
414 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("release_year".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
415 _ => req_builder.query(&[("release_year", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
416 };
417 }
418 if let Some(ref param_value) = p_query_sharing_label {
419 req_builder = match "multi" {
420 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("sharing_label".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
421 _ => req_builder.query(&[("sharing_label", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
422 };
423 }
424 if let Some(ref param_value) = p_query_deleted {
425 req_builder = req_builder.query(&[("deleted", ¶m_value.to_string())]);
426 }
427 if let Some(ref param_value) = p_query_complete {
428 req_builder = req_builder.query(&[("complete", ¶m_value.to_string())]);
429 }
430 if let Some(ref param_value) = p_query_oneshot {
431 req_builder = req_builder.query(&[("oneshot", ¶m_value.to_string())]);
432 }
433 if let Some(ref param_value) = p_query_search_regex {
434 req_builder = req_builder.query(&[("search_regex", ¶m_value.to_string())]);
435 }
436 if let Some(ref param_value) = p_query_author {
437 req_builder = match "multi" {
438 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("author".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
439 _ => req_builder.query(&[("author", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
440 };
441 }
442 if let Some(ref user_agent) = configuration.user_agent {
443 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
444 }
445 if let Some(ref apikey) = configuration.api_key {
446 let key = apikey.key.clone();
447 let value = match apikey.prefix {
448 Some(ref prefix) => format!("{} {}", prefix, key),
449 None => key,
450 };
451 req_builder = req_builder.header("X-API-Key", value);
452 };
453 if let Some(ref auth_conf) = configuration.basic_auth {
454 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
455 };
456
457 let req = req_builder.build()?;
458 let resp = configuration.client.execute(req).await?;
459
460 let status = resp.status();
461 let content_type = resp
462 .headers()
463 .get("content-type")
464 .and_then(|v| v.to_str().ok())
465 .unwrap_or("application/octet-stream");
466 let content_type = super::ContentType::from(content_type);
467
468 if !status.is_client_error() && !status.is_server_error() {
469 let content = resp.text().await?;
470 match content_type {
471 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
472 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GroupCountDto>`"))),
473 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<models::GroupCountDto>`")))),
474 }
475 } else {
476 let content = resp.text().await?;
477 let entity: Option<GetSeriesAlphabeticalGroupsDeprecatedError> = serde_json::from_str(&content).ok();
478 Err(Error::ResponseError(ResponseContent { status, content, entity }))
479 }
480}
481
482pub async fn get_series_deprecated(configuration: &configuration::Configuration, search: Option<&str>, library_id: Option<Vec<String>>, collection_id: Option<Vec<String>>, status: Option<Vec<String>>, read_status: Option<Vec<String>>, publisher: Option<Vec<String>>, language: Option<Vec<String>>, genre: Option<Vec<String>>, tag: Option<Vec<String>>, age_rating: Option<Vec<String>>, release_year: Option<Vec<String>>, sharing_label: Option<Vec<String>>, deleted: Option<bool>, complete: Option<bool>, oneshot: Option<bool>, unpaged: Option<bool>, search_regex: Option<&str>, page: Option<i32>, size: Option<i32>, sort: Option<Vec<String>>, author: Option<Vec<String>>) -> Result<models::PageSeriesDto, Error<GetSeriesDeprecatedError>> {
484 let p_query_search = search;
486 let p_query_library_id = library_id;
487 let p_query_collection_id = collection_id;
488 let p_query_status = status;
489 let p_query_read_status = read_status;
490 let p_query_publisher = publisher;
491 let p_query_language = language;
492 let p_query_genre = genre;
493 let p_query_tag = tag;
494 let p_query_age_rating = age_rating;
495 let p_query_release_year = release_year;
496 let p_query_sharing_label = sharing_label;
497 let p_query_deleted = deleted;
498 let p_query_complete = complete;
499 let p_query_oneshot = oneshot;
500 let p_query_unpaged = unpaged;
501 let p_query_search_regex = search_regex;
502 let p_query_page = page;
503 let p_query_size = size;
504 let p_query_sort = sort;
505 let p_query_author = author;
506
507 let uri_str = format!("{}/api/v1/series", configuration.base_path);
508 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
509
510 if let Some(ref param_value) = p_query_search {
511 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
512 }
513 if let Some(ref param_value) = p_query_library_id {
514 req_builder = match "multi" {
515 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("library_id".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
516 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
517 };
518 }
519 if let Some(ref param_value) = p_query_collection_id {
520 req_builder = match "multi" {
521 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("collection_id".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
522 _ => req_builder.query(&[("collection_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
523 };
524 }
525 if let Some(ref param_value) = p_query_status {
526 req_builder = match "multi" {
527 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
528 _ => req_builder.query(&[("status", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
529 };
530 }
531 if let Some(ref param_value) = p_query_read_status {
532 req_builder = match "multi" {
533 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("read_status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
534 _ => req_builder.query(&[("read_status", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
535 };
536 }
537 if let Some(ref param_value) = p_query_publisher {
538 req_builder = match "multi" {
539 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("publisher".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
540 _ => req_builder.query(&[("publisher", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
541 };
542 }
543 if let Some(ref param_value) = p_query_language {
544 req_builder = match "multi" {
545 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("language".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
546 _ => req_builder.query(&[("language", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
547 };
548 }
549 if let Some(ref param_value) = p_query_genre {
550 req_builder = match "multi" {
551 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("genre".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
552 _ => req_builder.query(&[("genre", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
553 };
554 }
555 if let Some(ref param_value) = p_query_tag {
556 req_builder = match "multi" {
557 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("tag".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
558 _ => req_builder.query(&[("tag", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
559 };
560 }
561 if let Some(ref param_value) = p_query_age_rating {
562 req_builder = match "multi" {
563 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("age_rating".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
564 _ => req_builder.query(&[("age_rating", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
565 };
566 }
567 if let Some(ref param_value) = p_query_release_year {
568 req_builder = match "multi" {
569 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("release_year".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
570 _ => req_builder.query(&[("release_year", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
571 };
572 }
573 if let Some(ref param_value) = p_query_sharing_label {
574 req_builder = match "multi" {
575 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("sharing_label".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
576 _ => req_builder.query(&[("sharing_label", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
577 };
578 }
579 if let Some(ref param_value) = p_query_deleted {
580 req_builder = req_builder.query(&[("deleted", ¶m_value.to_string())]);
581 }
582 if let Some(ref param_value) = p_query_complete {
583 req_builder = req_builder.query(&[("complete", ¶m_value.to_string())]);
584 }
585 if let Some(ref param_value) = p_query_oneshot {
586 req_builder = req_builder.query(&[("oneshot", ¶m_value.to_string())]);
587 }
588 if let Some(ref param_value) = p_query_unpaged {
589 req_builder = req_builder.query(&[("unpaged", ¶m_value.to_string())]);
590 }
591 if let Some(ref param_value) = p_query_search_regex {
592 req_builder = req_builder.query(&[("search_regex", ¶m_value.to_string())]);
593 }
594 if let Some(ref param_value) = p_query_page {
595 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
596 }
597 if let Some(ref param_value) = p_query_size {
598 req_builder = req_builder.query(&[("size", ¶m_value.to_string())]);
599 }
600 if let Some(ref param_value) = p_query_sort {
601 req_builder = match "multi" {
602 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("sort".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
603 _ => req_builder.query(&[("sort", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
604 };
605 }
606 if let Some(ref param_value) = p_query_author {
607 req_builder = match "multi" {
608 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("author".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
609 _ => req_builder.query(&[("author", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
610 };
611 }
612 if let Some(ref user_agent) = configuration.user_agent {
613 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
614 }
615 if let Some(ref apikey) = configuration.api_key {
616 let key = apikey.key.clone();
617 let value = match apikey.prefix {
618 Some(ref prefix) => format!("{} {}", prefix, key),
619 None => key,
620 };
621 req_builder = req_builder.header("X-API-Key", value);
622 };
623 if let Some(ref auth_conf) = configuration.basic_auth {
624 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
625 };
626
627 let req = req_builder.build()?;
628 let resp = configuration.client.execute(req).await?;
629
630 let status = resp.status();
631 let content_type = resp
632 .headers()
633 .get("content-type")
634 .and_then(|v| v.to_str().ok())
635 .unwrap_or("application/octet-stream");
636 let content_type = super::ContentType::from(content_type);
637
638 if !status.is_client_error() && !status.is_server_error() {
639 let content = resp.text().await?;
640 match content_type {
641 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
642 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PageSeriesDto`"))),
643 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::PageSeriesDto`")))),
644 }
645 } else {
646 let content = resp.text().await?;
647 let entity: Option<GetSeriesDeprecatedError> = serde_json::from_str(&content).ok();
648 Err(Error::ResponseError(ResponseContent { status, content, entity }))
649 }
650}
651
652pub async fn update_library_by_id_deprecated(configuration: &configuration::Configuration, library_id: &str, library_update_dto: models::LibraryUpdateDto) -> Result<(), Error<UpdateLibraryByIdDeprecatedError>> {
654 let p_path_library_id = library_id;
656 let p_body_library_update_dto = library_update_dto;
657
658 let uri_str = format!("{}/api/v1/libraries/{libraryId}", configuration.base_path, libraryId=crate::apis::urlencode(p_path_library_id));
659 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
660
661 if let Some(ref user_agent) = configuration.user_agent {
662 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
663 }
664 if let Some(ref apikey) = configuration.api_key {
665 let key = apikey.key.clone();
666 let value = match apikey.prefix {
667 Some(ref prefix) => format!("{} {}", prefix, key),
668 None => key,
669 };
670 req_builder = req_builder.header("X-API-Key", value);
671 };
672 if let Some(ref auth_conf) = configuration.basic_auth {
673 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
674 };
675 req_builder = req_builder.json(&p_body_library_update_dto);
676
677 let req = req_builder.build()?;
678 let resp = configuration.client.execute(req).await?;
679
680 let status = resp.status();
681
682 if !status.is_client_error() && !status.is_server_error() {
683 Ok(())
684 } else {
685 let content = resp.text().await?;
686 let entity: Option<UpdateLibraryByIdDeprecatedError> = serde_json::from_str(&content).ok();
687 Err(Error::ResponseError(ResponseContent { status, content, entity }))
688 }
689}
690