github.com/shoshinnikita/budget-manager@v0.7.1-0.20220131195411-8c46ff1c6778/docs/swagger.yaml (about) 1 basePath: /api 2 definitions: 3 db.Day: 4 properties: 5 day: 6 type: integer 7 id: 8 type: integer 9 month: 10 type: integer 11 saldo: 12 description: Saldo is DailyBudget - Cost of all Spends. It can be negative 13 type: number 14 spends: 15 items: 16 $ref: '#/definitions/db.Spend' 17 type: array 18 year: 19 type: integer 20 type: object 21 db.Income: 22 properties: 23 id: 24 type: integer 25 income: 26 type: number 27 month: 28 type: integer 29 notes: 30 type: string 31 title: 32 type: string 33 year: 34 type: integer 35 type: object 36 db.Month: 37 properties: 38 daily_budget: 39 description: DailyBudget is a (TotalIncome - Cost of Monthly Payments) / Number of Days 40 type: number 41 days: 42 items: 43 $ref: '#/definitions/db.Day' 44 type: array 45 id: 46 type: integer 47 incomes: 48 items: 49 $ref: '#/definitions/db.Income' 50 type: array 51 month: 52 type: integer 53 monthly_payments: 54 items: 55 $ref: '#/definitions/db.MonthlyPayment' 56 type: array 57 result: 58 description: Result is TotalIncome - TotalSpend 59 type: number 60 total_income: 61 type: number 62 total_spend: 63 description: TotalSpend is a cost of all Monthly Payments and Spends 64 type: number 65 year: 66 type: integer 67 type: object 68 db.MonthlyPayment: 69 properties: 70 cost: 71 type: number 72 id: 73 type: integer 74 month: 75 type: integer 76 notes: 77 type: string 78 title: 79 type: string 80 type: 81 $ref: '#/definitions/db.SpendType' 82 year: 83 type: integer 84 type: object 85 db.Spend: 86 properties: 87 cost: 88 type: number 89 day: 90 type: integer 91 id: 92 type: integer 93 month: 94 type: integer 95 notes: 96 type: string 97 title: 98 type: string 99 type: 100 $ref: '#/definitions/db.SpendType' 101 year: 102 type: integer 103 type: object 104 db.SpendType: 105 properties: 106 id: 107 type: integer 108 name: 109 type: string 110 parent_id: 111 type: integer 112 type: object 113 models.AddIncomeReq: 114 properties: 115 income: 116 example: 10000 117 type: number 118 month_id: 119 example: 1 120 type: integer 121 notes: 122 type: string 123 title: 124 example: Salary 125 type: string 126 required: 127 - income 128 - month_id 129 - title 130 type: object 131 models.AddIncomeResp: 132 properties: 133 error: 134 description: Error is specified only when success if false 135 type: string 136 id: 137 type: integer 138 request_id: 139 type: string 140 success: 141 type: boolean 142 type: object 143 models.AddMonthlyPaymentReq: 144 properties: 145 cost: 146 example: 1500 147 type: number 148 month_id: 149 example: 1 150 type: integer 151 notes: 152 type: string 153 title: 154 example: Rent 155 type: string 156 type_id: 157 type: integer 158 required: 159 - cost 160 - month_id 161 - title 162 type: object 163 models.AddMonthlyPaymentResp: 164 properties: 165 error: 166 description: Error is specified only when success if false 167 type: string 168 id: 169 type: integer 170 request_id: 171 type: string 172 success: 173 type: boolean 174 type: object 175 models.AddSpendReq: 176 properties: 177 cost: 178 example: 30 179 type: number 180 day_id: 181 example: 1 182 type: integer 183 notes: 184 type: string 185 title: 186 example: Food 187 type: string 188 type_id: 189 type: integer 190 required: 191 - cost 192 - day_id 193 - title 194 type: object 195 models.AddSpendResp: 196 properties: 197 error: 198 description: Error is specified only when success if false 199 type: string 200 id: 201 type: integer 202 request_id: 203 type: string 204 success: 205 type: boolean 206 type: object 207 models.AddSpendTypeReq: 208 properties: 209 name: 210 example: Food 211 type: string 212 parent_id: 213 type: integer 214 required: 215 - name 216 type: object 217 models.AddSpendTypeResp: 218 properties: 219 error: 220 description: Error is specified only when success if false 221 type: string 222 id: 223 type: integer 224 request_id: 225 type: string 226 success: 227 type: boolean 228 type: object 229 models.EditIncomeReq: 230 properties: 231 id: 232 example: 1 233 type: integer 234 income: 235 type: number 236 notes: 237 type: string 238 title: 239 type: string 240 required: 241 - id 242 type: object 243 models.EditMonthlyPaymentReq: 244 properties: 245 cost: 246 type: number 247 id: 248 example: 1 249 type: integer 250 notes: 251 type: string 252 title: 253 type: string 254 type_id: 255 type: integer 256 required: 257 - id 258 type: object 259 models.EditSpendReq: 260 properties: 261 cost: 262 type: number 263 id: 264 example: 1 265 type: integer 266 notes: 267 type: string 268 title: 269 type: string 270 type_id: 271 type: integer 272 required: 273 - id 274 type: object 275 models.EditSpendTypeReq: 276 properties: 277 id: 278 example: 1 279 type: integer 280 name: 281 example: Vegetables 282 type: string 283 parent_id: 284 example: 1 285 type: integer 286 required: 287 - id 288 type: object 289 models.GetMonthResp: 290 properties: 291 error: 292 description: Error is specified only when success if false 293 type: string 294 month: 295 $ref: '#/definitions/db.Month' 296 request_id: 297 type: string 298 success: 299 type: boolean 300 type: object 301 models.GetSpendTypesResp: 302 properties: 303 error: 304 description: Error is specified only when success if false 305 type: string 306 request_id: 307 type: string 308 spend_types: 309 items: 310 $ref: '#/definitions/db.SpendType' 311 type: array 312 success: 313 type: boolean 314 type: object 315 models.RemoveIncomeReq: 316 properties: 317 id: 318 example: 1 319 type: integer 320 required: 321 - id 322 type: object 323 models.RemoveMonthlyPaymentReq: 324 properties: 325 id: 326 example: 1 327 type: integer 328 required: 329 - id 330 type: object 331 models.RemoveSpendReq: 332 properties: 333 id: 334 example: 1 335 type: integer 336 required: 337 - id 338 type: object 339 models.RemoveSpendTypeReq: 340 properties: 341 id: 342 example: 1 343 type: integer 344 required: 345 - id 346 type: object 347 models.Response: 348 type: object 349 models.SearchSpendsResp: 350 properties: 351 error: 352 description: Error is specified only when success if false 353 type: string 354 request_id: 355 type: string 356 spends: 357 items: 358 $ref: '#/definitions/db.Spend' 359 type: array 360 success: 361 type: boolean 362 type: object 363 info: 364 contact: {} 365 description: Easy-to-use, lightweight and self-hosted solution to track your finances - [GitHub](https://github.com/ShoshinNikita/budget-manager) 366 license: 367 name: MIT 368 url: https://github.com/ShoshinNikita/budget-manager/blob/master/LICENSE 369 title: Budget Manager API 370 version: v0.2 371 paths: 372 /api/incomes: 373 delete: 374 consumes: 375 - application/json 376 parameters: 377 - description: Income id 378 in: body 379 name: body 380 required: true 381 schema: 382 $ref: '#/definitions/models.RemoveIncomeReq' 383 produces: 384 - application/json 385 responses: 386 "200": 387 description: OK 388 schema: 389 $ref: '#/definitions/models.Response' 390 "400": 391 description: Invalid request 392 schema: 393 $ref: '#/definitions/models.Response' 394 "404": 395 description: Income doesn't exist 396 schema: 397 $ref: '#/definitions/models.Response' 398 "500": 399 description: Internal error 400 schema: 401 $ref: '#/definitions/models.Response' 402 summary: Remove Income 403 tags: 404 - Incomes 405 post: 406 consumes: 407 - application/json 408 parameters: 409 - description: New Income 410 in: body 411 name: body 412 required: true 413 schema: 414 $ref: '#/definitions/models.AddIncomeReq' 415 produces: 416 - application/json 417 responses: 418 "201": 419 description: Created 420 schema: 421 $ref: '#/definitions/models.AddIncomeResp' 422 "400": 423 description: Invalid request 424 schema: 425 $ref: '#/definitions/models.Response' 426 "404": 427 description: Month doesn't exist 428 schema: 429 $ref: '#/definitions/models.Response' 430 "500": 431 description: Internal error 432 schema: 433 $ref: '#/definitions/models.Response' 434 summary: Create Income 435 tags: 436 - Incomes 437 put: 438 consumes: 439 - application/json 440 parameters: 441 - description: Updated Income 442 in: body 443 name: body 444 required: true 445 schema: 446 $ref: '#/definitions/models.EditIncomeReq' 447 produces: 448 - application/json 449 responses: 450 "200": 451 description: OK 452 schema: 453 $ref: '#/definitions/models.Response' 454 "400": 455 description: Invalid request 456 schema: 457 $ref: '#/definitions/models.Response' 458 "404": 459 description: Income doesn't exist 460 schema: 461 $ref: '#/definitions/models.Response' 462 "500": 463 description: Internal error 464 schema: 465 $ref: '#/definitions/models.Response' 466 summary: Edit Income 467 tags: 468 - Incomes 469 /api/monthly-payments: 470 delete: 471 consumes: 472 - application/json 473 parameters: 474 - description: Monthly Payment id 475 in: body 476 name: body 477 required: true 478 schema: 479 $ref: '#/definitions/models.RemoveMonthlyPaymentReq' 480 produces: 481 - application/json 482 responses: 483 "200": 484 description: OK 485 schema: 486 $ref: '#/definitions/models.Response' 487 "400": 488 description: Invalid request 489 schema: 490 $ref: '#/definitions/models.Response' 491 "404": 492 description: Monthly Payment doesn't exist 493 schema: 494 $ref: '#/definitions/models.Response' 495 "500": 496 description: Internal error 497 schema: 498 $ref: '#/definitions/models.Response' 499 summary: Remove Monthly Payment 500 tags: 501 - Monthly Payments 502 post: 503 consumes: 504 - application/json 505 parameters: 506 - description: New Monthly Payment 507 in: body 508 name: body 509 required: true 510 schema: 511 $ref: '#/definitions/models.AddMonthlyPaymentReq' 512 produces: 513 - application/json 514 responses: 515 "201": 516 description: Created 517 schema: 518 $ref: '#/definitions/models.AddMonthlyPaymentResp' 519 "400": 520 description: Invalid request 521 schema: 522 $ref: '#/definitions/models.Response' 523 "404": 524 description: Month doesn't exist 525 schema: 526 $ref: '#/definitions/models.Response' 527 "500": 528 description: Internal error 529 schema: 530 $ref: '#/definitions/models.Response' 531 summary: Create Monthly Payment 532 tags: 533 - Monthly Payments 534 put: 535 consumes: 536 - application/json 537 parameters: 538 - description: Updated Monthly Payment 539 in: body 540 name: body 541 required: true 542 schema: 543 $ref: '#/definitions/models.EditMonthlyPaymentReq' 544 produces: 545 - application/json 546 responses: 547 "200": 548 description: OK 549 schema: 550 $ref: '#/definitions/models.Response' 551 "400": 552 description: Invalid request 553 schema: 554 $ref: '#/definitions/models.Response' 555 "404": 556 description: Monthly Payment doesn't exist 557 schema: 558 $ref: '#/definitions/models.Response' 559 "500": 560 description: Internal error 561 schema: 562 $ref: '#/definitions/models.Response' 563 summary: Edit Monthly Payment 564 tags: 565 - Monthly Payments 566 /api/months/date: 567 get: 568 parameters: 569 - example: 7 570 in: query 571 name: month 572 required: true 573 type: integer 574 - example: 2020 575 in: query 576 name: year 577 required: true 578 type: integer 579 produces: 580 - application/json 581 responses: 582 "200": 583 description: OK 584 schema: 585 $ref: '#/definitions/models.GetMonthResp' 586 "400": 587 description: Invalid request 588 schema: 589 $ref: '#/definitions/models.Response' 590 "404": 591 description: Month doesn't exist 592 schema: 593 $ref: '#/definitions/models.Response' 594 "500": 595 description: Internal error 596 schema: 597 $ref: '#/definitions/models.Response' 598 summary: Get Month by date 599 tags: 600 - Months 601 /api/search/spends: 602 get: 603 parameters: 604 - description: After must be in the RFC3339 format (https://tools.ietf.org/html/rfc3339#section-5.8) 605 format: date 606 in: query 607 name: after 608 type: string 609 - description: Before must be in the RFC3339 format (https://tools.ietf.org/html/rfc3339#section-5.8) 610 format: date 611 in: query 612 name: before 613 type: string 614 - in: query 615 name: max_cost 616 type: number 617 - in: query 618 name: min_cost 619 type: number 620 - description: Notes can be in any case. Search will be performed by lowercased value 621 in: query 622 name: notes 623 type: string 624 - default: false 625 description: NotesExactly defines should we search exactly for the given notes 626 in: query 627 name: notes_exactly 628 type: boolean 629 - default: asc 630 description: Order specify sort order 631 enum: 632 - asc 633 - desc 634 in: query 635 name: order 636 type: string 637 - default: date 638 description: Sort specify field to sort by 639 enum: 640 - title 641 - cost 642 - date 643 in: query 644 name: sort 645 type: string 646 - description: Title can be in any case. Search will be performed by lowercased value 647 in: query 648 name: title 649 type: string 650 - default: false 651 description: TitleExactly defines should we search exactly for the given title 652 in: query 653 name: title_exactly 654 type: boolean 655 - description: TypeIDs is a list of Spend Type ids to search for. Use id '0' to search for Spends without type 656 in: query 657 items: 658 type: integer 659 name: type_ids 660 type: array 661 produces: 662 - application/json 663 responses: 664 "200": 665 description: OK 666 schema: 667 $ref: '#/definitions/models.SearchSpendsResp' 668 "400": 669 description: Invalid request 670 schema: 671 $ref: '#/definitions/models.Response' 672 "500": 673 description: Internal error 674 schema: 675 $ref: '#/definitions/models.Response' 676 summary: Search Spends 677 tags: 678 - Search 679 /api/spend-types: 680 delete: 681 consumes: 682 - application/json 683 parameters: 684 - description: Spend Type id 685 in: body 686 name: body 687 required: true 688 schema: 689 $ref: '#/definitions/models.RemoveSpendTypeReq' 690 produces: 691 - application/json 692 responses: 693 "200": 694 description: OK 695 schema: 696 $ref: '#/definitions/models.Response' 697 "400": 698 description: Invalid request 699 schema: 700 $ref: '#/definitions/models.Response' 701 "404": 702 description: Spend Type doesn't exist 703 schema: 704 $ref: '#/definitions/models.Response' 705 "500": 706 description: Internal error 707 schema: 708 $ref: '#/definitions/models.Response' 709 summary: Remove Spend Type 710 tags: 711 - Spend Types 712 get: 713 produces: 714 - application/json 715 responses: 716 "200": 717 description: OK 718 schema: 719 $ref: '#/definitions/models.GetSpendTypesResp' 720 "500": 721 description: Internal error 722 schema: 723 $ref: '#/definitions/models.Response' 724 summary: Get All Spend Types 725 tags: 726 - Spend Types 727 post: 728 consumes: 729 - application/json 730 parameters: 731 - description: New Spend Type 732 in: body 733 name: body 734 required: true 735 schema: 736 $ref: '#/definitions/models.AddSpendTypeReq' 737 produces: 738 - application/json 739 responses: 740 "201": 741 description: Created 742 schema: 743 $ref: '#/definitions/models.AddSpendTypeResp' 744 "400": 745 description: Invalid request 746 schema: 747 $ref: '#/definitions/models.Response' 748 "500": 749 description: Internal error 750 schema: 751 $ref: '#/definitions/models.Response' 752 summary: Create Spend Type 753 tags: 754 - Spend Types 755 put: 756 consumes: 757 - application/json 758 parameters: 759 - description: Updated Spend Type 760 in: body 761 name: body 762 required: true 763 schema: 764 $ref: '#/definitions/models.EditSpendTypeReq' 765 produces: 766 - application/json 767 responses: 768 "200": 769 description: OK 770 schema: 771 $ref: '#/definitions/models.Response' 772 "400": 773 description: Invalid request 774 schema: 775 $ref: '#/definitions/models.Response' 776 "404": 777 description: Spend Type doesn't exist 778 schema: 779 $ref: '#/definitions/models.Response' 780 "500": 781 description: Internal error 782 schema: 783 $ref: '#/definitions/models.Response' 784 summary: Edit Spend Type 785 tags: 786 - Spend Types 787 /api/spends: 788 delete: 789 consumes: 790 - application/json 791 parameters: 792 - description: Updated Spend 793 in: body 794 name: body 795 required: true 796 schema: 797 $ref: '#/definitions/models.RemoveSpendReq' 798 produces: 799 - application/json 800 responses: 801 "200": 802 description: OK 803 schema: 804 $ref: '#/definitions/models.Response' 805 "400": 806 description: Invalid request 807 schema: 808 $ref: '#/definitions/models.Response' 809 "404": 810 description: Spend doesn't exist 811 schema: 812 $ref: '#/definitions/models.Response' 813 "500": 814 description: Internal error 815 schema: 816 $ref: '#/definitions/models.Response' 817 summary: Remove Spend 818 tags: 819 - Spends 820 post: 821 consumes: 822 - application/json 823 parameters: 824 - description: New Spend 825 in: body 826 name: body 827 required: true 828 schema: 829 $ref: '#/definitions/models.AddSpendReq' 830 produces: 831 - application/json 832 responses: 833 "201": 834 description: Created 835 schema: 836 $ref: '#/definitions/models.AddSpendResp' 837 "400": 838 description: Invalid request 839 schema: 840 $ref: '#/definitions/models.Response' 841 "404": 842 description: Day doesn't exist 843 schema: 844 $ref: '#/definitions/models.Response' 845 "500": 846 description: Internal error 847 schema: 848 $ref: '#/definitions/models.Response' 849 summary: Create Spend 850 tags: 851 - Spends 852 put: 853 consumes: 854 - application/json 855 parameters: 856 - description: Updated Spend 857 in: body 858 name: body 859 required: true 860 schema: 861 $ref: '#/definitions/models.EditSpendReq' 862 produces: 863 - application/json 864 responses: 865 "200": 866 description: OK 867 schema: 868 $ref: '#/definitions/models.Response' 869 "400": 870 description: Invalid request 871 schema: 872 $ref: '#/definitions/models.Response' 873 "404": 874 description: Spend doesn't exist 875 schema: 876 $ref: '#/definitions/models.Response' 877 "500": 878 description: Internal error 879 schema: 880 $ref: '#/definitions/models.Response' 881 summary: Edit Spend 882 tags: 883 - Spends 884 securityDefinitions: 885 BasicAuth: 886 type: basic 887 swagger: "2.0"