commit 7a9f9e825950b8fccb93290b0fc9515153b2f8c7 Author: stuzer05 Date: Wed Apr 10 12:14:55 2024 +0300 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..33282e4 --- /dev/null +++ b/README.md @@ -0,0 +1,657 @@ +# Go API client for swagger + +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 2024-03-16T05:34:43+00:00 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. + +## Overview + +This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using +the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API +client. + +- API version: 2.0.12 +- Package version: 1.0.0 +- Build package: io.swagger.codegen.v3.generators.go.GoClientCodegen For more information, please + visit [https://firefly-iii.org](https://firefly-iii.org) + +## Installation + +Put the package under your project folder and add the following in import: + +```golang +import "./swagger" +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://demo.firefly-iii.org/api* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AboutApi* | [**GetAbout**](docs/AboutApi.md#getabout) | **Get** /v1/about | System information end point. +*AboutApi* | [**GetCron**](docs/AboutApi.md#getcron) | **Get** /v1/cron/{cliToken} | Cron job endpoint +*AboutApi* | [**GetCurrentUser**](docs/AboutApi.md#getcurrentuser) | ** +Get** /v1/about/user | Currently authenticated user endpoint. +*AccountsApi* | [**DeleteAccount**](docs/AccountsApi.md#deleteaccount) | ** +Delete** /v1/accounts/{id} | Permanently delete account. +*AccountsApi* | [**GetAccount**](docs/AccountsApi.md#getaccount) | **Get** /v1/accounts/{id} | Get single account. +*AccountsApi* | [**ListAccount**](docs/AccountsApi.md#listaccount) | **Get** /v1/accounts | List all accounts. +*AccountsApi* | [**ListAttachmentByAccount**](docs/AccountsApi.md#listattachmentbyaccount) | ** +Get** /v1/accounts/{id}/attachments | Lists all attachments. +*AccountsApi* | [**ListPiggyBankByAccount**](docs/AccountsApi.md#listpiggybankbyaccount) | ** +Get** /v1/accounts/{id}/piggy-banks | List all piggy banks related to the account. +*AccountsApi* | [**ListTransactionByAccount**](docs/AccountsApi.md#listtransactionbyaccount) | ** +Get** /v1/accounts/{id}/transactions | List all transactions related to the account. +*AccountsApi* | [**StoreAccount**](docs/AccountsApi.md#storeaccount) | **Post** /v1/accounts | Create new account. +*AccountsApi* | [**UpdateAccount**](docs/AccountsApi.md#updateaccount) | ** +Put** /v1/accounts/{id} | Update existing account. +*AttachmentsApi* | [**DeleteAttachment**](docs/AttachmentsApi.md#deleteattachment) | ** +Delete** /v1/attachments/{id} | Delete an attachment. +*AttachmentsApi* | [**DownloadAttachment**](docs/AttachmentsApi.md#downloadattachment) | ** +Get** /v1/attachments/{id}/download | Download a single attachment. +*AttachmentsApi* | [**GetAttachment**](docs/AttachmentsApi.md#getattachment) | ** +Get** /v1/attachments/{id} | Get a single attachment. +*AttachmentsApi* | [**ListAttachment**](docs/AttachmentsApi.md#listattachment) | ** +Get** /v1/attachments | List all attachments. +*AttachmentsApi* | [**StoreAttachment**](docs/AttachmentsApi.md#storeattachment) | ** +Post** /v1/attachments | Store a new attachment. +*AttachmentsApi* | [**UpdateAttachment**](docs/AttachmentsApi.md#updateattachment) | ** +Put** /v1/attachments/{id} | Update existing attachment. +*AttachmentsApi* | [**UploadAttachment**](docs/AttachmentsApi.md#uploadattachment) | ** +Post** /v1/attachments/{id}/upload | Upload an attachment. +*AutocompleteApi* | [**GetAccountsAC**](docs/AutocompleteApi.md#getaccountsac) | ** +Get** /v1/autocomplete/accounts | Returns all accounts of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetBillsAC**](docs/AutocompleteApi.md#getbillsac) | ** +Get** /v1/autocomplete/bills | Returns all bills of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetBudgetsAC**](docs/AutocompleteApi.md#getbudgetsac) | ** +Get** /v1/autocomplete/budgets | Returns all budgets of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetCategoriesAC**](docs/AutocompleteApi.md#getcategoriesac) | ** +Get** /v1/autocomplete/categories | Returns all categories of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetCurrenciesAC**](docs/AutocompleteApi.md#getcurrenciesac) | ** +Get** /v1/autocomplete/currencies | Returns all currencies of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetCurrenciesCodeAC**](docs/AutocompleteApi.md#getcurrenciescodeac) | ** +Get** /v1/autocomplete/currencies-with-code | Returns all currencies of the user returned in a basic auto-complete array. This endpoint is DEPRECATED and I suggest you DO NOT use it. +*AutocompleteApi* | [**GetObjectGroupsAC**](docs/AutocompleteApi.md#getobjectgroupsac) | ** +Get** /v1/autocomplete/object-groups | Returns all object groups of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetPiggiesAC**](docs/AutocompleteApi.md#getpiggiesac) | ** +Get** /v1/autocomplete/piggy-banks | Returns all piggy banks of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetPiggiesBalanceAC**](docs/AutocompleteApi.md#getpiggiesbalanceac) | ** +Get** /v1/autocomplete/piggy-banks-with-balance | Returns all piggy banks of the user returned in a basic auto-complete array complemented with balance information. +*AutocompleteApi* | [**GetRecurringAC**](docs/AutocompleteApi.md#getrecurringac) | ** +Get** /v1/autocomplete/recurring | Returns all recurring transactions of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetRuleGroupsAC**](docs/AutocompleteApi.md#getrulegroupsac) | ** +Get** /v1/autocomplete/rule-groups | Returns all rule groups of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetRulesAC**](docs/AutocompleteApi.md#getrulesac) | ** +Get** /v1/autocomplete/rules | Returns all rules of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetTagAC**](docs/AutocompleteApi.md#gettagac) | ** +Get** /v1/autocomplete/tags | Returns all tags of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetTransactionTypesAC**](docs/AutocompleteApi.md#gettransactiontypesac) | ** +Get** /v1/autocomplete/transaction-types | Returns all transaction types returned in a basic auto-complete array. English only. +*AutocompleteApi* | [**GetTransactionsAC**](docs/AutocompleteApi.md#gettransactionsac) | ** +Get** /v1/autocomplete/transactions | Returns all transaction descriptions of the user returned in a basic auto-complete array. +*AutocompleteApi* | [**GetTransactionsIDAC**](docs/AutocompleteApi.md#gettransactionsidac) | ** +Get** /v1/autocomplete/transactions-with-id | Returns all transactions, complemented with their ID, of the user returned in a basic auto-complete array. This endpoint is DEPRECATED and I suggest you DO NOT use it. +*AvailableBudgetsApi* | [**GetAvailableBudget**](docs/AvailableBudgetsApi.md#getavailablebudget) | ** +Get** /v1/available-budgets/{id} | Get a single available budget. +*AvailableBudgetsApi* | [**ListAvailableBudget**](docs/AvailableBudgetsApi.md#listavailablebudget) | ** +Get** /v1/available-budgets | List all available budget amounts. +*BillsApi* | [**DeleteBill**](docs/BillsApi.md#deletebill) | **Delete** /v1/bills/{id} | Delete a bill. +*BillsApi* | [**GetBill**](docs/BillsApi.md#getbill) | **Get** /v1/bills/{id} | Get a single bill. +*BillsApi* | [**ListAttachmentByBill**](docs/BillsApi.md#listattachmentbybill) | ** +Get** /v1/bills/{id}/attachments | List all attachments uploaded to the bill. +*BillsApi* | [**ListBill**](docs/BillsApi.md#listbill) | **Get** /v1/bills | List all bills. +*BillsApi* | [**ListRuleByBill**](docs/BillsApi.md#listrulebybill) | ** +Get** /v1/bills/{id}/rules | List all rules associated with the bill. +*BillsApi* | [**ListTransactionByBill**](docs/BillsApi.md#listtransactionbybill) | ** +Get** /v1/bills/{id}/transactions | List all transactions associated with the bill. +*BillsApi* | [**StoreBill**](docs/BillsApi.md#storebill) | **Post** /v1/bills | Store a new bill +*BillsApi* | [**UpdateBill**](docs/BillsApi.md#updatebill) | **Put** /v1/bills/{id} | Update existing bill. +*BudgetsApi* | [**DeleteBudget**](docs/BudgetsApi.md#deletebudget) | **Delete** /v1/budgets/{id} | Delete a budget. +*BudgetsApi* | [**DeleteBudgetLimit**](docs/BudgetsApi.md#deletebudgetlimit) | ** +Delete** /v1/budgets/{id}/limits/{limitId} | Delete a budget limit. +*BudgetsApi* | [**GetBudget**](docs/BudgetsApi.md#getbudget) | **Get** /v1/budgets/{id} | Get a single budget. +*BudgetsApi* | [**GetBudgetLimit**](docs/BudgetsApi.md#getbudgetlimit) | ** +Get** /v1/budgets/{id}/limits/{limitId} | Get single budget limit. +*BudgetsApi* | [**ListAttachmentByBudget**](docs/BudgetsApi.md#listattachmentbybudget) | ** +Get** /v1/budgets/{id}/attachments | Lists all attachments of a budget. +*BudgetsApi* | [**ListBudget**](docs/BudgetsApi.md#listbudget) | **Get** /v1/budgets | List all budgets. +*BudgetsApi* | [**ListBudgetLimit**](docs/BudgetsApi.md#listbudgetlimit) | ** +Get** /v1/budget-limits | Get list of budget limits by date +*BudgetsApi* | [**ListBudgetLimitByBudget**](docs/BudgetsApi.md#listbudgetlimitbybudget) | ** +Get** /v1/budgets/{id}/limits | Get all limits for a budget. +*BudgetsApi* | [**ListTransactionByBudget**](docs/BudgetsApi.md#listtransactionbybudget) | ** +Get** /v1/budgets/{id}/transactions | All transactions to a budget. +*BudgetsApi* | [**ListTransactionByBudgetLimit**](docs/BudgetsApi.md#listtransactionbybudgetlimit) | ** +Get** /v1/budgets/{id}/limits/{limitId}/transactions | List all transactions by a budget limit ID. +*BudgetsApi* | [**StoreBudget**](docs/BudgetsApi.md#storebudget) | **Post** /v1/budgets | Store a new budget +*BudgetsApi* | [**StoreBudgetLimit**](docs/BudgetsApi.md#storebudgetlimit) | ** +Post** /v1/budgets/{id}/limits | Store new budget limit. +*BudgetsApi* | [**UpdateBudget**](docs/BudgetsApi.md#updatebudget) | **Put** /v1/budgets/{id} | Update existing budget. +*BudgetsApi* | [**UpdateBudgetLimit**](docs/BudgetsApi.md#updatebudgetlimit) | ** +Put** /v1/budgets/{id}/limits/{limitId} | Update existing budget limit. +*CategoriesApi* | [**DeleteCategory**](docs/CategoriesApi.md#deletecategory) | ** +Delete** /v1/categories/{id} | Delete a category. +*CategoriesApi* | [**GetCategory**](docs/CategoriesApi.md#getcategory) | ** +Get** /v1/categories/{id} | Get a single category. +*CategoriesApi* | [**ListAttachmentByCategory**](docs/CategoriesApi.md#listattachmentbycategory) | ** +Get** /v1/categories/{id}/attachments | Lists all attachments. +*CategoriesApi* | [**ListCategory**](docs/CategoriesApi.md#listcategory) | **Get** /v1/categories | List all categories. +*CategoriesApi* | [**ListTransactionByCategory**](docs/CategoriesApi.md#listtransactionbycategory) | ** +Get** /v1/categories/{id}/transactions | List all transactions in a category. +*CategoriesApi* | [**StoreCategory**](docs/CategoriesApi.md#storecategory) | ** +Post** /v1/categories | Store a new category +*CategoriesApi* | [**UpdateCategory**](docs/CategoriesApi.md#updatecategory) | ** +Put** /v1/categories/{id} | Update existing category. +*ChartsApi* | [**GetChartAccountOverview**](docs/ChartsApi.md#getchartaccountoverview) | ** +Get** /v1/chart/account/overview | Dashboard chart with asset account balance information. +*ConfigurationApi* | [**GetConfiguration**](docs/ConfigurationApi.md#getconfiguration) | ** +Get** /v1/configuration | Get Firefly III system configuration values. +*ConfigurationApi* | [**GetSingleConfiguration**](docs/ConfigurationApi.md#getsingleconfiguration) | ** +Get** /v1/configuration/{name} | Get a single Firefly III system configuration value +*ConfigurationApi* | [**SetConfiguration**](docs/ConfigurationApi.md#setconfiguration) | ** +Put** /v1/configuration/{name} | Update configuration value +*CurrenciesApi* | [**DefaultCurrency**](docs/CurrenciesApi.md#defaultcurrency) | ** +Post** /v1/currencies/{code}/default | Make currency default currency. +*CurrenciesApi* | [**DeleteCurrency**](docs/CurrenciesApi.md#deletecurrency) | ** +Delete** /v1/currencies/{code} | Delete a currency. +*CurrenciesApi* | [**DisableCurrency**](docs/CurrenciesApi.md#disablecurrency) | ** +Post** /v1/currencies/{code}/disable | Disable a currency. +*CurrenciesApi* | [**EnableCurrency**](docs/CurrenciesApi.md#enablecurrency) | ** +Post** /v1/currencies/{code}/enable | Enable a single currency. +*CurrenciesApi* | [**GetCurrency**](docs/CurrenciesApi.md#getcurrency) | ** +Get** /v1/currencies/{code} | Get a single currency. +*CurrenciesApi* | [**GetDefaultCurrency**](docs/CurrenciesApi.md#getdefaultcurrency) | ** +Get** /v1/currencies/default | Get the user's default currency. +*CurrenciesApi* | [**ListAccountByCurrency**](docs/CurrenciesApi.md#listaccountbycurrency) | ** +Get** /v1/currencies/{code}/accounts | List all accounts with this currency. +*CurrenciesApi* | [**ListAvailableBudgetByCurrency**](docs/CurrenciesApi.md#listavailablebudgetbycurrency) | ** +Get** /v1/currencies/{code}/available-budgets | List all available budgets with this currency. +*CurrenciesApi* | [**ListBillByCurrency**](docs/CurrenciesApi.md#listbillbycurrency) | ** +Get** /v1/currencies/{code}/bills | List all bills with this currency. +*CurrenciesApi* | [**ListBudgetLimitByCurrency**](docs/CurrenciesApi.md#listbudgetlimitbycurrency) | ** +Get** /v1/currencies/{code}/budget_limits | List all budget limits with this currency +*CurrenciesApi* | [**ListCurrency**](docs/CurrenciesApi.md#listcurrency) | **Get** /v1/currencies | List all currencies. +*CurrenciesApi* | [**ListRecurrenceByCurrency**](docs/CurrenciesApi.md#listrecurrencebycurrency) | ** +Get** /v1/currencies/{code}/recurrences | List all recurring transactions with this currency. +*CurrenciesApi* | [**ListRuleByCurrency**](docs/CurrenciesApi.md#listrulebycurrency) | ** +Get** /v1/currencies/{code}/rules | List all rules with this currency. +*CurrenciesApi* | [**ListTransactionByCurrency**](docs/CurrenciesApi.md#listtransactionbycurrency) | ** +Get** /v1/currencies/{code}/transactions | List all transactions with this currency. +*CurrenciesApi* | [**StoreCurrency**](docs/CurrenciesApi.md#storecurrency) | ** +Post** /v1/currencies | Store a new currency +*CurrenciesApi* | [**UpdateCurrency**](docs/CurrenciesApi.md#updatecurrency) | ** +Put** /v1/currencies/{code} | Update existing currency. +*DataApi* | [**BulkUpdateTransactions**](docs/DataApi.md#bulkupdatetransactions) | ** +Post** /v1/data/bulk/transactions | Bulk update transaction properties. For more information, see https://docs.firefly-iii.org/references/firefly-iii/api/specials/ +*DataApi* | [**DestroyData**](docs/DataApi.md#destroydata) | **Delete** /v1/data/destroy | Endpoint to destroy user data +*DataApi* | [**ExportAccounts**](docs/DataApi.md#exportaccounts) | ** +Get** /v1/data/export/accounts | Export account data from Firefly III +*DataApi* | [**ExportBills**](docs/DataApi.md#exportbills) | ** +Get** /v1/data/export/bills | Export bills from Firefly III +*DataApi* | [**ExportBudgets**](docs/DataApi.md#exportbudgets) | ** +Get** /v1/data/export/budgets | Export budgets and budget amount data from Firefly III +*DataApi* | [**ExportCategories**](docs/DataApi.md#exportcategories) | ** +Get** /v1/data/export/categories | Export category data from Firefly III +*DataApi* | [**ExportPiggies**](docs/DataApi.md#exportpiggies) | ** +Get** /v1/data/export/piggy-banks | Export piggy banks from Firefly III +*DataApi* | [**ExportRecurring**](docs/DataApi.md#exportrecurring) | ** +Get** /v1/data/export/recurring | Export recurring transaction data from Firefly III +*DataApi* | [**ExportRules**](docs/DataApi.md#exportrules) | ** +Get** /v1/data/export/rules | Export rule groups and rule data from Firefly III +*DataApi* | [**ExportTags**](docs/DataApi.md#exporttags) | ** +Get** /v1/data/export/tags | Export tag data from Firefly III +*DataApi* | [**ExportTransactions**](docs/DataApi.md#exporttransactions) | ** +Get** /v1/data/export/transactions | Export transaction data from Firefly III +*DataApi* | [**PurgeData**](docs/DataApi.md#purgedata) | **Delete** /v1/data/purge | Endpoint to purge user data +*InsightApi* | [**InsightExpenseAsset**](docs/InsightApi.md#insightexpenseasset) | ** +Get** /v1/insight/expense/asset | Insight into expenses, grouped by asset account. +*InsightApi* | [**InsightExpenseBill**](docs/InsightApi.md#insightexpensebill) | ** +Get** /v1/insight/expense/bill | Insight into expenses, grouped by bill. +*InsightApi* | [**InsightExpenseBudget**](docs/InsightApi.md#insightexpensebudget) | ** +Get** /v1/insight/expense/budget | Insight into expenses, grouped by budget. +*InsightApi* | [**InsightExpenseCategory**](docs/InsightApi.md#insightexpensecategory) | ** +Get** /v1/insight/expense/category | Insight into expenses, grouped by category. +*InsightApi* | [**InsightExpenseExpense**](docs/InsightApi.md#insightexpenseexpense) | ** +Get** /v1/insight/expense/expense | Insight into expenses, grouped by expense account. +*InsightApi* | [**InsightExpenseNoBill**](docs/InsightApi.md#insightexpensenobill) | ** +Get** /v1/insight/expense/no-bill | Insight into expenses, without bill. +*InsightApi* | [**InsightExpenseNoBudget**](docs/InsightApi.md#insightexpensenobudget) | ** +Get** /v1/insight/expense/no-budget | Insight into expenses, without budget. +*InsightApi* | [**InsightExpenseNoCategory**](docs/InsightApi.md#insightexpensenocategory) | ** +Get** /v1/insight/expense/no-category | Insight into expenses, without category. +*InsightApi* | [**InsightExpenseNoTag**](docs/InsightApi.md#insightexpensenotag) | ** +Get** /v1/insight/expense/no-tag | Insight into expenses, without tag. +*InsightApi* | [**InsightExpenseTag**](docs/InsightApi.md#insightexpensetag) | ** +Get** /v1/insight/expense/tag | Insight into expenses, grouped by tag. +*InsightApi* | [**InsightExpenseTotal**](docs/InsightApi.md#insightexpensetotal) | ** +Get** /v1/insight/expense/total | Insight into total expenses. +*InsightApi* | [**InsightIncomeAsset**](docs/InsightApi.md#insightincomeasset) | ** +Get** /v1/insight/income/asset | Insight into income, grouped by asset account. +*InsightApi* | [**InsightIncomeCategory**](docs/InsightApi.md#insightincomecategory) | ** +Get** /v1/insight/income/category | Insight into income, grouped by category. +*InsightApi* | [**InsightIncomeNoCategory**](docs/InsightApi.md#insightincomenocategory) | ** +Get** /v1/insight/income/no-category | Insight into income, without category. +*InsightApi* | [**InsightIncomeNoTag**](docs/InsightApi.md#insightincomenotag) | ** +Get** /v1/insight/income/no-tag | Insight into income, without tag. +*InsightApi* | [**InsightIncomeRevenue**](docs/InsightApi.md#insightincomerevenue) | ** +Get** /v1/insight/income/revenue | Insight into income, grouped by revenue account. +*InsightApi* | [**InsightIncomeTag**](docs/InsightApi.md#insightincometag) | ** +Get** /v1/insight/income/tag | Insight into income, grouped by tag. +*InsightApi* | [**InsightIncomeTotal**](docs/InsightApi.md#insightincometotal) | ** +Get** /v1/insight/income/total | Insight into total income. +*InsightApi* | [**InsightTransferCategory**](docs/InsightApi.md#insighttransfercategory) | ** +Get** /v1/insight/transfer/category | Insight into transfers, grouped by category. +*InsightApi* | [**InsightTransferNoCategory**](docs/InsightApi.md#insighttransfernocategory) | ** +Get** /v1/insight/transfer/no-category | Insight into transfers, without category. +*InsightApi* | [**InsightTransferNoTag**](docs/InsightApi.md#insighttransfernotag) | ** +Get** /v1/insight/transfer/no-tag | Insight into expenses, without tag. +*InsightApi* | [**InsightTransferTag**](docs/InsightApi.md#insighttransfertag) | ** +Get** /v1/insight/transfer/tag | Insight into transfers, grouped by tag. +*InsightApi* | [**InsightTransferTotal**](docs/InsightApi.md#insighttransfertotal) | ** +Get** /v1/insight/transfer/total | Insight into total transfers. +*InsightApi* | [**InsightTransfers**](docs/InsightApi.md#insighttransfers) | ** +Get** /v1/insight/transfer/asset | Insight into transfers, grouped by account. +*LinksApi* | [**DeleteLinkType**](docs/LinksApi.md#deletelinktype) | ** +Delete** /v1/link-types/{id} | Permanently delete link type. +*LinksApi* | [**DeleteTransactionLink**](docs/LinksApi.md#deletetransactionlink) | ** +Delete** /v1/transaction-links/{id} | Permanently delete link between transactions. +*LinksApi* | [**GetLinkType**](docs/LinksApi.md#getlinktype) | **Get** /v1/link-types/{id} | Get single a link type. +*LinksApi* | [**GetTransactionLink**](docs/LinksApi.md#gettransactionlink) | ** +Get** /v1/transaction-links/{id} | Get a single link. +*LinksApi* | [**ListLinkType**](docs/LinksApi.md#listlinktype) | **Get** /v1/link-types | List all types of links. +*LinksApi* | [**ListTransactionByLinkType**](docs/LinksApi.md#listtransactionbylinktype) | ** +Get** /v1/link-types/{id}/transactions | List all transactions under this link type. +*LinksApi* | [**ListTransactionLink**](docs/LinksApi.md#listtransactionlink) | ** +Get** /v1/transaction-links | List all transaction links. +*LinksApi* | [**StoreLinkType**](docs/LinksApi.md#storelinktype) | **Post** /v1/link-types | Create a new link type +*LinksApi* | [**StoreTransactionLink**](docs/LinksApi.md#storetransactionlink) | ** +Post** /v1/transaction-links | Create a new link between transactions +*LinksApi* | [**UpdateLinkType**](docs/LinksApi.md#updatelinktype) | ** +Put** /v1/link-types/{id} | Update existing link type. +*LinksApi* | [**UpdateTransactionLink**](docs/LinksApi.md#updatetransactionlink) | ** +Put** /v1/transaction-links/{id} | Update an existing link between transactions. +*ObjectGroupsApi* | [**DeleteObjectGroup**](docs/ObjectGroupsApi.md#deleteobjectgroup) | ** +Delete** /v1/object-groups/{id} | Delete a object group. +*ObjectGroupsApi* | [**GetObjectGroup**](docs/ObjectGroupsApi.md#getobjectgroup) | ** +Get** /v1/object-groups/{id} | Get a single object group. +*ObjectGroupsApi* | [**ListBillByObjectGroup**](docs/ObjectGroupsApi.md#listbillbyobjectgroup) | ** +Get** /v1/object-groups/{id}/bills | List all bills with this object group. +*ObjectGroupsApi* | [**ListObjectGroups**](docs/ObjectGroupsApi.md#listobjectgroups) | ** +Get** /v1/object-groups | List all oject groups. +*ObjectGroupsApi* | [**ListPiggyBankByObjectGroup**](docs/ObjectGroupsApi.md#listpiggybankbyobjectgroup) | ** +Get** /v1/object-groups/{id}/piggy-banks | List all piggy banks related to the object group. +*ObjectGroupsApi* | [**UpdateObjectGroup**](docs/ObjectGroupsApi.md#updateobjectgroup) | ** +Put** /v1/object-groups/{id} | Update existing object group. +*PiggyBanksApi* | [**DeletePiggyBank**](docs/PiggyBanksApi.md#deletepiggybank) | ** +Delete** /v1/piggy-banks/{id} | Delete a piggy bank. +*PiggyBanksApi* | [**GetPiggyBank**](docs/PiggyBanksApi.md#getpiggybank) | ** +Get** /v1/piggy-banks/{id} | Get a single piggy bank. +*PiggyBanksApi* | [**ListAttachmentByPiggyBank**](docs/PiggyBanksApi.md#listattachmentbypiggybank) | ** +Get** /v1/piggy-banks/{id}/attachments | Lists all attachments. +*PiggyBanksApi* | [**ListEventByPiggyBank**](docs/PiggyBanksApi.md#listeventbypiggybank) | ** +Get** /v1/piggy-banks/{id}/events | List all events linked to a piggy bank. +*PiggyBanksApi* | [**ListPiggyBank**](docs/PiggyBanksApi.md#listpiggybank) | ** +Get** /v1/piggy-banks | List all piggy banks. +*PiggyBanksApi* | [**StorePiggyBank**](docs/PiggyBanksApi.md#storepiggybank) | ** +Post** /v1/piggy-banks | Store a new piggy bank +*PiggyBanksApi* | [**UpdatePiggyBank**](docs/PiggyBanksApi.md#updatepiggybank) | ** +Put** /v1/piggy-banks/{id} | Update existing piggy bank. +*PreferencesApi* | [**GetPreference**](docs/PreferencesApi.md#getpreference) | ** +Get** /v1/preferences/{name} | Return a single preference. +*PreferencesApi* | [**ListPreference**](docs/PreferencesApi.md#listpreference) | ** +Get** /v1/preferences | List all users preferences. +*PreferencesApi* | [**StorePreference**](docs/PreferencesApi.md#storepreference) | ** +Post** /v1/preferences | Store a new preference for this user. +*PreferencesApi* | [**UpdatePreference**](docs/PreferencesApi.md#updatepreference) | ** +Put** /v1/preferences/{name} | Update preference +*RecurrencesApi* | [**DeleteRecurrence**](docs/RecurrencesApi.md#deleterecurrence) | ** +Delete** /v1/recurrences/{id} | Delete a recurring transaction. +*RecurrencesApi* | [**GetRecurrence**](docs/RecurrencesApi.md#getrecurrence) | ** +Get** /v1/recurrences/{id} | Get a single recurring transaction. +*RecurrencesApi* | [**ListRecurrence**](docs/RecurrencesApi.md#listrecurrence) | ** +Get** /v1/recurrences | List all recurring transactions. +*RecurrencesApi* | [**ListTransactionByRecurrence**](docs/RecurrencesApi.md#listtransactionbyrecurrence) | ** +Get** /v1/recurrences/{id}/transactions | List all transactions created by a recurring transaction. +*RecurrencesApi* | [**StoreRecurrence**](docs/RecurrencesApi.md#storerecurrence) | ** +Post** /v1/recurrences | Store a new recurring transaction +*RecurrencesApi* | [**UpdateRecurrence**](docs/RecurrencesApi.md#updaterecurrence) | ** +Put** /v1/recurrences/{id} | Update existing recurring transaction. +*RuleGroupsApi* | [**DeleteRuleGroup**](docs/RuleGroupsApi.md#deleterulegroup) | ** +Delete** /v1/rule-groups/{id} | Delete a rule group. +*RuleGroupsApi* | [**FireRuleGroup**](docs/RuleGroupsApi.md#firerulegroup) | ** +Post** /v1/rule-groups/{id}/trigger | Fire the rule group on your transactions. +*RuleGroupsApi* | [**GetRuleGroup**](docs/RuleGroupsApi.md#getrulegroup) | ** +Get** /v1/rule-groups/{id} | Get a single rule group. +*RuleGroupsApi* | [**ListRuleByGroup**](docs/RuleGroupsApi.md#listrulebygroup) | ** +Get** /v1/rule-groups/{id}/rules | List rules in this rule group. +*RuleGroupsApi* | [**ListRuleGroup**](docs/RuleGroupsApi.md#listrulegroup) | ** +Get** /v1/rule-groups | List all rule groups. +*RuleGroupsApi* | [**StoreRuleGroup**](docs/RuleGroupsApi.md#storerulegroup) | ** +Post** /v1/rule-groups | Store a new rule group. +*RuleGroupsApi* | [**TestRuleGroup**](docs/RuleGroupsApi.md#testrulegroup) | ** +Get** /v1/rule-groups/{id}/test | Test which transactions would be hit by the rule group. No changes will be made. +*RuleGroupsApi* | [**UpdateRuleGroup**](docs/RuleGroupsApi.md#updaterulegroup) | ** +Put** /v1/rule-groups/{id} | Update existing rule group. +*RulesApi* | [**DeleteRule**](docs/RulesApi.md#deleterule) | **Delete** /v1/rules/{id} | Delete an rule. +*RulesApi* | [**FireRule**](docs/RulesApi.md#firerule) | ** +Post** /v1/rules/{id}/trigger | Fire the rule on your transactions. +*RulesApi* | [**GetRule**](docs/RulesApi.md#getrule) | **Get** /v1/rules/{id} | Get a single rule. +*RulesApi* | [**ListRule**](docs/RulesApi.md#listrule) | **Get** /v1/rules | List all rules. +*RulesApi* | [**StoreRule**](docs/RulesApi.md#storerule) | **Post** /v1/rules | Store a new rule +*RulesApi* | [**TestRule**](docs/RulesApi.md#testrule) | ** +Get** /v1/rules/{id}/test | Test which transactions would be hit by the rule. No changes will be made. +*RulesApi* | [**UpdateRule**](docs/RulesApi.md#updaterule) | **Put** /v1/rules/{id} | Update existing rule. +*SearchApi* | [**SearchAccounts**](docs/SearchApi.md#searchaccounts) | **Get** /v1/search/accounts | Search for accounts +*SearchApi* | [**SearchTransactions**](docs/SearchApi.md#searchtransactions) | ** +Get** /v1/search/transactions | Search for transactions +*SummaryApi* | [**GetBasicSummary**](docs/SummaryApi.md#getbasicsummary) | ** +Get** /v1/summary/basic | Returns basic sums of the users data. +*TagsApi* | [**DeleteTag**](docs/TagsApi.md#deletetag) | **Delete** /v1/tags/{tag} | Delete an tag. +*TagsApi* | [**GetTag**](docs/TagsApi.md#gettag) | **Get** /v1/tags/{tag} | Get a single tag. +*TagsApi* | [**ListAttachmentByTag**](docs/TagsApi.md#listattachmentbytag) | ** +Get** /v1/tags/{tag}/attachments | Lists all attachments. +*TagsApi* | [**ListTag**](docs/TagsApi.md#listtag) | **Get** /v1/tags | List all tags. +*TagsApi* | [**ListTransactionByTag**](docs/TagsApi.md#listtransactionbytag) | ** +Get** /v1/tags/{tag}/transactions | List all transactions with this tag. +*TagsApi* | [**StoreTag**](docs/TagsApi.md#storetag) | **Post** /v1/tags | Store a new tag +*TagsApi* | [**UpdateTag**](docs/TagsApi.md#updatetag) | **Put** /v1/tags/{tag} | Update existing tag. +*TransactionsApi* | [**DeleteTransaction**](docs/TransactionsApi.md#deletetransaction) | ** +Delete** /v1/transactions/{id} | Delete a transaction. +*TransactionsApi* | [**DeleteTransactionJournal**](docs/TransactionsApi.md#deletetransactionjournal) | ** +Delete** /v1/transaction-journals/{id} | Delete split from transaction +*TransactionsApi* | [**GetTransaction**](docs/TransactionsApi.md#gettransaction) | ** +Get** /v1/transactions/{id} | Get a single transaction. +*TransactionsApi* | [**GetTransactionByJournal**](docs/TransactionsApi.md#gettransactionbyjournal) | ** +Get** /v1/transaction-journals/{id} | Get a single transaction, based on one of the underlying transaction journals (transaction splits). +*TransactionsApi* | [**ListAttachmentByTransaction**](docs/TransactionsApi.md#listattachmentbytransaction) | ** +Get** /v1/transactions/{id}/attachments | Lists all attachments. +*TransactionsApi* | [**ListEventByTransaction**](docs/TransactionsApi.md#listeventbytransaction) | ** +Get** /v1/transactions/{id}/piggy-bank-events | Lists all piggy bank events. +*TransactionsApi* | [**ListLinksByJournal**](docs/TransactionsApi.md#listlinksbyjournal) | ** +Get** /v1/transaction-journals/{id}/links | Lists all the transaction links for an individual journal (individual split). +*TransactionsApi* | [**ListTransaction**](docs/TransactionsApi.md#listtransaction) | ** +Get** /v1/transactions | List all the user's transactions. +*TransactionsApi* | [**StoreTransaction**](docs/TransactionsApi.md#storetransaction) | ** +Post** /v1/transactions | Store a new transaction +*TransactionsApi* | [**UpdateTransaction**](docs/TransactionsApi.md#updatetransaction) | ** +Put** /v1/transactions/{id} | Update existing transaction. For more information, see https://docs.firefly-iii.org/references/firefly-iii/api/specials/ +*UsersApi* | [**DeleteUser**](docs/UsersApi.md#deleteuser) | **Delete** /v1/users/{id} | Delete a user. +*UsersApi* | [**GetUser**](docs/UsersApi.md#getuser) | **Get** /v1/users/{id} | Get a single user. +*UsersApi* | [**ListUser**](docs/UsersApi.md#listuser) | **Get** /v1/users | List all users. +*UsersApi* | [**StoreUser**](docs/UsersApi.md#storeuser) | **Post** /v1/users | Store a new user +*UsersApi* | [**UpdateUser**](docs/UsersApi.md#updateuser) | ** +Put** /v1/users/{id} | Update an existing user's information. +*WebhooksApi* | [**DeleteWebhook**](docs/WebhooksApi.md#deletewebhook) | ** +Delete** /v1/webhooks/{id} | Delete a webhook. +*WebhooksApi* | [**DeleteWebhookMessage**](docs/WebhooksApi.md#deletewebhookmessage) | ** +Delete** /v1/webhooks/{id}/messages/{messageId} | Delete a webhook message. +*WebhooksApi* | [**DeleteWebhookMessageAttempt**](docs/WebhooksApi.md#deletewebhookmessageattempt) | ** +Delete** /v1/webhooks/{id}/messages/{messageId}/attempts/{attemptId} | Delete a webhook attempt. +*WebhooksApi* | [**GetSingleWebhookMessage**](docs/WebhooksApi.md#getsinglewebhookmessage) | ** +Get** /v1/webhooks/{id}/messages/{messageId} | Get a single message from a webhook. +*WebhooksApi* | [**GetSingleWebhookMessageAttempt**](docs/WebhooksApi.md#getsinglewebhookmessageattempt) | ** +Get** /v1/webhooks/{id}/messages/{messageId}/attempts/{attemptId} | Get a single failed attempt from a single webhook message. +*WebhooksApi* | [**GetWebhook**](docs/WebhooksApi.md#getwebhook) | **Get** /v1/webhooks/{id} | Get a single webhook. +*WebhooksApi* | [**GetWebhookMessageAttempts**](docs/WebhooksApi.md#getwebhookmessageattempts) | ** +Get** /v1/webhooks/{id}/messages/{messageId}/attempts | Get all the failed attempts of a single webhook message. +*WebhooksApi* | [**GetWebhookMessages**](docs/WebhooksApi.md#getwebhookmessages) | ** +Get** /v1/webhooks/{id}/messages | Get all the messages of a single webhook. +*WebhooksApi* | [**ListWebhook**](docs/WebhooksApi.md#listwebhook) | **Get** /v1/webhooks | List all webhooks. +*WebhooksApi* | [**StoreWebhook**](docs/WebhooksApi.md#storewebhook) | **Post** /v1/webhooks | Store a new webhook +*WebhooksApi* | [**SubmitWebook**](docs/WebhooksApi.md#submitwebook) | ** +Post** /v1/webhooks/{id}/submit | Submit messages for a webhook. +*WebhooksApi* | [**TriggerTransactionWebhook**](docs/WebhooksApi.md#triggertransactionwebhook) | ** +Post** /v1/webhooks/{id}/trigger-transaction/{transactionId} | Trigger webhook for a given transaction. +*WebhooksApi* | [**UpdateWebhook**](docs/WebhooksApi.md#updatewebhook) | ** +Put** /v1/webhooks/{id} | Update existing webhook. + +## Documentation For Models + +- [Account](docs/Account.md) +- [AccountArray](docs/AccountArray.md) +- [AccountRead](docs/AccountRead.md) +- [AccountRoleProperty](docs/AccountRoleProperty.md) +- [AccountSearchFieldFilter](docs/AccountSearchFieldFilter.md) +- [AccountSingle](docs/AccountSingle.md) +- [AccountStore](docs/AccountStore.md) +- [AccountTypeFilter](docs/AccountTypeFilter.md) +- [AccountTypeProperty](docs/AccountTypeProperty.md) +- [AccountUpdate](docs/AccountUpdate.md) +- [AttachableType](docs/AttachableType.md) +- [Attachment](docs/Attachment.md) +- [AttachmentArray](docs/AttachmentArray.md) +- [AttachmentRead](docs/AttachmentRead.md) +- [AttachmentSingle](docs/AttachmentSingle.md) +- [AttachmentStore](docs/AttachmentStore.md) +- [AttachmentUpdate](docs/AttachmentUpdate.md) +- [AutoBudgetPeriod](docs/AutoBudgetPeriod.md) +- [AutoBudgetType](docs/AutoBudgetType.md) +- [AutocompleteAccount](docs/AutocompleteAccount.md) +- [AutocompleteBill](docs/AutocompleteBill.md) +- [AutocompleteBudget](docs/AutocompleteBudget.md) +- [AutocompleteCategory](docs/AutocompleteCategory.md) +- [AutocompleteCurrency](docs/AutocompleteCurrency.md) +- [AutocompleteCurrencyCode](docs/AutocompleteCurrencyCode.md) +- [AutocompleteObjectGroup](docs/AutocompleteObjectGroup.md) +- [AutocompletePiggy](docs/AutocompletePiggy.md) +- [AutocompletePiggyBalance](docs/AutocompletePiggyBalance.md) +- [AutocompleteRecurrence](docs/AutocompleteRecurrence.md) +- [AutocompleteRule](docs/AutocompleteRule.md) +- [AutocompleteRuleGroup](docs/AutocompleteRuleGroup.md) +- [AutocompleteTag](docs/AutocompleteTag.md) +- [AutocompleteTransaction](docs/AutocompleteTransaction.md) +- [AutocompleteTransactionId](docs/AutocompleteTransactionId.md) +- [AutocompleteTransactionType](docs/AutocompleteTransactionType.md) +- [AvailableBudget](docs/AvailableBudget.md) +- [AvailableBudgetArray](docs/AvailableBudgetArray.md) +- [AvailableBudgetRead](docs/AvailableBudgetRead.md) +- [AvailableBudgetSingle](docs/AvailableBudgetSingle.md) +- [BadRequestResponse](docs/BadRequestResponse.md) +- [BasicSummaryEntry](docs/BasicSummaryEntry.md) +- [Bill](docs/Bill.md) +- [BillArray](docs/BillArray.md) +- [BillPaidDates](docs/BillPaidDates.md) +- [BillRead](docs/BillRead.md) +- [BillRepeatFrequency](docs/BillRepeatFrequency.md) +- [BillSingle](docs/BillSingle.md) +- [BillStore](docs/BillStore.md) +- [BillUpdate](docs/BillUpdate.md) +- [Budget](docs/Budget.md) +- [BudgetArray](docs/BudgetArray.md) +- [BudgetLimit](docs/BudgetLimit.md) +- [BudgetLimitArray](docs/BudgetLimitArray.md) +- [BudgetLimitRead](docs/BudgetLimitRead.md) +- [BudgetLimitSingle](docs/BudgetLimitSingle.md) +- [BudgetLimitStore](docs/BudgetLimitStore.md) +- [BudgetRead](docs/BudgetRead.md) +- [BudgetSingle](docs/BudgetSingle.md) +- [BudgetSpent](docs/BudgetSpent.md) +- [BudgetStore](docs/BudgetStore.md) +- [BudgetUpdate](docs/BudgetUpdate.md) +- [Category](docs/Category.md) +- [CategoryArray](docs/CategoryArray.md) +- [CategoryEarned](docs/CategoryEarned.md) +- [CategoryRead](docs/CategoryRead.md) +- [CategorySingle](docs/CategorySingle.md) +- [CategorySpent](docs/CategorySpent.md) +- [CategoryUpdate](docs/CategoryUpdate.md) +- [ChartDataPoint](docs/ChartDataPoint.md) +- [ChartDataSet](docs/ChartDataSet.md) +- [ConfigValueFilter](docs/ConfigValueFilter.md) +- [ConfigValueUpdateFilter](docs/ConfigValueUpdateFilter.md) +- [Configuration](docs/Configuration.md) +- [ConfigurationSingle](docs/ConfigurationSingle.md) +- [ConfigurationUpdate](docs/ConfigurationUpdate.md) +- [CreditCardTypeProperty](docs/CreditCardTypeProperty.md) +- [CronResult](docs/CronResult.md) +- [CronResultRow](docs/CronResultRow.md) +- [Currency](docs/Currency.md) +- [CurrencyArray](docs/CurrencyArray.md) +- [CurrencyRead](docs/CurrencyRead.md) +- [CurrencySingle](docs/CurrencySingle.md) +- [CurrencyStore](docs/CurrencyStore.md) +- [CurrencyUpdate](docs/CurrencyUpdate.md) +- [DataDestroyObject](docs/DataDestroyObject.md) +- [ExportFileFilter](docs/ExportFileFilter.md) +- [InsightGroupEntry](docs/InsightGroupEntry.md) +- [InsightTotalEntry](docs/InsightTotalEntry.md) +- [InsightTransferEntry](docs/InsightTransferEntry.md) +- [InterestPeriodProperty](docs/InterestPeriodProperty.md) +- [InternalExceptionResponse](docs/InternalExceptionResponse.md) +- [LiabilityDirectionProperty](docs/LiabilityDirectionProperty.md) +- [LiabilityTypeProperty](docs/LiabilityTypeProperty.md) +- [LinkType](docs/LinkType.md) +- [LinkTypeArray](docs/LinkTypeArray.md) +- [LinkTypeRead](docs/LinkTypeRead.md) +- [LinkTypeSingle](docs/LinkTypeSingle.md) +- [LinkTypeUpdate](docs/LinkTypeUpdate.md) +- [Meta](docs/Meta.md) +- [MetaPagination](docs/MetaPagination.md) +- [NotFoundResponse](docs/NotFoundResponse.md) +- [ObjectGroup](docs/ObjectGroup.md) +- [ObjectGroupArray](docs/ObjectGroupArray.md) +- [ObjectGroupRead](docs/ObjectGroupRead.md) +- [ObjectGroupSingle](docs/ObjectGroupSingle.md) +- [ObjectGroupUpdate](docs/ObjectGroupUpdate.md) +- [ObjectLink](docs/ObjectLink.md) +- [ObjectLink0](docs/ObjectLink0.md) +- [PageLink](docs/PageLink.md) +- [PiggyBank](docs/PiggyBank.md) +- [PiggyBankArray](docs/PiggyBankArray.md) +- [PiggyBankEvent](docs/PiggyBankEvent.md) +- [PiggyBankEventArray](docs/PiggyBankEventArray.md) +- [PiggyBankEventRead](docs/PiggyBankEventRead.md) +- [PiggyBankRead](docs/PiggyBankRead.md) +- [PiggyBankSingle](docs/PiggyBankSingle.md) +- [PiggyBankStore](docs/PiggyBankStore.md) +- [PiggyBankUpdate](docs/PiggyBankUpdate.md) +- [PolymorphicProperty](docs/PolymorphicProperty.md) +- [Preference](docs/Preference.md) +- [PreferenceArray](docs/PreferenceArray.md) +- [PreferenceRead](docs/PreferenceRead.md) +- [PreferenceSingle](docs/PreferenceSingle.md) +- [PreferenceUpdate](docs/PreferenceUpdate.md) +- [Recurrence](docs/Recurrence.md) +- [RecurrenceArray](docs/RecurrenceArray.md) +- [RecurrenceRead](docs/RecurrenceRead.md) +- [RecurrenceRepetition](docs/RecurrenceRepetition.md) +- [RecurrenceRepetitionStore](docs/RecurrenceRepetitionStore.md) +- [RecurrenceRepetitionType](docs/RecurrenceRepetitionType.md) +- [RecurrenceRepetitionUpdate](docs/RecurrenceRepetitionUpdate.md) +- [RecurrenceSingle](docs/RecurrenceSingle.md) +- [RecurrenceStore](docs/RecurrenceStore.md) +- [RecurrenceTransaction](docs/RecurrenceTransaction.md) +- [RecurrenceTransactionStore](docs/RecurrenceTransactionStore.md) +- [RecurrenceTransactionType](docs/RecurrenceTransactionType.md) +- [RecurrenceTransactionUpdate](docs/RecurrenceTransactionUpdate.md) +- [RecurrenceUpdate](docs/RecurrenceUpdate.md) +- [Rule](docs/Rule.md) +- [RuleAction](docs/RuleAction.md) +- [RuleActionKeyword](docs/RuleActionKeyword.md) +- [RuleActionStore](docs/RuleActionStore.md) +- [RuleActionUpdate](docs/RuleActionUpdate.md) +- [RuleArray](docs/RuleArray.md) +- [RuleGroup](docs/RuleGroup.md) +- [RuleGroupArray](docs/RuleGroupArray.md) +- [RuleGroupRead](docs/RuleGroupRead.md) +- [RuleGroupSingle](docs/RuleGroupSingle.md) +- [RuleGroupStore](docs/RuleGroupStore.md) +- [RuleGroupUpdate](docs/RuleGroupUpdate.md) +- [RuleRead](docs/RuleRead.md) +- [RuleSingle](docs/RuleSingle.md) +- [RuleStore](docs/RuleStore.md) +- [RuleTrigger](docs/RuleTrigger.md) +- [RuleTriggerKeyword](docs/RuleTriggerKeyword.md) +- [RuleTriggerStore](docs/RuleTriggerStore.md) +- [RuleTriggerType](docs/RuleTriggerType.md) +- [RuleTriggerUpdate](docs/RuleTriggerUpdate.md) +- [RuleUpdate](docs/RuleUpdate.md) +- [ShortAccountTypeProperty](docs/ShortAccountTypeProperty.md) +- [SystemInfo](docs/SystemInfo.md) +- [SystemInfoData](docs/SystemInfoData.md) +- [TagArray](docs/TagArray.md) +- [TagModel](docs/TagModel.md) +- [TagModelStore](docs/TagModelStore.md) +- [TagModelUpdate](docs/TagModelUpdate.md) +- [TagRead](docs/TagRead.md) +- [TagSingle](docs/TagSingle.md) +- [Transaction](docs/Transaction.md) +- [TransactionArray](docs/TransactionArray.md) +- [TransactionLink](docs/TransactionLink.md) +- [TransactionLinkArray](docs/TransactionLinkArray.md) +- [TransactionLinkRead](docs/TransactionLinkRead.md) +- [TransactionLinkSingle](docs/TransactionLinkSingle.md) +- [TransactionLinkStore](docs/TransactionLinkStore.md) +- [TransactionLinkUpdate](docs/TransactionLinkUpdate.md) +- [TransactionRead](docs/TransactionRead.md) +- [TransactionSingle](docs/TransactionSingle.md) +- [TransactionSplit](docs/TransactionSplit.md) +- [TransactionSplitStore](docs/TransactionSplitStore.md) +- [TransactionSplitUpdate](docs/TransactionSplitUpdate.md) +- [TransactionStore](docs/TransactionStore.md) +- [TransactionTypeFilter](docs/TransactionTypeFilter.md) +- [TransactionTypeProperty](docs/TransactionTypeProperty.md) +- [TransactionUpdate](docs/TransactionUpdate.md) +- [UnauthenticatedResponse](docs/UnauthenticatedResponse.md) +- [User](docs/User.md) +- [UserArray](docs/UserArray.md) +- [UserBlockedCodeProperty](docs/UserBlockedCodeProperty.md) +- [UserRead](docs/UserRead.md) +- [UserRoleProperty](docs/UserRoleProperty.md) +- [UserSingle](docs/UserSingle.md) +- [ValidationErrorResponse](docs/ValidationErrorResponse.md) +- [ValidationErrorResponseErrors](docs/ValidationErrorResponseErrors.md) +- [Webhook](docs/Webhook.md) +- [WebhookArray](docs/WebhookArray.md) +- [WebhookAttempt](docs/WebhookAttempt.md) +- [WebhookAttemptArray](docs/WebhookAttemptArray.md) +- [WebhookAttemptRead](docs/WebhookAttemptRead.md) +- [WebhookAttemptSingle](docs/WebhookAttemptSingle.md) +- [WebhookDelivery](docs/WebhookDelivery.md) +- [WebhookMessage](docs/WebhookMessage.md) +- [WebhookMessageArray](docs/WebhookMessageArray.md) +- [WebhookMessageRead](docs/WebhookMessageRead.md) +- [WebhookMessageSingle](docs/WebhookMessageSingle.md) +- [WebhookRead](docs/WebhookRead.md) +- [WebhookResponse](docs/WebhookResponse.md) +- [WebhookSingle](docs/WebhookSingle.md) +- [WebhookStore](docs/WebhookStore.md) +- [WebhookTrigger](docs/WebhookTrigger.md) +- [WebhookUpdate](docs/WebhookUpdate.md) + +## Documentation For Authorization + +## firefly_iii_auth + +- **Type**: OAuth +- **Flow**: accessCode +- **Authorization URL**: https://demo.firefly-iii.org/oauth/authorize +- **Scopes**: + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") +r, err := client.Service.Operation(auth, args) +``` + +Or via OAuth2 module to automatically refresh tokens and perform user authentication. + +```golang +import "golang.org/x/oauth2" + +/* Perform OAuth2 round trip request and obtain a token */ + +tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) +auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) +r, err := client.Service.Operation(auth, args) +``` + +## local_bearer_auth + +## Author + +james@firefly-iii.org diff --git a/api_about.go b/api_about.go new file mode 100644 index 0000000..505435e --- /dev/null +++ b/api_about.go @@ -0,0 +1,441 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type AboutApiService service + +/* +AboutApiService System information end point. +Returns general system information and versions of the (supporting) software. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AboutApiGetAboutOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return SystemInfo +*/ + +type AboutApiGetAboutOpts struct { + XTraceId optional.Interface +} + +func (a *AboutApiService) GetAbout(ctx context.Context, localVarOptionals *AboutApiGetAboutOpts) (SystemInfo, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue SystemInfo + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/about" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v SystemInfo + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AboutApiService Cron job endpoint +Firefly III has one endpoint for its various cron related tasks. Send a GET to this endpoint to run the cron. The cron requires the CLI token to be present. The cron job will fire for all users. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param cliToken The CLI token of any user in Firefly III, required to run the cron job. + * @param optional nil or *AboutApiGetCronOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Date" (optional.String) - A date formatted YYYY-MM-DD. This can be used to make the cron job pretend it's running on another day. + * @param "Force" (optional.Bool) - Forces the cron job to fire, regardless of whether it has fired before. This may result in double transactions or weird budgets, so be careful. +@return CronResult +*/ + +type AboutApiGetCronOpts struct { + XTraceId optional.Interface + Date optional.String + Force optional.Bool +} + +func (a *AboutApiService) GetCron(ctx context.Context, cliToken string, localVarOptionals *AboutApiGetCronOpts) (CronResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CronResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/cron/{cliToken}" + localVarPath = strings.Replace(localVarPath, "{"+"cliToken"+"}", fmt.Sprintf("%v", cliToken), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Date.IsSet() { + localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Force.IsSet() { + localVarQueryParams.Add("force", parameterToString(localVarOptionals.Force.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v CronResult + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AboutApiService Currently authenticated user endpoint. +Returns the currently authenticated user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AboutApiGetCurrentUserOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return UserSingle +*/ + +type AboutApiGetCurrentUserOpts struct { + XTraceId optional.Interface +} + +func (a *AboutApiService) GetCurrentUser(ctx context.Context, localVarOptionals *AboutApiGetCurrentUserOpts) (UserSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue UserSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/about/user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v UserSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_accounts.go b/api_accounts.go new file mode 100644 index 0000000..337ad00 --- /dev/null +++ b/api_accounts.go @@ -0,0 +1,1188 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type AccountsApiService service + +/* +AccountsApiService Permanently delete account. +Will permanently delete an account. Any associated transactions and piggy banks are ALSO deleted. Cannot be recovered from. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the account. + * @param optional nil or *AccountsApiDeleteAccountOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type AccountsApiDeleteAccountOpts struct { + XTraceId optional.Interface +} + +func (a *AccountsApiService) DeleteAccount(ctx context.Context, id string, localVarOptionals *AccountsApiDeleteAccountOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/accounts/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +AccountsApiService Get single account. +Returns a single account by its ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the account. + * @param optional nil or *AccountsApiGetAccountOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Date" (optional.String) - A date formatted YYYY-MM-DD. When added to the request, Firefly III will show the account's balance on that day. +@return AccountSingle +*/ + +type AccountsApiGetAccountOpts struct { + XTraceId optional.Interface + Date optional.String +} + +func (a *AccountsApiService) GetAccount(ctx context.Context, id string, localVarOptionals *AccountsApiGetAccountOpts) (AccountSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccountSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/accounts/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Date.IsSet() { + localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AccountSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AccountsApiService List all accounts. +This endpoint returns a list of all the accounts owned by the authenticated user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AccountsApiListAccountOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Date" (optional.String) - A date formatted YYYY-MM-DD. When added to the request, Firefly III will show the account's balance on that day. + * @param "Type_" (optional.Interface of AccountTypeFilter) - Optional filter on the account type(s) returned +@return AccountArray +*/ + +type AccountsApiListAccountOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Date optional.String + Type_ optional.Interface +} + +func (a *AccountsApiService) ListAccount(ctx context.Context, localVarOptionals *AccountsApiListAccountOpts) (AccountArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccountArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/accounts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Date.IsSet() { + localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AccountArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AccountsApiService Lists all attachments. +Lists all attachments. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the account. + * @param optional nil or *AccountsApiListAttachmentByAccountOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return AttachmentArray +*/ + +type AccountsApiListAttachmentByAccountOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *AccountsApiService) ListAttachmentByAccount(ctx context.Context, id string, localVarOptionals *AccountsApiListAttachmentByAccountOpts) (AttachmentArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachmentArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/accounts/{id}/attachments" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AttachmentArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AccountsApiService List all piggy banks related to the account. +This endpoint returns a list of all the piggy banks connected to the account. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the account. + * @param optional nil or *AccountsApiListPiggyBankByAccountOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return PiggyBankArray +*/ + +type AccountsApiListPiggyBankByAccountOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *AccountsApiService) ListPiggyBankByAccount(ctx context.Context, id string, localVarOptionals *AccountsApiListPiggyBankByAccountOpts) (PiggyBankArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PiggyBankArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/accounts/{id}/piggy-banks" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v PiggyBankArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AccountsApiService List all transactions related to the account. +This endpoint returns a list of all the transactions connected to the account. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the account. + * @param optional nil or *AccountsApiListTransactionByAccountOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD. + * @param "Type_" (optional.Interface of TransactionTypeFilter) - Optional filter on the transaction type(s) returned. +@return TransactionArray +*/ + +type AccountsApiListTransactionByAccountOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String + Type_ optional.Interface +} + +func (a *AccountsApiService) ListTransactionByAccount(ctx context.Context, id string, localVarOptionals *AccountsApiListTransactionByAccountOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/accounts/{id}/transactions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AccountsApiService Create new account. +Creates a new account. The data required can be submitted as a JSON body or as a list of parameters (in key=value pairs, like a webform). + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with the necessary account information or key=value pairs. See the model for the exact specifications. + * @param optional nil or *AccountsApiStoreAccountOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return AccountSingle +*/ + +type AccountsApiStoreAccountOpts struct { + XTraceId optional.Interface +} + +func (a *AccountsApiService) StoreAccount(ctx context.Context, body AccountStore, localVarOptionals *AccountsApiStoreAccountOpts) (AccountSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccountSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/accounts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AccountSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AccountsApiService Update existing account. +Used to update a single account. All fields that are not submitted will be cleared (set to NULL). The model will tell you which fields are mandatory. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or formdata with updated account information. See the model for the exact specifications. + * @param id The ID of the account. + * @param optional nil or *AccountsApiUpdateAccountOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return AccountSingle +*/ + +type AccountsApiUpdateAccountOpts struct { + XTraceId optional.Interface +} + +func (a *AccountsApiService) UpdateAccount(ctx context.Context, body AccountUpdate, id string, localVarOptionals *AccountsApiUpdateAccountOpts) (AccountSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccountSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/accounts/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AccountSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_attachments.go b/api_attachments.go new file mode 100644 index 0000000..2179b7b --- /dev/null +++ b/api_attachments.go @@ -0,0 +1,992 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "os" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type AttachmentsApiService service + +/* +AttachmentsApiService Delete an attachment. +With this endpoint you delete an attachment, including any stored file data. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the single attachment. + * @param optional nil or *AttachmentsApiDeleteAttachmentOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type AttachmentsApiDeleteAttachmentOpts struct { + XTraceId optional.Interface +} + +func (a *AttachmentsApiService) DeleteAttachment(ctx context.Context, id string, localVarOptionals *AttachmentsApiDeleteAttachmentOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/attachments/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +AttachmentsApiService Download a single attachment. +This endpoint allows you to download the binary content of a transaction. It will be sent to you as a download, using the content type \"application/octet-stream\" and content disposition \"attachment; filename=example.pdf\". + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the attachment. + * @param optional nil or *AttachmentsApiDownloadAttachmentOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return *os.File +*/ + +type AttachmentsApiDownloadAttachmentOpts struct { + XTraceId optional.Interface +} + +func (a *AttachmentsApiService) DownloadAttachment(ctx context.Context, id string, localVarOptionals *AttachmentsApiDownloadAttachmentOpts) (*os.File, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *os.File + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/attachments/{id}/download" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/octet-stream", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v *os.File + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AttachmentsApiService Get a single attachment. +Get a single attachment. This endpoint only returns the available metadata for the attachment. Actual file data is handled in two other endpoints (see below). + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the attachment. + * @param optional nil or *AttachmentsApiGetAttachmentOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return AttachmentSingle +*/ + +type AttachmentsApiGetAttachmentOpts struct { + XTraceId optional.Interface +} + +func (a *AttachmentsApiService) GetAttachment(ctx context.Context, id string, localVarOptionals *AttachmentsApiGetAttachmentOpts) (AttachmentSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachmentSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/attachments/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AttachmentSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AttachmentsApiService List all attachments. +This endpoint lists all attachments. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AttachmentsApiListAttachmentOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return AttachmentArray +*/ + +type AttachmentsApiListAttachmentOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *AttachmentsApiService) ListAttachment(ctx context.Context, localVarOptionals *AttachmentsApiListAttachmentOpts) (AttachmentArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachmentArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/attachments" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AttachmentArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AttachmentsApiService Store a new attachment. +Creates a new attachment. The data required can be submitted as a JSON body or as a list of parameters. You cannot use this endpoint to upload the actual file data (see below). This endpoint only creates the attachment object. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary attachment information. See the model for the exact specifications. + * @param optional nil or *AttachmentsApiStoreAttachmentOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return AttachmentSingle +*/ + +type AttachmentsApiStoreAttachmentOpts struct { + XTraceId optional.Interface +} + +func (a *AttachmentsApiService) StoreAttachment(ctx context.Context, body AttachmentStore, localVarOptionals *AttachmentsApiStoreAttachmentOpts) (AttachmentSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachmentSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/attachments" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AttachmentSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AttachmentsApiService Update existing attachment. +Update the meta data for an existing attachment. This endpoint does not allow you to upload or download data. For that, see below. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated attachment information. See the model for the exact specifications. + * @param id The ID of the attachment. + * @param optional nil or *AttachmentsApiUpdateAttachmentOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return AttachmentSingle +*/ + +type AttachmentsApiUpdateAttachmentOpts struct { + XTraceId optional.Interface +} + +func (a *AttachmentsApiService) UpdateAttachment(ctx context.Context, body AttachmentUpdate, id string, localVarOptionals *AttachmentsApiUpdateAttachmentOpts) (AttachmentSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachmentSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/attachments/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AttachmentSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AttachmentsApiService Upload an attachment. +Use this endpoint to upload (and possible overwrite) the file contents of an attachment. Simply put the entire file in the body as binary data. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the attachment. + * @param optional nil or *AttachmentsApiUploadAttachmentOpts - Optional Parameters: + * @param "Body" (optional.Interface of Object) - + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type AttachmentsApiUploadAttachmentOpts struct { + Body optional.Interface + XTraceId optional.Interface +} + +func (a *AttachmentsApiService) UploadAttachment(ctx context.Context, id string, localVarOptionals *AttachmentsApiUploadAttachmentOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/attachments/{id}/upload" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/octet-stream"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody := localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} diff --git a/api_autocomplete.go b/api_autocomplete.go new file mode 100644 index 0000000..707ace6 --- /dev/null +++ b/api_autocomplete.go @@ -0,0 +1,2324 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type AutocompleteApiService service + +/* +AutocompleteApiService Returns all accounts of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetAccountsACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. + * @param "Date" (optional.String) - If the account is an asset account or a liability, the autocomplete will also return the balance of the account on this date. + * @param "Types" (optional.Interface of []AccountTypeFilter) - Optional filter on the account type(s) used in the autocomplete. +@return []AutocompleteAccount +*/ + +type AutocompleteApiGetAccountsACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 + Date optional.String + Types optional.Interface +} + +func (a *AutocompleteApiService) GetAccountsAC(ctx context.Context, localVarOptionals *AutocompleteApiGetAccountsACOpts) ([]AutocompleteAccount, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteAccount + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/accounts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Date.IsSet() { + localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Types.IsSet() { + localVarQueryParams.Add("types", parameterToString(localVarOptionals.Types.Value(), "csv")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteAccount + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all bills of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetBillsACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteBill +*/ + +type AutocompleteApiGetBillsACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetBillsAC(ctx context.Context, localVarOptionals *AutocompleteApiGetBillsACOpts) ([]AutocompleteBill, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteBill + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/bills" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteBill + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all budgets of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetBudgetsACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteBudget +*/ + +type AutocompleteApiGetBudgetsACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetBudgetsAC(ctx context.Context, localVarOptionals *AutocompleteApiGetBudgetsACOpts) ([]AutocompleteBudget, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteBudget + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/budgets" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteBudget + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all categories of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetCategoriesACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteCategory +*/ + +type AutocompleteApiGetCategoriesACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetCategoriesAC(ctx context.Context, localVarOptionals *AutocompleteApiGetCategoriesACOpts) ([]AutocompleteCategory, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteCategory + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/categories" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteCategory + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all currencies of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetCurrenciesACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteCurrency +*/ + +type AutocompleteApiGetCurrenciesACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetCurrenciesAC(ctx context.Context, localVarOptionals *AutocompleteApiGetCurrenciesACOpts) ([]AutocompleteCurrency, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteCurrency + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/currencies" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteCurrency + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all currencies of the user returned in a basic auto-complete array. This endpoint is DEPRECATED and I suggest you DO NOT use it. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetCurrenciesCodeACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteCurrencyCode +*/ + +type AutocompleteApiGetCurrenciesCodeACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetCurrenciesCodeAC(ctx context.Context, localVarOptionals *AutocompleteApiGetCurrenciesCodeACOpts) ([]AutocompleteCurrencyCode, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteCurrencyCode + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/currencies-with-code" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteCurrencyCode + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all object groups of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetObjectGroupsACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteObjectGroup +*/ + +type AutocompleteApiGetObjectGroupsACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetObjectGroupsAC(ctx context.Context, localVarOptionals *AutocompleteApiGetObjectGroupsACOpts) ([]AutocompleteObjectGroup, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteObjectGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/object-groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteObjectGroup + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all piggy banks of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetPiggiesACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompletePiggy +*/ + +type AutocompleteApiGetPiggiesACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetPiggiesAC(ctx context.Context, localVarOptionals *AutocompleteApiGetPiggiesACOpts) ([]AutocompletePiggy, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompletePiggy + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/piggy-banks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompletePiggy + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all piggy banks of the user returned in a basic auto-complete array complemented with balance information. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetPiggiesBalanceACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompletePiggyBalance +*/ + +type AutocompleteApiGetPiggiesBalanceACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetPiggiesBalanceAC(ctx context.Context, localVarOptionals *AutocompleteApiGetPiggiesBalanceACOpts) ([]AutocompletePiggyBalance, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompletePiggyBalance + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/piggy-banks-with-balance" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompletePiggyBalance + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all recurring transactions of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetRecurringACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteRecurrence +*/ + +type AutocompleteApiGetRecurringACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetRecurringAC(ctx context.Context, localVarOptionals *AutocompleteApiGetRecurringACOpts) ([]AutocompleteRecurrence, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteRecurrence + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/recurring" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteRecurrence + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all rule groups of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetRuleGroupsACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteRuleGroup +*/ + +type AutocompleteApiGetRuleGroupsACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetRuleGroupsAC(ctx context.Context, localVarOptionals *AutocompleteApiGetRuleGroupsACOpts) ([]AutocompleteRuleGroup, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteRuleGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/rule-groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteRuleGroup + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all rules of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetRulesACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteRule +*/ + +type AutocompleteApiGetRulesACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetRulesAC(ctx context.Context, localVarOptionals *AutocompleteApiGetRulesACOpts) ([]AutocompleteRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all tags of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetTagACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteTag +*/ + +type AutocompleteApiGetTagACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetTagAC(ctx context.Context, localVarOptionals *AutocompleteApiGetTagACOpts) ([]AutocompleteTag, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteTag + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/tags" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteTag + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all transaction types returned in a basic auto-complete array. English only. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetTransactionTypesACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteTransactionType +*/ + +type AutocompleteApiGetTransactionTypesACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetTransactionTypesAC(ctx context.Context, localVarOptionals *AutocompleteApiGetTransactionTypesACOpts) ([]AutocompleteTransactionType, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteTransactionType + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/transaction-types" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteTransactionType + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all transaction descriptions of the user returned in a basic auto-complete array. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetTransactionsACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteTransaction +*/ + +type AutocompleteApiGetTransactionsACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetTransactionsAC(ctx context.Context, localVarOptionals *AutocompleteApiGetTransactionsACOpts) ([]AutocompleteTransaction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteTransaction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/transactions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteTransaction + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AutocompleteApiService Returns all transactions, complemented with their ID, of the user returned in a basic auto-complete array. This endpoint is DEPRECATED and I suggest you DO NOT use it. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AutocompleteApiGetTransactionsIDACOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Query" (optional.String) - The autocomplete search query. + * @param "Limit" (optional.Int32) - The number of items returned. +@return []AutocompleteTransactionId +*/ + +type AutocompleteApiGetTransactionsIDACOpts struct { + XTraceId optional.Interface + Query optional.String + Limit optional.Int32 +} + +func (a *AutocompleteApiService) GetTransactionsIDAC(ctx context.Context, localVarOptionals *AutocompleteApiGetTransactionsIDACOpts) ([]AutocompleteTransactionId, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []AutocompleteTransactionId + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/autocomplete/transactions-with-id" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Query.IsSet() { + localVarQueryParams.Add("query", parameterToString(localVarOptionals.Query.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []AutocompleteTransactionId + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_available_budgets.go b/api_available_budgets.go new file mode 100644 index 0000000..5ea78c1 --- /dev/null +++ b/api_available_budgets.go @@ -0,0 +1,317 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type AvailableBudgetsApiService service + +/* +AvailableBudgetsApiService Get a single available budget. +Get a single available budget, by ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the available budget. + * @param optional nil or *AvailableBudgetsApiGetAvailableBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return AvailableBudgetSingle +*/ + +type AvailableBudgetsApiGetAvailableBudgetOpts struct { + XTraceId optional.Interface +} + +func (a *AvailableBudgetsApiService) GetAvailableBudget(ctx context.Context, id string, localVarOptionals *AvailableBudgetsApiGetAvailableBudgetOpts) (AvailableBudgetSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AvailableBudgetSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/available-budgets/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AvailableBudgetSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +AvailableBudgetsApiService List all available budget amounts. +Firefly III allows users to set the amount that is available to be budgeted in so-called \"available budgets\". For example, the user could have 1200,- available to be divided during the coming month. This amount is used on the /budgets page. This endpoint returns all of these amounts and the periods for which they are set. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AvailableBudgetsApiListAvailableBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD. +@return AvailableBudgetArray +*/ + +type AvailableBudgetsApiListAvailableBudgetOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String +} + +func (a *AvailableBudgetsApiService) ListAvailableBudget(ctx context.Context, localVarOptionals *AvailableBudgetsApiListAvailableBudgetOpts) (AvailableBudgetArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AvailableBudgetArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/available-budgets" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AvailableBudgetArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_bills.go b/api_bills.go new file mode 100644 index 0000000..6bf45c2 --- /dev/null +++ b/api_bills.go @@ -0,0 +1,1173 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type BillsApiService service + +/* +BillsApiService Delete a bill. +Delete a bill. This will not delete any associated rules. Will not remove associated transactions. WILL remove all associated attachments. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the bill. + * @param optional nil or *BillsApiDeleteBillOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type BillsApiDeleteBillOpts struct { + XTraceId optional.Interface +} + +func (a *BillsApiService) DeleteBill(ctx context.Context, id string, localVarOptionals *BillsApiDeleteBillOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/bills/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +BillsApiService Get a single bill. +Get a single bill. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the bill. + * @param optional nil or *BillsApiGetBillOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD. If it is are added to the request, Firefly III will calculate the appropriate payment and paid dates. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD. If it is added to the request, Firefly III will calculate the appropriate payment and paid dates. +@return BillSingle +*/ + +type BillsApiGetBillOpts struct { + XTraceId optional.Interface + Start optional.String + End optional.String +} + +func (a *BillsApiService) GetBill(ctx context.Context, id string, localVarOptionals *BillsApiGetBillOpts) (BillSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BillSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/bills/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v BillSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BillsApiService List all attachments uploaded to the bill. +This endpoint will list all attachments linked to the bill. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the bill. + * @param optional nil or *BillsApiListAttachmentByBillOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return AttachmentArray +*/ + +type BillsApiListAttachmentByBillOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *BillsApiService) ListAttachmentByBill(ctx context.Context, id string, localVarOptionals *BillsApiListAttachmentByBillOpts) (AttachmentArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachmentArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/bills/{id}/attachments" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v AttachmentArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BillsApiService List all bills. +This endpoint will list all the user's bills. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *BillsApiListBillOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD. If it is are added to the request, Firefly III will calculate the appropriate payment and paid dates. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD. If it is added to the request, Firefly III will calculate the appropriate payment and paid dates. +@return BillArray +*/ + +type BillsApiListBillOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String +} + +func (a *BillsApiService) ListBill(ctx context.Context, localVarOptionals *BillsApiListBillOpts) (BillArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BillArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/bills" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v BillArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BillsApiService List all rules associated with the bill. +This endpoint will list all rules that have an action to set the bill to this bill. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the bill. + * @param optional nil or *BillsApiListRuleByBillOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return RuleArray +*/ + +type BillsApiListRuleByBillOpts struct { + XTraceId optional.Interface +} + +func (a *BillsApiService) ListRuleByBill(ctx context.Context, id string, localVarOptionals *BillsApiListRuleByBillOpts) (RuleArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RuleArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/bills/{id}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v RuleArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BillsApiService List all transactions associated with the bill. +This endpoint will list all transactions linked to this bill. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the bill. + * @param optional nil or *BillsApiListTransactionByBillOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD. + * @param "Type_" (optional.Interface of TransactionTypeFilter) - Optional filter on the transaction type(s) returned +@return TransactionArray +*/ + +type BillsApiListTransactionByBillOpts struct { + XTraceId optional.Interface + Start optional.String + End optional.String + Type_ optional.Interface +} + +func (a *BillsApiService) ListTransactionByBill(ctx context.Context, id string, localVarOptionals *BillsApiListTransactionByBillOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/bills/{id}/transactions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BillsApiService Store a new bill +Creates a new bill. The data required can be submitted as a JSON body or as a list of parameters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary bill information. See the model for the exact specifications. + * @param optional nil or *BillsApiStoreBillOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return BillSingle +*/ + +type BillsApiStoreBillOpts struct { + XTraceId optional.Interface +} + +func (a *BillsApiService) StoreBill(ctx context.Context, body BillStore, localVarOptionals *BillsApiStoreBillOpts) (BillSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BillSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/bills" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v BillSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BillsApiService Update existing bill. +Update existing bill. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with updated bill information. See the model for the exact specifications. + * @param id The ID of the bill. + * @param optional nil or *BillsApiUpdateBillOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return BillSingle +*/ + +type BillsApiUpdateBillOpts struct { + XTraceId optional.Interface +} + +func (a *BillsApiService) UpdateBill(ctx context.Context, body BillUpdate, id string, localVarOptionals *BillsApiUpdateBillOpts) (BillSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BillSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/bills/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v BillSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_budgets.go b/api_budgets.go new file mode 100644 index 0000000..569725e --- /dev/null +++ b/api_budgets.go @@ -0,0 +1,2043 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type BudgetsApiService service + +/* +BudgetsApiService Delete a budget. +Delete a budget. Transactions will not be deleted. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the budget. + * @param optional nil or *BudgetsApiDeleteBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type BudgetsApiDeleteBudgetOpts struct { + XTraceId optional.Interface +} + +func (a *BudgetsApiService) DeleteBudget(ctx context.Context, id string, localVarOptionals *BudgetsApiDeleteBudgetOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +BudgetsApiService Delete a budget limit. +Delete a budget limit. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the budget. The budget limit MUST be associated to the budget ID. + * @param limitId The ID of the budget limit. The budget limit MUST be associated to the budget ID. + * @param optional nil or *BudgetsApiDeleteBudgetLimitOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type BudgetsApiDeleteBudgetLimitOpts struct { + XTraceId optional.Interface +} + +func (a *BudgetsApiService) DeleteBudgetLimit(ctx context.Context, id string, limitId string, localVarOptionals *BudgetsApiDeleteBudgetLimitOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets/{id}/limits/{limitId}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"limitId"+"}", fmt.Sprintf("%v", limitId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +BudgetsApiService Get a single budget. +Get a single budget. If the start date and end date are submitted as well, the \"spent\" array will be updated accordingly. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the requested budget. + * @param optional nil or *BudgetsApiGetBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD, to get info on how much the user has spent. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD, to get info on how much the user has spent. +@return BudgetSingle +*/ + +type BudgetsApiGetBudgetOpts struct { + XTraceId optional.Interface + Start optional.String + End optional.String +} + +func (a *BudgetsApiService) GetBudget(ctx context.Context, id string, localVarOptionals *BudgetsApiGetBudgetOpts) (BudgetSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BudgetSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BudgetSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BudgetsApiService Get single budget limit. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the budget. The budget limit MUST be associated to the budget ID. + * @param limitId The ID of the budget limit. The budget limit MUST be associated to the budget ID. + * @param optional nil or *BudgetsApiGetBudgetLimitOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return BudgetLimitSingle +*/ + +type BudgetsApiGetBudgetLimitOpts struct { + XTraceId optional.Interface +} + +func (a *BudgetsApiService) GetBudgetLimit(ctx context.Context, id string, limitId int32, localVarOptionals *BudgetsApiGetBudgetLimitOpts) (BudgetLimitSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BudgetLimitSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets/{id}/limits/{limitId}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"limitId"+"}", fmt.Sprintf("%v", limitId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if limitId < 1 { + return localVarReturnValue, nil, reportError("limitId must be greater than 1") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BudgetLimitSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BudgetsApiService Lists all attachments of a budget. +Lists all attachments. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the budget. + * @param optional nil or *BudgetsApiListAttachmentByBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return AttachmentArray +*/ + +type BudgetsApiListAttachmentByBudgetOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *BudgetsApiService) ListAttachmentByBudget(ctx context.Context, id string, localVarOptionals *BudgetsApiListAttachmentByBudgetOpts) (AttachmentArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachmentArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets/{id}/attachments" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v AttachmentArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BudgetsApiService List all budgets. +List all the budgets the user has made. If the start date and end date are submitted as well, the \"spent\" array will be updated accordingly. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *BudgetsApiListBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD, to get info on how much the user has spent. You must submit both start and end. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD, to get info on how much the user has spent. You must submit both start and end. +@return BudgetArray +*/ + +type BudgetsApiListBudgetOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String +} + +func (a *BudgetsApiService) ListBudget(ctx context.Context, localVarOptionals *BudgetsApiListBudgetOpts) (BudgetArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BudgetArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BudgetArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BudgetsApiService Get list of budget limits by date +Get all budget limits for for this date range. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *BudgetsApiListBudgetLimitOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return BudgetLimitArray +*/ + +type BudgetsApiListBudgetLimitOpts struct { + XTraceId optional.Interface +} + +func (a *BudgetsApiService) ListBudgetLimit(ctx context.Context, start string, end string, localVarOptionals *BudgetsApiListBudgetLimitOpts) (BudgetLimitArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BudgetLimitArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budget-limits" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BudgetLimitArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BudgetsApiService Get all limits for a budget. +Get all budget limits for this budget and the money spent, and money left. You can limit the list by submitting a date range as well. The \"spent\" array for each budget limit is NOT influenced by the start and end date of your query, but by the start and end date of the budget limit itself. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the requested budget. + * @param optional nil or *BudgetsApiListBudgetLimitByBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD. +@return BudgetLimitArray +*/ + +type BudgetsApiListBudgetLimitByBudgetOpts struct { + XTraceId optional.Interface + Start optional.String + End optional.String +} + +func (a *BudgetsApiService) ListBudgetLimitByBudget(ctx context.Context, id string, localVarOptionals *BudgetsApiListBudgetLimitByBudgetOpts) (BudgetLimitArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BudgetLimitArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets/{id}/limits" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BudgetLimitArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BudgetsApiService All transactions to a budget. +Get all transactions linked to a budget, possibly limited by start and end + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the budget. + * @param optional nil or *BudgetsApiListTransactionByBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD. + * @param "Type_" (optional.Interface of TransactionTypeFilter) - Optional filter on the transaction type(s) returned +@return TransactionArray +*/ + +type BudgetsApiListTransactionByBudgetOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String + Type_ optional.Interface +} + +func (a *BudgetsApiService) ListTransactionByBudget(ctx context.Context, id string, localVarOptionals *BudgetsApiListTransactionByBudgetOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets/{id}/transactions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BudgetsApiService List all transactions by a budget limit ID. +List all the transactions within one budget limit. The start and end date are dictated by the budget limit. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the budget. The budget limit MUST be associated to the budget ID. + * @param limitId The ID of the budget limit. The budget limit MUST be associated to the budget ID. + * @param optional nil or *BudgetsApiListTransactionByBudgetLimitOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Type_" (optional.Interface of TransactionTypeFilter) - Optional filter on the transaction type(s) returned +@return TransactionArray +*/ + +type BudgetsApiListTransactionByBudgetLimitOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Type_ optional.Interface +} + +func (a *BudgetsApiService) ListTransactionByBudgetLimit(ctx context.Context, id string, limitId string, localVarOptionals *BudgetsApiListTransactionByBudgetLimitOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets/{id}/limits/{limitId}/transactions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"limitId"+"}", fmt.Sprintf("%v", limitId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BudgetsApiService Store a new budget +Creates a new budget. The data required can be submitted as a JSON body or as a list of parameters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary budget information. See the model for the exact specifications. + * @param optional nil or *BudgetsApiStoreBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return BudgetSingle +*/ + +type BudgetsApiStoreBudgetOpts struct { + XTraceId optional.Interface +} + +func (a *BudgetsApiService) StoreBudget(ctx context.Context, body BudgetStore, localVarOptionals *BudgetsApiStoreBudgetOpts) (BudgetSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BudgetSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BudgetSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BudgetsApiService Store new budget limit. +Store a new budget limit under this budget. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary budget information. See the model for the exact specifications. + * @param id The ID of the budget. + * @param optional nil or *BudgetsApiStoreBudgetLimitOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return BudgetLimitSingle +*/ + +type BudgetsApiStoreBudgetLimitOpts struct { + XTraceId optional.Interface +} + +func (a *BudgetsApiService) StoreBudgetLimit(ctx context.Context, body BudgetLimitStore, id string, localVarOptionals *BudgetsApiStoreBudgetLimitOpts) (BudgetLimitSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BudgetLimitSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets/{id}/limits" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BudgetLimitSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BudgetsApiService Update existing budget. +Update existing budget. This endpoint cannot be used to set budget amount limits. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated budget information. See the model for the exact specifications. + * @param id The ID of the budget. + * @param optional nil or *BudgetsApiUpdateBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return BudgetSingle +*/ + +type BudgetsApiUpdateBudgetOpts struct { + XTraceId optional.Interface +} + +func (a *BudgetsApiService) UpdateBudget(ctx context.Context, body BudgetUpdate, id string, localVarOptionals *BudgetsApiUpdateBudgetOpts) (BudgetSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BudgetSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BudgetSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +BudgetsApiService Update existing budget limit. +Update existing budget limit. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated budget limit information. See the model for the exact specifications. + * @param id The ID of the budget. The budget limit MUST be associated to the budget ID. + * @param limitId The ID of the budget limit. The budget limit MUST be associated to the budget ID. + * @param optional nil or *BudgetsApiUpdateBudgetLimitOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return BudgetLimitSingle +*/ + +type BudgetsApiUpdateBudgetLimitOpts struct { + XTraceId optional.Interface +} + +func (a *BudgetsApiService) UpdateBudgetLimit(ctx context.Context, body BudgetLimit, id string, limitId string, localVarOptionals *BudgetsApiUpdateBudgetLimitOpts) (BudgetLimitSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BudgetLimitSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/budgets/{id}/limits/{limitId}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"limitId"+"}", fmt.Sprintf("%v", limitId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BudgetLimitSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_categories.go b/api_categories.go new file mode 100644 index 0000000..95e1441 --- /dev/null +++ b/api_categories.go @@ -0,0 +1,1037 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type CategoriesApiService service + +/* +CategoriesApiService Delete a category. +Delete a category. Transactions will not be removed. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the category. + * @param optional nil or *CategoriesApiDeleteCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type CategoriesApiDeleteCategoryOpts struct { + XTraceId optional.Interface +} + +func (a *CategoriesApiService) DeleteCategory(ctx context.Context, id string, localVarOptionals *CategoriesApiDeleteCategoryOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/categories/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +CategoriesApiService Get a single category. +Get a single category. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the category. + * @param optional nil or *CategoriesApiGetCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD, to show spent and earned info. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD, to show spent and earned info. +@return CategorySingle +*/ + +type CategoriesApiGetCategoryOpts struct { + XTraceId optional.Interface + Start optional.String + End optional.String +} + +func (a *CategoriesApiService) GetCategory(ctx context.Context, id string, localVarOptionals *CategoriesApiGetCategoryOpts) (CategorySingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CategorySingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/categories/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v CategorySingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CategoriesApiService Lists all attachments. +Lists all attachments. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the category. + * @param optional nil or *CategoriesApiListAttachmentByCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return AttachmentArray +*/ + +type CategoriesApiListAttachmentByCategoryOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *CategoriesApiService) ListAttachmentByCategory(ctx context.Context, id string, localVarOptionals *CategoriesApiListAttachmentByCategoryOpts) (AttachmentArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachmentArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/categories/{id}/attachments" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v AttachmentArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CategoriesApiService List all categories. +List all categories. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *CategoriesApiListCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return CategoryArray +*/ + +type CategoriesApiListCategoryOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *CategoriesApiService) ListCategory(ctx context.Context, localVarOptionals *CategoriesApiListCategoryOpts) (CategoryArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CategoryArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/categories" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v CategoryArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CategoriesApiService List all transactions in a category. +List all transactions in a category, optionally limited to the date ranges specified. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the category. + * @param optional nil or *CategoriesApiListTransactionByCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD, to limit the result list. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD, to limit the result list. + * @param "Type_" (optional.Interface of TransactionTypeFilter) - Optional filter on the transaction type(s) returned +@return TransactionArray +*/ + +type CategoriesApiListTransactionByCategoryOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String + Type_ optional.Interface +} + +func (a *CategoriesApiService) ListTransactionByCategory(ctx context.Context, id string, localVarOptionals *CategoriesApiListTransactionByCategoryOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/categories/{id}/transactions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CategoriesApiService Store a new category +Creates a new category. The data required can be submitted as a JSON body or as a list of parameters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary category information. See the model for the exact specifications. + * @param optional nil or *CategoriesApiStoreCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return CategorySingle +*/ + +type CategoriesApiStoreCategoryOpts struct { + XTraceId optional.Interface +} + +func (a *CategoriesApiService) StoreCategory(ctx context.Context, body Category, localVarOptionals *CategoriesApiStoreCategoryOpts) (CategorySingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CategorySingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/categories" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v CategorySingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CategoriesApiService Update existing category. +Update existing category. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated category information. See the model for the exact specifications. + * @param id The ID of the category. + * @param optional nil or *CategoriesApiUpdateCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return CategorySingle +*/ + +type CategoriesApiUpdateCategoryOpts struct { + XTraceId optional.Interface +} + +func (a *CategoriesApiService) UpdateCategory(ctx context.Context, body CategoryUpdate, id string, localVarOptionals *CategoriesApiUpdateCategoryOpts) (CategorySingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CategorySingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/categories/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v CategorySingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_charts.go b/api_charts.go new file mode 100644 index 0000000..8ebe7e9 --- /dev/null +++ b/api_charts.go @@ -0,0 +1,164 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type ChartsApiService service + +/* +ChartsApiService Dashboard chart with asset account balance information. +This endpoint returns the data required to generate a chart with basic asset account balance information. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *ChartsApiGetChartAccountOverviewOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return []ChartDataSet +*/ + +type ChartsApiGetChartAccountOverviewOpts struct { + XTraceId optional.Interface +} + +func (a *ChartsApiService) GetChartAccountOverview(ctx context.Context, start string, end string, localVarOptionals *ChartsApiGetChartAccountOverviewOpts) ([]ChartDataSet, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []ChartDataSet + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/chart/account/overview" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []ChartDataSet + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_configuration.go b/api_configuration.go new file mode 100644 index 0000000..7309350 --- /dev/null +++ b/api_configuration.go @@ -0,0 +1,445 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type ConfigurationApiService service + +/* +ConfigurationApiService Get Firefly III system configuration values. +Returns all editable and not-editable configuration values for this Firefly III installation + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *ConfigurationApiGetConfigurationOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return []Configuration +*/ + +type ConfigurationApiGetConfigurationOpts struct { + XTraceId optional.Interface +} + +func (a *ConfigurationApiService) GetConfiguration(ctx context.Context, localVarOptionals *ConfigurationApiGetConfigurationOpts) ([]Configuration, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Configuration + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/configuration" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []Configuration + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ConfigurationApiService Get a single Firefly III system configuration value +Returns one configuration variable for this Firefly III installation + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The name of the configuration value you want to know. + * @param optional nil or *ConfigurationApiGetSingleConfigurationOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return ConfigurationSingle +*/ + +type ConfigurationApiGetSingleConfigurationOpts struct { + XTraceId optional.Interface +} + +func (a *ConfigurationApiService) GetSingleConfiguration(ctx context.Context, name ConfigValueFilter, localVarOptionals *ConfigurationApiGetSingleConfigurationOpts) (ConfigurationSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ConfigurationSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/configuration/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v ConfigurationSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ConfigurationApiService Update configuration value +Set a single configuration value. Not all configuration values can be updated so the list of accepted configuration variables is small. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param value + * @param name The name of the configuration value you want to update. + * @param optional nil or *ConfigurationApiSetConfigurationOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return ConfigurationSingle +*/ + +type ConfigurationApiSetConfigurationOpts struct { + XTraceId optional.Interface +} + +func (a *ConfigurationApiService) SetConfiguration(ctx context.Context, value PolymorphicProperty, name ConfigValueUpdateFilter, localVarOptionals *ConfigurationApiSetConfigurationOpts) (ConfigurationSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ConfigurationSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/configuration/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/x-www-form-urlencoded", "application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ConfigurationSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_currencies.go b/api_currencies.go new file mode 100644 index 0000000..3d8262b --- /dev/null +++ b/api_currencies.go @@ -0,0 +1,2319 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type CurrenciesApiService service + +/* +CurrenciesApiService Make currency default currency. +Make this currency the default currency for the user. If the currency is not enabled, it will be enabled as well. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiDefaultCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return CurrencySingle +*/ + +type CurrenciesApiDefaultCurrencyOpts struct { + XTraceId optional.Interface +} + +func (a *CurrenciesApiService) DefaultCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiDefaultCurrencyOpts) (CurrencySingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CurrencySingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}/default" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 204 { + var v CurrencySingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService Delete a currency. +Delete a currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiDeleteCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type CurrenciesApiDeleteCurrencyOpts struct { + XTraceId optional.Interface +} + +func (a *CurrenciesApiService) DeleteCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiDeleteCurrencyOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +CurrenciesApiService Disable a currency. +Disable a currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiDisableCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return CurrencySingle +*/ + +type CurrenciesApiDisableCurrencyOpts struct { + XTraceId optional.Interface +} + +func (a *CurrenciesApiService) DisableCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiDisableCurrencyOpts) (CurrencySingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CurrencySingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}/disable" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 204 { + var v CurrencySingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService Enable a single currency. +Enable a single currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiEnableCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return CurrencySingle +*/ + +type CurrenciesApiEnableCurrencyOpts struct { + XTraceId optional.Interface +} + +func (a *CurrenciesApiService) EnableCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiEnableCurrencyOpts) (CurrencySingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CurrencySingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}/enable" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 204 { + var v CurrencySingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService Get a single currency. +Get a single currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiGetCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return CurrencySingle +*/ + +type CurrenciesApiGetCurrencyOpts struct { + XTraceId optional.Interface +} + +func (a *CurrenciesApiService) GetCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiGetCurrencyOpts) (CurrencySingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CurrencySingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v CurrencySingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService Get the user's default currency. +Get the user's default currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *CurrenciesApiGetDefaultCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return CurrencySingle +*/ + +type CurrenciesApiGetDefaultCurrencyOpts struct { + XTraceId optional.Interface +} + +func (a *CurrenciesApiService) GetDefaultCurrency(ctx context.Context, localVarOptionals *CurrenciesApiGetDefaultCurrencyOpts) (CurrencySingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CurrencySingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/default" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v CurrencySingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService List all accounts with this currency. +List all accounts with this currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiListAccountByCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Date" (optional.String) - A date formatted YYYY-MM-DD. When added to the request, Firefly III will show the account's balance on that day. + * @param "Type_" (optional.Interface of AccountTypeFilter) - Optional filter on the account type(s) returned +@return AccountArray +*/ + +type CurrenciesApiListAccountByCurrencyOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Date optional.String + Type_ optional.Interface +} + +func (a *CurrenciesApiService) ListAccountByCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiListAccountByCurrencyOpts) (AccountArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccountArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}/accounts" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Date.IsSet() { + localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v AccountArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService List all available budgets with this currency. +List all available budgets with this currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiListAvailableBudgetByCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return AvailableBudgetArray +*/ + +type CurrenciesApiListAvailableBudgetByCurrencyOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *CurrenciesApiService) ListAvailableBudgetByCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiListAvailableBudgetByCurrencyOpts) (AvailableBudgetArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AvailableBudgetArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}/available-budgets" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v AvailableBudgetArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService List all bills with this currency. +List all bills with this currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiListBillByCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return BillArray +*/ + +type CurrenciesApiListBillByCurrencyOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *CurrenciesApiService) ListBillByCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiListBillByCurrencyOpts) (BillArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BillArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}/bills" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BillArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService List all budget limits with this currency +List all budget limits with this currency + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiListBudgetLimitByCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - Start date for the budget limit list. + * @param "End" (optional.String) - End date for the budget limit list. +@return BudgetLimitArray +*/ + +type CurrenciesApiListBudgetLimitByCurrencyOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String +} + +func (a *CurrenciesApiService) ListBudgetLimitByCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiListBudgetLimitByCurrencyOpts) (BudgetLimitArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BudgetLimitArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}/budget_limits" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BudgetLimitArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService List all currencies. +List all currencies. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *CurrenciesApiListCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return CurrencyArray +*/ + +type CurrenciesApiListCurrencyOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *CurrenciesApiService) ListCurrency(ctx context.Context, localVarOptionals *CurrenciesApiListCurrencyOpts) (CurrencyArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CurrencyArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v CurrencyArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService List all recurring transactions with this currency. +List all recurring transactions with this currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiListRecurrenceByCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return RecurrenceArray +*/ + +type CurrenciesApiListRecurrenceByCurrencyOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *CurrenciesApiService) ListRecurrenceByCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiListRecurrenceByCurrencyOpts) (RecurrenceArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RecurrenceArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}/recurrences" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RecurrenceArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService List all rules with this currency. +List all rules with this currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiListRuleByCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return RuleArray +*/ + +type CurrenciesApiListRuleByCurrencyOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *CurrenciesApiService) ListRuleByCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiListRuleByCurrencyOpts) (RuleArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RuleArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RuleArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService List all transactions with this currency. +List all transactions with this currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param code The currency code. + * @param optional nil or *CurrenciesApiListTransactionByCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD, to limit the list of transactions. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD, to limit the list of transactions. + * @param "Type_" (optional.Interface of TransactionTypeFilter) - Optional filter on the transaction type(s) returned +@return TransactionArray +*/ + +type CurrenciesApiListTransactionByCurrencyOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String + Type_ optional.Interface +} + +func (a *CurrenciesApiService) ListTransactionByCurrency(ctx context.Context, code string, localVarOptionals *CurrenciesApiListTransactionByCurrencyOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}/transactions" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService Store a new currency +Creates a new currency. The data required can be submitted as a JSON body or as a list of parameters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary currency information. See the model for the exact specifications. + * @param optional nil or *CurrenciesApiStoreCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return CurrencySingle +*/ + +type CurrenciesApiStoreCurrencyOpts struct { + XTraceId optional.Interface +} + +func (a *CurrenciesApiService) StoreCurrency(ctx context.Context, body CurrencyStore, localVarOptionals *CurrenciesApiStoreCurrencyOpts) (CurrencySingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CurrencySingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v CurrencySingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +CurrenciesApiService Update existing currency. +Update existing currency. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated currency information. See the model for the exact specifications. + * @param code The currency code. + * @param optional nil or *CurrenciesApiUpdateCurrencyOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return CurrencySingle +*/ + +type CurrenciesApiUpdateCurrencyOpts struct { + XTraceId optional.Interface +} + +func (a *CurrenciesApiService) UpdateCurrency(ctx context.Context, body CurrencyUpdate, code string, localVarOptionals *CurrenciesApiUpdateCurrencyOpts) (CurrencySingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CurrencySingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/currencies/{code}" + localVarPath = strings.Replace(localVarPath, "{"+"code"+"}", fmt.Sprintf("%v", code), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/vnd.firefly3+json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v CurrencySingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_data.go b/api_data.go new file mode 100644 index 0000000..e7e0caf --- /dev/null +++ b/api_data.go @@ -0,0 +1,1616 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "os" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type DataApiService service + +/* +DataApiService Bulk update transaction properties. For more information, see https://docs.firefly-iii.org/references/firefly-iii/api/specials/ +Allows you to update transactions in bulk. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param query The JSON query. + +*/ +func (a *DataApiService) BulkUpdateTransactions(ctx context.Context, query string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/bulk/transactions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("query", parameterToString(query, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +DataApiService Endpoint to destroy user data +A call to this endpoint deletes the requested data type. Use it with care and always with user permission. The demo user is incapable of using this endpoint. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param objects The type of data that you wish to destroy. You can only use one at a time. + * @param optional nil or *DataApiDestroyDataOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type DataApiDestroyDataOpts struct { + XTraceId optional.Interface +} + +func (a *DataApiService) DestroyData(ctx context.Context, objects DataDestroyObject, localVarOptionals *DataApiDestroyDataOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/destroy" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("objects", parameterToString(objects, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +DataApiService Export account data from Firefly III +This endpoint allows you to export your accounts from Firefly III into a file. Currently supports CSV exports only. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DataApiExportAccountsOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Type_" (optional.Interface of ExportFileFilter) - The file type the export file (CSV is currently the only option). +@return *os.File +*/ + +type DataApiExportAccountsOpts struct { + XTraceId optional.Interface + Type_ optional.Interface +} + +func (a *DataApiService) ExportAccounts(ctx context.Context, localVarOptionals *DataApiExportAccountsOpts) (*os.File, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *os.File + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/export/accounts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/octet-stream"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v *os.File + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DataApiService Export bills from Firefly III +This endpoint allows you to export your bills from Firefly III into a file. Currently supports CSV exports only. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DataApiExportBillsOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Type_" (optional.Interface of ExportFileFilter) - The file type the export file (CSV is currently the only option). +@return *os.File +*/ + +type DataApiExportBillsOpts struct { + XTraceId optional.Interface + Type_ optional.Interface +} + +func (a *DataApiService) ExportBills(ctx context.Context, localVarOptionals *DataApiExportBillsOpts) (*os.File, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *os.File + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/export/bills" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/octet-stream"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v *os.File + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DataApiService Export budgets and budget amount data from Firefly III +This endpoint allows you to export your budgets and associated budget data from Firefly III into a file. Currently supports CSV exports only. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DataApiExportBudgetsOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Type_" (optional.Interface of ExportFileFilter) - The file type the export file (CSV is currently the only option). +@return *os.File +*/ + +type DataApiExportBudgetsOpts struct { + XTraceId optional.Interface + Type_ optional.Interface +} + +func (a *DataApiService) ExportBudgets(ctx context.Context, localVarOptionals *DataApiExportBudgetsOpts) (*os.File, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *os.File + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/export/budgets" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/octet-stream"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v *os.File + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DataApiService Export category data from Firefly III +This endpoint allows you to export your categories from Firefly III into a file. Currently supports CSV exports only. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DataApiExportCategoriesOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Type_" (optional.Interface of ExportFileFilter) - The file type the export file (CSV is currently the only option). +@return *os.File +*/ + +type DataApiExportCategoriesOpts struct { + XTraceId optional.Interface + Type_ optional.Interface +} + +func (a *DataApiService) ExportCategories(ctx context.Context, localVarOptionals *DataApiExportCategoriesOpts) (*os.File, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *os.File + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/export/categories" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/octet-stream"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v *os.File + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DataApiService Export piggy banks from Firefly III +This endpoint allows you to export your piggy banks from Firefly III into a file. Currently supports CSV exports only. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DataApiExportPiggiesOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Type_" (optional.Interface of ExportFileFilter) - The file type the export file (CSV is currently the only option). +@return *os.File +*/ + +type DataApiExportPiggiesOpts struct { + XTraceId optional.Interface + Type_ optional.Interface +} + +func (a *DataApiService) ExportPiggies(ctx context.Context, localVarOptionals *DataApiExportPiggiesOpts) (*os.File, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *os.File + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/export/piggy-banks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/octet-stream"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v *os.File + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DataApiService Export recurring transaction data from Firefly III +This endpoint allows you to export your recurring transactions from Firefly III into a file. Currently supports CSV exports only. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DataApiExportRecurringOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Type_" (optional.Interface of ExportFileFilter) - The file type the export file (CSV is currently the only option). +@return *os.File +*/ + +type DataApiExportRecurringOpts struct { + XTraceId optional.Interface + Type_ optional.Interface +} + +func (a *DataApiService) ExportRecurring(ctx context.Context, localVarOptionals *DataApiExportRecurringOpts) (*os.File, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *os.File + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/export/recurring" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/octet-stream"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v *os.File + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DataApiService Export rule groups and rule data from Firefly III +This endpoint allows you to export your rules and rule groups from Firefly III into a file. Currently supports CSV exports only. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DataApiExportRulesOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Type_" (optional.Interface of ExportFileFilter) - The file type the export file (CSV is currently the only option). +@return *os.File +*/ + +type DataApiExportRulesOpts struct { + XTraceId optional.Interface + Type_ optional.Interface +} + +func (a *DataApiService) ExportRules(ctx context.Context, localVarOptionals *DataApiExportRulesOpts) (*os.File, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *os.File + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/export/rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/octet-stream"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v *os.File + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DataApiService Export tag data from Firefly III +This endpoint allows you to export your tags from Firefly III into a file. Currently supports CSV exports only. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DataApiExportTagsOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Type_" (optional.Interface of ExportFileFilter) - The file type the export file (CSV is currently the only option). +@return *os.File +*/ + +type DataApiExportTagsOpts struct { + XTraceId optional.Interface + Type_ optional.Interface +} + +func (a *DataApiService) ExportTags(ctx context.Context, localVarOptionals *DataApiExportTagsOpts) (*os.File, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *os.File + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/export/tags" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/octet-stream"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v *os.File + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DataApiService Export transaction data from Firefly III +This endpoint allows you to export transactions from Firefly III into a file. Currently supports CSV exports only. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *DataApiExportTransactionsOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.String) - Limit the export of transactions to these accounts only. Only asset accounts will be accepted. Other types will be silently dropped. + * @param "Type_" (optional.Interface of ExportFileFilter) - The file type the export file (CSV is currently the only option). +@return *os.File +*/ + +type DataApiExportTransactionsOpts struct { + XTraceId optional.Interface + Accounts optional.String + Type_ optional.Interface +} + +func (a *DataApiService) ExportTransactions(ctx context.Context, start string, end string, localVarOptionals *DataApiExportTransactionsOpts) (*os.File, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *os.File + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/export/transactions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts", parameterToString(localVarOptionals.Accounts.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/octet-stream"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v *os.File + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DataApiService Endpoint to purge user data +A call to this endpoint purges all previously deleted data. Use it with care and always with user permission. The demo user is incapable of using this endpoint. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DataApiPurgeDataOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type DataApiPurgeDataOpts struct { + XTraceId optional.Interface +} + +func (a *DataApiService) PurgeData(ctx context.Context, localVarOptionals *DataApiPurgeDataOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/data/purge" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} diff --git a/api_insight.go b/api_insight.go new file mode 100644 index 0000000..523e748 --- /dev/null +++ b/api_insight.go @@ -0,0 +1,3498 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type InsightApiService service + +/* +InsightApiService Insight into expenses, grouped by asset account. +This endpoint gives a summary of the expenses made by the user, grouped by asset account. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightExpenseAssetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only withdrawals from those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightExpenseAssetOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightExpenseAsset(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightExpenseAssetOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/expense/asset" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into expenses, grouped by bill. +This endpoint gives a summary of the expenses made by the user, grouped by (any) bill. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightExpenseBillOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Bills" (optional.Interface of []int64) - The bills to be included in the results. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only withdrawals from those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightExpenseBillOpts struct { + XTraceId optional.Interface + Bills optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightExpenseBill(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightExpenseBillOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/expense/bill" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Bills.IsSet() { + localVarQueryParams.Add("bills[]", parameterToString(localVarOptionals.Bills.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into expenses, grouped by budget. +This endpoint gives a summary of the expenses made by the user, grouped by (any) budget. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightExpenseBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Budgets" (optional.Interface of []int64) - The budgets to be included in the results. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only withdrawals from those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightExpenseBudgetOpts struct { + XTraceId optional.Interface + Budgets optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightExpenseBudget(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightExpenseBudgetOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/expense/budget" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Budgets.IsSet() { + localVarQueryParams.Add("budgets[]", parameterToString(localVarOptionals.Budgets.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into expenses, grouped by category. +This endpoint gives a summary of the expenses made by the user, grouped by (any) category. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightExpenseCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Categories" (optional.Interface of []int64) - The categories to be included in the results. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only withdrawals from those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightExpenseCategoryOpts struct { + XTraceId optional.Interface + Categories optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightExpenseCategory(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightExpenseCategoryOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/expense/category" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Categories.IsSet() { + localVarQueryParams.Add("categories[]", parameterToString(localVarOptionals.Categories.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into expenses, grouped by expense account. +This endpoint gives a summary of the expenses made by the user, grouped by expense account. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightExpenseExpenseOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you add the accounts ID's of expense accounts, only those accounts are included in the results. If you include ID's of asset accounts or liabilities, only withdrawals from those asset accounts / liabilities will be included. You can combine both asset / liability and expense account ID's. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightExpenseExpenseOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightExpenseExpense(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightExpenseExpenseOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/expense/expense" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into expenses, without bill. +This endpoint gives a summary of the expenses made by the user, including only expenses with no bill. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightExpenseNoBillOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only withdrawals from those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTotalEntry +*/ + +type InsightApiInsightExpenseNoBillOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightExpenseNoBill(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightExpenseNoBillOpts) ([]InsightTotalEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTotalEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/expense/no-bill" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTotalEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into expenses, without budget. +This endpoint gives a summary of the expenses made by the user, including only expenses with no budget. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightExpenseNoBudgetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only withdrawals from those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTotalEntry +*/ + +type InsightApiInsightExpenseNoBudgetOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightExpenseNoBudget(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightExpenseNoBudgetOpts) ([]InsightTotalEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTotalEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/expense/no-budget" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTotalEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into expenses, without category. +This endpoint gives a summary of the expenses made by the user, including only expenses with no category. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightExpenseNoCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only withdrawals from those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTotalEntry +*/ + +type InsightApiInsightExpenseNoCategoryOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightExpenseNoCategory(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightExpenseNoCategoryOpts) ([]InsightTotalEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTotalEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/expense/no-category" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTotalEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into expenses, without tag. +This endpoint gives a summary of the expenses made by the user, including only expenses with no tag. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightExpenseNoTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only withdrawals from those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTotalEntry +*/ + +type InsightApiInsightExpenseNoTagOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightExpenseNoTag(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightExpenseNoTagOpts) ([]InsightTotalEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTotalEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/expense/no-tag" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTotalEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into expenses, grouped by tag. +This endpoint gives a summary of the expenses made by the user, grouped by (any) tag. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightExpenseTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Tags" (optional.Interface of []int64) - The tags to be included in the results. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only withdrawals from those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightExpenseTagOpts struct { + XTraceId optional.Interface + Tags optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightExpenseTag(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightExpenseTagOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/expense/tag" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Tags.IsSet() { + localVarQueryParams.Add("tags[]", parameterToString(localVarOptionals.Tags.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into total expenses. +This endpoint gives a sum of the total expenses made by the user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightExpenseTotalOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only withdrawals from those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTotalEntry +*/ + +type InsightApiInsightExpenseTotalOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightExpenseTotal(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightExpenseTotalOpts) ([]InsightTotalEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTotalEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/expense/total" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTotalEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into income, grouped by asset account. +This endpoint gives a summary of the income received by the user, grouped by asset account. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightIncomeAssetOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only deposits to those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightIncomeAssetOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightIncomeAsset(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightIncomeAssetOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/income/asset" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into income, grouped by category. +This endpoint gives a summary of the income received by the user, grouped by (any) category. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightIncomeCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Categories" (optional.Interface of []int64) - The categories to be included in the results. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only deposits to those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightIncomeCategoryOpts struct { + XTraceId optional.Interface + Categories optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightIncomeCategory(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightIncomeCategoryOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/income/category" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Categories.IsSet() { + localVarQueryParams.Add("categories[]", parameterToString(localVarOptionals.Categories.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into income, without category. +This endpoint gives a summary of the income received by the user, including only income with no category. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightIncomeNoCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only deposits to those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTotalEntry +*/ + +type InsightApiInsightIncomeNoCategoryOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightIncomeNoCategory(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightIncomeNoCategoryOpts) ([]InsightTotalEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTotalEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/income/no-category" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTotalEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into income, without tag. +This endpoint gives a summary of the income received by the user, including only income with no tag. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightIncomeNoTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only deposits to those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTotalEntry +*/ + +type InsightApiInsightIncomeNoTagOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightIncomeNoTag(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightIncomeNoTagOpts) ([]InsightTotalEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTotalEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/income/no-tag" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTotalEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into income, grouped by revenue account. +This endpoint gives a summary of the income received by the user, grouped by revenue account. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightIncomeRevenueOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you add the accounts ID's of revenue accounts, only those accounts are included in the results. If you include ID's of asset accounts or liabilities, only deposits to those asset accounts / liabilities will be included. You can combine both asset / liability and deposit account ID's. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightIncomeRevenueOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightIncomeRevenue(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightIncomeRevenueOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/income/revenue" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into income, grouped by tag. +This endpoint gives a summary of the income received by the user, grouped by (any) tag. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightIncomeTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Tags" (optional.Interface of []int64) - The tags to be included in the results. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only deposits to those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightIncomeTagOpts struct { + XTraceId optional.Interface + Tags optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightIncomeTag(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightIncomeTagOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/income/tag" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Tags.IsSet() { + localVarQueryParams.Add("tags[]", parameterToString(localVarOptionals.Tags.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into total income. +This endpoint gives a sum of the total income received by the user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightIncomeTotalOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only deposits to those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTotalEntry +*/ + +type InsightApiInsightIncomeTotalOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightIncomeTotal(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightIncomeTotalOpts) ([]InsightTotalEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTotalEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/income/total" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTotalEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into transfers, grouped by category. +This endpoint gives a summary of the transfers made by the user, grouped by (any) category. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightTransferCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Categories" (optional.Interface of []int64) - The categories to be included in the results. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only transfers between those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightTransferCategoryOpts struct { + XTraceId optional.Interface + Categories optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightTransferCategory(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightTransferCategoryOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/transfer/category" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Categories.IsSet() { + localVarQueryParams.Add("categories[]", parameterToString(localVarOptionals.Categories.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into transfers, without category. +This endpoint gives a summary of the transfers made by the user, including only transfers with no category. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightTransferNoCategoryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only transfers between those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTotalEntry +*/ + +type InsightApiInsightTransferNoCategoryOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightTransferNoCategory(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightTransferNoCategoryOpts) ([]InsightTotalEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTotalEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/transfer/no-category" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTotalEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into expenses, without tag. +This endpoint gives a summary of the transfers made by the user, including only transfers with no tag. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightTransferNoTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only transfers from those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTotalEntry +*/ + +type InsightApiInsightTransferNoTagOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightTransferNoTag(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightTransferNoTagOpts) ([]InsightTotalEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTotalEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/transfer/no-tag" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTotalEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into transfers, grouped by tag. +This endpoint gives a summary of the transfers created by the user, grouped by (any) tag. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightTransferTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Tags" (optional.Interface of []int64) - The tags to be included in the results. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only transfers between those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightGroupEntry +*/ + +type InsightApiInsightTransferTagOpts struct { + XTraceId optional.Interface + Tags optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightTransferTag(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightTransferTagOpts) ([]InsightGroupEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightGroupEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/transfer/tag" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Tags.IsSet() { + localVarQueryParams.Add("tags[]", parameterToString(localVarOptionals.Tags.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightGroupEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into total transfers. +This endpoint gives a sum of the total amount transfers made by the user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightTransferTotalOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only transfers between those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTotalEntry +*/ + +type InsightApiInsightTransferTotalOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightTransferTotal(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightTransferTotalOpts) ([]InsightTotalEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTotalEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/transfer/total" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTotalEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +InsightApiService Insight into transfers, grouped by account. +This endpoint gives a summary of the transfers made by the user, grouped by asset account or lability. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *InsightApiInsightTransfersOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Accounts" (optional.Interface of []int64) - The accounts to be included in the results. If you include ID's of asset accounts or liabilities, only transfers between those asset accounts / liabilities will be included. Other account ID's will be ignored. +@return []InsightTransferEntry +*/ + +type InsightApiInsightTransfersOpts struct { + XTraceId optional.Interface + Accounts optional.Interface +} + +func (a *InsightApiService) InsightTransfers(ctx context.Context, start string, end string, localVarOptionals *InsightApiInsightTransfersOpts) ([]InsightTransferEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []InsightTransferEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/insight/transfer/asset" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v []InsightTransferEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_links.go b/api_links.go new file mode 100644 index 0000000..ff1e4fa --- /dev/null +++ b/api_links.go @@ -0,0 +1,1574 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type LinksApiService service + +/* +LinksApiService Permanently delete link type. +Will permanently delete a link type. The links between transactions will be removed. The transactions themselves remain. You cannot delete some of the system provided link types, indicated by the editable=false flag when you list it. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the link type. + * @param optional nil or *LinksApiDeleteLinkTypeOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type LinksApiDeleteLinkTypeOpts struct { + XTraceId optional.Interface +} + +func (a *LinksApiService) DeleteLinkType(ctx context.Context, id string, localVarOptionals *LinksApiDeleteLinkTypeOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/link-types/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +LinksApiService Permanently delete link between transactions. +Will permanently delete link. Transactions remain. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the transaction link. + * @param optional nil or *LinksApiDeleteTransactionLinkOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type LinksApiDeleteTransactionLinkOpts struct { + XTraceId optional.Interface +} + +func (a *LinksApiService) DeleteTransactionLink(ctx context.Context, id string, localVarOptionals *LinksApiDeleteTransactionLinkOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transaction-links/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +LinksApiService Get single a link type. +Returns a single link type by its ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the link type. + * @param optional nil or *LinksApiGetLinkTypeOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return LinkTypeSingle +*/ + +type LinksApiGetLinkTypeOpts struct { + XTraceId optional.Interface +} + +func (a *LinksApiService) GetLinkType(ctx context.Context, id string, localVarOptionals *LinksApiGetLinkTypeOpts) (LinkTypeSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LinkTypeSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/link-types/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v LinkTypeSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +LinksApiService Get a single link. +Returns a single link by its ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the transaction link. + * @param optional nil or *LinksApiGetTransactionLinkOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return TransactionLinkSingle +*/ + +type LinksApiGetTransactionLinkOpts struct { + XTraceId optional.Interface +} + +func (a *LinksApiService) GetTransactionLink(ctx context.Context, id string, localVarOptionals *LinksApiGetTransactionLinkOpts) (TransactionLinkSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionLinkSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transaction-links/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionLinkSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +LinksApiService List all types of links. +List all the link types the system has. These include the default ones as well as any new ones. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *LinksApiListLinkTypeOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return LinkTypeArray +*/ + +type LinksApiListLinkTypeOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *LinksApiService) ListLinkType(ctx context.Context, localVarOptionals *LinksApiListLinkTypeOpts) (LinkTypeArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LinkTypeArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/link-types" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v LinkTypeArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +LinksApiService List all transactions under this link type. +List all transactions under this link type, both the inward and outward transactions. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the link type. + * @param optional nil or *LinksApiListTransactionByLinkTypeOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD, to limit the results. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD, to limit the results. + * @param "Type_" (optional.Interface of TransactionTypeFilter) - Optional filter on the transaction type(s) returned. +@return TransactionArray +*/ + +type LinksApiListTransactionByLinkTypeOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String + Type_ optional.Interface +} + +func (a *LinksApiService) ListTransactionByLinkType(ctx context.Context, id string, localVarOptionals *LinksApiListTransactionByLinkTypeOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/link-types/{id}/transactions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +LinksApiService List all transaction links. +List all the transaction links. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *LinksApiListTransactionLinkOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return TransactionLinkArray +*/ + +type LinksApiListTransactionLinkOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *LinksApiService) ListTransactionLink(ctx context.Context, localVarOptionals *LinksApiListTransactionLinkOpts) (TransactionLinkArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionLinkArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transaction-links" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionLinkArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +LinksApiService Create a new link type +Creates a new link type. The data required can be submitted as a JSON body or as a list of parameters (in key=value pairs, like a webform). + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with the necessary link type information or key=value pairs. See the model for the exact specifications. + * @param optional nil or *LinksApiStoreLinkTypeOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return LinkTypeSingle +*/ + +type LinksApiStoreLinkTypeOpts struct { + XTraceId optional.Interface +} + +func (a *LinksApiService) StoreLinkType(ctx context.Context, body LinkType, localVarOptionals *LinksApiStoreLinkTypeOpts) (LinkTypeSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LinkTypeSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/link-types" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v LinkTypeSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +LinksApiService Create a new link between transactions +Store a new link between two transactions. For this end point you need the journal_id from a transaction. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with the necessary link type information or key=value pairs. See the model for the exact specifications. + * @param optional nil or *LinksApiStoreTransactionLinkOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return TransactionLinkSingle +*/ + +type LinksApiStoreTransactionLinkOpts struct { + XTraceId optional.Interface +} + +func (a *LinksApiService) StoreTransactionLink(ctx context.Context, body TransactionLinkStore, localVarOptionals *LinksApiStoreTransactionLinkOpts) (TransactionLinkSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionLinkSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transaction-links" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionLinkSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +LinksApiService Update existing link type. +Used to update a single link type. All fields that are not submitted will be cleared (set to NULL). The model will tell you which fields are mandatory. You cannot update some of the system provided link types, indicated by the editable=false flag when you list it. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or formdata with updated link type information. See the model for the exact specifications. + * @param id The ID of the link type. + * @param optional nil or *LinksApiUpdateLinkTypeOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return LinkTypeSingle +*/ + +type LinksApiUpdateLinkTypeOpts struct { + XTraceId optional.Interface +} + +func (a *LinksApiService) UpdateLinkType(ctx context.Context, body LinkTypeUpdate, id string, localVarOptionals *LinksApiUpdateLinkTypeOpts) (LinkTypeSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue LinkTypeSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/link-types/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v LinkTypeSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +LinksApiService Update an existing link between transactions. +Used to update a single existing link. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or formdata with updated link type information. See the model for the exact specifications. + * @param id The ID of the transaction link. + * @param optional nil or *LinksApiUpdateTransactionLinkOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return TransactionLinkSingle +*/ + +type LinksApiUpdateTransactionLinkOpts struct { + XTraceId optional.Interface +} + +func (a *LinksApiService) UpdateTransactionLink(ctx context.Context, body TransactionLinkUpdate, id string, localVarOptionals *LinksApiUpdateTransactionLinkOpts) (TransactionLinkSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionLinkSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transaction-links/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionLinkSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_object_groups.go b/api_object_groups.go new file mode 100644 index 0000000..6746ca0 --- /dev/null +++ b/api_object_groups.go @@ -0,0 +1,865 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type ObjectGroupsApiService service + +/* +ObjectGroupsApiService Delete a object group. +Delete a object group. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the object group. + * @param optional nil or *ObjectGroupsApiDeleteObjectGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type ObjectGroupsApiDeleteObjectGroupOpts struct { + XTraceId optional.Interface +} + +func (a *ObjectGroupsApiService) DeleteObjectGroup(ctx context.Context, id string, localVarOptionals *ObjectGroupsApiDeleteObjectGroupOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/object-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +ObjectGroupsApiService Get a single object group. +Get a single object group. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the object group. + * @param optional nil or *ObjectGroupsApiGetObjectGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return ObjectGroupSingle +*/ + +type ObjectGroupsApiGetObjectGroupOpts struct { + XTraceId optional.Interface +} + +func (a *ObjectGroupsApiService) GetObjectGroup(ctx context.Context, id string, localVarOptionals *ObjectGroupsApiGetObjectGroupOpts) (ObjectGroupSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ObjectGroupSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/object-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ObjectGroupSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ObjectGroupsApiService List all bills with this object group. +List all bills with this object group. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the account. + * @param optional nil or *ObjectGroupsApiListBillByObjectGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return BillArray +*/ + +type ObjectGroupsApiListBillByObjectGroupOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *ObjectGroupsApiService) ListBillByObjectGroup(ctx context.Context, id string, localVarOptionals *ObjectGroupsApiListBillByObjectGroupOpts) (BillArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BillArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/object-groups/{id}/bills" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BillArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ObjectGroupsApiService List all oject groups. +List all oject groups. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *ObjectGroupsApiListObjectGroupsOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return ObjectGroupArray +*/ + +type ObjectGroupsApiListObjectGroupsOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *ObjectGroupsApiService) ListObjectGroups(ctx context.Context, localVarOptionals *ObjectGroupsApiListObjectGroupsOpts) (ObjectGroupArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ObjectGroupArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/object-groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ObjectGroupArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ObjectGroupsApiService List all piggy banks related to the object group. +This endpoint returns a list of all the piggy banks connected to the object group. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the account. + * @param optional nil or *ObjectGroupsApiListPiggyBankByObjectGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return PiggyBankArray +*/ + +type ObjectGroupsApiListPiggyBankByObjectGroupOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *ObjectGroupsApiService) ListPiggyBankByObjectGroup(ctx context.Context, id string, localVarOptionals *ObjectGroupsApiListPiggyBankByObjectGroupOpts) (PiggyBankArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PiggyBankArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/object-groups/{id}/piggy-banks" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v PiggyBankArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ObjectGroupsApiService Update existing object group. +Update existing object group. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated piggy bank information. See the model for the exact specifications. + * @param id The ID of the object group + * @param optional nil or *ObjectGroupsApiUpdateObjectGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return ObjectGroupSingle +*/ + +type ObjectGroupsApiUpdateObjectGroupOpts struct { + XTraceId optional.Interface +} + +func (a *ObjectGroupsApiService) UpdateObjectGroup(ctx context.Context, body ObjectGroupUpdate, id string, localVarOptionals *ObjectGroupsApiUpdateObjectGroupOpts) (ObjectGroupSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ObjectGroupSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/object-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ObjectGroupSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_piggy_banks.go b/api_piggy_banks.go new file mode 100644 index 0000000..fdcb6c7 --- /dev/null +++ b/api_piggy_banks.go @@ -0,0 +1,1012 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type PiggyBanksApiService service + +/* +PiggyBanksApiService Delete a piggy bank. +Delete a piggy bank. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the piggy bank. + * @param optional nil or *PiggyBanksApiDeletePiggyBankOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type PiggyBanksApiDeletePiggyBankOpts struct { + XTraceId optional.Interface +} + +func (a *PiggyBanksApiService) DeletePiggyBank(ctx context.Context, id string, localVarOptionals *PiggyBanksApiDeletePiggyBankOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/piggy-banks/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +PiggyBanksApiService Get a single piggy bank. +Get a single piggy bank. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the piggy bank. + * @param optional nil or *PiggyBanksApiGetPiggyBankOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return PiggyBankSingle +*/ + +type PiggyBanksApiGetPiggyBankOpts struct { + XTraceId optional.Interface +} + +func (a *PiggyBanksApiService) GetPiggyBank(ctx context.Context, id string, localVarOptionals *PiggyBanksApiGetPiggyBankOpts) (PiggyBankSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PiggyBankSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/piggy-banks/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v PiggyBankSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +PiggyBanksApiService Lists all attachments. +Lists all attachments. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the piggy bank. + * @param optional nil or *PiggyBanksApiListAttachmentByPiggyBankOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return AttachmentArray +*/ + +type PiggyBanksApiListAttachmentByPiggyBankOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *PiggyBanksApiService) ListAttachmentByPiggyBank(ctx context.Context, id string, localVarOptionals *PiggyBanksApiListAttachmentByPiggyBankOpts) (AttachmentArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachmentArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/piggy-banks/{id}/attachments" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v AttachmentArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +PiggyBanksApiService List all events linked to a piggy bank. +List all events linked to a piggy bank (adding and removing money). + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the piggy bank + * @param optional nil or *PiggyBanksApiListEventByPiggyBankOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return PiggyBankEventArray +*/ + +type PiggyBanksApiListEventByPiggyBankOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *PiggyBanksApiService) ListEventByPiggyBank(ctx context.Context, id string, localVarOptionals *PiggyBanksApiListEventByPiggyBankOpts) (PiggyBankEventArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PiggyBankEventArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/piggy-banks/{id}/events" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v PiggyBankEventArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +PiggyBanksApiService List all piggy banks. +List all piggy banks. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PiggyBanksApiListPiggyBankOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return PiggyBankArray +*/ + +type PiggyBanksApiListPiggyBankOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *PiggyBanksApiService) ListPiggyBank(ctx context.Context, localVarOptionals *PiggyBanksApiListPiggyBankOpts) (PiggyBankArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PiggyBankArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/piggy-banks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v PiggyBankArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +PiggyBanksApiService Store a new piggy bank +Creates a new piggy bank. The data required can be submitted as a JSON body or as a list of parameters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary piggy bank information. See the model for the exact specifications. + * @param optional nil or *PiggyBanksApiStorePiggyBankOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return PiggyBankSingle +*/ + +type PiggyBanksApiStorePiggyBankOpts struct { + XTraceId optional.Interface +} + +func (a *PiggyBanksApiService) StorePiggyBank(ctx context.Context, body PiggyBankStore, localVarOptionals *PiggyBanksApiStorePiggyBankOpts) (PiggyBankSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PiggyBankSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/piggy-banks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v PiggyBankSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +PiggyBanksApiService Update existing piggy bank. +Update existing piggy bank. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated piggy bank information. See the model for the exact specifications. + * @param id The ID of the piggy bank + * @param optional nil or *PiggyBanksApiUpdatePiggyBankOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return PiggyBankSingle +*/ + +type PiggyBanksApiUpdatePiggyBankOpts struct { + XTraceId optional.Interface +} + +func (a *PiggyBanksApiService) UpdatePiggyBank(ctx context.Context, body PiggyBankUpdate, id string, localVarOptionals *PiggyBanksApiUpdatePiggyBankOpts) (PiggyBankSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PiggyBankSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/piggy-banks/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v PiggyBankSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_preferences.go b/api_preferences.go new file mode 100644 index 0000000..3d1208b --- /dev/null +++ b/api_preferences.go @@ -0,0 +1,603 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type PreferencesApiService service + +/* +PreferencesApiService Return a single preference. +Return a single preference and the value. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The name of the preference. + * @param optional nil or *PreferencesApiGetPreferenceOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return PreferenceSingle +*/ + +type PreferencesApiGetPreferenceOpts struct { + XTraceId optional.Interface +} + +func (a *PreferencesApiService) GetPreference(ctx context.Context, name string, localVarOptionals *PreferencesApiGetPreferenceOpts) (PreferenceSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PreferenceSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/preferences/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v PreferenceSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +PreferencesApiService List all users preferences. +List all of the preferences of the user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PreferencesApiListPreferenceOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return PreferenceArray +*/ + +type PreferencesApiListPreferenceOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *PreferencesApiService) ListPreference(ctx context.Context, localVarOptionals *PreferencesApiListPreferenceOpts) (PreferenceArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PreferenceArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/preferences" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v PreferenceArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +PreferencesApiService Store a new preference for this user. +This endpoint creates a new preference. The name and data are free-format, and entirely up to you. If the preference is not used in Firefly III itself it may not be configurable through the user interface, but you can use this endpoint to persist custom data for your own app. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with the necessary preference information or key=value pairs. See the model for the exact specifications. + * @param optional nil or *PreferencesApiStorePreferenceOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return PreferenceSingle +*/ + +type PreferencesApiStorePreferenceOpts struct { + XTraceId optional.Interface +} + +func (a *PreferencesApiService) StorePreference(ctx context.Context, body Preference, localVarOptionals *PreferencesApiStorePreferenceOpts) (PreferenceSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PreferenceSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/preferences" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v PreferenceSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +PreferencesApiService Update preference +Update a user's preference. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary preference information. See the model for the exact specifications. + * @param name The name of the preference. Will always overwrite. Will be created if it does not exist. + * @param optional nil or *PreferencesApiUpdatePreferenceOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return PreferenceSingle +*/ + +type PreferencesApiUpdatePreferenceOpts struct { + XTraceId optional.Interface +} + +func (a *PreferencesApiService) UpdatePreference(ctx context.Context, body PreferenceUpdate, name string, localVarOptionals *PreferencesApiUpdatePreferenceOpts) (PreferenceSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PreferenceSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/preferences/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v PreferenceSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_recurrences.go b/api_recurrences.go new file mode 100644 index 0000000..ff7619b --- /dev/null +++ b/api_recurrences.go @@ -0,0 +1,881 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type RecurrencesApiService service + +/* +RecurrencesApiService Delete a recurring transaction. +Delete a recurring transaction. Transactions created by the recurring transaction will not be deleted. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the recurring transaction. + * @param optional nil or *RecurrencesApiDeleteRecurrenceOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type RecurrencesApiDeleteRecurrenceOpts struct { + XTraceId optional.Interface +} + +func (a *RecurrencesApiService) DeleteRecurrence(ctx context.Context, id string, localVarOptionals *RecurrencesApiDeleteRecurrenceOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/recurrences/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +RecurrencesApiService Get a single recurring transaction. +Get a single recurring transaction. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the recurring transaction. + * @param optional nil or *RecurrencesApiGetRecurrenceOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return RecurrenceSingle +*/ + +type RecurrencesApiGetRecurrenceOpts struct { + XTraceId optional.Interface +} + +func (a *RecurrencesApiService) GetRecurrence(ctx context.Context, id string, localVarOptionals *RecurrencesApiGetRecurrenceOpts) (RecurrenceSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RecurrenceSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/recurrences/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RecurrenceSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RecurrencesApiService List all recurring transactions. +List all recurring transactions. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *RecurrencesApiListRecurrenceOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return RecurrenceArray +*/ + +type RecurrencesApiListRecurrenceOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *RecurrencesApiService) ListRecurrence(ctx context.Context, localVarOptionals *RecurrencesApiListRecurrenceOpts) (RecurrenceArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RecurrenceArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/recurrences" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RecurrenceArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RecurrencesApiService List all transactions created by a recurring transaction. +List all transactions created by a recurring transaction, optionally limited to the date ranges specified. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the recurring transaction. + * @param optional nil or *RecurrencesApiListTransactionByRecurrenceOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD. Both the start and end date must be present. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD. Both the start and end date must be present. + * @param "Type_" (optional.Interface of TransactionTypeFilter) - Optional filter on the transaction type(s) returned +@return TransactionArray +*/ + +type RecurrencesApiListTransactionByRecurrenceOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String + Type_ optional.Interface +} + +func (a *RecurrencesApiService) ListTransactionByRecurrence(ctx context.Context, id string, localVarOptionals *RecurrencesApiListTransactionByRecurrenceOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/recurrences/{id}/transactions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RecurrencesApiService Store a new recurring transaction +Creates a new recurring transaction. The data required can be submitted as a JSON body or as a list of parameters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary recurring transaction information. See the model for the exact specifications. + * @param optional nil or *RecurrencesApiStoreRecurrenceOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return RecurrenceSingle +*/ + +type RecurrencesApiStoreRecurrenceOpts struct { + XTraceId optional.Interface +} + +func (a *RecurrencesApiService) StoreRecurrence(ctx context.Context, body RecurrenceStore, localVarOptionals *RecurrencesApiStoreRecurrenceOpts) (RecurrenceSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RecurrenceSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/recurrences" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RecurrenceSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RecurrencesApiService Update existing recurring transaction. +Update existing recurring transaction. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated recurring transaction information. See the model for the exact specifications. + * @param id The ID of the recurring transaction. + * @param optional nil or *RecurrencesApiUpdateRecurrenceOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return RecurrenceSingle +*/ + +type RecurrencesApiUpdateRecurrenceOpts struct { + XTraceId optional.Interface +} + +func (a *RecurrencesApiService) UpdateRecurrence(ctx context.Context, body RecurrenceUpdate, id string, localVarOptionals *RecurrencesApiUpdateRecurrenceOpts) (RecurrenceSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RecurrenceSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/recurrences/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RecurrenceSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_rule_groups.go b/api_rule_groups.go new file mode 100644 index 0000000..a713fde --- /dev/null +++ b/api_rule_groups.go @@ -0,0 +1,1169 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type RuleGroupsApiService service + +/* +RuleGroupsApiService Delete a rule group. +Delete a rule group. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the rule group. + * @param optional nil or *RuleGroupsApiDeleteRuleGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type RuleGroupsApiDeleteRuleGroupOpts struct { + XTraceId optional.Interface +} + +func (a *RuleGroupsApiService) DeleteRuleGroup(ctx context.Context, id string, localVarOptionals *RuleGroupsApiDeleteRuleGroupOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rule-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +RuleGroupsApiService Fire the rule group on your transactions. +Fire the rule group on your transactions. Changes will be made by the rules in the rule group! Limit the result if you want to. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the rule group. + * @param optional nil or *RuleGroupsApiFireRuleGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD, to limit the transactions the actions will be applied to. Both the start date and the end date must be present. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD, to limit the transactions the actions will be applied to. Both the start date and the end date must be present. + * @param "Accounts" (optional.Interface of []int64) - Limit the triggering of the rule group to these asset accounts or liabilities. Only asset accounts and liabilities will be accepted. Other types will be silently dropped. + +*/ + +type RuleGroupsApiFireRuleGroupOpts struct { + XTraceId optional.Interface + Start optional.String + End optional.String + Accounts optional.Interface +} + +func (a *RuleGroupsApiService) FireRuleGroup(ctx context.Context, id string, localVarOptionals *RuleGroupsApiFireRuleGroupOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rule-groups/{id}/trigger" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +RuleGroupsApiService Get a single rule group. +Get a single rule group. This does not include the rules. For that, see below. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the rule group. + * @param optional nil or *RuleGroupsApiGetRuleGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return RuleGroupSingle +*/ + +type RuleGroupsApiGetRuleGroupOpts struct { + XTraceId optional.Interface +} + +func (a *RuleGroupsApiService) GetRuleGroup(ctx context.Context, id string, localVarOptionals *RuleGroupsApiGetRuleGroupOpts) (RuleGroupSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RuleGroupSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rule-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RuleGroupSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RuleGroupsApiService List rules in this rule group. +List rules in this rule group. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the rule group. + * @param optional nil or *RuleGroupsApiListRuleByGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return RuleArray +*/ + +type RuleGroupsApiListRuleByGroupOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *RuleGroupsApiService) ListRuleByGroup(ctx context.Context, id string, localVarOptionals *RuleGroupsApiListRuleByGroupOpts) (RuleArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RuleArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rule-groups/{id}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RuleArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RuleGroupsApiService List all rule groups. +List all rule groups. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *RuleGroupsApiListRuleGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return RuleGroupArray +*/ + +type RuleGroupsApiListRuleGroupOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *RuleGroupsApiService) ListRuleGroup(ctx context.Context, localVarOptionals *RuleGroupsApiListRuleGroupOpts) (RuleGroupArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RuleGroupArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rule-groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RuleGroupArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RuleGroupsApiService Store a new rule group. +Creates a new rule group. The data required can be submitted as a JSON body or as a list of parameters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary rule group information. See the model for the exact specifications. + * @param optional nil or *RuleGroupsApiStoreRuleGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return RuleGroupSingle +*/ + +type RuleGroupsApiStoreRuleGroupOpts struct { + XTraceId optional.Interface +} + +func (a *RuleGroupsApiService) StoreRuleGroup(ctx context.Context, body RuleGroupStore, localVarOptionals *RuleGroupsApiStoreRuleGroupOpts) (RuleGroupSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RuleGroupSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rule-groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RuleGroupSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RuleGroupsApiService Test which transactions would be hit by the rule group. No changes will be made. +Test which transactions would be hit by the rule group. No changes will be made. Limit the result if you want to. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the rule group. + * @param optional nil or *RuleGroupsApiTestRuleGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD, to limit the transactions the test will be applied to. Both the start date and the end date must be present. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD, to limit the transactions the test will be applied to. Both the start date and the end date must be present. + * @param "SearchLimit" (optional.Int32) - Maximum number of transactions Firefly III will try. Don't set this too high, or it will take Firefly III very long to run the test. I suggest a max of 200. + * @param "TriggeredLimit" (optional.Int32) - Maximum number of transactions the rule group can actually trigger on, before Firefly III stops. I would suggest setting this to 10 or 15. Don't go above the user's page size, because browsing to page 2 or 3 of a test result would fire the test again, making any navigation efforts very slow. + * @param "Accounts" (optional.Interface of []int64) - Limit the testing of the rule group to these asset accounts or liabilities. Only asset accounts and liabilities will be accepted. Other types will be silently dropped. +@return TransactionArray +*/ + +type RuleGroupsApiTestRuleGroupOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String + SearchLimit optional.Int32 + TriggeredLimit optional.Int32 + Accounts optional.Interface +} + +func (a *RuleGroupsApiService) TestRuleGroup(ctx context.Context, id string, localVarOptionals *RuleGroupsApiTestRuleGroupOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rule-groups/{id}/test" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SearchLimit.IsSet() { + localVarQueryParams.Add("search_limit", parameterToString(localVarOptionals.SearchLimit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TriggeredLimit.IsSet() { + localVarQueryParams.Add("triggered_limit", parameterToString(localVarOptionals.TriggeredLimit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RuleGroupsApiService Update existing rule group. +Update existing rule group. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated rule group information. See the model for the exact specifications. + * @param id The ID of the rule group. + * @param optional nil or *RuleGroupsApiUpdateRuleGroupOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return RuleGroupSingle +*/ + +type RuleGroupsApiUpdateRuleGroupOpts struct { + XTraceId optional.Interface +} + +func (a *RuleGroupsApiService) UpdateRuleGroup(ctx context.Context, body RuleGroupUpdate, id string, localVarOptionals *RuleGroupsApiUpdateRuleGroupOpts) (RuleGroupSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RuleGroupSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rule-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RuleGroupSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_rules.go b/api_rules.go new file mode 100644 index 0000000..582a481 --- /dev/null +++ b/api_rules.go @@ -0,0 +1,1003 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type RulesApiService service + +/* +RulesApiService Delete an rule. +Delete an rule. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the rule. + * @param optional nil or *RulesApiDeleteRuleOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type RulesApiDeleteRuleOpts struct { + XTraceId optional.Interface +} + +func (a *RulesApiService) DeleteRule(ctx context.Context, id string, localVarOptionals *RulesApiDeleteRuleOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +RulesApiService Fire the rule on your transactions. +Fire the rule group on your transactions. Changes will be made by the rules in the group! Limit the result if you want to. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the rule. + * @param optional nil or *RulesApiFireRuleOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD, to limit the transactions the actions will be applied to. If the start date is not present, it will be set to one year ago. If you use this field, both the start date and the end date must be present. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD, to limit the transactions the actions will be applied to. If the end date is not present, it will be set to today. If you use this field, both the start date and the end date must be present. + * @param "Accounts" (optional.Interface of []int64) - Limit the triggering of the rule to these asset accounts or liabilities. Only asset accounts and liabilities will be accepted. Other types will be silently dropped. + +*/ + +type RulesApiFireRuleOpts struct { + XTraceId optional.Interface + Start optional.String + End optional.String + Accounts optional.Interface +} + +func (a *RulesApiService) FireRule(ctx context.Context, id string, localVarOptionals *RulesApiFireRuleOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rules/{id}/trigger" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +RulesApiService Get a single rule. +Get a single rule. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the object. + * @param optional nil or *RulesApiGetRuleOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return RuleSingle +*/ + +type RulesApiGetRuleOpts struct { + XTraceId optional.Interface +} + +func (a *RulesApiService) GetRule(ctx context.Context, id string, localVarOptionals *RulesApiGetRuleOpts) (RuleSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RuleSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RuleSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RulesApiService List all rules. +List all rules. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *RulesApiListRuleOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return RuleArray +*/ + +type RulesApiListRuleOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *RulesApiService) ListRule(ctx context.Context, localVarOptionals *RulesApiListRuleOpts) (RuleArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RuleArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RuleArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RulesApiService Store a new rule +Creates a new rule. The data required can be submitted as a JSON body or as a list of parameters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary rule information. See the model for the exact specifications. + * @param optional nil or *RulesApiStoreRuleOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return RuleSingle +*/ + +type RulesApiStoreRuleOpts struct { + XTraceId optional.Interface +} + +func (a *RulesApiService) StoreRule(ctx context.Context, body RuleStore, localVarOptionals *RulesApiStoreRuleOpts) (RuleSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RuleSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RuleSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RulesApiService Test which transactions would be hit by the rule. No changes will be made. +Test which transactions would be hit by the rule. No changes will be made. Limit the result if you want to. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the rule. + * @param optional nil or *RulesApiTestRuleOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD, to limit the transactions the test will be applied to. Both the start date and the end date must be present. + * @param "End" (optional.String) - A date formatted YYYY-MM-DD, to limit the transactions the test will be applied to. Both the start date and the end date must be present. + * @param "Accounts" (optional.Interface of []int64) - Limit the testing of the rule to these asset accounts or liabilities. Only asset accounts and liabilities will be accepted. Other types will be silently dropped. +@return TransactionArray +*/ + +type RulesApiTestRuleOpts struct { + XTraceId optional.Interface + Start optional.String + End optional.String + Accounts optional.Interface +} + +func (a *RulesApiService) TestRule(ctx context.Context, id string, localVarOptionals *RulesApiTestRuleOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rules/{id}/test" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Accounts.IsSet() { + localVarQueryParams.Add("accounts[]", parameterToString(localVarOptionals.Accounts.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +RulesApiService Update existing rule. +Update existing rule. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated rule information. See the model for the exact specifications. + * @param id The ID of the object. + * @param optional nil or *RulesApiUpdateRuleOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return RuleSingle +*/ + +type RulesApiUpdateRuleOpts struct { + XTraceId optional.Interface +} + +func (a *RulesApiService) UpdateRule(ctx context.Context, body RuleUpdate, id string, localVarOptionals *RulesApiUpdateRuleOpts) (RuleSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RuleSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RuleSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_search.go b/api_search.go new file mode 100644 index 0000000..1193c22 --- /dev/null +++ b/api_search.go @@ -0,0 +1,325 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type SearchApiService service + +/* +SearchApiService Search for accounts +Search for accounts + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param query The query you wish to search for. + * @param field The account field(s) you want to search in. + * @param optional nil or *SearchApiSearchAccountsOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Type_" (optional.Interface of AccountTypeFilter) - The type of accounts you wish to limit the search to. +@return AccountArray +*/ + +type SearchApiSearchAccountsOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Type_ optional.Interface +} + +func (a *SearchApiService) SearchAccounts(ctx context.Context, query string, field AccountSearchFieldFilter, localVarOptionals *SearchApiSearchAccountsOpts) (AccountArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccountArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/search/accounts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + localVarQueryParams.Add("query", parameterToString(query, "")) + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + localVarQueryParams.Add("field", parameterToString(field, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v AccountArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +SearchApiService Search for transactions +Searches through the users transactions. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param query The query you wish to search for. + * @param optional nil or *SearchApiSearchTransactionsOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return TransactionArray +*/ + +type SearchApiSearchTransactionsOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *SearchApiService) SearchTransactions(ctx context.Context, query string, localVarOptionals *SearchApiSearchTransactionsOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/search/transactions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + localVarQueryParams.Add("query", parameterToString(query, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_summary.go b/api_summary.go new file mode 100644 index 0000000..7ed104d --- /dev/null +++ b/api_summary.go @@ -0,0 +1,169 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type SummaryApiService service + +/* +SummaryApiService Returns basic sums of the users data. +Returns basic sums of the users data, like the net worth, spent and earned amounts. It is multi-currency, and is used in Firefly III to populate the dashboard. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param start A date formatted YYYY-MM-DD. + * @param end A date formatted YYYY-MM-DD. + * @param optional nil or *SummaryApiGetBasicSummaryOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "CurrencyCode" (optional.String) - A currency code like EUR or USD, to filter the result. +@return map[string]BasicSummaryEntry +*/ + +type SummaryApiGetBasicSummaryOpts struct { + XTraceId optional.Interface + CurrencyCode optional.String +} + +func (a *SummaryApiService) GetBasicSummary(ctx context.Context, start string, end string, localVarOptionals *SummaryApiGetBasicSummaryOpts) (map[string]BasicSummaryEntry, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]BasicSummaryEntry + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/summary/basic" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("start", parameterToString(start, "")) + localVarQueryParams.Add("end", parameterToString(end, "")) + if localVarOptionals != nil && localVarOptionals.CurrencyCode.IsSet() { + localVarQueryParams.Add("currency_code", parameterToString(localVarOptionals.CurrencyCode.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v map[string]BasicSummaryEntry + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_tags.go b/api_tags.go new file mode 100644 index 0000000..78a8d29 --- /dev/null +++ b/api_tags.go @@ -0,0 +1,1037 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type TagsApiService service + +/* +TagsApiService Delete an tag. +Delete an tag. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param tag Either the tag itself or the tag ID. If you use the tag itself, and it contains international (non-ASCII) characters, your milage may vary. + * @param optional nil or *TagsApiDeleteTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type TagsApiDeleteTagOpts struct { + XTraceId optional.Interface +} + +func (a *TagsApiService) DeleteTag(ctx context.Context, tag string, localVarOptionals *TagsApiDeleteTagOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/tags/{tag}" + localVarPath = strings.Replace(localVarPath, "{"+"tag"+"}", fmt.Sprintf("%v", tag), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +TagsApiService Get a single tag. +Get a single tag. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param tag Either the tag itself or the tag ID. If you use the tag itself, and it contains international (non-ASCII) characters, your milage may vary. + * @param optional nil or *TagsApiGetTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return TagSingle +*/ + +type TagsApiGetTagOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *TagsApiService) GetTag(ctx context.Context, tag string, localVarOptionals *TagsApiGetTagOpts) (TagSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TagSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/tags/{tag}" + localVarPath = strings.Replace(localVarPath, "{"+"tag"+"}", fmt.Sprintf("%v", tag), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TagSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TagsApiService Lists all attachments. +Lists all attachments. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param tag Either the tag itself or the tag ID. + * @param optional nil or *TagsApiListAttachmentByTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return AttachmentArray +*/ + +type TagsApiListAttachmentByTagOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *TagsApiService) ListAttachmentByTag(ctx context.Context, tag string, localVarOptionals *TagsApiListAttachmentByTagOpts) (AttachmentArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachmentArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/tags/{tag}/attachments" + localVarPath = strings.Replace(localVarPath, "{"+"tag"+"}", fmt.Sprintf("%v", tag), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v AttachmentArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TagsApiService List all tags. +List all of the user's tags. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *TagsApiListTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return TagArray +*/ + +type TagsApiListTagOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *TagsApiService) ListTag(ctx context.Context, localVarOptionals *TagsApiListTagOpts) (TagArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TagArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/tags" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TagArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TagsApiService List all transactions with this tag. +List all transactions with this tag. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param tag Either the tag itself or the tag ID. + * @param optional nil or *TagsApiListTransactionByTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD. This is the start date of the selected range (inclusive). + * @param "End" (optional.String) - A date formatted YYYY-MM-DD. This is the end date of the selected range (inclusive). + * @param "Type_" (optional.Interface of TransactionTypeFilter) - Optional filter on the transaction type(s) returned. +@return TransactionArray +*/ + +type TagsApiListTransactionByTagOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String + Type_ optional.Interface +} + +func (a *TagsApiService) ListTransactionByTag(ctx context.Context, tag string, localVarOptionals *TagsApiListTransactionByTagOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/tags/{tag}/transactions" + localVarPath = strings.Replace(localVarPath, "{"+"tag"+"}", fmt.Sprintf("%v", tag), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TagsApiService Store a new tag +Creates a new tag. The data required can be submitted as a JSON body or as a list of parameters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary tag information. See the model for the exact specifications. + * @param optional nil or *TagsApiStoreTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return TagSingle +*/ + +type TagsApiStoreTagOpts struct { + XTraceId optional.Interface +} + +func (a *TagsApiService) StoreTag(ctx context.Context, body TagModelStore, localVarOptionals *TagsApiStoreTagOpts) (TagSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TagSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/tags" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TagSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TagsApiService Update existing tag. +Update existing tag. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated tag information. See the model for the exact specifications. + * @param tag Either the tag itself or the tag ID. If you use the tag itself, and it contains international (non-ASCII) characters, your milage may vary. + * @param optional nil or *TagsApiUpdateTagOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return TagSingle +*/ + +type TagsApiUpdateTagOpts struct { + XTraceId optional.Interface +} + +func (a *TagsApiService) UpdateTag(ctx context.Context, body TagModelUpdate, tag string, localVarOptionals *TagsApiUpdateTagOpts) (TagSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TagSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/tags/{tag}" + localVarPath = strings.Replace(localVarPath, "{"+"tag"+"}", fmt.Sprintf("%v", tag), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TagSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_transactions.go b/api_transactions.go new file mode 100644 index 0000000..36af51e --- /dev/null +++ b/api_transactions.go @@ -0,0 +1,1426 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type TransactionsApiService service + +/* +TransactionsApiService Delete a transaction. +Delete a transaction. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the transaction. + * @param optional nil or *TransactionsApiDeleteTransactionOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type TransactionsApiDeleteTransactionOpts struct { + XTraceId optional.Interface +} + +func (a *TransactionsApiService) DeleteTransaction(ctx context.Context, id string, localVarOptionals *TransactionsApiDeleteTransactionOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transactions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +TransactionsApiService Delete split from transaction +Delete an individual journal (split) from a transaction. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the transaction journal (the split) you wish to delete. + * @param optional nil or *TransactionsApiDeleteTransactionJournalOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type TransactionsApiDeleteTransactionJournalOpts struct { + XTraceId optional.Interface +} + +func (a *TransactionsApiService) DeleteTransactionJournal(ctx context.Context, id string, localVarOptionals *TransactionsApiDeleteTransactionJournalOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transaction-journals/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +TransactionsApiService Get a single transaction. +Get a single transaction. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the transaction. + * @param optional nil or *TransactionsApiGetTransactionOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return TransactionSingle +*/ + +type TransactionsApiGetTransactionOpts struct { + XTraceId optional.Interface +} + +func (a *TransactionsApiService) GetTransaction(ctx context.Context, id string, localVarOptionals *TransactionsApiGetTransactionOpts) (TransactionSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transactions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TransactionsApiService Get a single transaction, based on one of the underlying transaction journals (transaction splits). +Get a single transaction by underlying journal (split). + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the transaction journal (split). + * @param optional nil or *TransactionsApiGetTransactionByJournalOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return TransactionSingle +*/ + +type TransactionsApiGetTransactionByJournalOpts struct { + XTraceId optional.Interface +} + +func (a *TransactionsApiService) GetTransactionByJournal(ctx context.Context, id string, localVarOptionals *TransactionsApiGetTransactionByJournalOpts) (TransactionSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transaction-journals/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TransactionsApiService Lists all attachments. +Lists all attachments. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the transaction. + * @param optional nil or *TransactionsApiListAttachmentByTransactionOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return AttachmentArray +*/ + +type TransactionsApiListAttachmentByTransactionOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *TransactionsApiService) ListAttachmentByTransaction(ctx context.Context, id string, localVarOptionals *TransactionsApiListAttachmentByTransactionOpts) (AttachmentArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AttachmentArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transactions/{id}/attachments" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v AttachmentArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TransactionsApiService Lists all piggy bank events. +Lists all piggy bank events. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the transaction. + * @param optional nil or *TransactionsApiListEventByTransactionOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return PiggyBankEventArray +*/ + +type TransactionsApiListEventByTransactionOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *TransactionsApiService) ListEventByTransaction(ctx context.Context, id string, localVarOptionals *TransactionsApiListEventByTransactionOpts) (PiggyBankEventArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PiggyBankEventArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transactions/{id}/piggy-bank-events" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v PiggyBankEventArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TransactionsApiService Lists all the transaction links for an individual journal (individual split). +Lists all the transaction links for an individual journal (a split). Don't use the group ID, you need the actual underlying journal (the split). + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the transaction journal / the split. + * @param optional nil or *TransactionsApiListLinksByJournalOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return TransactionLinkArray +*/ + +type TransactionsApiListLinksByJournalOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *TransactionsApiService) ListLinksByJournal(ctx context.Context, id string, localVarOptionals *TransactionsApiListLinksByJournalOpts) (TransactionLinkArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionLinkArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transaction-journals/{id}/links" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionLinkArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TransactionsApiService List all the user's transactions. +List all the user's transactions. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *TransactionsApiListTransactionOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. + * @param "Start" (optional.String) - A date formatted YYYY-MM-DD. This is the start date of the selected range (inclusive). + * @param "End" (optional.String) - A date formatted YYYY-MM-DD. This is the end date of the selected range (inclusive). + * @param "Type_" (optional.Interface of TransactionTypeFilter) - Optional filter on the transaction type(s) returned. +@return TransactionArray +*/ + +type TransactionsApiListTransactionOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 + Start optional.String + End optional.String + Type_ optional.Interface +} + +func (a *TransactionsApiService) ListTransaction(ctx context.Context, localVarOptionals *TransactionsApiListTransactionOpts) (TransactionArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transactions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.End.IsSet() { + localVarQueryParams.Add("end", parameterToString(localVarOptionals.End.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TransactionsApiService Store a new transaction +Creates a new transaction. The data required can be submitted as a JSON body or as a list of parameters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary transaction information. See the model for the exact specifications. + * @param optional nil or *TransactionsApiStoreTransactionOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return TransactionSingle +*/ + +type TransactionsApiStoreTransactionOpts struct { + XTraceId optional.Interface +} + +func (a *TransactionsApiService) StoreTransaction(ctx context.Context, body TransactionStore, localVarOptionals *TransactionsApiStoreTransactionOpts) (TransactionSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transactions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +TransactionsApiService Update existing transaction. For more information, see https://docs.firefly-iii.org/references/firefly-iii/api/specials/ +Update an existing transaction. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated transaction information. See the model for the exact specifications. + * @param id The ID of the transaction. + * @param optional nil or *TransactionsApiUpdateTransactionOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return TransactionSingle +*/ + +type TransactionsApiUpdateTransactionOpts struct { + XTraceId optional.Interface +} + +func (a *TransactionsApiService) UpdateTransaction(ctx context.Context, body TransactionUpdate, id string, localVarOptionals *TransactionsApiUpdateTransactionOpts) (TransactionSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue TransactionSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/transactions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v TransactionSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_users.go b/api_users.go new file mode 100644 index 0000000..4a1dae4 --- /dev/null +++ b/api_users.go @@ -0,0 +1,720 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type UsersApiService service + +/* +UsersApiService Delete a user. +Delete a user. You cannot delete the user you're authenticated with. This cannot be undone. Be careful! + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The user ID. + * @param optional nil or *UsersApiDeleteUserOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type UsersApiDeleteUserOpts struct { + XTraceId optional.Interface +} + +func (a *UsersApiService) DeleteUser(ctx context.Context, id string, localVarOptionals *UsersApiDeleteUserOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/users/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +UsersApiService Get a single user. +Gets all info of a single user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The user ID. + * @param optional nil or *UsersApiGetUserOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return UserSingle +*/ + +type UsersApiGetUserOpts struct { + XTraceId optional.Interface +} + +func (a *UsersApiService) GetUser(ctx context.Context, id string, localVarOptionals *UsersApiGetUserOpts) (UserSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue UserSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/users/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v UserSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +UsersApiService List all users. +List all the users in this instance of Firefly III. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *UsersApiListUserOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return UserArray +*/ + +type UsersApiListUserOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *UsersApiService) ListUser(ctx context.Context, localVarOptionals *UsersApiListUserOpts) (UserArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue UserArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v UserArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +UsersApiService Store a new user +Creates a new user. The data required can be submitted as a JSON body or as a list of parameters. The user will be given a random password, which they can reset using the \"forgot password\" function. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary user information. See the model for the exact specifications. + * @param optional nil or *UsersApiStoreUserOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return UserSingle +*/ + +type UsersApiStoreUserOpts struct { + XTraceId optional.Interface +} + +func (a *UsersApiService) StoreUser(ctx context.Context, body User, localVarOptionals *UsersApiStoreUserOpts) (UserSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue UserSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/vnd.firefly3+json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 200 { + var v UserSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +UsersApiService Update an existing user's information. +Update existing user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated user information. See the model for the exact specifications. + * @param id The user ID. + * @param optional nil or *UsersApiUpdateUserOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return UserSingle +*/ + +type UsersApiUpdateUserOpts struct { + XTraceId optional.Interface +} + +func (a *UsersApiService) UpdateUser(ctx context.Context, body User, id string, localVarOptionals *UsersApiUpdateUserOpts) (UserSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue UserSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/users/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v UserSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/api_webhooks.go b/api_webhooks.go new file mode 100644 index 0000000..c936d0a --- /dev/null +++ b/api_webhooks.go @@ -0,0 +1,1678 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "context" + "fmt" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type WebhooksApiService service + +/* +WebhooksApiService Delete a webhook. +Delete a webhook. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The webhook ID. + * @param optional nil or *WebhooksApiDeleteWebhookOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type WebhooksApiDeleteWebhookOpts struct { + XTraceId optional.Interface +} + +func (a *WebhooksApiService) DeleteWebhook(ctx context.Context, id string, localVarOptionals *WebhooksApiDeleteWebhookOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +WebhooksApiService Delete a webhook message. +Delete a webhook message. Any time a webhook is triggered the message is stored before it's sent. You can delete them before or after sending. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The webhook ID. + * @param messageId The webhook message ID. + * @param optional nil or *WebhooksApiDeleteWebhookMessageOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type WebhooksApiDeleteWebhookMessageOpts struct { + XTraceId optional.Interface +} + +func (a *WebhooksApiService) DeleteWebhookMessage(ctx context.Context, id string, messageId int32, localVarOptionals *WebhooksApiDeleteWebhookMessageOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks/{id}/messages/{messageId}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"messageId"+"}", fmt.Sprintf("%v", messageId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +WebhooksApiService Delete a webhook attempt. +Delete a webhook message attempt. If you delete all attempts for a webhook message, Firefly III will (once again) assume all is well with the webhook message and will try to send it again. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The webhook ID. + * @param messageId The webhook message ID. + * @param attemptId The webhook message attempt ID. + * @param optional nil or *WebhooksApiDeleteWebhookMessageAttemptOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type WebhooksApiDeleteWebhookMessageAttemptOpts struct { + XTraceId optional.Interface +} + +func (a *WebhooksApiService) DeleteWebhookMessageAttempt(ctx context.Context, id string, messageId int32, attemptId int32, localVarOptionals *WebhooksApiDeleteWebhookMessageAttemptOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks/{id}/messages/{messageId}/attempts/{attemptId}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"messageId"+"}", fmt.Sprintf("%v", messageId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"attemptId"+"}", fmt.Sprintf("%v", attemptId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +WebhooksApiService Get a single message from a webhook. +When a webhook is triggered it will store the actual content of the webhook in a webhook message. You can view and analyse a single one using this endpoint. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The webhook ID. + * @param messageId The webhook message ID. + * @param optional nil or *WebhooksApiGetSingleWebhookMessageOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return WebhookMessageSingle +*/ + +type WebhooksApiGetSingleWebhookMessageOpts struct { + XTraceId optional.Interface +} + +func (a *WebhooksApiService) GetSingleWebhookMessage(ctx context.Context, id string, messageId int32, localVarOptionals *WebhooksApiGetSingleWebhookMessageOpts) (WebhookMessageSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue WebhookMessageSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks/{id}/messages/{messageId}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"messageId"+"}", fmt.Sprintf("%v", messageId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v WebhookMessageSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +WebhooksApiService Get a single failed attempt from a single webhook message. +When a webhook message fails to send it will store the failure in an \"attempt\". You can view and analyse these. Webhooks messages that receive too many attempts (failures) will not be fired. You must first clear out old attempts and try again. This endpoint shows you the details of a single attempt. The ID of the attempt must match the corresponding webhook and webhook message. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The webhook ID. + * @param messageId The webhook message ID. + * @param attemptId The webhook attempt ID. + * @param optional nil or *WebhooksApiGetSingleWebhookMessageAttemptOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return WebhookAttemptSingle +*/ + +type WebhooksApiGetSingleWebhookMessageAttemptOpts struct { + XTraceId optional.Interface +} + +func (a *WebhooksApiService) GetSingleWebhookMessageAttempt(ctx context.Context, id string, messageId int32, attemptId int32, localVarOptionals *WebhooksApiGetSingleWebhookMessageAttemptOpts) (WebhookAttemptSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue WebhookAttemptSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks/{id}/messages/{messageId}/attempts/{attemptId}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"messageId"+"}", fmt.Sprintf("%v", messageId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"attemptId"+"}", fmt.Sprintf("%v", attemptId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v WebhookAttemptSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +WebhooksApiService Get a single webhook. +Gets all info of a single webhook. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The webhook ID. + * @param optional nil or *WebhooksApiGetWebhookOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return WebhookSingle +*/ + +type WebhooksApiGetWebhookOpts struct { + XTraceId optional.Interface +} + +func (a *WebhooksApiService) GetWebhook(ctx context.Context, id string, localVarOptionals *WebhooksApiGetWebhookOpts) (WebhookSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue WebhookSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v WebhookSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +WebhooksApiService Get all the failed attempts of a single webhook message. +When a webhook message fails to send it will store the failure in an \"attempt\". You can view and analyse these. Webhook messages that receive too many attempts (failures) will not be sent again. You must first clear out old attempts before the message can go out again. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The webhook ID. + * @param messageId The webhook message ID. + * @param optional nil or *WebhooksApiGetWebhookMessageAttemptsOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return WebhookAttemptArray +*/ + +type WebhooksApiGetWebhookMessageAttemptsOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *WebhooksApiService) GetWebhookMessageAttempts(ctx context.Context, id string, messageId int32, localVarOptionals *WebhooksApiGetWebhookMessageAttemptsOpts) (WebhookAttemptArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue WebhookAttemptArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks/{id}/messages/{messageId}/attempts" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"messageId"+"}", fmt.Sprintf("%v", messageId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v WebhookAttemptArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +WebhooksApiService Get all the messages of a single webhook. +When a webhook is triggered the actual message that will be send is stored in a \"message\". You can view and analyse these messages. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The webhook ID. + * @param optional nil or *WebhooksApiGetWebhookMessagesOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return WebhookMessageArray +*/ + +type WebhooksApiGetWebhookMessagesOpts struct { + XTraceId optional.Interface +} + +func (a *WebhooksApiService) GetWebhookMessages(ctx context.Context, id string, localVarOptionals *WebhooksApiGetWebhookMessagesOpts) (WebhookMessageArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue WebhookMessageArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks/{id}/messages" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v WebhookMessageArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +WebhooksApiService List all webhooks. +List all the user's webhooks. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *WebhooksApiListWebhookOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + * @param "Limit" (optional.Int32) - Number of items per page. The default pagination is per 50 items. + * @param "Page" (optional.Int32) - Page number. The default pagination is per 50 items. +@return WebhookArray +*/ + +type WebhooksApiListWebhookOpts struct { + XTraceId optional.Interface + Limit optional.Int32 + Page optional.Int32 +} + +func (a *WebhooksApiService) ListWebhook(ctx context.Context, localVarOptionals *WebhooksApiListWebhookOpts) (WebhookArray, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue WebhookArray + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v WebhookArray + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +WebhooksApiService Store a new webhook +Creates a new webhook. The data required can be submitted as a JSON body or as a list of parameters. The webhook will be given a random secret. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array or key=value pairs with the necessary webhook information. See the model for the exact specifications. + * @param optional nil or *WebhooksApiStoreWebhookOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return WebhookSingle +*/ + +type WebhooksApiStoreWebhookOpts struct { + XTraceId optional.Interface +} + +func (a *WebhooksApiService) StoreWebhook(ctx context.Context, body WebhookStore, localVarOptionals *WebhooksApiStoreWebhookOpts) (WebhookSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue WebhookSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v WebhookSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +WebhooksApiService Submit messages for a webhook. +This endpoint will submit any open messages for this webhook. This is an asynchronous operation, so you can't see the result. Refresh the webhook message and/or the webhook message attempts to see the results. This may take some time if the webhook receiver is slow. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The webhook ID. + * @param optional nil or *WebhooksApiSubmitWebookOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type WebhooksApiSubmitWebookOpts struct { + XTraceId optional.Interface +} + +func (a *WebhooksApiService) SubmitWebook(ctx context.Context, id string, localVarOptionals *WebhooksApiSubmitWebookOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks/{id}/submit" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +WebhooksApiService Trigger webhook for a given transaction. +This endpoint will execute this webhook for a given transaction ID. This is an asynchronous operation, so you can't see the result. Refresh the webhook message and/or the webhook message attempts to see the results. This may take some time if the webhook receiver is slow. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The webhook ID. + * @param transactionId The transaction ID. + * @param optional nil or *WebhooksApiTriggerTransactionWebhookOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. + +*/ + +type WebhooksApiTriggerTransactionWebhookOpts struct { + XTraceId optional.Interface +} + +func (a *WebhooksApiService) TriggerTransactionWebhook(ctx context.Context, id string, transactionId string, localVarOptionals *WebhooksApiTriggerTransactionWebhookOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks/{id}/trigger-transaction/{transactionId}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"transactionId"+"}", fmt.Sprintf("%v", transactionId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +WebhooksApiService Update existing webhook. +Update an existing webhook's information. If you wish to reset the secret, submit any value as the \"secret\". Firefly III will take this as a hint and reset the secret of the webhook. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body JSON array with updated webhook information. See the model for the exact specifications. + * @param id The webhook ID. + * @param optional nil or *WebhooksApiUpdateWebhookOpts - Optional Parameters: + * @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request. +@return WebhookSingle +*/ + +type WebhooksApiUpdateWebhookOpts struct { + XTraceId optional.Interface +} + +func (a *WebhooksApiService) UpdateWebhook(ctx context.Context, body WebhookUpdate, id string, localVarOptionals *WebhooksApiUpdateWebhookOpts) (WebhookSingle, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue WebhookSingle + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/webhooks/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/vnd.firefly3+json", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() { + localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v WebhookSingle + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v ValidationErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v UnauthenticatedResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v NotFoundResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v BadRequestResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InternalExceptionResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/client.go b/client.go new file mode 100644 index 0000000..1a079cf --- /dev/null +++ b/client.go @@ -0,0 +1,549 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") + xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") +) + +// APIClient manages communication with the Firefly III API v2.0.12 API v2.0.12 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + AboutApi *AboutApiService + + AccountsApi *AccountsApiService + + AttachmentsApi *AttachmentsApiService + + AutocompleteApi *AutocompleteApiService + + AvailableBudgetsApi *AvailableBudgetsApiService + + BillsApi *BillsApiService + + BudgetsApi *BudgetsApiService + + CategoriesApi *CategoriesApiService + + ChartsApi *ChartsApiService + + ConfigurationApi *ConfigurationApiService + + CurrenciesApi *CurrenciesApiService + + DataApi *DataApiService + + InsightApi *InsightApiService + + LinksApi *LinksApiService + + ObjectGroupsApi *ObjectGroupsApiService + + PiggyBanksApi *PiggyBanksApiService + + PreferencesApi *PreferencesApiService + + RecurrencesApi *RecurrencesApiService + + RuleGroupsApi *RuleGroupsApiService + + RulesApi *RulesApiService + + SearchApi *SearchApiService + + SummaryApi *SummaryApiService + + TagsApi *TagsApiService + + TransactionsApi *TransactionsApiService + + UsersApi *UsersApiService + + WebhooksApi *WebhooksApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.AboutApi = (*AboutApiService)(&c.common) + c.AccountsApi = (*AccountsApiService)(&c.common) + c.AttachmentsApi = (*AttachmentsApiService)(&c.common) + c.AutocompleteApi = (*AutocompleteApiService)(&c.common) + c.AvailableBudgetsApi = (*AvailableBudgetsApiService)(&c.common) + c.BillsApi = (*BillsApiService)(&c.common) + c.BudgetsApi = (*BudgetsApiService)(&c.common) + c.CategoriesApi = (*CategoriesApiService)(&c.common) + c.ChartsApi = (*ChartsApiService)(&c.common) + c.ConfigurationApi = (*ConfigurationApiService)(&c.common) + c.CurrenciesApi = (*CurrenciesApiService)(&c.common) + c.DataApi = (*DataApiService)(&c.common) + c.InsightApi = (*InsightApiService)(&c.common) + c.LinksApi = (*LinksApiService)(&c.common) + c.ObjectGroupsApi = (*ObjectGroupsApiService)(&c.common) + c.PiggyBanksApi = (*PiggyBanksApiService)(&c.common) + c.PreferencesApi = (*PreferencesApiService)(&c.common) + c.RecurrencesApi = (*RecurrencesApiService)(&c.common) + c.RuleGroupsApi = (*RuleGroupsApiService)(&c.common) + c.RulesApi = (*RulesApiService)(&c.common) + c.SearchApi = (*SearchApiService)(&c.common) + c.SummaryApi = (*SummaryApiService)(&c.common) + c.TagsApi = (*TagsApiService)(&c.common) + c.TransactionsApi = (*TransactionsApiService)(&c.common) + c.UsersApi = (*UsersApiService)(&c.common) + c.WebhooksApi = (*WebhooksApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } + + return fmt.Sprintf("%v", obj) +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + return c.cfg.HTTPClient.Do(request) +} + +// Change base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile("file", filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + } + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Override request host, if applicable + if c.cfg.Host != "" { + localVarRequest.Host = c.cfg.Host + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } else if strings.Contains(contentType, "application/json") || strings.Contains(contentType, "application/vnd.api+json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } + expires = now.Add(lifetime) + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericSwaggerError Provides access to the body, error and model on returned errors. +type GenericSwaggerError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericSwaggerError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericSwaggerError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericSwaggerError) Model() interface{} { + return e.model +} diff --git a/configuration.go b/configuration.go new file mode 100644 index 0000000..9a70b54 --- /dev/null +++ b/configuration.go @@ -0,0 +1,72 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "net/http" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +type Configuration struct { + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + HTTPClient *http.Client +} + +func NewConfiguration() *Configuration { + cfg := &Configuration{ + BasePath: "https://demo.firefly-iii.org/firefly3", + DefaultHeader: make(map[string]string), + UserAgent: "Swagger-Codegen/1.0.0/go", + } + return cfg +} + +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..ae01b18 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/model_account.go b/model_account.go new file mode 100644 index 0000000..0a9b36d --- /dev/null +++ b/model_account.go @@ -0,0 +1,62 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type Account struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // If omitted, defaults to true. + Active bool `json:"active,omitempty"` + // Order of the account. Is NULL if account is not asset or liability. + Order int32 `json:"order,omitempty"` + Name string `json:"name"` + Type_ *ShortAccountTypeProperty `json:"type"` + AccountRole *AccountRoleProperty `json:"account_role,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + CurrencyId string `json:"currency_id,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + CurrentBalance string `json:"current_balance,omitempty"` + // The timestamp for this date is always 23:59:59, to indicate it's the balance at the very END of that particular day. + CurrentBalanceDate time.Time `json:"current_balance_date,omitempty"` + Iban string `json:"iban,omitempty"` + Bic string `json:"bic,omitempty"` + AccountNumber string `json:"account_number,omitempty"` + // Represents the opening balance, the initial amount this account holds. + OpeningBalance string `json:"opening_balance,omitempty"` + // Represents the current debt for liabilities. + CurrentDebt string `json:"current_debt,omitempty"` + // Represents the date of the opening balance. + OpeningBalanceDate time.Time `json:"opening_balance_date,omitempty"` + VirtualBalance string `json:"virtual_balance,omitempty"` + // If omitted, defaults to true. + IncludeNetWorth bool `json:"include_net_worth,omitempty"` + CreditCardType *CreditCardTypeProperty `json:"credit_card_type,omitempty"` + // Mandatory when the account_role is ccAsset. Moment at which CC payment installments are asked for by the bank. + MonthlyPaymentDate time.Time `json:"monthly_payment_date,omitempty"` + LiabilityType *LiabilityTypeProperty `json:"liability_type,omitempty"` + LiabilityDirection *LiabilityDirectionProperty `json:"liability_direction,omitempty"` + // Mandatory when type is liability. Interest percentage. + Interest string `json:"interest,omitempty"` + InterestPeriod *InterestPeriodProperty `json:"interest_period,omitempty"` + Notes string `json:"notes,omitempty"` + // Latitude of the accounts's location, if applicable. Can be used to draw a map. + Latitude float64 `json:"latitude,omitempty"` + // Latitude of the accounts's location, if applicable. Can be used to draw a map. + Longitude float64 `json:"longitude,omitempty"` + // Zoom level for the map, if drawn. This to set the box right. Unfortunately this is a proprietary value because each map provider has different zoom levels. + ZoomLevel int32 `json:"zoom_level,omitempty"` +} diff --git a/model_account_array.go b/model_account_array.go new file mode 100644 index 0000000..526c212 --- /dev/null +++ b/model_account_array.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AccountArray struct { + Data []AccountRead `json:"data"` + Meta *Meta `json:"meta"` +} diff --git a/model_account_read.go b/model_account_read.go new file mode 100644 index 0000000..b08e9ab --- /dev/null +++ b/model_account_read.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AccountRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *Account `json:"attributes"` +} diff --git a/model_account_role_property.go b/model_account_role_property.go new file mode 100644 index 0000000..73c016c --- /dev/null +++ b/model_account_role_property.go @@ -0,0 +1,23 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// AccountRoleProperty : Is only mandatory when the type is asset. +type AccountRoleProperty string + +// List of AccountRoleProperty +const ( + DEFAULT_ASSET_AccountRoleProperty AccountRoleProperty = "defaultAsset" + SHARED_ASSET_AccountRoleProperty AccountRoleProperty = "sharedAsset" + SAVING_ASSET_AccountRoleProperty AccountRoleProperty = "savingAsset" + CC_ASSET_AccountRoleProperty AccountRoleProperty = "ccAsset" + CASH_WALLET_ASSET_AccountRoleProperty AccountRoleProperty = "cashWalletAsset" + NULL_AccountRoleProperty AccountRoleProperty = "" +) diff --git a/model_account_search_field_filter.go b/model_account_search_field_filter.go new file mode 100644 index 0000000..c168047 --- /dev/null +++ b/model_account_search_field_filter.go @@ -0,0 +1,21 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AccountSearchFieldFilter string + +// List of AccountSearchFieldFilter +const ( + ALL_AccountSearchFieldFilter AccountSearchFieldFilter = "all" + IBAN_AccountSearchFieldFilter AccountSearchFieldFilter = "iban" + NAME_AccountSearchFieldFilter AccountSearchFieldFilter = "name" + NUMBER_AccountSearchFieldFilter AccountSearchFieldFilter = "number" + ID_AccountSearchFieldFilter AccountSearchFieldFilter = "id" +) diff --git a/model_account_single.go b/model_account_single.go new file mode 100644 index 0000000..a310106 --- /dev/null +++ b/model_account_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AccountSingle struct { + Data *AccountRead `json:"data"` +} diff --git a/model_account_store.go b/model_account_store.go new file mode 100644 index 0000000..ead3cd8 --- /dev/null +++ b/model_account_store.go @@ -0,0 +1,53 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type AccountStore struct { + Name string `json:"name"` + Type_ *ShortAccountTypeProperty `json:"type"` + Iban string `json:"iban,omitempty"` + Bic string `json:"bic,omitempty"` + AccountNumber string `json:"account_number,omitempty"` + // Represents the opening balance, the initial amount this account holds. + OpeningBalance string `json:"opening_balance,omitempty"` + // Represents the date of the opening balance. + OpeningBalanceDate time.Time `json:"opening_balance_date,omitempty"` + VirtualBalance string `json:"virtual_balance,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + CurrencyId string `json:"currency_id,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + CurrencyCode string `json:"currency_code,omitempty"` + // If omitted, defaults to true. + Active bool `json:"active,omitempty"` + // Order of the account + Order int32 `json:"order,omitempty"` + // If omitted, defaults to true. + IncludeNetWorth bool `json:"include_net_worth,omitempty"` + AccountRole *AccountRoleProperty `json:"account_role,omitempty"` + CreditCardType *CreditCardTypeProperty `json:"credit_card_type,omitempty"` + // Mandatory when the account_role is ccAsset. Moment at which CC payment installments are asked for by the bank. + MonthlyPaymentDate time.Time `json:"monthly_payment_date,omitempty"` + LiabilityType *LiabilityTypeProperty `json:"liability_type,omitempty"` + LiabilityDirection *LiabilityDirectionProperty `json:"liability_direction,omitempty"` + // Mandatory when type is liability. Interest percentage. + Interest string `json:"interest,omitempty"` + InterestPeriod *InterestPeriodProperty `json:"interest_period,omitempty"` + Notes string `json:"notes,omitempty"` + // Latitude of the accounts's location, if applicable. Can be used to draw a map. + Latitude float64 `json:"latitude,omitempty"` + // Latitude of the accounts's location, if applicable. Can be used to draw a map. + Longitude float64 `json:"longitude,omitempty"` + // Zoom level for the map, if drawn. This to set the box right. Unfortunately this is a proprietary value because each map provider has different zoom levels. + ZoomLevel int32 `json:"zoom_level,omitempty"` +} diff --git a/model_account_type_filter.go b/model_account_type_filter.go new file mode 100644 index 0000000..3e7c686 --- /dev/null +++ b/model_account_type_filter.go @@ -0,0 +1,37 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AccountTypeFilter string + +// List of AccountTypeFilter +const ( + ALL_AccountTypeFilter AccountTypeFilter = "all" + ASSET_AccountTypeFilter AccountTypeFilter = "asset" + CASH_AccountTypeFilter AccountTypeFilter = "cash" + EXPENSE_AccountTypeFilter AccountTypeFilter = "expense" + REVENUE_AccountTypeFilter AccountTypeFilter = "revenue" + SPECIAL_AccountTypeFilter AccountTypeFilter = "special" + HIDDEN_AccountTypeFilter AccountTypeFilter = "hidden" + LIABILITY_AccountTypeFilter AccountTypeFilter = "liability" + LIABILITIES_AccountTypeFilter AccountTypeFilter = "liabilities" + DEFAULT_ACCOUNT_AccountTypeFilter AccountTypeFilter = "Default account" + CASH_ACCOUNT_AccountTypeFilter AccountTypeFilter = "Cash account" + ASSET_ACCOUNT_AccountTypeFilter AccountTypeFilter = "Asset account" + EXPENSE_ACCOUNT_AccountTypeFilter AccountTypeFilter = "Expense account" + REVENUE_ACCOUNT_AccountTypeFilter AccountTypeFilter = "Revenue account" + INITIAL_BALANCE_ACCOUNT_AccountTypeFilter AccountTypeFilter = "Initial balance account" + BENEFICIARY_ACCOUNT_AccountTypeFilter AccountTypeFilter = "Beneficiary account" + IMPORT_ACCOUNT_AccountTypeFilter AccountTypeFilter = "Import account" + RECONCILIATION_ACCOUNT_AccountTypeFilter AccountTypeFilter = "Reconciliation account" + LOAN_AccountTypeFilter AccountTypeFilter = "Loan" + DEBT_AccountTypeFilter AccountTypeFilter = "Debt" + MORTGAGE_AccountTypeFilter AccountTypeFilter = "Mortgage" +) diff --git a/model_account_type_property.go b/model_account_type_property.go new file mode 100644 index 0000000..701f10f --- /dev/null +++ b/model_account_type_property.go @@ -0,0 +1,28 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AccountTypeProperty string + +// List of AccountTypeProperty +const ( + DEFAULT_ACCOUNT_AccountTypeProperty AccountTypeProperty = "Default account" + CASH_ACCOUNT_AccountTypeProperty AccountTypeProperty = "Cash account" + ASSET_ACCOUNT_AccountTypeProperty AccountTypeProperty = "Asset account" + EXPENSE_ACCOUNT_AccountTypeProperty AccountTypeProperty = "Expense account" + REVENUE_ACCOUNT_AccountTypeProperty AccountTypeProperty = "Revenue account" + INITIAL_BALANCE_ACCOUNT_AccountTypeProperty AccountTypeProperty = "Initial balance account" + BENEFICIARY_ACCOUNT_AccountTypeProperty AccountTypeProperty = "Beneficiary account" + IMPORT_ACCOUNT_AccountTypeProperty AccountTypeProperty = "Import account" + RECONCILIATION_ACCOUNT_AccountTypeProperty AccountTypeProperty = "Reconciliation account" + LOAN_AccountTypeProperty AccountTypeProperty = "Loan" + DEBT_AccountTypeProperty AccountTypeProperty = "Debt" + MORTGAGE_AccountTypeProperty AccountTypeProperty = "Mortgage" +) diff --git a/model_account_update.go b/model_account_update.go new file mode 100644 index 0000000..9d1ac71 --- /dev/null +++ b/model_account_update.go @@ -0,0 +1,49 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type AccountUpdate struct { + Name string `json:"name"` + Iban string `json:"iban,omitempty"` + Bic string `json:"bic,omitempty"` + AccountNumber string `json:"account_number,omitempty"` + OpeningBalance string `json:"opening_balance,omitempty"` + OpeningBalanceDate time.Time `json:"opening_balance_date,omitempty"` + VirtualBalance string `json:"virtual_balance,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + CurrencyId string `json:"currency_id,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + CurrencyCode string `json:"currency_code,omitempty"` + // If omitted, defaults to true. + Active bool `json:"active,omitempty"` + // Order of the account + Order int32 `json:"order,omitempty"` + // If omitted, defaults to true. + IncludeNetWorth bool `json:"include_net_worth,omitempty"` + AccountRole *AccountRoleProperty `json:"account_role,omitempty"` + CreditCardType *CreditCardTypeProperty `json:"credit_card_type,omitempty"` + // Mandatory when the account_role is ccAsset. Moment at which CC payment installments are asked for by the bank. + MonthlyPaymentDate time.Time `json:"monthly_payment_date,omitempty"` + LiabilityType *LiabilityTypeProperty `json:"liability_type,omitempty"` + // Mandatory when type is liability. Interest percentage. + Interest string `json:"interest,omitempty"` + InterestPeriod *InterestPeriodProperty `json:"interest_period,omitempty"` + Notes string `json:"notes,omitempty"` + // Latitude of the account's location, if applicable. Can be used to draw a map. If omitted, the existing location will be kept. If submitted as NULL, the current location will be removed. + Latitude float64 `json:"latitude,omitempty"` + // Latitude of the account's location, if applicable. Can be used to draw a map. If omitted, the existing location will be kept. If submitted as NULL, the current location will be removed. + Longitude float64 `json:"longitude,omitempty"` + // Zoom level for the map, if drawn. This to set the box right. Unfortunately this is a proprietary value because each map provider has different zoom levels. If omitted, the existing location will be kept. If submitted as NULL, the current location will be removed. + ZoomLevel int32 `json:"zoom_level,omitempty"` +} diff --git a/model_attachable_type.go b/model_attachable_type.go new file mode 100644 index 0000000..17d6b7a --- /dev/null +++ b/model_attachable_type.go @@ -0,0 +1,23 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// AttachableType : The object class to which the attachment must be linked. +type AttachableType string + +// List of AttachableType +const ( + ACCOUNT_AttachableType AttachableType = "Account" + BUDGET_AttachableType AttachableType = "Budget" + BILL_AttachableType AttachableType = "Bill" + TRANSACTION_JOURNAL_AttachableType AttachableType = "TransactionJournal" + PIGGY_BANK_AttachableType AttachableType = "PiggyBank" + TAG_AttachableType AttachableType = "Tag" +) diff --git a/model_attachment.go b/model_attachment.go new file mode 100644 index 0000000..2f5fb21 --- /dev/null +++ b/model_attachment.go @@ -0,0 +1,31 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type Attachment struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + AttachableType *AttachableType `json:"attachable_type"` + // ID of the model this attachment is linked to. + AttachableId string `json:"attachable_id"` + // MD5 hash of the file for basic duplicate detection. + Md5 string `json:"md5,omitempty"` + Filename string `json:"filename"` + DownloadUrl string `json:"download_url,omitempty"` + UploadUrl string `json:"upload_url,omitempty"` + Title string `json:"title,omitempty"` + Notes string `json:"notes,omitempty"` + Mime string `json:"mime,omitempty"` + Size int32 `json:"size,omitempty"` +} diff --git a/model_attachment_array.go b/model_attachment_array.go new file mode 100644 index 0000000..598e96e --- /dev/null +++ b/model_attachment_array.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AttachmentArray struct { + Data []AttachmentRead `json:"data"` + Meta *Meta `json:"meta"` +} diff --git a/model_attachment_read.go b/model_attachment_read.go new file mode 100644 index 0000000..b06a891 --- /dev/null +++ b/model_attachment_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AttachmentRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *Attachment `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_attachment_single.go b/model_attachment_single.go new file mode 100644 index 0000000..84027bf --- /dev/null +++ b/model_attachment_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AttachmentSingle struct { + Data *AttachmentRead `json:"data"` +} diff --git a/model_attachment_store.go b/model_attachment_store.go new file mode 100644 index 0000000..56d9fa5 --- /dev/null +++ b/model_attachment_store.go @@ -0,0 +1,19 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AttachmentStore struct { + Filename string `json:"filename"` + AttachableType *AttachableType `json:"attachable_type"` + // ID of the model this attachment is linked to. + AttachableId string `json:"attachable_id"` + Title string `json:"title,omitempty"` + Notes string `json:"notes,omitempty"` +} diff --git a/model_attachment_update.go b/model_attachment_update.go new file mode 100644 index 0000000..2fd35f0 --- /dev/null +++ b/model_attachment_update.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AttachmentUpdate struct { + Filename string `json:"filename,omitempty"` + Title string `json:"title,omitempty"` + Notes string `json:"notes,omitempty"` +} diff --git a/model_auto_budget_period.go b/model_auto_budget_period.go new file mode 100644 index 0000000..378e21b --- /dev/null +++ b/model_auto_budget_period.go @@ -0,0 +1,24 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// AutoBudgetPeriod : Period for the auto budget +type AutoBudgetPeriod string + +// List of AutoBudgetPeriod +const ( + DAILY_AutoBudgetPeriod AutoBudgetPeriod = "daily" + WEEKLY_AutoBudgetPeriod AutoBudgetPeriod = "weekly" + MONTHLY_AutoBudgetPeriod AutoBudgetPeriod = "monthly" + QUARTERLY_AutoBudgetPeriod AutoBudgetPeriod = "quarterly" + HALF_YEAR_AutoBudgetPeriod AutoBudgetPeriod = "half-year" + YEARLY_AutoBudgetPeriod AutoBudgetPeriod = "yearly" + NULL_AutoBudgetPeriod AutoBudgetPeriod = "" +) diff --git a/model_auto_budget_type.go b/model_auto_budget_type.go new file mode 100644 index 0000000..c86ac92 --- /dev/null +++ b/model_auto_budget_type.go @@ -0,0 +1,21 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// AutoBudgetType : The type of auto-budget that Firefly III must create. +type AutoBudgetType string + +// List of AutoBudgetType +const ( + RESET_AutoBudgetType AutoBudgetType = "reset" + ROLLOVER_AutoBudgetType AutoBudgetType = "rollover" + NONE_AutoBudgetType AutoBudgetType = "none" + NULL_AutoBudgetType AutoBudgetType = "" +) diff --git a/model_autocomplete_account.go b/model_autocomplete_account.go new file mode 100644 index 0000000..61d3679 --- /dev/null +++ b/model_autocomplete_account.go @@ -0,0 +1,30 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteAccount struct { + Id string `json:"id"` + // Name of the account found by an auto-complete search. + Name string `json:"name"` + // Asset accounts and liabilities have a second field with the given date's account balance. + NameWithBalance string `json:"name_with_balance"` + // Account type of the account found by the auto-complete search. + Type_ string `json:"type"` + // ID for the currency used by this account. + CurrencyId string `json:"currency_id"` + // Currency name for the currency used by this account. + CurrencyName string `json:"currency_name"` + // Currency code for the currency used by this account. + CurrencyCode string `json:"currency_code"` + // Currency symbol for the currency used by this account. + CurrencySymbol string `json:"currency_symbol"` + // Number of decimal places for the currency used by this account. + CurrencyDecimalPlaces int32 `json:"currency_decimal_places"` +} diff --git a/model_autocomplete_bill.go b/model_autocomplete_bill.go new file mode 100644 index 0000000..3a77b2b --- /dev/null +++ b/model_autocomplete_bill.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteBill struct { + Id string `json:"id"` + // Name of the bill found by an auto-complete search. + Name string `json:"name"` + // Is the bill active or not? + Active bool `json:"active,omitempty"` +} diff --git a/model_autocomplete_budget.go b/model_autocomplete_budget.go new file mode 100644 index 0000000..bf4e601 --- /dev/null +++ b/model_autocomplete_budget.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteBudget struct { + Id string `json:"id"` + // Name of the budget found by an auto-complete search. + Name string `json:"name"` +} diff --git a/model_autocomplete_category.go b/model_autocomplete_category.go new file mode 100644 index 0000000..417ebd8 --- /dev/null +++ b/model_autocomplete_category.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteCategory struct { + Id string `json:"id"` + // Name of the category found by an auto-complete search. + Name string `json:"name"` +} diff --git a/model_autocomplete_currency.go b/model_autocomplete_currency.go new file mode 100644 index 0000000..62ba007 --- /dev/null +++ b/model_autocomplete_currency.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteCurrency struct { + Id string `json:"id"` + // Currency name. + Name string `json:"name"` + // Currency code. + Code string `json:"code"` + Symbol string `json:"symbol"` + DecimalPlaces int32 `json:"decimal_places"` +} diff --git a/model_autocomplete_currency_code.go b/model_autocomplete_currency_code.go new file mode 100644 index 0000000..6db80f6 --- /dev/null +++ b/model_autocomplete_currency_code.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteCurrencyCode struct { + Id string `json:"id"` + // Currency name with the code between brackets. + Name string `json:"name"` + // Currency code. + Code string `json:"code"` + Symbol string `json:"symbol"` + DecimalPlaces int32 `json:"decimal_places"` +} diff --git a/model_autocomplete_object_group.go b/model_autocomplete_object_group.go new file mode 100644 index 0000000..cf00cba --- /dev/null +++ b/model_autocomplete_object_group.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteObjectGroup struct { + Id string `json:"id"` + // Title of the object group found by an auto-complete search. + Title string `json:"title"` + // Title of the object group found by an auto-complete search. + Name string `json:"name"` +} diff --git a/model_autocomplete_piggy.go b/model_autocomplete_piggy.go new file mode 100644 index 0000000..88a3091 --- /dev/null +++ b/model_autocomplete_piggy.go @@ -0,0 +1,28 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompletePiggy struct { + Id string `json:"id"` + // Name of the piggy bank found by an auto-complete search. + Name string `json:"name"` + // Currency ID for this piggy bank. + CurrencyId string `json:"currency_id,omitempty"` + // Currency code for this piggy bank. + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + // Currency name for the currency used by this account. + CurrencyName string `json:"currency_name,omitempty"` + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + // The group ID of the group this object is part of. NULL if no group. + ObjectGroupId string `json:"object_group_id,omitempty"` + // The name of the group. NULL if no group. + ObjectGroupTitle string `json:"object_group_title,omitempty"` +} diff --git a/model_autocomplete_piggy_balance.go b/model_autocomplete_piggy_balance.go new file mode 100644 index 0000000..5823edd --- /dev/null +++ b/model_autocomplete_piggy_balance.go @@ -0,0 +1,28 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompletePiggyBalance struct { + Id string `json:"id"` + // Name of the piggy bank found by an auto-complete search. + Name string `json:"name"` + // Name of the piggy bank found by an auto-complete search with the current balance formatted nicely. + NameWithBalance string `json:"name_with_balance,omitempty"` + // Currency ID for this piggy bank. + CurrencyId string `json:"currency_id,omitempty"` + // Currency code for this piggy bank. + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + // The group ID of the group this object is part of. NULL if no group. + ObjectGroupId string `json:"object_group_id,omitempty"` + // The name of the group. NULL if no group. + ObjectGroupTitle string `json:"object_group_title,omitempty"` +} diff --git a/model_autocomplete_recurrence.go b/model_autocomplete_recurrence.go new file mode 100644 index 0000000..e2ce232 --- /dev/null +++ b/model_autocomplete_recurrence.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteRecurrence struct { + Id string `json:"id"` + // Name of the recurrence found by an auto-complete search. + Name string `json:"name"` + // Description of the recurrence found by auto-complete. + Description string `json:"description,omitempty"` +} diff --git a/model_autocomplete_rule.go b/model_autocomplete_rule.go new file mode 100644 index 0000000..c63c87e --- /dev/null +++ b/model_autocomplete_rule.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteRule struct { + Id string `json:"id"` + // Name of the rule found by an auto-complete search. + Name string `json:"name"` + // Description of the rule found by auto-complete. + Description string `json:"description,omitempty"` +} diff --git a/model_autocomplete_rule_group.go b/model_autocomplete_rule_group.go new file mode 100644 index 0000000..33126cc --- /dev/null +++ b/model_autocomplete_rule_group.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteRuleGroup struct { + Id string `json:"id"` + // Name of the rule group found by an auto-complete search. + Name string `json:"name"` + // Description of the rule group found by auto-complete. + Description string `json:"description,omitempty"` +} diff --git a/model_autocomplete_tag.go b/model_autocomplete_tag.go new file mode 100644 index 0000000..a43fea2 --- /dev/null +++ b/model_autocomplete_tag.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteTag struct { + Id string `json:"id"` + // Name of the tag found by an auto-complete search. + Name string `json:"name"` + // Name of the tag found by an auto-complete search. + Tag string `json:"tag"` +} diff --git a/model_autocomplete_transaction.go b/model_autocomplete_transaction.go new file mode 100644 index 0000000..366b22e --- /dev/null +++ b/model_autocomplete_transaction.go @@ -0,0 +1,21 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteTransaction struct { + // The ID of a transaction journal (basically a single split). + Id string `json:"id"` + // The ID of the underlying transaction group. + TransactionGroupId string `json:"transaction_group_id,omitempty"` + // Transaction description + Name string `json:"name"` + // Transaction description + Description string `json:"description"` +} diff --git a/model_autocomplete_transaction_id.go b/model_autocomplete_transaction_id.go new file mode 100644 index 0000000..1935c44 --- /dev/null +++ b/model_autocomplete_transaction_id.go @@ -0,0 +1,21 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteTransactionId struct { + // The ID of a transaction journal (basically a single split). + Id string `json:"id"` + // The ID of the underlying transaction group. + TransactionGroupId string `json:"transaction_group_id,omitempty"` + // Transaction description with ID in the name. + Name string `json:"name"` + // Transaction description with ID in the name. + Description string `json:"description"` +} diff --git a/model_autocomplete_transaction_type.go b/model_autocomplete_transaction_type.go new file mode 100644 index 0000000..a28e528 --- /dev/null +++ b/model_autocomplete_transaction_type.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AutocompleteTransactionType struct { + Id string `json:"id"` + // Type of the object found by an auto-complete search. + Name string `json:"name"` + // Name of the object found by an auto-complete search. + Type_ string `json:"type"` +} diff --git a/model_available_budget.go b/model_available_budget.go new file mode 100644 index 0000000..6f76136 --- /dev/null +++ b/model_available_budget.go @@ -0,0 +1,32 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type AvailableBudget struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // Use either currency_id or currency_code. + CurrencyId string `json:"currency_id,omitempty"` + // Use either currency_id or currency_code. + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + Amount string `json:"amount"` + // Start date of the available budget. + Start time.Time `json:"start"` + // End date of the available budget. + End time.Time `json:"end"` + SpentInBudgets []BudgetSpent `json:"spent_in_budgets,omitempty"` + SpentOutsideBudget []BudgetSpent `json:"spent_outside_budget,omitempty"` +} diff --git a/model_available_budget_array.go b/model_available_budget_array.go new file mode 100644 index 0000000..734c1a2 --- /dev/null +++ b/model_available_budget_array.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AvailableBudgetArray struct { + Data []AvailableBudgetRead `json:"data"` + Meta *Meta `json:"meta"` +} diff --git a/model_available_budget_read.go b/model_available_budget_read.go new file mode 100644 index 0000000..64272f8 --- /dev/null +++ b/model_available_budget_read.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AvailableBudgetRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *AvailableBudget `json:"attributes"` +} diff --git a/model_available_budget_single.go b/model_available_budget_single.go new file mode 100644 index 0000000..73a25c6 --- /dev/null +++ b/model_available_budget_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type AvailableBudgetSingle struct { + Data *AvailableBudgetRead `json:"data"` +} diff --git a/model_bad_request_response.go b/model_bad_request_response.go new file mode 100644 index 0000000..6747f77 --- /dev/null +++ b/model_bad_request_response.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BadRequestResponse struct { + Message string `json:"message,omitempty"` + Exception string `json:"exception,omitempty"` +} diff --git a/model_basic_summary_entry.go b/model_basic_summary_entry.go new file mode 100644 index 0000000..f5a591c --- /dev/null +++ b/model_basic_summary_entry.go @@ -0,0 +1,31 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BasicSummaryEntry struct { + // This is a reference to the type of info shared, not influenced by translations or user preferences. The EUR value is a reference to the currency code. Possibilities are: balance-in-ABC, spent-in-ABC, earned-in-ABC, bills-paid-in-ABC, bills-unpaid-in-ABC, left-to-spend-in-ABC and net-worth-in-ABC. + Key string `json:"key,omitempty"` + // A translated title for the information shared. + Title string `json:"title,omitempty"` + // The amount as a float. + MonetaryValue float64 `json:"monetary_value,omitempty"` + // The currency ID of the associated currency. + CurrencyId string `json:"currency_id,omitempty"` + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + // Number of decimals for the associated currency. + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + // The amount formatted according to the users locale + ValueParsed string `json:"value_parsed,omitempty"` + // Reference to a font-awesome icon without the fa- part. + LocalIcon string `json:"local_icon,omitempty"` + // A short explanation of the amounts origin. Already formatted according to the locale of the user or translated, if relevant. + SubTitle string `json:"sub_title,omitempty"` +} diff --git a/model_bill.go b/model_bill.go new file mode 100644 index 0000000..b7a757a --- /dev/null +++ b/model_bill.go @@ -0,0 +1,55 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type Bill struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // Use either currency_id or currency_code + CurrencyId string `json:"currency_id,omitempty"` + // Use either currency_id or currency_code + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + Name string `json:"name"` + AmountMin string `json:"amount_min"` + AmountMax string `json:"amount_max"` + Date time.Time `json:"date"` + // The date after which this bill is no longer valid or applicable + EndDate time.Time `json:"end_date,omitempty"` + // The date before which the bill must be renewed (or cancelled) + ExtensionDate time.Time `json:"extension_date,omitempty"` + RepeatFreq *BillRepeatFrequency `json:"repeat_freq"` + // How often the bill must be skipped. 1 means a bi-monthly bill. + Skip int32 `json:"skip,omitempty"` + // If the bill is active. + Active bool `json:"active,omitempty"` + // Order of the bill. + Order int32 `json:"order,omitempty"` + Notes string `json:"notes,omitempty"` + // When the bill is expected to be due. + NextExpectedMatch time.Time `json:"next_expected_match,omitempty"` + // Formatted (locally) when the bill is due. + NextExpectedMatchDiff string `json:"next_expected_match_diff,omitempty"` + // The group ID of the group this object is part of. NULL if no group. + ObjectGroupId string `json:"object_group_id,omitempty"` + // The order of the group. At least 1, for the highest sorting. + ObjectGroupOrder int32 `json:"object_group_order,omitempty"` + // The name of the group. NULL if no group. + ObjectGroupTitle string `json:"object_group_title,omitempty"` + // Array of future dates when the bill is expected to be paid. Autogenerated. + PayDates []time.Time `json:"pay_dates,omitempty"` + // Array of past transactions when the bill was paid. + PaidDates []BillPaidDates `json:"paid_dates,omitempty"` +} diff --git a/model_bill_array.go b/model_bill_array.go new file mode 100644 index 0000000..905fcfb --- /dev/null +++ b/model_bill_array.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BillArray struct { + Data []BillRead `json:"data"` + Meta *Meta `json:"meta"` +} diff --git a/model_bill_paid_dates.go b/model_bill_paid_dates.go new file mode 100644 index 0000000..6b89504 --- /dev/null +++ b/model_bill_paid_dates.go @@ -0,0 +1,23 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type BillPaidDates struct { + // Transaction group ID of the paid bill. + TransactionGroupId string `json:"transaction_group_id,omitempty"` + // Transaction journal ID of the paid bill. + TransactionJournalId string `json:"transaction_journal_id,omitempty"` + // Date the bill was paid. + Date time.Time `json:"date,omitempty"` +} diff --git a/model_bill_read.go b/model_bill_read.go new file mode 100644 index 0000000..f87482f --- /dev/null +++ b/model_bill_read.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BillRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *Bill `json:"attributes"` +} diff --git a/model_bill_repeat_frequency.go b/model_bill_repeat_frequency.go new file mode 100644 index 0000000..a827eca --- /dev/null +++ b/model_bill_repeat_frequency.go @@ -0,0 +1,22 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// BillRepeatFrequency : How often the bill must be paid. +type BillRepeatFrequency string + +// List of BillRepeatFrequency +const ( + WEEKLY_BillRepeatFrequency BillRepeatFrequency = "weekly" + MONTHLY_BillRepeatFrequency BillRepeatFrequency = "monthly" + QUARTERLY_BillRepeatFrequency BillRepeatFrequency = "quarterly" + HALF_YEAR_BillRepeatFrequency BillRepeatFrequency = "half-year" + YEARLY_BillRepeatFrequency BillRepeatFrequency = "yearly" +) diff --git a/model_bill_single.go b/model_bill_single.go new file mode 100644 index 0000000..2caabc4 --- /dev/null +++ b/model_bill_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BillSingle struct { + Data *BillRead `json:"data"` +} diff --git a/model_bill_store.go b/model_bill_store.go new file mode 100644 index 0000000..ea91084 --- /dev/null +++ b/model_bill_store.go @@ -0,0 +1,39 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type BillStore struct { + // Use either currency_id or currency_code + CurrencyId string `json:"currency_id,omitempty"` + // Use either currency_id or currency_code + CurrencyCode string `json:"currency_code,omitempty"` + Name string `json:"name"` + AmountMin string `json:"amount_min"` + AmountMax string `json:"amount_max"` + Date time.Time `json:"date"` + // The date after which this bill is no longer valid or applicable + EndDate time.Time `json:"end_date,omitempty"` + // The date before which the bill must be renewed (or cancelled) + ExtensionDate time.Time `json:"extension_date,omitempty"` + RepeatFreq *BillRepeatFrequency `json:"repeat_freq"` + // How often the bill must be skipped. 1 means a bi-monthly bill. + Skip int32 `json:"skip,omitempty"` + // If the bill is active. + Active bool `json:"active,omitempty"` + Notes string `json:"notes,omitempty"` + // The group ID of the group this object is part of. NULL if no group. + ObjectGroupId string `json:"object_group_id,omitempty"` + // The name of the group. NULL if no group. + ObjectGroupTitle string `json:"object_group_title,omitempty"` +} diff --git a/model_bill_update.go b/model_bill_update.go new file mode 100644 index 0000000..f14a089 --- /dev/null +++ b/model_bill_update.go @@ -0,0 +1,39 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type BillUpdate struct { + // Use either currency_id or currency_code + CurrencyId string `json:"currency_id,omitempty"` + // Use either currency_id or currency_code + CurrencyCode string `json:"currency_code,omitempty"` + Name string `json:"name"` + AmountMin string `json:"amount_min,omitempty"` + AmountMax string `json:"amount_max,omitempty"` + Date time.Time `json:"date,omitempty"` + // The date after which this bill is no longer valid or applicable + EndDate time.Time `json:"end_date,omitempty"` + // The date before which the bill must be renewed (or cancelled) + ExtensionDate time.Time `json:"extension_date,omitempty"` + RepeatFreq *BillRepeatFrequency `json:"repeat_freq,omitempty"` + // How often the bill must be skipped. 1 means a bi-monthly bill. + Skip int32 `json:"skip,omitempty"` + // If the bill is active. + Active bool `json:"active,omitempty"` + Notes string `json:"notes,omitempty"` + // The group ID of the group this object is part of. NULL if no group. + ObjectGroupId string `json:"object_group_id,omitempty"` + // The name of the group. NULL if no group. + ObjectGroupTitle string `json:"object_group_title,omitempty"` +} diff --git a/model_budget.go b/model_budget.go new file mode 100644 index 0000000..9edbf89 --- /dev/null +++ b/model_budget.go @@ -0,0 +1,32 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type Budget struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + Name string `json:"name"` + Active bool `json:"active,omitempty"` + Notes string `json:"notes,omitempty"` + Order int32 `json:"order,omitempty"` + AutoBudgetType *AutoBudgetType `json:"auto_budget_type,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + AutoBudgetCurrencyId string `json:"auto_budget_currency_id,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + AutoBudgetCurrencyCode string `json:"auto_budget_currency_code,omitempty"` + AutoBudgetAmount string `json:"auto_budget_amount,omitempty"` + AutoBudgetPeriod *AutoBudgetPeriod `json:"auto_budget_period,omitempty"` + // Information on how much was spent in this budget. Is only filled in when the start and end date are submitted. + Spent []BudgetSpent `json:"spent,omitempty"` +} diff --git a/model_budget_array.go b/model_budget_array.go new file mode 100644 index 0000000..d60915e --- /dev/null +++ b/model_budget_array.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BudgetArray struct { + Data []BudgetRead `json:"data"` + Meta *Meta `json:"meta"` +} diff --git a/model_budget_limit.go b/model_budget_limit.go new file mode 100644 index 0000000..bee179b --- /dev/null +++ b/model_budget_limit.go @@ -0,0 +1,36 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type BudgetLimit struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // Start date of the budget limit. + Start time.Time `json:"start"` + // End date of the budget limit. + End time.Time `json:"end"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + CurrencyId string `json:"currency_id,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + CurrencyCode string `json:"currency_code,omitempty"` + CurrencyName string `json:"currency_name,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + // The budget ID of the associated budget. + BudgetId string `json:"budget_id"` + // Period of the budget limit. Only used when auto-generated by auto-budget. + Period string `json:"period,omitempty"` + Amount string `json:"amount"` + Spent string `json:"spent,omitempty"` +} diff --git a/model_budget_limit_array.go b/model_budget_limit_array.go new file mode 100644 index 0000000..aa61b3c --- /dev/null +++ b/model_budget_limit_array.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BudgetLimitArray struct { + Data []BudgetLimitRead `json:"data"` + Meta *Meta `json:"meta"` +} diff --git a/model_budget_limit_read.go b/model_budget_limit_read.go new file mode 100644 index 0000000..2541618 --- /dev/null +++ b/model_budget_limit_read.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BudgetLimitRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *BudgetLimit `json:"attributes"` +} diff --git a/model_budget_limit_single.go b/model_budget_limit_single.go new file mode 100644 index 0000000..100db88 --- /dev/null +++ b/model_budget_limit_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BudgetLimitSingle struct { + Data *BudgetLimitRead `json:"data"` +} diff --git a/model_budget_limit_store.go b/model_budget_limit_store.go new file mode 100644 index 0000000..003e048 --- /dev/null +++ b/model_budget_limit_store.go @@ -0,0 +1,26 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BudgetLimitStore struct { + // Use either currency_id or currency_code. Defaults to the user's default currency. + CurrencyId string `json:"currency_id,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + CurrencyCode string `json:"currency_code,omitempty"` + // The budget ID of the associated budget. + BudgetId string `json:"budget_id"` + // Start date of the budget limit. + Start string `json:"start"` + // Period of the budget limit. Only used when auto-generated by auto-budget. + Period string `json:"period,omitempty"` + // End date of the budget limit. + End string `json:"end"` + Amount string `json:"amount"` +} diff --git a/model_budget_read.go b/model_budget_read.go new file mode 100644 index 0000000..b3c2e0c --- /dev/null +++ b/model_budget_read.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BudgetRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *Budget `json:"attributes"` +} diff --git a/model_budget_single.go b/model_budget_single.go new file mode 100644 index 0000000..a3d3a21 --- /dev/null +++ b/model_budget_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BudgetSingle struct { + Data *BudgetRead `json:"data"` +} diff --git a/model_budget_spent.go b/model_budget_spent.go new file mode 100644 index 0000000..ee4405c --- /dev/null +++ b/model_budget_spent.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BudgetSpent struct { + // The amount spent. + Sum string `json:"sum,omitempty"` + CurrencyId string `json:"currency_id,omitempty"` + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + // Number of decimals supported by the currency + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` +} diff --git a/model_budget_store.go b/model_budget_store.go new file mode 100644 index 0000000..fd3ca8a --- /dev/null +++ b/model_budget_store.go @@ -0,0 +1,24 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BudgetStore struct { + Name string `json:"name"` + Active bool `json:"active,omitempty"` + Order int32 `json:"order,omitempty"` + Notes string `json:"notes,omitempty"` + AutoBudgetType *AutoBudgetType `json:"auto_budget_type,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + AutoBudgetCurrencyId string `json:"auto_budget_currency_id,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + AutoBudgetCurrencyCode string `json:"auto_budget_currency_code,omitempty"` + AutoBudgetAmount string `json:"auto_budget_amount,omitempty"` + AutoBudgetPeriod *AutoBudgetPeriod `json:"auto_budget_period,omitempty"` +} diff --git a/model_budget_update.go b/model_budget_update.go new file mode 100644 index 0000000..45889c7 --- /dev/null +++ b/model_budget_update.go @@ -0,0 +1,24 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type BudgetUpdate struct { + Name string `json:"name"` + Active bool `json:"active,omitempty"` + Order int32 `json:"order,omitempty"` + Notes string `json:"notes,omitempty"` + AutoBudgetType *AutoBudgetType `json:"auto_budget_type,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + AutoBudgetCurrencyId string `json:"auto_budget_currency_id,omitempty"` + // Use either currency_id or currency_code. Defaults to the user's default currency. + AutoBudgetCurrencyCode string `json:"auto_budget_currency_code,omitempty"` + AutoBudgetAmount string `json:"auto_budget_amount,omitempty"` + AutoBudgetPeriod *AutoBudgetPeriod `json:"auto_budget_period,omitempty"` +} diff --git a/model_category.go b/model_category.go new file mode 100644 index 0000000..833838c --- /dev/null +++ b/model_category.go @@ -0,0 +1,23 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type Category struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + Name string `json:"name"` + Notes string `json:"notes,omitempty"` + Spent []CategorySpent `json:"spent,omitempty"` + Earned []CategoryEarned `json:"earned,omitempty"` +} diff --git a/model_category_array.go b/model_category_array.go new file mode 100644 index 0000000..66dbe1a --- /dev/null +++ b/model_category_array.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CategoryArray struct { + Data []CategoryRead `json:"data"` + Meta *Meta `json:"meta"` +} diff --git a/model_category_earned.go b/model_category_earned.go new file mode 100644 index 0000000..68261f0 --- /dev/null +++ b/model_category_earned.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CategoryEarned struct { + CurrencyId string `json:"currency_id,omitempty"` + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + // Number of decimals supported by the currency + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + // The amount earned. + Sum string `json:"sum,omitempty"` +} diff --git a/model_category_read.go b/model_category_read.go new file mode 100644 index 0000000..cbfc43e --- /dev/null +++ b/model_category_read.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CategoryRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *Category `json:"attributes"` +} diff --git a/model_category_single.go b/model_category_single.go new file mode 100644 index 0000000..9230886 --- /dev/null +++ b/model_category_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CategorySingle struct { + Data *CategoryRead `json:"data"` +} diff --git a/model_category_spent.go b/model_category_spent.go new file mode 100644 index 0000000..ee755b8 --- /dev/null +++ b/model_category_spent.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CategorySpent struct { + CurrencyId string `json:"currency_id,omitempty"` + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + // Number of decimals supported by the currency + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + // The amount spent. + Sum string `json:"sum,omitempty"` +} diff --git a/model_category_update.go b/model_category_update.go new file mode 100644 index 0000000..7b147f3 --- /dev/null +++ b/model_category_update.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CategoryUpdate struct { + Name string `json:"name"` + Notes string `json:"notes,omitempty"` +} diff --git a/model_chart_data_point.go b/model_chart_data_point.go new file mode 100644 index 0000000..2e7d33a --- /dev/null +++ b/model_chart_data_point.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ChartDataPoint struct { + // The key is the label of the value, so for example: '2018-01-01' => 13 or 'Groceries' => -123. + Key string `json:"key,omitempty"` +} diff --git a/model_chart_data_set.go b/model_chart_data_set.go new file mode 100644 index 0000000..daf37e9 --- /dev/null +++ b/model_chart_data_set.go @@ -0,0 +1,33 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type ChartDataSet struct { + // This is the title of the current set. It can refer to an account, a budget or another object (by name). + Label string `json:"label,omitempty"` + // The currency ID of the currency associated to the data in the entries. + CurrencyId string `json:"currency_id,omitempty"` + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + // Number of decimals for the currency associated to the data in the entries. + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + StartDate time.Time `json:"start_date,omitempty"` + EndDate time.Time `json:"end_date,omitempty"` + // Indicated the type of chart that is expected to be rendered. You can safely ignore this if you want. + Type_ string `json:"type,omitempty"` + // Used to indicate the Y axis for this data set. Is usually between 0 and 1 (left and right side of the chart). + YAxisID int32 `json:"yAxisID,omitempty"` + // The actual entries for this data set. They 'key' value is the label for the data point. The value is the actual (numerical) value. + Entries []ChartDataPoint `json:"entries,omitempty"` +} diff --git a/model_config_value_filter.go b/model_config_value_filter.go new file mode 100644 index 0000000..0a37e35 --- /dev/null +++ b/model_config_value_filter.go @@ -0,0 +1,36 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// ConfigValueFilter : Title of the configuration value. +type ConfigValueFilter string + +// List of ConfigValueFilter +const ( + CONFIGURATIONIS_DEMO_SITE_ConfigValueFilter ConfigValueFilter = "configuration.is_demo_site" + CONFIGURATIONPERMISSION_UPDATE_CHECK_ConfigValueFilter ConfigValueFilter = "configuration.permission_update_check" + CONFIGURATIONLAST_UPDATE_CHECK_ConfigValueFilter ConfigValueFilter = "configuration.last_update_check" + CONFIGURATIONSINGLE_USER_MODE_ConfigValueFilter ConfigValueFilter = "configuration.single_user_mode" + FIREFLYVERSION_ConfigValueFilter ConfigValueFilter = "firefly.version" + FIREFLYAPI_VERSION_ConfigValueFilter ConfigValueFilter = "firefly.api_version" + FIREFLYDEFAULT_LOCATION_ConfigValueFilter ConfigValueFilter = "firefly.default_location" + FIREFLYACCOUNT_TO_TRANSACTION_ConfigValueFilter ConfigValueFilter = "firefly.account_to_transaction" + FIREFLYALLOWED_OPPOSING_TYPES_ConfigValueFilter ConfigValueFilter = "firefly.allowed_opposing_types" + FIREFLYACCOUNT_ROLES_ConfigValueFilter ConfigValueFilter = "firefly.accountRoles" + FIREFLYVALID_LIABILITIES_ConfigValueFilter ConfigValueFilter = "firefly.valid_liabilities" + FIREFLYINTEREST_PERIODS_ConfigValueFilter ConfigValueFilter = "firefly.interest_periods" + FIREFLYENABLE_EXTERNAL_MAP_ConfigValueFilter ConfigValueFilter = "firefly.enable_external_map" + FIREFLYEXPECTED_SOURCE_TYPES_ConfigValueFilter ConfigValueFilter = "firefly.expected_source_types" + APPTIMEZONE_ConfigValueFilter ConfigValueFilter = "app.timezone" + FIREFLYBILL_PERIODS_ConfigValueFilter ConfigValueFilter = "firefly.bill_periods" + FIREFLYCREDIT_CARD_TYPES_ConfigValueFilter ConfigValueFilter = "firefly.credit_card_types" + FIREFLYLANGUAGES_ConfigValueFilter ConfigValueFilter = "firefly.languages" + FIREFLYVALID_VIEW_RANGES_ConfigValueFilter ConfigValueFilter = "firefly.valid_view_ranges" +) diff --git a/model_config_value_update_filter.go b/model_config_value_update_filter.go new file mode 100644 index 0000000..80f2a99 --- /dev/null +++ b/model_config_value_update_filter.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ConfigValueUpdateFilter string + +// List of ConfigValueUpdateFilter +const ( + IS_DEMO_SITE_ConfigValueUpdateFilter ConfigValueUpdateFilter = "configuration.is_demo_site" + PERMISSION_UPDATE_CHECK_ConfigValueUpdateFilter ConfigValueUpdateFilter = "configuration.permission_update_check" + LAST_UPDATE_CHECK_ConfigValueUpdateFilter ConfigValueUpdateFilter = "configuration.last_update_check" + SINGLE_USER_MODE_ConfigValueUpdateFilter ConfigValueUpdateFilter = "configuration.single_user_mode" +) diff --git a/model_configuration.go b/model_configuration.go new file mode 100644 index 0000000..19a6665 --- /dev/null +++ b/model_configuration.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +//type Configuration struct { +// Title *ConfigValueFilter `json:"title"` +// Value *PolymorphicProperty `json:"value"` +// // If this config variable can be edited by the user +// Editable bool `json:"editable"` +//} diff --git a/model_configuration_single.go b/model_configuration_single.go new file mode 100644 index 0000000..f6ffe70 --- /dev/null +++ b/model_configuration_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ConfigurationSingle struct { + Data *Configuration `json:"data"` +} diff --git a/model_configuration_update.go b/model_configuration_update.go new file mode 100644 index 0000000..3e58caa --- /dev/null +++ b/model_configuration_update.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ConfigurationUpdate struct { + Value *PolymorphicProperty `json:"value"` +} diff --git a/model_credit_card_type_property.go b/model_credit_card_type_property.go new file mode 100644 index 0000000..2b29d75 --- /dev/null +++ b/model_credit_card_type_property.go @@ -0,0 +1,19 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// CreditCardTypeProperty : Mandatory when the account_role is ccAsset. Can only be monthlyFull or null. +type CreditCardTypeProperty string + +// List of CreditCardTypeProperty +const ( + MONTHLY_FULL_CreditCardTypeProperty CreditCardTypeProperty = "monthlyFull" + NULL_CreditCardTypeProperty CreditCardTypeProperty = "" +) diff --git a/model_cron_result.go b/model_cron_result.go new file mode 100644 index 0000000..83c1778 --- /dev/null +++ b/model_cron_result.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CronResult struct { + RecurringTransactions *CronResultRow `json:"recurring_transactions,omitempty"` + AutoBudgets *CronResultRow `json:"auto_budgets,omitempty"` + Telemetry *CronResultRow `json:"telemetry,omitempty"` +} diff --git a/model_cron_result_row.go b/model_cron_result_row.go new file mode 100644 index 0000000..8660836 --- /dev/null +++ b/model_cron_result_row.go @@ -0,0 +1,21 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CronResultRow struct { + // This value tells you if this specific cron job actually fired. It may not fire. Some cron jobs only fire every 24 hours, for example. + JobFired bool `json:"job_fired,omitempty"` + // This value tells you if this specific cron job actually did something. The job may fire but not change anything. + JobSucceeded bool `json:"job_succeeded,omitempty"` + // If the cron job ran into some kind of an error, this value will be true. + JobErrored bool `json:"job_errored,omitempty"` + // If the cron job ran into some kind of an error, this value will be the error message. The success message if the job actually ran OK. + Message string `json:"message,omitempty"` +} diff --git a/model_currency.go b/model_currency.go new file mode 100644 index 0000000..ba7560f --- /dev/null +++ b/model_currency.go @@ -0,0 +1,28 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type Currency struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // Defaults to true + Enabled bool `json:"enabled,omitempty"` + // Make this currency the default currency. + Default_ bool `json:"default,omitempty"` + Code string `json:"code"` + Name string `json:"name"` + Symbol string `json:"symbol"` + // Supports 0-16 decimals. + DecimalPlaces int32 `json:"decimal_places,omitempty"` +} diff --git a/model_currency_array.go b/model_currency_array.go new file mode 100644 index 0000000..5d4628c --- /dev/null +++ b/model_currency_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CurrencyArray struct { + Data []CurrencyRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_currency_read.go b/model_currency_read.go new file mode 100644 index 0000000..3201d59 --- /dev/null +++ b/model_currency_read.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CurrencyRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *Currency `json:"attributes"` +} diff --git a/model_currency_single.go b/model_currency_single.go new file mode 100644 index 0000000..03e52f2 --- /dev/null +++ b/model_currency_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CurrencySingle struct { + Data *CurrencyRead `json:"data"` +} diff --git a/model_currency_store.go b/model_currency_store.go new file mode 100644 index 0000000..376558c --- /dev/null +++ b/model_currency_store.go @@ -0,0 +1,22 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CurrencyStore struct { + // Defaults to true + Enabled bool `json:"enabled,omitempty"` + // Make this currency the default currency. You can set this value to FALSE, in which case nothing will change to the default currency. If you set it to TRUE, the current default currency will no longer be the default currency. + Default_ bool `json:"default,omitempty"` + Code string `json:"code"` + Name string `json:"name"` + Symbol string `json:"symbol"` + // Supports 0-16 decimals. + DecimalPlaces int32 `json:"decimal_places,omitempty"` +} diff --git a/model_currency_update.go b/model_currency_update.go new file mode 100644 index 0000000..e248332 --- /dev/null +++ b/model_currency_update.go @@ -0,0 +1,25 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type CurrencyUpdate struct { + // If the currency is enabled + Enabled bool `json:"enabled,omitempty"` + // If the currency must be the default for the user. You can only submit TRUE. Submitting FALSE will not drop this currency as the default currency, because then the system would be without one. + Default_ bool `json:"default,omitempty"` + // The currency code + Code string `json:"code,omitempty"` + // The currency name + Name string `json:"name,omitempty"` + // The currency symbol + Symbol string `json:"symbol,omitempty"` + // How many decimals to use when displaying this currency. Between 0 and 16. + DecimalPlaces int32 `json:"decimal_places,omitempty"` +} diff --git a/model_data_destroy_object.go b/model_data_destroy_object.go new file mode 100644 index 0000000..18b59a4 --- /dev/null +++ b/model_data_destroy_object.go @@ -0,0 +1,34 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type DataDestroyObject string + +// List of DataDestroyObject +const ( + NOT_ASSETS_LIABILITIES_DataDestroyObject DataDestroyObject = "not_assets_liabilities" + BUDGETS_DataDestroyObject DataDestroyObject = "budgets" + BILLS_DataDestroyObject DataDestroyObject = "bills" + PIGGY_BANKS_DataDestroyObject DataDestroyObject = "piggy_banks" + RULES_DataDestroyObject DataDestroyObject = "rules" + RECURRING_DataDestroyObject DataDestroyObject = "recurring" + CATEGORIES_DataDestroyObject DataDestroyObject = "categories" + TAGS_DataDestroyObject DataDestroyObject = "tags" + OBJECT_GROUPS_DataDestroyObject DataDestroyObject = "object_groups" + ACCOUNTS_DataDestroyObject DataDestroyObject = "accounts" + ASSET_ACCOUNTS_DataDestroyObject DataDestroyObject = "asset_accounts" + EXPENSE_ACCOUNTS_DataDestroyObject DataDestroyObject = "expense_accounts" + REVENUE_ACCOUNTS_DataDestroyObject DataDestroyObject = "revenue_accounts" + LIABILITIES_DataDestroyObject DataDestroyObject = "liabilities" + TRANSACTIONS_DataDestroyObject DataDestroyObject = "transactions" + WITHDRAWALS_DataDestroyObject DataDestroyObject = "withdrawals" + DEPOSITS_DataDestroyObject DataDestroyObject = "deposits" + TRANSFERS_DataDestroyObject DataDestroyObject = "transfers" +) diff --git a/model_export_file_filter.go b/model_export_file_filter.go new file mode 100644 index 0000000..544b59a --- /dev/null +++ b/model_export_file_filter.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ExportFileFilter string + +// List of ExportFileFilter +const ( + CSV_ExportFileFilter ExportFileFilter = "csv" +) diff --git a/model_insight_group_entry.go b/model_insight_group_entry.go new file mode 100644 index 0000000..20fa483 --- /dev/null +++ b/model_insight_group_entry.go @@ -0,0 +1,25 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type InsightGroupEntry struct { + // This ID is a reference to the original object. + Id string `json:"id,omitempty"` + // This is the name of the object. + Name string `json:"name,omitempty"` + // The amount spent or earned between start date and end date, a number defined as a string, for this object and all asset accounts. + Difference string `json:"difference,omitempty"` + // The amount spent or earned between start date and end date, a number as a float, for this object and all asset accounts. May have rounding errors. + DifferenceFloat float64 `json:"difference_float,omitempty"` + // The currency ID of the expenses listed for this account. + CurrencyId string `json:"currency_id,omitempty"` + // The currency code of the expenses listed for this account. + CurrencyCode string `json:"currency_code,omitempty"` +} diff --git a/model_insight_total_entry.go b/model_insight_total_entry.go new file mode 100644 index 0000000..58c7971 --- /dev/null +++ b/model_insight_total_entry.go @@ -0,0 +1,21 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type InsightTotalEntry struct { + // The amount spent between start date and end date, defined as a string, for this expense account and all asset accounts. + Difference string `json:"difference,omitempty"` + // The amount spent between start date and end date, defined as a string, for this expense account and all asset accounts. This number is a float (double) and may have rounding errors. + DifferenceFloat float64 `json:"difference_float,omitempty"` + // The currency ID of the expenses listed for this expense account. + CurrencyId string `json:"currency_id,omitempty"` + // The currency code of the expenses listed for this expense account. + CurrencyCode string `json:"currency_code,omitempty"` +} diff --git a/model_insight_transfer_entry.go b/model_insight_transfer_entry.go new file mode 100644 index 0000000..1c254b6 --- /dev/null +++ b/model_insight_transfer_entry.go @@ -0,0 +1,33 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type InsightTransferEntry struct { + // This ID is a reference to the original object. + Id string `json:"id,omitempty"` + // This is the name of the object. + Name string `json:"name,omitempty"` + // The total amount transferred between start date and end date, a number defined as a string, for this asset account. + Difference string `json:"difference,omitempty"` + // The total amount transferred between start date and end date, a number as a float, for this asset account. May have rounding errors. + DifferenceFloat float64 `json:"difference_float,omitempty"` + // The total amount transferred TO this account between start date and end date, a number defined as a string, for this asset account. + In string `json:"in,omitempty"` + // The total amount transferred FROM this account between start date and end date, a number as a float, for this asset account. May have rounding errors. + InFloat float64 `json:"in_float,omitempty"` + // The total amount transferred FROM this account between start date and end date, a number defined as a string, for this asset account. + Out string `json:"out,omitempty"` + // The total amount transferred TO this account between start date and end date, a number as a float, for this asset account. May have rounding errors. + OutFloat float64 `json:"out_float,omitempty"` + // The currency ID of the expenses listed for this account. + CurrencyId string `json:"currency_id,omitempty"` + // The currency code of the expenses listed for this account. + CurrencyCode string `json:"currency_code,omitempty"` +} diff --git a/model_interest_period_property.go b/model_interest_period_property.go new file mode 100644 index 0000000..95b24ce --- /dev/null +++ b/model_interest_period_property.go @@ -0,0 +1,23 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// InterestPeriodProperty : Mandatory when type is liability. Period over which the interest is calculated. +type InterestPeriodProperty string + +// List of InterestPeriodProperty +const ( + WEEKLY_InterestPeriodProperty InterestPeriodProperty = "weekly" + MONTHLY_InterestPeriodProperty InterestPeriodProperty = "monthly" + QUARTERLY_InterestPeriodProperty InterestPeriodProperty = "quarterly" + HALF_YEAR_InterestPeriodProperty InterestPeriodProperty = "half-year" + YEARLY_InterestPeriodProperty InterestPeriodProperty = "yearly" + NULL_InterestPeriodProperty InterestPeriodProperty = "" +) diff --git a/model_internal_exception_response.go b/model_internal_exception_response.go new file mode 100644 index 0000000..765b6fb --- /dev/null +++ b/model_internal_exception_response.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type InternalExceptionResponse struct { + Message string `json:"message,omitempty"` + Exception string `json:"exception,omitempty"` +} diff --git a/model_liability_direction_property.go b/model_liability_direction_property.go new file mode 100644 index 0000000..9a71a58 --- /dev/null +++ b/model_liability_direction_property.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// LiabilityDirectionProperty : 'credit' indicates somebody owes you the liability. 'debit' Indicates you owe this debt yourself. Works only for liabiltiies. +type LiabilityDirectionProperty string + +// List of LiabilityDirectionProperty +const ( + CREDIT_LiabilityDirectionProperty LiabilityDirectionProperty = "credit" + DEBIT_LiabilityDirectionProperty LiabilityDirectionProperty = "debit" + NULL_LiabilityDirectionProperty LiabilityDirectionProperty = "" +) diff --git a/model_liability_type_property.go b/model_liability_type_property.go new file mode 100644 index 0000000..292b83d --- /dev/null +++ b/model_liability_type_property.go @@ -0,0 +1,21 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// LiabilityTypeProperty : Mandatory when type is liability. Specifies the exact type. +type LiabilityTypeProperty string + +// List of LiabilityTypeProperty +const ( + LOAN_LiabilityTypeProperty LiabilityTypeProperty = "loan" + DEBT_LiabilityTypeProperty LiabilityTypeProperty = "debt" + MORTGAGE_LiabilityTypeProperty LiabilityTypeProperty = "mortgage" + NULL_LiabilityTypeProperty LiabilityTypeProperty = "" +) diff --git a/model_link_type.go b/model_link_type.go new file mode 100644 index 0000000..e791f57 --- /dev/null +++ b/model_link_type.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type LinkType struct { + Name string `json:"name"` + Inward string `json:"inward"` + Outward string `json:"outward"` + Editable bool `json:"editable,omitempty"` +} diff --git a/model_link_type_array.go b/model_link_type_array.go new file mode 100644 index 0000000..730d618 --- /dev/null +++ b/model_link_type_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type LinkTypeArray struct { + Data []LinkTypeRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_link_type_read.go b/model_link_type_read.go new file mode 100644 index 0000000..f8c1221 --- /dev/null +++ b/model_link_type_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type LinkTypeRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *LinkType `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_link_type_single.go b/model_link_type_single.go new file mode 100644 index 0000000..bbf4f0e --- /dev/null +++ b/model_link_type_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type LinkTypeSingle struct { + Data *LinkTypeRead `json:"data"` +} diff --git a/model_link_type_update.go b/model_link_type_update.go new file mode 100644 index 0000000..fa66c1b --- /dev/null +++ b/model_link_type_update.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type LinkTypeUpdate struct { + Name string `json:"name,omitempty"` + Inward string `json:"inward,omitempty"` + Outward string `json:"outward,omitempty"` +} diff --git a/model_meta.go b/model_meta.go new file mode 100644 index 0000000..c860da5 --- /dev/null +++ b/model_meta.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type Meta struct { + Pagination *MetaPagination `json:"pagination,omitempty"` +} diff --git a/model_meta_pagination.go b/model_meta_pagination.go new file mode 100644 index 0000000..edd0830 --- /dev/null +++ b/model_meta_pagination.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type MetaPagination struct { + Total int32 `json:"total,omitempty"` + Count int32 `json:"count,omitempty"` + PerPage int32 `json:"per_page,omitempty"` + CurrentPage int32 `json:"current_page,omitempty"` + TotalPages int32 `json:"total_pages,omitempty"` +} diff --git a/model_not_found_response.go b/model_not_found_response.go new file mode 100644 index 0000000..270c42c --- /dev/null +++ b/model_not_found_response.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type NotFoundResponse struct { + Message string `json:"message,omitempty"` + Exception string `json:"exception,omitempty"` +} diff --git a/model_object_group.go b/model_object_group.go new file mode 100644 index 0000000..3f65356 --- /dev/null +++ b/model_object_group.go @@ -0,0 +1,22 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type ObjectGroup struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + Title string `json:"title"` + // Order of the object group + Order int32 `json:"order"` +} diff --git a/model_object_group_array.go b/model_object_group_array.go new file mode 100644 index 0000000..2c36787 --- /dev/null +++ b/model_object_group_array.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ObjectGroupArray struct { + Data []ObjectGroupRead `json:"data"` + Meta *Meta `json:"meta"` +} diff --git a/model_object_group_read.go b/model_object_group_read.go new file mode 100644 index 0000000..cb7ccc9 --- /dev/null +++ b/model_object_group_read.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ObjectGroupRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *ObjectGroup `json:"attributes"` +} diff --git a/model_object_group_single.go b/model_object_group_single.go new file mode 100644 index 0000000..5eaf49b --- /dev/null +++ b/model_object_group_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ObjectGroupSingle struct { + Data *ObjectGroupRead `json:"data"` +} diff --git a/model_object_group_update.go b/model_object_group_update.go new file mode 100644 index 0000000..5dba2f5 --- /dev/null +++ b/model_object_group_update.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ObjectGroupUpdate struct { + Title string `json:"title"` + // Order of the object group + Order int32 `json:"order,omitempty"` +} diff --git a/model_object_link.go b/model_object_link.go new file mode 100644 index 0000000..f7f6f33 --- /dev/null +++ b/model_object_link.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ObjectLink struct { + Var0 *ObjectLink0 `json:"0,omitempty"` + Self string `json:"self,omitempty"` +} diff --git a/model_object_link_0.go b/model_object_link_0.go new file mode 100644 index 0000000..64e490d --- /dev/null +++ b/model_object_link_0.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ObjectLink0 struct { + Rel string `json:"rel,omitempty"` + Uri string `json:"uri,omitempty"` +} diff --git a/model_page_link.go b/model_page_link.go new file mode 100644 index 0000000..f2e1842 --- /dev/null +++ b/model_page_link.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PageLink struct { + Self string `json:"self,omitempty"` + First string `json:"first,omitempty"` + Next string `json:"next,omitempty"` + Prev string `json:"prev,omitempty"` + Last string `json:"last,omitempty"` +} diff --git a/model_piggy_bank.go b/model_piggy_bank.go new file mode 100644 index 0000000..a0e8517 --- /dev/null +++ b/model_piggy_bank.go @@ -0,0 +1,47 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type PiggyBank struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // The ID of the asset account this piggy bank is connected to. + AccountId string `json:"account_id"` + // The name of the asset account this piggy bank is connected to. + AccountName string `json:"account_name,omitempty"` + Name string `json:"name"` + CurrencyId string `json:"currency_id,omitempty"` + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + // Number of decimals supported by the currency + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + TargetAmount string `json:"target_amount"` + Percentage float32 `json:"percentage,omitempty"` + CurrentAmount string `json:"current_amount,omitempty"` + LeftToSave string `json:"left_to_save,omitempty"` + SavePerMonth string `json:"save_per_month,omitempty"` + // The date you started with this piggy bank. + StartDate string `json:"start_date,omitempty"` + // The date you intend to finish saving money. + TargetDate string `json:"target_date,omitempty"` + Order int32 `json:"order,omitempty"` + Active bool `json:"active,omitempty"` + Notes string `json:"notes,omitempty"` + // The group ID of the group this object is part of. NULL if no group. + ObjectGroupId string `json:"object_group_id,omitempty"` + // The order of the group. At least 1, for the highest sorting. + ObjectGroupOrder int32 `json:"object_group_order,omitempty"` + // The name of the group. NULL if no group. + ObjectGroupTitle string `json:"object_group_title,omitempty"` +} diff --git a/model_piggy_bank_array.go b/model_piggy_bank_array.go new file mode 100644 index 0000000..6e5aa49 --- /dev/null +++ b/model_piggy_bank_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PiggyBankArray struct { + Data []PiggyBankRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_piggy_bank_event.go b/model_piggy_bank_event.go new file mode 100644 index 0000000..5ca274c --- /dev/null +++ b/model_piggy_bank_event.go @@ -0,0 +1,28 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type PiggyBankEvent struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + CurrencyId string `json:"currency_id,omitempty"` + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + Amount string `json:"amount,omitempty"` + // The journal associated with the event. + TransactionJournalId string `json:"transaction_journal_id,omitempty"` + // The transaction group associated with the event. + TransactionGroupId string `json:"transaction_group_id,omitempty"` +} diff --git a/model_piggy_bank_event_array.go b/model_piggy_bank_event_array.go new file mode 100644 index 0000000..171b5c2 --- /dev/null +++ b/model_piggy_bank_event_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PiggyBankEventArray struct { + Data []PiggyBankEventRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_piggy_bank_event_read.go b/model_piggy_bank_event_read.go new file mode 100644 index 0000000..110f23a --- /dev/null +++ b/model_piggy_bank_event_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PiggyBankEventRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *PiggyBankEvent `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_piggy_bank_read.go b/model_piggy_bank_read.go new file mode 100644 index 0000000..227b4bc --- /dev/null +++ b/model_piggy_bank_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PiggyBankRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *PiggyBank `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_piggy_bank_single.go b/model_piggy_bank_single.go new file mode 100644 index 0000000..4de9854 --- /dev/null +++ b/model_piggy_bank_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PiggyBankSingle struct { + Data *PiggyBankRead `json:"data"` +} diff --git a/model_piggy_bank_store.go b/model_piggy_bank_store.go new file mode 100644 index 0000000..7f819ab --- /dev/null +++ b/model_piggy_bank_store.go @@ -0,0 +1,29 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PiggyBankStore struct { + Name string `json:"name"` + // The ID of the asset account this piggy bank is connected to. + AccountId string `json:"account_id"` + TargetAmount string `json:"target_amount"` + CurrentAmount string `json:"current_amount,omitempty"` + // The date you started with this piggy bank. + StartDate string `json:"start_date,omitempty"` + // The date you intend to finish saving money. + TargetDate string `json:"target_date,omitempty"` + Order int32 `json:"order,omitempty"` + Active bool `json:"active,omitempty"` + Notes string `json:"notes,omitempty"` + // The group ID of the group this object is part of. NULL if no group. + ObjectGroupId string `json:"object_group_id,omitempty"` + // The name of the group. NULL if no group. + ObjectGroupTitle string `json:"object_group_title,omitempty"` +} diff --git a/model_piggy_bank_update.go b/model_piggy_bank_update.go new file mode 100644 index 0000000..8a1d5c4 --- /dev/null +++ b/model_piggy_bank_update.go @@ -0,0 +1,31 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PiggyBankUpdate struct { + Name string `json:"name,omitempty"` + // The ID of the asset account this piggy bank is connected to. + AccountId string `json:"account_id,omitempty"` + CurrencyId string `json:"currency_id,omitempty"` + CurrencyCode string `json:"currency_code,omitempty"` + TargetAmount string `json:"target_amount,omitempty"` + CurrentAmount string `json:"current_amount,omitempty"` + // The date you started with this piggy bank. + StartDate string `json:"start_date,omitempty"` + // The date you intend to finish saving money. + TargetDate string `json:"target_date,omitempty"` + Order int32 `json:"order,omitempty"` + Active bool `json:"active,omitempty"` + Notes string `json:"notes,omitempty"` + // The group ID of the group this object is part of. NULL if no group. + ObjectGroupId string `json:"object_group_id,omitempty"` + // The name of the group. NULL if no group. + ObjectGroupTitle string `json:"object_group_title,omitempty"` +} diff --git a/model_polymorphic_property.go b/model_polymorphic_property.go new file mode 100644 index 0000000..83a4c96 --- /dev/null +++ b/model_polymorphic_property.go @@ -0,0 +1,13 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PolymorphicProperty struct { +} diff --git a/model_preference.go b/model_preference.go new file mode 100644 index 0000000..3320b0f --- /dev/null +++ b/model_preference.go @@ -0,0 +1,21 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type Preference struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + Name string `json:"name"` + Data *PolymorphicProperty `json:"data"` +} diff --git a/model_preference_array.go b/model_preference_array.go new file mode 100644 index 0000000..8e43c65 --- /dev/null +++ b/model_preference_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PreferenceArray struct { + Data []PreferenceRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_preference_read.go b/model_preference_read.go new file mode 100644 index 0000000..fd845f9 --- /dev/null +++ b/model_preference_read.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PreferenceRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *Preference `json:"attributes"` +} diff --git a/model_preference_single.go b/model_preference_single.go new file mode 100644 index 0000000..22fb093 --- /dev/null +++ b/model_preference_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PreferenceSingle struct { + Data *PreferenceRead `json:"data"` +} diff --git a/model_preference_update.go b/model_preference_update.go new file mode 100644 index 0000000..ff57c8e --- /dev/null +++ b/model_preference_update.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type PreferenceUpdate struct { + Data *PolymorphicProperty `json:"data"` +} diff --git a/model_recurrence.go b/model_recurrence.go new file mode 100644 index 0000000..b3f0392 --- /dev/null +++ b/model_recurrence.go @@ -0,0 +1,38 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type Recurrence struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + Type_ *RecurrenceTransactionType `json:"type,omitempty"` + Title string `json:"title,omitempty"` + // Not to be confused with the description of the actual transaction(s) being created. + Description string `json:"description,omitempty"` + // First time the recurring transaction will fire. Must be after today. + FirstDate string `json:"first_date,omitempty"` + // Last time the recurring transaction has fired. + LatestDate string `json:"latest_date,omitempty"` + // Date until the recurring transaction can fire. Use either this field or repetitions. + RepeatUntil string `json:"repeat_until,omitempty"` + // Max number of created transactions. Use either this field or repeat_until. + NrOfRepetitions int32 `json:"nr_of_repetitions,omitempty"` + // Whether or not to fire the rules after the creation of a transaction. + ApplyRules bool `json:"apply_rules,omitempty"` + // If the recurrence is even active. + Active bool `json:"active,omitempty"` + Notes string `json:"notes,omitempty"` + Repetitions []RecurrenceRepetition `json:"repetitions,omitempty"` + Transactions []RecurrenceTransaction `json:"transactions,omitempty"` +} diff --git a/model_recurrence_array.go b/model_recurrence_array.go new file mode 100644 index 0000000..bac6c49 --- /dev/null +++ b/model_recurrence_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RecurrenceArray struct { + Data []RecurrenceRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_recurrence_read.go b/model_recurrence_read.go new file mode 100644 index 0000000..bac82f7 --- /dev/null +++ b/model_recurrence_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RecurrenceRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *Recurrence `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_recurrence_repetition.go b/model_recurrence_repetition.go new file mode 100644 index 0000000..14f7ea8 --- /dev/null +++ b/model_recurrence_repetition.go @@ -0,0 +1,31 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type RecurrenceRepetition struct { + Id string `json:"id,omitempty"` + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + Type_ *RecurrenceRepetitionType `json:"type"` + // Information that defined the type of repetition. - For 'daily', this is empty. - For 'weekly', it is day of the week between 1 and 7 (Monday - Sunday). - For 'ndom', it is '1,2' or '4,5' or something else, where the first number is the week in the month, and the second number is the day in the week (between 1 and 7). '2,3' means: the 2nd Wednesday of the month - For 'monthly' it is the day of the month (1 - 31) - For yearly, it is a full date, ie '2018-09-17'. The year you use does not matter. + Moment string `json:"moment"` + // How many occurrences to skip. 0 means skip nothing. 1 means every other. + Skip int32 `json:"skip,omitempty"` + // How to respond when the recurring transaction falls in the weekend. Possible values: 1. Do nothing, just create it 2. Create no transaction. 3. Skip to the previous Friday. 4. Skip to the next Monday. + Weekend int32 `json:"weekend,omitempty"` + // Auto-generated repetition description. + Description string `json:"description,omitempty"` + // Array of future dates when the repetition will apply to. Auto generated. + Occurrences []time.Time `json:"occurrences,omitempty"` +} diff --git a/model_recurrence_repetition_store.go b/model_recurrence_repetition_store.go new file mode 100644 index 0000000..bc535de --- /dev/null +++ b/model_recurrence_repetition_store.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RecurrenceRepetitionStore struct { + Type_ *RecurrenceRepetitionType `json:"type"` + // Information that defined the type of repetition. - For 'daily', this is empty. - For 'weekly', it is day of the week between 1 and 7 (Monday - Sunday). - For 'ndom', it is '1,2' or '4,5' or something else, where the first number is the week in the month, and the second number is the day in the week (between 1 and 7). '2,3' means: the 2nd Wednesday of the month - For 'monthly' it is the day of the month (1 - 31) - For yearly, it is a full date, ie '2018-09-17'. The year you use does not matter. + Moment string `json:"moment"` + // How many occurrences to skip. 0 means skip nothing. 1 means every other. + Skip int32 `json:"skip,omitempty"` + // How to respond when the recurring transaction falls in the weekend. Possible values: 1. Do nothing, just create it 2. Create no transaction. 3. Skip to the previous Friday. 4. Skip to the next Monday. + Weekend int32 `json:"weekend,omitempty"` +} diff --git a/model_recurrence_repetition_type.go b/model_recurrence_repetition_type.go new file mode 100644 index 0000000..540639d --- /dev/null +++ b/model_recurrence_repetition_type.go @@ -0,0 +1,22 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// RecurrenceRepetitionType : The type of the repetition. ndom means: the n-th weekday of the month, where you can also specify which day of the week. +type RecurrenceRepetitionType string + +// List of RecurrenceRepetitionType +const ( + DAILY_RecurrenceRepetitionType RecurrenceRepetitionType = "daily" + WEEKLY_RecurrenceRepetitionType RecurrenceRepetitionType = "weekly" + NDOM_RecurrenceRepetitionType RecurrenceRepetitionType = "ndom" + MONTHLY_RecurrenceRepetitionType RecurrenceRepetitionType = "monthly" + YEARLY_RecurrenceRepetitionType RecurrenceRepetitionType = "yearly" +) diff --git a/model_recurrence_repetition_update.go b/model_recurrence_repetition_update.go new file mode 100644 index 0000000..c91105b --- /dev/null +++ b/model_recurrence_repetition_update.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RecurrenceRepetitionUpdate struct { + Type_ *RecurrenceRepetitionType `json:"type,omitempty"` + // Information that defined the type of repetition. - For 'daily', this is empty. - For 'weekly', it is day of the week between 1 and 7 (Monday - Sunday). - For 'ndom', it is '1,2' or '4,5' or something else, where the first number is the week in the month, and the second number is the day in the week (between 1 and 7). '2,3' means: the 2nd Wednesday of the month - For 'monthly' it is the day of the month (1 - 31) - For yearly, it is a full date, ie '2018-09-17'. The year you use does not matter. + Moment string `json:"moment,omitempty"` + // How many occurrences to skip. 0 means skip nothing. 1 means every other. + Skip int32 `json:"skip,omitempty"` + // How to respond when the recurring transaction falls in the weekend. Possible values: 1. Do nothing, just create it 2. Create no transaction. 3. Skip to the previous Friday. 4. Skip to the next Monday. + Weekend int32 `json:"weekend,omitempty"` +} diff --git a/model_recurrence_single.go b/model_recurrence_single.go new file mode 100644 index 0000000..4335a12 --- /dev/null +++ b/model_recurrence_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RecurrenceSingle struct { + Data *RecurrenceRead `json:"data"` +} diff --git a/model_recurrence_store.go b/model_recurrence_store.go new file mode 100644 index 0000000..10d686a --- /dev/null +++ b/model_recurrence_store.go @@ -0,0 +1,30 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RecurrenceStore struct { + Type_ *RecurrenceTransactionType `json:"type"` + Title string `json:"title"` + // Not to be confused with the description of the actual transaction(s) being created. + Description string `json:"description,omitempty"` + // First time the recurring transaction will fire. Must be after today. + FirstDate string `json:"first_date"` + // Date until the recurring transaction can fire. Use either this field or repetitions. + RepeatUntil string `json:"repeat_until"` + // Max number of created transactions. Use either this field or repeat_until. + NrOfRepetitions int32 `json:"nr_of_repetitions,omitempty"` + // Whether or not to fire the rules after the creation of a transaction. + ApplyRules bool `json:"apply_rules,omitempty"` + // If the recurrence is even active. + Active bool `json:"active,omitempty"` + Notes string `json:"notes,omitempty"` + Repetitions []RecurrenceRepetitionStore `json:"repetitions"` + Transactions []RecurrenceTransactionStore `json:"transactions"` +} diff --git a/model_recurrence_transaction.go b/model_recurrence_transaction.go new file mode 100644 index 0000000..bece93f --- /dev/null +++ b/model_recurrence_transaction.go @@ -0,0 +1,63 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RecurrenceTransaction struct { + Id string `json:"id,omitempty"` + Description string `json:"description"` + // Amount of the transaction. + Amount string `json:"amount"` + // Foreign amount of the transaction. + ForeignAmount string `json:"foreign_amount,omitempty"` + // Submit either a currency_id or a currency_code. + CurrencyId string `json:"currency_id,omitempty"` + // Submit either a currency_id or a currency_code. + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + // Number of decimals in the currency + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + // Submit either a foreign_currency_id or a foreign_currency_code, or neither. + ForeignCurrencyId string `json:"foreign_currency_id,omitempty"` + // Submit either a foreign_currency_id or a foreign_currency_code, or neither. + ForeignCurrencyCode string `json:"foreign_currency_code,omitempty"` + ForeignCurrencySymbol string `json:"foreign_currency_symbol,omitempty"` + // Number of decimals in the currency + ForeignCurrencyDecimalPlaces int32 `json:"foreign_currency_decimal_places,omitempty"` + // The budget ID for this transaction. + BudgetId string `json:"budget_id,omitempty"` + // The name of the budget to be used. If the budget name is unknown, the ID will be used or the value will be ignored. + BudgetName string `json:"budget_name,omitempty"` + // Category ID for this transaction. + CategoryId string `json:"category_id,omitempty"` + // Category name for this transaction. + CategoryName string `json:"category_name,omitempty"` + // ID of the source account. Submit either this or source_name. + SourceId string `json:"source_id,omitempty"` + // Name of the source account. Submit either this or source_id. + SourceName string `json:"source_name,omitempty"` + SourceIban string `json:"source_iban,omitempty"` + SourceType *AccountTypeProperty `json:"source_type,omitempty"` + // ID of the destination account. Submit either this or destination_name. + DestinationId string `json:"destination_id,omitempty"` + // Name of the destination account. Submit either this or destination_id. + DestinationName string `json:"destination_name,omitempty"` + DestinationIban string `json:"destination_iban,omitempty"` + DestinationType *AccountTypeProperty `json:"destination_type,omitempty"` + // Array of tags. + Tags []string `json:"tags,omitempty"` + // Optional. Use either this or the piggy_bank_name + PiggyBankId string `json:"piggy_bank_id,omitempty"` + // Optional. Use either this or the piggy_bank_id + PiggyBankName string `json:"piggy_bank_name,omitempty"` + // Optional. Use either this or the bill_name + BillId string `json:"bill_id,omitempty"` + // Optional. Use either this or the bill_id + BillName string `json:"bill_name,omitempty"` +} diff --git a/model_recurrence_transaction_store.go b/model_recurrence_transaction_store.go new file mode 100644 index 0000000..1f073d7 --- /dev/null +++ b/model_recurrence_transaction_store.go @@ -0,0 +1,40 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RecurrenceTransactionStore struct { + Description string `json:"description"` + // Amount of the transaction. + Amount string `json:"amount"` + // Foreign amount of the transaction. + ForeignAmount string `json:"foreign_amount,omitempty"` + // Submit either a currency_id or a currency_code. + CurrencyId string `json:"currency_id,omitempty"` + // Submit either a currency_id or a currency_code. + CurrencyCode string `json:"currency_code,omitempty"` + // Submit either a foreign_currency_id or a foreign_currency_code, or neither. + ForeignCurrencyId string `json:"foreign_currency_id,omitempty"` + // Submit either a foreign_currency_id or a foreign_currency_code, or neither. + ForeignCurrencyCode string `json:"foreign_currency_code,omitempty"` + // The budget ID for this transaction. + BudgetId string `json:"budget_id,omitempty"` + // Category ID for this transaction. + CategoryId string `json:"category_id,omitempty"` + // ID of the source account. + SourceId string `json:"source_id"` + // ID of the destination account. + DestinationId string `json:"destination_id"` + // Array of tags. + Tags []string `json:"tags,omitempty"` + // Optional. + PiggyBankId string `json:"piggy_bank_id,omitempty"` + // Optional. + BillId string `json:"bill_id,omitempty"` +} diff --git a/model_recurrence_transaction_type.go b/model_recurrence_transaction_type.go new file mode 100644 index 0000000..2a5a79e --- /dev/null +++ b/model_recurrence_transaction_type.go @@ -0,0 +1,19 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RecurrenceTransactionType string + +// List of RecurrenceTransactionType +const ( + WITHDRAWAL_RecurrenceTransactionType RecurrenceTransactionType = "withdrawal" + TRANSFER_RecurrenceTransactionType RecurrenceTransactionType = "transfer" + DEPOSIT_RecurrenceTransactionType RecurrenceTransactionType = "deposit" +) diff --git a/model_recurrence_transaction_update.go b/model_recurrence_transaction_update.go new file mode 100644 index 0000000..29d64c9 --- /dev/null +++ b/model_recurrence_transaction_update.go @@ -0,0 +1,38 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RecurrenceTransactionUpdate struct { + Id string `json:"id"` + Description string `json:"description,omitempty"` + // Amount of the transaction. + Amount string `json:"amount,omitempty"` + // Foreign amount of the transaction. + ForeignAmount string `json:"foreign_amount,omitempty"` + // Submit either a currency_id or a currency_code. + CurrencyId string `json:"currency_id,omitempty"` + // Submit either a currency_id or a currency_code. + CurrencyCode string `json:"currency_code,omitempty"` + // Submit either a foreign_currency_id or a foreign_currency_code, or neither. + ForeignCurrencyId string `json:"foreign_currency_id,omitempty"` + // The budget ID for this transaction. + BudgetId string `json:"budget_id,omitempty"` + // Category ID for this transaction. + CategoryId string `json:"category_id,omitempty"` + // ID of the source account. Submit either this or source_name. + SourceId string `json:"source_id,omitempty"` + // ID of the destination account. Submit either this or destination_name. + DestinationId string `json:"destination_id,omitempty"` + // Array of tags. + Tags []string `json:"tags,omitempty"` + PiggyBankId string `json:"piggy_bank_id,omitempty"` + // Optional. + BillId string `json:"bill_id,omitempty"` +} diff --git a/model_recurrence_update.go b/model_recurrence_update.go new file mode 100644 index 0000000..034465c --- /dev/null +++ b/model_recurrence_update.go @@ -0,0 +1,29 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RecurrenceUpdate struct { + Title string `json:"title,omitempty"` + // Not to be confused with the description of the actual transaction(s) being created. + Description string `json:"description,omitempty"` + // First time the recurring transaction will fire. + FirstDate string `json:"first_date,omitempty"` + // Date until the recurring transaction can fire. After that date, it's basically inactive. Use either this field or repetitions. + RepeatUntil string `json:"repeat_until,omitempty"` + // Max number of created transactions. Use either this field or repeat_until. + NrOfRepetitions int32 `json:"nr_of_repetitions,omitempty"` + // Whether or not to fire the rules after the creation of a transaction. + ApplyRules bool `json:"apply_rules,omitempty"` + // If the recurrence is even active. + Active bool `json:"active,omitempty"` + Notes string `json:"notes,omitempty"` + Repetitions []RecurrenceRepetitionUpdate `json:"repetitions,omitempty"` + Transactions []RecurrenceTransactionUpdate `json:"transactions,omitempty"` +} diff --git a/model_rule.go b/model_rule.go new file mode 100644 index 0000000..557c141 --- /dev/null +++ b/model_rule.go @@ -0,0 +1,35 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type Rule struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + Title string `json:"title"` + Description string `json:"description,omitempty"` + // ID of the rule group under which the rule must be stored. Either this field or rule_group_title is mandatory. + RuleGroupId string `json:"rule_group_id"` + // Title of the rule group under which the rule must be stored. Either this field or rule_group_id is mandatory. + RuleGroupTitle string `json:"rule_group_title,omitempty"` + Order int32 `json:"order,omitempty"` + Trigger *RuleTriggerType `json:"trigger"` + // Whether or not the rule is even active. Default is true. + Active bool `json:"active,omitempty"` + // If the rule is set to be strict, ALL triggers must hit in order for the rule to fire. Otherwise, just one is enough. Default value is true. + Strict bool `json:"strict,omitempty"` + // If this value is true and the rule is triggered, other rules after this one in the group will be skipped. Default value is false. + StopProcessing bool `json:"stop_processing,omitempty"` + Triggers []RuleTrigger `json:"triggers"` + Actions []RuleAction `json:"actions"` +} diff --git a/model_rule_action.go b/model_rule_action.go new file mode 100644 index 0000000..8cf5881 --- /dev/null +++ b/model_rule_action.go @@ -0,0 +1,29 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type RuleAction struct { + Id string `json:"id,omitempty"` + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + Type_ *RuleActionKeyword `json:"type"` + // The accompanying value the action will set, change or update. Can be empty, but for some types this value is mandatory. + Value string `json:"value"` + // Order of the action + Order int32 `json:"order,omitempty"` + // If the action is active. Defaults to true. + Active bool `json:"active,omitempty"` + // When true, other actions will not be fired after this action has fired. Defaults to false. + StopProcessing bool `json:"stop_processing,omitempty"` +} diff --git a/model_rule_action_keyword.go b/model_rule_action_keyword.go new file mode 100644 index 0000000..84261d5 --- /dev/null +++ b/model_rule_action_keyword.go @@ -0,0 +1,39 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// RuleActionKeyword : The type of thing this action will do. A limited set is possible. +type RuleActionKeyword string + +// List of RuleActionKeyword +const ( + USER_ACTION_RuleActionKeyword RuleActionKeyword = "user_action" + SET_CATEGORY_RuleActionKeyword RuleActionKeyword = "set_category" + CLEAR_CATEGORY_RuleActionKeyword RuleActionKeyword = "clear_category" + SET_BUDGET_RuleActionKeyword RuleActionKeyword = "set_budget" + CLEAR_BUDGET_RuleActionKeyword RuleActionKeyword = "clear_budget" + ADD_TAG_RuleActionKeyword RuleActionKeyword = "add_tag" + REMOVE_TAG_RuleActionKeyword RuleActionKeyword = "remove_tag" + REMOVE_ALL_TAGS_RuleActionKeyword RuleActionKeyword = "remove_all_tags" + SET_DESCRIPTION_RuleActionKeyword RuleActionKeyword = "set_description" + APPEND_DESCRIPTION_RuleActionKeyword RuleActionKeyword = "append_description" + PREPEND_DESCRIPTION_RuleActionKeyword RuleActionKeyword = "prepend_description" + SET_SOURCE_ACCOUNT_RuleActionKeyword RuleActionKeyword = "set_source_account" + SET_DESTINATION_ACCOUNT_RuleActionKeyword RuleActionKeyword = "set_destination_account" + SET_NOTES_RuleActionKeyword RuleActionKeyword = "set_notes" + APPEND_NOTES_RuleActionKeyword RuleActionKeyword = "append_notes" + PREPEND_NOTES_RuleActionKeyword RuleActionKeyword = "prepend_notes" + CLEAR_NOTES_RuleActionKeyword RuleActionKeyword = "clear_notes" + LINK_TO_BILL_RuleActionKeyword RuleActionKeyword = "link_to_bill" + CONVERT_WITHDRAWAL_RuleActionKeyword RuleActionKeyword = "convert_withdrawal" + CONVERT_DEPOSIT_RuleActionKeyword RuleActionKeyword = "convert_deposit" + CONVERT_TRANSFER_RuleActionKeyword RuleActionKeyword = "convert_transfer" + DELETE_TRANSACTION_RuleActionKeyword RuleActionKeyword = "delete_transaction" +) diff --git a/model_rule_action_store.go b/model_rule_action_store.go new file mode 100644 index 0000000..8a3e1c0 --- /dev/null +++ b/model_rule_action_store.go @@ -0,0 +1,22 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleActionStore struct { + Type_ *RuleActionKeyword `json:"type"` + // The accompanying value the action will set, change or update. Can be empty, but for some types this value is mandatory. + Value string `json:"value"` + // Order of the action + Order int32 `json:"order,omitempty"` + // If the action is active. Defaults to true. + Active bool `json:"active,omitempty"` + // When true, other actions will not be fired after this action has fired. Defaults to false. + StopProcessing bool `json:"stop_processing,omitempty"` +} diff --git a/model_rule_action_update.go b/model_rule_action_update.go new file mode 100644 index 0000000..0d4d66f --- /dev/null +++ b/model_rule_action_update.go @@ -0,0 +1,22 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleActionUpdate struct { + Type_ *RuleActionKeyword `json:"type,omitempty"` + // The accompanying value the action will set, change or update. Can be empty, but for some types this value is mandatory. + Value string `json:"value,omitempty"` + // Order of the action + Order int32 `json:"order,omitempty"` + // If the action is active. + Active bool `json:"active,omitempty"` + // When true, other actions will not be fired after this action has fired. + StopProcessing bool `json:"stop_processing,omitempty"` +} diff --git a/model_rule_array.go b/model_rule_array.go new file mode 100644 index 0000000..3ba568a --- /dev/null +++ b/model_rule_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleArray struct { + Data []RuleRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_rule_group.go b/model_rule_group.go new file mode 100644 index 0000000..56c1754 --- /dev/null +++ b/model_rule_group.go @@ -0,0 +1,23 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type RuleGroup struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + Title string `json:"title"` + Description string `json:"description,omitempty"` + Order int32 `json:"order,omitempty"` + Active bool `json:"active,omitempty"` +} diff --git a/model_rule_group_array.go b/model_rule_group_array.go new file mode 100644 index 0000000..37c4bbe --- /dev/null +++ b/model_rule_group_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleGroupArray struct { + Data []RuleGroupRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_rule_group_read.go b/model_rule_group_read.go new file mode 100644 index 0000000..724edb3 --- /dev/null +++ b/model_rule_group_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleGroupRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *RuleGroup `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_rule_group_single.go b/model_rule_group_single.go new file mode 100644 index 0000000..ef7538c --- /dev/null +++ b/model_rule_group_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleGroupSingle struct { + Data *RuleGroupRead `json:"data"` +} diff --git a/model_rule_group_store.go b/model_rule_group_store.go new file mode 100644 index 0000000..d75d744 --- /dev/null +++ b/model_rule_group_store.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleGroupStore struct { + Title string `json:"title"` + Description string `json:"description,omitempty"` + Order int32 `json:"order,omitempty"` + Active bool `json:"active,omitempty"` +} diff --git a/model_rule_group_update.go b/model_rule_group_update.go new file mode 100644 index 0000000..aae3df6 --- /dev/null +++ b/model_rule_group_update.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleGroupUpdate struct { + Title string `json:"title,omitempty"` + Description string `json:"description,omitempty"` + Order int32 `json:"order,omitempty"` + Active bool `json:"active,omitempty"` +} diff --git a/model_rule_read.go b/model_rule_read.go new file mode 100644 index 0000000..c890db5 --- /dev/null +++ b/model_rule_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *Rule `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_rule_single.go b/model_rule_single.go new file mode 100644 index 0000000..63267a6 --- /dev/null +++ b/model_rule_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleSingle struct { + Data *RuleRead `json:"data"` +} diff --git a/model_rule_store.go b/model_rule_store.go new file mode 100644 index 0000000..7f56491 --- /dev/null +++ b/model_rule_store.go @@ -0,0 +1,29 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleStore struct { + Title string `json:"title"` + Description string `json:"description,omitempty"` + // ID of the rule group under which the rule must be stored. Either this field or rule_group_title is mandatory. + RuleGroupId string `json:"rule_group_id"` + // Title of the rule group under which the rule must be stored. Either this field or rule_group_id is mandatory. + RuleGroupTitle string `json:"rule_group_title,omitempty"` + Order int32 `json:"order,omitempty"` + Trigger *RuleTriggerType `json:"trigger"` + // Whether or not the rule is even active. Default is true. + Active bool `json:"active,omitempty"` + // If the rule is set to be strict, ALL triggers must hit in order for the rule to fire. Otherwise, just one is enough. Default value is true. + Strict bool `json:"strict,omitempty"` + // If this value is true and the rule is triggered, other rules after this one in the group will be skipped. Default value is false. + StopProcessing bool `json:"stop_processing,omitempty"` + Triggers []RuleTriggerStore `json:"triggers"` + Actions []RuleActionStore `json:"actions"` +} diff --git a/model_rule_trigger.go b/model_rule_trigger.go new file mode 100644 index 0000000..f670dec --- /dev/null +++ b/model_rule_trigger.go @@ -0,0 +1,29 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type RuleTrigger struct { + Id string `json:"id,omitempty"` + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + Type_ *RuleTriggerKeyword `json:"type"` + // The accompanying value the trigger responds to. This value is often mandatory, but this depends on the trigger. + Value string `json:"value"` + // Order of the trigger + Order int32 `json:"order,omitempty"` + // If the trigger is active. Defaults to true. + Active bool `json:"active,omitempty"` + // When true, other triggers will not be checked if this trigger was triggered. Defaults to false. + StopProcessing bool `json:"stop_processing,omitempty"` +} diff --git a/model_rule_trigger_keyword.go b/model_rule_trigger_keyword.go new file mode 100644 index 0000000..3dfa9a4 --- /dev/null +++ b/model_rule_trigger_keyword.go @@ -0,0 +1,53 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// RuleTriggerKeyword : The type of thing this trigger responds to. A limited set is possible +type RuleTriggerKeyword string + +// List of RuleTriggerKeyword +const ( + FROM_ACCOUNT_STARTS_RuleTriggerKeyword RuleTriggerKeyword = "from_account_starts" + FROM_ACCOUNT_ENDS_RuleTriggerKeyword RuleTriggerKeyword = "from_account_ends" + FROM_ACCOUNT_IS_RuleTriggerKeyword RuleTriggerKeyword = "from_account_is" + FROM_ACCOUNT_CONTAINS_RuleTriggerKeyword RuleTriggerKeyword = "from_account_contains" + TO_ACCOUNT_STARTS_RuleTriggerKeyword RuleTriggerKeyword = "to_account_starts" + TO_ACCOUNT_ENDS_RuleTriggerKeyword RuleTriggerKeyword = "to_account_ends" + TO_ACCOUNT_IS_RuleTriggerKeyword RuleTriggerKeyword = "to_account_is" + TO_ACCOUNT_CONTAINS_RuleTriggerKeyword RuleTriggerKeyword = "to_account_contains" + AMOUNT_LESS_RuleTriggerKeyword RuleTriggerKeyword = "amount_less" + AMOUNT_EXACTLY_RuleTriggerKeyword RuleTriggerKeyword = "amount_exactly" + AMOUNT_MORE_RuleTriggerKeyword RuleTriggerKeyword = "amount_more" + DESCRIPTION_STARTS_RuleTriggerKeyword RuleTriggerKeyword = "description_starts" + DESCRIPTION_ENDS_RuleTriggerKeyword RuleTriggerKeyword = "description_ends" + DESCRIPTION_CONTAINS_RuleTriggerKeyword RuleTriggerKeyword = "description_contains" + DESCRIPTION_IS_RuleTriggerKeyword RuleTriggerKeyword = "description_is" + TRANSACTION_TYPE_RuleTriggerKeyword RuleTriggerKeyword = "transaction_type" + CATEGORY_IS_RuleTriggerKeyword RuleTriggerKeyword = "category_is" + BUDGET_IS_RuleTriggerKeyword RuleTriggerKeyword = "budget_is" + TAG_IS_RuleTriggerKeyword RuleTriggerKeyword = "tag_is" + CURRENCY_IS_RuleTriggerKeyword RuleTriggerKeyword = "currency_is" + HAS_ATTACHMENTS_RuleTriggerKeyword RuleTriggerKeyword = "has_attachments" + HAS_NO_CATEGORY_RuleTriggerKeyword RuleTriggerKeyword = "has_no_category" + HAS_ANY_CATEGORY_RuleTriggerKeyword RuleTriggerKeyword = "has_any_category" + HAS_NO_BUDGET_RuleTriggerKeyword RuleTriggerKeyword = "has_no_budget" + HAS_ANY_BUDGET_RuleTriggerKeyword RuleTriggerKeyword = "has_any_budget" + HAS_NO_TAG_RuleTriggerKeyword RuleTriggerKeyword = "has_no_tag" + HAS_ANY_TAG_RuleTriggerKeyword RuleTriggerKeyword = "has_any_tag" + NOTES_CONTAINS_RuleTriggerKeyword RuleTriggerKeyword = "notes_contains" + NOTES_START_RuleTriggerKeyword RuleTriggerKeyword = "notes_start" + NOTES_END_RuleTriggerKeyword RuleTriggerKeyword = "notes_end" + NOTES_ARE_RuleTriggerKeyword RuleTriggerKeyword = "notes_are" + NO_NOTES_RuleTriggerKeyword RuleTriggerKeyword = "no_notes" + ANY_NOTES_RuleTriggerKeyword RuleTriggerKeyword = "any_notes" + SOURCE_ACCOUNT_IS_RuleTriggerKeyword RuleTriggerKeyword = "source_account_is" + DESTINATION_ACCOUNT_IS_RuleTriggerKeyword RuleTriggerKeyword = "destination_account_is" + SOURCE_ACCOUNT_STARTS_RuleTriggerKeyword RuleTriggerKeyword = "source_account_starts" +) diff --git a/model_rule_trigger_store.go b/model_rule_trigger_store.go new file mode 100644 index 0000000..d314ff2 --- /dev/null +++ b/model_rule_trigger_store.go @@ -0,0 +1,22 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleTriggerStore struct { + Type_ *RuleTriggerKeyword `json:"type"` + // The accompanying value the trigger responds to. This value is often mandatory, but this depends on the trigger. + Value string `json:"value"` + // Order of the trigger + Order int32 `json:"order,omitempty"` + // If the trigger is active. Defaults to true. + Active bool `json:"active,omitempty"` + // When true, other triggers will not be checked if this trigger was triggered. Defaults to false. + StopProcessing bool `json:"stop_processing,omitempty"` +} diff --git a/model_rule_trigger_type.go b/model_rule_trigger_type.go new file mode 100644 index 0000000..fd8893c --- /dev/null +++ b/model_rule_trigger_type.go @@ -0,0 +1,19 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// RuleTriggerType : Which action is necessary for the rule to fire? Use either store-journal or update-journal. +type RuleTriggerType string + +// List of RuleTriggerType +const ( + STORE_JOURNAL_RuleTriggerType RuleTriggerType = "store-journal" + UPDATE_JOURNAL_RuleTriggerType RuleTriggerType = "update-journal" +) diff --git a/model_rule_trigger_update.go b/model_rule_trigger_update.go new file mode 100644 index 0000000..c2698c6 --- /dev/null +++ b/model_rule_trigger_update.go @@ -0,0 +1,22 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleTriggerUpdate struct { + Type_ *RuleTriggerKeyword `json:"type,omitempty"` + // The accompanying value the trigger responds to. This value is often mandatory, but this depends on the trigger. If the rule trigger is something like 'has any tag', submit the string 'true'. + Value string `json:"value,omitempty"` + // Order of the trigger + Order int32 `json:"order,omitempty"` + // If the trigger is active. + Active bool `json:"active,omitempty"` + // When true, other triggers will not be checked if this trigger was triggered. + StopProcessing bool `json:"stop_processing,omitempty"` +} diff --git a/model_rule_update.go b/model_rule_update.go new file mode 100644 index 0000000..3a4d336 --- /dev/null +++ b/model_rule_update.go @@ -0,0 +1,27 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type RuleUpdate struct { + Title string `json:"title,omitempty"` + Description string `json:"description,omitempty"` + // ID of the rule group under which the rule must be stored. Either this field or rule_group_title is mandatory. + RuleGroupId string `json:"rule_group_id,omitempty"` + Order int32 `json:"order,omitempty"` + Trigger *RuleTriggerType `json:"trigger,omitempty"` + // Whether or not the rule is even active. Default is true. + Active bool `json:"active,omitempty"` + // If the rule is set to be strict, ALL triggers must hit in order for the rule to fire. Otherwise, just one is enough. Default value is true. + Strict bool `json:"strict,omitempty"` + // If this value is true and the rule is triggered, other rules after this one in the group will be skipped. Default value is false. + StopProcessing bool `json:"stop_processing,omitempty"` + Triggers []RuleTriggerUpdate `json:"triggers,omitempty"` + Actions []RuleActionUpdate `json:"actions,omitempty"` +} diff --git a/model_short_account_type_property.go b/model_short_account_type_property.go new file mode 100644 index 0000000..b3a9506 --- /dev/null +++ b/model_short_account_type_property.go @@ -0,0 +1,26 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// ShortAccountTypeProperty : Can only be one one these account types. import, initial-balance and reconciliation cannot be set manually. +type ShortAccountTypeProperty string + +// List of ShortAccountTypeProperty +const ( + ASSET_ShortAccountTypeProperty ShortAccountTypeProperty = "asset" + EXPENSE_ShortAccountTypeProperty ShortAccountTypeProperty = "expense" + IMPORT__ShortAccountTypeProperty ShortAccountTypeProperty = "import" + REVENUE_ShortAccountTypeProperty ShortAccountTypeProperty = "revenue" + CASH_ShortAccountTypeProperty ShortAccountTypeProperty = "cash" + LIABILITY_ShortAccountTypeProperty ShortAccountTypeProperty = "liability" + LIABILITIES_ShortAccountTypeProperty ShortAccountTypeProperty = "liabilities" + INITIAL_BALANCE_ShortAccountTypeProperty ShortAccountTypeProperty = "initial-balance" + RECONCILIATION_ShortAccountTypeProperty ShortAccountTypeProperty = "reconciliation" +) diff --git a/model_system_info.go b/model_system_info.go new file mode 100644 index 0000000..5d9610e --- /dev/null +++ b/model_system_info.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type SystemInfo struct { + Data *SystemInfoData `json:"data,omitempty"` +} diff --git a/model_system_info_data.go b/model_system_info_data.go new file mode 100644 index 0000000..26fd0a0 --- /dev/null +++ b/model_system_info_data.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type SystemInfoData struct { + Version string `json:"version,omitempty"` + ApiVersion string `json:"api_version,omitempty"` + PhpVersion string `json:"php_version,omitempty"` + Os string `json:"os,omitempty"` + Driver string `json:"driver,omitempty"` +} diff --git a/model_tag_array.go b/model_tag_array.go new file mode 100644 index 0000000..20001ea --- /dev/null +++ b/model_tag_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TagArray struct { + Data []TagRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_tag_model.go b/model_tag_model.go new file mode 100644 index 0000000..6582586 --- /dev/null +++ b/model_tag_model.go @@ -0,0 +1,30 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type TagModel struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // The tag + Tag string `json:"tag"` + // The date to which the tag is applicable. + Date string `json:"date,omitempty"` + Description string `json:"description,omitempty"` + // Latitude of the tag's location, if applicable. Can be used to draw a map. + Latitude float64 `json:"latitude,omitempty"` + // Latitude of the tag's location, if applicable. Can be used to draw a map. + Longitude float64 `json:"longitude,omitempty"` + // Zoom level for the map, if drawn. This to set the box right. Unfortunately this is a proprietary value because each map provider has different zoom levels. + ZoomLevel int32 `json:"zoom_level,omitempty"` +} diff --git a/model_tag_model_store.go b/model_tag_model_store.go new file mode 100644 index 0000000..ec98ff1 --- /dev/null +++ b/model_tag_model_store.go @@ -0,0 +1,24 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TagModelStore struct { + // The tag + Tag string `json:"tag"` + // The date to which the tag is applicable. + Date string `json:"date,omitempty"` + Description string `json:"description,omitempty"` + // Latitude of the tag's location, if applicable. Can be used to draw a map. + Latitude float64 `json:"latitude,omitempty"` + // Latitude of the tag's location, if applicable. Can be used to draw a map. + Longitude float64 `json:"longitude,omitempty"` + // Zoom level for the map, if drawn. This to set the box right. Unfortunately this is a proprietary value because each map provider has different zoom levels. + ZoomLevel int32 `json:"zoom_level,omitempty"` +} diff --git a/model_tag_model_update.go b/model_tag_model_update.go new file mode 100644 index 0000000..9e945e9 --- /dev/null +++ b/model_tag_model_update.go @@ -0,0 +1,24 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TagModelUpdate struct { + // The tag + Tag string `json:"tag,omitempty"` + // The date to which the tag is applicable. + Date string `json:"date,omitempty"` + Description string `json:"description,omitempty"` + // Latitude of the tag's location, if applicable. Can be used to draw a map. + Latitude float64 `json:"latitude,omitempty"` + // Latitude of the tag's location, if applicable. Can be used to draw a map. + Longitude float64 `json:"longitude,omitempty"` + // Zoom level for the map, if drawn. This to set the box right. Unfortunately this is a proprietary value because each map provider has different zoom levels. + ZoomLevel int32 `json:"zoom_level,omitempty"` +} diff --git a/model_tag_read.go b/model_tag_read.go new file mode 100644 index 0000000..22b4993 --- /dev/null +++ b/model_tag_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TagRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *TagModel `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_tag_single.go b/model_tag_single.go new file mode 100644 index 0000000..15cbbcb --- /dev/null +++ b/model_tag_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TagSingle struct { + Data *TagRead `json:"data"` +} diff --git a/model_transaction.go b/model_transaction.go new file mode 100644 index 0000000..53a4829 --- /dev/null +++ b/model_transaction.go @@ -0,0 +1,24 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type Transaction struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // User ID + User string `json:"user,omitempty"` + // Title of the transaction if it has been split in more than one piece. Empty otherwise. + GroupTitle string `json:"group_title,omitempty"` + Transactions []TransactionSplit `json:"transactions"` +} diff --git a/model_transaction_array.go b/model_transaction_array.go new file mode 100644 index 0000000..941c7b6 --- /dev/null +++ b/model_transaction_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionArray struct { + Data []TransactionRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_transaction_link.go b/model_transaction_link.go new file mode 100644 index 0000000..2d4a055 --- /dev/null +++ b/model_transaction_link.go @@ -0,0 +1,29 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type TransactionLink struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // The link type ID to use. You can also use the link_type_name field. + LinkTypeId string `json:"link_type_id"` + // The link type name to use. You can also use the link_type_id field. + LinkTypeName string `json:"link_type_name,omitempty"` + // The inward transaction transaction_journal_id for the link. This becomes the 'is paid by' transaction of the set. + InwardId string `json:"inward_id"` + // The outward transaction transaction_journal_id for the link. This becomes the 'pays for' transaction of the set. + OutwardId string `json:"outward_id"` + // Optional. Some notes. + Notes string `json:"notes,omitempty"` +} diff --git a/model_transaction_link_array.go b/model_transaction_link_array.go new file mode 100644 index 0000000..466b3a2 --- /dev/null +++ b/model_transaction_link_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionLinkArray struct { + Data []TransactionLinkRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_transaction_link_read.go b/model_transaction_link_read.go new file mode 100644 index 0000000..130ea6c --- /dev/null +++ b/model_transaction_link_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionLinkRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *TransactionLink `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_transaction_link_single.go b/model_transaction_link_single.go new file mode 100644 index 0000000..2804a07 --- /dev/null +++ b/model_transaction_link_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionLinkSingle struct { + Data *TransactionLinkRead `json:"data"` +} diff --git a/model_transaction_link_store.go b/model_transaction_link_store.go new file mode 100644 index 0000000..70ff567 --- /dev/null +++ b/model_transaction_link_store.go @@ -0,0 +1,23 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionLinkStore struct { + // The link type ID to use. You can also use the link_type_name field. + LinkTypeId string `json:"link_type_id"` + // The link type name to use. You can also use the link_type_id field. + LinkTypeName string `json:"link_type_name,omitempty"` + // The inward transaction transaction_journal_id for the link. This becomes the 'is paid by' transaction of the set. + InwardId string `json:"inward_id"` + // The outward transaction transaction_journal_id for the link. This becomes the 'pays for' transaction of the set. + OutwardId string `json:"outward_id"` + // Optional. Some notes. + Notes string `json:"notes,omitempty"` +} diff --git a/model_transaction_link_update.go b/model_transaction_link_update.go new file mode 100644 index 0000000..ee994dd --- /dev/null +++ b/model_transaction_link_update.go @@ -0,0 +1,23 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionLinkUpdate struct { + // The link type ID to use. Use this field OR use the link_type_name field. + LinkTypeId string `json:"link_type_id,omitempty"` + // The link type name to use. Use this field OR use the link_type_id field. + LinkTypeName string `json:"link_type_name,omitempty"` + // The inward transaction transaction_journal_id for the link. This becomes the 'is paid by' transaction of the set. + InwardId string `json:"inward_id,omitempty"` + // The outward transaction transaction_journal_id for the link. This becomes the 'pays for' transaction of the set. + OutwardId string `json:"outward_id,omitempty"` + // Optional. Some notes. If you submit an empty string the current notes will be removed + Notes string `json:"notes,omitempty"` +} diff --git a/model_transaction_read.go b/model_transaction_read.go new file mode 100644 index 0000000..ffff87a --- /dev/null +++ b/model_transaction_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *Transaction `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_transaction_single.go b/model_transaction_single.go new file mode 100644 index 0000000..8e6ff3d --- /dev/null +++ b/model_transaction_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionSingle struct { + Data *TransactionRead `json:"data"` +} diff --git a/model_transaction_split.go b/model_transaction_split.go new file mode 100644 index 0000000..1408026 --- /dev/null +++ b/model_transaction_split.go @@ -0,0 +1,124 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type TransactionSplit struct { + // User ID + User string `json:"user,omitempty"` + // ID of the underlying transaction journal. Each transaction consists of a transaction group (see the top ID) and one or more journals making up the splits of the transaction. + TransactionJournalId string `json:"transaction_journal_id,omitempty"` + Type_ *TransactionTypeProperty `json:"type"` + // Date of the transaction + Date time.Time `json:"date"` + // Order of this entry in the list of transactions. + Order int32 `json:"order,omitempty"` + // Currency ID. Default is the source account's currency, or the user's default currency. Can be used instead of currency_code. + CurrencyId string `json:"currency_id,omitempty"` + // Currency code. Default is the source account's currency, or the user's default currency. Can be used instead of currency_id. + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + CurrencyName string `json:"currency_name,omitempty"` + // Number of decimals used in this currency. + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + // Currency ID of the foreign currency. Default is null. Is required when you submit a foreign amount. + ForeignCurrencyId string `json:"foreign_currency_id,omitempty"` + // Currency code of the foreign currency. Default is NULL. Can be used instead of the foreign_currency_id, but this or the ID is required when submitting a foreign amount. + ForeignCurrencyCode string `json:"foreign_currency_code,omitempty"` + ForeignCurrencySymbol string `json:"foreign_currency_symbol,omitempty"` + // Number of decimals in the currency + ForeignCurrencyDecimalPlaces int32 `json:"foreign_currency_decimal_places,omitempty"` + // Amount of the transaction. + Amount string `json:"amount"` + // The amount in a foreign currency. + ForeignAmount string `json:"foreign_amount,omitempty"` + // Description of the transaction. + Description string `json:"description"` + // ID of the source account. For a withdrawal or a transfer, this must always be an asset account. For deposits, this must be a revenue account. + SourceId string `json:"source_id"` + // Name of the source account. For a withdrawal or a transfer, this must always be an asset account. For deposits, this must be a revenue account. Can be used instead of the source_id. If the transaction is a deposit, the source_name can be filled in freely: the account will be created based on the name. + SourceName string `json:"source_name,omitempty"` + SourceIban string `json:"source_iban,omitempty"` + SourceType *AccountTypeProperty `json:"source_type,omitempty"` + // ID of the destination account. For a deposit or a transfer, this must always be an asset account. For withdrawals this must be an expense account. + DestinationId string `json:"destination_id"` + // Name of the destination account. You can submit the name instead of the ID. For everything except transfers, the account will be auto-generated if unknown, so submitting a name is enough. + DestinationName string `json:"destination_name,omitempty"` + DestinationIban string `json:"destination_iban,omitempty"` + DestinationType *AccountTypeProperty `json:"destination_type,omitempty"` + // The budget ID for this transaction. + BudgetId string `json:"budget_id,omitempty"` + // The name of the budget to be used. If the budget name is unknown, the ID will be used or the value will be ignored. + BudgetName string `json:"budget_name,omitempty"` + // The category ID for this transaction. + CategoryId string `json:"category_id,omitempty"` + // The name of the category to be used. If the category is unknown, it will be created. If the ID and the name point to different categories, the ID overrules the name. + CategoryName string `json:"category_name,omitempty"` + // Optional. Use either this or the bill_name + BillId string `json:"bill_id,omitempty"` + // Optional. Use either this or the bill_id + BillName string `json:"bill_name,omitempty"` + // If the transaction has been reconciled already. When you set this, the amount can no longer be edited by the user. + Reconciled bool `json:"reconciled,omitempty"` + Notes string `json:"notes,omitempty"` + // Array of tags. + Tags []string `json:"tags,omitempty"` + // Reference to internal reference of other systems. + InternalReference string `json:"internal_reference,omitempty"` + // Reference to external ID in other systems. + ExternalId string `json:"external_id,omitempty"` + // External, custom URL for this transaction. + ExternalUrl string `json:"external_url,omitempty"` + // System generated identifier for original creator of transaction. + OriginalSource string `json:"original_source,omitempty"` + // Reference to recurrence that made the transaction. + RecurrenceId string `json:"recurrence_id,omitempty"` + // Total number of transactions expected to be created by this recurrence repetition. Will be 0 if infinite. + RecurrenceTotal int32 `json:"recurrence_total,omitempty"` + // The # of the current transaction created under this recurrence. + RecurrenceCount int32 `json:"recurrence_count,omitempty"` + // Internal ID of bunq transaction. DEPRECATED + BunqPaymentId string `json:"bunq_payment_id,omitempty"` + // Hash value of original import transaction (for duplicate detection). + ImportHashV2 string `json:"import_hash_v2,omitempty"` + // SEPA Clearing Code + SepaCc string `json:"sepa_cc,omitempty"` + // SEPA Opposing Account Identifier + SepaCtOp string `json:"sepa_ct_op,omitempty"` + // SEPA end-to-end Identifier + SepaCtId string `json:"sepa_ct_id,omitempty"` + // SEPA mandate identifier + SepaDb string `json:"sepa_db,omitempty"` + // SEPA Country + SepaCountry string `json:"sepa_country,omitempty"` + // SEPA External Purpose indicator + SepaEp string `json:"sepa_ep,omitempty"` + // SEPA Creditor Identifier + SepaCi string `json:"sepa_ci,omitempty"` + // SEPA Batch ID + SepaBatchId string `json:"sepa_batch_id,omitempty"` + InterestDate time.Time `json:"interest_date,omitempty"` + BookDate time.Time `json:"book_date,omitempty"` + ProcessDate time.Time `json:"process_date,omitempty"` + DueDate time.Time `json:"due_date,omitempty"` + PaymentDate time.Time `json:"payment_date,omitempty"` + InvoiceDate time.Time `json:"invoice_date,omitempty"` + // Latitude of the transaction's location, if applicable. Can be used to draw a map. + Latitude float64 `json:"latitude,omitempty"` + // Latitude of the transaction's location, if applicable. Can be used to draw a map. + Longitude float64 `json:"longitude,omitempty"` + // Zoom level for the map, if drawn. This to set the box right. Unfortunately this is a proprietary value because each map provider has different zoom levels. + ZoomLevel int32 `json:"zoom_level,omitempty"` + // If the transaction has attachments. + HasAttachments bool `json:"has_attachments,omitempty"` +} diff --git a/model_transaction_split_store.go b/model_transaction_split_store.go new file mode 100644 index 0000000..49aa0d4 --- /dev/null +++ b/model_transaction_split_store.go @@ -0,0 +1,95 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type TransactionSplitStore struct { + Type_ *TransactionTypeProperty `json:"type"` + // Date of the transaction + Date time.Time `json:"date"` + // Amount of the transaction. + Amount string `json:"amount"` + // Description of the transaction. + Description string `json:"description"` + // Order of this entry in the list of transactions. + Order int32 `json:"order,omitempty"` + // Currency ID. Default is the source account's currency, or the user's default currency. The value you submit may be overruled by the source or destination account. + CurrencyId string `json:"currency_id,omitempty"` + // Currency code. Default is the source account's currency, or the user's default currency. The value you submit may be overruled by the source or destination account. + CurrencyCode string `json:"currency_code,omitempty"` + // The amount in a foreign currency. + ForeignAmount string `json:"foreign_amount,omitempty"` + // Currency ID of the foreign currency. Default is null. Is required when you submit a foreign amount. + ForeignCurrencyId string `json:"foreign_currency_id,omitempty"` + // Currency code of the foreign currency. Default is NULL. Can be used instead of the foreign_currency_id, but this or the ID is required when submitting a foreign amount. + ForeignCurrencyCode string `json:"foreign_currency_code,omitempty"` + // The budget ID for this transaction. + BudgetId string `json:"budget_id,omitempty"` + // The name of the budget to be used. If the budget name is unknown, the ID will be used or the value will be ignored. + BudgetName string `json:"budget_name,omitempty"` + // The category ID for this transaction. + CategoryId string `json:"category_id,omitempty"` + // The name of the category to be used. If the category is unknown, it will be created. If the ID and the name point to different categories, the ID overrules the name. + CategoryName string `json:"category_name,omitempty"` + // ID of the source account. For a withdrawal or a transfer, this must always be an asset account. For deposits, this must be a revenue account. + SourceId string `json:"source_id,omitempty"` + // Name of the source account. For a withdrawal or a transfer, this must always be an asset account. For deposits, this must be a revenue account. Can be used instead of the source_id. If the transaction is a deposit, the source_name can be filled in freely: the account will be created based on the name. + SourceName string `json:"source_name,omitempty"` + // ID of the destination account. For a deposit or a transfer, this must always be an asset account. For withdrawals this must be an expense account. + DestinationId string `json:"destination_id,omitempty"` + // Name of the destination account. You can submit the name instead of the ID. For everything except transfers, the account will be auto-generated if unknown, so submitting a name is enough. + DestinationName string `json:"destination_name,omitempty"` + // If the transaction has been reconciled already. When you set this, the amount can no longer be edited by the user. + Reconciled bool `json:"reconciled,omitempty"` + // Optional. Use either this or the piggy_bank_name + PiggyBankId int32 `json:"piggy_bank_id,omitempty"` + // Optional. Use either this or the piggy_bank_id + PiggyBankName string `json:"piggy_bank_name,omitempty"` + // Optional. Use either this or the bill_name + BillId string `json:"bill_id,omitempty"` + // Optional. Use either this or the bill_id + BillName string `json:"bill_name,omitempty"` + // Array of tags. + Tags []string `json:"tags,omitempty"` + Notes string `json:"notes,omitempty"` + // Reference to internal reference of other systems. + InternalReference string `json:"internal_reference,omitempty"` + // Reference to external ID in other systems. + ExternalId string `json:"external_id,omitempty"` + // External, custom URL for this transaction. + ExternalUrl string `json:"external_url,omitempty"` + // Internal ID of bunq transaction. Field is no longer used but still works. + BunqPaymentId string `json:"bunq_payment_id,omitempty"` + // SEPA Clearing Code + SepaCc string `json:"sepa_cc,omitempty"` + // SEPA Opposing Account Identifier + SepaCtOp string `json:"sepa_ct_op,omitempty"` + // SEPA end-to-end Identifier + SepaCtId string `json:"sepa_ct_id,omitempty"` + // SEPA mandate identifier + SepaDb string `json:"sepa_db,omitempty"` + // SEPA Country + SepaCountry string `json:"sepa_country,omitempty"` + // SEPA External Purpose indicator + SepaEp string `json:"sepa_ep,omitempty"` + // SEPA Creditor Identifier + SepaCi string `json:"sepa_ci,omitempty"` + // SEPA Batch ID + SepaBatchId string `json:"sepa_batch_id,omitempty"` + InterestDate time.Time `json:"interest_date,omitempty"` + BookDate time.Time `json:"book_date,omitempty"` + ProcessDate time.Time `json:"process_date,omitempty"` + DueDate time.Time `json:"due_date,omitempty"` + PaymentDate time.Time `json:"payment_date,omitempty"` + InvoiceDate time.Time `json:"invoice_date,omitempty"` +} diff --git a/model_transaction_split_update.go b/model_transaction_split_update.go new file mode 100644 index 0000000..054fdcc --- /dev/null +++ b/model_transaction_split_update.go @@ -0,0 +1,102 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type TransactionSplitUpdate struct { + // Transaction journal ID of current transaction (split). + TransactionJournalId string `json:"transaction_journal_id,omitempty"` + Type_ *TransactionTypeProperty `json:"type,omitempty"` + // Date of the transaction + Date time.Time `json:"date,omitempty"` + // Amount of the transaction. + Amount string `json:"amount,omitempty"` + // Description of the transaction. + Description string `json:"description,omitempty"` + // Order of this entry in the list of transactions. + Order int32 `json:"order,omitempty"` + // Currency ID. Default is the source account's currency, or the user's default currency. Can be used instead of currency_code. + CurrencyId string `json:"currency_id,omitempty"` + // Currency code. Default is the source account's currency, or the user's default currency. Can be used instead of currency_id. + CurrencyCode string `json:"currency_code,omitempty"` + CurrencySymbol string `json:"currency_symbol,omitempty"` + CurrencyName string `json:"currency_name,omitempty"` + // Number of decimals used in this currency. + CurrencyDecimalPlaces int32 `json:"currency_decimal_places,omitempty"` + // The amount in a foreign currency. + ForeignAmount string `json:"foreign_amount,omitempty"` + // Currency ID of the foreign currency. Default is null. Is required when you submit a foreign amount. + ForeignCurrencyId string `json:"foreign_currency_id,omitempty"` + // Currency code of the foreign currency. Default is NULL. Can be used instead of the foreign_currency_id, but this or the ID is required when submitting a foreign amount. + ForeignCurrencyCode string `json:"foreign_currency_code,omitempty"` + ForeignCurrencySymbol string `json:"foreign_currency_symbol,omitempty"` + // Number of decimals in the currency + ForeignCurrencyDecimalPlaces int32 `json:"foreign_currency_decimal_places,omitempty"` + // The budget ID for this transaction. + BudgetId string `json:"budget_id,omitempty"` + // The name of the budget to be used. If the budget name is unknown, the ID will be used or the value will be ignored. + BudgetName string `json:"budget_name,omitempty"` + // The category ID for this transaction. + CategoryId string `json:"category_id,omitempty"` + // The name of the category to be used. If the category is unknown, it will be created. If the ID and the name point to different categories, the ID overrules the name. + CategoryName string `json:"category_name,omitempty"` + // ID of the source account. For a withdrawal or a transfer, this must always be an asset account. For deposits, this must be a revenue account. + SourceId string `json:"source_id,omitempty"` + // Name of the source account. For a withdrawal or a transfer, this must always be an asset account. For deposits, this must be a revenue account. Can be used instead of the source_id. If the transaction is a deposit, the source_name can be filled in freely: the account will be created based on the name. + SourceName string `json:"source_name,omitempty"` + SourceIban string `json:"source_iban,omitempty"` + // ID of the destination account. For a deposit or a transfer, this must always be an asset account. For withdrawals this must be an expense account. + DestinationId string `json:"destination_id,omitempty"` + // Name of the destination account. You can submit the name instead of the ID. For everything except transfers, the account will be auto-generated if unknown, so submitting a name is enough. + DestinationName string `json:"destination_name,omitempty"` + DestinationIban string `json:"destination_iban,omitempty"` + // If the transaction has been reconciled already. When you set this, the amount can no longer be edited by the user. + Reconciled bool `json:"reconciled,omitempty"` + // Optional. Use either this or the bill_name + BillId string `json:"bill_id,omitempty"` + // Optional. Use either this or the bill_id + BillName string `json:"bill_name,omitempty"` + // Array of tags. + Tags []string `json:"tags,omitempty"` + Notes string `json:"notes,omitempty"` + // Reference to internal reference of other systems. + InternalReference string `json:"internal_reference,omitempty"` + // Reference to external ID in other systems. + ExternalId string `json:"external_id,omitempty"` + // External, custom URL for this transaction. + ExternalUrl string `json:"external_url,omitempty"` + // Internal ID of bunq transaction. + BunqPaymentId string `json:"bunq_payment_id,omitempty"` + // SEPA Clearing Code + SepaCc string `json:"sepa_cc,omitempty"` + // SEPA Opposing Account Identifier + SepaCtOp string `json:"sepa_ct_op,omitempty"` + // SEPA end-to-end Identifier + SepaCtId string `json:"sepa_ct_id,omitempty"` + // SEPA mandate identifier + SepaDb string `json:"sepa_db,omitempty"` + // SEPA Country + SepaCountry string `json:"sepa_country,omitempty"` + // SEPA External Purpose indicator + SepaEp string `json:"sepa_ep,omitempty"` + // SEPA Creditor Identifier + SepaCi string `json:"sepa_ci,omitempty"` + // SEPA Batch ID + SepaBatchId string `json:"sepa_batch_id,omitempty"` + InterestDate time.Time `json:"interest_date,omitempty"` + BookDate time.Time `json:"book_date,omitempty"` + ProcessDate time.Time `json:"process_date,omitempty"` + DueDate time.Time `json:"due_date,omitempty"` + PaymentDate time.Time `json:"payment_date,omitempty"` + InvoiceDate time.Time `json:"invoice_date,omitempty"` +} diff --git a/model_transaction_store.go b/model_transaction_store.go new file mode 100644 index 0000000..e10cd7e --- /dev/null +++ b/model_transaction_store.go @@ -0,0 +1,22 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionStore struct { + // Break if the submitted transaction exists already. + ErrorIfDuplicateHash bool `json:"error_if_duplicate_hash,omitempty"` + // Whether or not to apply rules when submitting transaction. + ApplyRules bool `json:"apply_rules,omitempty"` + // Whether or not to fire the webhooks that are related to this event. + FireWebhooks bool `json:"fire_webhooks,omitempty"` + // Title of the transaction if it has been split in more than one piece. Empty otherwise. + GroupTitle string `json:"group_title,omitempty"` + Transactions []TransactionSplitStore `json:"transactions"` +} diff --git a/model_transaction_type_filter.go b/model_transaction_type_filter.go new file mode 100644 index 0000000..b3dd3e1 --- /dev/null +++ b/model_transaction_type_filter.go @@ -0,0 +1,30 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionTypeFilter string + +// List of TransactionTypeFilter +const ( + ALL_TransactionTypeFilter TransactionTypeFilter = "all" + WITHDRAWAL_TransactionTypeFilter TransactionTypeFilter = "withdrawal" + WITHDRAWALS_TransactionTypeFilter TransactionTypeFilter = "withdrawals" + EXPENSE_TransactionTypeFilter TransactionTypeFilter = "expense" + DEPOSIT_TransactionTypeFilter TransactionTypeFilter = "deposit" + DEPOSITS_TransactionTypeFilter TransactionTypeFilter = "deposits" + INCOME_TransactionTypeFilter TransactionTypeFilter = "income" + TRANSFER_TransactionTypeFilter TransactionTypeFilter = "transfer" + TRANSFERS_TransactionTypeFilter TransactionTypeFilter = "transfers" + OPENING_BALANCE_TransactionTypeFilter TransactionTypeFilter = "opening_balance" + RECONCILIATION_TransactionTypeFilter TransactionTypeFilter = "reconciliation" + SPECIAL_TransactionTypeFilter TransactionTypeFilter = "special" + SPECIALS_TransactionTypeFilter TransactionTypeFilter = "specials" + DEFAULT__TransactionTypeFilter TransactionTypeFilter = "default" +) diff --git a/model_transaction_type_property.go b/model_transaction_type_property.go new file mode 100644 index 0000000..a7e0ec2 --- /dev/null +++ b/model_transaction_type_property.go @@ -0,0 +1,21 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionTypeProperty string + +// List of TransactionTypeProperty +const ( + WITHDRAWAL_TransactionTypeProperty TransactionTypeProperty = "withdrawal" + DEPOSIT_TransactionTypeProperty TransactionTypeProperty = "deposit" + TRANSFER_TransactionTypeProperty TransactionTypeProperty = "transfer" + RECONCILIATION_TransactionTypeProperty TransactionTypeProperty = "reconciliation" + OPENING_BALANCE_TransactionTypeProperty TransactionTypeProperty = "opening balance" +) diff --git a/model_transaction_update.go b/model_transaction_update.go new file mode 100644 index 0000000..0ba58f4 --- /dev/null +++ b/model_transaction_update.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type TransactionUpdate struct { + // Whether or not to apply rules when submitting transaction. + ApplyRules bool `json:"apply_rules,omitempty"` + // Whether or not to fire the webhooks that are related to this event. + FireWebhooks bool `json:"fire_webhooks,omitempty"` + // Title of the transaction if it has been split in more than one piece. Empty otherwise. + GroupTitle string `json:"group_title,omitempty"` + Transactions []TransactionSplitUpdate `json:"transactions,omitempty"` +} diff --git a/model_unauthenticated_response.go b/model_unauthenticated_response.go new file mode 100644 index 0000000..a07fba6 --- /dev/null +++ b/model_unauthenticated_response.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type UnauthenticatedResponse struct { + Message string `json:"message,omitempty"` + Exception string `json:"exception,omitempty"` +} diff --git a/model_user.go b/model_user.go new file mode 100644 index 0000000..f8a7bda --- /dev/null +++ b/model_user.go @@ -0,0 +1,25 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type User struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // The new users email address. + Email string `json:"email"` + // Boolean to indicate if the user is blocked. + Blocked bool `json:"blocked,omitempty"` + BlockedCode *UserBlockedCodeProperty `json:"blocked_code,omitempty"` + Role *UserRoleProperty `json:"role,omitempty"` +} diff --git a/model_user_array.go b/model_user_array.go new file mode 100644 index 0000000..79d49a4 --- /dev/null +++ b/model_user_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type UserArray struct { + Data []UserRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_user_blocked_code_property.go b/model_user_blocked_code_property.go new file mode 100644 index 0000000..4a834d9 --- /dev/null +++ b/model_user_blocked_code_property.go @@ -0,0 +1,19 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// UserBlockedCodeProperty : If you say the user must be blocked, this will be the reason code. +type UserBlockedCodeProperty string + +// List of UserBlockedCodeProperty +const ( + EMAIL_CHANGED_UserBlockedCodeProperty UserBlockedCodeProperty = "email_changed" + NULL_UserBlockedCodeProperty UserBlockedCodeProperty = "" +) diff --git a/model_user_read.go b/model_user_read.go new file mode 100644 index 0000000..2b1295b --- /dev/null +++ b/model_user_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type UserRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *User `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_user_role_property.go b/model_user_role_property.go new file mode 100644 index 0000000..f158a90 --- /dev/null +++ b/model_user_role_property.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// UserRoleProperty : Role for the user. Can be empty or omitted. +type UserRoleProperty string + +// List of UserRoleProperty +const ( + OWNER_UserRoleProperty UserRoleProperty = "owner" + DEMO_UserRoleProperty UserRoleProperty = "demo" + NULL_UserRoleProperty UserRoleProperty = "" +) diff --git a/model_user_single.go b/model_user_single.go new file mode 100644 index 0000000..e8e4aec --- /dev/null +++ b/model_user_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type UserSingle struct { + Data *UserRead `json:"data"` +} diff --git a/model_validation_error_response.go b/model_validation_error_response.go new file mode 100644 index 0000000..d8fd8a6 --- /dev/null +++ b/model_validation_error_response.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ValidationErrorResponse struct { + Message string `json:"message,omitempty"` + Errors *ValidationErrorResponseErrors `json:"errors,omitempty"` +} diff --git a/model_validation_error_response_errors.go b/model_validation_error_response_errors.go new file mode 100644 index 0000000..8019ab2 --- /dev/null +++ b/model_validation_error_response_errors.go @@ -0,0 +1,23 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type ValidationErrorResponseErrors struct { + Email []string `json:"email,omitempty"` + Blocked []string `json:"blocked,omitempty"` + Role []string `json:"role,omitempty"` + BlockedCode []string `json:"blocked_code,omitempty"` + Name []string `json:"name,omitempty"` + Type_ []string `json:"type,omitempty"` + Iban []string `json:"iban,omitempty"` + Start []string `json:"start,omitempty"` + End []string `json:"end,omitempty"` + Date []string `json:"date,omitempty"` +} diff --git a/model_webhook.go b/model_webhook.go new file mode 100644 index 0000000..c1abe27 --- /dev/null +++ b/model_webhook.go @@ -0,0 +1,30 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type Webhook struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // Boolean to indicate if the webhook is active + Active bool `json:"active,omitempty"` + // A title for the webhook for easy recognition. + Title string `json:"title"` + // A 24-character secret for the webhook. It's generated by Firefly III when saving a new webhook. If you submit a new secret through the PUT endpoint it will generate a new secret for the selected webhook, a new secret bearing no relation to whatever you just submitted. + Secret string `json:"secret,omitempty"` + Trigger *WebhookTrigger `json:"trigger"` + Response *WebhookResponse `json:"response"` + Delivery *WebhookDelivery `json:"delivery"` + // The URL of the webhook. Has to start with `https`. + Url string `json:"url"` +} diff --git a/model_webhook_array.go b/model_webhook_array.go new file mode 100644 index 0000000..745a0a3 --- /dev/null +++ b/model_webhook_array.go @@ -0,0 +1,16 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type WebhookArray struct { + Data []WebhookRead `json:"data"` + Meta *Meta `json:"meta"` + Links *PageLink `json:"links"` +} diff --git a/model_webhook_attempt.go b/model_webhook_attempt.go new file mode 100644 index 0000000..aa33bb6 --- /dev/null +++ b/model_webhook_attempt.go @@ -0,0 +1,27 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type WebhookAttempt struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // The ID of the webhook message this attempt belongs to. + WebhookMessageId string `json:"webhook_message_id,omitempty"` + // The HTTP status code of the error, if any. + StatusCode int32 `json:"status_code,omitempty"` + // Internal log for this attempt. May contain sensitive user data. + Logs string `json:"logs,omitempty"` + // Webhook receiver response for this attempt, if any. May contain sensitive user data. + Response string `json:"response,omitempty"` +} diff --git a/model_webhook_attempt_array.go b/model_webhook_attempt_array.go new file mode 100644 index 0000000..2519d08 --- /dev/null +++ b/model_webhook_attempt_array.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type WebhookAttemptArray struct { + Data []WebhookAttemptRead `json:"data"` + Meta *Meta `json:"meta"` +} diff --git a/model_webhook_attempt_read.go b/model_webhook_attempt_read.go new file mode 100644 index 0000000..d66192b --- /dev/null +++ b/model_webhook_attempt_read.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type WebhookAttemptRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *WebhookAttempt `json:"attributes"` +} diff --git a/model_webhook_attempt_single.go b/model_webhook_attempt_single.go new file mode 100644 index 0000000..b6b9570 --- /dev/null +++ b/model_webhook_attempt_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type WebhookAttemptSingle struct { + Data *WebhookAttemptRead `json:"data"` +} diff --git a/model_webhook_delivery.go b/model_webhook_delivery.go new file mode 100644 index 0000000..41f08ae --- /dev/null +++ b/model_webhook_delivery.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// WebhookDelivery : Format of the delivered response. +type WebhookDelivery string + +// List of WebhookDelivery +const ( + JSON_WebhookDelivery WebhookDelivery = "JSON" +) diff --git a/model_webhook_message.go b/model_webhook_message.go new file mode 100644 index 0000000..7ee19e9 --- /dev/null +++ b/model_webhook_message.go @@ -0,0 +1,29 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "time" +) + +type WebhookMessage struct { + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + // If this message is sent yet. + Sent bool `json:"sent,omitempty"` + // If this message has errored out. + Errored bool `json:"errored,omitempty"` + // The ID of the webhook this message belongs to. + WebhookId string `json:"webhook_id,omitempty"` + // Long UUID string for identification of this webhook message. + Uuid string `json:"uuid,omitempty"` + // The actual message that is sent or will be sent as JSON string. + Message string `json:"message,omitempty"` +} diff --git a/model_webhook_message_array.go b/model_webhook_message_array.go new file mode 100644 index 0000000..43b57d7 --- /dev/null +++ b/model_webhook_message_array.go @@ -0,0 +1,15 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type WebhookMessageArray struct { + Data []WebhookMessageRead `json:"data"` + Meta *Meta `json:"meta"` +} diff --git a/model_webhook_message_read.go b/model_webhook_message_read.go new file mode 100644 index 0000000..bfc6795 --- /dev/null +++ b/model_webhook_message_read.go @@ -0,0 +1,17 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type WebhookMessageRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *WebhookMessage `json:"attributes"` +} diff --git a/model_webhook_message_single.go b/model_webhook_message_single.go new file mode 100644 index 0000000..c4ec182 --- /dev/null +++ b/model_webhook_message_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type WebhookMessageSingle struct { + Data *WebhookMessageRead `json:"data"` +} diff --git a/model_webhook_read.go b/model_webhook_read.go new file mode 100644 index 0000000..ae6f464 --- /dev/null +++ b/model_webhook_read.go @@ -0,0 +1,18 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type WebhookRead struct { + // Immutable value + Type_ string `json:"type"` + Id string `json:"id"` + Attributes *Webhook `json:"attributes"` + Links *ObjectLink `json:"links"` +} diff --git a/model_webhook_response.go b/model_webhook_response.go new file mode 100644 index 0000000..c0809ca --- /dev/null +++ b/model_webhook_response.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// WebhookResponse : Indicator for what Firefly III will deliver to the webhook URL. +type WebhookResponse string + +// List of WebhookResponse +const ( + TRANSACTIONS_WebhookResponse WebhookResponse = "TRANSACTIONS" + ACCOUNTS_WebhookResponse WebhookResponse = "ACCOUNTS" + NONE_WebhookResponse WebhookResponse = "NONE" +) diff --git a/model_webhook_single.go b/model_webhook_single.go new file mode 100644 index 0000000..377dc3d --- /dev/null +++ b/model_webhook_single.go @@ -0,0 +1,14 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type WebhookSingle struct { + Data *WebhookRead `json:"data"` +} diff --git a/model_webhook_store.go b/model_webhook_store.go new file mode 100644 index 0000000..fc91e3b --- /dev/null +++ b/model_webhook_store.go @@ -0,0 +1,22 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type WebhookStore struct { + // Boolean to indicate if the webhook is active + Active bool `json:"active,omitempty"` + // A title for the webhook for easy recognition. + Title string `json:"title"` + Trigger *WebhookTrigger `json:"trigger"` + Response *WebhookResponse `json:"response"` + Delivery *WebhookDelivery `json:"delivery"` + // The URL of the webhook. Has to start with `https`. + Url string `json:"url"` +} diff --git a/model_webhook_trigger.go b/model_webhook_trigger.go new file mode 100644 index 0000000..a962657 --- /dev/null +++ b/model_webhook_trigger.go @@ -0,0 +1,20 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +// WebhookTrigger : The trigger for the webhook. +type WebhookTrigger string + +// List of WebhookTrigger +const ( + STORE_TRANSACTION_WebhookTrigger WebhookTrigger = "STORE_TRANSACTION" + UPDATE_TRANSACTION_WebhookTrigger WebhookTrigger = "UPDATE_TRANSACTION" + DESTROY_TRANSACTION_WebhookTrigger WebhookTrigger = "DESTROY_TRANSACTION" +) diff --git a/model_webhook_update.go b/model_webhook_update.go new file mode 100644 index 0000000..22d3cf6 --- /dev/null +++ b/model_webhook_update.go @@ -0,0 +1,24 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +type WebhookUpdate struct { + // Boolean to indicate if the webhook is active + Active bool `json:"active,omitempty"` + // A title for the webhook for easy recognition. + Title string `json:"title,omitempty"` + // A 24-character secret for the webhook. It's generated by Firefly III when saving a new webhook. If you submit a new secret through the PUT endpoint it will generate a new secret for the selected webhook, a new secret bearing no relation to whatever you just submitted. + Secret string `json:"secret,omitempty"` + Trigger *WebhookTrigger `json:"trigger,omitempty"` + Response *WebhookResponse `json:"response,omitempty"` + Delivery *WebhookDelivery `json:"delivery,omitempty"` + // The URL of the webhook. Has to start with `https`. + Url string `json:"url,omitempty"` +} diff --git a/response.go b/response.go new file mode 100644 index 0000000..56502fd --- /dev/null +++ b/response.go @@ -0,0 +1,43 @@ +/* + * Firefly III API v2.0.12 + * + * 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 2024-03-16T05:34:43+00:00 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. + * + * API version: 2.0.12 + * Contact: james@firefly-iii.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package firefly3 + +import ( + "net/http" +) + +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the swagger operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +}