2016-09-15 23:19:40 -05:00
|
|
|
<?php
|
2019-02-09 03:36:59 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* api.php
|
2020-07-02 22:59:36 -05:00
|
|
|
* Copyright (c) 2020 james@firefly-iii.org
|
2019-02-09 03:36:59 -06:00
|
|
|
*
|
2019-10-01 23:45:03 -05:00
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
2019-02-09 03:36:59 -06:00
|
|
|
*
|
2019-10-01 23:45:03 -05:00
|
|
|
* 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.
|
2019-02-09 03:36:59 -06:00
|
|
|
*
|
2019-10-01 23:45:03 -05:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2019-02-09 03:36:59 -06:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-01 23:45:03 -05:00
|
|
|
* GNU Affero General Public License for more details.
|
2019-02-09 03:36:59 -06:00
|
|
|
*
|
2019-10-01 23:45:03 -05:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2019-02-09 03:36:59 -06:00
|
|
|
*/
|
|
|
|
|
2020-07-02 22:59:36 -05:00
|
|
|
declare(strict_types=1);
|
2020-03-19 22:42:19 -05:00
|
|
|
|
2024-07-26 11:50:41 -05:00
|
|
|
use FireflyIII\Api\V2\Controllers\JsonApi\AccountController;
|
2024-05-09 23:43:18 -05:00
|
|
|
use LaravelJsonApi\Laravel\Facades\JsonApiRoute;
|
|
|
|
use LaravelJsonApi\Laravel\Http\Controllers\JsonApiController;
|
2024-05-10 05:51:02 -05:00
|
|
|
use LaravelJsonApi\Laravel\Routing\Relationships;
|
|
|
|
use LaravelJsonApi\Laravel\Routing\ResourceRegistrar;
|
2024-05-09 23:43:18 -05:00
|
|
|
|
2024-07-26 05:52:54 -05:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* ____ ____ ___ .______ ______ __ __ .___________. _______ _______.
|
|
|
|
* \ \ / / |__ \ | _ \ / __ \ | | | | | || ____| / |
|
|
|
|
* \ \/ / ) | | |_) | | | | | | | | | `---| |----`| |__ | (----`
|
|
|
|
* \ / / / | / | | | | | | | | | | | __| \ \
|
|
|
|
* \ / / /_ | |\ \----.| `--' | | `--' | | | | |____.----) |
|
|
|
|
* \__/ |____| | _| `._____| \______/ \______/ |__| |_______|_______/
|
|
|
|
*/
|
|
|
|
|
2024-07-28 22:06:54 -05:00
|
|
|
// AUTOCOMPLETE ROUTES
|
2024-05-12 06:31:33 -05:00
|
|
|
Route::group(
|
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\Autocomplete',
|
|
|
|
'prefix' => 'v2/autocomplete',
|
|
|
|
'as' => 'api.v2.autocomplete.',
|
|
|
|
],
|
|
|
|
static function (): void {
|
|
|
|
Route::get('accounts', ['uses' => 'AccountController@accounts', 'as' => 'accounts']);
|
|
|
|
Route::get('categories', ['uses' => 'CategoryController@categories', 'as' => 'categories']);
|
|
|
|
Route::get('tags', ['uses' => 'TagController@tags', 'as' => 'tags']);
|
2024-05-17 22:51:02 -05:00
|
|
|
Route::get('transaction-descriptions', ['uses' => 'TransactionController@transactionDescriptions', 'as' => 'transaction-descriptions']);
|
2024-05-12 06:31:33 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2024-07-28 22:06:54 -05:00
|
|
|
// CHART ROUTES
|
2024-05-20 00:30:41 -05:00
|
|
|
Route::group(
|
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\Chart',
|
|
|
|
'prefix' => 'v2/chart',
|
|
|
|
'as' => 'api.v1.chart.',
|
|
|
|
],
|
|
|
|
static function (): void {
|
|
|
|
Route::get('account/dashboard', ['uses' => 'AccountController@dashboard', 'as' => 'account.dashboard']);
|
2024-07-28 22:06:54 -05:00
|
|
|
Route::get('budget/dashboard', ['uses' => 'BudgetController@dashboard', 'as' => 'budget.dashboard']);
|
|
|
|
Route::get('category/dashboard', ['uses' => 'CategoryController@dashboard', 'as' => 'category.dashboard']);
|
2024-05-20 00:30:41 -05:00
|
|
|
Route::get('balance/balance', ['uses' => 'BalanceController@balance', 'as' => 'balance.balance']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// V2 API route for Summary boxes
|
2023-08-06 00:04:09 -05:00
|
|
|
// BASIC
|
|
|
|
Route::group(
|
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\Summary',
|
|
|
|
'prefix' => 'v2/summary',
|
|
|
|
'as' => 'api.v2.summary.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2023-08-06 00:04:09 -05:00
|
|
|
Route::get('basic', ['uses' => 'BasicController@basic', 'as' => 'basic']);
|
|
|
|
}
|
|
|
|
);
|
2023-12-29 12:59:19 -06:00
|
|
|
// V2 API route for all kinds of Transaction lists.
|
|
|
|
// A lot of endpoints involve transactions. So any time Firefly III needs to list transactions
|
|
|
|
// it's coming from these endpoints.
|
2022-06-25 07:23:52 -05:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\Transaction\List',
|
|
|
|
'prefix' => 'v2',
|
|
|
|
'as' => 'api.v2.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2023-12-29 12:59:19 -06:00
|
|
|
// basic list
|
2023-08-08 08:03:58 -05:00
|
|
|
Route::get('transactions', ['uses' => 'TransactionController@list', 'as' => 'transactions.list']);
|
2023-12-29 12:59:19 -06:00
|
|
|
|
|
|
|
// list by parent or related object.
|
|
|
|
// note how the check is done on the user group, not the user itself.
|
2023-08-08 08:03:58 -05:00
|
|
|
Route::get('accounts/{userGroupAccount}/transactions', ['uses' => 'AccountController@list', 'as' => 'accounts.transactions']);
|
2022-06-25 07:23:52 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// V2 API routes for auto complete
|
2024-05-12 06:31:33 -05:00
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// V2 API route for net worth endpoint(s);
|
2022-06-06 10:39:50 -05:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
2023-09-20 12:05:06 -05:00
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\Summary',
|
2023-01-17 13:09:57 -06:00
|
|
|
'prefix' => 'v2/net-worth',
|
|
|
|
'as' => 'api.v2.net-worth.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2022-06-06 10:39:50 -05:00
|
|
|
Route::get('', ['uses' => 'NetWorthController@get', 'as' => 'index']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2024-07-28 22:06:54 -05:00
|
|
|
// // V2 API route for accounts.
|
|
|
|
// Route::group(
|
2024-07-26 05:52:54 -05:00
|
|
|
// [
|
|
|
|
// 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Account',
|
|
|
|
// 'prefix' => 'v2/accounts',
|
|
|
|
// 'as' => 'api.v2.accounts.',
|
|
|
|
// ],
|
|
|
|
// static function (): void {
|
|
|
|
// Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
|
|
|
|
// Route::get('{account}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
// Route::put('{account}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
// }
|
2024-07-28 22:06:54 -05:00
|
|
|
// );
|
2022-06-25 07:23:52 -05:00
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// V2 API route for subscriptions.
|
2022-06-05 13:02:43 -05:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Bill',
|
2023-08-09 07:14:33 -05:00
|
|
|
'prefix' => 'v2/subscriptions',
|
|
|
|
'as' => 'api.v2.subscriptions.',
|
2023-01-17 13:09:57 -06:00
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2023-10-28 10:17:09 -05:00
|
|
|
Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
|
2023-09-03 10:38:54 -05:00
|
|
|
Route::get('{userGroupBill}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
2022-06-05 13:02:43 -05:00
|
|
|
Route::get('sum/paid', ['uses' => 'SumController@paid', 'as' => 'sum.paid']);
|
|
|
|
Route::get('sum/unpaid', ['uses' => 'SumController@unpaid', 'as' => 'sum.unpaid']);
|
|
|
|
}
|
|
|
|
);
|
2023-08-10 23:04:03 -05:00
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// V2 API route for piggy banks.
|
2023-08-10 23:04:03 -05:00
|
|
|
Route::group(
|
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\Model\PiggyBank',
|
|
|
|
'prefix' => 'v2/piggy-banks',
|
|
|
|
'as' => 'api.v2.piggy-banks.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2023-10-28 10:17:09 -05:00
|
|
|
Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
|
2023-08-10 23:04:03 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// V2 API route for transaction currencies
|
2023-10-28 10:17:09 -05:00
|
|
|
Route::group(
|
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Currency',
|
|
|
|
'prefix' => 'v2/currencies',
|
|
|
|
'as' => 'api.v2.currencies.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2023-10-28 10:17:09 -05:00
|
|
|
Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
|
2023-08-10 23:04:03 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// V2 API route for transactions
|
2023-08-22 01:25:06 -05:00
|
|
|
Route::group(
|
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Transaction',
|
|
|
|
'prefix' => 'v2/transactions',
|
|
|
|
'as' => 'api.v2.transactions.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2023-08-22 01:25:06 -05:00
|
|
|
Route::post('', ['uses' => 'StoreController@post', 'as' => 'store']);
|
2024-01-06 00:26:03 -06:00
|
|
|
Route::get('{userGroupTransaction}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
2024-01-10 13:29:00 -06:00
|
|
|
Route::put('{userGroupTransaction}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
2023-08-22 01:25:06 -05:00
|
|
|
}
|
|
|
|
);
|
2024-02-25 11:09:52 -06:00
|
|
|
// infinite (transactions) list:
|
2024-02-10 01:28:59 -06:00
|
|
|
Route::group(
|
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\Transaction\List',
|
2024-02-25 11:09:52 -06:00
|
|
|
'prefix' => 'v2/infinite/transactions',
|
|
|
|
'as' => 'api.v2.infinite.transactions.',
|
2024-02-10 01:28:59 -06:00
|
|
|
],
|
|
|
|
static function (): void {
|
2024-02-25 11:09:52 -06:00
|
|
|
Route::get('', ['uses' => 'TransactionController@infiniteList', 'as' => 'list']);
|
2023-08-22 01:25:06 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// V2 API route for budgets and budget limits:
|
2022-06-06 07:40:19 -05:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\Model',
|
|
|
|
'prefix' => 'v2/budgets',
|
|
|
|
'as' => 'api.v2.budgets',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2023-10-28 10:17:09 -05:00
|
|
|
Route::get('', ['uses' => 'Budget\IndexController@index', 'as' => 'index']);
|
2022-07-24 22:42:49 -05:00
|
|
|
Route::get('{budget}', ['uses' => 'Budget\ShowController@show', 'as' => 'show']);
|
2023-10-28 10:17:09 -05:00
|
|
|
Route::get('{budget}/limits', ['uses' => 'BudgetLimit\IndexController@index', 'as' => 'budget-limits.index']);
|
2023-12-30 07:39:44 -06:00
|
|
|
Route::get('sum/budgeted', ['uses' => 'Budget\SumController@budgeted', 'as' => 'sum.budgeted']);
|
2022-07-24 22:42:49 -05:00
|
|
|
Route::get('sum/spent', ['uses' => 'Budget\SumController@spent', 'as' => 'sum.spent']);
|
2023-12-20 12:45:12 -06:00
|
|
|
// Route::get('{budget}/budgeted', ['uses' => 'Budget\ShowController@budgeted', 'as' => 'budget.budgeted']);
|
|
|
|
// Route::get('{budget}/spent', ['uses' => 'Budget\ShowController@spent', 'as' => 'budget.spent']);
|
2022-06-06 07:40:19 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// V2 API route for system
|
2022-06-06 07:40:19 -05:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\System',
|
|
|
|
'prefix' => 'v2',
|
|
|
|
'as' => 'api.v2.system.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2022-06-06 07:40:19 -05:00
|
|
|
Route::get('preferences/{preference}', ['uses' => 'PreferencesController@get', 'as' => 'preferences.get']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// V2 API route for user groups (administrations).
|
2023-09-19 23:18:25 -05:00
|
|
|
Route::group(
|
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V2\Controllers\UserGroup',
|
|
|
|
'prefix' => 'v2/user-groups',
|
|
|
|
'as' => 'api.v2.user-groups.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2023-10-28 10:17:09 -05:00
|
|
|
Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
|
2023-09-19 23:18:25 -05:00
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{userGroup}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
2023-09-21 04:29:09 -05:00
|
|
|
Route::put('{userGroup}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
2024-04-01 08:41:16 -05:00
|
|
|
Route::post('{userGroup}/use', ['uses' => 'UpdateController@useUserGroup', 'as' => 'use']);
|
2023-09-21 04:29:09 -05:00
|
|
|
Route::put('{userGroup}/update-membership', ['uses' => 'UpdateController@updateMembership', 'as' => 'updateMembership']);
|
2023-09-20 12:05:06 -05:00
|
|
|
Route::delete('{userGroup}', ['uses' => 'DestroyController@destroy', 'as' => 'destroy']);
|
2023-09-19 23:18:25 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2024-07-28 22:06:54 -05:00
|
|
|
// V2 JSON API ROUTES
|
2024-07-26 05:52:54 -05:00
|
|
|
JsonApiRoute::server('v2')->prefix('v2')
|
2024-08-05 13:37:29 -05:00
|
|
|
->resources(function (ResourceRegistrar $server): void {
|
|
|
|
// ACCOUNTS
|
|
|
|
$server->resource('accounts', AccountController::class)
|
|
|
|
->relationships(function (Relationships $relations): void {
|
|
|
|
$relations->hasOne('user')->readOnly();
|
|
|
|
})
|
|
|
|
;
|
2024-07-26 05:52:54 -05:00
|
|
|
|
2024-08-05 13:37:29 -05:00
|
|
|
// USERS
|
|
|
|
$server->resource('users', JsonApiController::class)->readOnly()->relationships(function (Relationships $relations): void {
|
|
|
|
$relations->hasMany('accounts')->readOnly();
|
|
|
|
});
|
|
|
|
})
|
|
|
|
;
|
2024-07-26 05:52:54 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ____ ____ __ .______ ______ __ __ .___________. _______ _______.
|
|
|
|
* \ \ / / /_ | | _ \ / __ \ | | | | | || ____| / |
|
|
|
|
* \ \/ / | | | |_) | | | | | | | | | `---| |----`| |__ | (----`
|
|
|
|
* \ / | | | / | | | | | | | | | | | __| \ \
|
|
|
|
* \ / | | | |\ \----.| `--' | | `--' | | | | |____.----) |
|
|
|
|
* \__/ |_| | _| `._____| \______/ \______/ |__| |_______|_______/
|
|
|
|
*/
|
2023-09-19 23:18:25 -05:00
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// Autocomplete controllers
|
2021-03-03 00:02:57 -06:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Autocomplete',
|
|
|
|
'prefix' => 'v1/autocomplete',
|
|
|
|
'as' => 'api.v1.autocomplete.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-03 00:02:57 -06:00
|
|
|
// Auto complete routes
|
|
|
|
Route::get('accounts', ['uses' => 'AccountController@accounts', 'as' => 'accounts']);
|
|
|
|
Route::get('bills', ['uses' => 'BillController@bills', 'as' => 'bills']);
|
|
|
|
Route::get('budgets', ['uses' => 'BudgetController@budgets', 'as' => 'budgets']);
|
|
|
|
Route::get('categories', ['uses' => 'CategoryController@categories', 'as' => 'categories']);
|
|
|
|
Route::get('currencies', ['uses' => 'CurrencyController@currencies', 'as' => 'currencies']);
|
|
|
|
Route::get('currencies-with-code', ['uses' => 'CurrencyController@currenciesWithCode', 'as' => 'currencies-with-code']);
|
|
|
|
Route::get('object-groups', ['uses' => 'ObjectGroupController@objectGroups', 'as' => 'object-groups']);
|
|
|
|
Route::get('piggy-banks', ['uses' => 'PiggyBankController@piggyBanks', 'as' => 'piggy-banks']);
|
|
|
|
Route::get('piggy-banks-with-balance', ['uses' => 'PiggyBankController@piggyBanksWithBalance', 'as' => 'piggy-banks-with-balance']);
|
2021-03-05 00:03:28 -06:00
|
|
|
Route::get('recurring', ['uses' => 'RecurrenceController@recurring', 'as' => 'recurring']);
|
2021-03-03 00:02:57 -06:00
|
|
|
Route::get('rules', ['uses' => 'RuleController@rules', 'as' => 'rules']);
|
2021-03-05 00:03:28 -06:00
|
|
|
Route::get('rule-groups', ['uses' => 'RuleGroupController@ruleGroups', 'as' => 'rule-groups']);
|
2021-03-03 00:02:57 -06:00
|
|
|
Route::get('tags', ['uses' => 'TagController@tags', 'as' => 'tags']);
|
|
|
|
Route::get('transactions', ['uses' => 'TransactionController@transactions', 'as' => 'transactions']);
|
|
|
|
Route::get('transactions-with-id', ['uses' => 'TransactionController@transactionsWithID', 'as' => 'transactions-with-id']);
|
|
|
|
Route::get('transaction-types', ['uses' => 'TransactionTypeController@transactionTypes', 'as' => 'transaction-types']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// CHART ROUTES.
|
2024-07-26 05:52:54 -05:00
|
|
|
// Chart accounts
|
2021-03-03 00:02:57 -06:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Chart',
|
|
|
|
'prefix' => 'v1/chart/account',
|
|
|
|
'as' => 'api.v1.chart.account.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-03 00:02:57 -06:00
|
|
|
Route::get('overview', ['uses' => 'AccountController@overview', 'as' => 'overview']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-03 23:28:16 -06:00
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// DATA ROUTES
|
2021-03-07 01:16:33 -06:00
|
|
|
// Export data API routes
|
2021-03-03 23:28:16 -06:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Data\Export',
|
|
|
|
'prefix' => 'v1/data/export',
|
|
|
|
'as' => 'api.v1.data.export.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-03 23:28:16 -06:00
|
|
|
Route::get('accounts', ['uses' => 'ExportController@accounts', 'as' => 'accounts']);
|
|
|
|
Route::get('bills', ['uses' => 'ExportController@bills', 'as' => 'bills']);
|
|
|
|
Route::get('budgets', ['uses' => 'ExportController@budgets', 'as' => 'budgets']);
|
|
|
|
Route::get('categories', ['uses' => 'ExportController@categories', 'as' => 'categories']);
|
|
|
|
Route::get('piggy-banks', ['uses' => 'ExportController@piggyBanks', 'as' => 'piggy-banks']);
|
|
|
|
Route::get('recurring', ['uses' => 'ExportController@recurring', 'as' => 'recurring']);
|
|
|
|
Route::get('rules', ['uses' => 'ExportController@rules', 'as' => 'rules']);
|
|
|
|
Route::get('tags', ['uses' => 'ExportController@tags', 'as' => 'tags']);
|
|
|
|
Route::get('transactions', ['uses' => 'ExportController@transactions', 'as' => 'transactions']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-07 01:16:33 -06:00
|
|
|
// Destroy data API route
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Data',
|
|
|
|
'prefix' => 'v1/data/destroy',
|
|
|
|
'as' => 'api.v1.data.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-07 01:16:33 -06:00
|
|
|
Route::delete('', ['uses' => 'DestroyController@destroy', 'as' => 'destroy']);
|
|
|
|
}
|
|
|
|
);
|
2022-10-01 12:06:55 -05:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Data',
|
|
|
|
'prefix' => 'v1/data/purge',
|
|
|
|
'as' => 'api.v1.data.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2022-10-01 12:06:55 -05:00
|
|
|
Route::delete('', ['uses' => 'PurgeController@purge', 'as' => 'purge']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-03 23:28:16 -06:00
|
|
|
|
2021-08-10 11:43:21 -05:00
|
|
|
// Bulk update API routes
|
2021-04-03 06:56:45 -05:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Data\Bulk',
|
|
|
|
'prefix' => 'v1/data/bulk',
|
|
|
|
'as' => 'api.v1.data.bulk.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-08-10 11:43:21 -05:00
|
|
|
Route::post('transactions', ['uses' => 'TransactionController@update', 'as' => 'transactions']);
|
2021-04-03 06:56:45 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// INSIGHTS ROUTES
|
2021-03-03 10:06:18 -06:00
|
|
|
|
|
|
|
// Insight in expenses:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Insight\Expense',
|
|
|
|
'prefix' => 'v1/insight/expense',
|
|
|
|
'as' => 'api.v1.insight.expense.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-05 09:28:59 -06:00
|
|
|
// Insight in expenses per account:
|
2021-03-03 10:06:18 -06:00
|
|
|
Route::get('expense', ['uses' => 'AccountController@expense', 'as' => 'expense']);
|
2021-03-05 13:17:39 -06:00
|
|
|
Route::get('asset', ['uses' => 'AccountController@asset', 'as' => 'asset']);
|
2021-03-03 10:06:18 -06:00
|
|
|
Route::get('total', ['uses' => 'PeriodController@total', 'as' => 'total']);
|
2021-03-05 09:28:59 -06:00
|
|
|
Route::get('bill', ['uses' => 'BillController@bill', 'as' => 'bill']);
|
|
|
|
Route::get('no-bill', ['uses' => 'BillController@noBill', 'as' => 'no-bill']);
|
|
|
|
Route::get('budget', ['uses' => 'BudgetController@budget', 'as' => 'budget']);
|
|
|
|
Route::get('no-budget', ['uses' => 'BudgetController@noBudget', 'as' => 'no-budget']);
|
2021-03-03 23:28:16 -06:00
|
|
|
Route::get('category', ['uses' => 'CategoryController@category', 'as' => 'category']);
|
|
|
|
Route::get('no-category', ['uses' => 'CategoryController@noCategory', 'as' => 'no-category']);
|
2021-03-05 09:28:59 -06:00
|
|
|
Route::get('tag', ['uses' => 'TagController@tag', 'as' => 'tag']);
|
|
|
|
Route::get('no-tag', ['uses' => 'TagController@noTag', 'as' => 'no-tag']);
|
|
|
|
|
2022-12-29 12:43:43 -06:00
|
|
|
// TODO per object group, perhaps in the future.
|
|
|
|
// TODO per recurrence, all transaction created under it.
|
|
|
|
// TODO Per currency or as filter?
|
|
|
|
// TODO Show user net worth
|
2021-03-03 10:06:18 -06:00
|
|
|
}
|
|
|
|
);
|
2021-03-05 13:17:39 -06:00
|
|
|
// insight in income
|
2021-03-03 23:28:16 -06:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Insight\Income',
|
|
|
|
'prefix' => 'v1/insight/income',
|
|
|
|
'as' => 'api.v1.insight.income.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-05 13:17:39 -06:00
|
|
|
// Insight in expenses per account:
|
|
|
|
Route::get('revenue', ['uses' => 'AccountController@revenue', 'as' => 'revenue']);
|
|
|
|
Route::get('asset', ['uses' => 'AccountController@asset', 'as' => 'asset']);
|
2021-03-03 23:28:16 -06:00
|
|
|
Route::get('total', ['uses' => 'PeriodController@total', 'as' => 'total']);
|
|
|
|
Route::get('category', ['uses' => 'CategoryController@category', 'as' => 'category']);
|
|
|
|
Route::get('no-category', ['uses' => 'CategoryController@noCategory', 'as' => 'no-category']);
|
|
|
|
|
2021-03-05 13:17:39 -06:00
|
|
|
Route::get('tag', ['uses' => 'TagController@tag', 'as' => 'tag']);
|
|
|
|
Route::get('no-tag', ['uses' => 'TagController@noTag', 'as' => 'no-tag']);
|
|
|
|
|
2022-12-29 12:43:43 -06:00
|
|
|
// TODO per object group, maybe in the future
|
|
|
|
// TODO Per recurrence, all transactions created under it.
|
|
|
|
// TODO per currency or as a filter?
|
|
|
|
// TODO show user net worth?
|
2021-03-03 23:28:16 -06:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2021-03-05 09:28:59 -06:00
|
|
|
// Insight in transfers
|
2021-03-07 08:26:42 -06:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Insight\Transfer',
|
|
|
|
'prefix' => 'v1/insight/transfer',
|
|
|
|
'as' => 'api.v1.insight.transfer.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-07 08:26:42 -06:00
|
|
|
// Insight in expenses per account:
|
|
|
|
Route::get('asset', ['uses' => 'AccountController@asset', 'as' => 'asset']);
|
|
|
|
Route::get('category', ['uses' => 'CategoryController@category', 'as' => 'category']);
|
|
|
|
Route::get('no-category', ['uses' => 'CategoryController@noCategory', 'as' => 'no-category']);
|
|
|
|
Route::get('tag', ['uses' => 'TagController@tag', 'as' => 'tag']);
|
|
|
|
Route::get('no-tag', ['uses' => 'TagController@noTag', 'as' => 'no-tag']);
|
|
|
|
Route::get('total', ['uses' => 'PeriodController@total', 'as' => 'total']);
|
2022-12-29 12:43:43 -06:00
|
|
|
// TODO Transfers for piggies
|
2021-03-07 08:26:42 -06:00
|
|
|
}
|
|
|
|
);
|
2023-12-20 12:45:12 -06:00
|
|
|
// SUMMARY CONTROLLER
|
2021-03-05 00:03:28 -06:00
|
|
|
// BASIC
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Summary',
|
|
|
|
'prefix' => 'v1/summary',
|
|
|
|
'as' => 'api.v1.summary.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-05 00:03:28 -06:00
|
|
|
Route::get('basic', ['uses' => 'BasicController@basic', 'as' => 'basic']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-06 00:20:49 -06:00
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// MODELS
|
2021-03-06 00:20:49 -06:00
|
|
|
// Accounts API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\Account',
|
|
|
|
'prefix' => 'v1/accounts',
|
|
|
|
'as' => 'api.v1.accounts.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 00:20:49 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{account}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{account}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{account}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
|
2023-02-11 23:53:36 -06:00
|
|
|
Route::get('{account}/piggy-banks', ['uses' => 'ListController@piggyBanks', 'as' => 'piggy-banks']);
|
2021-03-06 00:20:49 -06:00
|
|
|
Route::get('{account}/transactions', ['uses' => 'ListController@transactions', 'as' => 'transactions']);
|
|
|
|
Route::get('{account}/attachments', ['uses' => 'ListController@attachments', 'as' => 'attachments']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// Attachment API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\Attachment',
|
|
|
|
'prefix' => 'v1/attachments',
|
|
|
|
'as' => 'api.v1.attachments.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 00:20:49 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{attachment}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::get('{attachment}/download', ['uses' => 'ShowController@download', 'as' => 'download']);
|
|
|
|
Route::post('{attachment}/upload', ['uses' => 'StoreController@upload', 'as' => 'upload']);
|
|
|
|
Route::put('{attachment}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{attachment}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-06 05:45:49 -06:00
|
|
|
|
|
|
|
// Bills API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\Bill',
|
|
|
|
'prefix' => 'v1/bills',
|
|
|
|
'as' => 'api.v1.bills.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 05:45:49 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{bill}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{bill}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{bill}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
|
|
|
|
Route::get('{bill}/attachments', ['uses' => 'ListController@attachments', 'as' => 'attachments']);
|
|
|
|
Route::get('{bill}/rules', ['uses' => 'ListController@rules', 'as' => 'rules']);
|
|
|
|
Route::get('{bill}/transactions', ['uses' => 'ListController@transactions', 'as' => 'transactions']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2021-03-06 00:20:49 -06:00
|
|
|
// Available Budget API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\AvailableBudget',
|
2023-02-11 23:53:36 -06:00
|
|
|
'prefix' => 'v1/available-budgets',
|
|
|
|
'as' => 'api.v1.available-budgets.',
|
2023-01-17 13:09:57 -06:00
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 00:20:49 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
2023-12-20 12:45:12 -06:00
|
|
|
// Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
2021-03-06 00:20:49 -06:00
|
|
|
Route::get('{availableBudget}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
2023-12-20 12:45:12 -06:00
|
|
|
// Route::put('{availableBudget}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
// Route::delete('{availableBudget}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
2021-03-06 00:20:49 -06:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2021-03-06 01:40:51 -06:00
|
|
|
// Budget and Budget Limit API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models',
|
|
|
|
'prefix' => 'v1/budgets',
|
|
|
|
'as' => 'api.v1.budgets.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 01:40:51 -06:00
|
|
|
Route::get('', ['uses' => 'Budget\ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'Budget\StoreController@store', 'as' => 'store']);
|
2022-01-29 06:39:03 -06:00
|
|
|
Route::get('transactions-without-budget', ['uses' => 'Budget\ListController@withoutBudget', 'as' => 'without-budget']);
|
2021-03-06 01:40:51 -06:00
|
|
|
Route::get('{budget}', ['uses' => 'Budget\ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{budget}', ['uses' => 'Budget\UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{budget}', ['uses' => 'Budget\DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
|
|
|
|
Route::get('{budget}/transactions', ['uses' => 'Budget\ListController@transactions', 'as' => 'transactions']);
|
|
|
|
Route::get('{budget}/attachments', ['uses' => 'Budget\ListController@attachments', 'as' => 'attachments']);
|
|
|
|
|
|
|
|
// limits:
|
|
|
|
Route::get('{budget}/limits', ['uses' => 'BudgetLimit\ShowController@index', 'as' => 'limits.index']);
|
|
|
|
Route::post('{budget}/limits', ['uses' => 'BudgetLimit\StoreController@store', 'as' => 'limits.store']);
|
|
|
|
Route::get('{budget}/limits/{budgetLimit}', ['uses' => 'BudgetLimit\ShowController@show', 'as' => 'limits.show']);
|
|
|
|
Route::put('{budget}/limits/{budgetLimit}', ['uses' => 'BudgetLimit\UpdateController@update', 'as' => 'limits.update']);
|
|
|
|
Route::delete('{budget}/limits/{budgetLimit}', ['uses' => 'BudgetLimit\DestroyController@destroy', 'as' => 'limits.delete']);
|
|
|
|
Route::get('{budget}/limits/{budgetLimit}/transactions', ['uses' => 'BudgetLimit\ListController@transactions', 'as' => 'limits.transactions']);
|
2021-03-13 14:32:24 -06:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// separate route for budget limits without referring to the budget.
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\BudgetLimit',
|
|
|
|
'prefix' => 'v1/budget-limits',
|
|
|
|
'as' => 'api.v1.budget-limits.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-13 14:32:24 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@indexAll', 'as' => 'index']);
|
2021-03-06 01:40:51 -06:00
|
|
|
}
|
|
|
|
);
|
2021-03-06 07:50:48 -06:00
|
|
|
|
2021-03-06 05:45:49 -06:00
|
|
|
// Category API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\Category',
|
|
|
|
'prefix' => 'v1/categories',
|
|
|
|
'as' => 'api.v1.categories.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 05:45:49 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{category}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{category}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{category}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
|
|
|
|
Route::get('{category}/transactions', ['uses' => 'ListController@transactions', 'as' => 'transactions']);
|
|
|
|
Route::get('{category}/attachments', ['uses' => 'ListController@attachments', 'as' => 'attachments']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-06 07:50:48 -06:00
|
|
|
|
|
|
|
// Object Group API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\ObjectGroup',
|
2023-02-11 23:53:36 -06:00
|
|
|
'prefix' => 'v1/object-groups',
|
2023-01-17 13:09:57 -06:00
|
|
|
'as' => 'api.v1.object-groups.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 07:50:48 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::get('{objectGroup}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{objectGroup}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{objectGroup}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
|
2023-02-11 23:53:36 -06:00
|
|
|
Route::get('{objectGroup}/piggy-banks', ['uses' => 'ListController@piggyBanks', 'as' => 'piggy-banks']);
|
2021-03-06 07:50:48 -06:00
|
|
|
Route::get('{objectGroup}/bills', ['uses' => 'ListController@bills', 'as' => 'bills']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2021-03-06 05:45:49 -06:00
|
|
|
// Piggy Bank API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\PiggyBank',
|
2023-02-11 23:53:36 -06:00
|
|
|
'prefix' => 'v1/piggy-banks',
|
|
|
|
'as' => 'api.v1.piggy-banks.',
|
2023-01-17 13:09:57 -06:00
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 05:45:49 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{piggyBank}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{piggyBank}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{piggyBank}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
|
|
|
|
Route::get('{piggyBank}/events', ['uses' => 'ListController@piggyBankEvents', 'as' => 'events']);
|
|
|
|
Route::get('{piggyBank}/attachments', ['uses' => 'ListController@attachments', 'as' => 'attachments']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2021-03-06 09:15:39 -06:00
|
|
|
// Recurrence API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\Recurrence',
|
|
|
|
'prefix' => 'v1/recurrences',
|
|
|
|
'as' => 'api.v1.recurrences.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 09:15:39 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{recurrence}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{recurrence}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{recurrence}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
|
|
|
|
Route::get('{recurrence}/transactions', ['uses' => 'ListController@transactions', 'as' => 'transactions']);
|
2024-06-15 02:15:48 -05:00
|
|
|
|
|
|
|
// controller does not exist:
|
2024-06-15 06:07:23 -05:00
|
|
|
// Route::post('trigger', ['uses' => 'RecurrenceController@trigger', 'as' => 'trigger']);
|
2021-03-06 09:15:39 -06:00
|
|
|
}
|
|
|
|
);
|
2021-03-06 05:45:49 -06:00
|
|
|
|
2021-03-06 10:43:06 -06:00
|
|
|
// Rules API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\Rule',
|
|
|
|
'prefix' => 'v1/rules',
|
|
|
|
'as' => 'api.v1.rules.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 10:43:06 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
2024-03-09 23:29:15 -06:00
|
|
|
Route::get('validate-expression', ['uses' => 'ExpressionController@validateExpression', 'as' => 'validate']);
|
2021-03-06 10:43:06 -06:00
|
|
|
Route::get('{rule}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{rule}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{rule}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
|
|
|
|
Route::get('{rule}/test', ['uses' => 'TriggerController@testRule', 'as' => 'test']);
|
2022-10-30 05:43:17 -05:00
|
|
|
// TODO give results back
|
2021-03-06 10:43:06 -06:00
|
|
|
Route::post('{rule}/trigger', ['uses' => 'TriggerController@triggerRule', 'as' => 'trigger']);
|
2022-10-30 05:43:17 -05:00
|
|
|
// TODO rule transactions, rule bills?
|
2021-03-06 10:43:06 -06:00
|
|
|
}
|
|
|
|
);
|
2021-03-06 05:45:49 -06:00
|
|
|
|
2021-03-06 11:00:49 -06:00
|
|
|
// Rules API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\RuleGroup',
|
2023-02-11 23:53:36 -06:00
|
|
|
'prefix' => 'v1/rule-groups',
|
|
|
|
'as' => 'api.v1.rule-groups.',
|
2023-01-17 13:09:57 -06:00
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 11:00:49 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{ruleGroup}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{ruleGroup}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{ruleGroup}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
Route::get('{ruleGroup}/test', ['uses' => 'TriggerController@testGroup', 'as' => 'test']);
|
|
|
|
Route::post('{ruleGroup}/trigger', ['uses' => 'TriggerController@triggerGroup', 'as' => 'trigger']);
|
|
|
|
|
|
|
|
Route::get('{ruleGroup}/rules', ['uses' => 'ListController@rules', 'as' => 'rules']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2021-03-06 12:04:09 -06:00
|
|
|
// Tag API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\Tag',
|
|
|
|
'prefix' => 'v1/tags',
|
|
|
|
'as' => 'api.v1.tags.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 12:04:09 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{tagOrId}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{tagOrId}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{tagOrId}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
|
|
|
|
Route::get('{tagOrId}/transactions', ['uses' => 'ListController@transactions', 'as' => 'transactions']);
|
|
|
|
Route::get('{tagOrId}/attachments', ['uses' => 'ListController@attachments', 'as' => 'attachments']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-06 13:05:17 -06:00
|
|
|
// Transaction API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\Transaction',
|
|
|
|
'prefix' => 'v1/transactions',
|
|
|
|
'as' => 'api.v1.transactions.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 13:05:17 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{transactionGroup}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{transactionGroup}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{transactionGroup}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
2021-03-06 11:00:49 -06:00
|
|
|
|
2021-03-06 13:05:17 -06:00
|
|
|
Route::get('{transactionGroup}/attachments', ['uses' => 'ListController@attachments', 'as' => 'attachments']);
|
2023-02-11 23:53:36 -06:00
|
|
|
Route::get('{transactionGroup}/piggy-bank-events', ['uses' => 'ListController@piggyBankEvents', 'as' => 'piggy-bank-events']);
|
2021-03-06 13:05:17 -06:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\Transaction',
|
|
|
|
'prefix' => 'v1/transaction-journals',
|
|
|
|
'as' => 'api.v1.transaction-journals.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 13:05:17 -06:00
|
|
|
Route::get('{tj}', ['uses' => 'ShowController@showJournal', 'as' => 'show']);
|
2021-03-06 13:52:42 -06:00
|
|
|
Route::delete('{tj}', ['uses' => 'DestroyController@destroyJournal', 'as' => 'delete']);
|
2021-03-06 11:00:49 -06:00
|
|
|
|
2023-02-11 23:53:36 -06:00
|
|
|
Route::get('{tj}/links', ['uses' => 'ListController@transactionLinks', 'as' => 'transaction-links']);
|
2021-03-06 13:05:17 -06:00
|
|
|
}
|
|
|
|
);
|
2021-03-06 05:45:49 -06:00
|
|
|
|
2021-03-06 14:39:29 -06:00
|
|
|
// Transaction currency API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\TransactionCurrency',
|
|
|
|
'prefix' => 'v1/currencies',
|
|
|
|
'as' => 'api.v1.currencies.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 14:39:29 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('default', ['uses' => 'ShowController@showDefault', 'as' => 'show.default']);
|
|
|
|
Route::get('{currency_code}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{currency_code}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{currency_code}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
|
|
|
|
Route::post('{currency_code}/enable', ['uses' => 'UpdateController@enable', 'as' => 'enable']);
|
|
|
|
Route::post('{currency_code}/disable', ['uses' => 'UpdateController@disable', 'as' => 'disable']);
|
|
|
|
Route::post('{currency_code}/default', ['uses' => 'UpdateController@makeDefault', 'as' => 'default']);
|
|
|
|
|
|
|
|
Route::get('{currency_code}/accounts', ['uses' => 'ListController@accounts', 'as' => 'accounts']);
|
2023-02-11 23:53:36 -06:00
|
|
|
Route::get('{currency_code}/available-budgets', ['uses' => 'ListController@availableBudgets', 'as' => 'available-budgets']);
|
2021-03-06 14:39:29 -06:00
|
|
|
Route::get('{currency_code}/bills', ['uses' => 'ListController@bills', 'as' => 'bills']);
|
2023-02-11 23:53:36 -06:00
|
|
|
Route::get('{currency_code}/budget-limits', ['uses' => 'ListController@budgetLimits', 'as' => 'budget-limits']);
|
2021-03-06 14:39:29 -06:00
|
|
|
Route::get('{currency_code}/cer', ['uses' => 'ListController@cer', 'as' => 'cer']);
|
|
|
|
Route::get('{currency_code}/recurrences', ['uses' => 'ListController@recurrences', 'as' => 'recurrences']);
|
|
|
|
Route::get('{currency_code}/rules', ['uses' => 'ListController@rules', 'as' => 'rules']);
|
|
|
|
Route::get('{currency_code}/transactions', ['uses' => 'ListController@transactions', 'as' => 'transactions']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-06 01:40:51 -06:00
|
|
|
|
2021-03-06 15:15:17 -06:00
|
|
|
// Transaction Links API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\TransactionLink',
|
2023-02-11 23:53:36 -06:00
|
|
|
'prefix' => 'v1/transaction-links',
|
|
|
|
'as' => 'api.v1.transaction-links.',
|
2023-01-17 13:09:57 -06:00
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 15:15:17 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{journalLink}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{journalLink}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{journalLink}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-06 01:40:51 -06:00
|
|
|
|
2021-03-06 15:22:51 -06:00
|
|
|
// Transaction Link Type API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\TransactionLinkType',
|
2023-02-11 23:53:36 -06:00
|
|
|
'prefix' => 'v1/link-types',
|
|
|
|
'as' => 'api.v1.link-types.',
|
2023-01-17 13:09:57 -06:00
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 15:22:51 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{linkType}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{linkType}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{linkType}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
|
|
|
Route::get('{linkType}/transactions', ['uses' => 'ListController@transactions', 'as' => 'transactions']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-06 00:20:49 -06:00
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// SEARCH ENDPOINTS
|
2021-03-06 23:30:59 -06:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Search',
|
|
|
|
'prefix' => 'v1/search',
|
|
|
|
'as' => 'api.v1.search.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 23:30:59 -06:00
|
|
|
Route::get('transactions', ['uses' => 'TransactionController@search', 'as' => 'transactions']);
|
|
|
|
Route::get('accounts', ['uses' => 'AccountController@search', 'as' => 'accounts']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// SYSTEM END POINTS
|
2021-03-06 23:30:59 -06:00
|
|
|
// About Firefly III API routes:
|
|
|
|
Route::group(
|
|
|
|
[
|
2023-01-17 13:09:57 -06:00
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\System',
|
|
|
|
'prefix' => 'v1/about',
|
|
|
|
'as' => 'api.v1.about.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-06 23:30:59 -06:00
|
|
|
Route::get('', ['uses' => 'AboutController@about', 'as' => 'index']);
|
|
|
|
Route::get('user', ['uses' => 'AboutController@user', 'as' => 'user']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-07 01:16:33 -06:00
|
|
|
// Configuration API routes
|
2021-03-07 00:43:18 -06:00
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\System',
|
|
|
|
'prefix' => 'v1/configuration',
|
|
|
|
'as' => 'api.v1.configuration.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-07 00:43:18 -06:00
|
|
|
Route::get('', ['uses' => 'ConfigurationController@index', 'as' => 'index']);
|
|
|
|
Route::get('{eitherConfigKey}', ['uses' => 'ConfigurationController@show', 'as' => 'show']);
|
|
|
|
Route::put('{dynamicConfigKey}', ['uses' => 'ConfigurationController@update', 'as' => 'update']);
|
|
|
|
}
|
|
|
|
);
|
2021-03-07 01:16:33 -06:00
|
|
|
// Users API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'middleware' => ['auth:api,sanctum', 'bindings'],
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\System',
|
|
|
|
'prefix' => 'v1/users',
|
|
|
|
'as' => 'api.v1.users.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-07 01:16:33 -06:00
|
|
|
Route::get('', ['uses' => 'UserController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'UserController@store', 'as' => 'store']);
|
|
|
|
Route::get('{user}', ['uses' => 'UserController@show', 'as' => 'show']);
|
|
|
|
Route::put('{user}', ['uses' => 'UserController@update', 'as' => 'update']);
|
|
|
|
Route::delete('{user}', ['uses' => 'UserController@destroy', 'as' => 'delete']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-12-20 12:45:12 -06:00
|
|
|
// USER
|
2021-03-07 05:13:22 -06:00
|
|
|
|
2021-03-07 02:46:12 -06:00
|
|
|
// Preference API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\User',
|
|
|
|
'prefix' => 'v1/preferences',
|
|
|
|
'as' => 'api.v1.preferences.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-07 02:46:12 -06:00
|
|
|
Route::get('', ['uses' => 'PreferencesController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'PreferencesController@store', 'as' => 'store']);
|
2024-04-25 23:18:27 -05:00
|
|
|
// Route::get('{preferenceList}', ['uses' => 'PreferencesController@showList', 'as' => 'show-list'])->where('preferenceList', ',+');
|
2021-03-07 02:46:12 -06:00
|
|
|
Route::get('{preference}', ['uses' => 'PreferencesController@show', 'as' => 'show']);
|
|
|
|
Route::put('{preference}', ['uses' => 'PreferencesController@update', 'as' => 'update']);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2021-03-07 05:13:22 -06:00
|
|
|
// Webhook API routes:
|
|
|
|
Route::group(
|
2023-01-17 13:09:57 -06:00
|
|
|
[
|
|
|
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Webhook',
|
|
|
|
'prefix' => 'v1/webhooks',
|
|
|
|
'as' => 'api.v1.webhooks.',
|
|
|
|
],
|
2023-12-20 22:06:17 -06:00
|
|
|
static function (): void {
|
2021-03-07 05:13:22 -06:00
|
|
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
|
|
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
|
|
|
Route::get('{webhook}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
|
|
|
Route::put('{webhook}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
|
|
|
Route::post('{webhook}/submit', ['uses' => 'SubmitController@submit', 'as' => 'submit']);
|
2023-01-05 12:05:23 -06:00
|
|
|
Route::post('{webhook}/trigger-transaction/{transactionGroup}', ['uses' => 'ShowController@triggerTransaction', 'as' => 'trigger-transaction']);
|
2021-03-07 05:13:22 -06:00
|
|
|
Route::delete('{webhook}', ['uses' => 'DestroyController@destroy', 'as' => 'destroy']);
|
|
|
|
|
|
|
|
// webhook messages
|
|
|
|
Route::get('{webhook}/messages', ['uses' => 'MessageController@index', 'as' => 'messages.index']);
|
|
|
|
Route::get('{webhook}/messages/{webhookMessage}', ['uses' => 'MessageController@show', 'as' => 'messages.show']);
|
|
|
|
Route::delete('{webhook}/messages/{webhookMessage}', ['uses' => 'DestroyController@destroyMessage', 'as' => 'messages.destroy']);
|
|
|
|
|
|
|
|
// webhook message attempts
|
|
|
|
Route::get('{webhook}/messages/{webhookMessage}/attempts', ['uses' => 'AttemptController@index', 'as' => 'attempts.index']);
|
|
|
|
Route::get('{webhook}/messages/{webhookMessage}/attempts/{webhookAttempt}', ['uses' => 'AttemptController@show', 'as' => 'attempts.show']);
|
2021-03-07 08:26:42 -06:00
|
|
|
Route::delete(
|
2022-12-29 12:43:43 -06:00
|
|
|
'{webhook}/messages/{webhookMessage}/attempts/{webhookAttempt}',
|
|
|
|
['uses' => 'DestroyController@destroyAttempt', 'as' => 'attempts.destroy']
|
2021-03-07 08:26:42 -06:00
|
|
|
);
|
2021-03-07 05:13:22 -06:00
|
|
|
}
|
|
|
|
);
|