1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum AddTemplateError {
20 UnknownValue(serde_json::Value),
21}
22
23#[derive(Debug, Clone, Serialize, Deserialize)]
25#[serde(untagged)]
26pub enum Bookmarked1Error {
27 UnknownValue(serde_json::Value),
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize)]
32#[serde(untagged)]
33pub enum DeleteInvoiceError {
34 UnknownValue(serde_json::Value),
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum DeleteTemplateError {
41 UnknownValue(serde_json::Value),
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum FindAllSummariesError {
48 UnknownValue(serde_json::Value),
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(untagged)]
54pub enum FindByIdError {
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum FindByIdsError {
62 UnknownValue(serde_json::Value),
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
67#[serde(untagged)]
68pub enum FindByIds1Error {
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum ListTemplatesError {
76 UnknownValue(serde_json::Value),
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum MakeCreditNoteError {
83 UnknownValue(serde_json::Value),
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum ManualUploadError {
90 UnknownValue(serde_json::Value),
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize)]
95#[serde(untagged)]
96pub enum NewInvoiceGenerationEmptyTemplateError {
97 UnknownValue(serde_json::Value),
98}
99
100#[derive(Debug, Clone, Serialize, Deserialize)]
102#[serde(untagged)]
103pub enum NewInvoiceGenerationFromTemplateError {
104 UnknownValue(serde_json::Value),
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum PageError {
111 UnknownValue(serde_json::Value),
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum RestoreError {
118 UnknownValue(serde_json::Value),
119}
120
121#[derive(Debug, Clone, Serialize, Deserialize)]
123#[serde(untagged)]
124pub enum Save4Error {
125 UnknownValue(serde_json::Value),
126}
127
128#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum ToggleBookmarked1Error {
132 UnknownValue(serde_json::Value),
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
137#[serde(untagged)]
138pub enum ValidatePeppolError {
139 UnknownValue(serde_json::Value),
140}
141
142pub async fn add_template(
143 configuration: &configuration::Configuration,
144 name: &str,
145 template: std::path::PathBuf,
146) -> Result<models::InvoiceFreemarkerTemplate, Error<AddTemplateError>> {
147 let p_query_name = name;
149 let p_form_template = template;
150
151 let uri_str = format!("{}/api/invoice/add-template", configuration.base_path);
152 let mut req_builder = configuration
153 .client
154 .request(reqwest::Method::POST, &uri_str);
155
156 req_builder = req_builder.query(&[("name", &p_query_name.to_string())]);
157 if let Some(ref user_agent) = configuration.user_agent {
158 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
159 }
160 if let Some(ref token) = configuration.bearer_access_token {
161 req_builder = req_builder.bearer_auth(token.to_owned());
162 };
163 let multipart_form = reqwest::multipart::Form::new();
164 req_builder = req_builder.multipart(multipart_form);
166
167 let req = req_builder.build()?;
168 let resp = configuration.client.execute(req).await?;
169
170 let status = resp.status();
171 let content_type = resp
172 .headers()
173 .get("content-type")
174 .and_then(|v| v.to_str().ok())
175 .unwrap_or("application/octet-stream");
176 let content_type = super::ContentType::from(content_type);
177
178 if !status.is_client_error() && !status.is_server_error() {
179 let content = resp.text().await?;
180 match content_type {
181 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
182 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InvoiceFreemarkerTemplate`"))),
183 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::InvoiceFreemarkerTemplate`")))),
184 }
185 } else {
186 let content = resp.text().await?;
187 let entity: Option<AddTemplateError> = serde_json::from_str(&content).ok();
188 Err(Error::ResponseError(ResponseContent {
189 status,
190 content,
191 entity,
192 }))
193 }
194}
195
196pub async fn bookmarked1(
197 configuration: &configuration::Configuration,
198 arg0: models::Pageable,
199) -> Result<models::PagedModelInvoiceGeneration, Error<Bookmarked1Error>> {
200 let p_query_arg0 = arg0;
202
203 let uri_str = format!("{}/api/invoice/bookmarked", configuration.base_path);
204 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
205
206 req_builder = req_builder.query(&[("arg0", &p_query_arg0.to_string())]);
207 if let Some(ref user_agent) = configuration.user_agent {
208 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
209 }
210 if let Some(ref token) = configuration.bearer_access_token {
211 req_builder = req_builder.bearer_auth(token.to_owned());
212 };
213
214 let req = req_builder.build()?;
215 let resp = configuration.client.execute(req).await?;
216
217 let status = resp.status();
218 let content_type = resp
219 .headers()
220 .get("content-type")
221 .and_then(|v| v.to_str().ok())
222 .unwrap_or("application/octet-stream");
223 let content_type = super::ContentType::from(content_type);
224
225 if !status.is_client_error() && !status.is_server_error() {
226 let content = resp.text().await?;
227 match content_type {
228 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
229 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PagedModelInvoiceGeneration`"))),
230 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PagedModelInvoiceGeneration`")))),
231 }
232 } else {
233 let content = resp.text().await?;
234 let entity: Option<Bookmarked1Error> = serde_json::from_str(&content).ok();
235 Err(Error::ResponseError(ResponseContent {
236 status,
237 content,
238 entity,
239 }))
240 }
241}
242
243pub async fn delete_invoice(
244 configuration: &configuration::Configuration,
245 id: &str,
246 logical: Option<bool>,
247) -> Result<models::Restore200Response, Error<DeleteInvoiceError>> {
248 let p_query_id = id;
250 let p_query_logical = logical;
251
252 let uri_str = format!("{}/api/invoice", configuration.base_path);
253 let mut req_builder = configuration
254 .client
255 .request(reqwest::Method::DELETE, &uri_str);
256
257 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
258 if let Some(ref param_value) = p_query_logical {
259 req_builder = req_builder.query(&[("logical", ¶m_value.to_string())]);
260 }
261 if let Some(ref user_agent) = configuration.user_agent {
262 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
263 }
264 if let Some(ref token) = configuration.bearer_access_token {
265 req_builder = req_builder.bearer_auth(token.to_owned());
266 };
267
268 let req = req_builder.build()?;
269 let resp = configuration.client.execute(req).await?;
270
271 let status = resp.status();
272 let content_type = resp
273 .headers()
274 .get("content-type")
275 .and_then(|v| v.to_str().ok())
276 .unwrap_or("application/octet-stream");
277 let content_type = super::ContentType::from(content_type);
278
279 if !status.is_client_error() && !status.is_server_error() {
280 let content = resp.text().await?;
281 match content_type {
282 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
283 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Restore200Response`"))),
284 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Restore200Response`")))),
285 }
286 } else {
287 let content = resp.text().await?;
288 let entity: Option<DeleteInvoiceError> = serde_json::from_str(&content).ok();
289 Err(Error::ResponseError(ResponseContent {
290 status,
291 content,
292 entity,
293 }))
294 }
295}
296
297pub async fn delete_template(
298 configuration: &configuration::Configuration,
299 id: &str,
300) -> Result<(), Error<DeleteTemplateError>> {
301 let p_query_id = id;
303
304 let uri_str = format!("{}/api/invoice/delete-template", configuration.base_path);
305 let mut req_builder = configuration
306 .client
307 .request(reqwest::Method::DELETE, &uri_str);
308
309 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
310 if let Some(ref user_agent) = configuration.user_agent {
311 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
312 }
313 if let Some(ref token) = configuration.bearer_access_token {
314 req_builder = req_builder.bearer_auth(token.to_owned());
315 };
316
317 let req = req_builder.build()?;
318 let resp = configuration.client.execute(req).await?;
319
320 let status = resp.status();
321
322 if !status.is_client_error() && !status.is_server_error() {
323 Ok(())
324 } else {
325 let content = resp.text().await?;
326 let entity: Option<DeleteTemplateError> = serde_json::from_str(&content).ok();
327 Err(Error::ResponseError(ResponseContent {
328 status,
329 content,
330 entity,
331 }))
332 }
333}
334
335pub async fn find_all_summaries(
336 configuration: &configuration::Configuration,
337) -> Result<Vec<models::InvoiceSummary>, Error<FindAllSummariesError>> {
338 let uri_str = format!("{}/api/invoice/find-all-summaries", configuration.base_path);
339 let mut req_builder = configuration
340 .client
341 .request(reqwest::Method::POST, &uri_str);
342
343 if let Some(ref user_agent) = configuration.user_agent {
344 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
345 }
346 if let Some(ref token) = configuration.bearer_access_token {
347 req_builder = req_builder.bearer_auth(token.to_owned());
348 };
349
350 let req = req_builder.build()?;
351 let resp = configuration.client.execute(req).await?;
352
353 let status = resp.status();
354 let content_type = resp
355 .headers()
356 .get("content-type")
357 .and_then(|v| v.to_str().ok())
358 .unwrap_or("application/octet-stream");
359 let content_type = super::ContentType::from(content_type);
360
361 if !status.is_client_error() && !status.is_server_error() {
362 let content = resp.text().await?;
363 match content_type {
364 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
365 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::InvoiceSummary>`"))),
366 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::InvoiceSummary>`")))),
367 }
368 } else {
369 let content = resp.text().await?;
370 let entity: Option<FindAllSummariesError> = serde_json::from_str(&content).ok();
371 Err(Error::ResponseError(ResponseContent {
372 status,
373 content,
374 entity,
375 }))
376 }
377}
378
379pub async fn find_by_id(
380 configuration: &configuration::Configuration,
381 id: &str,
382) -> Result<models::InvoiceGeneration, Error<FindByIdError>> {
383 let p_query_id = id;
385
386 let uri_str = format!("{}/api/invoice/find-by-id", configuration.base_path);
387 let mut req_builder = configuration
388 .client
389 .request(reqwest::Method::POST, &uri_str);
390
391 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
392 if let Some(ref user_agent) = configuration.user_agent {
393 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
394 }
395 if let Some(ref token) = configuration.bearer_access_token {
396 req_builder = req_builder.bearer_auth(token.to_owned());
397 };
398
399 let req = req_builder.build()?;
400 let resp = configuration.client.execute(req).await?;
401
402 let status = resp.status();
403 let content_type = resp
404 .headers()
405 .get("content-type")
406 .and_then(|v| v.to_str().ok())
407 .unwrap_or("application/octet-stream");
408 let content_type = super::ContentType::from(content_type);
409
410 if !status.is_client_error() && !status.is_server_error() {
411 let content = resp.text().await?;
412 match content_type {
413 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
414 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InvoiceGeneration`"))),
415 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::InvoiceGeneration`")))),
416 }
417 } else {
418 let content = resp.text().await?;
419 let entity: Option<FindByIdError> = serde_json::from_str(&content).ok();
420 Err(Error::ResponseError(ResponseContent {
421 status,
422 content,
423 entity,
424 }))
425 }
426}
427
428pub async fn find_by_ids(
429 configuration: &configuration::Configuration,
430 id: &str,
431) -> Result<(), Error<FindByIdsError>> {
432 let p_query_id = id;
434
435 let uri_str = format!("{}/api/invoice/send-to-peppol", configuration.base_path);
436 let mut req_builder = configuration
437 .client
438 .request(reqwest::Method::POST, &uri_str);
439
440 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
441 if let Some(ref user_agent) = configuration.user_agent {
442 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
443 }
444 if let Some(ref token) = configuration.bearer_access_token {
445 req_builder = req_builder.bearer_auth(token.to_owned());
446 };
447
448 let req = req_builder.build()?;
449 let resp = configuration.client.execute(req).await?;
450
451 let status = resp.status();
452
453 if !status.is_client_error() && !status.is_server_error() {
454 Ok(())
455 } else {
456 let content = resp.text().await?;
457 let entity: Option<FindByIdsError> = serde_json::from_str(&content).ok();
458 Err(Error::ResponseError(ResponseContent {
459 status,
460 content,
461 entity,
462 }))
463 }
464}
465
466pub async fn find_by_ids1(
467 configuration: &configuration::Configuration,
468 id: Vec<String>,
469) -> Result<Vec<models::InvoiceGeneration>, Error<FindByIds1Error>> {
470 let p_query_id = id;
472
473 let uri_str = format!("{}/api/invoice/find-by-ids", configuration.base_path);
474 let mut req_builder = configuration
475 .client
476 .request(reqwest::Method::POST, &uri_str);
477
478 req_builder = match "multi" {
479 "multi" => req_builder.query(
480 &p_query_id
481 .into_iter()
482 .map(|p| ("id".to_owned(), p.to_string()))
483 .collect::<Vec<(std::string::String, std::string::String)>>(),
484 ),
485 _ => req_builder.query(&[(
486 "id",
487 &p_query_id
488 .into_iter()
489 .map(|p| p.to_string())
490 .collect::<Vec<String>>()
491 .join(",")
492 .to_string(),
493 )]),
494 };
495 if let Some(ref user_agent) = configuration.user_agent {
496 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
497 }
498 if let Some(ref token) = configuration.bearer_access_token {
499 req_builder = req_builder.bearer_auth(token.to_owned());
500 };
501
502 let req = req_builder.build()?;
503 let resp = configuration.client.execute(req).await?;
504
505 let status = resp.status();
506 let content_type = resp
507 .headers()
508 .get("content-type")
509 .and_then(|v| v.to_str().ok())
510 .unwrap_or("application/octet-stream");
511 let content_type = super::ContentType::from(content_type);
512
513 if !status.is_client_error() && !status.is_server_error() {
514 let content = resp.text().await?;
515 match content_type {
516 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
517 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::InvoiceGeneration>`"))),
518 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::InvoiceGeneration>`")))),
519 }
520 } else {
521 let content = resp.text().await?;
522 let entity: Option<FindByIds1Error> = serde_json::from_str(&content).ok();
523 Err(Error::ResponseError(ResponseContent {
524 status,
525 content,
526 entity,
527 }))
528 }
529}
530
531pub async fn list_templates(
532 configuration: &configuration::Configuration,
533) -> Result<Vec<models::InvoiceFreemarkerTemplate>, Error<ListTemplatesError>> {
534 let uri_str = format!("{}/api/invoice/list-templates", configuration.base_path);
535 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
536
537 if let Some(ref user_agent) = configuration.user_agent {
538 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
539 }
540 if let Some(ref token) = configuration.bearer_access_token {
541 req_builder = req_builder.bearer_auth(token.to_owned());
542 };
543
544 let req = req_builder.build()?;
545 let resp = configuration.client.execute(req).await?;
546
547 let status = resp.status();
548 let content_type = resp
549 .headers()
550 .get("content-type")
551 .and_then(|v| v.to_str().ok())
552 .unwrap_or("application/octet-stream");
553 let content_type = super::ContentType::from(content_type);
554
555 if !status.is_client_error() && !status.is_server_error() {
556 let content = resp.text().await?;
557 match content_type {
558 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
559 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::InvoiceFreemarkerTemplate>`"))),
560 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::InvoiceFreemarkerTemplate>`")))),
561 }
562 } else {
563 let content = resp.text().await?;
564 let entity: Option<ListTemplatesError> = serde_json::from_str(&content).ok();
565 Err(Error::ResponseError(ResponseContent {
566 status,
567 content,
568 entity,
569 }))
570 }
571}
572
573pub async fn make_credit_note(
574 configuration: &configuration::Configuration,
575 id: &str,
576) -> Result<models::InvoiceGeneration, Error<MakeCreditNoteError>> {
577 let p_query_id = id;
579
580 let uri_str = format!("{}/api/invoice/make-credit-note", configuration.base_path);
581 let mut req_builder = configuration
582 .client
583 .request(reqwest::Method::POST, &uri_str);
584
585 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
586 if let Some(ref user_agent) = configuration.user_agent {
587 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
588 }
589 if let Some(ref token) = configuration.bearer_access_token {
590 req_builder = req_builder.bearer_auth(token.to_owned());
591 };
592
593 let req = req_builder.build()?;
594 let resp = configuration.client.execute(req).await?;
595
596 let status = resp.status();
597 let content_type = resp
598 .headers()
599 .get("content-type")
600 .and_then(|v| v.to_str().ok())
601 .unwrap_or("application/octet-stream");
602 let content_type = super::ContentType::from(content_type);
603
604 if !status.is_client_error() && !status.is_server_error() {
605 let content = resp.text().await?;
606 match content_type {
607 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
608 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InvoiceGeneration`"))),
609 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::InvoiceGeneration`")))),
610 }
611 } else {
612 let content = resp.text().await?;
613 let entity: Option<MakeCreditNoteError> = serde_json::from_str(&content).ok();
614 Err(Error::ResponseError(ResponseContent {
615 status,
616 content,
617 entity,
618 }))
619 }
620}
621
622pub async fn manual_upload(
623 configuration: &configuration::Configuration,
624 id: &str,
625 manual_upload_file: std::path::PathBuf,
626) -> Result<(), Error<ManualUploadError>> {
627 let p_query_id = id;
629 let p_form_manual_upload_file = manual_upload_file;
630
631 let uri_str = format!("{}/api/invoice/manual-upload", configuration.base_path);
632 let mut req_builder = configuration
633 .client
634 .request(reqwest::Method::POST, &uri_str);
635
636 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
637 if let Some(ref user_agent) = configuration.user_agent {
638 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
639 }
640 if let Some(ref token) = configuration.bearer_access_token {
641 req_builder = req_builder.bearer_auth(token.to_owned());
642 };
643 let multipart_form = reqwest::multipart::Form::new();
644 req_builder = req_builder.multipart(multipart_form);
646
647 let req = req_builder.build()?;
648 let resp = configuration.client.execute(req).await?;
649
650 let status = resp.status();
651
652 if !status.is_client_error() && !status.is_server_error() {
653 Ok(())
654 } else {
655 let content = resp.text().await?;
656 let entity: Option<ManualUploadError> = serde_json::from_str(&content).ok();
657 Err(Error::ResponseError(ResponseContent {
658 status,
659 content,
660 entity,
661 }))
662 }
663}
664
665pub async fn new_invoice_generation_empty_template(
666 configuration: &configuration::Configuration,
667) -> Result<models::InvoiceGeneration, Error<NewInvoiceGenerationEmptyTemplateError>> {
668 let uri_str = format!("{}/api/invoice/new", configuration.base_path);
669 let mut req_builder = configuration
670 .client
671 .request(reqwest::Method::POST, &uri_str);
672
673 if let Some(ref user_agent) = configuration.user_agent {
674 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
675 }
676 if let Some(ref token) = configuration.bearer_access_token {
677 req_builder = req_builder.bearer_auth(token.to_owned());
678 };
679
680 let req = req_builder.build()?;
681 let resp = configuration.client.execute(req).await?;
682
683 let status = resp.status();
684 let content_type = resp
685 .headers()
686 .get("content-type")
687 .and_then(|v| v.to_str().ok())
688 .unwrap_or("application/octet-stream");
689 let content_type = super::ContentType::from(content_type);
690
691 if !status.is_client_error() && !status.is_server_error() {
692 let content = resp.text().await?;
693 match content_type {
694 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
695 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InvoiceGeneration`"))),
696 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::InvoiceGeneration`")))),
697 }
698 } else {
699 let content = resp.text().await?;
700 let entity: Option<NewInvoiceGenerationEmptyTemplateError> =
701 serde_json::from_str(&content).ok();
702 Err(Error::ResponseError(ResponseContent {
703 status,
704 content,
705 entity,
706 }))
707 }
708}
709
710pub async fn new_invoice_generation_from_template(
711 configuration: &configuration::Configuration,
712 id: &str,
713) -> Result<models::InvoiceGeneration, Error<NewInvoiceGenerationFromTemplateError>> {
714 let p_query_id = id;
716
717 let uri_str = format!("{}/api/invoice/from-template", configuration.base_path);
718 let mut req_builder = configuration
719 .client
720 .request(reqwest::Method::POST, &uri_str);
721
722 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
723 if let Some(ref user_agent) = configuration.user_agent {
724 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
725 }
726 if let Some(ref token) = configuration.bearer_access_token {
727 req_builder = req_builder.bearer_auth(token.to_owned());
728 };
729
730 let req = req_builder.build()?;
731 let resp = configuration.client.execute(req).await?;
732
733 let status = resp.status();
734 let content_type = resp
735 .headers()
736 .get("content-type")
737 .and_then(|v| v.to_str().ok())
738 .unwrap_or("application/octet-stream");
739 let content_type = super::ContentType::from(content_type);
740
741 if !status.is_client_error() && !status.is_server_error() {
742 let content = resp.text().await?;
743 match content_type {
744 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
745 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InvoiceGeneration`"))),
746 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::InvoiceGeneration`")))),
747 }
748 } else {
749 let content = resp.text().await?;
750 let entity: Option<NewInvoiceGenerationFromTemplateError> =
751 serde_json::from_str(&content).ok();
752 Err(Error::ResponseError(ResponseContent {
753 status,
754 content,
755 entity,
756 }))
757 }
758}
759
760pub async fn page(
761 configuration: &configuration::Configuration,
762 arg2: models::Pageable,
763 archived: Option<bool>,
764 logical: Option<bool>,
765) -> Result<models::PagedModelInvoiceGeneration, Error<PageError>> {
766 let p_query_arg2 = arg2;
768 let p_query_archived = archived;
769 let p_query_logical = logical;
770
771 let uri_str = format!("{}/api/invoice/page", configuration.base_path);
772 let mut req_builder = configuration
773 .client
774 .request(reqwest::Method::POST, &uri_str);
775
776 if let Some(ref param_value) = p_query_archived {
777 req_builder = req_builder.query(&[("archived", ¶m_value.to_string())]);
778 }
779 if let Some(ref param_value) = p_query_logical {
780 req_builder = req_builder.query(&[("logical", ¶m_value.to_string())]);
781 }
782 req_builder = req_builder.query(&[("arg2", &p_query_arg2.to_string())]);
783 if let Some(ref user_agent) = configuration.user_agent {
784 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
785 }
786 if let Some(ref token) = configuration.bearer_access_token {
787 req_builder = req_builder.bearer_auth(token.to_owned());
788 };
789
790 let req = req_builder.build()?;
791 let resp = configuration.client.execute(req).await?;
792
793 let status = resp.status();
794 let content_type = resp
795 .headers()
796 .get("content-type")
797 .and_then(|v| v.to_str().ok())
798 .unwrap_or("application/octet-stream");
799 let content_type = super::ContentType::from(content_type);
800
801 if !status.is_client_error() && !status.is_server_error() {
802 let content = resp.text().await?;
803 match content_type {
804 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
805 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PagedModelInvoiceGeneration`"))),
806 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PagedModelInvoiceGeneration`")))),
807 }
808 } else {
809 let content = resp.text().await?;
810 let entity: Option<PageError> = serde_json::from_str(&content).ok();
811 Err(Error::ResponseError(ResponseContent {
812 status,
813 content,
814 entity,
815 }))
816 }
817}
818
819pub async fn restore(
820 configuration: &configuration::Configuration,
821 id: &str,
822) -> Result<models::Restore200Response, Error<RestoreError>> {
823 let p_query_id = id;
825
826 let uri_str = format!("{}/api/invoice/restore", configuration.base_path);
827 let mut req_builder = configuration
828 .client
829 .request(reqwest::Method::POST, &uri_str);
830
831 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
832 if let Some(ref user_agent) = configuration.user_agent {
833 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
834 }
835 if let Some(ref token) = configuration.bearer_access_token {
836 req_builder = req_builder.bearer_auth(token.to_owned());
837 };
838
839 let req = req_builder.build()?;
840 let resp = configuration.client.execute(req).await?;
841
842 let status = resp.status();
843 let content_type = resp
844 .headers()
845 .get("content-type")
846 .and_then(|v| v.to_str().ok())
847 .unwrap_or("application/octet-stream");
848 let content_type = super::ContentType::from(content_type);
849
850 if !status.is_client_error() && !status.is_server_error() {
851 let content = resp.text().await?;
852 match content_type {
853 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
854 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Restore200Response`"))),
855 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Restore200Response`")))),
856 }
857 } else {
858 let content = resp.text().await?;
859 let entity: Option<RestoreError> = serde_json::from_str(&content).ok();
860 Err(Error::ResponseError(ResponseContent {
861 status,
862 content,
863 entity,
864 }))
865 }
866}
867
868pub async fn save4(
869 configuration: &configuration::Configuration,
870 invoice_generation: models::InvoiceGeneration,
871) -> Result<models::InvoiceGeneration, Error<Save4Error>> {
872 let p_body_invoice_generation = invoice_generation;
874
875 let uri_str = format!("{}/api/invoice/save", configuration.base_path);
876 let mut req_builder = configuration
877 .client
878 .request(reqwest::Method::POST, &uri_str);
879
880 if let Some(ref user_agent) = configuration.user_agent {
881 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
882 }
883 if let Some(ref token) = configuration.bearer_access_token {
884 req_builder = req_builder.bearer_auth(token.to_owned());
885 };
886 req_builder = req_builder.json(&p_body_invoice_generation);
887
888 let req = req_builder.build()?;
889 let resp = configuration.client.execute(req).await?;
890
891 let status = resp.status();
892 let content_type = resp
893 .headers()
894 .get("content-type")
895 .and_then(|v| v.to_str().ok())
896 .unwrap_or("application/octet-stream");
897 let content_type = super::ContentType::from(content_type);
898
899 if !status.is_client_error() && !status.is_server_error() {
900 let content = resp.text().await?;
901 match content_type {
902 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
903 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InvoiceGeneration`"))),
904 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::InvoiceGeneration`")))),
905 }
906 } else {
907 let content = resp.text().await?;
908 let entity: Option<Save4Error> = serde_json::from_str(&content).ok();
909 Err(Error::ResponseError(ResponseContent {
910 status,
911 content,
912 entity,
913 }))
914 }
915}
916
917pub async fn toggle_bookmarked1(
918 configuration: &configuration::Configuration,
919 id: &str,
920) -> Result<models::InvoiceGeneration, Error<ToggleBookmarked1Error>> {
921 let p_query_id = id;
923
924 let uri_str = format!("{}/api/invoice/toggle-bookmarked", configuration.base_path);
925 let mut req_builder = configuration
926 .client
927 .request(reqwest::Method::POST, &uri_str);
928
929 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
930 if let Some(ref user_agent) = configuration.user_agent {
931 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
932 }
933 if let Some(ref token) = configuration.bearer_access_token {
934 req_builder = req_builder.bearer_auth(token.to_owned());
935 };
936
937 let req = req_builder.build()?;
938 let resp = configuration.client.execute(req).await?;
939
940 let status = resp.status();
941 let content_type = resp
942 .headers()
943 .get("content-type")
944 .and_then(|v| v.to_str().ok())
945 .unwrap_or("application/octet-stream");
946 let content_type = super::ContentType::from(content_type);
947
948 if !status.is_client_error() && !status.is_server_error() {
949 let content = resp.text().await?;
950 match content_type {
951 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
952 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InvoiceGeneration`"))),
953 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::InvoiceGeneration`")))),
954 }
955 } else {
956 let content = resp.text().await?;
957 let entity: Option<ToggleBookmarked1Error> = serde_json::from_str(&content).ok();
958 Err(Error::ResponseError(ResponseContent {
959 status,
960 content,
961 entity,
962 }))
963 }
964}
965
966pub async fn validate_peppol(
967 configuration: &configuration::Configuration,
968 id: &str,
969) -> Result<models::PeppolValidationResult, Error<ValidatePeppolError>> {
970 let p_query_id = id;
972
973 let uri_str = format!("{}/api/invoice/validate-peppol", configuration.base_path);
974 let mut req_builder = configuration
975 .client
976 .request(reqwest::Method::POST, &uri_str);
977
978 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
979 if let Some(ref user_agent) = configuration.user_agent {
980 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
981 }
982 if let Some(ref token) = configuration.bearer_access_token {
983 req_builder = req_builder.bearer_auth(token.to_owned());
984 };
985
986 let req = req_builder.build()?;
987 let resp = configuration.client.execute(req).await?;
988
989 let status = resp.status();
990 let content_type = resp
991 .headers()
992 .get("content-type")
993 .and_then(|v| v.to_str().ok())
994 .unwrap_or("application/octet-stream");
995 let content_type = super::ContentType::from(content_type);
996
997 if !status.is_client_error() && !status.is_server_error() {
998 let content = resp.text().await?;
999 match content_type {
1000 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1001 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PeppolValidationResult`"))),
1002 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PeppolValidationResult`")))),
1003 }
1004 } else {
1005 let content = resp.text().await?;
1006 let entity: Option<ValidatePeppolError> = serde_json::from_str(&content).ok();
1007 Err(Error::ResponseError(ResponseContent {
1008 status,
1009 content,
1010 entity,
1011 }))
1012 }
1013}