From 9ebdb0057929478a978a13351eeab0f9b48296fb Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 27 Feb 2022 10:13:07 +0100 Subject: [PATCH] API code --- frontend/src/api/accounts/destroy.js | 28 ++++++++ frontend/src/api/accounts/get.js | 35 ++++++++++ frontend/src/api/accounts/list.js | 28 ++++++++ frontend/src/api/accounts/post.js | 28 ++++++++ frontend/src/api/accounts/put.js | 28 ++++++++ frontend/src/api/authenticate/index.js | 27 ++++++++ frontend/src/api/budgets/destroy.js | 28 ++++++++ frontend/src/api/budgets/get.js | 38 +++++++++++ frontend/src/api/budgets/list.js | 28 ++++++++ frontend/src/api/budgets/post.js | 28 ++++++++ frontend/src/api/budgets/put.js | 28 ++++++++ frontend/src/api/categories/destroy.js | 28 ++++++++ frontend/src/api/categories/get.js | 36 ++++++++++ frontend/src/api/categories/list.js | 28 ++++++++ frontend/src/api/categories/post.js | 28 ++++++++ frontend/src/api/categories/put.js | 28 ++++++++ frontend/src/api/chart/account/overview.js | 30 ++++++++ frontend/src/api/currencies/destroy.js | 28 ++++++++ frontend/src/api/currencies/get.js | 32 +++++++++ frontend/src/api/currencies/index.js | 28 ++++++++ frontend/src/api/currencies/list.js | 28 ++++++++ frontend/src/api/currencies/post.js | 32 +++++++++ frontend/src/api/currencies/put.js | 28 ++++++++ frontend/src/api/data/export.js | 28 ++++++++ frontend/src/api/groups/destroy.js | 28 ++++++++ frontend/src/api/groups/get.js | 28 ++++++++ frontend/src/api/groups/list.js | 28 ++++++++ frontend/src/api/groups/put.js | 28 ++++++++ frontend/src/api/piggy-banks/destroy.js | 28 ++++++++ frontend/src/api/piggy-banks/get.js | 32 +++++++++ frontend/src/api/piggy-banks/list.js | 28 ++++++++ frontend/src/api/piggy-banks/post.js | 28 ++++++++ frontend/src/api/piggy-banks/put.js | 28 ++++++++ frontend/src/api/preferences/index.js | 30 ++++++++ frontend/src/api/preferences/put.js | 28 ++++++++ frontend/src/api/recurring/destroy.js | 28 ++++++++ frontend/src/api/recurring/get.js | 28 ++++++++ frontend/src/api/recurring/list.js | 28 ++++++++ frontend/src/api/recurring/post.js | 28 ++++++++ frontend/src/api/recurring/put.js | 28 ++++++++ frontend/src/api/rule-groups/destroy.js | 28 ++++++++ frontend/src/api/rule-groups/get.js | 35 ++++++++++ frontend/src/api/rule-groups/list.js | 28 ++++++++ frontend/src/api/rule-groups/post.js | 28 ++++++++ frontend/src/api/rule-groups/put.js | 28 ++++++++ frontend/src/api/rules/destroy.js | 28 ++++++++ frontend/src/api/rules/get.js | 31 +++++++++ frontend/src/api/rules/post.js | 28 ++++++++ frontend/src/api/rules/put.js | 28 ++++++++ frontend/src/api/subscriptions/destroy.js | 28 ++++++++ frontend/src/api/subscriptions/get.js | 32 +++++++++ frontend/src/api/subscriptions/list.js | 28 ++++++++ frontend/src/api/subscriptions/post.js | 28 ++++++++ frontend/src/api/subscriptions/put.js | 28 ++++++++ frontend/src/api/summary/basic.js | 32 +++++++++ frontend/src/api/system/about.js | 8 +++ frontend/src/api/system/configuration.js | 12 ++++ frontend/src/api/system/user.js | 16 +++++ frontend/src/api/tags/get.js | 32 +++++++++ frontend/src/api/tags/list.js | 28 ++++++++ frontend/src/api/transactions/destroy.js | 28 ++++++++ frontend/src/api/transactions/get.js | 28 ++++++++ frontend/src/api/transactions/list.js | 29 ++++++++ frontend/src/api/transactions/parser.js | 79 ++++++++++++++++++++++ frontend/src/api/transactions/post.js | 28 ++++++++ frontend/src/api/transactions/put.js | 28 ++++++++ frontend/src/api/webhooks/destroy.js | 28 ++++++++ frontend/src/api/webhooks/get.js | 28 ++++++++ frontend/src/api/webhooks/list.js | 28 ++++++++ frontend/src/api/webhooks/post.js | 28 ++++++++ frontend/src/api/webhooks/put.js | 28 ++++++++ 71 files changed, 2054 insertions(+) create mode 100644 frontend/src/api/accounts/destroy.js create mode 100644 frontend/src/api/accounts/get.js create mode 100644 frontend/src/api/accounts/list.js create mode 100644 frontend/src/api/accounts/post.js create mode 100644 frontend/src/api/accounts/put.js create mode 100644 frontend/src/api/authenticate/index.js create mode 100644 frontend/src/api/budgets/destroy.js create mode 100644 frontend/src/api/budgets/get.js create mode 100644 frontend/src/api/budgets/list.js create mode 100644 frontend/src/api/budgets/post.js create mode 100644 frontend/src/api/budgets/put.js create mode 100644 frontend/src/api/categories/destroy.js create mode 100644 frontend/src/api/categories/get.js create mode 100644 frontend/src/api/categories/list.js create mode 100644 frontend/src/api/categories/post.js create mode 100644 frontend/src/api/categories/put.js create mode 100644 frontend/src/api/chart/account/overview.js create mode 100644 frontend/src/api/currencies/destroy.js create mode 100644 frontend/src/api/currencies/get.js create mode 100644 frontend/src/api/currencies/index.js create mode 100644 frontend/src/api/currencies/list.js create mode 100644 frontend/src/api/currencies/post.js create mode 100644 frontend/src/api/currencies/put.js create mode 100644 frontend/src/api/data/export.js create mode 100644 frontend/src/api/groups/destroy.js create mode 100644 frontend/src/api/groups/get.js create mode 100644 frontend/src/api/groups/list.js create mode 100644 frontend/src/api/groups/put.js create mode 100644 frontend/src/api/piggy-banks/destroy.js create mode 100644 frontend/src/api/piggy-banks/get.js create mode 100644 frontend/src/api/piggy-banks/list.js create mode 100644 frontend/src/api/piggy-banks/post.js create mode 100644 frontend/src/api/piggy-banks/put.js create mode 100644 frontend/src/api/preferences/index.js create mode 100644 frontend/src/api/preferences/put.js create mode 100644 frontend/src/api/recurring/destroy.js create mode 100644 frontend/src/api/recurring/get.js create mode 100644 frontend/src/api/recurring/list.js create mode 100644 frontend/src/api/recurring/post.js create mode 100644 frontend/src/api/recurring/put.js create mode 100644 frontend/src/api/rule-groups/destroy.js create mode 100644 frontend/src/api/rule-groups/get.js create mode 100644 frontend/src/api/rule-groups/list.js create mode 100644 frontend/src/api/rule-groups/post.js create mode 100644 frontend/src/api/rule-groups/put.js create mode 100644 frontend/src/api/rules/destroy.js create mode 100644 frontend/src/api/rules/get.js create mode 100644 frontend/src/api/rules/post.js create mode 100644 frontend/src/api/rules/put.js create mode 100644 frontend/src/api/subscriptions/destroy.js create mode 100644 frontend/src/api/subscriptions/get.js create mode 100644 frontend/src/api/subscriptions/list.js create mode 100644 frontend/src/api/subscriptions/post.js create mode 100644 frontend/src/api/subscriptions/put.js create mode 100644 frontend/src/api/summary/basic.js create mode 100644 frontend/src/api/system/about.js create mode 100644 frontend/src/api/system/configuration.js create mode 100644 frontend/src/api/system/user.js create mode 100644 frontend/src/api/tags/get.js create mode 100644 frontend/src/api/tags/list.js create mode 100644 frontend/src/api/transactions/destroy.js create mode 100644 frontend/src/api/transactions/get.js create mode 100644 frontend/src/api/transactions/list.js create mode 100644 frontend/src/api/transactions/parser.js create mode 100644 frontend/src/api/transactions/post.js create mode 100644 frontend/src/api/transactions/put.js create mode 100644 frontend/src/api/webhooks/destroy.js create mode 100644 frontend/src/api/webhooks/get.js create mode 100644 frontend/src/api/webhooks/list.js create mode 100644 frontend/src/api/webhooks/post.js create mode 100644 frontend/src/api/webhooks/put.js diff --git a/frontend/src/api/accounts/destroy.js b/frontend/src/api/accounts/destroy.js new file mode 100644 index 0000000000..3b784bf218 --- /dev/null +++ b/frontend/src/api/accounts/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = '/api/v1/accounts/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/accounts/get.js b/frontend/src/api/accounts/get.js new file mode 100644 index 0000000000..6d9cb854ed --- /dev/null +++ b/frontend/src/api/accounts/get.js @@ -0,0 +1,35 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier, date) { + let url = '/api/v1/accounts/' + identifier; + if(!date) { + return api.get(url); + } + return api.get(url, {params: {date: date}}); + } + transactions(identifier, page, cacheKey) { + let url = '/api/v1/accounts/' + identifier + '/transactions'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/accounts/list.js b/frontend/src/api/accounts/list.js new file mode 100644 index 0000000000..90a0fea825 --- /dev/null +++ b/frontend/src/api/accounts/list.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(type, page, cacheKey) { + let url = '/api/v1/accounts'; + return api.get(url, {params: {page: page, cache: cacheKey, type: type}}); + } +} diff --git a/frontend/src/api/accounts/post.js b/frontend/src/api/accounts/post.js new file mode 100644 index 0000000000..159ec94f32 --- /dev/null +++ b/frontend/src/api/accounts/post.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Post { + post(submission) { + let url = '/api/v1/accounts'; + return api.post(url, submission); + } +} diff --git a/frontend/src/api/accounts/put.js b/frontend/src/api/accounts/put.js new file mode 100644 index 0000000000..58a6c43d12 --- /dev/null +++ b/frontend/src/api/accounts/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + post(identifier, submission) { + let url = '/api/v1/accounts/' + identifier; + return api.put(url, submission); + } +} diff --git a/frontend/src/api/authenticate/index.js b/frontend/src/api/authenticate/index.js new file mode 100644 index 0000000000..43d5fb32ea --- /dev/null +++ b/frontend/src/api/authenticate/index.js @@ -0,0 +1,27 @@ +/* + * basic.js + * Copyright (c) 2021 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + + export default class Authenticate { + async authenticate() { + return await api.get('/sanctum/csrf-cookie'); + } +} diff --git a/frontend/src/api/budgets/destroy.js b/frontend/src/api/budgets/destroy.js new file mode 100644 index 0000000000..3b17de392a --- /dev/null +++ b/frontend/src/api/budgets/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = 'api/v1/budgets/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/budgets/get.js b/frontend/src/api/budgets/get.js new file mode 100644 index 0000000000..48eaa24ec6 --- /dev/null +++ b/frontend/src/api/budgets/get.js @@ -0,0 +1,38 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier) { + let url = '/api/v1/budgets/' + identifier; + return api.get(url); + } + + transactions(identifier, page, cacheKey) { + let url = '/api/v1/budgets/' + identifier + '/transactions'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } + + transactionsWithoutBudget(page, cacheKey) { + let url = '/api/v1/budgets/transactions-without-budget'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/budgets/list.js b/frontend/src/api/budgets/list.js new file mode 100644 index 0000000000..25e6cb40c9 --- /dev/null +++ b/frontend/src/api/budgets/list.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(page, cacheKey) { + let url = '/api/v1/budgets'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/budgets/post.js b/frontend/src/api/budgets/post.js new file mode 100644 index 0000000000..51ef6c6dad --- /dev/null +++ b/frontend/src/api/budgets/post.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Post { + post(submission) { + let url = '/api/v1/budgets'; + return api.post(url, submission); + } +} diff --git a/frontend/src/api/budgets/put.js b/frontend/src/api/budgets/put.js new file mode 100644 index 0000000000..d58e7872cb --- /dev/null +++ b/frontend/src/api/budgets/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + post(identifier, submission) { + let url = '/api/v1/budgets/' + identifier; + return api.put(url, submission); + } +} diff --git a/frontend/src/api/categories/destroy.js b/frontend/src/api/categories/destroy.js new file mode 100644 index 0000000000..dcb150dc0d --- /dev/null +++ b/frontend/src/api/categories/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = '/api/v1/categories/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/categories/get.js b/frontend/src/api/categories/get.js new file mode 100644 index 0000000000..765aec746f --- /dev/null +++ b/frontend/src/api/categories/get.js @@ -0,0 +1,36 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier) { + let url = '/api/v1/categories/' + identifier; + return api.get(url); + } + transactions(identifier, page, cacheKey) { + let url = '/api/v1/categories/' + identifier + '/transactions'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } + transactionsWithoutCategory(page, cacheKey) { + let url = '/api/v1/categories/transactions-without-category'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/categories/list.js b/frontend/src/api/categories/list.js new file mode 100644 index 0000000000..0d07c89c4e --- /dev/null +++ b/frontend/src/api/categories/list.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(page, cacheKey) { + let url = '/api/v1/categories'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/categories/post.js b/frontend/src/api/categories/post.js new file mode 100644 index 0000000000..af240f2d05 --- /dev/null +++ b/frontend/src/api/categories/post.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Post { + post(submission) { + let url = '/api/v1/categories'; + return api.post(url, submission); + } +} diff --git a/frontend/src/api/categories/put.js b/frontend/src/api/categories/put.js new file mode 100644 index 0000000000..0576150be3 --- /dev/null +++ b/frontend/src/api/categories/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + post(identifier, submission) { + let url = '/api/v1/categories/' + identifier; + return api.put(url, submission); + } +} diff --git a/frontend/src/api/chart/account/overview.js b/frontend/src/api/chart/account/overview.js new file mode 100644 index 0000000000..cecaefaf51 --- /dev/null +++ b/frontend/src/api/chart/account/overview.js @@ -0,0 +1,30 @@ +/* + * overview.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; +import {format} from "date-fns"; + +export default class Overview { + overview(range, cacheKey) { + let startStr = format(range.start, 'y-MM-dd'); + let endStr = format(range.end, 'y-MM-dd'); + return api.get('/api/v1/chart/account/overview', {params: {start: startStr, end: endStr, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/currencies/destroy.js b/frontend/src/api/currencies/destroy.js new file mode 100644 index 0000000000..f9ec216790 --- /dev/null +++ b/frontend/src/api/currencies/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = '/api/v1/currencies/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/currencies/get.js b/frontend/src/api/currencies/get.js new file mode 100644 index 0000000000..107144b51d --- /dev/null +++ b/frontend/src/api/currencies/get.js @@ -0,0 +1,32 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier) { + let url = '/api/v1/currencies/' + identifier; + return api.get(url); + } + transactions(identifier, page, cacheKey) { + let url = '/api/v1/currencies/' + identifier + '/transactions'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/currencies/index.js b/frontend/src/api/currencies/index.js new file mode 100644 index 0000000000..bcc528de2b --- /dev/null +++ b/frontend/src/api/currencies/index.js @@ -0,0 +1,28 @@ +/* + * basic.js + * Copyright (c) 2021 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; +import Authenticate from '../authenticate/index'; +export default class Currencies { + default() { + let auth = new Authenticate(); + return auth.authenticate().then(() => {return api.get('/api/v1/currencies/default')}); + } +} diff --git a/frontend/src/api/currencies/list.js b/frontend/src/api/currencies/list.js new file mode 100644 index 0000000000..2468bc3d94 --- /dev/null +++ b/frontend/src/api/currencies/list.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(page, cacheKey) { + let url = '/api/v1/currencies'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/currencies/post.js b/frontend/src/api/currencies/post.js new file mode 100644 index 0000000000..689d72c571 --- /dev/null +++ b/frontend/src/api/currencies/post.js @@ -0,0 +1,32 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Post { + post(submission) { + let url = '/api/v1/currencies'; + return api.post(url, submission); + } + makeDefault(currency) { + let url = '/api/v1/currencies/' + currency + '/default'; + return api.post(url); + } +} diff --git a/frontend/src/api/currencies/put.js b/frontend/src/api/currencies/put.js new file mode 100644 index 0000000000..f3bae8c194 --- /dev/null +++ b/frontend/src/api/currencies/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + post(identifier, submission) { + let url = '/api/v1/currencies/' + identifier; + return api.put(url, submission); + } +} diff --git a/frontend/src/api/data/export.js b/frontend/src/api/data/export.js new file mode 100644 index 0000000000..d3a15f23f9 --- /dev/null +++ b/frontend/src/api/data/export.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Export { + transactions(start, end) { + let url = '/api/v1/data/export/transactions'; + return api.get(url, {params: {start: start, end: end}}); + } +} diff --git a/frontend/src/api/groups/destroy.js b/frontend/src/api/groups/destroy.js new file mode 100644 index 0000000000..a21e6ba7d1 --- /dev/null +++ b/frontend/src/api/groups/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = '/api/v1/object_groups/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/groups/get.js b/frontend/src/api/groups/get.js new file mode 100644 index 0000000000..693ba9261f --- /dev/null +++ b/frontend/src/api/groups/get.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier) { + let url = '/api/v1/object_groups/' + identifier; + return api.get(url); + } +} diff --git a/frontend/src/api/groups/list.js b/frontend/src/api/groups/list.js new file mode 100644 index 0000000000..7c37ad4b7e --- /dev/null +++ b/frontend/src/api/groups/list.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(type, page, cacheKey) { + let url = '/api/v1/object_groups'; + return api.get(url, {params: {page: page, cache: cacheKey, type: type}}); + } +} diff --git a/frontend/src/api/groups/put.js b/frontend/src/api/groups/put.js new file mode 100644 index 0000000000..b326011c27 --- /dev/null +++ b/frontend/src/api/groups/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + post(identifier, submission) { + let url = '/api/v1/object_groups/' + identifier; + return api.put(url, submission); + } +} diff --git a/frontend/src/api/piggy-banks/destroy.js b/frontend/src/api/piggy-banks/destroy.js new file mode 100644 index 0000000000..f7d7a24744 --- /dev/null +++ b/frontend/src/api/piggy-banks/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = '/api/v1/piggy_banks/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/piggy-banks/get.js b/frontend/src/api/piggy-banks/get.js new file mode 100644 index 0000000000..d12c88609f --- /dev/null +++ b/frontend/src/api/piggy-banks/get.js @@ -0,0 +1,32 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier) { + let url = '/api/v1/piggy_banks/' + identifier; + return api.get(url); + } + transactions(identifier, page, cacheKey) { + let url = '/api/v1/piggy_banks/' + identifier + '/transactions'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/piggy-banks/list.js b/frontend/src/api/piggy-banks/list.js new file mode 100644 index 0000000000..836b8313b1 --- /dev/null +++ b/frontend/src/api/piggy-banks/list.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(page, cacheKey) { + let url = '/api/v1/piggy_banks'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/piggy-banks/post.js b/frontend/src/api/piggy-banks/post.js new file mode 100644 index 0000000000..8f7b1020d8 --- /dev/null +++ b/frontend/src/api/piggy-banks/post.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Post { + post(submission) { + let url = '/api/v1/piggy_banks'; + return api.post(url, submission); + } +} diff --git a/frontend/src/api/piggy-banks/put.js b/frontend/src/api/piggy-banks/put.js new file mode 100644 index 0000000000..0168125922 --- /dev/null +++ b/frontend/src/api/piggy-banks/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + post(identifier, submission) { + let url = '/api/v1/piggy_banks/' + identifier; + return api.put(url, submission); + } +} diff --git a/frontend/src/api/preferences/index.js b/frontend/src/api/preferences/index.js new file mode 100644 index 0000000000..4121d77636 --- /dev/null +++ b/frontend/src/api/preferences/index.js @@ -0,0 +1,30 @@ +/* + * basic.js + * Copyright (c) 2021 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Preferences { + getByName(name) { + return api.get('/api/v1/preferences/' + name); + } + postByName(name, value) { + return api.post('/api/v1/preferences', {name: name, data: value}); + } +} diff --git a/frontend/src/api/preferences/put.js b/frontend/src/api/preferences/put.js new file mode 100644 index 0000000000..d8283cae65 --- /dev/null +++ b/frontend/src/api/preferences/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + put(name, value) { + let url = '/api/v1/preferences/' + name; + return api.put(url, {data: value}); + } +} diff --git a/frontend/src/api/recurring/destroy.js b/frontend/src/api/recurring/destroy.js new file mode 100644 index 0000000000..ffb61a8ac7 --- /dev/null +++ b/frontend/src/api/recurring/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = '/api/v1/recurrences/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/recurring/get.js b/frontend/src/api/recurring/get.js new file mode 100644 index 0000000000..f1a05daf97 --- /dev/null +++ b/frontend/src/api/recurring/get.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier) { + let url = '/api/v1/recurrences/' + identifier; + return api.get(url); + } +} diff --git a/frontend/src/api/recurring/list.js b/frontend/src/api/recurring/list.js new file mode 100644 index 0000000000..a47029db44 --- /dev/null +++ b/frontend/src/api/recurring/list.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(page, cacheKey) { + let url = '/api/v1/recurrences'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/recurring/post.js b/frontend/src/api/recurring/post.js new file mode 100644 index 0000000000..6f32133667 --- /dev/null +++ b/frontend/src/api/recurring/post.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Post { + post(submission) { + let url = '/api/v1/recurrences'; + return api.post(url, submission); + } +} diff --git a/frontend/src/api/recurring/put.js b/frontend/src/api/recurring/put.js new file mode 100644 index 0000000000..e56d616008 --- /dev/null +++ b/frontend/src/api/recurring/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + post(identifier, submission) { + let url = '/api/v1/recurrences/' + identifier; + return api.put(url, submission); + } +} diff --git a/frontend/src/api/rule-groups/destroy.js b/frontend/src/api/rule-groups/destroy.js new file mode 100644 index 0000000000..f72620bf1a --- /dev/null +++ b/frontend/src/api/rule-groups/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = '/api/v1/rule_groups/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/rule-groups/get.js b/frontend/src/api/rule-groups/get.js new file mode 100644 index 0000000000..7fe8793f9e --- /dev/null +++ b/frontend/src/api/rule-groups/get.js @@ -0,0 +1,35 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier, date) { + let url = '/api/v1/rule_groups/' + identifier; + if(!date) { + return api.get(url); + } + return api.get(url, {params: {date: date}}); + } + rules(identifier, page, cacheKey) { + let url = '/api/v1/rule_groups/' + identifier + '/rules'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/rule-groups/list.js b/frontend/src/api/rule-groups/list.js new file mode 100644 index 0000000000..3aaa5e1f31 --- /dev/null +++ b/frontend/src/api/rule-groups/list.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(page, cacheKey) { + let url = '/api/v1/rule_groups'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/rule-groups/post.js b/frontend/src/api/rule-groups/post.js new file mode 100644 index 0000000000..70601acba1 --- /dev/null +++ b/frontend/src/api/rule-groups/post.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Post { + post(submission) { + let url = '/api/v1/rule_groups'; + return api.post(url, submission); + } +} diff --git a/frontend/src/api/rule-groups/put.js b/frontend/src/api/rule-groups/put.js new file mode 100644 index 0000000000..e04ee87c89 --- /dev/null +++ b/frontend/src/api/rule-groups/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + post(identifier, submission) { + let url = '/api/v1/rule_groups/' + identifier; + return api.put(url, submission); + } +} diff --git a/frontend/src/api/rules/destroy.js b/frontend/src/api/rules/destroy.js new file mode 100644 index 0000000000..025f961208 --- /dev/null +++ b/frontend/src/api/rules/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = '/api/v1/rules/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/rules/get.js b/frontend/src/api/rules/get.js new file mode 100644 index 0000000000..29e80b2474 --- /dev/null +++ b/frontend/src/api/rules/get.js @@ -0,0 +1,31 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier, date) { + let url = '/api/v1/rules/' + identifier; + if(!date) { + return api.get(url); + } + return api.get(url, {params: {date: date}}); + } +} diff --git a/frontend/src/api/rules/post.js b/frontend/src/api/rules/post.js new file mode 100644 index 0000000000..5dbacb8b5b --- /dev/null +++ b/frontend/src/api/rules/post.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Post { + post(submission) { + let url = '/api/v1/rules'; + return api.post(url, submission); + } +} diff --git a/frontend/src/api/rules/put.js b/frontend/src/api/rules/put.js new file mode 100644 index 0000000000..cede795cbb --- /dev/null +++ b/frontend/src/api/rules/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + post(identifier, submission) { + let url = '/api/v1/rules/' + identifier; + return api.put(url, submission); + } +} diff --git a/frontend/src/api/subscriptions/destroy.js b/frontend/src/api/subscriptions/destroy.js new file mode 100644 index 0000000000..83bb5c833c --- /dev/null +++ b/frontend/src/api/subscriptions/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = '/api/v1/bills/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/subscriptions/get.js b/frontend/src/api/subscriptions/get.js new file mode 100644 index 0000000000..2d0ef000cf --- /dev/null +++ b/frontend/src/api/subscriptions/get.js @@ -0,0 +1,32 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier) { + let url = '/api/v1/bills/' + identifier; + return api.get(url); + } + transactions(identifier, page, cacheKey) { + let url = '/api/v1/bills/' + identifier + '/transactions'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/subscriptions/list.js b/frontend/src/api/subscriptions/list.js new file mode 100644 index 0000000000..aa88472022 --- /dev/null +++ b/frontend/src/api/subscriptions/list.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(page, cacheKey) { + let url = '/api/v1/bills'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/subscriptions/post.js b/frontend/src/api/subscriptions/post.js new file mode 100644 index 0000000000..1be441cdb7 --- /dev/null +++ b/frontend/src/api/subscriptions/post.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Post { + post(submission) { + let url = '/api/v1/bills'; + return api.post(url, submission); + } +} diff --git a/frontend/src/api/subscriptions/put.js b/frontend/src/api/subscriptions/put.js new file mode 100644 index 0000000000..d3067215c7 --- /dev/null +++ b/frontend/src/api/subscriptions/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + put(identifier, submission) { + let url = '/api/v1/bills/' + identifier; + return api.put(url, submission); + } +} diff --git a/frontend/src/api/summary/basic.js b/frontend/src/api/summary/basic.js new file mode 100644 index 0000000000..2c4c185ebc --- /dev/null +++ b/frontend/src/api/summary/basic.js @@ -0,0 +1,32 @@ +/* + * basic.js + * Copyright (c) 2021 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; +import {format} from 'date-fns'; + + +export default class Basic { + list(range, cacheKey) { + let startStr = format(range.start, 'y-MM-dd'); + let endStr = format(range.end, 'y-MM-dd'); + + return api.get('/api/v1/summary/basic', {params: {start: startStr, end: endStr, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/system/about.js b/frontend/src/api/system/about.js new file mode 100644 index 0000000000..44e29a0c20 --- /dev/null +++ b/frontend/src/api/system/about.js @@ -0,0 +1,8 @@ +import {api} from "boot/axios"; +//import createAuthRefreshInterceptor from 'axios-auth-refresh'; + +export default class About { + list() { + return api.get('/api/v1/about'); + } +} diff --git a/frontend/src/api/system/configuration.js b/frontend/src/api/system/configuration.js new file mode 100644 index 0000000000..1de0d58580 --- /dev/null +++ b/frontend/src/api/system/configuration.js @@ -0,0 +1,12 @@ + +import {api} from "boot/axios"; + +export default class Configuration { + get (identifier) { + return api.get('/api/v1/configuration/' + identifier); + } + + put (identifier, value) { + return api.put('/api/v1/configuration/' + identifier, value); + } +} diff --git a/frontend/src/api/system/user.js b/frontend/src/api/system/user.js new file mode 100644 index 0000000000..3ff9d421e0 --- /dev/null +++ b/frontend/src/api/system/user.js @@ -0,0 +1,16 @@ +import {api} from "boot/axios"; + +export default class AboutUser { + get() { + return api.get('/api/v1/about/user'); + } + + put(identifier, submission) { + console.log('here we are'); + return api.put('/api/v1/users/' + identifier, submission); + } + + logout() { + return api.post('/logout'); + } +} diff --git a/frontend/src/api/tags/get.js b/frontend/src/api/tags/get.js new file mode 100644 index 0000000000..1825f1aec3 --- /dev/null +++ b/frontend/src/api/tags/get.js @@ -0,0 +1,32 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier) { + let url = '/api/v1/tags/' + identifier; + return api.get(url); + } + transactions(identifier, page, cacheKey) { + let url = '/api/v1/tags/' + identifier + '/transactions'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/tags/list.js b/frontend/src/api/tags/list.js new file mode 100644 index 0000000000..0239f7ac4c --- /dev/null +++ b/frontend/src/api/tags/list.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(page, cacheKey) { + let url = '/api/v1/tags'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/transactions/destroy.js b/frontend/src/api/transactions/destroy.js new file mode 100644 index 0000000000..1eca9641a6 --- /dev/null +++ b/frontend/src/api/transactions/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = '/api/v1/transactions/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/transactions/get.js b/frontend/src/api/transactions/get.js new file mode 100644 index 0000000000..c8adc2f7bf --- /dev/null +++ b/frontend/src/api/transactions/get.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier) { + let url = 'api/v1/transactions/' + identifier; + return api.get(url); + } +} diff --git a/frontend/src/api/transactions/list.js b/frontend/src/api/transactions/list.js new file mode 100644 index 0000000000..fee89f3764 --- /dev/null +++ b/frontend/src/api/transactions/list.js @@ -0,0 +1,29 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(type, page, cacheKey) { + let url = 'api/v1/transactions'; + return api.get(url, {params: {page: page, cache: cacheKey, type: type}}); + } + +} diff --git a/frontend/src/api/transactions/parser.js b/frontend/src/api/transactions/parser.js new file mode 100644 index 0000000000..76ae40f162 --- /dev/null +++ b/frontend/src/api/transactions/parser.js @@ -0,0 +1,79 @@ +/* + * parser.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +export default class Parser { + parseResponse(response) { + let obj = {}; + obj.rows = []; + obj.rowsPerPage = response.data.meta.pagination.per_page; + obj.rowsNumber = response.data.meta.pagination.total; + + for (let i in response.data.data) { + if (response.data.data.hasOwnProperty(i)) { + let current = response.data.data[i]; + let group = { + group_id: current.id, + splits: [], + group_title: current.attributes.group_title + }; + + for (let ii in current.attributes.transactions) { + if (current.attributes.transactions.hasOwnProperty(ii)) { + let transaction = current.attributes.transactions[ii]; + let parsed = { + group_id: current.id, + journal_id: parseInt(transaction.transaction_journal_id), + type: transaction.type, + description: transaction.description, + amount: transaction.amount, + date: transaction.date, + source: transaction.source_name, + destination: transaction.destination_name, + category: transaction.category_name, + budget: transaction.budget_name, + currencyCode: transaction.currency_code, + }; + if (1 === current.attributes.transactions.length && 0 === parseInt(ii)) { + group.group_title = transaction.description; + } + + // merge with group if index = 0; + if (0 === parseInt(ii)) { + group = { + ...group, + ...parsed + }; + } + // append to splits if > 1 and > 1 + if (current.attributes.transactions.length > 0) { + group.splits.push(parsed); + // add amount: + if (ii > 0) { + group.amount = parseFloat(group.amount) + parseFloat(parsed.amount); + } + } + } + } + obj.rows.push(group); + } + } + return obj; + } +} diff --git a/frontend/src/api/transactions/post.js b/frontend/src/api/transactions/post.js new file mode 100644 index 0000000000..5197fc1035 --- /dev/null +++ b/frontend/src/api/transactions/post.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Post { + post(submission) { + let url = '/api/v1/transactions'; + return api.post(url, submission); + } +} diff --git a/frontend/src/api/transactions/put.js b/frontend/src/api/transactions/put.js new file mode 100644 index 0000000000..52858ded73 --- /dev/null +++ b/frontend/src/api/transactions/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + put(identifier, submission) { + let url = '/api/v1/transactions/' + identifier; + return api.put(url, submission); + } +} diff --git a/frontend/src/api/webhooks/destroy.js b/frontend/src/api/webhooks/destroy.js new file mode 100644 index 0000000000..b99a699a89 --- /dev/null +++ b/frontend/src/api/webhooks/destroy.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Destroy { + destroy(identifier) { + let url = '/api/v1/webhooks/' + identifier; + return api.delete(url); + } +} diff --git a/frontend/src/api/webhooks/get.js b/frontend/src/api/webhooks/get.js new file mode 100644 index 0000000000..3c8ce7ed11 --- /dev/null +++ b/frontend/src/api/webhooks/get.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Get { + get(identifier) { + let url = '/api/v1/webhooks/' + identifier; + return api.get(url); + } +} diff --git a/frontend/src/api/webhooks/list.js b/frontend/src/api/webhooks/list.js new file mode 100644 index 0000000000..5d4335ea73 --- /dev/null +++ b/frontend/src/api/webhooks/list.js @@ -0,0 +1,28 @@ +/* + * list.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class List { + list(page, cacheKey) { + let url = '/api/v1/webhooks'; + return api.get(url, {params: {page: page, cache: cacheKey}}); + } +} diff --git a/frontend/src/api/webhooks/post.js b/frontend/src/api/webhooks/post.js new file mode 100644 index 0000000000..b120984741 --- /dev/null +++ b/frontend/src/api/webhooks/post.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Post { + post(submission) { + let url = '/api/v1/webhooks'; + return api.post(url, submission); + } +} diff --git a/frontend/src/api/webhooks/put.js b/frontend/src/api/webhooks/put.js new file mode 100644 index 0000000000..16dff0a824 --- /dev/null +++ b/frontend/src/api/webhooks/put.js @@ -0,0 +1,28 @@ +/* + * post.js + * Copyright (c) 2022 james@firefly-iii.org + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import {api} from "boot/axios"; + +export default class Put { + put(identifier, submission) { + let url = '/api/v1/webhooks/' + identifier; + return api.put(url, submission); + } +}