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 Delete11Error {
20 UnknownValue(serde_json::Value),
21}
22
23#[derive(Debug, Clone, Serialize, Deserialize)]
25#[serde(untagged)]
26pub enum FindAll6Error {
27 UnknownValue(serde_json::Value),
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize)]
32#[serde(untagged)]
33pub enum FindAll7Error {
34 UnknownValue(serde_json::Value),
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum FindById2Error {
41 UnknownValue(serde_json::Value),
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum FindByIds2Error {
48 UnknownValue(serde_json::Value),
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(untagged)]
54pub enum ManualSubmitError {
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum RemoveAttachmentError {
62 UnknownValue(serde_json::Value),
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
67#[serde(untagged)]
68pub enum SummariesError {
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum ToggleBookmarked2Error {
76 UnknownValue(serde_json::Value),
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum UpdatePriceError {
83 UnknownValue(serde_json::Value),
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum UpdateTag1Error {
90 UnknownValue(serde_json::Value),
91}
92
93pub async fn delete11(
94 configuration: &configuration::Configuration,
95 id: &str,
96) -> Result<models::Restore200Response, Error<Delete11Error>> {
97 let p_query_id = id;
99
100 let uri_str = format!("{}/api/fee", configuration.base_path);
101 let mut req_builder = configuration
102 .client
103 .request(reqwest::Method::DELETE, &uri_str);
104
105 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
106 if let Some(ref user_agent) = configuration.user_agent {
107 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
108 }
109 if let Some(ref token) = configuration.bearer_access_token {
110 req_builder = req_builder.bearer_auth(token.to_owned());
111 };
112
113 let req = req_builder.build()?;
114 let resp = configuration.client.execute(req).await?;
115
116 let status = resp.status();
117 let content_type = resp
118 .headers()
119 .get("content-type")
120 .and_then(|v| v.to_str().ok())
121 .unwrap_or("application/octet-stream");
122 let content_type = super::ContentType::from(content_type);
123
124 if !status.is_client_error() && !status.is_server_error() {
125 let content = resp.text().await?;
126 match content_type {
127 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
128 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Restore200Response`"))),
129 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`")))),
130 }
131 } else {
132 let content = resp.text().await?;
133 let entity: Option<Delete11Error> = serde_json::from_str(&content).ok();
134 Err(Error::ResponseError(ResponseContent {
135 status,
136 content,
137 entity,
138 }))
139 }
140}
141
142pub async fn find_all6(
143 configuration: &configuration::Configuration,
144 arg1: models::Pageable,
145 fee_search_criteria: models::FeeSearchCriteria,
146) -> Result<models::PagedModelFee, Error<FindAll6Error>> {
147 let p_query_arg1 = arg1;
149 let p_body_fee_search_criteria = fee_search_criteria;
150
151 let uri_str = format!("{}/api/fee/search", 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(&[("arg1", &p_query_arg1.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 req_builder = req_builder.json(&p_body_fee_search_criteria);
164
165 let req = req_builder.build()?;
166 let resp = configuration.client.execute(req).await?;
167
168 let status = resp.status();
169 let content_type = resp
170 .headers()
171 .get("content-type")
172 .and_then(|v| v.to_str().ok())
173 .unwrap_or("application/octet-stream");
174 let content_type = super::ContentType::from(content_type);
175
176 if !status.is_client_error() && !status.is_server_error() {
177 let content = resp.text().await?;
178 match content_type {
179 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
180 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PagedModelFee`"))),
181 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PagedModelFee`")))),
182 }
183 } else {
184 let content = resp.text().await?;
185 let entity: Option<FindAll6Error> = serde_json::from_str(&content).ok();
186 Err(Error::ResponseError(ResponseContent {
187 status,
188 content,
189 entity,
190 }))
191 }
192}
193
194pub async fn find_all7(
195 configuration: &configuration::Configuration,
196) -> Result<Vec<models::Fee>, Error<FindAll7Error>> {
197 let uri_str = format!("{}/api/fee/find-all", configuration.base_path);
198 let mut req_builder = configuration
199 .client
200 .request(reqwest::Method::POST, &uri_str);
201
202 if let Some(ref user_agent) = configuration.user_agent {
203 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
204 }
205 if let Some(ref token) = configuration.bearer_access_token {
206 req_builder = req_builder.bearer_auth(token.to_owned());
207 };
208
209 let req = req_builder.build()?;
210 let resp = configuration.client.execute(req).await?;
211
212 let status = resp.status();
213 let content_type = resp
214 .headers()
215 .get("content-type")
216 .and_then(|v| v.to_str().ok())
217 .unwrap_or("application/octet-stream");
218 let content_type = super::ContentType::from(content_type);
219
220 if !status.is_client_error() && !status.is_server_error() {
221 let content = resp.text().await?;
222 match content_type {
223 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
224 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Fee>`"))),
225 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::Fee>`")))),
226 }
227 } else {
228 let content = resp.text().await?;
229 let entity: Option<FindAll7Error> = serde_json::from_str(&content).ok();
230 Err(Error::ResponseError(ResponseContent {
231 status,
232 content,
233 entity,
234 }))
235 }
236}
237
238pub async fn find_by_id2(
239 configuration: &configuration::Configuration,
240 id: &str,
241) -> Result<models::Fee, Error<FindById2Error>> {
242 let p_query_id = id;
244
245 let uri_str = format!("{}/api/fee/find-by-id", configuration.base_path);
246 let mut req_builder = configuration
247 .client
248 .request(reqwest::Method::POST, &uri_str);
249
250 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
251 if let Some(ref user_agent) = configuration.user_agent {
252 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
253 }
254 if let Some(ref token) = configuration.bearer_access_token {
255 req_builder = req_builder.bearer_auth(token.to_owned());
256 };
257
258 let req = req_builder.build()?;
259 let resp = configuration.client.execute(req).await?;
260
261 let status = resp.status();
262 let content_type = resp
263 .headers()
264 .get("content-type")
265 .and_then(|v| v.to_str().ok())
266 .unwrap_or("application/octet-stream");
267 let content_type = super::ContentType::from(content_type);
268
269 if !status.is_client_error() && !status.is_server_error() {
270 let content = resp.text().await?;
271 match content_type {
272 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
273 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Fee`"))),
274 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Fee`")))),
275 }
276 } else {
277 let content = resp.text().await?;
278 let entity: Option<FindById2Error> = serde_json::from_str(&content).ok();
279 Err(Error::ResponseError(ResponseContent {
280 status,
281 content,
282 entity,
283 }))
284 }
285}
286
287pub async fn find_by_ids2(
288 configuration: &configuration::Configuration,
289 id: Vec<String>,
290) -> Result<Vec<models::Fee>, Error<FindByIds2Error>> {
291 let p_query_id = id;
293
294 let uri_str = format!("{}/api/fee/find-by-ids", configuration.base_path);
295 let mut req_builder = configuration
296 .client
297 .request(reqwest::Method::POST, &uri_str);
298
299 req_builder = match "multi" {
300 "multi" => req_builder.query(
301 &p_query_id
302 .into_iter()
303 .map(|p| ("id".to_owned(), p.to_string()))
304 .collect::<Vec<(std::string::String, std::string::String)>>(),
305 ),
306 _ => req_builder.query(&[(
307 "id",
308 &p_query_id
309 .into_iter()
310 .map(|p| p.to_string())
311 .collect::<Vec<String>>()
312 .join(",")
313 .to_string(),
314 )]),
315 };
316 if let Some(ref user_agent) = configuration.user_agent {
317 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
318 }
319 if let Some(ref token) = configuration.bearer_access_token {
320 req_builder = req_builder.bearer_auth(token.to_owned());
321 };
322
323 let req = req_builder.build()?;
324 let resp = configuration.client.execute(req).await?;
325
326 let status = resp.status();
327 let content_type = resp
328 .headers()
329 .get("content-type")
330 .and_then(|v| v.to_str().ok())
331 .unwrap_or("application/octet-stream");
332 let content_type = super::ContentType::from(content_type);
333
334 if !status.is_client_error() && !status.is_server_error() {
335 let content = resp.text().await?;
336 match content_type {
337 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
338 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Fee>`"))),
339 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::Fee>`")))),
340 }
341 } else {
342 let content = resp.text().await?;
343 let entity: Option<FindByIds2Error> = serde_json::from_str(&content).ok();
344 Err(Error::ResponseError(ResponseContent {
345 status,
346 content,
347 entity,
348 }))
349 }
350}
351
352pub async fn manual_submit(
353 configuration: &configuration::Configuration,
354 subject: &str,
355 body: &str,
356 files: Vec<std::path::PathBuf>,
357) -> Result<models::Fee, Error<ManualSubmitError>> {
358 let p_query_subject = subject;
360 let p_query_body = body;
361 let p_form_files = files;
362
363 let uri_str = format!("{}/api/fee/manual-submit", configuration.base_path);
364 let mut req_builder = configuration
365 .client
366 .request(reqwest::Method::POST, &uri_str);
367
368 req_builder = req_builder.query(&[("subject", &p_query_subject.to_string())]);
369 req_builder = req_builder.query(&[("body", &p_query_body.to_string())]);
370 if let Some(ref user_agent) = configuration.user_agent {
371 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
372 }
373 if let Some(ref token) = configuration.bearer_access_token {
374 req_builder = req_builder.bearer_auth(token.to_owned());
375 };
376 let multipart_form = reqwest::multipart::Form::new();
377 req_builder = req_builder.multipart(multipart_form);
379
380 let req = req_builder.build()?;
381 let resp = configuration.client.execute(req).await?;
382
383 let status = resp.status();
384 let content_type = resp
385 .headers()
386 .get("content-type")
387 .and_then(|v| v.to_str().ok())
388 .unwrap_or("application/octet-stream");
389 let content_type = super::ContentType::from(content_type);
390
391 if !status.is_client_error() && !status.is_server_error() {
392 let content = resp.text().await?;
393 match content_type {
394 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
395 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Fee`"))),
396 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Fee`")))),
397 }
398 } else {
399 let content = resp.text().await?;
400 let entity: Option<ManualSubmitError> = serde_json::from_str(&content).ok();
401 Err(Error::ResponseError(ResponseContent {
402 status,
403 content,
404 entity,
405 }))
406 }
407}
408
409pub async fn remove_attachment(
410 configuration: &configuration::Configuration,
411 id: &str,
412 attachment_id: &str,
413) -> Result<models::Fee, Error<RemoveAttachmentError>> {
414 let p_query_id = id;
416 let p_query_attachment_id = attachment_id;
417
418 let uri_str = format!("{}/api/fee/remove-attachment", configuration.base_path);
419 let mut req_builder = configuration
420 .client
421 .request(reqwest::Method::POST, &uri_str);
422
423 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
424 req_builder = req_builder.query(&[("attachmentId", &p_query_attachment_id.to_string())]);
425 if let Some(ref user_agent) = configuration.user_agent {
426 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
427 }
428 if let Some(ref token) = configuration.bearer_access_token {
429 req_builder = req_builder.bearer_auth(token.to_owned());
430 };
431
432 let req = req_builder.build()?;
433 let resp = configuration.client.execute(req).await?;
434
435 let status = resp.status();
436 let content_type = resp
437 .headers()
438 .get("content-type")
439 .and_then(|v| v.to_str().ok())
440 .unwrap_or("application/octet-stream");
441 let content_type = super::ContentType::from(content_type);
442
443 if !status.is_client_error() && !status.is_server_error() {
444 let content = resp.text().await?;
445 match content_type {
446 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
447 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Fee`"))),
448 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Fee`")))),
449 }
450 } else {
451 let content = resp.text().await?;
452 let entity: Option<RemoveAttachmentError> = serde_json::from_str(&content).ok();
453 Err(Error::ResponseError(ResponseContent {
454 status,
455 content,
456 entity,
457 }))
458 }
459}
460
461pub async fn summaries(
462 configuration: &configuration::Configuration,
463) -> Result<Vec<models::FeeSummary>, Error<SummariesError>> {
464 let uri_str = format!("{}/api/fee/summaries", configuration.base_path);
465 let mut req_builder = configuration
466 .client
467 .request(reqwest::Method::POST, &uri_str);
468
469 if let Some(ref user_agent) = configuration.user_agent {
470 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
471 }
472 if let Some(ref token) = configuration.bearer_access_token {
473 req_builder = req_builder.bearer_auth(token.to_owned());
474 };
475
476 let req = req_builder.build()?;
477 let resp = configuration.client.execute(req).await?;
478
479 let status = resp.status();
480 let content_type = resp
481 .headers()
482 .get("content-type")
483 .and_then(|v| v.to_str().ok())
484 .unwrap_or("application/octet-stream");
485 let content_type = super::ContentType::from(content_type);
486
487 if !status.is_client_error() && !status.is_server_error() {
488 let content = resp.text().await?;
489 match content_type {
490 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
491 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::FeeSummary>`"))),
492 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::FeeSummary>`")))),
493 }
494 } else {
495 let content = resp.text().await?;
496 let entity: Option<SummariesError> = serde_json::from_str(&content).ok();
497 Err(Error::ResponseError(ResponseContent {
498 status,
499 content,
500 entity,
501 }))
502 }
503}
504
505pub async fn toggle_bookmarked2(
506 configuration: &configuration::Configuration,
507 id: &str,
508) -> Result<models::Fee, Error<ToggleBookmarked2Error>> {
509 let p_query_id = id;
511
512 let uri_str = format!("{}/api/fee/toggle-bookmarked", configuration.base_path);
513 let mut req_builder = configuration
514 .client
515 .request(reqwest::Method::POST, &uri_str);
516
517 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
518 if let Some(ref user_agent) = configuration.user_agent {
519 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
520 }
521 if let Some(ref token) = configuration.bearer_access_token {
522 req_builder = req_builder.bearer_auth(token.to_owned());
523 };
524
525 let req = req_builder.build()?;
526 let resp = configuration.client.execute(req).await?;
527
528 let status = resp.status();
529 let content_type = resp
530 .headers()
531 .get("content-type")
532 .and_then(|v| v.to_str().ok())
533 .unwrap_or("application/octet-stream");
534 let content_type = super::ContentType::from(content_type);
535
536 if !status.is_client_error() && !status.is_server_error() {
537 let content = resp.text().await?;
538 match content_type {
539 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
540 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Fee`"))),
541 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Fee`")))),
542 }
543 } else {
544 let content = resp.text().await?;
545 let entity: Option<ToggleBookmarked2Error> = serde_json::from_str(&content).ok();
546 Err(Error::ResponseError(ResponseContent {
547 status,
548 content,
549 entity,
550 }))
551 }
552}
553
554pub async fn update_price(
555 configuration: &configuration::Configuration,
556 id: &str,
557 price_h_vat: f64,
558 vat: f64,
559) -> Result<models::Fee, Error<UpdatePriceError>> {
560 let p_query_id = id;
562 let p_query_price_h_vat = price_h_vat;
563 let p_query_vat = vat;
564
565 let uri_str = format!("{}/api/fee/update-price", configuration.base_path);
566 let mut req_builder = configuration
567 .client
568 .request(reqwest::Method::POST, &uri_str);
569
570 req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
571 req_builder = req_builder.query(&[("priceHVat", &p_query_price_h_vat.to_string())]);
572 req_builder = req_builder.query(&[("vat", &p_query_vat.to_string())]);
573 if let Some(ref user_agent) = configuration.user_agent {
574 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
575 }
576 if let Some(ref token) = configuration.bearer_access_token {
577 req_builder = req_builder.bearer_auth(token.to_owned());
578 };
579
580 let req = req_builder.build()?;
581 let resp = configuration.client.execute(req).await?;
582
583 let status = resp.status();
584 let content_type = resp
585 .headers()
586 .get("content-type")
587 .and_then(|v| v.to_str().ok())
588 .unwrap_or("application/octet-stream");
589 let content_type = super::ContentType::from(content_type);
590
591 if !status.is_client_error() && !status.is_server_error() {
592 let content = resp.text().await?;
593 match content_type {
594 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
595 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Fee`"))),
596 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Fee`")))),
597 }
598 } else {
599 let content = resp.text().await?;
600 let entity: Option<UpdatePriceError> = serde_json::from_str(&content).ok();
601 Err(Error::ResponseError(ResponseContent {
602 status,
603 content,
604 entity,
605 }))
606 }
607}
608
609pub async fn update_tag1(
610 configuration: &configuration::Configuration,
611 tag: &str,
612 request_body: Vec<String>,
613) -> Result<Vec<models::Fee>, Error<UpdateTag1Error>> {
614 let p_query_tag = tag;
616 let p_body_request_body = request_body;
617
618 let uri_str = format!("{}/api/fee/update-tag", configuration.base_path);
619 let mut req_builder = configuration
620 .client
621 .request(reqwest::Method::POST, &uri_str);
622
623 req_builder = req_builder.query(&[("tag", &p_query_tag.to_string())]);
624 if let Some(ref user_agent) = configuration.user_agent {
625 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
626 }
627 if let Some(ref token) = configuration.bearer_access_token {
628 req_builder = req_builder.bearer_auth(token.to_owned());
629 };
630 req_builder = req_builder.json(&p_body_request_body);
631
632 let req = req_builder.build()?;
633 let resp = configuration.client.execute(req).await?;
634
635 let status = resp.status();
636 let content_type = resp
637 .headers()
638 .get("content-type")
639 .and_then(|v| v.to_str().ok())
640 .unwrap_or("application/octet-stream");
641 let content_type = super::ContentType::from(content_type);
642
643 if !status.is_client_error() && !status.is_server_error() {
644 let content = resp.text().await?;
645 match content_type {
646 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
647 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Fee>`"))),
648 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::Fee>`")))),
649 }
650 } else {
651 let content = resp.text().await?;
652 let entity: Option<UpdateTag1Error> = serde_json::from_str(&content).ok();
653 Err(Error::ResponseError(ResponseContent {
654 status,
655 content,
656 entity,
657 }))
658 }
659}