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 GetAgeRatingsError {
22 Status400(models::ValidationErrorResponse),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum GetAuthorsError {
30 Status400(models::ValidationErrorResponse),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum GetAuthorsDeprecatedError {
38 Status400(models::ValidationErrorResponse),
39 UnknownValue(serde_json::Value),
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum GetAuthorsNamesError {
46 Status400(models::ValidationErrorResponse),
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum GetAuthorsRolesError {
54 Status400(models::ValidationErrorResponse),
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum GetBookTagsError {
62 Status400(models::ValidationErrorResponse),
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum GetGenresError {
70 Status400(models::ValidationErrorResponse),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetLanguagesError {
78 Status400(models::ValidationErrorResponse),
79 UnknownValue(serde_json::Value),
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum GetPublishersError {
86 Status400(models::ValidationErrorResponse),
87 UnknownValue(serde_json::Value),
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum GetSeriesReleaseDatesError {
94 Status400(models::ValidationErrorResponse),
95 UnknownValue(serde_json::Value),
96}
97
98#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum GetSeriesTagsError {
102 Status400(models::ValidationErrorResponse),
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum GetSharingLabelsError {
110 Status400(models::ValidationErrorResponse),
111 UnknownValue(serde_json::Value),
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum GetTagsError {
118 Status400(models::ValidationErrorResponse),
119 UnknownValue(serde_json::Value),
120}
121
122
123pub async fn get_age_ratings(configuration: &configuration::Configuration, library_id: Option<Vec<String>>, collection_id: Option<&str>) -> Result<Vec<String>, Error<GetAgeRatingsError>> {
125 let p_query_library_id = library_id;
127 let p_query_collection_id = collection_id;
128
129 let uri_str = format!("{}/api/v1/age-ratings", configuration.base_path);
130 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
131
132 if let Some(ref param_value) = p_query_library_id {
133 req_builder = match "multi" {
134 "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)>>()),
135 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
136 };
137 }
138 if let Some(ref param_value) = p_query_collection_id {
139 req_builder = req_builder.query(&[("collection_id", ¶m_value.to_string())]);
140 }
141 if let Some(ref user_agent) = configuration.user_agent {
142 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
143 }
144 if let Some(ref apikey) = configuration.api_key {
145 let key = apikey.key.clone();
146 let value = match apikey.prefix {
147 Some(ref prefix) => format!("{} {}", prefix, key),
148 None => key,
149 };
150 req_builder = req_builder.header("X-API-Key", value);
151 };
152 if let Some(ref auth_conf) = configuration.basic_auth {
153 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
154 };
155
156 let req = req_builder.build()?;
157 let resp = configuration.client.execute(req).await?;
158
159 let status = resp.status();
160 let content_type = resp
161 .headers()
162 .get("content-type")
163 .and_then(|v| v.to_str().ok())
164 .unwrap_or("application/octet-stream");
165 let content_type = super::ContentType::from(content_type);
166
167 if !status.is_client_error() && !status.is_server_error() {
168 let content = resp.text().await?;
169 match content_type {
170 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
171 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
172 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<String>`")))),
173 }
174 } else {
175 let content = resp.text().await?;
176 let entity: Option<GetAgeRatingsError> = serde_json::from_str(&content).ok();
177 Err(Error::ResponseError(ResponseContent { status, content, entity }))
178 }
179}
180
181pub async fn get_authors(configuration: &configuration::Configuration, search: Option<&str>, role: Option<&str>, library_id: Option<Vec<String>>, collection_id: Option<&str>, series_id: Option<&str>, readlist_id: Option<&str>, unpaged: Option<bool>, page: Option<i32>, size: Option<i32>) -> Result<models::PageAuthorDto, Error<GetAuthorsError>> {
183 let p_query_search = search;
185 let p_query_role = role;
186 let p_query_library_id = library_id;
187 let p_query_collection_id = collection_id;
188 let p_query_series_id = series_id;
189 let p_query_readlist_id = readlist_id;
190 let p_query_unpaged = unpaged;
191 let p_query_page = page;
192 let p_query_size = size;
193
194 let uri_str = format!("{}/api/v2/authors", configuration.base_path);
195 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
196
197 if let Some(ref param_value) = p_query_search {
198 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
199 }
200 if let Some(ref param_value) = p_query_role {
201 req_builder = req_builder.query(&[("role", ¶m_value.to_string())]);
202 }
203 if let Some(ref param_value) = p_query_library_id {
204 req_builder = match "multi" {
205 "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)>>()),
206 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
207 };
208 }
209 if let Some(ref param_value) = p_query_collection_id {
210 req_builder = req_builder.query(&[("collection_id", ¶m_value.to_string())]);
211 }
212 if let Some(ref param_value) = p_query_series_id {
213 req_builder = req_builder.query(&[("series_id", ¶m_value.to_string())]);
214 }
215 if let Some(ref param_value) = p_query_readlist_id {
216 req_builder = req_builder.query(&[("readlist_id", ¶m_value.to_string())]);
217 }
218 if let Some(ref param_value) = p_query_unpaged {
219 req_builder = req_builder.query(&[("unpaged", ¶m_value.to_string())]);
220 }
221 if let Some(ref param_value) = p_query_page {
222 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
223 }
224 if let Some(ref param_value) = p_query_size {
225 req_builder = req_builder.query(&[("size", ¶m_value.to_string())]);
226 }
227 if let Some(ref user_agent) = configuration.user_agent {
228 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
229 }
230 if let Some(ref apikey) = configuration.api_key {
231 let key = apikey.key.clone();
232 let value = match apikey.prefix {
233 Some(ref prefix) => format!("{} {}", prefix, key),
234 None => key,
235 };
236 req_builder = req_builder.header("X-API-Key", value);
237 };
238 if let Some(ref auth_conf) = configuration.basic_auth {
239 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
240 };
241
242 let req = req_builder.build()?;
243 let resp = configuration.client.execute(req).await?;
244
245 let status = resp.status();
246 let content_type = resp
247 .headers()
248 .get("content-type")
249 .and_then(|v| v.to_str().ok())
250 .unwrap_or("application/octet-stream");
251 let content_type = super::ContentType::from(content_type);
252
253 if !status.is_client_error() && !status.is_server_error() {
254 let content = resp.text().await?;
255 match content_type {
256 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
257 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PageAuthorDto`"))),
258 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::PageAuthorDto`")))),
259 }
260 } else {
261 let content = resp.text().await?;
262 let entity: Option<GetAuthorsError> = serde_json::from_str(&content).ok();
263 Err(Error::ResponseError(ResponseContent { status, content, entity }))
264 }
265}
266
267pub 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>> {
269 let p_query_search = search;
271 let p_query_library_id = library_id;
272 let p_query_collection_id = collection_id;
273 let p_query_series_id = series_id;
274
275 let uri_str = format!("{}/api/v1/authors", configuration.base_path);
276 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
277
278 if let Some(ref param_value) = p_query_search {
279 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
280 }
281 if let Some(ref param_value) = p_query_library_id {
282 req_builder = req_builder.query(&[("library_id", ¶m_value.to_string())]);
283 }
284 if let Some(ref param_value) = p_query_collection_id {
285 req_builder = req_builder.query(&[("collection_id", ¶m_value.to_string())]);
286 }
287 if let Some(ref param_value) = p_query_series_id {
288 req_builder = req_builder.query(&[("series_id", ¶m_value.to_string())]);
289 }
290 if let Some(ref user_agent) = configuration.user_agent {
291 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
292 }
293 if let Some(ref apikey) = configuration.api_key {
294 let key = apikey.key.clone();
295 let value = match apikey.prefix {
296 Some(ref prefix) => format!("{} {}", prefix, key),
297 None => key,
298 };
299 req_builder = req_builder.header("X-API-Key", value);
300 };
301 if let Some(ref auth_conf) = configuration.basic_auth {
302 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
303 };
304
305 let req = req_builder.build()?;
306 let resp = configuration.client.execute(req).await?;
307
308 let status = resp.status();
309 let content_type = resp
310 .headers()
311 .get("content-type")
312 .and_then(|v| v.to_str().ok())
313 .unwrap_or("application/octet-stream");
314 let content_type = super::ContentType::from(content_type);
315
316 if !status.is_client_error() && !status.is_server_error() {
317 let content = resp.text().await?;
318 match content_type {
319 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
320 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::AuthorDto>`"))),
321 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>`")))),
322 }
323 } else {
324 let content = resp.text().await?;
325 let entity: Option<GetAuthorsDeprecatedError> = serde_json::from_str(&content).ok();
326 Err(Error::ResponseError(ResponseContent { status, content, entity }))
327 }
328}
329
330pub async fn get_authors_names(configuration: &configuration::Configuration, search: Option<&str>) -> Result<Vec<String>, Error<GetAuthorsNamesError>> {
331 let p_query_search = search;
333
334 let uri_str = format!("{}/api/v1/authors/names", configuration.base_path);
335 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
336
337 if let Some(ref param_value) = p_query_search {
338 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
339 }
340 if let Some(ref user_agent) = configuration.user_agent {
341 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
342 }
343 if let Some(ref apikey) = configuration.api_key {
344 let key = apikey.key.clone();
345 let value = match apikey.prefix {
346 Some(ref prefix) => format!("{} {}", prefix, key),
347 None => key,
348 };
349 req_builder = req_builder.header("X-API-Key", value);
350 };
351 if let Some(ref auth_conf) = configuration.basic_auth {
352 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
353 };
354
355 let req = req_builder.build()?;
356 let resp = configuration.client.execute(req).await?;
357
358 let status = resp.status();
359 let content_type = resp
360 .headers()
361 .get("content-type")
362 .and_then(|v| v.to_str().ok())
363 .unwrap_or("application/octet-stream");
364 let content_type = super::ContentType::from(content_type);
365
366 if !status.is_client_error() && !status.is_server_error() {
367 let content = resp.text().await?;
368 match content_type {
369 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
370 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
371 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<String>`")))),
372 }
373 } else {
374 let content = resp.text().await?;
375 let entity: Option<GetAuthorsNamesError> = serde_json::from_str(&content).ok();
376 Err(Error::ResponseError(ResponseContent { status, content, entity }))
377 }
378}
379
380pub async fn get_authors_roles(configuration: &configuration::Configuration, ) -> Result<Vec<String>, Error<GetAuthorsRolesError>> {
381
382 let uri_str = format!("{}/api/v1/authors/roles", configuration.base_path);
383 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
384
385 if let Some(ref user_agent) = configuration.user_agent {
386 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
387 }
388 if let Some(ref apikey) = configuration.api_key {
389 let key = apikey.key.clone();
390 let value = match apikey.prefix {
391 Some(ref prefix) => format!("{} {}", prefix, key),
392 None => key,
393 };
394 req_builder = req_builder.header("X-API-Key", value);
395 };
396 if let Some(ref auth_conf) = configuration.basic_auth {
397 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
398 };
399
400 let req = req_builder.build()?;
401 let resp = configuration.client.execute(req).await?;
402
403 let status = resp.status();
404 let content_type = resp
405 .headers()
406 .get("content-type")
407 .and_then(|v| v.to_str().ok())
408 .unwrap_or("application/octet-stream");
409 let content_type = super::ContentType::from(content_type);
410
411 if !status.is_client_error() && !status.is_server_error() {
412 let content = resp.text().await?;
413 match content_type {
414 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
415 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
416 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<String>`")))),
417 }
418 } else {
419 let content = resp.text().await?;
420 let entity: Option<GetAuthorsRolesError> = serde_json::from_str(&content).ok();
421 Err(Error::ResponseError(ResponseContent { status, content, entity }))
422 }
423}
424
425pub async fn get_book_tags(configuration: &configuration::Configuration, series_id: Option<&str>, readlist_id: Option<&str>, library_id: Option<Vec<String>>) -> Result<Vec<String>, Error<GetBookTagsError>> {
427 let p_query_series_id = series_id;
429 let p_query_readlist_id = readlist_id;
430 let p_query_library_id = library_id;
431
432 let uri_str = format!("{}/api/v1/tags/book", configuration.base_path);
433 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
434
435 if let Some(ref param_value) = p_query_series_id {
436 req_builder = req_builder.query(&[("series_id", ¶m_value.to_string())]);
437 }
438 if let Some(ref param_value) = p_query_readlist_id {
439 req_builder = req_builder.query(&[("readlist_id", ¶m_value.to_string())]);
440 }
441 if let Some(ref param_value) = p_query_library_id {
442 req_builder = match "multi" {
443 "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)>>()),
444 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
445 };
446 }
447 if let Some(ref user_agent) = configuration.user_agent {
448 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
449 }
450 if let Some(ref apikey) = configuration.api_key {
451 let key = apikey.key.clone();
452 let value = match apikey.prefix {
453 Some(ref prefix) => format!("{} {}", prefix, key),
454 None => key,
455 };
456 req_builder = req_builder.header("X-API-Key", value);
457 };
458 if let Some(ref auth_conf) = configuration.basic_auth {
459 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
460 };
461
462 let req = req_builder.build()?;
463 let resp = configuration.client.execute(req).await?;
464
465 let status = resp.status();
466 let content_type = resp
467 .headers()
468 .get("content-type")
469 .and_then(|v| v.to_str().ok())
470 .unwrap_or("application/octet-stream");
471 let content_type = super::ContentType::from(content_type);
472
473 if !status.is_client_error() && !status.is_server_error() {
474 let content = resp.text().await?;
475 match content_type {
476 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
477 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
478 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<String>`")))),
479 }
480 } else {
481 let content = resp.text().await?;
482 let entity: Option<GetBookTagsError> = serde_json::from_str(&content).ok();
483 Err(Error::ResponseError(ResponseContent { status, content, entity }))
484 }
485}
486
487pub async fn get_genres(configuration: &configuration::Configuration, library_id: Option<Vec<String>>, collection_id: Option<&str>) -> Result<Vec<String>, Error<GetGenresError>> {
489 let p_query_library_id = library_id;
491 let p_query_collection_id = collection_id;
492
493 let uri_str = format!("{}/api/v1/genres", configuration.base_path);
494 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
495
496 if let Some(ref param_value) = p_query_library_id {
497 req_builder = match "multi" {
498 "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)>>()),
499 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
500 };
501 }
502 if let Some(ref param_value) = p_query_collection_id {
503 req_builder = req_builder.query(&[("collection_id", ¶m_value.to_string())]);
504 }
505 if let Some(ref user_agent) = configuration.user_agent {
506 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
507 }
508 if let Some(ref apikey) = configuration.api_key {
509 let key = apikey.key.clone();
510 let value = match apikey.prefix {
511 Some(ref prefix) => format!("{} {}", prefix, key),
512 None => key,
513 };
514 req_builder = req_builder.header("X-API-Key", value);
515 };
516 if let Some(ref auth_conf) = configuration.basic_auth {
517 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
518 };
519
520 let req = req_builder.build()?;
521 let resp = configuration.client.execute(req).await?;
522
523 let status = resp.status();
524 let content_type = resp
525 .headers()
526 .get("content-type")
527 .and_then(|v| v.to_str().ok())
528 .unwrap_or("application/octet-stream");
529 let content_type = super::ContentType::from(content_type);
530
531 if !status.is_client_error() && !status.is_server_error() {
532 let content = resp.text().await?;
533 match content_type {
534 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
535 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
536 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<String>`")))),
537 }
538 } else {
539 let content = resp.text().await?;
540 let entity: Option<GetGenresError> = serde_json::from_str(&content).ok();
541 Err(Error::ResponseError(ResponseContent { status, content, entity }))
542 }
543}
544
545pub async fn get_languages(configuration: &configuration::Configuration, library_id: Option<Vec<String>>, collection_id: Option<&str>) -> Result<Vec<String>, Error<GetLanguagesError>> {
547 let p_query_library_id = library_id;
549 let p_query_collection_id = collection_id;
550
551 let uri_str = format!("{}/api/v1/languages", configuration.base_path);
552 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
553
554 if let Some(ref param_value) = p_query_library_id {
555 req_builder = match "multi" {
556 "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)>>()),
557 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
558 };
559 }
560 if let Some(ref param_value) = p_query_collection_id {
561 req_builder = req_builder.query(&[("collection_id", ¶m_value.to_string())]);
562 }
563 if let Some(ref user_agent) = configuration.user_agent {
564 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
565 }
566 if let Some(ref apikey) = configuration.api_key {
567 let key = apikey.key.clone();
568 let value = match apikey.prefix {
569 Some(ref prefix) => format!("{} {}", prefix, key),
570 None => key,
571 };
572 req_builder = req_builder.header("X-API-Key", value);
573 };
574 if let Some(ref auth_conf) = configuration.basic_auth {
575 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
576 };
577
578 let req = req_builder.build()?;
579 let resp = configuration.client.execute(req).await?;
580
581 let status = resp.status();
582 let content_type = resp
583 .headers()
584 .get("content-type")
585 .and_then(|v| v.to_str().ok())
586 .unwrap_or("application/octet-stream");
587 let content_type = super::ContentType::from(content_type);
588
589 if !status.is_client_error() && !status.is_server_error() {
590 let content = resp.text().await?;
591 match content_type {
592 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
593 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
594 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<String>`")))),
595 }
596 } else {
597 let content = resp.text().await?;
598 let entity: Option<GetLanguagesError> = serde_json::from_str(&content).ok();
599 Err(Error::ResponseError(ResponseContent { status, content, entity }))
600 }
601}
602
603pub async fn get_publishers(configuration: &configuration::Configuration, library_id: Option<Vec<String>>, collection_id: Option<&str>) -> Result<Vec<String>, Error<GetPublishersError>> {
605 let p_query_library_id = library_id;
607 let p_query_collection_id = collection_id;
608
609 let uri_str = format!("{}/api/v1/publishers", configuration.base_path);
610 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
611
612 if let Some(ref param_value) = p_query_library_id {
613 req_builder = match "multi" {
614 "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)>>()),
615 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
616 };
617 }
618 if let Some(ref param_value) = p_query_collection_id {
619 req_builder = req_builder.query(&[("collection_id", ¶m_value.to_string())]);
620 }
621 if let Some(ref user_agent) = configuration.user_agent {
622 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
623 }
624 if let Some(ref apikey) = configuration.api_key {
625 let key = apikey.key.clone();
626 let value = match apikey.prefix {
627 Some(ref prefix) => format!("{} {}", prefix, key),
628 None => key,
629 };
630 req_builder = req_builder.header("X-API-Key", value);
631 };
632 if let Some(ref auth_conf) = configuration.basic_auth {
633 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
634 };
635
636 let req = req_builder.build()?;
637 let resp = configuration.client.execute(req).await?;
638
639 let status = resp.status();
640 let content_type = resp
641 .headers()
642 .get("content-type")
643 .and_then(|v| v.to_str().ok())
644 .unwrap_or("application/octet-stream");
645 let content_type = super::ContentType::from(content_type);
646
647 if !status.is_client_error() && !status.is_server_error() {
648 let content = resp.text().await?;
649 match content_type {
650 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
651 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
652 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<String>`")))),
653 }
654 } else {
655 let content = resp.text().await?;
656 let entity: Option<GetPublishersError> = serde_json::from_str(&content).ok();
657 Err(Error::ResponseError(ResponseContent { status, content, entity }))
658 }
659}
660
661pub async fn get_series_release_dates(configuration: &configuration::Configuration, library_id: Option<Vec<String>>, collection_id: Option<&str>) -> Result<Vec<String>, Error<GetSeriesReleaseDatesError>> {
663 let p_query_library_id = library_id;
665 let p_query_collection_id = collection_id;
666
667 let uri_str = format!("{}/api/v1/series/release-dates", configuration.base_path);
668 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
669
670 if let Some(ref param_value) = p_query_library_id {
671 req_builder = match "multi" {
672 "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)>>()),
673 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
674 };
675 }
676 if let Some(ref param_value) = p_query_collection_id {
677 req_builder = req_builder.query(&[("collection_id", ¶m_value.to_string())]);
678 }
679 if let Some(ref user_agent) = configuration.user_agent {
680 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
681 }
682 if let Some(ref apikey) = configuration.api_key {
683 let key = apikey.key.clone();
684 let value = match apikey.prefix {
685 Some(ref prefix) => format!("{} {}", prefix, key),
686 None => key,
687 };
688 req_builder = req_builder.header("X-API-Key", value);
689 };
690 if let Some(ref auth_conf) = configuration.basic_auth {
691 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
692 };
693
694 let req = req_builder.build()?;
695 let resp = configuration.client.execute(req).await?;
696
697 let status = resp.status();
698 let content_type = resp
699 .headers()
700 .get("content-type")
701 .and_then(|v| v.to_str().ok())
702 .unwrap_or("application/octet-stream");
703 let content_type = super::ContentType::from(content_type);
704
705 if !status.is_client_error() && !status.is_server_error() {
706 let content = resp.text().await?;
707 match content_type {
708 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
709 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
710 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<String>`")))),
711 }
712 } else {
713 let content = resp.text().await?;
714 let entity: Option<GetSeriesReleaseDatesError> = serde_json::from_str(&content).ok();
715 Err(Error::ResponseError(ResponseContent { status, content, entity }))
716 }
717}
718
719pub async fn get_series_tags(configuration: &configuration::Configuration, library_id: Option<&str>, collection_id: Option<&str>) -> Result<Vec<String>, Error<GetSeriesTagsError>> {
721 let p_query_library_id = library_id;
723 let p_query_collection_id = collection_id;
724
725 let uri_str = format!("{}/api/v1/tags/series", configuration.base_path);
726 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
727
728 if let Some(ref param_value) = p_query_library_id {
729 req_builder = req_builder.query(&[("library_id", ¶m_value.to_string())]);
730 }
731 if let Some(ref param_value) = p_query_collection_id {
732 req_builder = req_builder.query(&[("collection_id", ¶m_value.to_string())]);
733 }
734 if let Some(ref user_agent) = configuration.user_agent {
735 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
736 }
737 if let Some(ref apikey) = configuration.api_key {
738 let key = apikey.key.clone();
739 let value = match apikey.prefix {
740 Some(ref prefix) => format!("{} {}", prefix, key),
741 None => key,
742 };
743 req_builder = req_builder.header("X-API-Key", value);
744 };
745 if let Some(ref auth_conf) = configuration.basic_auth {
746 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
747 };
748
749 let req = req_builder.build()?;
750 let resp = configuration.client.execute(req).await?;
751
752 let status = resp.status();
753 let content_type = resp
754 .headers()
755 .get("content-type")
756 .and_then(|v| v.to_str().ok())
757 .unwrap_or("application/octet-stream");
758 let content_type = super::ContentType::from(content_type);
759
760 if !status.is_client_error() && !status.is_server_error() {
761 let content = resp.text().await?;
762 match content_type {
763 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
764 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
765 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<String>`")))),
766 }
767 } else {
768 let content = resp.text().await?;
769 let entity: Option<GetSeriesTagsError> = serde_json::from_str(&content).ok();
770 Err(Error::ResponseError(ResponseContent { status, content, entity }))
771 }
772}
773
774pub async fn get_sharing_labels(configuration: &configuration::Configuration, library_id: Option<Vec<String>>, collection_id: Option<&str>) -> Result<Vec<String>, Error<GetSharingLabelsError>> {
776 let p_query_library_id = library_id;
778 let p_query_collection_id = collection_id;
779
780 let uri_str = format!("{}/api/v1/sharing-labels", configuration.base_path);
781 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
782
783 if let Some(ref param_value) = p_query_library_id {
784 req_builder = match "multi" {
785 "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)>>()),
786 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
787 };
788 }
789 if let Some(ref param_value) = p_query_collection_id {
790 req_builder = req_builder.query(&[("collection_id", ¶m_value.to_string())]);
791 }
792 if let Some(ref user_agent) = configuration.user_agent {
793 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
794 }
795 if let Some(ref apikey) = configuration.api_key {
796 let key = apikey.key.clone();
797 let value = match apikey.prefix {
798 Some(ref prefix) => format!("{} {}", prefix, key),
799 None => key,
800 };
801 req_builder = req_builder.header("X-API-Key", value);
802 };
803 if let Some(ref auth_conf) = configuration.basic_auth {
804 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
805 };
806
807 let req = req_builder.build()?;
808 let resp = configuration.client.execute(req).await?;
809
810 let status = resp.status();
811 let content_type = resp
812 .headers()
813 .get("content-type")
814 .and_then(|v| v.to_str().ok())
815 .unwrap_or("application/octet-stream");
816 let content_type = super::ContentType::from(content_type);
817
818 if !status.is_client_error() && !status.is_server_error() {
819 let content = resp.text().await?;
820 match content_type {
821 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
822 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
823 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<String>`")))),
824 }
825 } else {
826 let content = resp.text().await?;
827 let entity: Option<GetSharingLabelsError> = serde_json::from_str(&content).ok();
828 Err(Error::ResponseError(ResponseContent { status, content, entity }))
829 }
830}
831
832pub async fn get_tags(configuration: &configuration::Configuration, library_id: Option<Vec<String>>, collection_id: Option<&str>) -> Result<Vec<String>, Error<GetTagsError>> {
834 let p_query_library_id = library_id;
836 let p_query_collection_id = collection_id;
837
838 let uri_str = format!("{}/api/v1/tags", configuration.base_path);
839 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
840
841 if let Some(ref param_value) = p_query_library_id {
842 req_builder = match "multi" {
843 "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)>>()),
844 _ => req_builder.query(&[("library_id", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
845 };
846 }
847 if let Some(ref param_value) = p_query_collection_id {
848 req_builder = req_builder.query(&[("collection_id", ¶m_value.to_string())]);
849 }
850 if let Some(ref user_agent) = configuration.user_agent {
851 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
852 }
853 if let Some(ref apikey) = configuration.api_key {
854 let key = apikey.key.clone();
855 let value = match apikey.prefix {
856 Some(ref prefix) => format!("{} {}", prefix, key),
857 None => key,
858 };
859 req_builder = req_builder.header("X-API-Key", value);
860 };
861 if let Some(ref auth_conf) = configuration.basic_auth {
862 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
863 };
864
865 let req = req_builder.build()?;
866 let resp = configuration.client.execute(req).await?;
867
868 let status = resp.status();
869 let content_type = resp
870 .headers()
871 .get("content-type")
872 .and_then(|v| v.to_str().ok())
873 .unwrap_or("application/octet-stream");
874 let content_type = super::ContentType::from(content_type);
875
876 if !status.is_client_error() && !status.is_server_error() {
877 let content = resp.text().await?;
878 match content_type {
879 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
880 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))),
881 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<String>`")))),
882 }
883 } else {
884 let content = resp.text().await?;
885 let entity: Option<GetTagsError> = serde_json::from_str(&content).ok();
886 Err(Error::ResponseError(ResponseContent { status, content, entity }))
887 }
888}
889