1use reqwest;
13
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ListArchiveCategoriesError {
22 Status401(),
23 Status404(),
24 UnknownValue(serde_json::Value),
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum ListCitiesError {
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum ListCostCentersError {
38 Status401(),
39 Status404(),
40 UnknownValue(serde_json::Value),
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum ListCountriesError {
47 Status401(),
48 UnknownValue(serde_json::Value),
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(untagged)]
54pub enum ListCurrenciesError {
55 Status401(),
56 UnknownValue(serde_json::Value),
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum ListDeliveryNotesDefaultCausalsError {
63 Status401(),
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum ListDetailedCountriesError {
71 Status401(),
72 UnknownValue(serde_json::Value),
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum ListLanguagesError {
79 Status401(),
80 UnknownValue(serde_json::Value),
81}
82
83#[derive(Debug, Clone, Serialize, Deserialize)]
85#[serde(untagged)]
86pub enum ListPaymentAccountsError {
87 Status401(),
88 Status404(),
89 UnknownValue(serde_json::Value),
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize)]
94#[serde(untagged)]
95pub enum ListPaymentMethodsError {
96 Status401(),
97 Status404(),
98 UnknownValue(serde_json::Value),
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum ListProductCategoriesError {
105 Status401(),
106 Status404(),
107 UnknownValue(serde_json::Value),
108}
109
110#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum ListReceivedDocumentCategoriesError {
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum ListRevenueCentersError {
121 Status401(),
122 Status404(),
123 UnknownValue(serde_json::Value),
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum ListTemplatesError {
130 Status401(),
131 UnknownValue(serde_json::Value),
132}
133
134#[derive(Debug, Clone, Serialize, Deserialize)]
136#[serde(untagged)]
137pub enum ListUnitsOfMeasureError {
138 Status401(),
139 UnknownValue(serde_json::Value),
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum ListVatTypesError {
146 Status401(),
147 Status404(),
148 UnknownValue(serde_json::Value),
149}
150
151
152pub async fn list_archive_categories(configuration: &configuration::Configuration, company_id: i32) -> Result<models::ListArchiveCategoriesResponse, Error<ListArchiveCategoriesError>> {
154 let local_var_configuration = configuration;
155
156 let local_var_client = &local_var_configuration.client;
157
158 let local_var_uri_str = format!("{}/c/{company_id}/info/archive_categories", local_var_configuration.base_path, company_id=company_id);
159 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
160
161 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
162 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
163 }
164 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
165 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
166 };
167 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
168 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
169 };
170
171 let local_var_req = local_var_req_builder.build()?;
172 let local_var_resp = local_var_client.execute(local_var_req).await?;
173
174 let local_var_status = local_var_resp.status();
175 let local_var_content = local_var_resp.text().await?;
176
177 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
178 serde_json::from_str(&local_var_content).map_err(Error::from)
179 } else {
180 let local_var_entity: Option<ListArchiveCategoriesError> = serde_json::from_str(&local_var_content).ok();
181 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
182 Err(Error::ResponseError(local_var_error))
183 }
184}
185
186pub async fn list_cities(configuration: &configuration::Configuration, postal_code: Option<&str>, city: Option<&str>) -> Result<models::ListCitiesResponse, Error<ListCitiesError>> {
188 let local_var_configuration = configuration;
189
190 let local_var_client = &local_var_configuration.client;
191
192 let local_var_uri_str = format!("{}/info/cities", local_var_configuration.base_path);
193 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
194
195 if let Some(ref local_var_str) = postal_code {
196 local_var_req_builder = local_var_req_builder.query(&[("postal_code", &local_var_str.to_string())]);
197 }
198 if let Some(ref local_var_str) = city {
199 local_var_req_builder = local_var_req_builder.query(&[("city", &local_var_str.to_string())]);
200 }
201 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
202 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
203 }
204 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
205 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
206 };
207 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
208 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
209 };
210
211 let local_var_req = local_var_req_builder.build()?;
212 let local_var_resp = local_var_client.execute(local_var_req).await?;
213
214 let local_var_status = local_var_resp.status();
215 let local_var_content = local_var_resp.text().await?;
216
217 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
218 serde_json::from_str(&local_var_content).map_err(Error::from)
219 } else {
220 let local_var_entity: Option<ListCitiesError> = serde_json::from_str(&local_var_content).ok();
221 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
222 Err(Error::ResponseError(local_var_error))
223 }
224}
225
226pub async fn list_cost_centers(configuration: &configuration::Configuration, company_id: i32) -> Result<models::ListCostCentersResponse, Error<ListCostCentersError>> {
228 let local_var_configuration = configuration;
229
230 let local_var_client = &local_var_configuration.client;
231
232 let local_var_uri_str = format!("{}/c/{company_id}/info/cost_centers", local_var_configuration.base_path, company_id=company_id);
233 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
234
235 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
236 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
237 }
238 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
239 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
240 };
241 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
242 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
243 };
244
245 let local_var_req = local_var_req_builder.build()?;
246 let local_var_resp = local_var_client.execute(local_var_req).await?;
247
248 let local_var_status = local_var_resp.status();
249 let local_var_content = local_var_resp.text().await?;
250
251 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
252 serde_json::from_str(&local_var_content).map_err(Error::from)
253 } else {
254 let local_var_entity: Option<ListCostCentersError> = serde_json::from_str(&local_var_content).ok();
255 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
256 Err(Error::ResponseError(local_var_error))
257 }
258}
259
260pub async fn list_countries(configuration: &configuration::Configuration, ) -> Result<models::ListCountriesResponse, Error<ListCountriesError>> {
262 let local_var_configuration = configuration;
263
264 let local_var_client = &local_var_configuration.client;
265
266 let local_var_uri_str = format!("{}/info/countries", local_var_configuration.base_path);
267 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
268
269 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
270 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
271 }
272 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
273 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
274 };
275 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
276 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
277 };
278
279 let local_var_req = local_var_req_builder.build()?;
280 let local_var_resp = local_var_client.execute(local_var_req).await?;
281
282 let local_var_status = local_var_resp.status();
283 let local_var_content = local_var_resp.text().await?;
284
285 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
286 serde_json::from_str(&local_var_content).map_err(Error::from)
287 } else {
288 let local_var_entity: Option<ListCountriesError> = serde_json::from_str(&local_var_content).ok();
289 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
290 Err(Error::ResponseError(local_var_error))
291 }
292}
293
294pub async fn list_currencies(configuration: &configuration::Configuration, ) -> Result<models::ListCurrenciesResponse, Error<ListCurrenciesError>> {
296 let local_var_configuration = configuration;
297
298 let local_var_client = &local_var_configuration.client;
299
300 let local_var_uri_str = format!("{}/info/currencies", local_var_configuration.base_path);
301 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
302
303 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
304 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
305 }
306 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
307 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
308 };
309 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
310 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
311 };
312
313 let local_var_req = local_var_req_builder.build()?;
314 let local_var_resp = local_var_client.execute(local_var_req).await?;
315
316 let local_var_status = local_var_resp.status();
317 let local_var_content = local_var_resp.text().await?;
318
319 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
320 serde_json::from_str(&local_var_content).map_err(Error::from)
321 } else {
322 let local_var_entity: Option<ListCurrenciesError> = serde_json::from_str(&local_var_content).ok();
323 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
324 Err(Error::ResponseError(local_var_error))
325 }
326}
327
328pub async fn list_delivery_notes_default_causals(configuration: &configuration::Configuration, ) -> Result<models::ListDeliveryNotesDefaultCasualsResponse, Error<ListDeliveryNotesDefaultCausalsError>> {
330 let local_var_configuration = configuration;
331
332 let local_var_client = &local_var_configuration.client;
333
334 let local_var_uri_str = format!("{}/info/dn_causals", local_var_configuration.base_path);
335 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
336
337 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
338 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
339 }
340 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
341 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
342 };
343 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
344 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
345 };
346
347 let local_var_req = local_var_req_builder.build()?;
348 let local_var_resp = local_var_client.execute(local_var_req).await?;
349
350 let local_var_status = local_var_resp.status();
351 let local_var_content = local_var_resp.text().await?;
352
353 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
354 serde_json::from_str(&local_var_content).map_err(Error::from)
355 } else {
356 let local_var_entity: Option<ListDeliveryNotesDefaultCausalsError> = serde_json::from_str(&local_var_content).ok();
357 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
358 Err(Error::ResponseError(local_var_error))
359 }
360}
361
362pub async fn list_detailed_countries(configuration: &configuration::Configuration, ) -> Result<models::ListDetailedCountriesResponse, Error<ListDetailedCountriesError>> {
364 let local_var_configuration = configuration;
365
366 let local_var_client = &local_var_configuration.client;
367
368 let local_var_uri_str = format!("{}/info/detailed_countries", local_var_configuration.base_path);
369 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
370
371 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
372 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
373 }
374 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
375 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
376 };
377 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
378 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
379 };
380
381 let local_var_req = local_var_req_builder.build()?;
382 let local_var_resp = local_var_client.execute(local_var_req).await?;
383
384 let local_var_status = local_var_resp.status();
385 let local_var_content = local_var_resp.text().await?;
386
387 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
388 serde_json::from_str(&local_var_content).map_err(Error::from)
389 } else {
390 let local_var_entity: Option<ListDetailedCountriesError> = serde_json::from_str(&local_var_content).ok();
391 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
392 Err(Error::ResponseError(local_var_error))
393 }
394}
395
396pub async fn list_languages(configuration: &configuration::Configuration, ) -> Result<models::ListLanguagesResponse, Error<ListLanguagesError>> {
398 let local_var_configuration = configuration;
399
400 let local_var_client = &local_var_configuration.client;
401
402 let local_var_uri_str = format!("{}/info/languages", local_var_configuration.base_path);
403 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
404
405 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
406 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
407 }
408 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
409 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
410 };
411 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
412 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
413 };
414
415 let local_var_req = local_var_req_builder.build()?;
416 let local_var_resp = local_var_client.execute(local_var_req).await?;
417
418 let local_var_status = local_var_resp.status();
419 let local_var_content = local_var_resp.text().await?;
420
421 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
422 serde_json::from_str(&local_var_content).map_err(Error::from)
423 } else {
424 let local_var_entity: Option<ListLanguagesError> = serde_json::from_str(&local_var_content).ok();
425 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
426 Err(Error::ResponseError(local_var_error))
427 }
428}
429
430pub async fn list_payment_accounts(configuration: &configuration::Configuration, company_id: i32, fields: Option<&str>, fieldset: Option<&str>, sort: Option<&str>) -> Result<models::ListPaymentAccountsResponse, Error<ListPaymentAccountsError>> {
432 let local_var_configuration = configuration;
433
434 let local_var_client = &local_var_configuration.client;
435
436 let local_var_uri_str = format!("{}/c/{company_id}/info/payment_accounts", local_var_configuration.base_path, company_id=company_id);
437 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
438
439 if let Some(ref local_var_str) = fields {
440 local_var_req_builder = local_var_req_builder.query(&[("fields", &local_var_str.to_string())]);
441 }
442 if let Some(ref local_var_str) = fieldset {
443 local_var_req_builder = local_var_req_builder.query(&[("fieldset", &local_var_str.to_string())]);
444 }
445 if let Some(ref local_var_str) = sort {
446 local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
447 }
448 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
449 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
450 }
451 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
452 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
453 };
454 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
455 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
456 };
457
458 let local_var_req = local_var_req_builder.build()?;
459 let local_var_resp = local_var_client.execute(local_var_req).await?;
460
461 let local_var_status = local_var_resp.status();
462 let local_var_content = local_var_resp.text().await?;
463
464 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
465 serde_json::from_str(&local_var_content).map_err(Error::from)
466 } else {
467 let local_var_entity: Option<ListPaymentAccountsError> = serde_json::from_str(&local_var_content).ok();
468 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
469 Err(Error::ResponseError(local_var_error))
470 }
471}
472
473pub async fn list_payment_methods(configuration: &configuration::Configuration, company_id: i32, fields: Option<&str>, fieldset: Option<&str>, sort: Option<&str>) -> Result<models::ListPaymentMethodsResponse, Error<ListPaymentMethodsError>> {
475 let local_var_configuration = configuration;
476
477 let local_var_client = &local_var_configuration.client;
478
479 let local_var_uri_str = format!("{}/c/{company_id}/info/payment_methods", local_var_configuration.base_path, company_id=company_id);
480 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
481
482 if let Some(ref local_var_str) = fields {
483 local_var_req_builder = local_var_req_builder.query(&[("fields", &local_var_str.to_string())]);
484 }
485 if let Some(ref local_var_str) = fieldset {
486 local_var_req_builder = local_var_req_builder.query(&[("fieldset", &local_var_str.to_string())]);
487 }
488 if let Some(ref local_var_str) = sort {
489 local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
490 }
491 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
492 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
493 }
494 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
495 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
496 };
497 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
498 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
499 };
500
501 let local_var_req = local_var_req_builder.build()?;
502 let local_var_resp = local_var_client.execute(local_var_req).await?;
503
504 let local_var_status = local_var_resp.status();
505 let local_var_content = local_var_resp.text().await?;
506
507 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
508 serde_json::from_str(&local_var_content).map_err(Error::from)
509 } else {
510 let local_var_entity: Option<ListPaymentMethodsError> = serde_json::from_str(&local_var_content).ok();
511 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
512 Err(Error::ResponseError(local_var_error))
513 }
514}
515
516pub async fn list_product_categories(configuration: &configuration::Configuration, company_id: i32, context: &str) -> Result<models::ListProductCategoriesResponse, Error<ListProductCategoriesError>> {
518 let local_var_configuration = configuration;
519
520 let local_var_client = &local_var_configuration.client;
521
522 let local_var_uri_str = format!("{}/c/{company_id}/info/product_categories", local_var_configuration.base_path, company_id=company_id);
523 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
524
525 local_var_req_builder = local_var_req_builder.query(&[("context", &context.to_string())]);
526 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
527 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
528 }
529 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
530 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
531 };
532 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
533 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
534 };
535
536 let local_var_req = local_var_req_builder.build()?;
537 let local_var_resp = local_var_client.execute(local_var_req).await?;
538
539 let local_var_status = local_var_resp.status();
540 let local_var_content = local_var_resp.text().await?;
541
542 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
543 serde_json::from_str(&local_var_content).map_err(Error::from)
544 } else {
545 let local_var_entity: Option<ListProductCategoriesError> = serde_json::from_str(&local_var_content).ok();
546 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
547 Err(Error::ResponseError(local_var_error))
548 }
549}
550
551pub async fn list_received_document_categories(configuration: &configuration::Configuration, company_id: i32) -> Result<models::ListReceivedDocumentCategoriesResponse, Error<ListReceivedDocumentCategoriesError>> {
553 let local_var_configuration = configuration;
554
555 let local_var_client = &local_var_configuration.client;
556
557 let local_var_uri_str = format!("{}/c/{company_id}/info/received_document_categories", local_var_configuration.base_path, company_id=company_id);
558 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
559
560 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
561 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
562 }
563 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
564 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
565 };
566 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
567 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
568 };
569
570 let local_var_req = local_var_req_builder.build()?;
571 let local_var_resp = local_var_client.execute(local_var_req).await?;
572
573 let local_var_status = local_var_resp.status();
574 let local_var_content = local_var_resp.text().await?;
575
576 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
577 serde_json::from_str(&local_var_content).map_err(Error::from)
578 } else {
579 let local_var_entity: Option<ListReceivedDocumentCategoriesError> = serde_json::from_str(&local_var_content).ok();
580 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
581 Err(Error::ResponseError(local_var_error))
582 }
583}
584
585pub async fn list_revenue_centers(configuration: &configuration::Configuration, company_id: i32) -> Result<models::ListRevenueCentersResponse, Error<ListRevenueCentersError>> {
587 let local_var_configuration = configuration;
588
589 let local_var_client = &local_var_configuration.client;
590
591 let local_var_uri_str = format!("{}/c/{company_id}/info/revenue_centers", local_var_configuration.base_path, company_id=company_id);
592 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
593
594 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
595 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
596 }
597 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
598 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
599 };
600 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
601 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
602 };
603
604 let local_var_req = local_var_req_builder.build()?;
605 let local_var_resp = local_var_client.execute(local_var_req).await?;
606
607 let local_var_status = local_var_resp.status();
608 let local_var_content = local_var_resp.text().await?;
609
610 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
611 serde_json::from_str(&local_var_content).map_err(Error::from)
612 } else {
613 let local_var_entity: Option<ListRevenueCentersError> = serde_json::from_str(&local_var_content).ok();
614 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
615 Err(Error::ResponseError(local_var_error))
616 }
617}
618
619pub async fn list_templates(configuration: &configuration::Configuration, r#type: Option<&str>, by_type: Option<bool>) -> Result<models::ListTemplatesResponse, Error<ListTemplatesError>> {
621 let local_var_configuration = configuration;
622
623 let local_var_client = &local_var_configuration.client;
624
625 let local_var_uri_str = format!("{}/info/templates", local_var_configuration.base_path);
626 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
627
628 if let Some(ref local_var_str) = r#type {
629 local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
630 }
631 if let Some(ref local_var_str) = by_type {
632 local_var_req_builder = local_var_req_builder.query(&[("by_type", &local_var_str.to_string())]);
633 }
634 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
635 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
636 }
637 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
638 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
639 };
640 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
641 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
642 };
643
644 let local_var_req = local_var_req_builder.build()?;
645 let local_var_resp = local_var_client.execute(local_var_req).await?;
646
647 let local_var_status = local_var_resp.status();
648 let local_var_content = local_var_resp.text().await?;
649
650 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
651 serde_json::from_str(&local_var_content).map_err(Error::from)
652 } else {
653 let local_var_entity: Option<ListTemplatesError> = serde_json::from_str(&local_var_content).ok();
654 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
655 Err(Error::ResponseError(local_var_error))
656 }
657}
658
659pub async fn list_units_of_measure(configuration: &configuration::Configuration, ) -> Result<models::ListUnitsOfMeasureResponse, Error<ListUnitsOfMeasureError>> {
661 let local_var_configuration = configuration;
662
663 let local_var_client = &local_var_configuration.client;
664
665 let local_var_uri_str = format!("{}/info/measures", local_var_configuration.base_path);
666 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
667
668 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
669 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
670 }
671 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
672 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
673 };
674 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
675 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
676 };
677
678 let local_var_req = local_var_req_builder.build()?;
679 let local_var_resp = local_var_client.execute(local_var_req).await?;
680
681 let local_var_status = local_var_resp.status();
682 let local_var_content = local_var_resp.text().await?;
683
684 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
685 serde_json::from_str(&local_var_content).map_err(Error::from)
686 } else {
687 let local_var_entity: Option<ListUnitsOfMeasureError> = serde_json::from_str(&local_var_content).ok();
688 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
689 Err(Error::ResponseError(local_var_error))
690 }
691}
692
693pub async fn list_vat_types(configuration: &configuration::Configuration, company_id: i32, fieldset: Option<&str>) -> Result<models::ListVatTypesResponse, Error<ListVatTypesError>> {
695 let local_var_configuration = configuration;
696
697 let local_var_client = &local_var_configuration.client;
698
699 let local_var_uri_str = format!("{}/c/{company_id}/info/vat_types", local_var_configuration.base_path, company_id=company_id);
700 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
701
702 if let Some(ref local_var_str) = fieldset {
703 local_var_req_builder = local_var_req_builder.query(&[("fieldset", &local_var_str.to_string())]);
704 }
705 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
706 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
707 }
708 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
709 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
710 };
711 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
712 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
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<ListVatTypesError> = 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