organizze / api-doc

135 stars 16 forks source link

Saldo da conta #21

Closed andregumieri closed 6 years ago

andregumieri commented 6 years ago

Alguma forma de eu conseguir o saldo de uma conta sem ter que passar por todos os lançamentos?

esdras commented 6 years ago

Oi @andregumieri

Este endpoint já está disponível porém a gente acabou esquecendo de documentar ele, vou descrever abaixo como ele pode ser usado e eventualmente vou atualizar a documentação:

Request:

GET /balances

Possíveis parâmetros são:

Response:

{
  "previous_balance": 0,
    "previous_predicted_balance": 0,
    "balance": 0,
    "predicted_balance": 0,
    "outcomes": 0,
    "predicted_outcomes": 0,
    "incomes": 0,
    "predicted_incomes": 0,
    "expenses": 0,
    "predicted_expenses": 0,
    "earnings": 0,
    "predicted_earnings": 0,
    "initial_amounts": 0,
    "predicted_initial_amounts": 1,
    "result": 0,
    "predicted_result": 0,
    // Valores acima particionados em dias
    "balances": [
      {
        "date": "2018-09-01",
        "date_range": "2018-09-01-2018-09-01",
        "outcomes": 0,
        "predicted_outcomes": 0,
        "incomes": 0,
        "predicted_incomes": 0,
        "expenses": 0,
        "predicted_expenses": 0,
        "earnings": 0,
        "predicted_earnings": 0,
        "initial_amounts": 0,
        "predicted_initial_amounts": 0,
        "transferences": 0,
        "predicted_transferences": 0,
        "credit_card_invoices_to_pay": 0,
        "balance": 0,
        "predicted_balance": 0,
        "previous_balance": 0,
        "previous_predicted_balance": 0,
        "accumulated_outcomes": 0,
        "accumulated_predicted_outcomes": 0,
        "accumulated_incomes": 0,
        "accumulated_predicted_incomes": 0,
        "accumulated_expenses": 0,
        "accumulated_predicted_expenses": 0,
        "accumulated_earnings": 0,
        "accumulated_predicted_earnings": 0,
        "accumulated_initial_amounts": 0,
        "accumulated_predicted_initial_amounts": 1
      },
      {
        "date": "2018-09-02",
        "date_range": "2018-09-02-2018-09-02",
        "outcomes": 0,
        "predicted_outcomes": 0,
        "incomes": 0,
        "predicted_incomes": 0,
        "expenses": 0,
        "predicted_expenses": 0,
        "earnings": 0,
        "predicted_earnings": 0,
        "initial_amounts": 0,
        "predicted_initial_amounts": 0,
        "transferences": 0,
        "predicted_transferences": 0,
        "credit_card_invoices_to_pay": 0,
        "balance": 0,
        "predicted_balance": 0,
        "previous_balance": 0,
        "previous_predicted_balance": 0,
        "accumulated_outcomes": 0,
        "accumulated_predicted_outcomes": 0,
        "accumulated_incomes": 0,
        "accumulated_predicted_incomes": 0,
        "accumulated_expenses": 0,
        "accumulated_predicted_expenses": 0,
        "accumulated_earnings": 0,
        "accumulated_predicted_earnings": 0,
        "accumulated_initial_amounts": 0,
        "accumulated_predicted_initial_amounts": 1
      },
      //... até o último dia do período
    ]
}
andregumieri commented 6 years ago

Obrigado @esdras :)