2023-07-11 11:45:55 +02:00
|
|
|
/*
|
2023-07-24 18:58:35 +02:00
|
|
|
* list.js
|
|
|
|
* Copyright (c) 2022 james@firefly-iii.org
|
2023-07-11 11:45:55 +02:00
|
|
|
*
|
|
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2023-07-24 18:58:35 +02:00
|
|
|
import {api} from "../../../boot/axios";
|
2023-08-08 14:11:04 +02:00
|
|
|
import format from "date-fns/format";
|
2023-07-11 11:45:55 +02:00
|
|
|
|
2023-07-24 18:58:35 +02:00
|
|
|
export default class Get {
|
2023-07-11 11:45:55 +02:00
|
|
|
|
2023-07-24 18:58:35 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param identifier
|
|
|
|
* @param date
|
|
|
|
* @returns {Promise<AxiosResponse<any>>}
|
|
|
|
*/
|
|
|
|
get(identifier, date) {
|
2023-10-01 06:52:38 +02:00
|
|
|
let params = {date: format(date, 'y-MM-dd').slice(0, 10)};
|
2023-07-24 18:58:35 +02:00
|
|
|
if (!date) {
|
|
|
|
return api.get('/api/v1/accounts/' + identifier);
|
|
|
|
}
|
|
|
|
return api.get('/api/v1/accounts/' + identifier, {params: params});
|
2023-07-22 16:42:33 +02:00
|
|
|
}
|
|
|
|
|
2023-07-24 18:58:35 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param identifier
|
|
|
|
* @param page
|
|
|
|
* @returns {Promise<AxiosResponse<any>>}
|
|
|
|
*/
|
|
|
|
transactions(identifier, page) {
|
|
|
|
return api.get('/api/v1/accounts/' + identifier + '/transactions', {params: {page: page}});
|
2023-07-12 07:07:06 +02:00
|
|
|
}
|
2023-07-11 11:45:55 +02:00
|
|
|
}
|