Skip to main content

firefly_iii/apis/
data_api.rs

1/*
2 * Firefly III API v6.4.14
3 *
4 * This is the documentation of the Firefly III API. Please report any bugs or issues. You may use the \"Authorize\" button to try the API below. <br><br> Please keep in mind that the demo site does **not** accept requests from `curl`, `colly`, `wget`, etc. You must use a browser or a tool like Insomnia to make your test requests. <br><br> To learn more about the idiosyncrasies of this API, please read about the API in the [Firefly III API documentation](https://docs.firefly-iii.org/references/firefly-iii/api/). <br><br> <small>This file was last generated on 2025-12-26 @ 15:17:41 (Europe/Amsterdam)</small>
5 *
6 * The version of the OpenAPI document: v6.4.14
7 * Contact: james@firefly-iii.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11#![allow(unused_imports)]
12
13use reqwest;
14
15use super::{configuration, Error};
16use crate::apis::ResponseContent;
17use crate::models::{self, *};
18
19/// struct for typed errors of method [`bulk_update_transactions`]
20#[derive(Debug, Clone, Serialize, Deserialize)]
21#[serde(untagged)]
22pub enum BulkUpdateTransactionsError {
23    Status401(models::UnauthenticatedResponse),
24    Status404(models::NotFoundResponse),
25    Status400(models::BadRequestResponse),
26    Status500(models::InternalExceptionResponse),
27    UnknownValue(serde_json::Value),
28}
29
30/// struct for typed errors of method [`destroy_data`]
31#[derive(Debug, Clone, Serialize, Deserialize)]
32#[serde(untagged)]
33pub enum DestroyDataError {
34    Status401(models::UnauthenticatedResponse),
35    Status404(models::NotFoundResponse),
36    Status400(models::BadRequestResponse),
37    Status500(models::InternalExceptionResponse),
38    UnknownValue(serde_json::Value),
39}
40
41/// struct for typed errors of method [`export_accounts`]
42#[derive(Debug, Clone, Serialize, Deserialize)]
43#[serde(untagged)]
44pub enum ExportAccountsError {
45    Status401(models::UnauthenticatedResponse),
46    Status404(models::NotFoundResponse),
47    Status400(models::BadRequestResponse),
48    Status500(models::InternalExceptionResponse),
49    Status422(models::ValidationErrorResponse),
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`export_bills`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ExportBillsError {
57    Status401(models::UnauthenticatedResponse),
58    Status404(models::NotFoundResponse),
59    Status400(models::BadRequestResponse),
60    Status500(models::InternalExceptionResponse),
61    UnknownValue(serde_json::Value),
62}
63
64/// struct for typed errors of method [`export_budgets`]
65#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum ExportBudgetsError {
68    Status401(models::UnauthenticatedResponse),
69    Status404(models::NotFoundResponse),
70    Status400(models::BadRequestResponse),
71    Status500(models::InternalExceptionResponse),
72    UnknownValue(serde_json::Value),
73}
74
75/// struct for typed errors of method [`export_categories`]
76#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum ExportCategoriesError {
79    Status401(models::UnauthenticatedResponse),
80    Status404(models::NotFoundResponse),
81    Status400(models::BadRequestResponse),
82    Status500(models::InternalExceptionResponse),
83    UnknownValue(serde_json::Value),
84}
85
86/// struct for typed errors of method [`export_piggies`]
87#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum ExportPiggiesError {
90    Status401(models::UnauthenticatedResponse),
91    Status404(models::NotFoundResponse),
92    Status400(models::BadRequestResponse),
93    Status500(models::InternalExceptionResponse),
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`export_recurring`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum ExportRecurringError {
101    Status401(models::UnauthenticatedResponse),
102    Status404(models::NotFoundResponse),
103    Status400(models::BadRequestResponse),
104    Status500(models::InternalExceptionResponse),
105    UnknownValue(serde_json::Value),
106}
107
108/// struct for typed errors of method [`export_rules`]
109#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum ExportRulesError {
112    Status401(models::UnauthenticatedResponse),
113    Status404(models::NotFoundResponse),
114    Status400(models::BadRequestResponse),
115    Status500(models::InternalExceptionResponse),
116    UnknownValue(serde_json::Value),
117}
118
119/// struct for typed errors of method [`export_tags`]
120#[derive(Debug, Clone, Serialize, Deserialize)]
121#[serde(untagged)]
122pub enum ExportTagsError {
123    Status401(models::UnauthenticatedResponse),
124    Status404(models::NotFoundResponse),
125    Status400(models::BadRequestResponse),
126    Status500(models::InternalExceptionResponse),
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`export_transactions`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum ExportTransactionsError {
134    Status401(models::UnauthenticatedResponse),
135    Status404(models::NotFoundResponse),
136    Status400(models::BadRequestResponse),
137    Status500(models::InternalExceptionResponse),
138    UnknownValue(serde_json::Value),
139}
140
141/// struct for typed errors of method [`purge_data`]
142#[derive(Debug, Clone, Serialize, Deserialize)]
143#[serde(untagged)]
144pub enum PurgeDataError {
145    Status401(models::UnauthenticatedResponse),
146    Status400(models::BadRequestResponse),
147    Status404(models::NotFoundResponse),
148    Status500(models::InternalExceptionResponse),
149    UnknownValue(serde_json::Value),
150}
151
152/// Allows you to update transactions in bulk.
153pub async fn bulk_update_transactions(
154    configuration: &configuration::Configuration,
155    query: &str,
156    x_trace_id: Option<&str>,
157) -> Result<(), Error<BulkUpdateTransactionsError>> {
158    let local_var_configuration = configuration;
159
160    let local_var_client = &local_var_configuration.client;
161
162    let local_var_uri_str = format!(
163        "{}/v1/data/bulk/transactions",
164        local_var_configuration.base_path
165    );
166    let mut local_var_req_builder =
167        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
168
169    local_var_req_builder = local_var_req_builder.query(&[("query", &query.to_string())]);
170    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
171        local_var_req_builder =
172            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
173    }
174    if let Some(local_var_param_value) = x_trace_id {
175        local_var_req_builder =
176            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
177    }
178    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
179        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
180    };
181    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
182        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
183    };
184
185    let local_var_req = local_var_req_builder.build()?;
186    let local_var_resp = local_var_client.execute(local_var_req).await?;
187
188    let local_var_status = local_var_resp.status();
189    let local_var_content = local_var_resp.text().await?;
190
191    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
192        Ok(())
193    } else {
194        let local_var_entity: Option<BulkUpdateTransactionsError> =
195            serde_json::from_str(&local_var_content).ok();
196        let local_var_error = ResponseContent {
197            status: local_var_status,
198            content: local_var_content,
199            entity: local_var_entity,
200        };
201        Err(Error::ResponseError(local_var_error))
202    }
203}
204
205/// A call to this endpoint deletes the requested data type. Use it with care and always with user permission. The demo user is incapable of using this endpoint.
206pub async fn destroy_data(
207    configuration: &configuration::Configuration,
208    objects: DataDestroyObject,
209    x_trace_id: Option<&str>,
210) -> Result<(), Error<DestroyDataError>> {
211    let local_var_configuration = configuration;
212
213    let local_var_client = &local_var_configuration.client;
214
215    let local_var_uri_str = format!("{}/v1/data/destroy", local_var_configuration.base_path);
216    let mut local_var_req_builder =
217        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
218
219    local_var_req_builder = local_var_req_builder.query(&[("objects", &objects.to_string())]);
220    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
221        local_var_req_builder =
222            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
223    }
224    if let Some(local_var_param_value) = x_trace_id {
225        local_var_req_builder =
226            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
227    }
228    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
229        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
230    };
231    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
232        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
233    };
234
235    let local_var_req = local_var_req_builder.build()?;
236    let local_var_resp = local_var_client.execute(local_var_req).await?;
237
238    let local_var_status = local_var_resp.status();
239    let local_var_content = local_var_resp.text().await?;
240
241    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
242        Ok(())
243    } else {
244        let local_var_entity: Option<DestroyDataError> =
245            serde_json::from_str(&local_var_content).ok();
246        let local_var_error = ResponseContent {
247            status: local_var_status,
248            content: local_var_content,
249            entity: local_var_entity,
250        };
251        Err(Error::ResponseError(local_var_error))
252    }
253}
254
255/// This endpoint allows you to export your accounts from Firefly III into a file. Currently supports CSV exports only.
256pub async fn export_accounts(
257    configuration: &configuration::Configuration,
258    x_trace_id: Option<&str>,
259    r#type: Option<ExportFileFilter>,
260) -> Result<std::path::PathBuf, Error<ExportAccountsError>> {
261    let local_var_configuration = configuration;
262
263    let local_var_client = &local_var_configuration.client;
264
265    let local_var_uri_str = format!(
266        "{}/v1/data/export/accounts",
267        local_var_configuration.base_path
268    );
269    let mut local_var_req_builder =
270        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
271
272    if let Some(ref local_var_str) = r#type {
273        local_var_req_builder =
274            local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
275    }
276    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
277        local_var_req_builder =
278            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
279    }
280    if let Some(local_var_param_value) = x_trace_id {
281        local_var_req_builder =
282            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
283    }
284    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
285        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
286    };
287    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
288        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
289    };
290
291    let local_var_req = local_var_req_builder.build()?;
292    let local_var_resp = local_var_client.execute(local_var_req).await?;
293
294    let local_var_status = local_var_resp.status();
295    let local_var_content = local_var_resp.text().await?;
296
297    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
298        serde_json::from_str(&local_var_content).map_err(Error::from)
299    } else {
300        let local_var_entity: Option<ExportAccountsError> =
301            serde_json::from_str(&local_var_content).ok();
302        let local_var_error = ResponseContent {
303            status: local_var_status,
304            content: local_var_content,
305            entity: local_var_entity,
306        };
307        Err(Error::ResponseError(local_var_error))
308    }
309}
310
311/// This endpoint allows you to export your bills from Firefly III into a file. Currently supports CSV exports only.
312pub async fn export_bills(
313    configuration: &configuration::Configuration,
314    x_trace_id: Option<&str>,
315    r#type: Option<ExportFileFilter>,
316) -> Result<std::path::PathBuf, Error<ExportBillsError>> {
317    let local_var_configuration = configuration;
318
319    let local_var_client = &local_var_configuration.client;
320
321    let local_var_uri_str = format!("{}/v1/data/export/bills", local_var_configuration.base_path);
322    let mut local_var_req_builder =
323        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
324
325    if let Some(ref local_var_str) = r#type {
326        local_var_req_builder =
327            local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
328    }
329    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
330        local_var_req_builder =
331            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
332    }
333    if let Some(local_var_param_value) = x_trace_id {
334        local_var_req_builder =
335            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
336    }
337    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
338        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
339    };
340    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
341        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
342    };
343
344    let local_var_req = local_var_req_builder.build()?;
345    let local_var_resp = local_var_client.execute(local_var_req).await?;
346
347    let local_var_status = local_var_resp.status();
348    let local_var_content = local_var_resp.text().await?;
349
350    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
351        serde_json::from_str(&local_var_content).map_err(Error::from)
352    } else {
353        let local_var_entity: Option<ExportBillsError> =
354            serde_json::from_str(&local_var_content).ok();
355        let local_var_error = ResponseContent {
356            status: local_var_status,
357            content: local_var_content,
358            entity: local_var_entity,
359        };
360        Err(Error::ResponseError(local_var_error))
361    }
362}
363
364/// This endpoint allows you to export your budgets and associated budget data from Firefly III into a file. Currently supports CSV exports only.
365pub async fn export_budgets(
366    configuration: &configuration::Configuration,
367    x_trace_id: Option<&str>,
368    r#type: Option<ExportFileFilter>,
369) -> Result<std::path::PathBuf, Error<ExportBudgetsError>> {
370    let local_var_configuration = configuration;
371
372    let local_var_client = &local_var_configuration.client;
373
374    let local_var_uri_str = format!(
375        "{}/v1/data/export/budgets",
376        local_var_configuration.base_path
377    );
378    let mut local_var_req_builder =
379        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
380
381    if let Some(ref local_var_str) = r#type {
382        local_var_req_builder =
383            local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
384    }
385    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
386        local_var_req_builder =
387            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
388    }
389    if let Some(local_var_param_value) = x_trace_id {
390        local_var_req_builder =
391            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
392    }
393    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
394        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
395    };
396    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
397        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
398    };
399
400    let local_var_req = local_var_req_builder.build()?;
401    let local_var_resp = local_var_client.execute(local_var_req).await?;
402
403    let local_var_status = local_var_resp.status();
404    let local_var_content = local_var_resp.text().await?;
405
406    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
407        serde_json::from_str(&local_var_content).map_err(Error::from)
408    } else {
409        let local_var_entity: Option<ExportBudgetsError> =
410            serde_json::from_str(&local_var_content).ok();
411        let local_var_error = ResponseContent {
412            status: local_var_status,
413            content: local_var_content,
414            entity: local_var_entity,
415        };
416        Err(Error::ResponseError(local_var_error))
417    }
418}
419
420/// This endpoint allows you to export your categories from Firefly III into a file. Currently supports CSV exports only.
421pub async fn export_categories(
422    configuration: &configuration::Configuration,
423    x_trace_id: Option<&str>,
424    r#type: Option<ExportFileFilter>,
425) -> Result<std::path::PathBuf, Error<ExportCategoriesError>> {
426    let local_var_configuration = configuration;
427
428    let local_var_client = &local_var_configuration.client;
429
430    let local_var_uri_str = format!(
431        "{}/v1/data/export/categories",
432        local_var_configuration.base_path
433    );
434    let mut local_var_req_builder =
435        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
436
437    if let Some(ref local_var_str) = r#type {
438        local_var_req_builder =
439            local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
440    }
441    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
442        local_var_req_builder =
443            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
444    }
445    if let Some(local_var_param_value) = x_trace_id {
446        local_var_req_builder =
447            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
448    }
449    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
450        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
451    };
452    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
453        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
454    };
455
456    let local_var_req = local_var_req_builder.build()?;
457    let local_var_resp = local_var_client.execute(local_var_req).await?;
458
459    let local_var_status = local_var_resp.status();
460    let local_var_content = local_var_resp.text().await?;
461
462    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
463        serde_json::from_str(&local_var_content).map_err(Error::from)
464    } else {
465        let local_var_entity: Option<ExportCategoriesError> =
466            serde_json::from_str(&local_var_content).ok();
467        let local_var_error = ResponseContent {
468            status: local_var_status,
469            content: local_var_content,
470            entity: local_var_entity,
471        };
472        Err(Error::ResponseError(local_var_error))
473    }
474}
475
476/// This endpoint allows you to export your piggy banks from Firefly III into a file. Currently supports CSV exports only.
477pub async fn export_piggies(
478    configuration: &configuration::Configuration,
479    x_trace_id: Option<&str>,
480    r#type: Option<ExportFileFilter>,
481) -> Result<std::path::PathBuf, Error<ExportPiggiesError>> {
482    let local_var_configuration = configuration;
483
484    let local_var_client = &local_var_configuration.client;
485
486    let local_var_uri_str = format!(
487        "{}/v1/data/export/piggy-banks",
488        local_var_configuration.base_path
489    );
490    let mut local_var_req_builder =
491        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
492
493    if let Some(ref local_var_str) = r#type {
494        local_var_req_builder =
495            local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
496    }
497    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
498        local_var_req_builder =
499            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
500    }
501    if let Some(local_var_param_value) = x_trace_id {
502        local_var_req_builder =
503            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
504    }
505    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
506        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
507    };
508    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
509        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
510    };
511
512    let local_var_req = local_var_req_builder.build()?;
513    let local_var_resp = local_var_client.execute(local_var_req).await?;
514
515    let local_var_status = local_var_resp.status();
516    let local_var_content = local_var_resp.text().await?;
517
518    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
519        serde_json::from_str(&local_var_content).map_err(Error::from)
520    } else {
521        let local_var_entity: Option<ExportPiggiesError> =
522            serde_json::from_str(&local_var_content).ok();
523        let local_var_error = ResponseContent {
524            status: local_var_status,
525            content: local_var_content,
526            entity: local_var_entity,
527        };
528        Err(Error::ResponseError(local_var_error))
529    }
530}
531
532/// This endpoint allows you to export your recurring transactions from Firefly III into a file. Currently supports CSV exports only.
533pub async fn export_recurring(
534    configuration: &configuration::Configuration,
535    x_trace_id: Option<&str>,
536    r#type: Option<ExportFileFilter>,
537) -> Result<std::path::PathBuf, Error<ExportRecurringError>> {
538    let local_var_configuration = configuration;
539
540    let local_var_client = &local_var_configuration.client;
541
542    let local_var_uri_str = format!(
543        "{}/v1/data/export/recurring",
544        local_var_configuration.base_path
545    );
546    let mut local_var_req_builder =
547        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
548
549    if let Some(ref local_var_str) = r#type {
550        local_var_req_builder =
551            local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
552    }
553    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
554        local_var_req_builder =
555            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
556    }
557    if let Some(local_var_param_value) = x_trace_id {
558        local_var_req_builder =
559            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
560    }
561    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
562        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
563    };
564    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
565        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
566    };
567
568    let local_var_req = local_var_req_builder.build()?;
569    let local_var_resp = local_var_client.execute(local_var_req).await?;
570
571    let local_var_status = local_var_resp.status();
572    let local_var_content = local_var_resp.text().await?;
573
574    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
575        serde_json::from_str(&local_var_content).map_err(Error::from)
576    } else {
577        let local_var_entity: Option<ExportRecurringError> =
578            serde_json::from_str(&local_var_content).ok();
579        let local_var_error = ResponseContent {
580            status: local_var_status,
581            content: local_var_content,
582            entity: local_var_entity,
583        };
584        Err(Error::ResponseError(local_var_error))
585    }
586}
587
588/// This endpoint allows you to export your rules and rule groups from Firefly III into a file. Currently supports CSV exports only.
589pub async fn export_rules(
590    configuration: &configuration::Configuration,
591    x_trace_id: Option<&str>,
592    r#type: Option<ExportFileFilter>,
593) -> Result<std::path::PathBuf, Error<ExportRulesError>> {
594    let local_var_configuration = configuration;
595
596    let local_var_client = &local_var_configuration.client;
597
598    let local_var_uri_str = format!("{}/v1/data/export/rules", local_var_configuration.base_path);
599    let mut local_var_req_builder =
600        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
601
602    if let Some(ref local_var_str) = r#type {
603        local_var_req_builder =
604            local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
605    }
606    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
607        local_var_req_builder =
608            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
609    }
610    if let Some(local_var_param_value) = x_trace_id {
611        local_var_req_builder =
612            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
613    }
614    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
615        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
616    };
617    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
618        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
619    };
620
621    let local_var_req = local_var_req_builder.build()?;
622    let local_var_resp = local_var_client.execute(local_var_req).await?;
623
624    let local_var_status = local_var_resp.status();
625    let local_var_content = local_var_resp.text().await?;
626
627    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
628        serde_json::from_str(&local_var_content).map_err(Error::from)
629    } else {
630        let local_var_entity: Option<ExportRulesError> =
631            serde_json::from_str(&local_var_content).ok();
632        let local_var_error = ResponseContent {
633            status: local_var_status,
634            content: local_var_content,
635            entity: local_var_entity,
636        };
637        Err(Error::ResponseError(local_var_error))
638    }
639}
640
641/// This endpoint allows you to export your tags from Firefly III into a file. Currently supports CSV exports only.
642pub async fn export_tags(
643    configuration: &configuration::Configuration,
644    x_trace_id: Option<&str>,
645    r#type: Option<ExportFileFilter>,
646) -> Result<std::path::PathBuf, Error<ExportTagsError>> {
647    let local_var_configuration = configuration;
648
649    let local_var_client = &local_var_configuration.client;
650
651    let local_var_uri_str = format!("{}/v1/data/export/tags", local_var_configuration.base_path);
652    let mut local_var_req_builder =
653        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
654
655    if let Some(ref local_var_str) = r#type {
656        local_var_req_builder =
657            local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
658    }
659    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
660        local_var_req_builder =
661            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
662    }
663    if let Some(local_var_param_value) = x_trace_id {
664        local_var_req_builder =
665            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
666    }
667    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
668        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
669    };
670    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
671        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
672    };
673
674    let local_var_req = local_var_req_builder.build()?;
675    let local_var_resp = local_var_client.execute(local_var_req).await?;
676
677    let local_var_status = local_var_resp.status();
678    let local_var_content = local_var_resp.text().await?;
679
680    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
681        serde_json::from_str(&local_var_content).map_err(Error::from)
682    } else {
683        let local_var_entity: Option<ExportTagsError> =
684            serde_json::from_str(&local_var_content).ok();
685        let local_var_error = ResponseContent {
686            status: local_var_status,
687            content: local_var_content,
688            entity: local_var_entity,
689        };
690        Err(Error::ResponseError(local_var_error))
691    }
692}
693
694/// This endpoint allows you to export transactions from Firefly III into a file. Currently supports CSV exports only.
695pub async fn export_transactions(
696    configuration: &configuration::Configuration,
697    start: String,
698    end: String,
699    x_trace_id: Option<&str>,
700    accounts: Option<&str>,
701    r#type: Option<ExportFileFilter>,
702) -> Result<std::path::PathBuf, Error<ExportTransactionsError>> {
703    let local_var_configuration = configuration;
704
705    let local_var_client = &local_var_configuration.client;
706
707    let local_var_uri_str = format!(
708        "{}/v1/data/export/transactions",
709        local_var_configuration.base_path
710    );
711    let mut local_var_req_builder =
712        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
713
714    local_var_req_builder = local_var_req_builder.query(&[("start", &start.to_string())]);
715    local_var_req_builder = local_var_req_builder.query(&[("end", &end.to_string())]);
716    if let Some(ref local_var_str) = accounts {
717        local_var_req_builder =
718            local_var_req_builder.query(&[("accounts", &local_var_str.to_string())]);
719    }
720    if let Some(ref local_var_str) = r#type {
721        local_var_req_builder =
722            local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
723    }
724    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
725        local_var_req_builder =
726            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
727    }
728    if let Some(local_var_param_value) = x_trace_id {
729        local_var_req_builder =
730            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
731    }
732    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
733        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
734    };
735    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
736        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
737    };
738
739    let local_var_req = local_var_req_builder.build()?;
740    let local_var_resp = local_var_client.execute(local_var_req).await?;
741
742    let local_var_status = local_var_resp.status();
743    let local_var_content = local_var_resp.text().await?;
744
745    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
746        serde_json::from_str(&local_var_content).map_err(Error::from)
747    } else {
748        let local_var_entity: Option<ExportTransactionsError> =
749            serde_json::from_str(&local_var_content).ok();
750        let local_var_error = ResponseContent {
751            status: local_var_status,
752            content: local_var_content,
753            entity: local_var_entity,
754        };
755        Err(Error::ResponseError(local_var_error))
756    }
757}
758
759/// A call to this endpoint purges all previously deleted data. Use it with care and always with user permission. The demo user is incapable of using this endpoint.
760pub async fn purge_data(
761    configuration: &configuration::Configuration,
762    x_trace_id: Option<&str>,
763) -> Result<(), Error<PurgeDataError>> {
764    let local_var_configuration = configuration;
765
766    let local_var_client = &local_var_configuration.client;
767
768    let local_var_uri_str = format!("{}/v1/data/purge", local_var_configuration.base_path);
769    let mut local_var_req_builder =
770        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
771
772    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
773        local_var_req_builder =
774            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
775    }
776    if let Some(local_var_param_value) = x_trace_id {
777        local_var_req_builder =
778            local_var_req_builder.header("X-Trace-Id", local_var_param_value.to_string());
779    }
780    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
781        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
782    };
783    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
784        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
785    };
786
787    let local_var_req = local_var_req_builder.build()?;
788    let local_var_resp = local_var_client.execute(local_var_req).await?;
789
790    let local_var_status = local_var_resp.status();
791    let local_var_content = local_var_resp.text().await?;
792
793    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
794        Ok(())
795    } else {
796        let local_var_entity: Option<PurgeDataError> =
797            serde_json::from_str(&local_var_content).ok();
798        let local_var_error = ResponseContent {
799            status: local_var_status,
800            content: local_var_content,
801            entity: local_var_entity,
802        };
803        Err(Error::ResponseError(local_var_error))
804    }
805}