Skip to content

Commit

Permalink
Add and verify the balance chart.
Browse files Browse the repository at this point in the history
  • Loading branch information
JC5 committed Oct 20, 2024
1 parent 5380f9d commit 1f488c0
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 1 deletion.
4 changes: 3 additions & 1 deletion templates/start.yaml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ info:
This is the documentation of the Firefly III API. You can find accompanying documentation on the website of Firefly III itself (see below). Please report any bugs or issues. You may use the "Authorize" button to try the API below. This file was last generated on {{ time }}

Please keep in mind that the demo site does not accept requests from curl, colly, wget, etc. You must use a browser or a tool like Postman to make requests. Too many script kiddies out there, sorry about that.

{% if 'v2' == api_version %}The v2 version of the API is not yet complete. My apologies for any laps or inconsistencies. Please report any issues you find.{% endif %}

version: "{{ version }}"
contact:
name: James Cole
Expand Down Expand Up @@ -51,4 +54,3 @@ components:
security:
- firefly_iii_auth: []
- local_bearer_auth: []

47 changes: 47 additions & 0 deletions yaml/v2/paths/charts/balance/balance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/chart/balance/balance:
get:
tags:
- charts
summary: A chart that contains spent/earned amounts
description: |
The chart contains spent/earned amounts for the given date range, grouped by the given period, and collected for the given accounts.
operationId: getBalanceChart
parameters:
!correlationParameter,3
!mandatoryDateRangeParameters,3
- in: query
name: accounts[]
allowReserved: true
description: |
An array of accounts that should be included. Example: accounts[]=1&accounts[]=2.
required: true
style: form
explode: true
schema:
type: array
items:
type: integer
format: int32
- in: query
name: period
description: The period by which the results must be grouped.
required: true
schema:
$ref: '#/components/schemas/PeriodProperty'
- in: query
name: preselected
description: The accounts Firefly III must include in this chart. If you do not select any accounts in the accounts[] parameter, this parameter is used. This parameter overrules the accounts[] parameter.
required: false
schema:
$ref: '#/components/schemas/PreselectedAccountProperty'
responses:
!unauthenticatedResponse,3
!notFoundResponse,3
!badRequestResponse,3
!internalExceptionResponse,3
200:
description: Chart information. Check out the model for more details. Each main entry is a set of data.
content:
application/json:
schema:
$ref: '#/components/schemas/ChartLine'
8 changes: 8 additions & 0 deletions yaml/v2/properties/charts/ChartDataPoint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ChartDataPoint:
type: object
properties:
key:
type: string
format: string
example: "value"
description: "The key is the label of the value, so for example: '2018-01-01' => 13 or 'Groceries' => -123. For date-related charts, this is always a Atom date."
68 changes: 68 additions & 0 deletions yaml/v2/properties/charts/ChartDataSet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
ChartDataSet:
type: object
properties:
label:
type: string
format: string
example: "earned-EUR"
description: "This is the label of the current data-set. It can refer to an object by name, or a collected set of data."
currency_id:
type: string
format: string
example: "5"
description: "The currency ID of the currency associated to the data in the entries."
currency_code:
type: string
format: string
example: "EUR"
currency_symbol:
type: string
format: string
example: "$"
currency_decimal_places:
type: integer
format: int32
example: 2
description: "Number of decimals for the currency associated to the data in the entries."
native_currency_id:
type: string
format: string
example: "5"
description: "The currency ID of the user's native (default) currency."
native_currency_code:
type: string
format: string
example: "EUR"
description: "The currency code of the user's native (default) currency."
native_currency_symbol:
type: string
format: string
example: "$"
description: "The currency symbol of the user's native (default) currency."
native_currency_decimal_places:
type: integer
format: int32
example: 2
description: "Number of decimals for the native (default) currency of the user."
start:
type: string
format: date-time
example: "2018-09-17T12:46:47+01:00"
description: "Holds the date and time of start of the range of data collected. It could be there was no data for this point in time, but this is the start of the requested range."
end:
type: string
format: date-time
example: "2018-09-17T12:46:47+01:00"
description: "Holds the date and time of END of the range of data collected. It could be there was no data for this point in time, but this is the end of the requested range."
period:
$ref: '#/components/schemas/PeriodProperty'
entries:
type: object
description: "The actual entries for this data set. They 'key' value is the label for the data point. The value is the actual (numerical) value."
items:
$ref: '#/components/schemas/ChartDataPoint'
native_entries:
type: object
description: "The entries for this data set converted to the user's native (default) currency. They 'key' value is the label for the data point. The value is the actual (numerical) value."
items:
$ref: '#/components/schemas/ChartDataPoint'
4 changes: 4 additions & 0 deletions yaml/v2/properties/charts/ChartLine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ChartLine:
type: array
items:
$ref: '#/components/schemas/ChartDataSet'
13 changes: 13 additions & 0 deletions yaml/v2/properties/charts/PeriodProperty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PeriodProperty:
type: string
format: string
example: "1M"
description: "This field denotes the period in which the chart data is split up. If the period is not relevant, because the chart is not time-based, it will be NULL."
nullable: true
enum:
- 1D
- 1W
- 1M
- 3M
- 6M
- 1Y
6 changes: 6 additions & 0 deletions yaml/v2/properties/charts/PreselectedAccountProperty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PreselectedAccountProperty:
type: string
enum:
- all
- assets
- liabilities

0 comments on commit 1f488c0

Please sign in to comment.