1use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AddUserUploadedBookThumbnailError {
22 Status400(crate::models::ValidationErrorResponse),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum Analyze3Error {
30 Status400(crate::models::ValidationErrorResponse),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum DeleteBookError {
38 Status400(crate::models::ValidationErrorResponse),
39 UnknownValue(serde_json::Value),
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum DeleteReadProgressError {
46 Status400(crate::models::ValidationErrorResponse),
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum DeleteUserUploadedBookThumbnailError {
54 Status400(crate::models::ValidationErrorResponse),
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum GetAllBooksError {
62 Status400(crate::models::ValidationErrorResponse),
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum GetAllReadListsByBookError {
70 Status400(crate::models::ValidationErrorResponse),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetBookFileError {
78 Status400(crate::models::ValidationErrorResponse),
79 UnknownValue(serde_json::Value),
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum GetBookFile1Error {
86 Status400(crate::models::ValidationErrorResponse),
87 UnknownValue(serde_json::Value),
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum GetBookPageError {
94 Status400(crate::models::ValidationErrorResponse),
95 DefaultResponse(std::path::PathBuf),
96 UnknownValue(serde_json::Value),
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum GetBookPageRawError {
103 Status400(crate::models::ValidationErrorResponse),
104 UnknownValue(serde_json::Value),
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum GetBookPageThumbnailError {
111 Status400(crate::models::ValidationErrorResponse),
112 DefaultResponse(std::path::PathBuf),
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetBookPagesError {
120 Status400(crate::models::ValidationErrorResponse),
121 UnknownValue(serde_json::Value),
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum GetBookResourceError {
128 Status400(crate::models::ValidationErrorResponse),
129 UnknownValue(serde_json::Value),
130}
131
132#[derive(Debug, Clone, Serialize, Deserialize)]
134#[serde(untagged)]
135pub enum GetBookSiblingNext1Error {
136 Status400(crate::models::ValidationErrorResponse),
137 UnknownValue(serde_json::Value),
138}
139
140#[derive(Debug, Clone, Serialize, Deserialize)]
142#[serde(untagged)]
143pub enum GetBookSiblingPrevious1Error {
144 Status400(crate::models::ValidationErrorResponse),
145 UnknownValue(serde_json::Value),
146}
147
148#[derive(Debug, Clone, Serialize, Deserialize)]
150#[serde(untagged)]
151pub enum GetBookThumbnailError {
152 Status400(crate::models::ValidationErrorResponse),
153 DefaultResponse(std::path::PathBuf),
154 UnknownValue(serde_json::Value),
155}
156
157#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum GetBookThumbnailByIdError {
161 Status400(crate::models::ValidationErrorResponse),
162 DefaultResponse(std::path::PathBuf),
163 UnknownValue(serde_json::Value),
164}
165
166#[derive(Debug, Clone, Serialize, Deserialize)]
168#[serde(untagged)]
169pub enum GetBookThumbnailsError {
170 Status400(crate::models::ValidationErrorResponse),
171 UnknownValue(serde_json::Value),
172}
173
174#[derive(Debug, Clone, Serialize, Deserialize)]
176#[serde(untagged)]
177pub enum GetBooksOnDeckError {
178 Status400(crate::models::ValidationErrorResponse),
179 UnknownValue(serde_json::Value),
180}
181
182#[derive(Debug, Clone, Serialize, Deserialize)]
184#[serde(untagged)]
185pub enum GetDuplicateBooksError {
186 Status400(crate::models::ValidationErrorResponse),
187 UnknownValue(serde_json::Value),
188}
189
190#[derive(Debug, Clone, Serialize, Deserialize)]
192#[serde(untagged)]
193pub enum GetLatestBooksError {
194 Status400(crate::models::ValidationErrorResponse),
195 UnknownValue(serde_json::Value),
196}
197
198#[derive(Debug, Clone, Serialize, Deserialize)]
200#[serde(untagged)]
201pub enum GetOneBookError {
202 Status400(crate::models::ValidationErrorResponse),
203 UnknownValue(serde_json::Value),
204}
205
206#[derive(Debug, Clone, Serialize, Deserialize)]
208#[serde(untagged)]
209pub enum GetPositionsError {
210 Status400(crate::models::ValidationErrorResponse),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum GetProgressionError {
218 Status400(crate::models::ValidationErrorResponse),
219 UnknownValue(serde_json::Value),
220}
221
222#[derive(Debug, Clone, Serialize, Deserialize)]
224#[serde(untagged)]
225pub enum GetWebPubManifestError {
226 Status400(crate::models::ValidationErrorResponse),
227 UnknownValue(serde_json::Value),
228}
229
230#[derive(Debug, Clone, Serialize, Deserialize)]
232#[serde(untagged)]
233pub enum GetWebPubManifestDivinaError {
234 Status400(crate::models::ValidationErrorResponse),
235 UnknownValue(serde_json::Value),
236}
237
238#[derive(Debug, Clone, Serialize, Deserialize)]
240#[serde(untagged)]
241pub enum GetWebPubManifestEpubError {
242 Status400(crate::models::ValidationErrorResponse),
243 UnknownValue(serde_json::Value),
244}
245
246#[derive(Debug, Clone, Serialize, Deserialize)]
248#[serde(untagged)]
249pub enum GetWebPubManifestPdfError {
250 Status400(crate::models::ValidationErrorResponse),
251 UnknownValue(serde_json::Value),
252}
253
254#[derive(Debug, Clone, Serialize, Deserialize)]
256#[serde(untagged)]
257pub enum ImportBooksError {
258 Status400(crate::models::ValidationErrorResponse),
259 UnknownValue(serde_json::Value),
260}
261
262#[derive(Debug, Clone, Serialize, Deserialize)]
264#[serde(untagged)]
265pub enum MarkProgressionError {
266 Status400(crate::models::ValidationErrorResponse),
267 UnknownValue(serde_json::Value),
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum MarkReadProgressError {
274 Status400(crate::models::ValidationErrorResponse),
275 UnknownValue(serde_json::Value),
276}
277
278#[derive(Debug, Clone, Serialize, Deserialize)]
280#[serde(untagged)]
281pub enum MarkSelectedBookThumbnailError {
282 Status400(crate::models::ValidationErrorResponse),
283 UnknownValue(serde_json::Value),
284}
285
286#[derive(Debug, Clone, Serialize, Deserialize)]
288#[serde(untagged)]
289pub enum RefreshMetadata2Error {
290 Status400(crate::models::ValidationErrorResponse),
291 UnknownValue(serde_json::Value),
292}
293
294#[derive(Debug, Clone, Serialize, Deserialize)]
296#[serde(untagged)]
297pub enum RegenerateThumbnailsError {
298 Status400(crate::models::ValidationErrorResponse),
299 UnknownValue(serde_json::Value),
300}
301
302#[derive(Debug, Clone, Serialize, Deserialize)]
304#[serde(untagged)]
305pub enum UpdateBatchMetadataError {
306 Status400(crate::models::ValidationErrorResponse),
307 UnknownValue(serde_json::Value),
308}
309
310#[derive(Debug, Clone, Serialize, Deserialize)]
312#[serde(untagged)]
313pub enum UpdateMetadata1Error {
314 Status400(crate::models::ValidationErrorResponse),
315 UnknownValue(serde_json::Value),
316}
317
318
319pub async fn add_user_uploaded_book_thumbnail(configuration: &configuration::Configuration, book_id: &str, _file: std::path::PathBuf, selected: Option<bool>) -> Result<crate::models::ThumbnailBookDto, Error<AddUserUploadedBookThumbnailError>> {
320 let local_var_configuration = configuration;
321
322 let local_var_client = &local_var_configuration.client;
323
324 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/thumbnails", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
325 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
326
327 if let Some(ref local_var_str) = selected {
328 local_var_req_builder = local_var_req_builder.query(&[("selected", &local_var_str.to_string())]);
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 let local_var_form = reqwest::multipart::Form::new();
334 local_var_req_builder = local_var_req_builder.multipart(local_var_form);
336
337 let local_var_req = local_var_req_builder.build()?;
338 let local_var_resp = local_var_client.execute(local_var_req).await?;
339
340 let local_var_status = local_var_resp.status();
341 let local_var_content = local_var_resp.text().await?;
342
343 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
344 serde_json::from_str(&local_var_content).map_err(Error::from)
345 } else {
346 let local_var_entity: Option<AddUserUploadedBookThumbnailError> = serde_json::from_str(&local_var_content).ok();
347 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
348 Err(Error::ResponseError(local_var_error))
349 }
350}
351
352pub async fn analyze3(configuration: &configuration::Configuration, book_id: &str) -> Result<(), Error<Analyze3Error>> {
353 let local_var_configuration = configuration;
354
355 let local_var_client = &local_var_configuration.client;
356
357 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/analyze", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
358 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
359
360 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
361 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
362 }
363
364 let local_var_req = local_var_req_builder.build()?;
365 let local_var_resp = local_var_client.execute(local_var_req).await?;
366
367 let local_var_status = local_var_resp.status();
368 let local_var_content = local_var_resp.text().await?;
369
370 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
371 Ok(())
372 } else {
373 let local_var_entity: Option<Analyze3Error> = serde_json::from_str(&local_var_content).ok();
374 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
375 Err(Error::ResponseError(local_var_error))
376 }
377}
378
379pub async fn delete_book(configuration: &configuration::Configuration, book_id: &str) -> Result<(), Error<DeleteBookError>> {
380 let local_var_configuration = configuration;
381
382 let local_var_client = &local_var_configuration.client;
383
384 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/file", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
385 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
386
387 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
388 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
389 }
390
391 let local_var_req = local_var_req_builder.build()?;
392 let local_var_resp = local_var_client.execute(local_var_req).await?;
393
394 let local_var_status = local_var_resp.status();
395 let local_var_content = local_var_resp.text().await?;
396
397 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
398 Ok(())
399 } else {
400 let local_var_entity: Option<DeleteBookError> = serde_json::from_str(&local_var_content).ok();
401 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
402 Err(Error::ResponseError(local_var_error))
403 }
404}
405
406pub async fn delete_read_progress(configuration: &configuration::Configuration, book_id: &str) -> Result<(), Error<DeleteReadProgressError>> {
408 let local_var_configuration = configuration;
409
410 let local_var_client = &local_var_configuration.client;
411
412 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/read-progress", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
413 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
414
415 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
416 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
417 }
418
419 let local_var_req = local_var_req_builder.build()?;
420 let local_var_resp = local_var_client.execute(local_var_req).await?;
421
422 let local_var_status = local_var_resp.status();
423 let local_var_content = local_var_resp.text().await?;
424
425 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
426 Ok(())
427 } else {
428 let local_var_entity: Option<DeleteReadProgressError> = serde_json::from_str(&local_var_content).ok();
429 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
430 Err(Error::ResponseError(local_var_error))
431 }
432}
433
434pub async fn delete_user_uploaded_book_thumbnail(configuration: &configuration::Configuration, book_id: &str, thumbnail_id: &str) -> Result<(), Error<DeleteUserUploadedBookThumbnailError>> {
435 let local_var_configuration = configuration;
436
437 let local_var_client = &local_var_configuration.client;
438
439 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/thumbnails/{thumbnailId}", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id), thumbnailId=crate::apis::urlencode(thumbnail_id));
440 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
441
442 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
443 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
444 }
445
446 let local_var_req = local_var_req_builder.build()?;
447 let local_var_resp = local_var_client.execute(local_var_req).await?;
448
449 let local_var_status = local_var_resp.status();
450 let local_var_content = local_var_resp.text().await?;
451
452 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
453 Ok(())
454 } else {
455 let local_var_entity: Option<DeleteUserUploadedBookThumbnailError> = serde_json::from_str(&local_var_content).ok();
456 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
457 Err(Error::ResponseError(local_var_error))
458 }
459}
460
461pub async fn get_all_books(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<crate::models::PageBookDto, Error<GetAllBooksError>> {
462 let local_var_configuration = configuration;
463
464 let local_var_client = &local_var_configuration.client;
465
466 let local_var_uri_str = format!("{}/api/v1/books", local_var_configuration.base_path);
467 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
468
469 if let Some(ref local_var_str) = search {
470 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
471 }
472 if let Some(ref local_var_str) = library_id {
473 local_var_req_builder = match "multi" {
474 "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("library_id".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
475 _ => local_var_req_builder.query(&[("library_id", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
476 };
477 }
478 if let Some(ref local_var_str) = media_status {
479 local_var_req_builder = match "multi" {
480 "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("media_status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
481 _ => local_var_req_builder.query(&[("media_status", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
482 };
483 }
484 if let Some(ref local_var_str) = read_status {
485 local_var_req_builder = match "multi" {
486 "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("read_status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
487 _ => local_var_req_builder.query(&[("read_status", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
488 };
489 }
490 if let Some(ref local_var_str) = released_after {
491 local_var_req_builder = local_var_req_builder.query(&[("released_after", &local_var_str.to_string())]);
492 }
493 if let Some(ref local_var_str) = tag {
494 local_var_req_builder = match "multi" {
495 "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("tag".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
496 _ => local_var_req_builder.query(&[("tag", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
497 };
498 }
499 if let Some(ref local_var_str) = unpaged {
500 local_var_req_builder = local_var_req_builder.query(&[("unpaged", &local_var_str.to_string())]);
501 }
502 if let Some(ref local_var_str) = page {
503 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
504 }
505 if let Some(ref local_var_str) = size {
506 local_var_req_builder = local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
507 }
508 if let Some(ref local_var_str) = sort {
509 local_var_req_builder = match "multi" {
510 "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("sort".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
511 _ => local_var_req_builder.query(&[("sort", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
512 };
513 }
514 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
515 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
516 }
517
518 let local_var_req = local_var_req_builder.build()?;
519 let local_var_resp = local_var_client.execute(local_var_req).await?;
520
521 let local_var_status = local_var_resp.status();
522 let local_var_content = local_var_resp.text().await?;
523
524 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
525 serde_json::from_str(&local_var_content).map_err(Error::from)
526 } else {
527 let local_var_entity: Option<GetAllBooksError> = serde_json::from_str(&local_var_content).ok();
528 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
529 Err(Error::ResponseError(local_var_error))
530 }
531}
532
533pub async fn get_all_read_lists_by_book(configuration: &configuration::Configuration, book_id: &str) -> Result<Vec<crate::models::ReadListDto>, Error<GetAllReadListsByBookError>> {
534 let local_var_configuration = configuration;
535
536 let local_var_client = &local_var_configuration.client;
537
538 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/readlists", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
539 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
540
541 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
542 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
543 }
544
545 let local_var_req = local_var_req_builder.build()?;
546 let local_var_resp = local_var_client.execute(local_var_req).await?;
547
548 let local_var_status = local_var_resp.status();
549 let local_var_content = local_var_resp.text().await?;
550
551 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
552 serde_json::from_str(&local_var_content).map_err(Error::from)
553 } else {
554 let local_var_entity: Option<GetAllReadListsByBookError> = serde_json::from_str(&local_var_content).ok();
555 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
556 Err(Error::ResponseError(local_var_error))
557 }
558}
559
560pub async fn get_book_file(configuration: &configuration::Configuration, book_id: &str) -> Result<serde_json::Value, Error<GetBookFileError>> {
562 let local_var_configuration = configuration;
563
564 let local_var_client = &local_var_configuration.client;
565
566 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/file", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
567 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
568
569 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
570 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
571 }
572
573 let local_var_req = local_var_req_builder.build()?;
574 let local_var_resp = local_var_client.execute(local_var_req).await?;
575
576 let local_var_status = local_var_resp.status();
577 let local_var_content = local_var_resp.text().await?;
578
579 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
580 serde_json::from_str(&local_var_content).map_err(Error::from)
581 } else {
582 let local_var_entity: Option<GetBookFileError> = serde_json::from_str(&local_var_content).ok();
583 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
584 Err(Error::ResponseError(local_var_error))
585 }
586}
587
588pub async fn get_book_file1(configuration: &configuration::Configuration, book_id: &str) -> Result<serde_json::Value, Error<GetBookFile1Error>> {
590 let local_var_configuration = configuration;
591
592 let local_var_client = &local_var_configuration.client;
593
594 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/file/*", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
595 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
596
597 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
598 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
599 }
600
601 let local_var_req = local_var_req_builder.build()?;
602 let local_var_resp = local_var_client.execute(local_var_req).await?;
603
604 let local_var_status = local_var_resp.status();
605 let local_var_content = local_var_resp.text().await?;
606
607 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
608 serde_json::from_str(&local_var_content).map_err(Error::from)
609 } else {
610 let local_var_entity: Option<GetBookFile1Error> = serde_json::from_str(&local_var_content).ok();
611 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
612 Err(Error::ResponseError(local_var_error))
613 }
614}
615
616pub async fn get_book_page(configuration: &configuration::Configuration, book_id: &str, page_number: i32, convert: Option<&str>, zero_based: Option<bool>, _accept: Option<Vec<crate::models::MediaType>>) -> Result<std::path::PathBuf, Error<GetBookPageError>> {
617 let local_var_configuration = configuration;
618
619 let local_var_client = &local_var_configuration.client;
620
621 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/pages/{pageNumber}", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id), pageNumber=page_number);
622 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
623
624 if let Some(ref local_var_str) = convert {
625 local_var_req_builder = local_var_req_builder.query(&[("convert", &local_var_str.to_string())]);
626 }
627 if let Some(ref local_var_str) = zero_based {
628 local_var_req_builder = local_var_req_builder.query(&[("zero_based", &local_var_str.to_string())]);
629 }
630 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
631 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
632 }
633
634 let local_var_req = local_var_req_builder.build()?;
635 let local_var_resp = local_var_client.execute(local_var_req).await?;
636
637 let local_var_status = local_var_resp.status();
638 let local_var_content = local_var_resp.text().await?;
639
640 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
641 serde_json::from_str(&local_var_content).map_err(Error::from)
642 } else {
643 let local_var_entity: Option<GetBookPageError> = serde_json::from_str(&local_var_content).ok();
644 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
645 Err(Error::ResponseError(local_var_error))
646 }
647}
648
649pub async fn get_book_page_raw(configuration: &configuration::Configuration, book_id: &str, page_number: i32) -> Result<String, Error<GetBookPageRawError>> {
650 let local_var_configuration = configuration;
651
652 let local_var_client = &local_var_configuration.client;
653
654 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/pages/{pageNumber}/raw", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id), pageNumber=page_number);
655 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
656
657 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
658 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
659 }
660
661 let local_var_req = local_var_req_builder.build()?;
662 let local_var_resp = local_var_client.execute(local_var_req).await?;
663
664 let local_var_status = local_var_resp.status();
665 let local_var_content = local_var_resp.text().await?;
666
667 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
668 serde_json::from_str(&local_var_content).map_err(Error::from)
669 } else {
670 let local_var_entity: Option<GetBookPageRawError> = serde_json::from_str(&local_var_content).ok();
671 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
672 Err(Error::ResponseError(local_var_error))
673 }
674}
675
676pub async fn get_book_page_thumbnail(configuration: &configuration::Configuration, book_id: &str, page_number: i32) -> Result<std::path::PathBuf, Error<GetBookPageThumbnailError>> {
677 let local_var_configuration = configuration;
678
679 let local_var_client = &local_var_configuration.client;
680
681 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/pages/{pageNumber}/thumbnail", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id), pageNumber=page_number);
682 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
683
684 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
685 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
686 }
687
688 let local_var_req = local_var_req_builder.build()?;
689 let local_var_resp = local_var_client.execute(local_var_req).await?;
690
691 let local_var_status = local_var_resp.status();
692 let local_var_content = local_var_resp.text().await?;
693
694 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
695 serde_json::from_str(&local_var_content).map_err(Error::from)
696 } else {
697 let local_var_entity: Option<GetBookPageThumbnailError> = serde_json::from_str(&local_var_content).ok();
698 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
699 Err(Error::ResponseError(local_var_error))
700 }
701}
702
703pub async fn get_book_pages(configuration: &configuration::Configuration, book_id: &str) -> Result<Vec<crate::models::PageDto>, Error<GetBookPagesError>> {
704 let local_var_configuration = configuration;
705
706 let local_var_client = &local_var_configuration.client;
707
708 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/pages", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
709 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
710
711 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
712 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
713 }
714
715 let local_var_req = local_var_req_builder.build()?;
716 let local_var_resp = local_var_client.execute(local_var_req).await?;
717
718 let local_var_status = local_var_resp.status();
719 let local_var_content = local_var_resp.text().await?;
720
721 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
722 serde_json::from_str(&local_var_content).map_err(Error::from)
723 } else {
724 let local_var_entity: Option<GetBookPagesError> = serde_json::from_str(&local_var_content).ok();
725 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
726 Err(Error::ResponseError(local_var_error))
727 }
728}
729
730pub async fn get_book_resource(configuration: &configuration::Configuration, book_id: &str, resource: &str) -> Result<String, Error<GetBookResourceError>> {
731 let local_var_configuration = configuration;
732
733 let local_var_client = &local_var_configuration.client;
734
735 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/resource/{resource}", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id), resource=crate::apis::urlencode(resource));
736 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
737
738 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
739 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
740 }
741
742 let local_var_req = local_var_req_builder.build()?;
743 let local_var_resp = local_var_client.execute(local_var_req).await?;
744
745 let local_var_status = local_var_resp.status();
746 let local_var_content = local_var_resp.text().await?;
747
748 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
749 serde_json::from_str(&local_var_content).map_err(Error::from)
750 } else {
751 let local_var_entity: Option<GetBookResourceError> = serde_json::from_str(&local_var_content).ok();
752 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
753 Err(Error::ResponseError(local_var_error))
754 }
755}
756
757pub async fn get_book_sibling_next1(configuration: &configuration::Configuration, book_id: &str) -> Result<crate::models::BookDto, Error<GetBookSiblingNext1Error>> {
758 let local_var_configuration = configuration;
759
760 let local_var_client = &local_var_configuration.client;
761
762 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/next", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
763 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
764
765 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
766 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
767 }
768
769 let local_var_req = local_var_req_builder.build()?;
770 let local_var_resp = local_var_client.execute(local_var_req).await?;
771
772 let local_var_status = local_var_resp.status();
773 let local_var_content = local_var_resp.text().await?;
774
775 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
776 serde_json::from_str(&local_var_content).map_err(Error::from)
777 } else {
778 let local_var_entity: Option<GetBookSiblingNext1Error> = serde_json::from_str(&local_var_content).ok();
779 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
780 Err(Error::ResponseError(local_var_error))
781 }
782}
783
784pub async fn get_book_sibling_previous1(configuration: &configuration::Configuration, book_id: &str) -> Result<crate::models::BookDto, Error<GetBookSiblingPrevious1Error>> {
785 let local_var_configuration = configuration;
786
787 let local_var_client = &local_var_configuration.client;
788
789 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/previous", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
790 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
791
792 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
793 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
794 }
795
796 let local_var_req = local_var_req_builder.build()?;
797 let local_var_resp = local_var_client.execute(local_var_req).await?;
798
799 let local_var_status = local_var_resp.status();
800 let local_var_content = local_var_resp.text().await?;
801
802 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
803 serde_json::from_str(&local_var_content).map_err(Error::from)
804 } else {
805 let local_var_entity: Option<GetBookSiblingPrevious1Error> = serde_json::from_str(&local_var_content).ok();
806 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
807 Err(Error::ResponseError(local_var_error))
808 }
809}
810
811pub async fn get_book_thumbnail(configuration: &configuration::Configuration, book_id: &str) -> Result<std::path::PathBuf, Error<GetBookThumbnailError>> {
812 let local_var_configuration = configuration;
813
814 let local_var_client = &local_var_configuration.client;
815
816 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/thumbnail", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
817 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
818
819 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
820 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
821 }
822
823 let local_var_req = local_var_req_builder.build()?;
824 let local_var_resp = local_var_client.execute(local_var_req).await?;
825
826 let local_var_status = local_var_resp.status();
827 let local_var_content = local_var_resp.text().await?;
828
829 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
830 serde_json::from_str(&local_var_content).map_err(Error::from)
831 } else {
832 let local_var_entity: Option<GetBookThumbnailError> = serde_json::from_str(&local_var_content).ok();
833 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
834 Err(Error::ResponseError(local_var_error))
835 }
836}
837
838pub async fn get_book_thumbnail_by_id(configuration: &configuration::Configuration, book_id: &str, thumbnail_id: &str) -> Result<std::path::PathBuf, Error<GetBookThumbnailByIdError>> {
839 let local_var_configuration = configuration;
840
841 let local_var_client = &local_var_configuration.client;
842
843 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/thumbnails/{thumbnailId}", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id), thumbnailId=crate::apis::urlencode(thumbnail_id));
844 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
845
846 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
847 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
848 }
849
850 let local_var_req = local_var_req_builder.build()?;
851 let local_var_resp = local_var_client.execute(local_var_req).await?;
852
853 let local_var_status = local_var_resp.status();
854 let local_var_content = local_var_resp.text().await?;
855
856 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
857 serde_json::from_str(&local_var_content).map_err(Error::from)
858 } else {
859 let local_var_entity: Option<GetBookThumbnailByIdError> = serde_json::from_str(&local_var_content).ok();
860 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
861 Err(Error::ResponseError(local_var_error))
862 }
863}
864
865pub async fn get_book_thumbnails(configuration: &configuration::Configuration, book_id: &str) -> Result<Vec<crate::models::ThumbnailBookDto>, Error<GetBookThumbnailsError>> {
866 let local_var_configuration = configuration;
867
868 let local_var_client = &local_var_configuration.client;
869
870 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/thumbnails", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
871 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
872
873 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
874 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
875 }
876
877 let local_var_req = local_var_req_builder.build()?;
878 let local_var_resp = local_var_client.execute(local_var_req).await?;
879
880 let local_var_status = local_var_resp.status();
881 let local_var_content = local_var_resp.text().await?;
882
883 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
884 serde_json::from_str(&local_var_content).map_err(Error::from)
885 } else {
886 let local_var_entity: Option<GetBookThumbnailsError> = serde_json::from_str(&local_var_content).ok();
887 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
888 Err(Error::ResponseError(local_var_error))
889 }
890}
891
892pub async fn get_books_on_deck(configuration: &configuration::Configuration, library_id: Option<Vec<String>>, page: Option<i32>, size: Option<i32>) -> Result<crate::models::PageBookDto, Error<GetBooksOnDeckError>> {
894 let local_var_configuration = configuration;
895
896 let local_var_client = &local_var_configuration.client;
897
898 let local_var_uri_str = format!("{}/api/v1/books/ondeck", local_var_configuration.base_path);
899 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
900
901 if let Some(ref local_var_str) = library_id {
902 local_var_req_builder = match "multi" {
903 "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("library_id".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
904 _ => local_var_req_builder.query(&[("library_id", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
905 };
906 }
907 if let Some(ref local_var_str) = page {
908 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
909 }
910 if let Some(ref local_var_str) = size {
911 local_var_req_builder = local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
912 }
913 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
914 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
915 }
916
917 let local_var_req = local_var_req_builder.build()?;
918 let local_var_resp = local_var_client.execute(local_var_req).await?;
919
920 let local_var_status = local_var_resp.status();
921 let local_var_content = local_var_resp.text().await?;
922
923 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
924 serde_json::from_str(&local_var_content).map_err(Error::from)
925 } else {
926 let local_var_entity: Option<GetBooksOnDeckError> = serde_json::from_str(&local_var_content).ok();
927 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
928 Err(Error::ResponseError(local_var_error))
929 }
930}
931
932pub async fn get_duplicate_books(configuration: &configuration::Configuration, unpaged: Option<bool>, page: Option<i32>, size: Option<i32>, sort: Option<Vec<String>>) -> Result<crate::models::PageBookDto, Error<GetDuplicateBooksError>> {
933 let local_var_configuration = configuration;
934
935 let local_var_client = &local_var_configuration.client;
936
937 let local_var_uri_str = format!("{}/api/v1/books/duplicates", local_var_configuration.base_path);
938 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
939
940 if let Some(ref local_var_str) = unpaged {
941 local_var_req_builder = local_var_req_builder.query(&[("unpaged", &local_var_str.to_string())]);
942 }
943 if let Some(ref local_var_str) = page {
944 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
945 }
946 if let Some(ref local_var_str) = size {
947 local_var_req_builder = local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
948 }
949 if let Some(ref local_var_str) = sort {
950 local_var_req_builder = match "multi" {
951 "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("sort".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
952 _ => local_var_req_builder.query(&[("sort", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
953 };
954 }
955 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
956 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
957 }
958
959 let local_var_req = local_var_req_builder.build()?;
960 let local_var_resp = local_var_client.execute(local_var_req).await?;
961
962 let local_var_status = local_var_resp.status();
963 let local_var_content = local_var_resp.text().await?;
964
965 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
966 serde_json::from_str(&local_var_content).map_err(Error::from)
967 } else {
968 let local_var_entity: Option<GetDuplicateBooksError> = serde_json::from_str(&local_var_content).ok();
969 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
970 Err(Error::ResponseError(local_var_error))
971 }
972}
973
974pub async fn get_latest_books(configuration: &configuration::Configuration, unpaged: Option<bool>, page: Option<i32>, size: Option<i32>) -> Result<crate::models::PageBookDto, Error<GetLatestBooksError>> {
976 let local_var_configuration = configuration;
977
978 let local_var_client = &local_var_configuration.client;
979
980 let local_var_uri_str = format!("{}/api/v1/books/latest", local_var_configuration.base_path);
981 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
982
983 if let Some(ref local_var_str) = unpaged {
984 local_var_req_builder = local_var_req_builder.query(&[("unpaged", &local_var_str.to_string())]);
985 }
986 if let Some(ref local_var_str) = page {
987 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
988 }
989 if let Some(ref local_var_str) = size {
990 local_var_req_builder = local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
991 }
992 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
993 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
994 }
995
996 let local_var_req = local_var_req_builder.build()?;
997 let local_var_resp = local_var_client.execute(local_var_req).await?;
998
999 let local_var_status = local_var_resp.status();
1000 let local_var_content = local_var_resp.text().await?;
1001
1002 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1003 serde_json::from_str(&local_var_content).map_err(Error::from)
1004 } else {
1005 let local_var_entity: Option<GetLatestBooksError> = serde_json::from_str(&local_var_content).ok();
1006 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1007 Err(Error::ResponseError(local_var_error))
1008 }
1009}
1010
1011pub async fn get_one_book(configuration: &configuration::Configuration, book_id: &str) -> Result<crate::models::BookDto, Error<GetOneBookError>> {
1012 let local_var_configuration = configuration;
1013
1014 let local_var_client = &local_var_configuration.client;
1015
1016 let local_var_uri_str = format!("{}/api/v1/books/{bookId}", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
1017 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1018
1019 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1020 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1021 }
1022
1023 let local_var_req = local_var_req_builder.build()?;
1024 let local_var_resp = local_var_client.execute(local_var_req).await?;
1025
1026 let local_var_status = local_var_resp.status();
1027 let local_var_content = local_var_resp.text().await?;
1028
1029 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1030 serde_json::from_str(&local_var_content).map_err(Error::from)
1031 } else {
1032 let local_var_entity: Option<GetOneBookError> = serde_json::from_str(&local_var_content).ok();
1033 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1034 Err(Error::ResponseError(local_var_error))
1035 }
1036}
1037
1038pub async fn get_positions(configuration: &configuration::Configuration, book_id: &str) -> Result<crate::models::R2Positions, Error<GetPositionsError>> {
1039 let local_var_configuration = configuration;
1040
1041 let local_var_client = &local_var_configuration.client;
1042
1043 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/positions", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
1044 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1045
1046 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1047 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1048 }
1049
1050 let local_var_req = local_var_req_builder.build()?;
1051 let local_var_resp = local_var_client.execute(local_var_req).await?;
1052
1053 let local_var_status = local_var_resp.status();
1054 let local_var_content = local_var_resp.text().await?;
1055
1056 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1057 serde_json::from_str(&local_var_content).map_err(Error::from)
1058 } else {
1059 let local_var_entity: Option<GetPositionsError> = serde_json::from_str(&local_var_content).ok();
1060 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1061 Err(Error::ResponseError(local_var_error))
1062 }
1063}
1064
1065pub async fn get_progression(configuration: &configuration::Configuration, book_id: &str) -> Result<crate::models::R2Progression, Error<GetProgressionError>> {
1066 let local_var_configuration = configuration;
1067
1068 let local_var_client = &local_var_configuration.client;
1069
1070 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/progression", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
1071 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1072
1073 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1074 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1075 }
1076
1077 let local_var_req = local_var_req_builder.build()?;
1078 let local_var_resp = local_var_client.execute(local_var_req).await?;
1079
1080 let local_var_status = local_var_resp.status();
1081 let local_var_content = local_var_resp.text().await?;
1082
1083 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1084 serde_json::from_str(&local_var_content).map_err(Error::from)
1085 } else {
1086 let local_var_entity: Option<GetProgressionError> = serde_json::from_str(&local_var_content).ok();
1087 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1088 Err(Error::ResponseError(local_var_error))
1089 }
1090}
1091
1092pub async fn get_web_pub_manifest(configuration: &configuration::Configuration, book_id: &str) -> Result<crate::models::WpPublicationDto, Error<GetWebPubManifestError>> {
1093 let local_var_configuration = configuration;
1094
1095 let local_var_client = &local_var_configuration.client;
1096
1097 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/manifest", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
1098 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1099
1100 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1101 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1102 }
1103
1104 let local_var_req = local_var_req_builder.build()?;
1105 let local_var_resp = local_var_client.execute(local_var_req).await?;
1106
1107 let local_var_status = local_var_resp.status();
1108 let local_var_content = local_var_resp.text().await?;
1109
1110 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1111 serde_json::from_str(&local_var_content).map_err(Error::from)
1112 } else {
1113 let local_var_entity: Option<GetWebPubManifestError> = serde_json::from_str(&local_var_content).ok();
1114 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1115 Err(Error::ResponseError(local_var_error))
1116 }
1117}
1118
1119pub async fn get_web_pub_manifest_divina(configuration: &configuration::Configuration, book_id: &str) -> Result<crate::models::WpPublicationDto, Error<GetWebPubManifestDivinaError>> {
1120 let local_var_configuration = configuration;
1121
1122 let local_var_client = &local_var_configuration.client;
1123
1124 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/manifest/divina", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
1125 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1126
1127 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1128 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1129 }
1130
1131 let local_var_req = local_var_req_builder.build()?;
1132 let local_var_resp = local_var_client.execute(local_var_req).await?;
1133
1134 let local_var_status = local_var_resp.status();
1135 let local_var_content = local_var_resp.text().await?;
1136
1137 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1138 serde_json::from_str(&local_var_content).map_err(Error::from)
1139 } else {
1140 let local_var_entity: Option<GetWebPubManifestDivinaError> = serde_json::from_str(&local_var_content).ok();
1141 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1142 Err(Error::ResponseError(local_var_error))
1143 }
1144}
1145
1146pub async fn get_web_pub_manifest_epub(configuration: &configuration::Configuration, book_id: &str) -> Result<crate::models::WpPublicationDto, Error<GetWebPubManifestEpubError>> {
1147 let local_var_configuration = configuration;
1148
1149 let local_var_client = &local_var_configuration.client;
1150
1151 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/manifest/epub", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
1152 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1153
1154 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1155 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1156 }
1157
1158 let local_var_req = local_var_req_builder.build()?;
1159 let local_var_resp = local_var_client.execute(local_var_req).await?;
1160
1161 let local_var_status = local_var_resp.status();
1162 let local_var_content = local_var_resp.text().await?;
1163
1164 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1165 serde_json::from_str(&local_var_content).map_err(Error::from)
1166 } else {
1167 let local_var_entity: Option<GetWebPubManifestEpubError> = serde_json::from_str(&local_var_content).ok();
1168 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1169 Err(Error::ResponseError(local_var_error))
1170 }
1171}
1172
1173pub async fn get_web_pub_manifest_pdf(configuration: &configuration::Configuration, book_id: &str) -> Result<crate::models::WpPublicationDto, Error<GetWebPubManifestPdfError>> {
1174 let local_var_configuration = configuration;
1175
1176 let local_var_client = &local_var_configuration.client;
1177
1178 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/manifest/pdf", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
1179 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1180
1181 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1182 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1183 }
1184
1185 let local_var_req = local_var_req_builder.build()?;
1186 let local_var_resp = local_var_client.execute(local_var_req).await?;
1187
1188 let local_var_status = local_var_resp.status();
1189 let local_var_content = local_var_resp.text().await?;
1190
1191 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1192 serde_json::from_str(&local_var_content).map_err(Error::from)
1193 } else {
1194 let local_var_entity: Option<GetWebPubManifestPdfError> = serde_json::from_str(&local_var_content).ok();
1195 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1196 Err(Error::ResponseError(local_var_error))
1197 }
1198}
1199
1200pub async fn import_books(configuration: &configuration::Configuration, book_import_batch_dto: crate::models::BookImportBatchDto) -> Result<(), Error<ImportBooksError>> {
1201 let local_var_configuration = configuration;
1202
1203 let local_var_client = &local_var_configuration.client;
1204
1205 let local_var_uri_str = format!("{}/api/v1/books/import", local_var_configuration.base_path);
1206 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1207
1208 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1209 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1210 }
1211 local_var_req_builder = local_var_req_builder.json(&book_import_batch_dto);
1212
1213 let local_var_req = local_var_req_builder.build()?;
1214 let local_var_resp = local_var_client.execute(local_var_req).await?;
1215
1216 let local_var_status = local_var_resp.status();
1217 let local_var_content = local_var_resp.text().await?;
1218
1219 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1220 Ok(())
1221 } else {
1222 let local_var_entity: Option<ImportBooksError> = serde_json::from_str(&local_var_content).ok();
1223 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1224 Err(Error::ResponseError(local_var_error))
1225 }
1226}
1227
1228pub async fn mark_progression(configuration: &configuration::Configuration, book_id: &str, r2_progression: crate::models::R2Progression) -> Result<(), Error<MarkProgressionError>> {
1229 let local_var_configuration = configuration;
1230
1231 let local_var_client = &local_var_configuration.client;
1232
1233 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/progression", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
1234 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1235
1236 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1237 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1238 }
1239 local_var_req_builder = local_var_req_builder.json(&r2_progression);
1240
1241 let local_var_req = local_var_req_builder.build()?;
1242 let local_var_resp = local_var_client.execute(local_var_req).await?;
1243
1244 let local_var_status = local_var_resp.status();
1245 let local_var_content = local_var_resp.text().await?;
1246
1247 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1248 Ok(())
1249 } else {
1250 let local_var_entity: Option<MarkProgressionError> = serde_json::from_str(&local_var_content).ok();
1251 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1252 Err(Error::ResponseError(local_var_error))
1253 }
1254}
1255
1256pub async fn mark_read_progress(configuration: &configuration::Configuration, book_id: &str, read_progress_update_dto: crate::models::ReadProgressUpdateDto) -> Result<(), Error<MarkReadProgressError>> {
1258 let local_var_configuration = configuration;
1259
1260 let local_var_client = &local_var_configuration.client;
1261
1262 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/read-progress", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
1263 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1264
1265 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1266 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1267 }
1268 local_var_req_builder = local_var_req_builder.json(&read_progress_update_dto);
1269
1270 let local_var_req = local_var_req_builder.build()?;
1271 let local_var_resp = local_var_client.execute(local_var_req).await?;
1272
1273 let local_var_status = local_var_resp.status();
1274 let local_var_content = local_var_resp.text().await?;
1275
1276 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1277 Ok(())
1278 } else {
1279 let local_var_entity: Option<MarkReadProgressError> = serde_json::from_str(&local_var_content).ok();
1280 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1281 Err(Error::ResponseError(local_var_error))
1282 }
1283}
1284
1285pub async fn mark_selected_book_thumbnail(configuration: &configuration::Configuration, book_id: &str, thumbnail_id: &str) -> Result<(), Error<MarkSelectedBookThumbnailError>> {
1286 let local_var_configuration = configuration;
1287
1288 let local_var_client = &local_var_configuration.client;
1289
1290 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/thumbnails/{thumbnailId}/selected", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id), thumbnailId=crate::apis::urlencode(thumbnail_id));
1291 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1292
1293 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1294 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1295 }
1296
1297 let local_var_req = local_var_req_builder.build()?;
1298 let local_var_resp = local_var_client.execute(local_var_req).await?;
1299
1300 let local_var_status = local_var_resp.status();
1301 let local_var_content = local_var_resp.text().await?;
1302
1303 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1304 Ok(())
1305 } else {
1306 let local_var_entity: Option<MarkSelectedBookThumbnailError> = serde_json::from_str(&local_var_content).ok();
1307 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1308 Err(Error::ResponseError(local_var_error))
1309 }
1310}
1311
1312pub async fn refresh_metadata2(configuration: &configuration::Configuration, book_id: &str) -> Result<(), Error<RefreshMetadata2Error>> {
1313 let local_var_configuration = configuration;
1314
1315 let local_var_client = &local_var_configuration.client;
1316
1317 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/metadata/refresh", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
1318 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1319
1320 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1321 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1322 }
1323
1324 let local_var_req = local_var_req_builder.build()?;
1325 let local_var_resp = local_var_client.execute(local_var_req).await?;
1326
1327 let local_var_status = local_var_resp.status();
1328 let local_var_content = local_var_resp.text().await?;
1329
1330 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1331 Ok(())
1332 } else {
1333 let local_var_entity: Option<RefreshMetadata2Error> = serde_json::from_str(&local_var_content).ok();
1334 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1335 Err(Error::ResponseError(local_var_error))
1336 }
1337}
1338
1339pub async fn regenerate_thumbnails(configuration: &configuration::Configuration, for_bigger_result_only: Option<bool>) -> Result<(), Error<RegenerateThumbnailsError>> {
1340 let local_var_configuration = configuration;
1341
1342 let local_var_client = &local_var_configuration.client;
1343
1344 let local_var_uri_str = format!("{}/api/v1/books/thumbnails", local_var_configuration.base_path);
1345 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1346
1347 if let Some(ref local_var_str) = for_bigger_result_only {
1348 local_var_req_builder = local_var_req_builder.query(&[("for_bigger_result_only", &local_var_str.to_string())]);
1349 }
1350 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1351 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1352 }
1353
1354 let local_var_req = local_var_req_builder.build()?;
1355 let local_var_resp = local_var_client.execute(local_var_req).await?;
1356
1357 let local_var_status = local_var_resp.status();
1358 let local_var_content = local_var_resp.text().await?;
1359
1360 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1361 Ok(())
1362 } else {
1363 let local_var_entity: Option<RegenerateThumbnailsError> = serde_json::from_str(&local_var_content).ok();
1364 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1365 Err(Error::ResponseError(local_var_error))
1366 }
1367}
1368
1369pub async fn update_batch_metadata(configuration: &configuration::Configuration, request_body: ::std::collections::HashMap<String, crate::models::BookMetadataUpdateDto>) -> Result<(), Error<UpdateBatchMetadataError>> {
1370 let local_var_configuration = configuration;
1371
1372 let local_var_client = &local_var_configuration.client;
1373
1374 let local_var_uri_str = format!("{}/api/v1/books/metadata", local_var_configuration.base_path);
1375 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1376
1377 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1378 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1379 }
1380 local_var_req_builder = local_var_req_builder.json(&request_body);
1381
1382 let local_var_req = local_var_req_builder.build()?;
1383 let local_var_resp = local_var_client.execute(local_var_req).await?;
1384
1385 let local_var_status = local_var_resp.status();
1386 let local_var_content = local_var_resp.text().await?;
1387
1388 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1389 Ok(())
1390 } else {
1391 let local_var_entity: Option<UpdateBatchMetadataError> = serde_json::from_str(&local_var_content).ok();
1392 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1393 Err(Error::ResponseError(local_var_error))
1394 }
1395}
1396
1397pub async fn update_metadata1(configuration: &configuration::Configuration, book_id: &str, book_metadata_update_dto: crate::models::BookMetadataUpdateDto) -> Result<(), Error<UpdateMetadata1Error>> {
1398 let local_var_configuration = configuration;
1399
1400 let local_var_client = &local_var_configuration.client;
1401
1402 let local_var_uri_str = format!("{}/api/v1/books/{bookId}/metadata", local_var_configuration.base_path, bookId=crate::apis::urlencode(book_id));
1403 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1404
1405 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1406 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1407 }
1408 local_var_req_builder = local_var_req_builder.json(&book_metadata_update_dto);
1409
1410 let local_var_req = local_var_req_builder.build()?;
1411 let local_var_resp = local_var_client.execute(local_var_req).await?;
1412
1413 let local_var_status = local_var_resp.status();
1414 let local_var_content = local_var_resp.text().await?;
1415
1416 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1417 Ok(())
1418 } else {
1419 let local_var_entity: Option<UpdateMetadata1Error> = serde_json::from_str(&local_var_content).ok();
1420 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1421 Err(Error::ResponseError(local_var_error))
1422 }
1423}
1424