diff --git a/app/packages/api_client/.openapi-generator-ignore b/app/packages/api_client/.openapi-generator-ignore new file mode 100644 index 0000000..1cc0a88 --- /dev/null +++ b/app/packages/api_client/.openapi-generator-ignore @@ -0,0 +1,5 @@ +# keep our config and ignore-file; everything else is regenerated +openapi-config.yaml +.openapi-generator-ignore +README.md +.gitignore diff --git a/app/packages/api_client/.openapi-generator/FILES b/app/packages/api_client/.openapi-generator/FILES new file mode 100644 index 0000000..a00d0b4 --- /dev/null +++ b/app/packages/api_client/.openapi-generator/FILES @@ -0,0 +1,129 @@ +analysis_options.yaml +build.yaml +doc/AccountBalance.md +doc/AccountKind.md +doc/AccountOut.md +doc/AccountPatch.md +doc/AccountRole.md +doc/AccountsApi.md +doc/AuthApi.md +doc/Broker.md +doc/CashFlowMonth.md +doc/CashflowApi.md +doc/CategoriesApi.md +doc/CategoryOut.md +doc/DataQualityRow.md +doc/EventSource.md +doc/FlowType.md +doc/Health.md +doc/HealthApi.md +doc/JobStatus.md +doc/LoginRequest.md +doc/MetricsApi.md +doc/NetWorthBreakdown.md +doc/NetWorthDay.md +doc/NetworthApi.md +doc/Problem.md +doc/RefreshLogOut.md +doc/RefreshRequest.md +doc/RuleCreate.md +doc/RuleKind.md +doc/RuleMatchType.md +doc/RuleOut.md +doc/RulePatch.md +doc/RulesApi.md +doc/RunStatus.md +doc/RunwayOut.md +doc/SourceStatus.md +doc/SpendingRow.md +doc/SyncApi.md +doc/SyncJobOut.md +doc/SyncRunOut.md +doc/TokenPair.md +doc/TransactionOut.md +doc/TransactionPage.md +doc/TransactionsApi.md +doc/UserOut.md +lib/fintracker_api.dart +lib/src/api.dart +lib/src/api/accounts_api.dart +lib/src/api/auth_api.dart +lib/src/api/cashflow_api.dart +lib/src/api/categories_api.dart +lib/src/api/health_api.dart +lib/src/api/metrics_api.dart +lib/src/api/networth_api.dart +lib/src/api/rules_api.dart +lib/src/api/sync_api.dart +lib/src/api/transactions_api.dart +lib/src/auth/api_key_auth.dart +lib/src/auth/auth.dart +lib/src/auth/basic_auth.dart +lib/src/auth/bearer_auth.dart +lib/src/auth/oauth.dart +lib/src/deserialize.dart +lib/src/model/account_balance.dart +lib/src/model/account_kind.dart +lib/src/model/account_out.dart +lib/src/model/account_patch.dart +lib/src/model/account_role.dart +lib/src/model/broker.dart +lib/src/model/cash_flow_month.dart +lib/src/model/category_out.dart +lib/src/model/data_quality_row.dart +lib/src/model/event_source.dart +lib/src/model/flow_type.dart +lib/src/model/health.dart +lib/src/model/job_status.dart +lib/src/model/login_request.dart +lib/src/model/net_worth_breakdown.dart +lib/src/model/net_worth_day.dart +lib/src/model/problem.dart +lib/src/model/refresh_log_out.dart +lib/src/model/refresh_request.dart +lib/src/model/rule_create.dart +lib/src/model/rule_kind.dart +lib/src/model/rule_match_type.dart +lib/src/model/rule_out.dart +lib/src/model/rule_patch.dart +lib/src/model/run_status.dart +lib/src/model/runway_out.dart +lib/src/model/source_status.dart +lib/src/model/spending_row.dart +lib/src/model/sync_job_out.dart +lib/src/model/sync_run_out.dart +lib/src/model/token_pair.dart +lib/src/model/transaction_out.dart +lib/src/model/transaction_page.dart +lib/src/model/user_out.dart +pubspec.yaml +test/account_balance_test.dart +test/account_kind_test.dart +test/account_out_test.dart +test/account_patch_test.dart +test/account_role_test.dart +test/accounts_api_test.dart +test/broker_test.dart +test/cash_flow_month_test.dart +test/cashflow_api_test.dart +test/categories_api_test.dart +test/category_out_test.dart +test/data_quality_row_test.dart +test/event_source_test.dart +test/flow_type_test.dart +test/metrics_api_test.dart +test/net_worth_breakdown_test.dart +test/net_worth_day_test.dart +test/networth_api_test.dart +test/refresh_log_out_test.dart +test/rule_create_test.dart +test/rule_kind_test.dart +test/rule_match_type_test.dart +test/rule_out_test.dart +test/rule_patch_test.dart +test/rules_api_test.dart +test/runway_out_test.dart +test/spending_row_test.dart +test/transaction_out_test.dart +test/transaction_page_test.dart +test/transactions_api_test.dart diff --git a/app/packages/api_client/.openapi-generator/VERSION b/app/packages/api_client/.openapi-generator/VERSION new file mode 100644 index 0000000..bc34d81 --- /dev/null +++ b/app/packages/api_client/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.25.0 diff --git a/app/packages/api_client/analysis_options.yaml b/app/packages/api_client/analysis_options.yaml new file mode 100644 index 0000000..7052412 --- /dev/null +++ b/app/packages/api_client/analysis_options.yaml @@ -0,0 +1,10 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: false + exclude: + - test/*.dart + - lib/src/model/*.g.dart + errors: + deprecated_member_use_from_same_package: ignore diff --git a/app/packages/api_client/build.yaml b/app/packages/api_client/build.yaml new file mode 100644 index 0000000..89a4dd6 --- /dev/null +++ b/app/packages/api_client/build.yaml @@ -0,0 +1,18 @@ +targets: + $default: + builders: + json_serializable: + options: + # Options configure how source code is generated for every + # `@JsonSerializable`-annotated class in the package. + # + # The default value for each is listed. + any_map: false + checked: true + create_factory: true + create_to_json: true + disallow_unrecognized_keys: true + explicit_to_json: true + field_rename: none + ignore_unannotated: false + include_if_null: false diff --git a/app/packages/api_client/doc/AccountBalance.md b/app/packages/api_client/doc/AccountBalance.md new file mode 100644 index 0000000..167c09c --- /dev/null +++ b/app/packages/api_client/doc/AccountBalance.md @@ -0,0 +1,20 @@ +# fintracker_api.model.AccountBalance + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**accountId** | **int** | | +**balance** | **String** | decimal as string | +**balanceRub** | **String** | decimal as string | +**currency** | **String** | | +**name** | **String** | | +**role** | [**AccountRole**](AccountRole.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/AccountKind.md b/app/packages/api_client/doc/AccountKind.md new file mode 100644 index 0000000..10f8c8e --- /dev/null +++ b/app/packages/api_client/doc/AccountKind.md @@ -0,0 +1,14 @@ +# fintracker_api.model.AccountKind + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/AccountOut.md b/app/packages/api_client/doc/AccountOut.md new file mode 100644 index 0000000..f6d61f0 --- /dev/null +++ b/app/packages/api_client/doc/AccountOut.md @@ -0,0 +1,31 @@ +# fintracker_api.model.AccountOut + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**archived** | **bool** | | +**balance** | **String** | decimal as string | +**balanceAsOf** | [**DateTime**](DateTime.md) | | +**broker** | [**Broker**](Broker.md) | | +**creditLimit** | **String** | decimal as string | +**currency** | **String** | | +**id** | **int** | | +**includeInNetWorth** | **bool** | | +**kind** | [**AccountKind**](AccountKind.md) | | +**mirrorOfAccountId** | **int** | | +**name** | **String** | | +**openedAt** | [**DateTime**](DateTime.md) | | +**primaryEventSource** | [**EventSource**](EventSource.md) | | +**role** | [**AccountRole**](AccountRole.md) | | +**source_** | **String** | | +**sourceId** | **String** | | +**startBalance** | **String** | decimal as string | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/AccountPatch.md b/app/packages/api_client/doc/AccountPatch.md new file mode 100644 index 0000000..53a8985 --- /dev/null +++ b/app/packages/api_client/doc/AccountPatch.md @@ -0,0 +1,19 @@ +# fintracker_api.model.AccountPatch + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**includeInNetWorth** | **bool** | | [optional] +**mirrorOfAccountId** | **int** | | [optional] +**name** | **String** | | [optional] +**primaryEventSource** | [**EventSource**](EventSource.md) | | [optional] +**role** | [**AccountRole**](AccountRole.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/AccountRole.md b/app/packages/api_client/doc/AccountRole.md new file mode 100644 index 0000000..dd43644 --- /dev/null +++ b/app/packages/api_client/doc/AccountRole.md @@ -0,0 +1,14 @@ +# fintracker_api.model.AccountRole + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/AccountsApi.md b/app/packages/api_client/doc/AccountsApi.md new file mode 100644 index 0000000..7047a69 --- /dev/null +++ b/app/packages/api_client/doc/AccountsApi.md @@ -0,0 +1,99 @@ +# fintracker_api.api.AccountsApi + +## Load the API package +```dart +import 'package:fintracker_api/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**accountsList**](AccountsApi.md#accountslist) | **GET** /api/v1/accounts | List +[**accountsPatch**](AccountsApi.md#accountspatch) | **PATCH** /api/v1/accounts/{account_id} | Patch + + +# **accountsList** +> List accountsList() + +List + +Every account, archived ones included — the client decides what to show. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getAccountsApi(); + +try { + final response = api.accountsList(); + print(response); +} on DioException catch (e) { + print('Exception when calling AccountsApi->accountsList: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<AccountOut>**](AccountOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **accountsPatch** +> AccountOut accountsPatch(accountId, accountPatch) + +Patch + +Update the user-owned fields. Everything else is overwritten by the next sync. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getAccountsApi(); +final int accountId = 56; // int | +final AccountPatch accountPatch = ; // AccountPatch | + +try { + final response = api.accountsPatch(accountId, accountPatch); + print(response); +} on DioException catch (e) { + print('Exception when calling AccountsApi->accountsPatch: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **accountId** | **int**| | + **accountPatch** | [**AccountPatch**](AccountPatch.md)| | + +### Return type + +[**AccountOut**](AccountOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/app/packages/api_client/doc/AuthApi.md b/app/packages/api_client/doc/AuthApi.md new file mode 100644 index 0000000..3cad69e --- /dev/null +++ b/app/packages/api_client/doc/AuthApi.md @@ -0,0 +1,176 @@ +# fintracker_api.api.AuthApi + +## Load the API package +```dart +import 'package:fintracker_api/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**authLogin**](AuthApi.md#authlogin) | **POST** /api/v1/auth/login | Login +[**authLogout**](AuthApi.md#authlogout) | **POST** /api/v1/auth/logout | Logout +[**authMe**](AuthApi.md#authme) | **GET** /api/v1/auth/me | Me +[**authRefresh**](AuthApi.md#authrefresh) | **POST** /api/v1/auth/refresh | Refresh + + +# **authLogin** +> TokenPair authLogin(loginRequest) + +Login + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getAuthApi(); +final LoginRequest loginRequest = ; // LoginRequest | + +try { + final response = api.authLogin(loginRequest); + print(response); +} on DioException catch (e) { + print('Exception when calling AuthApi->authLogin: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **loginRequest** | [**LoginRequest**](LoginRequest.md)| | + +### Return type + +[**TokenPair**](TokenPair.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **authLogout** +> authLogout(refreshRequest) + +Logout + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getAuthApi(); +final RefreshRequest refreshRequest = ; // RefreshRequest | + +try { + api.authLogout(refreshRequest); +} on DioException catch (e) { + print('Exception when calling AuthApi->authLogout: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **refreshRequest** | [**RefreshRequest**](RefreshRequest.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **authMe** +> UserOut authMe() + +Me + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getAuthApi(); + +try { + final response = api.authMe(); + print(response); +} on DioException catch (e) { + print('Exception when calling AuthApi->authMe: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**UserOut**](UserOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **authRefresh** +> TokenPair authRefresh(refreshRequest) + +Refresh + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getAuthApi(); +final RefreshRequest refreshRequest = ; // RefreshRequest | + +try { + final response = api.authRefresh(refreshRequest); + print(response); +} on DioException catch (e) { + print('Exception when calling AuthApi->authRefresh: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **refreshRequest** | [**RefreshRequest**](RefreshRequest.md)| | + +### Return type + +[**TokenPair**](TokenPair.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/app/packages/api_client/doc/Broker.md b/app/packages/api_client/doc/Broker.md new file mode 100644 index 0000000..bd79d2f --- /dev/null +++ b/app/packages/api_client/doc/Broker.md @@ -0,0 +1,14 @@ +# fintracker_api.model.Broker + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/CashFlowMonth.md b/app/packages/api_client/doc/CashFlowMonth.md new file mode 100644 index 0000000..a65a8ca --- /dev/null +++ b/app/packages/api_client/doc/CashFlowMonth.md @@ -0,0 +1,22 @@ +# fintracker_api.model.CashFlowMonth + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**baselineRub** | **String** | decimal as string | +**expenseRub** | **String** | decimal as string | +**incomeRub** | **String** | decimal as string | +**month** | [**DateTime**](DateTime.md) | | +**oneOffRub** | **String** | decimal as string | +**savingsRate** | **String** | decimal as string | +**savingsTransferRub** | **String** | decimal as string | +**txnCount** | **int** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/CashflowApi.md b/app/packages/api_client/doc/CashflowApi.md new file mode 100644 index 0000000..9716900 --- /dev/null +++ b/app/packages/api_client/doc/CashflowApi.md @@ -0,0 +1,141 @@ +# fintracker_api.api.CashflowApi + +## Load the API package +```dart +import 'package:fintracker_api/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**cashflowMonthly**](CashflowApi.md#cashflowmonthly) | **GET** /api/v1/cashflow/monthly | Monthly +[**cashflowRunway**](CashflowApi.md#cashflowrunway) | **GET** /api/v1/runway | Runway +[**cashflowSpending**](CashflowApi.md#cashflowspending) | **GET** /api/v1/spending/categories | Spending + + +# **cashflowMonthly** +> List cashflowMonthly(months) + +Monthly + +The last `months` months, oldest first. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getCashflowApi(); +final int months = 56; // int | + +try { + final response = api.cashflowMonthly(months); + print(response); +} on DioException catch (e) { + print('Exception when calling CashflowApi->cashflowMonthly: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **months** | **int**| | [optional] [default to 12] + +### Return type + +[**List<CashFlowMonth>**](CashFlowMonth.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **cashflowRunway** +> RunwayOut cashflowRunway() + +Runway + +How many months the liquid reserve covers; null before the first refresh. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getCashflowApi(); + +try { + final response = api.cashflowRunway(); + print(response); +} on DioException catch (e) { + print('Exception when calling CashflowApi->cashflowRunway: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**RunwayOut**](RunwayOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **cashflowSpending** +> List cashflowSpending(month) + +Spending + +Expenses of one month by category, largest first. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getCashflowApi(); +final String month = month_example; // String | YYYY-MM; defaults to the latest month + +try { + final response = api.cashflowSpending(month); + print(response); +} on DioException catch (e) { + print('Exception when calling CashflowApi->cashflowSpending: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **month** | **String**| YYYY-MM; defaults to the latest month | [optional] + +### Return type + +[**List<SpendingRow>**](SpendingRow.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/app/packages/api_client/doc/CategoriesApi.md b/app/packages/api_client/doc/CategoriesApi.md new file mode 100644 index 0000000..2a79b6e --- /dev/null +++ b/app/packages/api_client/doc/CategoriesApi.md @@ -0,0 +1,53 @@ +# fintracker_api.api.CategoriesApi + +## Load the API package +```dart +import 'package:fintracker_api/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**categoriesList**](CategoriesApi.md#categorieslist) | **GET** /api/v1/categories | List + + +# **categoriesList** +> List categoriesList() + +List + +Flat list of the ZenMoney tag tree; the client nests it by `parent_id`. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getCategoriesApi(); + +try { + final response = api.categoriesList(); + print(response); +} on DioException catch (e) { + print('Exception when calling CategoriesApi->categoriesList: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<CategoryOut>**](CategoryOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/app/packages/api_client/doc/CategoryOut.md b/app/packages/api_client/doc/CategoryOut.md new file mode 100644 index 0000000..cd55df0 --- /dev/null +++ b/app/packages/api_client/doc/CategoryOut.md @@ -0,0 +1,22 @@ +# fintracker_api.model.CategoryOut + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**archived** | **bool** | | +**color** | **int** | | +**icon** | **String** | | +**id** | **int** | | +**name** | **String** | | +**parentId** | **int** | | +**showIncome** | **bool** | | +**showOutcome** | **bool** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/DataQualityRow.md b/app/packages/api_client/doc/DataQualityRow.md new file mode 100644 index 0000000..179099a --- /dev/null +++ b/app/packages/api_client/doc/DataQualityRow.md @@ -0,0 +1,21 @@ +# fintracker_api.model.DataQualityRow + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**checkName** | **String** | | +**computedAt** | [**DateTime**](DateTime.md) | | +**count** | **int** | | +**detail** | **String** | | +**id** | **int** | | +**ref** | **Map<String, Object>** | | +**severity** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/EventSource.md b/app/packages/api_client/doc/EventSource.md new file mode 100644 index 0000000..2cb2c46 --- /dev/null +++ b/app/packages/api_client/doc/EventSource.md @@ -0,0 +1,14 @@ +# fintracker_api.model.EventSource + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/FlowType.md b/app/packages/api_client/doc/FlowType.md new file mode 100644 index 0000000..2716791 --- /dev/null +++ b/app/packages/api_client/doc/FlowType.md @@ -0,0 +1,14 @@ +# fintracker_api.model.FlowType + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/Health.md b/app/packages/api_client/doc/Health.md new file mode 100644 index 0000000..ff5ae38 --- /dev/null +++ b/app/packages/api_client/doc/Health.md @@ -0,0 +1,17 @@ +# fintracker_api.model.Health + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**database** | **String** | | +**status** | **String** | | +**version** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/HealthApi.md b/app/packages/api_client/doc/HealthApi.md new file mode 100644 index 0000000..3910e97 --- /dev/null +++ b/app/packages/api_client/doc/HealthApi.md @@ -0,0 +1,51 @@ +# fintracker_api.api.HealthApi + +## Load the API package +```dart +import 'package:fintracker_api/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**healthCheck**](HealthApi.md#healthcheck) | **GET** /api/v1/health | Check + + +# **healthCheck** +> Health healthCheck() + +Check + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getHealthApi(); + +try { + final response = api.healthCheck(); + print(response); +} on DioException catch (e) { + print('Exception when calling HealthApi->healthCheck: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Health**](Health.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/app/packages/api_client/doc/JobStatus.md b/app/packages/api_client/doc/JobStatus.md new file mode 100644 index 0000000..196c23e --- /dev/null +++ b/app/packages/api_client/doc/JobStatus.md @@ -0,0 +1,14 @@ +# fintracker_api.model.JobStatus + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/LoginRequest.md b/app/packages/api_client/doc/LoginRequest.md new file mode 100644 index 0000000..ac87994 --- /dev/null +++ b/app/packages/api_client/doc/LoginRequest.md @@ -0,0 +1,16 @@ +# fintracker_api.model.LoginRequest + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **String** | | +**password** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/MetricsApi.md b/app/packages/api_client/doc/MetricsApi.md new file mode 100644 index 0000000..481ab3c --- /dev/null +++ b/app/packages/api_client/doc/MetricsApi.md @@ -0,0 +1,133 @@ +# fintracker_api.api.MetricsApi + +## Load the API package +```dart +import 'package:fintracker_api/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**metricsDataQuality**](MetricsApi.md#metricsdataquality) | **GET** /api/v1/data-quality | Data Quality +[**metricsRefresh**](MetricsApi.md#metricsrefresh) | **POST** /api/v1/metrics/refresh | Refresh +[**metricsStatus**](MetricsApi.md#metricsstatus) | **GET** /api/v1/metrics/status | Status + + +# **metricsDataQuality** +> List metricsDataQuality() + +Data Quality + +Findings of the latest refresh, most serious first. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getMetricsApi(); + +try { + final response = api.metricsDataQuality(); + print(response); +} on DioException catch (e) { + print('Exception when calling MetricsApi->metricsDataQuality: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<DataQualityRow>**](DataQualityRow.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **metricsRefresh** +> RefreshLogOut metricsRefresh() + +Refresh + +Rebuild every metric_* table inline (seconds at personal volumes). + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getMetricsApi(); + +try { + final response = api.metricsRefresh(); + print(response); +} on DioException catch (e) { + print('Exception when calling MetricsApi->metricsRefresh: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**RefreshLogOut**](RefreshLogOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **metricsStatus** +> RefreshLogOut metricsStatus() + +Status + +When the metric tables were last rebuilt, and whether it failed. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getMetricsApi(); + +try { + final response = api.metricsStatus(); + print(response); +} on DioException catch (e) { + print('Exception when calling MetricsApi->metricsStatus: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**RefreshLogOut**](RefreshLogOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/app/packages/api_client/doc/NetWorthBreakdown.md b/app/packages/api_client/doc/NetWorthBreakdown.md new file mode 100644 index 0000000..97d7dd8 --- /dev/null +++ b/app/packages/api_client/doc/NetWorthBreakdown.md @@ -0,0 +1,23 @@ +# fintracker_api.model.NetWorthBreakdown + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**accounts** | [**List<AccountBalance>**](AccountBalance.md) | | +**byCurrency** | **Map<String, String>** | | +**d** | [**DateTime**](DateTime.md) | | +**debtRub** | **String** | decimal as string | +**investmentRub** | **String** | decimal as string | +**liquidRub** | **String** | decimal as string | +**missingFxCount** | **int** | | +**savingsRub** | **String** | decimal as string | +**totalRub** | **String** | decimal as string | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/NetWorthDay.md b/app/packages/api_client/doc/NetWorthDay.md new file mode 100644 index 0000000..b995505 --- /dev/null +++ b/app/packages/api_client/doc/NetWorthDay.md @@ -0,0 +1,22 @@ +# fintracker_api.model.NetWorthDay + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**byCurrency** | **Map<String, String>** | | +**d** | [**DateTime**](DateTime.md) | | +**debtRub** | **String** | decimal as string | +**investmentRub** | **String** | decimal as string | +**liquidRub** | **String** | decimal as string | +**missingFxCount** | **int** | | +**savingsRub** | **String** | decimal as string | +**totalRub** | **String** | decimal as string | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/NetworthApi.md b/app/packages/api_client/doc/NetworthApi.md new file mode 100644 index 0000000..9af915c --- /dev/null +++ b/app/packages/api_client/doc/NetworthApi.md @@ -0,0 +1,99 @@ +# fintracker_api.api.NetworthApi + +## Load the API package +```dart +import 'package:fintracker_api/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**networthBreakdown**](NetworthApi.md#networthbreakdown) | **GET** /api/v1/networth/breakdown | Breakdown +[**networthSeries**](NetworthApi.md#networthseries) | **GET** /api/v1/networth/series | Series + + +# **networthBreakdown** +> NetWorthBreakdown networthBreakdown() + +Breakdown + +The latest day's buckets, plus every account's current balance native and in RUB. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getNetworthApi(); + +try { + final response = api.networthBreakdown(); + print(response); +} on DioException catch (e) { + print('Exception when calling NetworthApi->networthBreakdown: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**NetWorthBreakdown**](NetWorthBreakdown.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **networthSeries** +> List networthSeries(from, to) + +Series + +Daily net worth; defaults to the last 365 days. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getNetworthApi(); +final DateTime from = 2013-10-20; // DateTime | +final DateTime to = 2013-10-20; // DateTime | + +try { + final response = api.networthSeries(from, to); + print(response); +} on DioException catch (e) { + print('Exception when calling NetworthApi->networthSeries: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **from** | **DateTime**| | [optional] + **to** | **DateTime**| | [optional] + +### Return type + +[**List<NetWorthDay>**](NetWorthDay.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/app/packages/api_client/doc/Problem.md b/app/packages/api_client/doc/Problem.md new file mode 100644 index 0000000..5f8405f --- /dev/null +++ b/app/packages/api_client/doc/Problem.md @@ -0,0 +1,18 @@ +# fintracker_api.model.Problem + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**detail** | **String** | | [optional] +**errors** | **List<Object>** | | [optional] +**status** | **int** | | +**title** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/RefreshLogOut.md b/app/packages/api_client/doc/RefreshLogOut.md new file mode 100644 index 0000000..78d8be0 --- /dev/null +++ b/app/packages/api_client/doc/RefreshLogOut.md @@ -0,0 +1,19 @@ +# fintracker_api.model.RefreshLogOut + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **String** | | +**finishedAt** | [**DateTime**](DateTime.md) | | +**id** | **int** | | +**startedAt** | [**DateTime**](DateTime.md) | | +**trigger** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/RefreshRequest.md b/app/packages/api_client/doc/RefreshRequest.md new file mode 100644 index 0000000..bfdf7d5 --- /dev/null +++ b/app/packages/api_client/doc/RefreshRequest.md @@ -0,0 +1,15 @@ +# fintracker_api.model.RefreshRequest + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**refreshToken** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/RuleCreate.md b/app/packages/api_client/doc/RuleCreate.md new file mode 100644 index 0000000..6a5ac1e --- /dev/null +++ b/app/packages/api_client/doc/RuleCreate.md @@ -0,0 +1,21 @@ +# fintracker_api.model.RuleCreate + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | | [optional] [default to true] +**kind** | [**RuleKind**](RuleKind.md) | | +**matchType** | [**RuleMatchType**](RuleMatchType.md) | | +**note** | **String** | | [optional] +**pattern** | **String** | | +**priority** | **int** | | [optional] [default to 100] +**value** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/RuleKind.md b/app/packages/api_client/doc/RuleKind.md new file mode 100644 index 0000000..6d457e9 --- /dev/null +++ b/app/packages/api_client/doc/RuleKind.md @@ -0,0 +1,14 @@ +# fintracker_api.model.RuleKind + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/RuleMatchType.md b/app/packages/api_client/doc/RuleMatchType.md new file mode 100644 index 0000000..5e1278d --- /dev/null +++ b/app/packages/api_client/doc/RuleMatchType.md @@ -0,0 +1,14 @@ +# fintracker_api.model.RuleMatchType + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/RuleOut.md b/app/packages/api_client/doc/RuleOut.md new file mode 100644 index 0000000..1810e5e --- /dev/null +++ b/app/packages/api_client/doc/RuleOut.md @@ -0,0 +1,24 @@ +# fintracker_api.model.RuleOut + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | | +**id** | **int** | | +**kind** | [**RuleKind**](RuleKind.md) | | +**lastMatchedAt** | [**DateTime**](DateTime.md) | | +**matchCount** | **int** | | +**matchType** | [**RuleMatchType**](RuleMatchType.md) | | +**note** | **String** | | +**pattern** | **String** | | +**priority** | **int** | | +**value** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/RulePatch.md b/app/packages/api_client/doc/RulePatch.md new file mode 100644 index 0000000..764f393 --- /dev/null +++ b/app/packages/api_client/doc/RulePatch.md @@ -0,0 +1,21 @@ +# fintracker_api.model.RulePatch + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | | [optional] +**kind** | [**RuleKind**](RuleKind.md) | | [optional] +**matchType** | [**RuleMatchType**](RuleMatchType.md) | | [optional] +**note** | **String** | | [optional] +**pattern** | **String** | | [optional] +**priority** | **int** | | [optional] +**value** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/RulesApi.md b/app/packages/api_client/doc/RulesApi.md new file mode 100644 index 0000000..ab43471 --- /dev/null +++ b/app/packages/api_client/doc/RulesApi.md @@ -0,0 +1,258 @@ +# fintracker_api.api.RulesApi + +## Load the API package +```dart +import 'package:fintracker_api/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**rulesApply**](RulesApi.md#rulesapply) | **POST** /api/v1/rules/apply | Apply +[**rulesCreate**](RulesApi.md#rulescreate) | **POST** /api/v1/rules | Create +[**rulesDelete**](RulesApi.md#rulesdelete) | **DELETE** /api/v1/rules/{rule_id} | Delete +[**rulesList**](RulesApi.md#ruleslist) | **GET** /api/v1/rules | List +[**rulesPatch**](RulesApi.md#rulespatch) | **PATCH** /api/v1/rules/{rule_id} | Patch +[**rulesStale**](RulesApi.md#rulesstale) | **GET** /api/v1/rules/stale | Stale + + +# **rulesApply** +> RefreshLogOut rulesApply() + +Apply + +Re-run the whole metric refresh so edited rules take effect everywhere at once. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getRulesApi(); + +try { + final response = api.rulesApply(); + print(response); +} on DioException catch (e) { + print('Exception when calling RulesApi->rulesApply: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**RefreshLogOut**](RefreshLogOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **rulesCreate** +> RuleOut rulesCreate(ruleCreate) + +Create + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getRulesApi(); +final RuleCreate ruleCreate = ; // RuleCreate | + +try { + final response = api.rulesCreate(ruleCreate); + print(response); +} on DioException catch (e) { + print('Exception when calling RulesApi->rulesCreate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ruleCreate** | [**RuleCreate**](RuleCreate.md)| | + +### Return type + +[**RuleOut**](RuleOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **rulesDelete** +> rulesDelete(ruleId) + +Delete + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getRulesApi(); +final int ruleId = 56; // int | + +try { + api.rulesDelete(ruleId); +} on DioException catch (e) { + print('Exception when calling RulesApi->rulesDelete: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ruleId** | **int**| | + +### Return type + +void (empty response body) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **rulesList** +> List rulesList() + +List + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getRulesApi(); + +try { + final response = api.rulesList(); + print(response); +} on DioException catch (e) { + print('Exception when calling RulesApi->rulesList: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<RuleOut>**](RuleOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **rulesPatch** +> RuleOut rulesPatch(ruleId, rulePatch) + +Patch + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getRulesApi(); +final int ruleId = 56; // int | +final RulePatch rulePatch = ; // RulePatch | + +try { + final response = api.rulesPatch(ruleId, rulePatch); + print(response); +} on DioException catch (e) { + print('Exception when calling RulesApi->rulesPatch: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ruleId** | **int**| | + **rulePatch** | [**RulePatch**](RulePatch.md)| | + +### Return type + +[**RuleOut**](RuleOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **rulesStale** +> List rulesStale() + +Stale + +Enabled rules that matched nothing in the latest refresh: the payee was renamed, or the transaction was re-categorised in ZenMoney. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getRulesApi(); + +try { + final response = api.rulesStale(); + print(response); +} on DioException catch (e) { + print('Exception when calling RulesApi->rulesStale: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<RuleOut>**](RuleOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/app/packages/api_client/doc/RunStatus.md b/app/packages/api_client/doc/RunStatus.md new file mode 100644 index 0000000..e0aab78 --- /dev/null +++ b/app/packages/api_client/doc/RunStatus.md @@ -0,0 +1,14 @@ +# fintracker_api.model.RunStatus + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/RunwayOut.md b/app/packages/api_client/doc/RunwayOut.md new file mode 100644 index 0000000..f19410a --- /dev/null +++ b/app/packages/api_client/doc/RunwayOut.md @@ -0,0 +1,18 @@ +# fintracker_api.model.RunwayOut + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asOf** | [**DateTime**](DateTime.md) | | +**avgBaseline3mRub** | **String** | decimal as string | +**liquidReserveRub** | **String** | decimal as string | +**runwayMonths** | **String** | decimal as string | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/SourceStatus.md b/app/packages/api_client/doc/SourceStatus.md new file mode 100644 index 0000000..2d40c11 --- /dev/null +++ b/app/packages/api_client/doc/SourceStatus.md @@ -0,0 +1,20 @@ +# fintracker_api.model.SourceStatus + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cursor** | **String** | | +**lastRunAt** | [**DateTime**](DateTime.md) | | +**lastRunStatus** | [**RunStatus**](RunStatus.md) | | +**lastSuccessAt** | [**DateTime**](DateTime.md) | | +**queued** | **bool** | | +**source_** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/SpendingRow.md b/app/packages/api_client/doc/SpendingRow.md new file mode 100644 index 0000000..0507d86 --- /dev/null +++ b/app/packages/api_client/doc/SpendingRow.md @@ -0,0 +1,21 @@ +# fintracker_api.model.SpendingRow + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amountRub** | **String** | decimal as string | +**categoryId** | **int** | | +**categoryName** | **String** | | +**month** | [**DateTime**](DateTime.md) | | +**rootCategoryId** | **int** | | +**rootCategoryName** | **String** | | +**txnCount** | **int** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/SyncApi.md b/app/packages/api_client/doc/SyncApi.md new file mode 100644 index 0000000..c4ccdf2 --- /dev/null +++ b/app/packages/api_client/doc/SyncApi.md @@ -0,0 +1,137 @@ +# fintracker_api.api.SyncApi + +## Load the API package +```dart +import 'package:fintracker_api/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**syncRuns**](SyncApi.md#syncruns) | **GET** /api/v1/sync/runs | Runs +[**syncStatus**](SyncApi.md#syncstatus) | **GET** /api/v1/sync/status | Status +[**syncTrigger**](SyncApi.md#synctrigger) | **POST** /api/v1/sync/{source} | Trigger + + +# **syncRuns** +> List syncRuns(source_, limit) + +Runs + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getSyncApi(); +final String source_ = source__example; // String | +final int limit = 56; // int | + +try { + final response = api.syncRuns(source_, limit); + print(response); +} on DioException catch (e) { + print('Exception when calling SyncApi->syncRuns: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **source_** | **String**| | [optional] + **limit** | **int**| | [optional] [default to 20] + +### Return type + +[**List<SyncRunOut>**](SyncRunOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **syncStatus** +> List syncStatus() + +Status + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getSyncApi(); + +try { + final response = api.syncStatus(); + print(response); +} on DioException catch (e) { + print('Exception when calling SyncApi->syncStatus: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<SourceStatus>**](SourceStatus.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **syncTrigger** +> SyncJobOut syncTrigger(source_) + +Trigger + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getSyncApi(); +final String source_ = source__example; // String | + +try { + final response = api.syncTrigger(source_); + print(response); +} on DioException catch (e) { + print('Exception when calling SyncApi->syncTrigger: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **source_** | **String**| | + +### Return type + +[**SyncJobOut**](SyncJobOut.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/app/packages/api_client/doc/SyncJobOut.md b/app/packages/api_client/doc/SyncJobOut.md new file mode 100644 index 0000000..b17e721 --- /dev/null +++ b/app/packages/api_client/doc/SyncJobOut.md @@ -0,0 +1,18 @@ +# fintracker_api.model.SyncJobOut + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**requestedAt** | [**DateTime**](DateTime.md) | | +**source_** | **String** | | +**status** | [**JobStatus**](JobStatus.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/SyncRunOut.md b/app/packages/api_client/doc/SyncRunOut.md new file mode 100644 index 0000000..9c66e89 --- /dev/null +++ b/app/packages/api_client/doc/SyncRunOut.md @@ -0,0 +1,25 @@ +# fintracker_api.model.SyncRunOut + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**counts** | **Map<String, Object>** | | +**cursorAfter** | **String** | | +**cursorBefore** | **String** | | +**error** | **String** | | +**finishedAt** | [**DateTime**](DateTime.md) | | +**id** | **String** | | +**source_** | **String** | | +**startedAt** | [**DateTime**](DateTime.md) | | +**status** | [**RunStatus**](RunStatus.md) | | +**triggeredBy** | **String** | | +**warnings** | **List<Object>** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/TokenPair.md b/app/packages/api_client/doc/TokenPair.md new file mode 100644 index 0000000..52ad7be --- /dev/null +++ b/app/packages/api_client/doc/TokenPair.md @@ -0,0 +1,18 @@ +# fintracker_api.model.TokenPair + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**accessToken** | **String** | | +**expiresIn** | **int** | | +**refreshToken** | **String** | | +**tokenType** | **String** | | [optional] [default to 'bearer'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/TransactionOut.md b/app/packages/api_client/doc/TransactionOut.md new file mode 100644 index 0000000..a4fbba4 --- /dev/null +++ b/app/packages/api_client/doc/TransactionOut.md @@ -0,0 +1,37 @@ +# fintracker_api.model.TransactionOut + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**categoryId** | **int** | | +**comment** | **String** | | +**date** | [**DateTime**](DateTime.md) | | +**deleted** | **bool** | | +**flowType** | [**FlowType**](FlowType.md) | | +**hold** | **bool** | | +**id** | **int** | | +**income** | **String** | decimal as string | +**incomeAccountId** | **int** | | +**incomeCurrency** | **String** | | +**incomeRub** | **String** | decimal as string | +**isOneOff** | **bool** | | +**mcc** | **int** | | +**outcome** | **String** | decimal as string | +**outcomeAccountId** | **int** | | +**outcomeCurrency** | **String** | | +**outcomeRub** | **String** | decimal as string | +**payee** | **String** | | +**payeeCanonical** | **String** | | +**sourceId** | **String** | | +**tags** | **List<int>** | | +**tripId** | **int** | | +**ts** | [**DateTime**](DateTime.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/TransactionPage.md b/app/packages/api_client/doc/TransactionPage.md new file mode 100644 index 0000000..20aa94f --- /dev/null +++ b/app/packages/api_client/doc/TransactionPage.md @@ -0,0 +1,18 @@ +# fintracker_api.model.TransactionPage + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**items** | [**List<TransactionOut>**](TransactionOut.md) | | +**page** | **int** | | +**pageSize** | **int** | | +**total** | **int** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/doc/TransactionsApi.md b/app/packages/api_client/doc/TransactionsApi.md new file mode 100644 index 0000000..6aabfc5 --- /dev/null +++ b/app/packages/api_client/doc/TransactionsApi.md @@ -0,0 +1,73 @@ +# fintracker_api.api.TransactionsApi + +## Load the API package +```dart +import 'package:fintracker_api/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**transactionsList**](TransactionsApi.md#transactionslist) | **GET** /api/v1/transactions | List + + +# **transactionsList** +> TransactionPage transactionsList(from, to, accountId, categoryId, flowType, q, includeDeleted, page, pageSize) + +List + +One page of transactions, newest first, with RUB amounts at each own date's rate. + +### Example +```dart +import 'package:fintracker_api/api.dart'; + +final api = FintrackerApi().getTransactionsApi(); +final DateTime from = 2013-10-20; // DateTime | +final DateTime to = 2013-10-20; // DateTime | +final int accountId = 56; // int | +final int categoryId = 56; // int | +final FlowType flowType = ; // FlowType | +final String q = q_example; // String | substring of payee or comment +final bool includeDeleted = true; // bool | +final int page = 56; // int | +final int pageSize = 56; // int | + +try { + final response = api.transactionsList(from, to, accountId, categoryId, flowType, q, includeDeleted, page, pageSize); + print(response); +} on DioException catch (e) { + print('Exception when calling TransactionsApi->transactionsList: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **from** | **DateTime**| | [optional] + **to** | **DateTime**| | [optional] + **accountId** | **int**| | [optional] + **categoryId** | **int**| | [optional] + **flowType** | [**FlowType**](.md)| | [optional] + **q** | **String**| substring of payee or comment | [optional] + **includeDeleted** | **bool**| | [optional] [default to false] + **page** | **int**| | [optional] [default to 1] + **pageSize** | **int**| | [optional] [default to 50] + +### Return type + +[**TransactionPage**](TransactionPage.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/app/packages/api_client/doc/UserOut.md b/app/packages/api_client/doc/UserOut.md new file mode 100644 index 0000000..d929b6e --- /dev/null +++ b/app/packages/api_client/doc/UserOut.md @@ -0,0 +1,16 @@ +# fintracker_api.model.UserOut + +## Load the model package +```dart +import 'package:fintracker_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **String** | | +**id** | **int** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/app/packages/api_client/lib/fintracker_api.dart b/app/packages/api_client/lib/fintracker_api.dart new file mode 100644 index 0000000..4e76fd5 --- /dev/null +++ b/app/packages/api_client/lib/fintracker_api.dart @@ -0,0 +1,57 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:fintracker_api/src/api.dart'; +export 'package:fintracker_api/src/auth/api_key_auth.dart'; +export 'package:fintracker_api/src/auth/basic_auth.dart'; +export 'package:fintracker_api/src/auth/bearer_auth.dart'; +export 'package:fintracker_api/src/auth/oauth.dart'; + + +export 'package:fintracker_api/src/api/accounts_api.dart'; +export 'package:fintracker_api/src/api/auth_api.dart'; +export 'package:fintracker_api/src/api/cashflow_api.dart'; +export 'package:fintracker_api/src/api/categories_api.dart'; +export 'package:fintracker_api/src/api/health_api.dart'; +export 'package:fintracker_api/src/api/metrics_api.dart'; +export 'package:fintracker_api/src/api/networth_api.dart'; +export 'package:fintracker_api/src/api/rules_api.dart'; +export 'package:fintracker_api/src/api/sync_api.dart'; +export 'package:fintracker_api/src/api/transactions_api.dart'; + +export 'package:fintracker_api/src/model/account_balance.dart'; +export 'package:fintracker_api/src/model/account_kind.dart'; +export 'package:fintracker_api/src/model/account_out.dart'; +export 'package:fintracker_api/src/model/account_patch.dart'; +export 'package:fintracker_api/src/model/account_role.dart'; +export 'package:fintracker_api/src/model/broker.dart'; +export 'package:fintracker_api/src/model/cash_flow_month.dart'; +export 'package:fintracker_api/src/model/category_out.dart'; +export 'package:fintracker_api/src/model/data_quality_row.dart'; +export 'package:fintracker_api/src/model/event_source.dart'; +export 'package:fintracker_api/src/model/flow_type.dart'; +export 'package:fintracker_api/src/model/health.dart'; +export 'package:fintracker_api/src/model/job_status.dart'; +export 'package:fintracker_api/src/model/login_request.dart'; +export 'package:fintracker_api/src/model/net_worth_breakdown.dart'; +export 'package:fintracker_api/src/model/net_worth_day.dart'; +export 'package:fintracker_api/src/model/problem.dart'; +export 'package:fintracker_api/src/model/refresh_log_out.dart'; +export 'package:fintracker_api/src/model/refresh_request.dart'; +export 'package:fintracker_api/src/model/rule_create.dart'; +export 'package:fintracker_api/src/model/rule_kind.dart'; +export 'package:fintracker_api/src/model/rule_match_type.dart'; +export 'package:fintracker_api/src/model/rule_out.dart'; +export 'package:fintracker_api/src/model/rule_patch.dart'; +export 'package:fintracker_api/src/model/run_status.dart'; +export 'package:fintracker_api/src/model/runway_out.dart'; +export 'package:fintracker_api/src/model/source_status.dart'; +export 'package:fintracker_api/src/model/spending_row.dart'; +export 'package:fintracker_api/src/model/sync_job_out.dart'; +export 'package:fintracker_api/src/model/sync_run_out.dart'; +export 'package:fintracker_api/src/model/token_pair.dart'; +export 'package:fintracker_api/src/model/transaction_out.dart'; +export 'package:fintracker_api/src/model/transaction_page.dart'; +export 'package:fintracker_api/src/model/user_out.dart'; + diff --git a/app/packages/api_client/lib/src/api.dart b/app/packages/api_client/lib/src/api.dart new file mode 100644 index 0000000..4f1e7e1 --- /dev/null +++ b/app/packages/api_client/lib/src/api.dart @@ -0,0 +1,171 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:fintracker_api/src/auth/api_key_auth.dart'; +import 'package:fintracker_api/src/auth/basic_auth.dart'; +import 'package:fintracker_api/src/auth/bearer_auth.dart'; +import 'package:fintracker_api/src/auth/oauth.dart'; +import 'package:fintracker_api/src/api/accounts_api.dart'; +import 'package:fintracker_api/src/api/auth_api.dart'; +import 'package:fintracker_api/src/api/cashflow_api.dart'; +import 'package:fintracker_api/src/api/categories_api.dart'; +import 'package:fintracker_api/src/api/health_api.dart'; +import 'package:fintracker_api/src/api/metrics_api.dart'; +import 'package:fintracker_api/src/api/networth_api.dart'; +import 'package:fintracker_api/src/api/rules_api.dart'; +import 'package:fintracker_api/src/api/sync_api.dart'; +import 'package:fintracker_api/src/api/transactions_api.dart'; + +class FintrackerApi { + static const String basePath = r'http://localhost'; + + final Dio dio; + FintrackerApi({ + Dio? dio, + String? basePathOverride, + List? interceptors, + }) : + this.dio = dio ?? + Dio(BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), + )) { + if (interceptors == null) { + this.dio.interceptors.addAll([ + OAuthInterceptor(), + BasicAuthInterceptor(), + BearerAuthInterceptor(), + ApiKeyAuthInterceptor(), + ]); + } else { + this.dio.interceptors.addAll(interceptors); + } + } + + void setOAuthToken(String name, String token) { + if (this.dio.interceptors.any((i) => i is OAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor) as OAuthInterceptor).tokens[name] = token; + } + } + + /// Removes the OAuth token associated with the given [name]. + /// + /// If no [OAuthInterceptor] is registered or no token exists for the given + /// [name], this method has no effect. + void removeOAuthToken(String name) { + if (this.dio.interceptors.any((i) => i is OAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor) as OAuthInterceptor).tokens.remove(name); + } + } + + void setBearerAuth(String name, String token) { + if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).tokens[name] = token; + } + } + + /// Removes the bearer authentication token associated with the given [name]. + /// + /// If no [BearerAuthInterceptor] is registered or no token exists for the + /// given [name], this method has no effect. + void removeBearerAuth(String name) { + if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).tokens.remove(name); + } + } + + void setBasicAuth(String name, String username, String password) { + if (this.dio.interceptors.any((i) => i is BasicAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor) as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password); + } + } + + /// Removes the basic authentication credentials associated with the given [name]. + /// + /// If no [BasicAuthInterceptor] is registered or no credentials exist for the + /// given [name], this method has no effect. + void removeBasicAuth(String name) { + if (this.dio.interceptors.any((i) => i is BasicAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor) as BasicAuthInterceptor).authInfo.remove(name); + } + } + + void setApiKey(String name, String apiKey) { + if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) { + (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor) as ApiKeyAuthInterceptor).apiKeys[name] = apiKey; + } + } + + /// Removes the API key associated with the given [name]. + /// + /// If no [ApiKeyAuthInterceptor] is registered or no API key exists for the + /// given [name], this method has no effect. + void removeApiKey(String name) { + if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) { + (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor) as ApiKeyAuthInterceptor).apiKeys.remove(name); + } + } + + /// Get AccountsApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + AccountsApi getAccountsApi() { + return AccountsApi(dio); + } + + /// Get AuthApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + AuthApi getAuthApi() { + return AuthApi(dio); + } + + /// Get CashflowApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + CashflowApi getCashflowApi() { + return CashflowApi(dio); + } + + /// Get CategoriesApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + CategoriesApi getCategoriesApi() { + return CategoriesApi(dio); + } + + /// Get HealthApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + HealthApi getHealthApi() { + return HealthApi(dio); + } + + /// Get MetricsApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + MetricsApi getMetricsApi() { + return MetricsApi(dio); + } + + /// Get NetworthApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + NetworthApi getNetworthApi() { + return NetworthApi(dio); + } + + /// Get RulesApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + RulesApi getRulesApi() { + return RulesApi(dio); + } + + /// Get SyncApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + SyncApi getSyncApi() { + return SyncApi(dio); + } + + /// Get TransactionsApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + TransactionsApi getTransactionsApi() { + return TransactionsApi(dio); + } +} diff --git a/app/packages/api_client/lib/src/api/accounts_api.dart b/app/packages/api_client/lib/src/api/accounts_api.dart new file mode 100644 index 0000000..5731489 --- /dev/null +++ b/app/packages/api_client/lib/src/api/accounts_api.dart @@ -0,0 +1,197 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:fintracker_api/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:fintracker_api/src/model/account_out.dart'; +import 'package:fintracker_api/src/model/account_patch.dart'; +import 'package:fintracker_api/src/model/problem.dart'; + +class AccountsApi { + + final Dio _dio; + + const AccountsApi(this._dio); + + /// List + /// Every account, archived ones included — the client decides what to show. + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> accountsList({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/accounts'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, AccountOut>(rawData, 'List', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Patch + /// Update the user-owned fields. Everything else is overwritten by the next sync. + /// + /// Parameters: + /// * [accountId] + /// * [accountPatch] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [AccountOut] as data + /// Throws [DioException] if API call or serialization fails + Future> accountsPatch({ + required int accountId, + required AccountPatch accountPatch, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/accounts/{account_id}'.replaceAll('{' r'account_id' '}', accountId.toString()); + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = jsonEncode(accountPatch); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + AccountOut? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'AccountOut', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/app/packages/api_client/lib/src/api/auth_api.dart b/app/packages/api_client/lib/src/api/auth_api.dart new file mode 100644 index 0000000..b224f66 --- /dev/null +++ b/app/packages/api_client/lib/src/api/auth_api.dart @@ -0,0 +1,348 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:fintracker_api/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:fintracker_api/src/model/login_request.dart'; +import 'package:fintracker_api/src/model/problem.dart'; +import 'package:fintracker_api/src/model/refresh_request.dart'; +import 'package:fintracker_api/src/model/token_pair.dart'; +import 'package:fintracker_api/src/model/user_out.dart'; + +class AuthApi { + + final Dio _dio; + + const AuthApi(this._dio); + + /// Login + /// + /// + /// Parameters: + /// * [loginRequest] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [TokenPair] as data + /// Throws [DioException] if API call or serialization fails + Future> authLogin({ + required LoginRequest loginRequest, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/auth/login'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = jsonEncode(loginRequest); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + TokenPair? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'TokenPair', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Logout + /// + /// + /// Parameters: + /// * [refreshRequest] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> authLogout({ + required RefreshRequest refreshRequest, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/auth/logout'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = jsonEncode(refreshRequest); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Me + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [UserOut] as data + /// Throws [DioException] if API call or serialization fails + Future> authMe({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/auth/me'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + UserOut? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'UserOut', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Refresh + /// + /// + /// Parameters: + /// * [refreshRequest] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [TokenPair] as data + /// Throws [DioException] if API call or serialization fails + Future> authRefresh({ + required RefreshRequest refreshRequest, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/auth/refresh'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = jsonEncode(refreshRequest); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + TokenPair? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'TokenPair', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/app/packages/api_client/lib/src/api/cashflow_api.dart b/app/packages/api_client/lib/src/api/cashflow_api.dart new file mode 100644 index 0000000..e513278 --- /dev/null +++ b/app/packages/api_client/lib/src/api/cashflow_api.dart @@ -0,0 +1,265 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:fintracker_api/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:fintracker_api/src/model/cash_flow_month.dart'; +import 'package:fintracker_api/src/model/problem.dart'; +import 'package:fintracker_api/src/model/runway_out.dart'; +import 'package:fintracker_api/src/model/spending_row.dart'; + +class CashflowApi { + + final Dio _dio; + + const CashflowApi(this._dio); + + /// Monthly + /// The last `months` months, oldest first. + /// + /// Parameters: + /// * [months] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> cashflowMonthly({ + int? months = 12, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/cashflow/monthly'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (months != null) r'months': months, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, CashFlowMonth>(rawData, 'List', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Runway + /// How many months the liquid reserve covers; null before the first refresh. + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [RunwayOut] as data + /// Throws [DioException] if API call or serialization fails + Future> cashflowRunway({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/runway'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + RunwayOut? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'RunwayOut', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Spending + /// Expenses of one month by category, largest first. + /// + /// Parameters: + /// * [month] - YYYY-MM; defaults to the latest month + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> cashflowSpending({ + String? month, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/spending/categories'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (month != null) r'month': month, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, SpendingRow>(rawData, 'List', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/app/packages/api_client/lib/src/api/categories_api.dart b/app/packages/api_client/lib/src/api/categories_api.dart new file mode 100644 index 0000000..20126ce --- /dev/null +++ b/app/packages/api_client/lib/src/api/categories_api.dart @@ -0,0 +1,97 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:fintracker_api/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:fintracker_api/src/model/category_out.dart'; +import 'package:fintracker_api/src/model/problem.dart'; + +class CategoriesApi { + + final Dio _dio; + + const CategoriesApi(this._dio); + + /// List + /// Flat list of the ZenMoney tag tree; the client nests it by `parent_id`. + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> categoriesList({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/categories'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, CategoryOut>(rawData, 'List', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/app/packages/api_client/lib/src/api/health_api.dart b/app/packages/api_client/lib/src/api/health_api.dart new file mode 100644 index 0000000..c037b24 --- /dev/null +++ b/app/packages/api_client/lib/src/api/health_api.dart @@ -0,0 +1,91 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:fintracker_api/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:fintracker_api/src/model/health.dart'; +import 'package:fintracker_api/src/model/problem.dart'; + +class HealthApi { + + final Dio _dio; + + const HealthApi(this._dio); + + /// Check + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Health] as data + /// Throws [DioException] if API call or serialization fails + Future> healthCheck({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/health'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Health? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'Health', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/app/packages/api_client/lib/src/api/metrics_api.dart b/app/packages/api_client/lib/src/api/metrics_api.dart new file mode 100644 index 0000000..5fc0ca6 --- /dev/null +++ b/app/packages/api_client/lib/src/api/metrics_api.dart @@ -0,0 +1,250 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:fintracker_api/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:fintracker_api/src/model/data_quality_row.dart'; +import 'package:fintracker_api/src/model/problem.dart'; +import 'package:fintracker_api/src/model/refresh_log_out.dart'; + +class MetricsApi { + + final Dio _dio; + + const MetricsApi(this._dio); + + /// Data Quality + /// Findings of the latest refresh, most serious first. + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> metricsDataQuality({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/data-quality'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, DataQualityRow>(rawData, 'List', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Refresh + /// Rebuild every metric_* table inline (seconds at personal volumes). + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [RefreshLogOut] as data + /// Throws [DioException] if API call or serialization fails + Future> metricsRefresh({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/metrics/refresh'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + RefreshLogOut? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'RefreshLogOut', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Status + /// When the metric tables were last rebuilt, and whether it failed. + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [RefreshLogOut] as data + /// Throws [DioException] if API call or serialization fails + Future> metricsStatus({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/metrics/status'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + RefreshLogOut? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'RefreshLogOut', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/app/packages/api_client/lib/src/api/networth_api.dart b/app/packages/api_client/lib/src/api/networth_api.dart new file mode 100644 index 0000000..e4de10c --- /dev/null +++ b/app/packages/api_client/lib/src/api/networth_api.dart @@ -0,0 +1,184 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:fintracker_api/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:fintracker_api/src/model/net_worth_breakdown.dart'; +import 'package:fintracker_api/src/model/net_worth_day.dart'; +import 'package:fintracker_api/src/model/problem.dart'; + +class NetworthApi { + + final Dio _dio; + + const NetworthApi(this._dio); + + /// Breakdown + /// The latest day's buckets, plus every account's current balance native and in RUB. + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [NetWorthBreakdown] as data + /// Throws [DioException] if API call or serialization fails + Future> networthBreakdown({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/networth/breakdown'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + NetWorthBreakdown? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'NetWorthBreakdown', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Series + /// Daily net worth; defaults to the last 365 days. + /// + /// Parameters: + /// * [from] + /// * [to] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> networthSeries({ + DateTime? from, + DateTime? to, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/networth/series'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (from != null) r'from': from, + if (to != null) r'to': to, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, NetWorthDay>(rawData, 'List', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/app/packages/api_client/lib/src/api/rules_api.dart b/app/packages/api_client/lib/src/api/rules_api.dart new file mode 100644 index 0000000..42050da --- /dev/null +++ b/app/packages/api_client/lib/src/api/rules_api.dart @@ -0,0 +1,501 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:fintracker_api/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:fintracker_api/src/model/problem.dart'; +import 'package:fintracker_api/src/model/refresh_log_out.dart'; +import 'package:fintracker_api/src/model/rule_create.dart'; +import 'package:fintracker_api/src/model/rule_out.dart'; +import 'package:fintracker_api/src/model/rule_patch.dart'; + +class RulesApi { + + final Dio _dio; + + const RulesApi(this._dio); + + /// Apply + /// Re-run the whole metric refresh so edited rules take effect everywhere at once. + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [RefreshLogOut] as data + /// Throws [DioException] if API call or serialization fails + Future> rulesApply({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/rules/apply'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + RefreshLogOut? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'RefreshLogOut', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Create + /// + /// + /// Parameters: + /// * [ruleCreate] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [RuleOut] as data + /// Throws [DioException] if API call or serialization fails + Future> rulesCreate({ + required RuleCreate ruleCreate, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/rules'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = jsonEncode(ruleCreate); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + RuleOut? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'RuleOut', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Delete + /// + /// + /// Parameters: + /// * [ruleId] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> rulesDelete({ + required int ruleId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/rules/{rule_id}'.replaceAll('{' r'rule_id' '}', ruleId.toString()); + final _options = Options( + method: r'DELETE', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// List + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> rulesList({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/rules'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, RuleOut>(rawData, 'List', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Patch + /// + /// + /// Parameters: + /// * [ruleId] + /// * [rulePatch] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [RuleOut] as data + /// Throws [DioException] if API call or serialization fails + Future> rulesPatch({ + required int ruleId, + required RulePatch rulePatch, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/rules/{rule_id}'.replaceAll('{' r'rule_id' '}', ruleId.toString()); + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = jsonEncode(rulePatch); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + RuleOut? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'RuleOut', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Stale + /// Enabled rules that matched nothing in the latest refresh: the payee was renamed, or the transaction was re-categorised in ZenMoney. + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> rulesStale({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/rules/stale'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, RuleOut>(rawData, 'List', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/app/packages/api_client/lib/src/api/sync_api.dart b/app/packages/api_client/lib/src/api/sync_api.dart new file mode 100644 index 0000000..1353836 --- /dev/null +++ b/app/packages/api_client/lib/src/api/sync_api.dart @@ -0,0 +1,263 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:fintracker_api/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:fintracker_api/src/model/problem.dart'; +import 'package:fintracker_api/src/model/source_status.dart'; +import 'package:fintracker_api/src/model/sync_job_out.dart'; +import 'package:fintracker_api/src/model/sync_run_out.dart'; + +class SyncApi { + + final Dio _dio; + + const SyncApi(this._dio); + + /// Runs + /// + /// + /// Parameters: + /// * [source_] + /// * [limit] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> syncRuns({ + String? source_, + int? limit = 20, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/sync/runs'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (source_ != null) r'source': source_, + if (limit != null) r'limit': limit, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, SyncRunOut>(rawData, 'List', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Status + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> syncStatus({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/sync/status'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, SourceStatus>(rawData, 'List', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Trigger + /// + /// + /// Parameters: + /// * [source_] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [SyncJobOut] as data + /// Throws [DioException] if API call or serialization fails + Future> syncTrigger({ + required String source_, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/sync/{source}'.replaceAll('{' r'source' '}', source_.toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + SyncJobOut? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'SyncJobOut', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/app/packages/api_client/lib/src/api/transactions_api.dart b/app/packages/api_client/lib/src/api/transactions_api.dart new file mode 100644 index 0000000..c6dec1a --- /dev/null +++ b/app/packages/api_client/lib/src/api/transactions_api.dart @@ -0,0 +1,129 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:fintracker_api/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:fintracker_api/src/model/flow_type.dart'; +import 'package:fintracker_api/src/model/problem.dart'; +import 'package:fintracker_api/src/model/transaction_page.dart'; + +class TransactionsApi { + + final Dio _dio; + + const TransactionsApi(this._dio); + + /// List + /// One page of transactions, newest first, with RUB amounts at each own date's rate. + /// + /// Parameters: + /// * [from] + /// * [to] + /// * [accountId] + /// * [categoryId] + /// * [flowType] + /// * [q] - substring of payee or comment + /// * [includeDeleted] + /// * [page] + /// * [pageSize] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [TransactionPage] as data + /// Throws [DioException] if API call or serialization fails + Future> transactionsList({ + DateTime? from, + DateTime? to, + int? accountId, + int? categoryId, + FlowType? flowType, + String? q, + bool? includeDeleted = false, + int? page = 1, + int? pageSize = 50, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/api/v1/transactions'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'HTTPBearer', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (from != null) r'from': from, + if (to != null) r'to': to, + if (accountId != null) r'account_id': accountId, + if (categoryId != null) r'category_id': categoryId, + if (flowType != null) r'flow_type': flowType, + if (q != null) r'q': q, + if (includeDeleted != null) r'include_deleted': includeDeleted, + if (page != null) r'page': page, + if (pageSize != null) r'page_size': pageSize, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + TransactionPage? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'TransactionPage', growable: true); + + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/app/packages/api_client/lib/src/auth/api_key_auth.dart b/app/packages/api_client/lib/src/auth/api_key_auth.dart new file mode 100644 index 0000000..a6683ba --- /dev/null +++ b/app/packages/api_client/lib/src/auth/api_key_auth.dart @@ -0,0 +1,30 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + + +import 'package:dio/dio.dart'; +import 'package:fintracker_api/src/auth/auth.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + final Map apiKeys = {}; + + @override + void onRequest(RequestOptions options, RequestInterceptorHandler handler) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'apiKey'); + for (final info in authInfo) { + final authName = info['name'] as String; + final authKeyName = info['keyName'] as String; + final authWhere = info['where'] as String; + final apiKey = apiKeys[authName]; + if (apiKey != null) { + if (authWhere == 'query') { + options.queryParameters[authKeyName] = apiKey; + } else { + options.headers[authKeyName] = apiKey; + } + } + } + super.onRequest(options, handler); + } +} diff --git a/app/packages/api_client/lib/src/auth/auth.dart b/app/packages/api_client/lib/src/auth/auth.dart new file mode 100644 index 0000000..f7ae9bf --- /dev/null +++ b/app/packages/api_client/lib/src/auth/auth.dart @@ -0,0 +1,18 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; + +abstract class AuthInterceptor extends Interceptor { + /// Get auth information on given route for the given type. + /// Can return an empty list if type is not present on auth data or + /// if route doesn't need authentication. + List> getAuthInfo(RequestOptions route, bool Function(Map secure) handles) { + if (route.extra.containsKey('secure')) { + final auth = route.extra['secure'] as List>; + return auth.where((secure) => handles(secure)).toList(); + } + return []; + } +} diff --git a/app/packages/api_client/lib/src/auth/basic_auth.dart b/app/packages/api_client/lib/src/auth/basic_auth.dart new file mode 100644 index 0000000..465840c --- /dev/null +++ b/app/packages/api_client/lib/src/auth/basic_auth.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:fintracker_api/src/auth/auth.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); +} + +class BasicAuthInterceptor extends AuthInterceptor { + final Map authInfo = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final metadataAuthInfo = getAuthInfo(options, (secure) => (secure['type'] == 'http' && secure['scheme']?.toLowerCase() == 'basic') || secure['type'] == 'basic'); + for (final info in metadataAuthInfo) { + final authName = info['name'] as String; + final basicAuthInfo = authInfo[authName]; + if (basicAuthInfo != null) { + final basicAuth = 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}'; + options.headers['Authorization'] = basicAuth; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/app/packages/api_client/lib/src/auth/bearer_auth.dart b/app/packages/api_client/lib/src/auth/bearer_auth.dart new file mode 100644 index 0000000..572b426 --- /dev/null +++ b/app/packages/api_client/lib/src/auth/bearer_auth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:fintracker_api/src/auth/auth.dart'; + +class BearerAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme']?.toLowerCase() == 'bearer'); + for (final info in authInfo) { + final token = tokens[info['name']]; + if (token != null) { + options.headers['Authorization'] = 'Bearer ${token}'; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/app/packages/api_client/lib/src/auth/oauth.dart b/app/packages/api_client/lib/src/auth/oauth.dart new file mode 100644 index 0000000..0a4f803 --- /dev/null +++ b/app/packages/api_client/lib/src/auth/oauth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:fintracker_api/src/auth/auth.dart'; + +class OAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2'); + for (final info in authInfo) { + final token = tokens[info['name']]; + if (token != null) { + options.headers['Authorization'] = 'Bearer ${token}'; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/app/packages/api_client/lib/src/deserialize.dart b/app/packages/api_client/lib/src/deserialize.dart new file mode 100644 index 0000000..cd2f9b2 --- /dev/null +++ b/app/packages/api_client/lib/src/deserialize.dart @@ -0,0 +1,147 @@ +import 'package:fintracker_api/src/model/account_balance.dart'; +import 'package:fintracker_api/src/model/account_out.dart'; +import 'package:fintracker_api/src/model/account_patch.dart'; +import 'package:fintracker_api/src/model/cash_flow_month.dart'; +import 'package:fintracker_api/src/model/category_out.dart'; +import 'package:fintracker_api/src/model/data_quality_row.dart'; +import 'package:fintracker_api/src/model/health.dart'; +import 'package:fintracker_api/src/model/login_request.dart'; +import 'package:fintracker_api/src/model/net_worth_breakdown.dart'; +import 'package:fintracker_api/src/model/net_worth_day.dart'; +import 'package:fintracker_api/src/model/problem.dart'; +import 'package:fintracker_api/src/model/refresh_log_out.dart'; +import 'package:fintracker_api/src/model/refresh_request.dart'; +import 'package:fintracker_api/src/model/rule_create.dart'; +import 'package:fintracker_api/src/model/rule_out.dart'; +import 'package:fintracker_api/src/model/rule_patch.dart'; +import 'package:fintracker_api/src/model/runway_out.dart'; +import 'package:fintracker_api/src/model/source_status.dart'; +import 'package:fintracker_api/src/model/spending_row.dart'; +import 'package:fintracker_api/src/model/sync_job_out.dart'; +import 'package:fintracker_api/src/model/sync_run_out.dart'; +import 'package:fintracker_api/src/model/token_pair.dart'; +import 'package:fintracker_api/src/model/transaction_out.dart'; +import 'package:fintracker_api/src/model/transaction_page.dart'; +import 'package:fintracker_api/src/model/user_out.dart'; + +final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + + ReturnType deserialize(dynamic value, String targetType, {bool growable= true}) { + switch (targetType) { + case 'String': + return '$value' as ReturnType; + case 'int': + return (value is int ? value : int.parse('$value')) as ReturnType; + case 'bool': + if (value is bool) { + return value as ReturnType; + } + final valueString = '$value'.toLowerCase(); + return (valueString == 'true' || valueString == '1') as ReturnType; + case 'double': + return (value is double ? value : double.parse('$value')) as ReturnType; + case 'AccountBalance': + return AccountBalance.fromJson(value as Map) as ReturnType; + case 'AccountKind': + + + case 'AccountOut': + return AccountOut.fromJson(value as Map) as ReturnType; + case 'AccountPatch': + return AccountPatch.fromJson(value as Map) as ReturnType; + case 'AccountRole': + + + case 'Broker': + + + case 'CashFlowMonth': + return CashFlowMonth.fromJson(value as Map) as ReturnType; + case 'CategoryOut': + return CategoryOut.fromJson(value as Map) as ReturnType; + case 'DataQualityRow': + return DataQualityRow.fromJson(value as Map) as ReturnType; + case 'EventSource': + + + case 'FlowType': + + + case 'Health': + return Health.fromJson(value as Map) as ReturnType; + case 'JobStatus': + + + case 'LoginRequest': + return LoginRequest.fromJson(value as Map) as ReturnType; + case 'NetWorthBreakdown': + return NetWorthBreakdown.fromJson(value as Map) as ReturnType; + case 'NetWorthDay': + return NetWorthDay.fromJson(value as Map) as ReturnType; + case 'Problem': + return Problem.fromJson(value as Map) as ReturnType; + case 'RefreshLogOut': + return RefreshLogOut.fromJson(value as Map) as ReturnType; + case 'RefreshRequest': + return RefreshRequest.fromJson(value as Map) as ReturnType; + case 'RuleCreate': + return RuleCreate.fromJson(value as Map) as ReturnType; + case 'RuleKind': + + + case 'RuleMatchType': + + + case 'RuleOut': + return RuleOut.fromJson(value as Map) as ReturnType; + case 'RulePatch': + return RulePatch.fromJson(value as Map) as ReturnType; + case 'RunStatus': + + + case 'RunwayOut': + return RunwayOut.fromJson(value as Map) as ReturnType; + case 'SourceStatus': + return SourceStatus.fromJson(value as Map) as ReturnType; + case 'SpendingRow': + return SpendingRow.fromJson(value as Map) as ReturnType; + case 'SyncJobOut': + return SyncJobOut.fromJson(value as Map) as ReturnType; + case 'SyncRunOut': + return SyncRunOut.fromJson(value as Map) as ReturnType; + case 'TokenPair': + return TokenPair.fromJson(value as Map) as ReturnType; + case 'TransactionOut': + return TransactionOut.fromJson(value as Map) as ReturnType; + case 'TransactionPage': + return TransactionPage.fromJson(value as Map) as ReturnType; + case 'UserOut': + return UserOut.fromJson(value as Map) as ReturnType; + default: + RegExpMatch? match; + + if (value is List && (match = _regList.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return value + .map((dynamic v) => deserialize(v, targetType, growable: growable)) + .toList(growable: growable) as ReturnType; + } + if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return value + .map((dynamic v) => deserialize(v, targetType, growable: growable)) + .toSet() as ReturnType; + } + if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { + targetType = match![1]!.trim(); // ignore: parameter_assignments + return Map.fromIterables( + value.keys as Iterable, + value.values.map((dynamic v) => deserialize(v, targetType, growable: growable)), + ) as ReturnType; + } + break; + } + throw Exception('Cannot deserialize'); + } \ No newline at end of file diff --git a/app/packages/api_client/lib/src/model/account_balance.dart b/app/packages/api_client/lib/src/model/account_balance.dart new file mode 100644 index 0000000..08a9e2b --- /dev/null +++ b/app/packages/api_client/lib/src/model/account_balance.dart @@ -0,0 +1,142 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/account_role.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'account_balance.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AccountBalance { + /// Returns a new [AccountBalance] instance. + AccountBalance({ + + required this.accountId, + + required this.balance, + + required this.balanceRub, + + required this.currency, + + required this.name, + + required this.role, + }); + + @JsonKey( + + name: r'account_id', + required: true, + includeIfNull: false, + ) + + + final int accountId; + + + + /// decimal as string + @JsonKey( + + name: r'balance', + required: true, + includeIfNull: false, + ) + + + final String balance; + + + + /// decimal as string + @JsonKey( + + name: r'balance_rub', + required: true, + includeIfNull: true, + ) + + + final String? balanceRub; + + + + @JsonKey( + + name: r'currency', + required: true, + includeIfNull: false, + ) + + + final String currency; + + + + @JsonKey( + + name: r'name', + required: true, + includeIfNull: false, + ) + + + final String name; + + + + @JsonKey( + + name: r'role', + required: true, + includeIfNull: false, + unknownEnumValue: AccountRole.unknownDefaultOpenApi, + ) + + + final AccountRole role; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is AccountBalance && + other.accountId == accountId && + other.balance == balance && + other.balanceRub == balanceRub && + other.currency == currency && + other.name == name && + other.role == role; + + @override + int get hashCode => + accountId.hashCode + + balance.hashCode + + (balanceRub == null ? 0 : balanceRub.hashCode) + + currency.hashCode + + name.hashCode + + role.hashCode; + + factory AccountBalance.fromJson(Map json) => _$AccountBalanceFromJson(json); + + Map toJson() => _$AccountBalanceToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/account_balance.g.dart b/app/packages/api_client/lib/src/model/account_balance.g.dart new file mode 100644 index 0000000..b57e107 --- /dev/null +++ b/app/packages/api_client/lib/src/model/account_balance.g.dart @@ -0,0 +1,171 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'account_balance.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$AccountBalanceCWProxy { + AccountBalance accountId(int accountId); + + AccountBalance balance(String balance); + + AccountBalance balanceRub(String? balanceRub); + + AccountBalance currency(String currency); + + AccountBalance name(String name); + + AccountBalance role(AccountRole role); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `AccountBalance(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// AccountBalance(...).copyWith(id: 12, name: "My name") + /// ```` + AccountBalance call({ + int accountId, + String balance, + String? balanceRub, + String currency, + String name, + AccountRole role, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfAccountBalance.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfAccountBalance.copyWith.fieldName(...)` +class _$AccountBalanceCWProxyImpl implements _$AccountBalanceCWProxy { + const _$AccountBalanceCWProxyImpl(this._value); + + final AccountBalance _value; + + @override + AccountBalance accountId(int accountId) => this(accountId: accountId); + + @override + AccountBalance balance(String balance) => this(balance: balance); + + @override + AccountBalance balanceRub(String? balanceRub) => this(balanceRub: balanceRub); + + @override + AccountBalance currency(String currency) => this(currency: currency); + + @override + AccountBalance name(String name) => this(name: name); + + @override + AccountBalance role(AccountRole role) => this(role: role); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `AccountBalance(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// AccountBalance(...).copyWith(id: 12, name: "My name") + /// ```` + AccountBalance call({ + Object? accountId = const $CopyWithPlaceholder(), + Object? balance = const $CopyWithPlaceholder(), + Object? balanceRub = const $CopyWithPlaceholder(), + Object? currency = const $CopyWithPlaceholder(), + Object? name = const $CopyWithPlaceholder(), + Object? role = const $CopyWithPlaceholder(), + }) { + return AccountBalance( + accountId: accountId == const $CopyWithPlaceholder() + ? _value.accountId + // ignore: cast_nullable_to_non_nullable + : accountId as int, + balance: balance == const $CopyWithPlaceholder() + ? _value.balance + // ignore: cast_nullable_to_non_nullable + : balance as String, + balanceRub: balanceRub == const $CopyWithPlaceholder() + ? _value.balanceRub + // ignore: cast_nullable_to_non_nullable + : balanceRub as String?, + currency: currency == const $CopyWithPlaceholder() + ? _value.currency + // ignore: cast_nullable_to_non_nullable + : currency as String, + name: name == const $CopyWithPlaceholder() + ? _value.name + // ignore: cast_nullable_to_non_nullable + : name as String, + role: role == const $CopyWithPlaceholder() + ? _value.role + // ignore: cast_nullable_to_non_nullable + : role as AccountRole, + ); + } +} + +extension $AccountBalanceCopyWith on AccountBalance { + /// Returns a callable class that can be used as follows: `instanceOfAccountBalance.copyWith(...)` or like so:`instanceOfAccountBalance.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$AccountBalanceCWProxy get copyWith => _$AccountBalanceCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AccountBalance _$AccountBalanceFromJson(Map json) => + $checkedCreate( + 'AccountBalance', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'account_id', + 'balance', + 'balance_rub', + 'currency', + 'name', + 'role', + ], + ); + final val = AccountBalance( + accountId: $checkedConvert('account_id', (v) => (v as num).toInt()), + balance: $checkedConvert('balance', (v) => v as String), + balanceRub: $checkedConvert('balance_rub', (v) => v as String?), + currency: $checkedConvert('currency', (v) => v as String), + name: $checkedConvert('name', (v) => v as String), + role: $checkedConvert( + 'role', + (v) => $enumDecode( + _$AccountRoleEnumMap, + v, + unknownValue: AccountRole.unknownDefaultOpenApi, + ), + ), + ); + return val; + }, + fieldKeyMap: const { + 'accountId': 'account_id', + 'balanceRub': 'balance_rub', + }, + ); + +Map _$AccountBalanceToJson(AccountBalance instance) => + { + 'account_id': instance.accountId, + 'balance': instance.balance, + 'balance_rub': instance.balanceRub, + 'currency': instance.currency, + 'name': instance.name, + 'role': _$AccountRoleEnumMap[instance.role]!, + }; + +const _$AccountRoleEnumMap = { + AccountRole.liquid: 'liquid', + AccountRole.savings: 'savings', + AccountRole.investment: 'investment', + AccountRole.debt: 'debt', + AccountRole.unknownDefaultOpenApi: 'unknown_default_open_api', +}; diff --git a/app/packages/api_client/lib/src/model/account_kind.dart b/app/packages/api_client/lib/src/model/account_kind.dart new file mode 100644 index 0000000..c91a372 --- /dev/null +++ b/app/packages/api_client/lib/src/model/account_kind.dart @@ -0,0 +1,36 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum AccountKind { + @JsonValue(r'zm_cash') + zmCash(r'zm_cash'), + @JsonValue(r'zm_card') + zmCard(r'zm_card'), + @JsonValue(r'zm_checking') + zmChecking(r'zm_checking'), + @JsonValue(r'zm_deposit') + zmDeposit(r'zm_deposit'), + @JsonValue(r'zm_loan') + zmLoan(r'zm_loan'), + @JsonValue(r'zm_emoney') + zmEmoney(r'zm_emoney'), + @JsonValue(r'zm_debt') + zmDebt(r'zm_debt'), + @JsonValue(r'broker') + broker(r'broker'), + @JsonValue(r'manual_asset') + manualAsset(r'manual_asset'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const AccountKind(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/app/packages/api_client/lib/src/model/account_out.dart b/app/packages/api_client/lib/src/model/account_out.dart new file mode 100644 index 0000000..55e34d8 --- /dev/null +++ b/app/packages/api_client/lib/src/model/account_out.dart @@ -0,0 +1,325 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/event_source.dart'; +import 'package:fintracker_api/src/model/account_role.dart'; +import 'package:fintracker_api/src/model/account_kind.dart'; +import 'package:fintracker_api/src/model/broker.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'account_out.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AccountOut { + /// Returns a new [AccountOut] instance. + AccountOut({ + + required this.archived, + + required this.balance, + + required this.balanceAsOf, + + required this.broker, + + required this.creditLimit, + + required this.currency, + + required this.id, + + required this.includeInNetWorth, + + required this.kind, + + required this.mirrorOfAccountId, + + required this.name, + + required this.openedAt, + + required this.primaryEventSource, + + required this.role, + + required this.source_, + + required this.sourceId, + + required this.startBalance, + }); + + @JsonKey( + + name: r'archived', + required: true, + includeIfNull: false, + ) + + + final bool archived; + + + + /// decimal as string + @JsonKey( + + name: r'balance', + required: true, + includeIfNull: true, + ) + + + final String? balance; + + + + @JsonKey( + + name: r'balance_as_of', + required: true, + includeIfNull: true, + ) + + + final DateTime? balanceAsOf; + + + + @JsonKey( + + name: r'broker', + required: true, + includeIfNull: true, + unknownEnumValue: Broker.unknownDefaultOpenApi, + ) + + + final Broker? broker; + + + + /// decimal as string + @JsonKey( + + name: r'credit_limit', + required: true, + includeIfNull: true, + ) + + + final String? creditLimit; + + + + @JsonKey( + + name: r'currency', + required: true, + includeIfNull: false, + ) + + + final String currency; + + + + @JsonKey( + + name: r'id', + required: true, + includeIfNull: false, + ) + + + final int id; + + + + @JsonKey( + + name: r'include_in_net_worth', + required: true, + includeIfNull: false, + ) + + + final bool includeInNetWorth; + + + + @JsonKey( + + name: r'kind', + required: true, + includeIfNull: false, + unknownEnumValue: AccountKind.unknownDefaultOpenApi, + ) + + + final AccountKind kind; + + + + @JsonKey( + + name: r'mirror_of_account_id', + required: true, + includeIfNull: true, + ) + + + final int? mirrorOfAccountId; + + + + @JsonKey( + + name: r'name', + required: true, + includeIfNull: false, + ) + + + final String name; + + + + @JsonKey( + + name: r'opened_at', + required: true, + includeIfNull: true, + ) + + + final DateTime? openedAt; + + + + @JsonKey( + + name: r'primary_event_source', + required: true, + includeIfNull: true, + unknownEnumValue: EventSource.unknownDefaultOpenApi, + ) + + + final EventSource? primaryEventSource; + + + + @JsonKey( + + name: r'role', + required: true, + includeIfNull: false, + unknownEnumValue: AccountRole.unknownDefaultOpenApi, + ) + + + final AccountRole role; + + + + @JsonKey( + + name: r'source', + required: true, + includeIfNull: false, + ) + + + final String source_; + + + + @JsonKey( + + name: r'source_id', + required: true, + includeIfNull: false, + ) + + + final String sourceId; + + + + /// decimal as string + @JsonKey( + + name: r'start_balance', + required: true, + includeIfNull: true, + ) + + + final String? startBalance; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is AccountOut && + other.archived == archived && + other.balance == balance && + other.balanceAsOf == balanceAsOf && + other.broker == broker && + other.creditLimit == creditLimit && + other.currency == currency && + other.id == id && + other.includeInNetWorth == includeInNetWorth && + other.kind == kind && + other.mirrorOfAccountId == mirrorOfAccountId && + other.name == name && + other.openedAt == openedAt && + other.primaryEventSource == primaryEventSource && + other.role == role && + other.source_ == source_ && + other.sourceId == sourceId && + other.startBalance == startBalance; + + @override + int get hashCode => + archived.hashCode + + (balance == null ? 0 : balance.hashCode) + + (balanceAsOf == null ? 0 : balanceAsOf.hashCode) + + (broker == null ? 0 : broker.hashCode) + + (creditLimit == null ? 0 : creditLimit.hashCode) + + currency.hashCode + + id.hashCode + + includeInNetWorth.hashCode + + kind.hashCode + + (mirrorOfAccountId == null ? 0 : mirrorOfAccountId.hashCode) + + name.hashCode + + (openedAt == null ? 0 : openedAt.hashCode) + + (primaryEventSource == null ? 0 : primaryEventSource.hashCode) + + role.hashCode + + source_.hashCode + + sourceId.hashCode + + (startBalance == null ? 0 : startBalance.hashCode); + + factory AccountOut.fromJson(Map json) => _$AccountOutFromJson(json); + + Map toJson() => _$AccountOutToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/account_out.g.dart b/app/packages/api_client/lib/src/model/account_out.g.dart new file mode 100644 index 0000000..f35137d --- /dev/null +++ b/app/packages/api_client/lib/src/model/account_out.g.dart @@ -0,0 +1,398 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'account_out.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$AccountOutCWProxy { + AccountOut archived(bool archived); + + AccountOut balance(String? balance); + + AccountOut balanceAsOf(DateTime? balanceAsOf); + + AccountOut broker(Broker? broker); + + AccountOut creditLimit(String? creditLimit); + + AccountOut currency(String currency); + + AccountOut id(int id); + + AccountOut includeInNetWorth(bool includeInNetWorth); + + AccountOut kind(AccountKind kind); + + AccountOut mirrorOfAccountId(int? mirrorOfAccountId); + + AccountOut name(String name); + + AccountOut openedAt(DateTime? openedAt); + + AccountOut primaryEventSource(EventSource? primaryEventSource); + + AccountOut role(AccountRole role); + + AccountOut source_(String source_); + + AccountOut sourceId(String sourceId); + + AccountOut startBalance(String? startBalance); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `AccountOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// AccountOut(...).copyWith(id: 12, name: "My name") + /// ```` + AccountOut call({ + bool archived, + String? balance, + DateTime? balanceAsOf, + Broker? broker, + String? creditLimit, + String currency, + int id, + bool includeInNetWorth, + AccountKind kind, + int? mirrorOfAccountId, + String name, + DateTime? openedAt, + EventSource? primaryEventSource, + AccountRole role, + String source_, + String sourceId, + String? startBalance, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfAccountOut.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfAccountOut.copyWith.fieldName(...)` +class _$AccountOutCWProxyImpl implements _$AccountOutCWProxy { + const _$AccountOutCWProxyImpl(this._value); + + final AccountOut _value; + + @override + AccountOut archived(bool archived) => this(archived: archived); + + @override + AccountOut balance(String? balance) => this(balance: balance); + + @override + AccountOut balanceAsOf(DateTime? balanceAsOf) => + this(balanceAsOf: balanceAsOf); + + @override + AccountOut broker(Broker? broker) => this(broker: broker); + + @override + AccountOut creditLimit(String? creditLimit) => this(creditLimit: creditLimit); + + @override + AccountOut currency(String currency) => this(currency: currency); + + @override + AccountOut id(int id) => this(id: id); + + @override + AccountOut includeInNetWorth(bool includeInNetWorth) => + this(includeInNetWorth: includeInNetWorth); + + @override + AccountOut kind(AccountKind kind) => this(kind: kind); + + @override + AccountOut mirrorOfAccountId(int? mirrorOfAccountId) => + this(mirrorOfAccountId: mirrorOfAccountId); + + @override + AccountOut name(String name) => this(name: name); + + @override + AccountOut openedAt(DateTime? openedAt) => this(openedAt: openedAt); + + @override + AccountOut primaryEventSource(EventSource? primaryEventSource) => + this(primaryEventSource: primaryEventSource); + + @override + AccountOut role(AccountRole role) => this(role: role); + + @override + AccountOut source_(String source_) => this(source_: source_); + + @override + AccountOut sourceId(String sourceId) => this(sourceId: sourceId); + + @override + AccountOut startBalance(String? startBalance) => + this(startBalance: startBalance); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `AccountOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// AccountOut(...).copyWith(id: 12, name: "My name") + /// ```` + AccountOut call({ + Object? archived = const $CopyWithPlaceholder(), + Object? balance = const $CopyWithPlaceholder(), + Object? balanceAsOf = const $CopyWithPlaceholder(), + Object? broker = const $CopyWithPlaceholder(), + Object? creditLimit = const $CopyWithPlaceholder(), + Object? currency = const $CopyWithPlaceholder(), + Object? id = const $CopyWithPlaceholder(), + Object? includeInNetWorth = const $CopyWithPlaceholder(), + Object? kind = const $CopyWithPlaceholder(), + Object? mirrorOfAccountId = const $CopyWithPlaceholder(), + Object? name = const $CopyWithPlaceholder(), + Object? openedAt = const $CopyWithPlaceholder(), + Object? primaryEventSource = const $CopyWithPlaceholder(), + Object? role = const $CopyWithPlaceholder(), + Object? source_ = const $CopyWithPlaceholder(), + Object? sourceId = const $CopyWithPlaceholder(), + Object? startBalance = const $CopyWithPlaceholder(), + }) { + return AccountOut( + archived: archived == const $CopyWithPlaceholder() + ? _value.archived + // ignore: cast_nullable_to_non_nullable + : archived as bool, + balance: balance == const $CopyWithPlaceholder() + ? _value.balance + // ignore: cast_nullable_to_non_nullable + : balance as String?, + balanceAsOf: balanceAsOf == const $CopyWithPlaceholder() + ? _value.balanceAsOf + // ignore: cast_nullable_to_non_nullable + : balanceAsOf as DateTime?, + broker: broker == const $CopyWithPlaceholder() + ? _value.broker + // ignore: cast_nullable_to_non_nullable + : broker as Broker?, + creditLimit: creditLimit == const $CopyWithPlaceholder() + ? _value.creditLimit + // ignore: cast_nullable_to_non_nullable + : creditLimit as String?, + currency: currency == const $CopyWithPlaceholder() + ? _value.currency + // ignore: cast_nullable_to_non_nullable + : currency as String, + id: id == const $CopyWithPlaceholder() + ? _value.id + // ignore: cast_nullable_to_non_nullable + : id as int, + includeInNetWorth: includeInNetWorth == const $CopyWithPlaceholder() + ? _value.includeInNetWorth + // ignore: cast_nullable_to_non_nullable + : includeInNetWorth as bool, + kind: kind == const $CopyWithPlaceholder() + ? _value.kind + // ignore: cast_nullable_to_non_nullable + : kind as AccountKind, + mirrorOfAccountId: mirrorOfAccountId == const $CopyWithPlaceholder() + ? _value.mirrorOfAccountId + // ignore: cast_nullable_to_non_nullable + : mirrorOfAccountId as int?, + name: name == const $CopyWithPlaceholder() + ? _value.name + // ignore: cast_nullable_to_non_nullable + : name as String, + openedAt: openedAt == const $CopyWithPlaceholder() + ? _value.openedAt + // ignore: cast_nullable_to_non_nullable + : openedAt as DateTime?, + primaryEventSource: primaryEventSource == const $CopyWithPlaceholder() + ? _value.primaryEventSource + // ignore: cast_nullable_to_non_nullable + : primaryEventSource as EventSource?, + role: role == const $CopyWithPlaceholder() + ? _value.role + // ignore: cast_nullable_to_non_nullable + : role as AccountRole, + source_: source_ == const $CopyWithPlaceholder() + ? _value.source_ + // ignore: cast_nullable_to_non_nullable + : source_ as String, + sourceId: sourceId == const $CopyWithPlaceholder() + ? _value.sourceId + // ignore: cast_nullable_to_non_nullable + : sourceId as String, + startBalance: startBalance == const $CopyWithPlaceholder() + ? _value.startBalance + // ignore: cast_nullable_to_non_nullable + : startBalance as String?, + ); + } +} + +extension $AccountOutCopyWith on AccountOut { + /// Returns a callable class that can be used as follows: `instanceOfAccountOut.copyWith(...)` or like so:`instanceOfAccountOut.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$AccountOutCWProxy get copyWith => _$AccountOutCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AccountOut _$AccountOutFromJson(Map json) => $checkedCreate( + 'AccountOut', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'archived', + 'balance', + 'balance_as_of', + 'broker', + 'credit_limit', + 'currency', + 'id', + 'include_in_net_worth', + 'kind', + 'mirror_of_account_id', + 'name', + 'opened_at', + 'primary_event_source', + 'role', + 'source', + 'source_id', + 'start_balance', + ], + ); + final val = AccountOut( + archived: $checkedConvert('archived', (v) => v as bool), + balance: $checkedConvert('balance', (v) => v as String?), + balanceAsOf: $checkedConvert( + 'balance_as_of', + (v) => v == null ? null : DateTime.parse(v as String), + ), + broker: $checkedConvert( + 'broker', + (v) => $enumDecodeNullable( + _$BrokerEnumMap, + v, + unknownValue: Broker.unknownDefaultOpenApi, + ), + ), + creditLimit: $checkedConvert('credit_limit', (v) => v as String?), + currency: $checkedConvert('currency', (v) => v as String), + id: $checkedConvert('id', (v) => (v as num).toInt()), + includeInNetWorth: $checkedConvert( + 'include_in_net_worth', + (v) => v as bool, + ), + kind: $checkedConvert( + 'kind', + (v) => $enumDecode( + _$AccountKindEnumMap, + v, + unknownValue: AccountKind.unknownDefaultOpenApi, + ), + ), + mirrorOfAccountId: $checkedConvert( + 'mirror_of_account_id', + (v) => (v as num?)?.toInt(), + ), + name: $checkedConvert('name', (v) => v as String), + openedAt: $checkedConvert( + 'opened_at', + (v) => v == null ? null : DateTime.parse(v as String), + ), + primaryEventSource: $checkedConvert( + 'primary_event_source', + (v) => $enumDecodeNullable( + _$EventSourceEnumMap, + v, + unknownValue: EventSource.unknownDefaultOpenApi, + ), + ), + role: $checkedConvert( + 'role', + (v) => $enumDecode( + _$AccountRoleEnumMap, + v, + unknownValue: AccountRole.unknownDefaultOpenApi, + ), + ), + source_: $checkedConvert('source', (v) => v as String), + sourceId: $checkedConvert('source_id', (v) => v as String), + startBalance: $checkedConvert('start_balance', (v) => v as String?), + ); + return val; + }, + fieldKeyMap: const { + 'balanceAsOf': 'balance_as_of', + 'creditLimit': 'credit_limit', + 'includeInNetWorth': 'include_in_net_worth', + 'mirrorOfAccountId': 'mirror_of_account_id', + 'openedAt': 'opened_at', + 'primaryEventSource': 'primary_event_source', + 'source_': 'source', + 'sourceId': 'source_id', + 'startBalance': 'start_balance', + }, +); + +Map _$AccountOutToJson(AccountOut instance) => + { + 'archived': instance.archived, + 'balance': instance.balance, + 'balance_as_of': instance.balanceAsOf?.toIso8601String(), + 'broker': _$BrokerEnumMap[instance.broker], + 'credit_limit': instance.creditLimit, + 'currency': instance.currency, + 'id': instance.id, + 'include_in_net_worth': instance.includeInNetWorth, + 'kind': _$AccountKindEnumMap[instance.kind]!, + 'mirror_of_account_id': instance.mirrorOfAccountId, + 'name': instance.name, + 'opened_at': instance.openedAt?.toIso8601String(), + 'primary_event_source': _$EventSourceEnumMap[instance.primaryEventSource], + 'role': _$AccountRoleEnumMap[instance.role]!, + 'source': instance.source_, + 'source_id': instance.sourceId, + 'start_balance': instance.startBalance, + }; + +const _$BrokerEnumMap = { + Broker.tinvest: 'tinvest', + Broker.sber: 'sber', + Broker.vtb: 'vtb', + Broker.other: 'other', + Broker.unknownDefaultOpenApi: 'unknown_default_open_api', +}; + +const _$AccountKindEnumMap = { + AccountKind.zmCash: 'zm_cash', + AccountKind.zmCard: 'zm_card', + AccountKind.zmChecking: 'zm_checking', + AccountKind.zmDeposit: 'zm_deposit', + AccountKind.zmLoan: 'zm_loan', + AccountKind.zmEmoney: 'zm_emoney', + AccountKind.zmDebt: 'zm_debt', + AccountKind.broker: 'broker', + AccountKind.manualAsset: 'manual_asset', + AccountKind.unknownDefaultOpenApi: 'unknown_default_open_api', +}; + +const _$EventSourceEnumMap = { + EventSource.tinvestApi: 'tinvest_api', + EventSource.reportSber: 'report_sber', + EventSource.reportVtb: 'report_vtb', + EventSource.manual: 'manual', + EventSource.unknownDefaultOpenApi: 'unknown_default_open_api', +}; + +const _$AccountRoleEnumMap = { + AccountRole.liquid: 'liquid', + AccountRole.savings: 'savings', + AccountRole.investment: 'investment', + AccountRole.debt: 'debt', + AccountRole.unknownDefaultOpenApi: 'unknown_default_open_api', +}; diff --git a/app/packages/api_client/lib/src/model/account_patch.dart b/app/packages/api_client/lib/src/model/account_patch.dart new file mode 100644 index 0000000..a7c9659 --- /dev/null +++ b/app/packages/api_client/lib/src/model/account_patch.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/event_source.dart'; +import 'package:fintracker_api/src/model/account_role.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'account_patch.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AccountPatch { + /// Returns a new [AccountPatch] instance. + AccountPatch({ + + this.includeInNetWorth, + + this.mirrorOfAccountId, + + this.name, + + this.primaryEventSource, + + this.role, + }); + + @JsonKey( + + name: r'include_in_net_worth', + required: false, + includeIfNull: false, + ) + + + final bool? includeInNetWorth; + + + + @JsonKey( + + name: r'mirror_of_account_id', + required: false, + includeIfNull: false, + ) + + + final int? mirrorOfAccountId; + + + + @JsonKey( + + name: r'name', + required: false, + includeIfNull: false, + ) + + + final String? name; + + + + @JsonKey( + + name: r'primary_event_source', + required: false, + includeIfNull: false, + unknownEnumValue: EventSource.unknownDefaultOpenApi, + ) + + + final EventSource? primaryEventSource; + + + + @JsonKey( + + name: r'role', + required: false, + includeIfNull: false, + unknownEnumValue: AccountRole.unknownDefaultOpenApi, + ) + + + final AccountRole? role; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is AccountPatch && + other.includeInNetWorth == includeInNetWorth && + other.mirrorOfAccountId == mirrorOfAccountId && + other.name == name && + other.primaryEventSource == primaryEventSource && + other.role == role; + + @override + int get hashCode => + (includeInNetWorth == null ? 0 : includeInNetWorth.hashCode) + + (mirrorOfAccountId == null ? 0 : mirrorOfAccountId.hashCode) + + (name == null ? 0 : name.hashCode) + + (primaryEventSource == null ? 0 : primaryEventSource.hashCode) + + (role == null ? 0 : role.hashCode); + + factory AccountPatch.fromJson(Map json) => _$AccountPatchFromJson(json); + + Map toJson() => _$AccountPatchToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/account_patch.g.dart b/app/packages/api_client/lib/src/model/account_patch.g.dart new file mode 100644 index 0000000..9d2d13d --- /dev/null +++ b/app/packages/api_client/lib/src/model/account_patch.g.dart @@ -0,0 +1,173 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'account_patch.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$AccountPatchCWProxy { + AccountPatch includeInNetWorth(bool? includeInNetWorth); + + AccountPatch mirrorOfAccountId(int? mirrorOfAccountId); + + AccountPatch name(String? name); + + AccountPatch primaryEventSource(EventSource? primaryEventSource); + + AccountPatch role(AccountRole? role); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `AccountPatch(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// AccountPatch(...).copyWith(id: 12, name: "My name") + /// ```` + AccountPatch call({ + bool? includeInNetWorth, + int? mirrorOfAccountId, + String? name, + EventSource? primaryEventSource, + AccountRole? role, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfAccountPatch.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfAccountPatch.copyWith.fieldName(...)` +class _$AccountPatchCWProxyImpl implements _$AccountPatchCWProxy { + const _$AccountPatchCWProxyImpl(this._value); + + final AccountPatch _value; + + @override + AccountPatch includeInNetWorth(bool? includeInNetWorth) => + this(includeInNetWorth: includeInNetWorth); + + @override + AccountPatch mirrorOfAccountId(int? mirrorOfAccountId) => + this(mirrorOfAccountId: mirrorOfAccountId); + + @override + AccountPatch name(String? name) => this(name: name); + + @override + AccountPatch primaryEventSource(EventSource? primaryEventSource) => + this(primaryEventSource: primaryEventSource); + + @override + AccountPatch role(AccountRole? role) => this(role: role); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `AccountPatch(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// AccountPatch(...).copyWith(id: 12, name: "My name") + /// ```` + AccountPatch call({ + Object? includeInNetWorth = const $CopyWithPlaceholder(), + Object? mirrorOfAccountId = const $CopyWithPlaceholder(), + Object? name = const $CopyWithPlaceholder(), + Object? primaryEventSource = const $CopyWithPlaceholder(), + Object? role = const $CopyWithPlaceholder(), + }) { + return AccountPatch( + includeInNetWorth: includeInNetWorth == const $CopyWithPlaceholder() + ? _value.includeInNetWorth + // ignore: cast_nullable_to_non_nullable + : includeInNetWorth as bool?, + mirrorOfAccountId: mirrorOfAccountId == const $CopyWithPlaceholder() + ? _value.mirrorOfAccountId + // ignore: cast_nullable_to_non_nullable + : mirrorOfAccountId as int?, + name: name == const $CopyWithPlaceholder() + ? _value.name + // ignore: cast_nullable_to_non_nullable + : name as String?, + primaryEventSource: primaryEventSource == const $CopyWithPlaceholder() + ? _value.primaryEventSource + // ignore: cast_nullable_to_non_nullable + : primaryEventSource as EventSource?, + role: role == const $CopyWithPlaceholder() + ? _value.role + // ignore: cast_nullable_to_non_nullable + : role as AccountRole?, + ); + } +} + +extension $AccountPatchCopyWith on AccountPatch { + /// Returns a callable class that can be used as follows: `instanceOfAccountPatch.copyWith(...)` or like so:`instanceOfAccountPatch.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$AccountPatchCWProxy get copyWith => _$AccountPatchCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AccountPatch _$AccountPatchFromJson(Map json) => + $checkedCreate( + 'AccountPatch', + json, + ($checkedConvert) { + final val = AccountPatch( + includeInNetWorth: $checkedConvert( + 'include_in_net_worth', + (v) => v as bool?, + ), + mirrorOfAccountId: $checkedConvert( + 'mirror_of_account_id', + (v) => (v as num?)?.toInt(), + ), + name: $checkedConvert('name', (v) => v as String?), + primaryEventSource: $checkedConvert( + 'primary_event_source', + (v) => $enumDecodeNullable( + _$EventSourceEnumMap, + v, + unknownValue: EventSource.unknownDefaultOpenApi, + ), + ), + role: $checkedConvert( + 'role', + (v) => $enumDecodeNullable( + _$AccountRoleEnumMap, + v, + unknownValue: AccountRole.unknownDefaultOpenApi, + ), + ), + ); + return val; + }, + fieldKeyMap: const { + 'includeInNetWorth': 'include_in_net_worth', + 'mirrorOfAccountId': 'mirror_of_account_id', + 'primaryEventSource': 'primary_event_source', + }, + ); + +Map _$AccountPatchToJson( + AccountPatch instance, +) => { + 'include_in_net_worth': ?instance.includeInNetWorth, + 'mirror_of_account_id': ?instance.mirrorOfAccountId, + 'name': ?instance.name, + 'primary_event_source': ?_$EventSourceEnumMap[instance.primaryEventSource], + 'role': ?_$AccountRoleEnumMap[instance.role], +}; + +const _$EventSourceEnumMap = { + EventSource.tinvestApi: 'tinvest_api', + EventSource.reportSber: 'report_sber', + EventSource.reportVtb: 'report_vtb', + EventSource.manual: 'manual', + EventSource.unknownDefaultOpenApi: 'unknown_default_open_api', +}; + +const _$AccountRoleEnumMap = { + AccountRole.liquid: 'liquid', + AccountRole.savings: 'savings', + AccountRole.investment: 'investment', + AccountRole.debt: 'debt', + AccountRole.unknownDefaultOpenApi: 'unknown_default_open_api', +}; diff --git a/app/packages/api_client/lib/src/model/account_role.dart b/app/packages/api_client/lib/src/model/account_role.dart new file mode 100644 index 0000000..121f6ce --- /dev/null +++ b/app/packages/api_client/lib/src/model/account_role.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum AccountRole { + @JsonValue(r'liquid') + liquid(r'liquid'), + @JsonValue(r'savings') + savings(r'savings'), + @JsonValue(r'investment') + investment(r'investment'), + @JsonValue(r'debt') + debt(r'debt'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const AccountRole(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/app/packages/api_client/lib/src/model/broker.dart b/app/packages/api_client/lib/src/model/broker.dart new file mode 100644 index 0000000..21f4189 --- /dev/null +++ b/app/packages/api_client/lib/src/model/broker.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum Broker { + @JsonValue(r'tinvest') + tinvest(r'tinvest'), + @JsonValue(r'sber') + sber(r'sber'), + @JsonValue(r'vtb') + vtb(r'vtb'), + @JsonValue(r'other') + other(r'other'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const Broker(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/app/packages/api_client/lib/src/model/cash_flow_month.dart b/app/packages/api_client/lib/src/model/cash_flow_month.dart new file mode 100644 index 0000000..141ecca --- /dev/null +++ b/app/packages/api_client/lib/src/model/cash_flow_month.dart @@ -0,0 +1,176 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'cash_flow_month.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class CashFlowMonth { + /// Returns a new [CashFlowMonth] instance. + CashFlowMonth({ + + required this.baselineRub, + + required this.expenseRub, + + required this.incomeRub, + + required this.month, + + required this.oneOffRub, + + required this.savingsRate, + + required this.savingsTransferRub, + + required this.txnCount, + }); + + /// decimal as string + @JsonKey( + + name: r'baseline_rub', + required: true, + includeIfNull: false, + ) + + + final String baselineRub; + + + + /// decimal as string + @JsonKey( + + name: r'expense_rub', + required: true, + includeIfNull: false, + ) + + + final String expenseRub; + + + + /// decimal as string + @JsonKey( + + name: r'income_rub', + required: true, + includeIfNull: false, + ) + + + final String incomeRub; + + + + @JsonKey( + + name: r'month', + required: true, + includeIfNull: false, + ) + + + final DateTime month; + + + + /// decimal as string + @JsonKey( + + name: r'one_off_rub', + required: true, + includeIfNull: false, + ) + + + final String oneOffRub; + + + + /// decimal as string + @JsonKey( + + name: r'savings_rate', + required: true, + includeIfNull: true, + ) + + + final String? savingsRate; + + + + /// decimal as string + @JsonKey( + + name: r'savings_transfer_rub', + required: true, + includeIfNull: false, + ) + + + final String savingsTransferRub; + + + + @JsonKey( + + name: r'txn_count', + required: true, + includeIfNull: false, + ) + + + final int txnCount; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is CashFlowMonth && + other.baselineRub == baselineRub && + other.expenseRub == expenseRub && + other.incomeRub == incomeRub && + other.month == month && + other.oneOffRub == oneOffRub && + other.savingsRate == savingsRate && + other.savingsTransferRub == savingsTransferRub && + other.txnCount == txnCount; + + @override + int get hashCode => + baselineRub.hashCode + + expenseRub.hashCode + + incomeRub.hashCode + + month.hashCode + + oneOffRub.hashCode + + (savingsRate == null ? 0 : savingsRate.hashCode) + + savingsTransferRub.hashCode + + txnCount.hashCode; + + factory CashFlowMonth.fromJson(Map json) => _$CashFlowMonthFromJson(json); + + Map toJson() => _$CashFlowMonthToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/cash_flow_month.g.dart b/app/packages/api_client/lib/src/model/cash_flow_month.g.dart new file mode 100644 index 0000000..08baf3a --- /dev/null +++ b/app/packages/api_client/lib/src/model/cash_flow_month.g.dart @@ -0,0 +1,195 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'cash_flow_month.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$CashFlowMonthCWProxy { + CashFlowMonth baselineRub(String baselineRub); + + CashFlowMonth expenseRub(String expenseRub); + + CashFlowMonth incomeRub(String incomeRub); + + CashFlowMonth month(DateTime month); + + CashFlowMonth oneOffRub(String oneOffRub); + + CashFlowMonth savingsRate(String? savingsRate); + + CashFlowMonth savingsTransferRub(String savingsTransferRub); + + CashFlowMonth txnCount(int txnCount); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `CashFlowMonth(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// CashFlowMonth(...).copyWith(id: 12, name: "My name") + /// ```` + CashFlowMonth call({ + String baselineRub, + String expenseRub, + String incomeRub, + DateTime month, + String oneOffRub, + String? savingsRate, + String savingsTransferRub, + int txnCount, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfCashFlowMonth.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfCashFlowMonth.copyWith.fieldName(...)` +class _$CashFlowMonthCWProxyImpl implements _$CashFlowMonthCWProxy { + const _$CashFlowMonthCWProxyImpl(this._value); + + final CashFlowMonth _value; + + @override + CashFlowMonth baselineRub(String baselineRub) => + this(baselineRub: baselineRub); + + @override + CashFlowMonth expenseRub(String expenseRub) => this(expenseRub: expenseRub); + + @override + CashFlowMonth incomeRub(String incomeRub) => this(incomeRub: incomeRub); + + @override + CashFlowMonth month(DateTime month) => this(month: month); + + @override + CashFlowMonth oneOffRub(String oneOffRub) => this(oneOffRub: oneOffRub); + + @override + CashFlowMonth savingsRate(String? savingsRate) => + this(savingsRate: savingsRate); + + @override + CashFlowMonth savingsTransferRub(String savingsTransferRub) => + this(savingsTransferRub: savingsTransferRub); + + @override + CashFlowMonth txnCount(int txnCount) => this(txnCount: txnCount); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `CashFlowMonth(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// CashFlowMonth(...).copyWith(id: 12, name: "My name") + /// ```` + CashFlowMonth call({ + Object? baselineRub = const $CopyWithPlaceholder(), + Object? expenseRub = const $CopyWithPlaceholder(), + Object? incomeRub = const $CopyWithPlaceholder(), + Object? month = const $CopyWithPlaceholder(), + Object? oneOffRub = const $CopyWithPlaceholder(), + Object? savingsRate = const $CopyWithPlaceholder(), + Object? savingsTransferRub = const $CopyWithPlaceholder(), + Object? txnCount = const $CopyWithPlaceholder(), + }) { + return CashFlowMonth( + baselineRub: baselineRub == const $CopyWithPlaceholder() + ? _value.baselineRub + // ignore: cast_nullable_to_non_nullable + : baselineRub as String, + expenseRub: expenseRub == const $CopyWithPlaceholder() + ? _value.expenseRub + // ignore: cast_nullable_to_non_nullable + : expenseRub as String, + incomeRub: incomeRub == const $CopyWithPlaceholder() + ? _value.incomeRub + // ignore: cast_nullable_to_non_nullable + : incomeRub as String, + month: month == const $CopyWithPlaceholder() + ? _value.month + // ignore: cast_nullable_to_non_nullable + : month as DateTime, + oneOffRub: oneOffRub == const $CopyWithPlaceholder() + ? _value.oneOffRub + // ignore: cast_nullable_to_non_nullable + : oneOffRub as String, + savingsRate: savingsRate == const $CopyWithPlaceholder() + ? _value.savingsRate + // ignore: cast_nullable_to_non_nullable + : savingsRate as String?, + savingsTransferRub: savingsTransferRub == const $CopyWithPlaceholder() + ? _value.savingsTransferRub + // ignore: cast_nullable_to_non_nullable + : savingsTransferRub as String, + txnCount: txnCount == const $CopyWithPlaceholder() + ? _value.txnCount + // ignore: cast_nullable_to_non_nullable + : txnCount as int, + ); + } +} + +extension $CashFlowMonthCopyWith on CashFlowMonth { + /// Returns a callable class that can be used as follows: `instanceOfCashFlowMonth.copyWith(...)` or like so:`instanceOfCashFlowMonth.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$CashFlowMonthCWProxy get copyWith => _$CashFlowMonthCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CashFlowMonth _$CashFlowMonthFromJson(Map json) => + $checkedCreate( + 'CashFlowMonth', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'baseline_rub', + 'expense_rub', + 'income_rub', + 'month', + 'one_off_rub', + 'savings_rate', + 'savings_transfer_rub', + 'txn_count', + ], + ); + final val = CashFlowMonth( + baselineRub: $checkedConvert('baseline_rub', (v) => v as String), + expenseRub: $checkedConvert('expense_rub', (v) => v as String), + incomeRub: $checkedConvert('income_rub', (v) => v as String), + month: $checkedConvert('month', (v) => DateTime.parse(v as String)), + oneOffRub: $checkedConvert('one_off_rub', (v) => v as String), + savingsRate: $checkedConvert('savings_rate', (v) => v as String?), + savingsTransferRub: $checkedConvert( + 'savings_transfer_rub', + (v) => v as String, + ), + txnCount: $checkedConvert('txn_count', (v) => (v as num).toInt()), + ); + return val; + }, + fieldKeyMap: const { + 'baselineRub': 'baseline_rub', + 'expenseRub': 'expense_rub', + 'incomeRub': 'income_rub', + 'oneOffRub': 'one_off_rub', + 'savingsRate': 'savings_rate', + 'savingsTransferRub': 'savings_transfer_rub', + 'txnCount': 'txn_count', + }, + ); + +Map _$CashFlowMonthToJson(CashFlowMonth instance) => + { + 'baseline_rub': instance.baselineRub, + 'expense_rub': instance.expenseRub, + 'income_rub': instance.incomeRub, + 'month': instance.month.toIso8601String(), + 'one_off_rub': instance.oneOffRub, + 'savings_rate': instance.savingsRate, + 'savings_transfer_rub': instance.savingsTransferRub, + 'txn_count': instance.txnCount, + }; diff --git a/app/packages/api_client/lib/src/model/category_out.dart b/app/packages/api_client/lib/src/model/category_out.dart new file mode 100644 index 0000000..e769eb3 --- /dev/null +++ b/app/packages/api_client/lib/src/model/category_out.dart @@ -0,0 +1,170 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'category_out.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class CategoryOut { + /// Returns a new [CategoryOut] instance. + CategoryOut({ + + required this.archived, + + required this.color, + + required this.icon, + + required this.id, + + required this.name, + + required this.parentId, + + required this.showIncome, + + required this.showOutcome, + }); + + @JsonKey( + + name: r'archived', + required: true, + includeIfNull: false, + ) + + + final bool archived; + + + + @JsonKey( + + name: r'color', + required: true, + includeIfNull: true, + ) + + + final int? color; + + + + @JsonKey( + + name: r'icon', + required: true, + includeIfNull: true, + ) + + + final String? icon; + + + + @JsonKey( + + name: r'id', + required: true, + includeIfNull: false, + ) + + + final int id; + + + + @JsonKey( + + name: r'name', + required: true, + includeIfNull: false, + ) + + + final String name; + + + + @JsonKey( + + name: r'parent_id', + required: true, + includeIfNull: true, + ) + + + final int? parentId; + + + + @JsonKey( + + name: r'show_income', + required: true, + includeIfNull: false, + ) + + + final bool showIncome; + + + + @JsonKey( + + name: r'show_outcome', + required: true, + includeIfNull: false, + ) + + + final bool showOutcome; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is CategoryOut && + other.archived == archived && + other.color == color && + other.icon == icon && + other.id == id && + other.name == name && + other.parentId == parentId && + other.showIncome == showIncome && + other.showOutcome == showOutcome; + + @override + int get hashCode => + archived.hashCode + + (color == null ? 0 : color.hashCode) + + (icon == null ? 0 : icon.hashCode) + + id.hashCode + + name.hashCode + + (parentId == null ? 0 : parentId.hashCode) + + showIncome.hashCode + + showOutcome.hashCode; + + factory CategoryOut.fromJson(Map json) => _$CategoryOutFromJson(json); + + Map toJson() => _$CategoryOutToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/category_out.g.dart b/app/packages/api_client/lib/src/model/category_out.g.dart new file mode 100644 index 0000000..09f31d8 --- /dev/null +++ b/app/packages/api_client/lib/src/model/category_out.g.dart @@ -0,0 +1,184 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'category_out.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$CategoryOutCWProxy { + CategoryOut archived(bool archived); + + CategoryOut color(int? color); + + CategoryOut icon(String? icon); + + CategoryOut id(int id); + + CategoryOut name(String name); + + CategoryOut parentId(int? parentId); + + CategoryOut showIncome(bool showIncome); + + CategoryOut showOutcome(bool showOutcome); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `CategoryOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// CategoryOut(...).copyWith(id: 12, name: "My name") + /// ```` + CategoryOut call({ + bool archived, + int? color, + String? icon, + int id, + String name, + int? parentId, + bool showIncome, + bool showOutcome, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfCategoryOut.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfCategoryOut.copyWith.fieldName(...)` +class _$CategoryOutCWProxyImpl implements _$CategoryOutCWProxy { + const _$CategoryOutCWProxyImpl(this._value); + + final CategoryOut _value; + + @override + CategoryOut archived(bool archived) => this(archived: archived); + + @override + CategoryOut color(int? color) => this(color: color); + + @override + CategoryOut icon(String? icon) => this(icon: icon); + + @override + CategoryOut id(int id) => this(id: id); + + @override + CategoryOut name(String name) => this(name: name); + + @override + CategoryOut parentId(int? parentId) => this(parentId: parentId); + + @override + CategoryOut showIncome(bool showIncome) => this(showIncome: showIncome); + + @override + CategoryOut showOutcome(bool showOutcome) => this(showOutcome: showOutcome); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `CategoryOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// CategoryOut(...).copyWith(id: 12, name: "My name") + /// ```` + CategoryOut call({ + Object? archived = const $CopyWithPlaceholder(), + Object? color = const $CopyWithPlaceholder(), + Object? icon = const $CopyWithPlaceholder(), + Object? id = const $CopyWithPlaceholder(), + Object? name = const $CopyWithPlaceholder(), + Object? parentId = const $CopyWithPlaceholder(), + Object? showIncome = const $CopyWithPlaceholder(), + Object? showOutcome = const $CopyWithPlaceholder(), + }) { + return CategoryOut( + archived: archived == const $CopyWithPlaceholder() + ? _value.archived + // ignore: cast_nullable_to_non_nullable + : archived as bool, + color: color == const $CopyWithPlaceholder() + ? _value.color + // ignore: cast_nullable_to_non_nullable + : color as int?, + icon: icon == const $CopyWithPlaceholder() + ? _value.icon + // ignore: cast_nullable_to_non_nullable + : icon as String?, + id: id == const $CopyWithPlaceholder() + ? _value.id + // ignore: cast_nullable_to_non_nullable + : id as int, + name: name == const $CopyWithPlaceholder() + ? _value.name + // ignore: cast_nullable_to_non_nullable + : name as String, + parentId: parentId == const $CopyWithPlaceholder() + ? _value.parentId + // ignore: cast_nullable_to_non_nullable + : parentId as int?, + showIncome: showIncome == const $CopyWithPlaceholder() + ? _value.showIncome + // ignore: cast_nullable_to_non_nullable + : showIncome as bool, + showOutcome: showOutcome == const $CopyWithPlaceholder() + ? _value.showOutcome + // ignore: cast_nullable_to_non_nullable + : showOutcome as bool, + ); + } +} + +extension $CategoryOutCopyWith on CategoryOut { + /// Returns a callable class that can be used as follows: `instanceOfCategoryOut.copyWith(...)` or like so:`instanceOfCategoryOut.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$CategoryOutCWProxy get copyWith => _$CategoryOutCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CategoryOut _$CategoryOutFromJson(Map json) => $checkedCreate( + 'CategoryOut', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'archived', + 'color', + 'icon', + 'id', + 'name', + 'parent_id', + 'show_income', + 'show_outcome', + ], + ); + final val = CategoryOut( + archived: $checkedConvert('archived', (v) => v as bool), + color: $checkedConvert('color', (v) => (v as num?)?.toInt()), + icon: $checkedConvert('icon', (v) => v as String?), + id: $checkedConvert('id', (v) => (v as num).toInt()), + name: $checkedConvert('name', (v) => v as String), + parentId: $checkedConvert('parent_id', (v) => (v as num?)?.toInt()), + showIncome: $checkedConvert('show_income', (v) => v as bool), + showOutcome: $checkedConvert('show_outcome', (v) => v as bool), + ); + return val; + }, + fieldKeyMap: const { + 'parentId': 'parent_id', + 'showIncome': 'show_income', + 'showOutcome': 'show_outcome', + }, +); + +Map _$CategoryOutToJson(CategoryOut instance) => + { + 'archived': instance.archived, + 'color': instance.color, + 'icon': instance.icon, + 'id': instance.id, + 'name': instance.name, + 'parent_id': instance.parentId, + 'show_income': instance.showIncome, + 'show_outcome': instance.showOutcome, + }; diff --git a/app/packages/api_client/lib/src/model/data_quality_row.dart b/app/packages/api_client/lib/src/model/data_quality_row.dart new file mode 100644 index 0000000..5d46d1d --- /dev/null +++ b/app/packages/api_client/lib/src/model/data_quality_row.dart @@ -0,0 +1,154 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'data_quality_row.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class DataQualityRow { + /// Returns a new [DataQualityRow] instance. + DataQualityRow({ + + required this.checkName, + + required this.computedAt, + + required this.count, + + required this.detail, + + required this.id, + + required this.ref, + + required this.severity, + }); + + @JsonKey( + + name: r'check_name', + required: true, + includeIfNull: false, + ) + + + final String checkName; + + + + @JsonKey( + + name: r'computed_at', + required: true, + includeIfNull: false, + ) + + + final DateTime computedAt; + + + + @JsonKey( + + name: r'count', + required: true, + includeIfNull: false, + ) + + + final int count; + + + + @JsonKey( + + name: r'detail', + required: true, + includeIfNull: false, + ) + + + final String detail; + + + + @JsonKey( + + name: r'id', + required: true, + includeIfNull: false, + ) + + + final int id; + + + + @JsonKey( + + name: r'ref', + required: true, + includeIfNull: true, + ) + + + final Map? ref; + + + + @JsonKey( + + name: r'severity', + required: true, + includeIfNull: false, + ) + + + final String severity; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is DataQualityRow && + other.checkName == checkName && + other.computedAt == computedAt && + other.count == count && + other.detail == detail && + other.id == id && + other.ref == ref && + other.severity == severity; + + @override + int get hashCode => + checkName.hashCode + + computedAt.hashCode + + count.hashCode + + detail.hashCode + + id.hashCode + + (ref == null ? 0 : ref.hashCode) + + severity.hashCode; + + factory DataQualityRow.fromJson(Map json) => _$DataQualityRowFromJson(json); + + Map toJson() => _$DataQualityRowToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/data_quality_row.g.dart b/app/packages/api_client/lib/src/model/data_quality_row.g.dart new file mode 100644 index 0000000..a794de6 --- /dev/null +++ b/app/packages/api_client/lib/src/model/data_quality_row.g.dart @@ -0,0 +1,179 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'data_quality_row.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$DataQualityRowCWProxy { + DataQualityRow checkName(String checkName); + + DataQualityRow computedAt(DateTime computedAt); + + DataQualityRow count(int count); + + DataQualityRow detail(String detail); + + DataQualityRow id(int id); + + DataQualityRow ref(Map? ref); + + DataQualityRow severity(String severity); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `DataQualityRow(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// DataQualityRow(...).copyWith(id: 12, name: "My name") + /// ```` + DataQualityRow call({ + String checkName, + DateTime computedAt, + int count, + String detail, + int id, + Map? ref, + String severity, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfDataQualityRow.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfDataQualityRow.copyWith.fieldName(...)` +class _$DataQualityRowCWProxyImpl implements _$DataQualityRowCWProxy { + const _$DataQualityRowCWProxyImpl(this._value); + + final DataQualityRow _value; + + @override + DataQualityRow checkName(String checkName) => this(checkName: checkName); + + @override + DataQualityRow computedAt(DateTime computedAt) => + this(computedAt: computedAt); + + @override + DataQualityRow count(int count) => this(count: count); + + @override + DataQualityRow detail(String detail) => this(detail: detail); + + @override + DataQualityRow id(int id) => this(id: id); + + @override + DataQualityRow ref(Map? ref) => this(ref: ref); + + @override + DataQualityRow severity(String severity) => this(severity: severity); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `DataQualityRow(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// DataQualityRow(...).copyWith(id: 12, name: "My name") + /// ```` + DataQualityRow call({ + Object? checkName = const $CopyWithPlaceholder(), + Object? computedAt = const $CopyWithPlaceholder(), + Object? count = const $CopyWithPlaceholder(), + Object? detail = const $CopyWithPlaceholder(), + Object? id = const $CopyWithPlaceholder(), + Object? ref = const $CopyWithPlaceholder(), + Object? severity = const $CopyWithPlaceholder(), + }) { + return DataQualityRow( + checkName: checkName == const $CopyWithPlaceholder() + ? _value.checkName + // ignore: cast_nullable_to_non_nullable + : checkName as String, + computedAt: computedAt == const $CopyWithPlaceholder() + ? _value.computedAt + // ignore: cast_nullable_to_non_nullable + : computedAt as DateTime, + count: count == const $CopyWithPlaceholder() + ? _value.count + // ignore: cast_nullable_to_non_nullable + : count as int, + detail: detail == const $CopyWithPlaceholder() + ? _value.detail + // ignore: cast_nullable_to_non_nullable + : detail as String, + id: id == const $CopyWithPlaceholder() + ? _value.id + // ignore: cast_nullable_to_non_nullable + : id as int, + ref: ref == const $CopyWithPlaceholder() + ? _value.ref + // ignore: cast_nullable_to_non_nullable + : ref as Map?, + severity: severity == const $CopyWithPlaceholder() + ? _value.severity + // ignore: cast_nullable_to_non_nullable + : severity as String, + ); + } +} + +extension $DataQualityRowCopyWith on DataQualityRow { + /// Returns a callable class that can be used as follows: `instanceOfDataQualityRow.copyWith(...)` or like so:`instanceOfDataQualityRow.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$DataQualityRowCWProxy get copyWith => _$DataQualityRowCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DataQualityRow _$DataQualityRowFromJson(Map json) => + $checkedCreate( + 'DataQualityRow', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'check_name', + 'computed_at', + 'count', + 'detail', + 'id', + 'ref', + 'severity', + ], + ); + final val = DataQualityRow( + checkName: $checkedConvert('check_name', (v) => v as String), + computedAt: $checkedConvert( + 'computed_at', + (v) => DateTime.parse(v as String), + ), + count: $checkedConvert('count', (v) => (v as num).toInt()), + detail: $checkedConvert('detail', (v) => v as String), + id: $checkedConvert('id', (v) => (v as num).toInt()), + ref: $checkedConvert( + 'ref', + (v) => (v as Map?)?.map( + (k, e) => MapEntry(k, e as Object), + ), + ), + severity: $checkedConvert('severity', (v) => v as String), + ); + return val; + }, + fieldKeyMap: const { + 'checkName': 'check_name', + 'computedAt': 'computed_at', + }, + ); + +Map _$DataQualityRowToJson(DataQualityRow instance) => + { + 'check_name': instance.checkName, + 'computed_at': instance.computedAt.toIso8601String(), + 'count': instance.count, + 'detail': instance.detail, + 'id': instance.id, + 'ref': instance.ref, + 'severity': instance.severity, + }; diff --git a/app/packages/api_client/lib/src/model/event_source.dart b/app/packages/api_client/lib/src/model/event_source.dart new file mode 100644 index 0000000..bdb209b --- /dev/null +++ b/app/packages/api_client/lib/src/model/event_source.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +/// Which feed is the truth for an account's ledger; others become `shadow` events. +enum EventSource { + @JsonValue(r'tinvest_api') + tinvestApi(r'tinvest_api'), + @JsonValue(r'report_sber') + reportSber(r'report_sber'), + @JsonValue(r'report_vtb') + reportVtb(r'report_vtb'), + @JsonValue(r'manual') + manual(r'manual'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const EventSource(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/app/packages/api_client/lib/src/model/flow_type.dart b/app/packages/api_client/lib/src/model/flow_type.dart new file mode 100644 index 0000000..67668e3 --- /dev/null +++ b/app/packages/api_client/lib/src/model/flow_type.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum FlowType { + @JsonValue(r'income') + income(r'income'), + @JsonValue(r'expense') + expense(r'expense'), + @JsonValue(r'internal_transfer') + internalTransfer(r'internal_transfer'), + @JsonValue(r'savings_transfer') + savingsTransfer(r'savings_transfer'), + @JsonValue(r'broker_external_flow') + brokerExternalFlow(r'broker_external_flow'), + @JsonValue(r'deleted') + deleted(r'deleted'), + @JsonValue(r'other') + other(r'other'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const FlowType(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/app/packages/api_client/lib/src/model/health.dart b/app/packages/api_client/lib/src/model/health.dart new file mode 100644 index 0000000..8cd4643 --- /dev/null +++ b/app/packages/api_client/lib/src/model/health.dart @@ -0,0 +1,90 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'health.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Health { + /// Returns a new [Health] instance. + Health({ + + required this.database, + + required this.status, + + required this.version, + }); + + @JsonKey( + + name: r'database', + required: true, + includeIfNull: false, + ) + + + final String database; + + + + @JsonKey( + + name: r'status', + required: true, + includeIfNull: false, + ) + + + final String status; + + + + @JsonKey( + + name: r'version', + required: true, + includeIfNull: false, + ) + + + final String version; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Health && + other.database == database && + other.status == status && + other.version == version; + + @override + int get hashCode => + database.hashCode + + status.hashCode + + version.hashCode; + + factory Health.fromJson(Map json) => _$HealthFromJson(json); + + Map toJson() => _$HealthToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/health.g.dart b/app/packages/api_client/lib/src/model/health.g.dart new file mode 100644 index 0000000..a536dbd --- /dev/null +++ b/app/packages/api_client/lib/src/model/health.g.dart @@ -0,0 +1,94 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'health.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$HealthCWProxy { + Health database(String database); + + Health status(String status); + + Health version(String version); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `Health(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// Health(...).copyWith(id: 12, name: "My name") + /// ```` + Health call({String database, String status, String version}); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfHealth.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfHealth.copyWith.fieldName(...)` +class _$HealthCWProxyImpl implements _$HealthCWProxy { + const _$HealthCWProxyImpl(this._value); + + final Health _value; + + @override + Health database(String database) => this(database: database); + + @override + Health status(String status) => this(status: status); + + @override + Health version(String version) => this(version: version); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `Health(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// Health(...).copyWith(id: 12, name: "My name") + /// ```` + Health call({ + Object? database = const $CopyWithPlaceholder(), + Object? status = const $CopyWithPlaceholder(), + Object? version = const $CopyWithPlaceholder(), + }) { + return Health( + database: database == const $CopyWithPlaceholder() + ? _value.database + // ignore: cast_nullable_to_non_nullable + : database as String, + status: status == const $CopyWithPlaceholder() + ? _value.status + // ignore: cast_nullable_to_non_nullable + : status as String, + version: version == const $CopyWithPlaceholder() + ? _value.version + // ignore: cast_nullable_to_non_nullable + : version as String, + ); + } +} + +extension $HealthCopyWith on Health { + /// Returns a callable class that can be used as follows: `instanceOfHealth.copyWith(...)` or like so:`instanceOfHealth.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$HealthCWProxy get copyWith => _$HealthCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Health _$HealthFromJson(Map json) => + $checkedCreate('Health', json, ($checkedConvert) { + $checkKeys(json, requiredKeys: const ['database', 'status', 'version']); + final val = Health( + database: $checkedConvert('database', (v) => v as String), + status: $checkedConvert('status', (v) => v as String), + version: $checkedConvert('version', (v) => v as String), + ); + return val; + }); + +Map _$HealthToJson(Health instance) => { + 'database': instance.database, + 'status': instance.status, + 'version': instance.version, +}; diff --git a/app/packages/api_client/lib/src/model/job_status.dart b/app/packages/api_client/lib/src/model/job_status.dart new file mode 100644 index 0000000..4975875 --- /dev/null +++ b/app/packages/api_client/lib/src/model/job_status.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum JobStatus { + @JsonValue(r'queued') + queued(r'queued'), + @JsonValue(r'running') + running(r'running'), + @JsonValue(r'done') + done(r'done'), + @JsonValue(r'error') + error(r'error'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const JobStatus(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/app/packages/api_client/lib/src/model/login_request.dart b/app/packages/api_client/lib/src/model/login_request.dart new file mode 100644 index 0000000..7be096e --- /dev/null +++ b/app/packages/api_client/lib/src/model/login_request.dart @@ -0,0 +1,74 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'login_request.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class LoginRequest { + /// Returns a new [LoginRequest] instance. + LoginRequest({ + + required this.email, + + required this.password, + }); + + @JsonKey( + + name: r'email', + required: true, + includeIfNull: false, + ) + + + final String email; + + + + @JsonKey( + + name: r'password', + required: true, + includeIfNull: false, + ) + + + final String password; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is LoginRequest && + other.email == email && + other.password == password; + + @override + int get hashCode => + email.hashCode + + password.hashCode; + + factory LoginRequest.fromJson(Map json) => _$LoginRequestFromJson(json); + + Map toJson() => _$LoginRequestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/login_request.g.dart b/app/packages/api_client/lib/src/model/login_request.g.dart new file mode 100644 index 0000000..fa8e44f --- /dev/null +++ b/app/packages/api_client/lib/src/model/login_request.g.dart @@ -0,0 +1,80 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'login_request.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$LoginRequestCWProxy { + LoginRequest email(String email); + + LoginRequest password(String password); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `LoginRequest(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// LoginRequest(...).copyWith(id: 12, name: "My name") + /// ```` + LoginRequest call({String email, String password}); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfLoginRequest.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfLoginRequest.copyWith.fieldName(...)` +class _$LoginRequestCWProxyImpl implements _$LoginRequestCWProxy { + const _$LoginRequestCWProxyImpl(this._value); + + final LoginRequest _value; + + @override + LoginRequest email(String email) => this(email: email); + + @override + LoginRequest password(String password) => this(password: password); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `LoginRequest(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// LoginRequest(...).copyWith(id: 12, name: "My name") + /// ```` + LoginRequest call({ + Object? email = const $CopyWithPlaceholder(), + Object? password = const $CopyWithPlaceholder(), + }) { + return LoginRequest( + email: email == const $CopyWithPlaceholder() + ? _value.email + // ignore: cast_nullable_to_non_nullable + : email as String, + password: password == const $CopyWithPlaceholder() + ? _value.password + // ignore: cast_nullable_to_non_nullable + : password as String, + ); + } +} + +extension $LoginRequestCopyWith on LoginRequest { + /// Returns a callable class that can be used as follows: `instanceOfLoginRequest.copyWith(...)` or like so:`instanceOfLoginRequest.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$LoginRequestCWProxy get copyWith => _$LoginRequestCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +LoginRequest _$LoginRequestFromJson(Map json) => + $checkedCreate('LoginRequest', json, ($checkedConvert) { + $checkKeys(json, requiredKeys: const ['email', 'password']); + final val = LoginRequest( + email: $checkedConvert('email', (v) => v as String), + password: $checkedConvert('password', (v) => v as String), + ); + return val; + }); + +Map _$LoginRequestToJson(LoginRequest instance) => + {'email': instance.email, 'password': instance.password}; diff --git a/app/packages/api_client/lib/src/model/net_worth_breakdown.dart b/app/packages/api_client/lib/src/model/net_worth_breakdown.dart new file mode 100644 index 0000000..2e408e6 --- /dev/null +++ b/app/packages/api_client/lib/src/model/net_worth_breakdown.dart @@ -0,0 +1,192 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/account_balance.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'net_worth_breakdown.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class NetWorthBreakdown { + /// Returns a new [NetWorthBreakdown] instance. + NetWorthBreakdown({ + + required this.accounts, + + required this.byCurrency, + + required this.d, + + required this.debtRub, + + required this.investmentRub, + + required this.liquidRub, + + required this.missingFxCount, + + required this.savingsRub, + + required this.totalRub, + }); + + @JsonKey( + + name: r'accounts', + required: true, + includeIfNull: false, + ) + + + final List accounts; + + + + @JsonKey( + + name: r'by_currency', + required: true, + includeIfNull: false, + ) + + + final Map byCurrency; + + + + @JsonKey( + + name: r'd', + required: true, + includeIfNull: true, + ) + + + final DateTime? d; + + + + /// decimal as string + @JsonKey( + + name: r'debt_rub', + required: true, + includeIfNull: false, + ) + + + final String debtRub; + + + + /// decimal as string + @JsonKey( + + name: r'investment_rub', + required: true, + includeIfNull: false, + ) + + + final String investmentRub; + + + + /// decimal as string + @JsonKey( + + name: r'liquid_rub', + required: true, + includeIfNull: false, + ) + + + final String liquidRub; + + + + @JsonKey( + + name: r'missing_fx_count', + required: true, + includeIfNull: false, + ) + + + final int missingFxCount; + + + + /// decimal as string + @JsonKey( + + name: r'savings_rub', + required: true, + includeIfNull: false, + ) + + + final String savingsRub; + + + + /// decimal as string + @JsonKey( + + name: r'total_rub', + required: true, + includeIfNull: false, + ) + + + final String totalRub; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is NetWorthBreakdown && + other.accounts == accounts && + other.byCurrency == byCurrency && + other.d == d && + other.debtRub == debtRub && + other.investmentRub == investmentRub && + other.liquidRub == liquidRub && + other.missingFxCount == missingFxCount && + other.savingsRub == savingsRub && + other.totalRub == totalRub; + + @override + int get hashCode => + accounts.hashCode + + byCurrency.hashCode + + (d == null ? 0 : d.hashCode) + + debtRub.hashCode + + investmentRub.hashCode + + liquidRub.hashCode + + missingFxCount.hashCode + + savingsRub.hashCode + + totalRub.hashCode; + + factory NetWorthBreakdown.fromJson(Map json) => _$NetWorthBreakdownFromJson(json); + + Map toJson() => _$NetWorthBreakdownToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/net_worth_breakdown.g.dart b/app/packages/api_client/lib/src/model/net_worth_breakdown.g.dart new file mode 100644 index 0000000..488675b --- /dev/null +++ b/app/packages/api_client/lib/src/model/net_worth_breakdown.g.dart @@ -0,0 +1,223 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'net_worth_breakdown.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$NetWorthBreakdownCWProxy { + NetWorthBreakdown accounts(List accounts); + + NetWorthBreakdown byCurrency(Map byCurrency); + + NetWorthBreakdown d(DateTime? d); + + NetWorthBreakdown debtRub(String debtRub); + + NetWorthBreakdown investmentRub(String investmentRub); + + NetWorthBreakdown liquidRub(String liquidRub); + + NetWorthBreakdown missingFxCount(int missingFxCount); + + NetWorthBreakdown savingsRub(String savingsRub); + + NetWorthBreakdown totalRub(String totalRub); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `NetWorthBreakdown(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// NetWorthBreakdown(...).copyWith(id: 12, name: "My name") + /// ```` + NetWorthBreakdown call({ + List accounts, + Map byCurrency, + DateTime? d, + String debtRub, + String investmentRub, + String liquidRub, + int missingFxCount, + String savingsRub, + String totalRub, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfNetWorthBreakdown.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfNetWorthBreakdown.copyWith.fieldName(...)` +class _$NetWorthBreakdownCWProxyImpl implements _$NetWorthBreakdownCWProxy { + const _$NetWorthBreakdownCWProxyImpl(this._value); + + final NetWorthBreakdown _value; + + @override + NetWorthBreakdown accounts(List accounts) => + this(accounts: accounts); + + @override + NetWorthBreakdown byCurrency(Map byCurrency) => + this(byCurrency: byCurrency); + + @override + NetWorthBreakdown d(DateTime? d) => this(d: d); + + @override + NetWorthBreakdown debtRub(String debtRub) => this(debtRub: debtRub); + + @override + NetWorthBreakdown investmentRub(String investmentRub) => + this(investmentRub: investmentRub); + + @override + NetWorthBreakdown liquidRub(String liquidRub) => this(liquidRub: liquidRub); + + @override + NetWorthBreakdown missingFxCount(int missingFxCount) => + this(missingFxCount: missingFxCount); + + @override + NetWorthBreakdown savingsRub(String savingsRub) => + this(savingsRub: savingsRub); + + @override + NetWorthBreakdown totalRub(String totalRub) => this(totalRub: totalRub); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `NetWorthBreakdown(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// NetWorthBreakdown(...).copyWith(id: 12, name: "My name") + /// ```` + NetWorthBreakdown call({ + Object? accounts = const $CopyWithPlaceholder(), + Object? byCurrency = const $CopyWithPlaceholder(), + Object? d = const $CopyWithPlaceholder(), + Object? debtRub = const $CopyWithPlaceholder(), + Object? investmentRub = const $CopyWithPlaceholder(), + Object? liquidRub = const $CopyWithPlaceholder(), + Object? missingFxCount = const $CopyWithPlaceholder(), + Object? savingsRub = const $CopyWithPlaceholder(), + Object? totalRub = const $CopyWithPlaceholder(), + }) { + return NetWorthBreakdown( + accounts: accounts == const $CopyWithPlaceholder() + ? _value.accounts + // ignore: cast_nullable_to_non_nullable + : accounts as List, + byCurrency: byCurrency == const $CopyWithPlaceholder() + ? _value.byCurrency + // ignore: cast_nullable_to_non_nullable + : byCurrency as Map, + d: d == const $CopyWithPlaceholder() + ? _value.d + // ignore: cast_nullable_to_non_nullable + : d as DateTime?, + debtRub: debtRub == const $CopyWithPlaceholder() + ? _value.debtRub + // ignore: cast_nullable_to_non_nullable + : debtRub as String, + investmentRub: investmentRub == const $CopyWithPlaceholder() + ? _value.investmentRub + // ignore: cast_nullable_to_non_nullable + : investmentRub as String, + liquidRub: liquidRub == const $CopyWithPlaceholder() + ? _value.liquidRub + // ignore: cast_nullable_to_non_nullable + : liquidRub as String, + missingFxCount: missingFxCount == const $CopyWithPlaceholder() + ? _value.missingFxCount + // ignore: cast_nullable_to_non_nullable + : missingFxCount as int, + savingsRub: savingsRub == const $CopyWithPlaceholder() + ? _value.savingsRub + // ignore: cast_nullable_to_non_nullable + : savingsRub as String, + totalRub: totalRub == const $CopyWithPlaceholder() + ? _value.totalRub + // ignore: cast_nullable_to_non_nullable + : totalRub as String, + ); + } +} + +extension $NetWorthBreakdownCopyWith on NetWorthBreakdown { + /// Returns a callable class that can be used as follows: `instanceOfNetWorthBreakdown.copyWith(...)` or like so:`instanceOfNetWorthBreakdown.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$NetWorthBreakdownCWProxy get copyWith => + _$NetWorthBreakdownCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NetWorthBreakdown _$NetWorthBreakdownFromJson(Map json) => + $checkedCreate( + 'NetWorthBreakdown', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'accounts', + 'by_currency', + 'd', + 'debt_rub', + 'investment_rub', + 'liquid_rub', + 'missing_fx_count', + 'savings_rub', + 'total_rub', + ], + ); + final val = NetWorthBreakdown( + accounts: $checkedConvert( + 'accounts', + (v) => (v as List) + .map((e) => AccountBalance.fromJson(e as Map)) + .toList(), + ), + byCurrency: $checkedConvert( + 'by_currency', + (v) => Map.from(v as Map), + ), + d: $checkedConvert( + 'd', + (v) => v == null ? null : DateTime.parse(v as String), + ), + debtRub: $checkedConvert('debt_rub', (v) => v as String), + investmentRub: $checkedConvert('investment_rub', (v) => v as String), + liquidRub: $checkedConvert('liquid_rub', (v) => v as String), + missingFxCount: $checkedConvert( + 'missing_fx_count', + (v) => (v as num).toInt(), + ), + savingsRub: $checkedConvert('savings_rub', (v) => v as String), + totalRub: $checkedConvert('total_rub', (v) => v as String), + ); + return val; + }, + fieldKeyMap: const { + 'byCurrency': 'by_currency', + 'debtRub': 'debt_rub', + 'investmentRub': 'investment_rub', + 'liquidRub': 'liquid_rub', + 'missingFxCount': 'missing_fx_count', + 'savingsRub': 'savings_rub', + 'totalRub': 'total_rub', + }, + ); + +Map _$NetWorthBreakdownToJson(NetWorthBreakdown instance) => + { + 'accounts': instance.accounts.map((e) => e.toJson()).toList(), + 'by_currency': instance.byCurrency, + 'd': instance.d?.toIso8601String(), + 'debt_rub': instance.debtRub, + 'investment_rub': instance.investmentRub, + 'liquid_rub': instance.liquidRub, + 'missing_fx_count': instance.missingFxCount, + 'savings_rub': instance.savingsRub, + 'total_rub': instance.totalRub, + }; diff --git a/app/packages/api_client/lib/src/model/net_worth_day.dart b/app/packages/api_client/lib/src/model/net_worth_day.dart new file mode 100644 index 0000000..fe18a92 --- /dev/null +++ b/app/packages/api_client/lib/src/model/net_worth_day.dart @@ -0,0 +1,175 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'net_worth_day.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class NetWorthDay { + /// Returns a new [NetWorthDay] instance. + NetWorthDay({ + + required this.byCurrency, + + required this.d, + + required this.debtRub, + + required this.investmentRub, + + required this.liquidRub, + + required this.missingFxCount, + + required this.savingsRub, + + required this.totalRub, + }); + + @JsonKey( + + name: r'by_currency', + required: true, + includeIfNull: false, + ) + + + final Map byCurrency; + + + + @JsonKey( + + name: r'd', + required: true, + includeIfNull: false, + ) + + + final DateTime d; + + + + /// decimal as string + @JsonKey( + + name: r'debt_rub', + required: true, + includeIfNull: false, + ) + + + final String debtRub; + + + + /// decimal as string + @JsonKey( + + name: r'investment_rub', + required: true, + includeIfNull: false, + ) + + + final String investmentRub; + + + + /// decimal as string + @JsonKey( + + name: r'liquid_rub', + required: true, + includeIfNull: false, + ) + + + final String liquidRub; + + + + @JsonKey( + + name: r'missing_fx_count', + required: true, + includeIfNull: false, + ) + + + final int missingFxCount; + + + + /// decimal as string + @JsonKey( + + name: r'savings_rub', + required: true, + includeIfNull: false, + ) + + + final String savingsRub; + + + + /// decimal as string + @JsonKey( + + name: r'total_rub', + required: true, + includeIfNull: false, + ) + + + final String totalRub; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is NetWorthDay && + other.byCurrency == byCurrency && + other.d == d && + other.debtRub == debtRub && + other.investmentRub == investmentRub && + other.liquidRub == liquidRub && + other.missingFxCount == missingFxCount && + other.savingsRub == savingsRub && + other.totalRub == totalRub; + + @override + int get hashCode => + byCurrency.hashCode + + d.hashCode + + debtRub.hashCode + + investmentRub.hashCode + + liquidRub.hashCode + + missingFxCount.hashCode + + savingsRub.hashCode + + totalRub.hashCode; + + factory NetWorthDay.fromJson(Map json) => _$NetWorthDayFromJson(json); + + Map toJson() => _$NetWorthDayToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/net_worth_day.g.dart b/app/packages/api_client/lib/src/model/net_worth_day.g.dart new file mode 100644 index 0000000..e6201ff --- /dev/null +++ b/app/packages/api_client/lib/src/model/net_worth_day.g.dart @@ -0,0 +1,197 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'net_worth_day.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$NetWorthDayCWProxy { + NetWorthDay byCurrency(Map byCurrency); + + NetWorthDay d(DateTime d); + + NetWorthDay debtRub(String debtRub); + + NetWorthDay investmentRub(String investmentRub); + + NetWorthDay liquidRub(String liquidRub); + + NetWorthDay missingFxCount(int missingFxCount); + + NetWorthDay savingsRub(String savingsRub); + + NetWorthDay totalRub(String totalRub); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `NetWorthDay(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// NetWorthDay(...).copyWith(id: 12, name: "My name") + /// ```` + NetWorthDay call({ + Map byCurrency, + DateTime d, + String debtRub, + String investmentRub, + String liquidRub, + int missingFxCount, + String savingsRub, + String totalRub, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfNetWorthDay.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfNetWorthDay.copyWith.fieldName(...)` +class _$NetWorthDayCWProxyImpl implements _$NetWorthDayCWProxy { + const _$NetWorthDayCWProxyImpl(this._value); + + final NetWorthDay _value; + + @override + NetWorthDay byCurrency(Map byCurrency) => + this(byCurrency: byCurrency); + + @override + NetWorthDay d(DateTime d) => this(d: d); + + @override + NetWorthDay debtRub(String debtRub) => this(debtRub: debtRub); + + @override + NetWorthDay investmentRub(String investmentRub) => + this(investmentRub: investmentRub); + + @override + NetWorthDay liquidRub(String liquidRub) => this(liquidRub: liquidRub); + + @override + NetWorthDay missingFxCount(int missingFxCount) => + this(missingFxCount: missingFxCount); + + @override + NetWorthDay savingsRub(String savingsRub) => this(savingsRub: savingsRub); + + @override + NetWorthDay totalRub(String totalRub) => this(totalRub: totalRub); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `NetWorthDay(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// NetWorthDay(...).copyWith(id: 12, name: "My name") + /// ```` + NetWorthDay call({ + Object? byCurrency = const $CopyWithPlaceholder(), + Object? d = const $CopyWithPlaceholder(), + Object? debtRub = const $CopyWithPlaceholder(), + Object? investmentRub = const $CopyWithPlaceholder(), + Object? liquidRub = const $CopyWithPlaceholder(), + Object? missingFxCount = const $CopyWithPlaceholder(), + Object? savingsRub = const $CopyWithPlaceholder(), + Object? totalRub = const $CopyWithPlaceholder(), + }) { + return NetWorthDay( + byCurrency: byCurrency == const $CopyWithPlaceholder() + ? _value.byCurrency + // ignore: cast_nullable_to_non_nullable + : byCurrency as Map, + d: d == const $CopyWithPlaceholder() + ? _value.d + // ignore: cast_nullable_to_non_nullable + : d as DateTime, + debtRub: debtRub == const $CopyWithPlaceholder() + ? _value.debtRub + // ignore: cast_nullable_to_non_nullable + : debtRub as String, + investmentRub: investmentRub == const $CopyWithPlaceholder() + ? _value.investmentRub + // ignore: cast_nullable_to_non_nullable + : investmentRub as String, + liquidRub: liquidRub == const $CopyWithPlaceholder() + ? _value.liquidRub + // ignore: cast_nullable_to_non_nullable + : liquidRub as String, + missingFxCount: missingFxCount == const $CopyWithPlaceholder() + ? _value.missingFxCount + // ignore: cast_nullable_to_non_nullable + : missingFxCount as int, + savingsRub: savingsRub == const $CopyWithPlaceholder() + ? _value.savingsRub + // ignore: cast_nullable_to_non_nullable + : savingsRub as String, + totalRub: totalRub == const $CopyWithPlaceholder() + ? _value.totalRub + // ignore: cast_nullable_to_non_nullable + : totalRub as String, + ); + } +} + +extension $NetWorthDayCopyWith on NetWorthDay { + /// Returns a callable class that can be used as follows: `instanceOfNetWorthDay.copyWith(...)` or like so:`instanceOfNetWorthDay.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$NetWorthDayCWProxy get copyWith => _$NetWorthDayCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NetWorthDay _$NetWorthDayFromJson(Map json) => $checkedCreate( + 'NetWorthDay', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'by_currency', + 'd', + 'debt_rub', + 'investment_rub', + 'liquid_rub', + 'missing_fx_count', + 'savings_rub', + 'total_rub', + ], + ); + final val = NetWorthDay( + byCurrency: $checkedConvert( + 'by_currency', + (v) => Map.from(v as Map), + ), + d: $checkedConvert('d', (v) => DateTime.parse(v as String)), + debtRub: $checkedConvert('debt_rub', (v) => v as String), + investmentRub: $checkedConvert('investment_rub', (v) => v as String), + liquidRub: $checkedConvert('liquid_rub', (v) => v as String), + missingFxCount: $checkedConvert( + 'missing_fx_count', + (v) => (v as num).toInt(), + ), + savingsRub: $checkedConvert('savings_rub', (v) => v as String), + totalRub: $checkedConvert('total_rub', (v) => v as String), + ); + return val; + }, + fieldKeyMap: const { + 'byCurrency': 'by_currency', + 'debtRub': 'debt_rub', + 'investmentRub': 'investment_rub', + 'liquidRub': 'liquid_rub', + 'missingFxCount': 'missing_fx_count', + 'savingsRub': 'savings_rub', + 'totalRub': 'total_rub', + }, +); + +Map _$NetWorthDayToJson(NetWorthDay instance) => + { + 'by_currency': instance.byCurrency, + 'd': instance.d.toIso8601String(), + 'debt_rub': instance.debtRub, + 'investment_rub': instance.investmentRub, + 'liquid_rub': instance.liquidRub, + 'missing_fx_count': instance.missingFxCount, + 'savings_rub': instance.savingsRub, + 'total_rub': instance.totalRub, + }; diff --git a/app/packages/api_client/lib/src/model/problem.dart b/app/packages/api_client/lib/src/model/problem.dart new file mode 100644 index 0000000..418bcd8 --- /dev/null +++ b/app/packages/api_client/lib/src/model/problem.dart @@ -0,0 +1,106 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'problem.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Problem { + /// Returns a new [Problem] instance. + Problem({ + + this.detail, + + this.errors, + + required this.status, + + required this.title, + }); + + @JsonKey( + + name: r'detail', + required: false, + includeIfNull: false, + ) + + + final String? detail; + + + + @JsonKey( + + name: r'errors', + required: false, + includeIfNull: false, + ) + + + final List? errors; + + + + @JsonKey( + + name: r'status', + required: true, + includeIfNull: false, + ) + + + final int status; + + + + @JsonKey( + + name: r'title', + required: true, + includeIfNull: false, + ) + + + final String title; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Problem && + other.detail == detail && + other.errors == errors && + other.status == status && + other.title == title; + + @override + int get hashCode => + detail.hashCode + + errors.hashCode + + status.hashCode + + title.hashCode; + + factory Problem.fromJson(Map json) => _$ProblemFromJson(json); + + Map toJson() => _$ProblemToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/problem.g.dart b/app/packages/api_client/lib/src/model/problem.g.dart new file mode 100644 index 0000000..a813e4b --- /dev/null +++ b/app/packages/api_client/lib/src/model/problem.g.dart @@ -0,0 +1,114 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'problem.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$ProblemCWProxy { + Problem detail(String? detail); + + Problem errors(List? errors); + + Problem status(int status); + + Problem title(String title); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `Problem(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// Problem(...).copyWith(id: 12, name: "My name") + /// ```` + Problem call({ + String? detail, + List? errors, + int status, + String title, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfProblem.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfProblem.copyWith.fieldName(...)` +class _$ProblemCWProxyImpl implements _$ProblemCWProxy { + const _$ProblemCWProxyImpl(this._value); + + final Problem _value; + + @override + Problem detail(String? detail) => this(detail: detail); + + @override + Problem errors(List? errors) => this(errors: errors); + + @override + Problem status(int status) => this(status: status); + + @override + Problem title(String title) => this(title: title); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `Problem(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// Problem(...).copyWith(id: 12, name: "My name") + /// ```` + Problem call({ + Object? detail = const $CopyWithPlaceholder(), + Object? errors = const $CopyWithPlaceholder(), + Object? status = const $CopyWithPlaceholder(), + Object? title = const $CopyWithPlaceholder(), + }) { + return Problem( + detail: detail == const $CopyWithPlaceholder() + ? _value.detail + // ignore: cast_nullable_to_non_nullable + : detail as String?, + errors: errors == const $CopyWithPlaceholder() + ? _value.errors + // ignore: cast_nullable_to_non_nullable + : errors as List?, + status: status == const $CopyWithPlaceholder() + ? _value.status + // ignore: cast_nullable_to_non_nullable + : status as int, + title: title == const $CopyWithPlaceholder() + ? _value.title + // ignore: cast_nullable_to_non_nullable + : title as String, + ); + } +} + +extension $ProblemCopyWith on Problem { + /// Returns a callable class that can be used as follows: `instanceOfProblem.copyWith(...)` or like so:`instanceOfProblem.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$ProblemCWProxy get copyWith => _$ProblemCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Problem _$ProblemFromJson(Map json) => + $checkedCreate('Problem', json, ($checkedConvert) { + $checkKeys(json, requiredKeys: const ['status', 'title']); + final val = Problem( + detail: $checkedConvert('detail', (v) => v as String?), + errors: $checkedConvert( + 'errors', + (v) => (v as List?)?.map((e) => e as Object).toList(), + ), + status: $checkedConvert('status', (v) => (v as num).toInt()), + title: $checkedConvert('title', (v) => v as String), + ); + return val; + }); + +Map _$ProblemToJson(Problem instance) => { + 'detail': ?instance.detail, + 'errors': ?instance.errors, + 'status': instance.status, + 'title': instance.title, +}; diff --git a/app/packages/api_client/lib/src/model/refresh_log_out.dart b/app/packages/api_client/lib/src/model/refresh_log_out.dart new file mode 100644 index 0000000..b03bbb3 --- /dev/null +++ b/app/packages/api_client/lib/src/model/refresh_log_out.dart @@ -0,0 +1,122 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'refresh_log_out.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class RefreshLogOut { + /// Returns a new [RefreshLogOut] instance. + RefreshLogOut({ + + required this.error, + + required this.finishedAt, + + required this.id, + + required this.startedAt, + + required this.trigger, + }); + + @JsonKey( + + name: r'error', + required: true, + includeIfNull: true, + ) + + + final String? error; + + + + @JsonKey( + + name: r'finished_at', + required: true, + includeIfNull: true, + ) + + + final DateTime? finishedAt; + + + + @JsonKey( + + name: r'id', + required: true, + includeIfNull: false, + ) + + + final int id; + + + + @JsonKey( + + name: r'started_at', + required: true, + includeIfNull: false, + ) + + + final DateTime startedAt; + + + + @JsonKey( + + name: r'trigger', + required: true, + includeIfNull: false, + ) + + + final String trigger; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is RefreshLogOut && + other.error == error && + other.finishedAt == finishedAt && + other.id == id && + other.startedAt == startedAt && + other.trigger == trigger; + + @override + int get hashCode => + (error == null ? 0 : error.hashCode) + + (finishedAt == null ? 0 : finishedAt.hashCode) + + id.hashCode + + startedAt.hashCode + + trigger.hashCode; + + factory RefreshLogOut.fromJson(Map json) => _$RefreshLogOutFromJson(json); + + Map toJson() => _$RefreshLogOutToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/refresh_log_out.g.dart b/app/packages/api_client/lib/src/model/refresh_log_out.g.dart new file mode 100644 index 0000000..2a04a55 --- /dev/null +++ b/app/packages/api_client/lib/src/model/refresh_log_out.g.dart @@ -0,0 +1,149 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'refresh_log_out.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$RefreshLogOutCWProxy { + RefreshLogOut error(String? error); + + RefreshLogOut finishedAt(DateTime? finishedAt); + + RefreshLogOut id(int id); + + RefreshLogOut startedAt(DateTime startedAt); + + RefreshLogOut trigger(String trigger); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RefreshLogOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RefreshLogOut(...).copyWith(id: 12, name: "My name") + /// ```` + RefreshLogOut call({ + String? error, + DateTime? finishedAt, + int id, + DateTime startedAt, + String trigger, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfRefreshLogOut.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfRefreshLogOut.copyWith.fieldName(...)` +class _$RefreshLogOutCWProxyImpl implements _$RefreshLogOutCWProxy { + const _$RefreshLogOutCWProxyImpl(this._value); + + final RefreshLogOut _value; + + @override + RefreshLogOut error(String? error) => this(error: error); + + @override + RefreshLogOut finishedAt(DateTime? finishedAt) => + this(finishedAt: finishedAt); + + @override + RefreshLogOut id(int id) => this(id: id); + + @override + RefreshLogOut startedAt(DateTime startedAt) => this(startedAt: startedAt); + + @override + RefreshLogOut trigger(String trigger) => this(trigger: trigger); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RefreshLogOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RefreshLogOut(...).copyWith(id: 12, name: "My name") + /// ```` + RefreshLogOut call({ + Object? error = const $CopyWithPlaceholder(), + Object? finishedAt = const $CopyWithPlaceholder(), + Object? id = const $CopyWithPlaceholder(), + Object? startedAt = const $CopyWithPlaceholder(), + Object? trigger = const $CopyWithPlaceholder(), + }) { + return RefreshLogOut( + error: error == const $CopyWithPlaceholder() + ? _value.error + // ignore: cast_nullable_to_non_nullable + : error as String?, + finishedAt: finishedAt == const $CopyWithPlaceholder() + ? _value.finishedAt + // ignore: cast_nullable_to_non_nullable + : finishedAt as DateTime?, + id: id == const $CopyWithPlaceholder() + ? _value.id + // ignore: cast_nullable_to_non_nullable + : id as int, + startedAt: startedAt == const $CopyWithPlaceholder() + ? _value.startedAt + // ignore: cast_nullable_to_non_nullable + : startedAt as DateTime, + trigger: trigger == const $CopyWithPlaceholder() + ? _value.trigger + // ignore: cast_nullable_to_non_nullable + : trigger as String, + ); + } +} + +extension $RefreshLogOutCopyWith on RefreshLogOut { + /// Returns a callable class that can be used as follows: `instanceOfRefreshLogOut.copyWith(...)` or like so:`instanceOfRefreshLogOut.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$RefreshLogOutCWProxy get copyWith => _$RefreshLogOutCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RefreshLogOut _$RefreshLogOutFromJson(Map json) => + $checkedCreate( + 'RefreshLogOut', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'error', + 'finished_at', + 'id', + 'started_at', + 'trigger', + ], + ); + final val = RefreshLogOut( + error: $checkedConvert('error', (v) => v as String?), + finishedAt: $checkedConvert( + 'finished_at', + (v) => v == null ? null : DateTime.parse(v as String), + ), + id: $checkedConvert('id', (v) => (v as num).toInt()), + startedAt: $checkedConvert( + 'started_at', + (v) => DateTime.parse(v as String), + ), + trigger: $checkedConvert('trigger', (v) => v as String), + ); + return val; + }, + fieldKeyMap: const { + 'finishedAt': 'finished_at', + 'startedAt': 'started_at', + }, + ); + +Map _$RefreshLogOutToJson(RefreshLogOut instance) => + { + 'error': instance.error, + 'finished_at': instance.finishedAt?.toIso8601String(), + 'id': instance.id, + 'started_at': instance.startedAt.toIso8601String(), + 'trigger': instance.trigger, + }; diff --git a/app/packages/api_client/lib/src/model/refresh_request.dart b/app/packages/api_client/lib/src/model/refresh_request.dart new file mode 100644 index 0000000..3f0bee8 --- /dev/null +++ b/app/packages/api_client/lib/src/model/refresh_request.dart @@ -0,0 +1,58 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'refresh_request.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class RefreshRequest { + /// Returns a new [RefreshRequest] instance. + RefreshRequest({ + + required this.refreshToken, + }); + + @JsonKey( + + name: r'refresh_token', + required: true, + includeIfNull: false, + ) + + + final String refreshToken; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is RefreshRequest && + other.refreshToken == refreshToken; + + @override + int get hashCode => + refreshToken.hashCode; + + factory RefreshRequest.fromJson(Map json) => _$RefreshRequestFromJson(json); + + Map toJson() => _$RefreshRequestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/refresh_request.g.dart b/app/packages/api_client/lib/src/model/refresh_request.g.dart new file mode 100644 index 0000000..aee63e6 --- /dev/null +++ b/app/packages/api_client/lib/src/model/refresh_request.g.dart @@ -0,0 +1,68 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'refresh_request.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$RefreshRequestCWProxy { + RefreshRequest refreshToken(String refreshToken); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RefreshRequest(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RefreshRequest(...).copyWith(id: 12, name: "My name") + /// ```` + RefreshRequest call({String refreshToken}); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfRefreshRequest.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfRefreshRequest.copyWith.fieldName(...)` +class _$RefreshRequestCWProxyImpl implements _$RefreshRequestCWProxy { + const _$RefreshRequestCWProxyImpl(this._value); + + final RefreshRequest _value; + + @override + RefreshRequest refreshToken(String refreshToken) => + this(refreshToken: refreshToken); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RefreshRequest(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RefreshRequest(...).copyWith(id: 12, name: "My name") + /// ```` + RefreshRequest call({Object? refreshToken = const $CopyWithPlaceholder()}) { + return RefreshRequest( + refreshToken: refreshToken == const $CopyWithPlaceholder() + ? _value.refreshToken + // ignore: cast_nullable_to_non_nullable + : refreshToken as String, + ); + } +} + +extension $RefreshRequestCopyWith on RefreshRequest { + /// Returns a callable class that can be used as follows: `instanceOfRefreshRequest.copyWith(...)` or like so:`instanceOfRefreshRequest.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$RefreshRequestCWProxy get copyWith => _$RefreshRequestCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RefreshRequest _$RefreshRequestFromJson(Map json) => + $checkedCreate('RefreshRequest', json, ($checkedConvert) { + $checkKeys(json, requiredKeys: const ['refresh_token']); + final val = RefreshRequest( + refreshToken: $checkedConvert('refresh_token', (v) => v as String), + ); + return val; + }, fieldKeyMap: const {'refreshToken': 'refresh_token'}); + +Map _$RefreshRequestToJson(RefreshRequest instance) => + {'refresh_token': instance.refreshToken}; diff --git a/app/packages/api_client/lib/src/model/rule_create.dart b/app/packages/api_client/lib/src/model/rule_create.dart new file mode 100644 index 0000000..1e58b8f --- /dev/null +++ b/app/packages/api_client/lib/src/model/rule_create.dart @@ -0,0 +1,158 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/rule_match_type.dart'; +import 'package:fintracker_api/src/model/rule_kind.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'rule_create.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class RuleCreate { + /// Returns a new [RuleCreate] instance. + RuleCreate({ + + this.enabled = true, + + required this.kind, + + required this.matchType, + + this.note, + + required this.pattern, + + this.priority = 100, + + this.value, + }); + + @JsonKey( + defaultValue: true, + name: r'enabled', + required: false, + includeIfNull: false, + ) + + + final bool? enabled; + + + + @JsonKey( + + name: r'kind', + required: true, + includeIfNull: false, + unknownEnumValue: RuleKind.unknownDefaultOpenApi, + ) + + + final RuleKind kind; + + + + @JsonKey( + + name: r'match_type', + required: true, + includeIfNull: false, + unknownEnumValue: RuleMatchType.unknownDefaultOpenApi, + ) + + + final RuleMatchType matchType; + + + + @JsonKey( + + name: r'note', + required: false, + includeIfNull: false, + ) + + + final String? note; + + + + @JsonKey( + + name: r'pattern', + required: true, + includeIfNull: false, + ) + + + final String pattern; + + + + @JsonKey( + defaultValue: 100, + name: r'priority', + required: false, + includeIfNull: false, + ) + + + final int? priority; + + + + @JsonKey( + + name: r'value', + required: false, + includeIfNull: false, + ) + + + final String? value; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is RuleCreate && + other.enabled == enabled && + other.kind == kind && + other.matchType == matchType && + other.note == note && + other.pattern == pattern && + other.priority == priority && + other.value == value; + + @override + int get hashCode => + enabled.hashCode + + kind.hashCode + + matchType.hashCode + + (note == null ? 0 : note.hashCode) + + pattern.hashCode + + priority.hashCode + + (value == null ? 0 : value.hashCode); + + factory RuleCreate.fromJson(Map json) => _$RuleCreateFromJson(json); + + Map toJson() => _$RuleCreateToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/rule_create.g.dart b/app/packages/api_client/lib/src/model/rule_create.g.dart new file mode 100644 index 0000000..c1e4948 --- /dev/null +++ b/app/packages/api_client/lib/src/model/rule_create.g.dart @@ -0,0 +1,189 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'rule_create.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$RuleCreateCWProxy { + RuleCreate enabled(bool? enabled); + + RuleCreate kind(RuleKind kind); + + RuleCreate matchType(RuleMatchType matchType); + + RuleCreate note(String? note); + + RuleCreate pattern(String pattern); + + RuleCreate priority(int? priority); + + RuleCreate value(String? value); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RuleCreate(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RuleCreate(...).copyWith(id: 12, name: "My name") + /// ```` + RuleCreate call({ + bool? enabled, + RuleKind kind, + RuleMatchType matchType, + String? note, + String pattern, + int? priority, + String? value, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfRuleCreate.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfRuleCreate.copyWith.fieldName(...)` +class _$RuleCreateCWProxyImpl implements _$RuleCreateCWProxy { + const _$RuleCreateCWProxyImpl(this._value); + + final RuleCreate _value; + + @override + RuleCreate enabled(bool? enabled) => this(enabled: enabled); + + @override + RuleCreate kind(RuleKind kind) => this(kind: kind); + + @override + RuleCreate matchType(RuleMatchType matchType) => this(matchType: matchType); + + @override + RuleCreate note(String? note) => this(note: note); + + @override + RuleCreate pattern(String pattern) => this(pattern: pattern); + + @override + RuleCreate priority(int? priority) => this(priority: priority); + + @override + RuleCreate value(String? value) => this(value: value); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RuleCreate(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RuleCreate(...).copyWith(id: 12, name: "My name") + /// ```` + RuleCreate call({ + Object? enabled = const $CopyWithPlaceholder(), + Object? kind = const $CopyWithPlaceholder(), + Object? matchType = const $CopyWithPlaceholder(), + Object? note = const $CopyWithPlaceholder(), + Object? pattern = const $CopyWithPlaceholder(), + Object? priority = const $CopyWithPlaceholder(), + Object? value = const $CopyWithPlaceholder(), + }) { + return RuleCreate( + enabled: enabled == const $CopyWithPlaceholder() + ? _value.enabled + // ignore: cast_nullable_to_non_nullable + : enabled as bool?, + kind: kind == const $CopyWithPlaceholder() + ? _value.kind + // ignore: cast_nullable_to_non_nullable + : kind as RuleKind, + matchType: matchType == const $CopyWithPlaceholder() + ? _value.matchType + // ignore: cast_nullable_to_non_nullable + : matchType as RuleMatchType, + note: note == const $CopyWithPlaceholder() + ? _value.note + // ignore: cast_nullable_to_non_nullable + : note as String?, + pattern: pattern == const $CopyWithPlaceholder() + ? _value.pattern + // ignore: cast_nullable_to_non_nullable + : pattern as String, + priority: priority == const $CopyWithPlaceholder() + ? _value.priority + // ignore: cast_nullable_to_non_nullable + : priority as int?, + value: value == const $CopyWithPlaceholder() + ? _value.value + // ignore: cast_nullable_to_non_nullable + : value as String?, + ); + } +} + +extension $RuleCreateCopyWith on RuleCreate { + /// Returns a callable class that can be used as follows: `instanceOfRuleCreate.copyWith(...)` or like so:`instanceOfRuleCreate.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$RuleCreateCWProxy get copyWith => _$RuleCreateCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RuleCreate _$RuleCreateFromJson(Map json) => $checkedCreate( + 'RuleCreate', + json, + ($checkedConvert) { + $checkKeys(json, requiredKeys: const ['kind', 'match_type', 'pattern']); + final val = RuleCreate( + enabled: $checkedConvert('enabled', (v) => v as bool? ?? true), + kind: $checkedConvert( + 'kind', + (v) => $enumDecode( + _$RuleKindEnumMap, + v, + unknownValue: RuleKind.unknownDefaultOpenApi, + ), + ), + matchType: $checkedConvert( + 'match_type', + (v) => $enumDecode( + _$RuleMatchTypeEnumMap, + v, + unknownValue: RuleMatchType.unknownDefaultOpenApi, + ), + ), + note: $checkedConvert('note', (v) => v as String?), + pattern: $checkedConvert('pattern', (v) => v as String), + priority: $checkedConvert('priority', (v) => (v as num?)?.toInt() ?? 100), + value: $checkedConvert('value', (v) => v as String?), + ); + return val; + }, + fieldKeyMap: const {'matchType': 'match_type'}, +); + +Map _$RuleCreateToJson(RuleCreate instance) => + { + 'enabled': ?instance.enabled, + 'kind': _$RuleKindEnumMap[instance.kind]!, + 'match_type': _$RuleMatchTypeEnumMap[instance.matchType]!, + 'note': ?instance.note, + 'pattern': instance.pattern, + 'priority': ?instance.priority, + 'value': ?instance.value, + }; + +const _$RuleKindEnumMap = { + RuleKind.savings: 'savings', + RuleKind.oneOff: 'one_off', + RuleKind.category: 'category', + RuleKind.payee: 'payee', + RuleKind.brokerTarget: 'broker_target', + RuleKind.ignore: 'ignore', + RuleKind.unknownDefaultOpenApi: 'unknown_default_open_api', +}; + +const _$RuleMatchTypeEnumMap = { + RuleMatchType.id: 'id', + RuleMatchType.payee: 'payee', + RuleMatchType.comment: 'comment', + RuleMatchType.category: 'category', + RuleMatchType.mcc: 'mcc', + RuleMatchType.account: 'account', + RuleMatchType.unknownDefaultOpenApi: 'unknown_default_open_api', +}; diff --git a/app/packages/api_client/lib/src/model/rule_kind.dart b/app/packages/api_client/lib/src/model/rule_kind.dart new file mode 100644 index 0000000..2950b14 --- /dev/null +++ b/app/packages/api_client/lib/src/model/rule_kind.dart @@ -0,0 +1,30 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum RuleKind { + @JsonValue(r'savings') + savings(r'savings'), + @JsonValue(r'one_off') + oneOff(r'one_off'), + @JsonValue(r'category') + category(r'category'), + @JsonValue(r'payee') + payee(r'payee'), + @JsonValue(r'broker_target') + brokerTarget(r'broker_target'), + @JsonValue(r'ignore') + ignore(r'ignore'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const RuleKind(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/app/packages/api_client/lib/src/model/rule_match_type.dart b/app/packages/api_client/lib/src/model/rule_match_type.dart new file mode 100644 index 0000000..4a3ac22 --- /dev/null +++ b/app/packages/api_client/lib/src/model/rule_match_type.dart @@ -0,0 +1,30 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum RuleMatchType { + @JsonValue(r'id') + id(r'id'), + @JsonValue(r'payee') + payee(r'payee'), + @JsonValue(r'comment') + comment(r'comment'), + @JsonValue(r'category') + category(r'category'), + @JsonValue(r'mcc') + mcc(r'mcc'), + @JsonValue(r'account') + account(r'account'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const RuleMatchType(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/app/packages/api_client/lib/src/model/rule_out.dart b/app/packages/api_client/lib/src/model/rule_out.dart new file mode 100644 index 0000000..3f58274 --- /dev/null +++ b/app/packages/api_client/lib/src/model/rule_out.dart @@ -0,0 +1,206 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/rule_match_type.dart'; +import 'package:fintracker_api/src/model/rule_kind.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'rule_out.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class RuleOut { + /// Returns a new [RuleOut] instance. + RuleOut({ + + required this.enabled, + + required this.id, + + required this.kind, + + required this.lastMatchedAt, + + required this.matchCount, + + required this.matchType, + + required this.note, + + required this.pattern, + + required this.priority, + + required this.value, + }); + + @JsonKey( + + name: r'enabled', + required: true, + includeIfNull: false, + ) + + + final bool enabled; + + + + @JsonKey( + + name: r'id', + required: true, + includeIfNull: false, + ) + + + final int id; + + + + @JsonKey( + + name: r'kind', + required: true, + includeIfNull: false, + unknownEnumValue: RuleKind.unknownDefaultOpenApi, + ) + + + final RuleKind kind; + + + + @JsonKey( + + name: r'last_matched_at', + required: true, + includeIfNull: true, + ) + + + final DateTime? lastMatchedAt; + + + + @JsonKey( + + name: r'match_count', + required: true, + includeIfNull: false, + ) + + + final int matchCount; + + + + @JsonKey( + + name: r'match_type', + required: true, + includeIfNull: false, + unknownEnumValue: RuleMatchType.unknownDefaultOpenApi, + ) + + + final RuleMatchType matchType; + + + + @JsonKey( + + name: r'note', + required: true, + includeIfNull: true, + ) + + + final String? note; + + + + @JsonKey( + + name: r'pattern', + required: true, + includeIfNull: false, + ) + + + final String pattern; + + + + @JsonKey( + + name: r'priority', + required: true, + includeIfNull: false, + ) + + + final int priority; + + + + @JsonKey( + + name: r'value', + required: true, + includeIfNull: true, + ) + + + final String? value; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is RuleOut && + other.enabled == enabled && + other.id == id && + other.kind == kind && + other.lastMatchedAt == lastMatchedAt && + other.matchCount == matchCount && + other.matchType == matchType && + other.note == note && + other.pattern == pattern && + other.priority == priority && + other.value == value; + + @override + int get hashCode => + enabled.hashCode + + id.hashCode + + kind.hashCode + + (lastMatchedAt == null ? 0 : lastMatchedAt.hashCode) + + matchCount.hashCode + + matchType.hashCode + + (note == null ? 0 : note.hashCode) + + pattern.hashCode + + priority.hashCode + + (value == null ? 0 : value.hashCode); + + factory RuleOut.fromJson(Map json) => _$RuleOutFromJson(json); + + Map toJson() => _$RuleOutToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/rule_out.g.dart b/app/packages/api_client/lib/src/model/rule_out.g.dart new file mode 100644 index 0000000..ffe94b1 --- /dev/null +++ b/app/packages/api_client/lib/src/model/rule_out.g.dart @@ -0,0 +1,249 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'rule_out.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$RuleOutCWProxy { + RuleOut enabled(bool enabled); + + RuleOut id(int id); + + RuleOut kind(RuleKind kind); + + RuleOut lastMatchedAt(DateTime? lastMatchedAt); + + RuleOut matchCount(int matchCount); + + RuleOut matchType(RuleMatchType matchType); + + RuleOut note(String? note); + + RuleOut pattern(String pattern); + + RuleOut priority(int priority); + + RuleOut value(String? value); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RuleOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RuleOut(...).copyWith(id: 12, name: "My name") + /// ```` + RuleOut call({ + bool enabled, + int id, + RuleKind kind, + DateTime? lastMatchedAt, + int matchCount, + RuleMatchType matchType, + String? note, + String pattern, + int priority, + String? value, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfRuleOut.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfRuleOut.copyWith.fieldName(...)` +class _$RuleOutCWProxyImpl implements _$RuleOutCWProxy { + const _$RuleOutCWProxyImpl(this._value); + + final RuleOut _value; + + @override + RuleOut enabled(bool enabled) => this(enabled: enabled); + + @override + RuleOut id(int id) => this(id: id); + + @override + RuleOut kind(RuleKind kind) => this(kind: kind); + + @override + RuleOut lastMatchedAt(DateTime? lastMatchedAt) => + this(lastMatchedAt: lastMatchedAt); + + @override + RuleOut matchCount(int matchCount) => this(matchCount: matchCount); + + @override + RuleOut matchType(RuleMatchType matchType) => this(matchType: matchType); + + @override + RuleOut note(String? note) => this(note: note); + + @override + RuleOut pattern(String pattern) => this(pattern: pattern); + + @override + RuleOut priority(int priority) => this(priority: priority); + + @override + RuleOut value(String? value) => this(value: value); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RuleOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RuleOut(...).copyWith(id: 12, name: "My name") + /// ```` + RuleOut call({ + Object? enabled = const $CopyWithPlaceholder(), + Object? id = const $CopyWithPlaceholder(), + Object? kind = const $CopyWithPlaceholder(), + Object? lastMatchedAt = const $CopyWithPlaceholder(), + Object? matchCount = const $CopyWithPlaceholder(), + Object? matchType = const $CopyWithPlaceholder(), + Object? note = const $CopyWithPlaceholder(), + Object? pattern = const $CopyWithPlaceholder(), + Object? priority = const $CopyWithPlaceholder(), + Object? value = const $CopyWithPlaceholder(), + }) { + return RuleOut( + enabled: enabled == const $CopyWithPlaceholder() + ? _value.enabled + // ignore: cast_nullable_to_non_nullable + : enabled as bool, + id: id == const $CopyWithPlaceholder() + ? _value.id + // ignore: cast_nullable_to_non_nullable + : id as int, + kind: kind == const $CopyWithPlaceholder() + ? _value.kind + // ignore: cast_nullable_to_non_nullable + : kind as RuleKind, + lastMatchedAt: lastMatchedAt == const $CopyWithPlaceholder() + ? _value.lastMatchedAt + // ignore: cast_nullable_to_non_nullable + : lastMatchedAt as DateTime?, + matchCount: matchCount == const $CopyWithPlaceholder() + ? _value.matchCount + // ignore: cast_nullable_to_non_nullable + : matchCount as int, + matchType: matchType == const $CopyWithPlaceholder() + ? _value.matchType + // ignore: cast_nullable_to_non_nullable + : matchType as RuleMatchType, + note: note == const $CopyWithPlaceholder() + ? _value.note + // ignore: cast_nullable_to_non_nullable + : note as String?, + pattern: pattern == const $CopyWithPlaceholder() + ? _value.pattern + // ignore: cast_nullable_to_non_nullable + : pattern as String, + priority: priority == const $CopyWithPlaceholder() + ? _value.priority + // ignore: cast_nullable_to_non_nullable + : priority as int, + value: value == const $CopyWithPlaceholder() + ? _value.value + // ignore: cast_nullable_to_non_nullable + : value as String?, + ); + } +} + +extension $RuleOutCopyWith on RuleOut { + /// Returns a callable class that can be used as follows: `instanceOfRuleOut.copyWith(...)` or like so:`instanceOfRuleOut.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$RuleOutCWProxy get copyWith => _$RuleOutCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RuleOut _$RuleOutFromJson(Map json) => $checkedCreate( + 'RuleOut', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'enabled', + 'id', + 'kind', + 'last_matched_at', + 'match_count', + 'match_type', + 'note', + 'pattern', + 'priority', + 'value', + ], + ); + final val = RuleOut( + enabled: $checkedConvert('enabled', (v) => v as bool), + id: $checkedConvert('id', (v) => (v as num).toInt()), + kind: $checkedConvert( + 'kind', + (v) => $enumDecode( + _$RuleKindEnumMap, + v, + unknownValue: RuleKind.unknownDefaultOpenApi, + ), + ), + lastMatchedAt: $checkedConvert( + 'last_matched_at', + (v) => v == null ? null : DateTime.parse(v as String), + ), + matchCount: $checkedConvert('match_count', (v) => (v as num).toInt()), + matchType: $checkedConvert( + 'match_type', + (v) => $enumDecode( + _$RuleMatchTypeEnumMap, + v, + unknownValue: RuleMatchType.unknownDefaultOpenApi, + ), + ), + note: $checkedConvert('note', (v) => v as String?), + pattern: $checkedConvert('pattern', (v) => v as String), + priority: $checkedConvert('priority', (v) => (v as num).toInt()), + value: $checkedConvert('value', (v) => v as String?), + ); + return val; + }, + fieldKeyMap: const { + 'lastMatchedAt': 'last_matched_at', + 'matchCount': 'match_count', + 'matchType': 'match_type', + }, +); + +Map _$RuleOutToJson(RuleOut instance) => { + 'enabled': instance.enabled, + 'id': instance.id, + 'kind': _$RuleKindEnumMap[instance.kind]!, + 'last_matched_at': instance.lastMatchedAt?.toIso8601String(), + 'match_count': instance.matchCount, + 'match_type': _$RuleMatchTypeEnumMap[instance.matchType]!, + 'note': instance.note, + 'pattern': instance.pattern, + 'priority': instance.priority, + 'value': instance.value, +}; + +const _$RuleKindEnumMap = { + RuleKind.savings: 'savings', + RuleKind.oneOff: 'one_off', + RuleKind.category: 'category', + RuleKind.payee: 'payee', + RuleKind.brokerTarget: 'broker_target', + RuleKind.ignore: 'ignore', + RuleKind.unknownDefaultOpenApi: 'unknown_default_open_api', +}; + +const _$RuleMatchTypeEnumMap = { + RuleMatchType.id: 'id', + RuleMatchType.payee: 'payee', + RuleMatchType.comment: 'comment', + RuleMatchType.category: 'category', + RuleMatchType.mcc: 'mcc', + RuleMatchType.account: 'account', + RuleMatchType.unknownDefaultOpenApi: 'unknown_default_open_api', +}; diff --git a/app/packages/api_client/lib/src/model/rule_patch.dart b/app/packages/api_client/lib/src/model/rule_patch.dart new file mode 100644 index 0000000..0a6860d --- /dev/null +++ b/app/packages/api_client/lib/src/model/rule_patch.dart @@ -0,0 +1,158 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/rule_match_type.dart'; +import 'package:fintracker_api/src/model/rule_kind.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'rule_patch.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class RulePatch { + /// Returns a new [RulePatch] instance. + RulePatch({ + + this.enabled, + + this.kind, + + this.matchType, + + this.note, + + this.pattern, + + this.priority, + + this.value, + }); + + @JsonKey( + + name: r'enabled', + required: false, + includeIfNull: false, + ) + + + final bool? enabled; + + + + @JsonKey( + + name: r'kind', + required: false, + includeIfNull: false, + unknownEnumValue: RuleKind.unknownDefaultOpenApi, + ) + + + final RuleKind? kind; + + + + @JsonKey( + + name: r'match_type', + required: false, + includeIfNull: false, + unknownEnumValue: RuleMatchType.unknownDefaultOpenApi, + ) + + + final RuleMatchType? matchType; + + + + @JsonKey( + + name: r'note', + required: false, + includeIfNull: false, + ) + + + final String? note; + + + + @JsonKey( + + name: r'pattern', + required: false, + includeIfNull: false, + ) + + + final String? pattern; + + + + @JsonKey( + + name: r'priority', + required: false, + includeIfNull: false, + ) + + + final int? priority; + + + + @JsonKey( + + name: r'value', + required: false, + includeIfNull: false, + ) + + + final String? value; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is RulePatch && + other.enabled == enabled && + other.kind == kind && + other.matchType == matchType && + other.note == note && + other.pattern == pattern && + other.priority == priority && + other.value == value; + + @override + int get hashCode => + (enabled == null ? 0 : enabled.hashCode) + + (kind == null ? 0 : kind.hashCode) + + (matchType == null ? 0 : matchType.hashCode) + + (note == null ? 0 : note.hashCode) + + (pattern == null ? 0 : pattern.hashCode) + + (priority == null ? 0 : priority.hashCode) + + (value == null ? 0 : value.hashCode); + + factory RulePatch.fromJson(Map json) => _$RulePatchFromJson(json); + + Map toJson() => _$RulePatchToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/rule_patch.g.dart b/app/packages/api_client/lib/src/model/rule_patch.g.dart new file mode 100644 index 0000000..82fd88a --- /dev/null +++ b/app/packages/api_client/lib/src/model/rule_patch.g.dart @@ -0,0 +1,183 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'rule_patch.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$RulePatchCWProxy { + RulePatch enabled(bool? enabled); + + RulePatch kind(RuleKind? kind); + + RulePatch matchType(RuleMatchType? matchType); + + RulePatch note(String? note); + + RulePatch pattern(String? pattern); + + RulePatch priority(int? priority); + + RulePatch value(String? value); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RulePatch(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RulePatch(...).copyWith(id: 12, name: "My name") + /// ```` + RulePatch call({ + bool? enabled, + RuleKind? kind, + RuleMatchType? matchType, + String? note, + String? pattern, + int? priority, + String? value, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfRulePatch.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfRulePatch.copyWith.fieldName(...)` +class _$RulePatchCWProxyImpl implements _$RulePatchCWProxy { + const _$RulePatchCWProxyImpl(this._value); + + final RulePatch _value; + + @override + RulePatch enabled(bool? enabled) => this(enabled: enabled); + + @override + RulePatch kind(RuleKind? kind) => this(kind: kind); + + @override + RulePatch matchType(RuleMatchType? matchType) => this(matchType: matchType); + + @override + RulePatch note(String? note) => this(note: note); + + @override + RulePatch pattern(String? pattern) => this(pattern: pattern); + + @override + RulePatch priority(int? priority) => this(priority: priority); + + @override + RulePatch value(String? value) => this(value: value); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RulePatch(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RulePatch(...).copyWith(id: 12, name: "My name") + /// ```` + RulePatch call({ + Object? enabled = const $CopyWithPlaceholder(), + Object? kind = const $CopyWithPlaceholder(), + Object? matchType = const $CopyWithPlaceholder(), + Object? note = const $CopyWithPlaceholder(), + Object? pattern = const $CopyWithPlaceholder(), + Object? priority = const $CopyWithPlaceholder(), + Object? value = const $CopyWithPlaceholder(), + }) { + return RulePatch( + enabled: enabled == const $CopyWithPlaceholder() + ? _value.enabled + // ignore: cast_nullable_to_non_nullable + : enabled as bool?, + kind: kind == const $CopyWithPlaceholder() + ? _value.kind + // ignore: cast_nullable_to_non_nullable + : kind as RuleKind?, + matchType: matchType == const $CopyWithPlaceholder() + ? _value.matchType + // ignore: cast_nullable_to_non_nullable + : matchType as RuleMatchType?, + note: note == const $CopyWithPlaceholder() + ? _value.note + // ignore: cast_nullable_to_non_nullable + : note as String?, + pattern: pattern == const $CopyWithPlaceholder() + ? _value.pattern + // ignore: cast_nullable_to_non_nullable + : pattern as String?, + priority: priority == const $CopyWithPlaceholder() + ? _value.priority + // ignore: cast_nullable_to_non_nullable + : priority as int?, + value: value == const $CopyWithPlaceholder() + ? _value.value + // ignore: cast_nullable_to_non_nullable + : value as String?, + ); + } +} + +extension $RulePatchCopyWith on RulePatch { + /// Returns a callable class that can be used as follows: `instanceOfRulePatch.copyWith(...)` or like so:`instanceOfRulePatch.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$RulePatchCWProxy get copyWith => _$RulePatchCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RulePatch _$RulePatchFromJson(Map json) => + $checkedCreate('RulePatch', json, ($checkedConvert) { + final val = RulePatch( + enabled: $checkedConvert('enabled', (v) => v as bool?), + kind: $checkedConvert( + 'kind', + (v) => $enumDecodeNullable( + _$RuleKindEnumMap, + v, + unknownValue: RuleKind.unknownDefaultOpenApi, + ), + ), + matchType: $checkedConvert( + 'match_type', + (v) => $enumDecodeNullable( + _$RuleMatchTypeEnumMap, + v, + unknownValue: RuleMatchType.unknownDefaultOpenApi, + ), + ), + note: $checkedConvert('note', (v) => v as String?), + pattern: $checkedConvert('pattern', (v) => v as String?), + priority: $checkedConvert('priority', (v) => (v as num?)?.toInt()), + value: $checkedConvert('value', (v) => v as String?), + ); + return val; + }, fieldKeyMap: const {'matchType': 'match_type'}); + +Map _$RulePatchToJson(RulePatch instance) => { + 'enabled': ?instance.enabled, + 'kind': ?_$RuleKindEnumMap[instance.kind], + 'match_type': ?_$RuleMatchTypeEnumMap[instance.matchType], + 'note': ?instance.note, + 'pattern': ?instance.pattern, + 'priority': ?instance.priority, + 'value': ?instance.value, +}; + +const _$RuleKindEnumMap = { + RuleKind.savings: 'savings', + RuleKind.oneOff: 'one_off', + RuleKind.category: 'category', + RuleKind.payee: 'payee', + RuleKind.brokerTarget: 'broker_target', + RuleKind.ignore: 'ignore', + RuleKind.unknownDefaultOpenApi: 'unknown_default_open_api', +}; + +const _$RuleMatchTypeEnumMap = { + RuleMatchType.id: 'id', + RuleMatchType.payee: 'payee', + RuleMatchType.comment: 'comment', + RuleMatchType.category: 'category', + RuleMatchType.mcc: 'mcc', + RuleMatchType.account: 'account', + RuleMatchType.unknownDefaultOpenApi: 'unknown_default_open_api', +}; diff --git a/app/packages/api_client/lib/src/model/run_status.dart b/app/packages/api_client/lib/src/model/run_status.dart new file mode 100644 index 0000000..5f91101 --- /dev/null +++ b/app/packages/api_client/lib/src/model/run_status.dart @@ -0,0 +1,24 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum RunStatus { + @JsonValue(r'running') + running(r'running'), + @JsonValue(r'ok') + ok(r'ok'), + @JsonValue(r'error') + error(r'error'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const RunStatus(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/app/packages/api_client/lib/src/model/runway_out.dart b/app/packages/api_client/lib/src/model/runway_out.dart new file mode 100644 index 0000000..416f66e --- /dev/null +++ b/app/packages/api_client/lib/src/model/runway_out.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'runway_out.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class RunwayOut { + /// Returns a new [RunwayOut] instance. + RunwayOut({ + + required this.asOf, + + required this.avgBaseline3mRub, + + required this.liquidReserveRub, + + required this.runwayMonths, + }); + + @JsonKey( + + name: r'as_of', + required: true, + includeIfNull: false, + ) + + + final DateTime asOf; + + + + /// decimal as string + @JsonKey( + + name: r'avg_baseline_3m_rub', + required: true, + includeIfNull: false, + ) + + + final String avgBaseline3mRub; + + + + /// decimal as string + @JsonKey( + + name: r'liquid_reserve_rub', + required: true, + includeIfNull: false, + ) + + + final String liquidReserveRub; + + + + /// decimal as string + @JsonKey( + + name: r'runway_months', + required: true, + includeIfNull: true, + ) + + + final String? runwayMonths; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is RunwayOut && + other.asOf == asOf && + other.avgBaseline3mRub == avgBaseline3mRub && + other.liquidReserveRub == liquidReserveRub && + other.runwayMonths == runwayMonths; + + @override + int get hashCode => + asOf.hashCode + + avgBaseline3mRub.hashCode + + liquidReserveRub.hashCode + + (runwayMonths == null ? 0 : runwayMonths.hashCode); + + factory RunwayOut.fromJson(Map json) => _$RunwayOutFromJson(json); + + Map toJson() => _$RunwayOutToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/runway_out.g.dart b/app/packages/api_client/lib/src/model/runway_out.g.dart new file mode 100644 index 0000000..45eb3fc --- /dev/null +++ b/app/packages/api_client/lib/src/model/runway_out.g.dart @@ -0,0 +1,137 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'runway_out.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$RunwayOutCWProxy { + RunwayOut asOf(DateTime asOf); + + RunwayOut avgBaseline3mRub(String avgBaseline3mRub); + + RunwayOut liquidReserveRub(String liquidReserveRub); + + RunwayOut runwayMonths(String? runwayMonths); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RunwayOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RunwayOut(...).copyWith(id: 12, name: "My name") + /// ```` + RunwayOut call({ + DateTime asOf, + String avgBaseline3mRub, + String liquidReserveRub, + String? runwayMonths, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfRunwayOut.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfRunwayOut.copyWith.fieldName(...)` +class _$RunwayOutCWProxyImpl implements _$RunwayOutCWProxy { + const _$RunwayOutCWProxyImpl(this._value); + + final RunwayOut _value; + + @override + RunwayOut asOf(DateTime asOf) => this(asOf: asOf); + + @override + RunwayOut avgBaseline3mRub(String avgBaseline3mRub) => + this(avgBaseline3mRub: avgBaseline3mRub); + + @override + RunwayOut liquidReserveRub(String liquidReserveRub) => + this(liquidReserveRub: liquidReserveRub); + + @override + RunwayOut runwayMonths(String? runwayMonths) => + this(runwayMonths: runwayMonths); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RunwayOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// RunwayOut(...).copyWith(id: 12, name: "My name") + /// ```` + RunwayOut call({ + Object? asOf = const $CopyWithPlaceholder(), + Object? avgBaseline3mRub = const $CopyWithPlaceholder(), + Object? liquidReserveRub = const $CopyWithPlaceholder(), + Object? runwayMonths = const $CopyWithPlaceholder(), + }) { + return RunwayOut( + asOf: asOf == const $CopyWithPlaceholder() + ? _value.asOf + // ignore: cast_nullable_to_non_nullable + : asOf as DateTime, + avgBaseline3mRub: avgBaseline3mRub == const $CopyWithPlaceholder() + ? _value.avgBaseline3mRub + // ignore: cast_nullable_to_non_nullable + : avgBaseline3mRub as String, + liquidReserveRub: liquidReserveRub == const $CopyWithPlaceholder() + ? _value.liquidReserveRub + // ignore: cast_nullable_to_non_nullable + : liquidReserveRub as String, + runwayMonths: runwayMonths == const $CopyWithPlaceholder() + ? _value.runwayMonths + // ignore: cast_nullable_to_non_nullable + : runwayMonths as String?, + ); + } +} + +extension $RunwayOutCopyWith on RunwayOut { + /// Returns a callable class that can be used as follows: `instanceOfRunwayOut.copyWith(...)` or like so:`instanceOfRunwayOut.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$RunwayOutCWProxy get copyWith => _$RunwayOutCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +RunwayOut _$RunwayOutFromJson(Map json) => $checkedCreate( + 'RunwayOut', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'as_of', + 'avg_baseline_3m_rub', + 'liquid_reserve_rub', + 'runway_months', + ], + ); + final val = RunwayOut( + asOf: $checkedConvert('as_of', (v) => DateTime.parse(v as String)), + avgBaseline3mRub: $checkedConvert( + 'avg_baseline_3m_rub', + (v) => v as String, + ), + liquidReserveRub: $checkedConvert( + 'liquid_reserve_rub', + (v) => v as String, + ), + runwayMonths: $checkedConvert('runway_months', (v) => v as String?), + ); + return val; + }, + fieldKeyMap: const { + 'asOf': 'as_of', + 'avgBaseline3mRub': 'avg_baseline_3m_rub', + 'liquidReserveRub': 'liquid_reserve_rub', + 'runwayMonths': 'runway_months', + }, +); + +Map _$RunwayOutToJson(RunwayOut instance) => { + 'as_of': instance.asOf.toIso8601String(), + 'avg_baseline_3m_rub': instance.avgBaseline3mRub, + 'liquid_reserve_rub': instance.liquidReserveRub, + 'runway_months': instance.runwayMonths, +}; diff --git a/app/packages/api_client/lib/src/model/source_status.dart b/app/packages/api_client/lib/src/model/source_status.dart new file mode 100644 index 0000000..f086dd8 --- /dev/null +++ b/app/packages/api_client/lib/src/model/source_status.dart @@ -0,0 +1,140 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/run_status.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'source_status.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class SourceStatus { + /// Returns a new [SourceStatus] instance. + SourceStatus({ + + required this.cursor, + + required this.lastRunAt, + + required this.lastRunStatus, + + required this.lastSuccessAt, + + required this.queued, + + required this.source_, + }); + + @JsonKey( + + name: r'cursor', + required: true, + includeIfNull: true, + ) + + + final String? cursor; + + + + @JsonKey( + + name: r'last_run_at', + required: true, + includeIfNull: true, + ) + + + final DateTime? lastRunAt; + + + + @JsonKey( + + name: r'last_run_status', + required: true, + includeIfNull: true, + unknownEnumValue: RunStatus.unknownDefaultOpenApi, + ) + + + final RunStatus? lastRunStatus; + + + + @JsonKey( + + name: r'last_success_at', + required: true, + includeIfNull: true, + ) + + + final DateTime? lastSuccessAt; + + + + @JsonKey( + + name: r'queued', + required: true, + includeIfNull: false, + ) + + + final bool queued; + + + + @JsonKey( + + name: r'source', + required: true, + includeIfNull: false, + ) + + + final String source_; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is SourceStatus && + other.cursor == cursor && + other.lastRunAt == lastRunAt && + other.lastRunStatus == lastRunStatus && + other.lastSuccessAt == lastSuccessAt && + other.queued == queued && + other.source_ == source_; + + @override + int get hashCode => + (cursor == null ? 0 : cursor.hashCode) + + (lastRunAt == null ? 0 : lastRunAt.hashCode) + + (lastRunStatus == null ? 0 : lastRunStatus.hashCode) + + (lastSuccessAt == null ? 0 : lastSuccessAt.hashCode) + + queued.hashCode + + source_.hashCode; + + factory SourceStatus.fromJson(Map json) => _$SourceStatusFromJson(json); + + Map toJson() => _$SourceStatusToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/source_status.g.dart b/app/packages/api_client/lib/src/model/source_status.g.dart new file mode 100644 index 0000000..8d01e5b --- /dev/null +++ b/app/packages/api_client/lib/src/model/source_status.g.dart @@ -0,0 +1,180 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'source_status.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$SourceStatusCWProxy { + SourceStatus cursor(String? cursor); + + SourceStatus lastRunAt(DateTime? lastRunAt); + + SourceStatus lastRunStatus(RunStatus? lastRunStatus); + + SourceStatus lastSuccessAt(DateTime? lastSuccessAt); + + SourceStatus queued(bool queued); + + SourceStatus source_(String source_); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SourceStatus(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// SourceStatus(...).copyWith(id: 12, name: "My name") + /// ```` + SourceStatus call({ + String? cursor, + DateTime? lastRunAt, + RunStatus? lastRunStatus, + DateTime? lastSuccessAt, + bool queued, + String source_, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfSourceStatus.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfSourceStatus.copyWith.fieldName(...)` +class _$SourceStatusCWProxyImpl implements _$SourceStatusCWProxy { + const _$SourceStatusCWProxyImpl(this._value); + + final SourceStatus _value; + + @override + SourceStatus cursor(String? cursor) => this(cursor: cursor); + + @override + SourceStatus lastRunAt(DateTime? lastRunAt) => this(lastRunAt: lastRunAt); + + @override + SourceStatus lastRunStatus(RunStatus? lastRunStatus) => + this(lastRunStatus: lastRunStatus); + + @override + SourceStatus lastSuccessAt(DateTime? lastSuccessAt) => + this(lastSuccessAt: lastSuccessAt); + + @override + SourceStatus queued(bool queued) => this(queued: queued); + + @override + SourceStatus source_(String source_) => this(source_: source_); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SourceStatus(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// SourceStatus(...).copyWith(id: 12, name: "My name") + /// ```` + SourceStatus call({ + Object? cursor = const $CopyWithPlaceholder(), + Object? lastRunAt = const $CopyWithPlaceholder(), + Object? lastRunStatus = const $CopyWithPlaceholder(), + Object? lastSuccessAt = const $CopyWithPlaceholder(), + Object? queued = const $CopyWithPlaceholder(), + Object? source_ = const $CopyWithPlaceholder(), + }) { + return SourceStatus( + cursor: cursor == const $CopyWithPlaceholder() + ? _value.cursor + // ignore: cast_nullable_to_non_nullable + : cursor as String?, + lastRunAt: lastRunAt == const $CopyWithPlaceholder() + ? _value.lastRunAt + // ignore: cast_nullable_to_non_nullable + : lastRunAt as DateTime?, + lastRunStatus: lastRunStatus == const $CopyWithPlaceholder() + ? _value.lastRunStatus + // ignore: cast_nullable_to_non_nullable + : lastRunStatus as RunStatus?, + lastSuccessAt: lastSuccessAt == const $CopyWithPlaceholder() + ? _value.lastSuccessAt + // ignore: cast_nullable_to_non_nullable + : lastSuccessAt as DateTime?, + queued: queued == const $CopyWithPlaceholder() + ? _value.queued + // ignore: cast_nullable_to_non_nullable + : queued as bool, + source_: source_ == const $CopyWithPlaceholder() + ? _value.source_ + // ignore: cast_nullable_to_non_nullable + : source_ as String, + ); + } +} + +extension $SourceStatusCopyWith on SourceStatus { + /// Returns a callable class that can be used as follows: `instanceOfSourceStatus.copyWith(...)` or like so:`instanceOfSourceStatus.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$SourceStatusCWProxy get copyWith => _$SourceStatusCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SourceStatus _$SourceStatusFromJson(Map json) => + $checkedCreate( + 'SourceStatus', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'cursor', + 'last_run_at', + 'last_run_status', + 'last_success_at', + 'queued', + 'source', + ], + ); + final val = SourceStatus( + cursor: $checkedConvert('cursor', (v) => v as String?), + lastRunAt: $checkedConvert( + 'last_run_at', + (v) => v == null ? null : DateTime.parse(v as String), + ), + lastRunStatus: $checkedConvert( + 'last_run_status', + (v) => $enumDecodeNullable( + _$RunStatusEnumMap, + v, + unknownValue: RunStatus.unknownDefaultOpenApi, + ), + ), + lastSuccessAt: $checkedConvert( + 'last_success_at', + (v) => v == null ? null : DateTime.parse(v as String), + ), + queued: $checkedConvert('queued', (v) => v as bool), + source_: $checkedConvert('source', (v) => v as String), + ); + return val; + }, + fieldKeyMap: const { + 'lastRunAt': 'last_run_at', + 'lastRunStatus': 'last_run_status', + 'lastSuccessAt': 'last_success_at', + 'source_': 'source', + }, + ); + +Map _$SourceStatusToJson(SourceStatus instance) => + { + 'cursor': instance.cursor, + 'last_run_at': instance.lastRunAt?.toIso8601String(), + 'last_run_status': _$RunStatusEnumMap[instance.lastRunStatus], + 'last_success_at': instance.lastSuccessAt?.toIso8601String(), + 'queued': instance.queued, + 'source': instance.source_, + }; + +const _$RunStatusEnumMap = { + RunStatus.running: 'running', + RunStatus.ok: 'ok', + RunStatus.error: 'error', + RunStatus.unknownDefaultOpenApi: 'unknown_default_open_api', +}; diff --git a/app/packages/api_client/lib/src/model/spending_row.dart b/app/packages/api_client/lib/src/model/spending_row.dart new file mode 100644 index 0000000..bac967c --- /dev/null +++ b/app/packages/api_client/lib/src/model/spending_row.dart @@ -0,0 +1,155 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'spending_row.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class SpendingRow { + /// Returns a new [SpendingRow] instance. + SpendingRow({ + + required this.amountRub, + + required this.categoryId, + + required this.categoryName, + + required this.month, + + required this.rootCategoryId, + + required this.rootCategoryName, + + required this.txnCount, + }); + + /// decimal as string + @JsonKey( + + name: r'amount_rub', + required: true, + includeIfNull: false, + ) + + + final String amountRub; + + + + @JsonKey( + + name: r'category_id', + required: true, + includeIfNull: true, + ) + + + final int? categoryId; + + + + @JsonKey( + + name: r'category_name', + required: true, + includeIfNull: true, + ) + + + final String? categoryName; + + + + @JsonKey( + + name: r'month', + required: true, + includeIfNull: false, + ) + + + final DateTime month; + + + + @JsonKey( + + name: r'root_category_id', + required: true, + includeIfNull: true, + ) + + + final int? rootCategoryId; + + + + @JsonKey( + + name: r'root_category_name', + required: true, + includeIfNull: true, + ) + + + final String? rootCategoryName; + + + + @JsonKey( + + name: r'txn_count', + required: true, + includeIfNull: false, + ) + + + final int txnCount; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is SpendingRow && + other.amountRub == amountRub && + other.categoryId == categoryId && + other.categoryName == categoryName && + other.month == month && + other.rootCategoryId == rootCategoryId && + other.rootCategoryName == rootCategoryName && + other.txnCount == txnCount; + + @override + int get hashCode => + amountRub.hashCode + + (categoryId == null ? 0 : categoryId.hashCode) + + (categoryName == null ? 0 : categoryName.hashCode) + + month.hashCode + + (rootCategoryId == null ? 0 : rootCategoryId.hashCode) + + (rootCategoryName == null ? 0 : rootCategoryName.hashCode) + + txnCount.hashCode; + + factory SpendingRow.fromJson(Map json) => _$SpendingRowFromJson(json); + + Map toJson() => _$SpendingRowToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/spending_row.g.dart b/app/packages/api_client/lib/src/model/spending_row.g.dart new file mode 100644 index 0000000..6433e42 --- /dev/null +++ b/app/packages/api_client/lib/src/model/spending_row.g.dart @@ -0,0 +1,182 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'spending_row.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$SpendingRowCWProxy { + SpendingRow amountRub(String amountRub); + + SpendingRow categoryId(int? categoryId); + + SpendingRow categoryName(String? categoryName); + + SpendingRow month(DateTime month); + + SpendingRow rootCategoryId(int? rootCategoryId); + + SpendingRow rootCategoryName(String? rootCategoryName); + + SpendingRow txnCount(int txnCount); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SpendingRow(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// SpendingRow(...).copyWith(id: 12, name: "My name") + /// ```` + SpendingRow call({ + String amountRub, + int? categoryId, + String? categoryName, + DateTime month, + int? rootCategoryId, + String? rootCategoryName, + int txnCount, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfSpendingRow.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfSpendingRow.copyWith.fieldName(...)` +class _$SpendingRowCWProxyImpl implements _$SpendingRowCWProxy { + const _$SpendingRowCWProxyImpl(this._value); + + final SpendingRow _value; + + @override + SpendingRow amountRub(String amountRub) => this(amountRub: amountRub); + + @override + SpendingRow categoryId(int? categoryId) => this(categoryId: categoryId); + + @override + SpendingRow categoryName(String? categoryName) => + this(categoryName: categoryName); + + @override + SpendingRow month(DateTime month) => this(month: month); + + @override + SpendingRow rootCategoryId(int? rootCategoryId) => + this(rootCategoryId: rootCategoryId); + + @override + SpendingRow rootCategoryName(String? rootCategoryName) => + this(rootCategoryName: rootCategoryName); + + @override + SpendingRow txnCount(int txnCount) => this(txnCount: txnCount); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SpendingRow(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// SpendingRow(...).copyWith(id: 12, name: "My name") + /// ```` + SpendingRow call({ + Object? amountRub = const $CopyWithPlaceholder(), + Object? categoryId = const $CopyWithPlaceholder(), + Object? categoryName = const $CopyWithPlaceholder(), + Object? month = const $CopyWithPlaceholder(), + Object? rootCategoryId = const $CopyWithPlaceholder(), + Object? rootCategoryName = const $CopyWithPlaceholder(), + Object? txnCount = const $CopyWithPlaceholder(), + }) { + return SpendingRow( + amountRub: amountRub == const $CopyWithPlaceholder() + ? _value.amountRub + // ignore: cast_nullable_to_non_nullable + : amountRub as String, + categoryId: categoryId == const $CopyWithPlaceholder() + ? _value.categoryId + // ignore: cast_nullable_to_non_nullable + : categoryId as int?, + categoryName: categoryName == const $CopyWithPlaceholder() + ? _value.categoryName + // ignore: cast_nullable_to_non_nullable + : categoryName as String?, + month: month == const $CopyWithPlaceholder() + ? _value.month + // ignore: cast_nullable_to_non_nullable + : month as DateTime, + rootCategoryId: rootCategoryId == const $CopyWithPlaceholder() + ? _value.rootCategoryId + // ignore: cast_nullable_to_non_nullable + : rootCategoryId as int?, + rootCategoryName: rootCategoryName == const $CopyWithPlaceholder() + ? _value.rootCategoryName + // ignore: cast_nullable_to_non_nullable + : rootCategoryName as String?, + txnCount: txnCount == const $CopyWithPlaceholder() + ? _value.txnCount + // ignore: cast_nullable_to_non_nullable + : txnCount as int, + ); + } +} + +extension $SpendingRowCopyWith on SpendingRow { + /// Returns a callable class that can be used as follows: `instanceOfSpendingRow.copyWith(...)` or like so:`instanceOfSpendingRow.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$SpendingRowCWProxy get copyWith => _$SpendingRowCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SpendingRow _$SpendingRowFromJson(Map json) => $checkedCreate( + 'SpendingRow', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'amount_rub', + 'category_id', + 'category_name', + 'month', + 'root_category_id', + 'root_category_name', + 'txn_count', + ], + ); + final val = SpendingRow( + amountRub: $checkedConvert('amount_rub', (v) => v as String), + categoryId: $checkedConvert('category_id', (v) => (v as num?)?.toInt()), + categoryName: $checkedConvert('category_name', (v) => v as String?), + month: $checkedConvert('month', (v) => DateTime.parse(v as String)), + rootCategoryId: $checkedConvert( + 'root_category_id', + (v) => (v as num?)?.toInt(), + ), + rootCategoryName: $checkedConvert( + 'root_category_name', + (v) => v as String?, + ), + txnCount: $checkedConvert('txn_count', (v) => (v as num).toInt()), + ); + return val; + }, + fieldKeyMap: const { + 'amountRub': 'amount_rub', + 'categoryId': 'category_id', + 'categoryName': 'category_name', + 'rootCategoryId': 'root_category_id', + 'rootCategoryName': 'root_category_name', + 'txnCount': 'txn_count', + }, +); + +Map _$SpendingRowToJson(SpendingRow instance) => + { + 'amount_rub': instance.amountRub, + 'category_id': instance.categoryId, + 'category_name': instance.categoryName, + 'month': instance.month.toIso8601String(), + 'root_category_id': instance.rootCategoryId, + 'root_category_name': instance.rootCategoryName, + 'txn_count': instance.txnCount, + }; diff --git a/app/packages/api_client/lib/src/model/sync_job_out.dart b/app/packages/api_client/lib/src/model/sync_job_out.dart new file mode 100644 index 0000000..717af0a --- /dev/null +++ b/app/packages/api_client/lib/src/model/sync_job_out.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/job_status.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'sync_job_out.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class SyncJobOut { + /// Returns a new [SyncJobOut] instance. + SyncJobOut({ + + required this.id, + + required this.requestedAt, + + required this.source_, + + required this.status, + }); + + @JsonKey( + + name: r'id', + required: true, + includeIfNull: false, + ) + + + final String id; + + + + @JsonKey( + + name: r'requested_at', + required: true, + includeIfNull: false, + ) + + + final DateTime requestedAt; + + + + @JsonKey( + + name: r'source', + required: true, + includeIfNull: false, + ) + + + final String source_; + + + + @JsonKey( + + name: r'status', + required: true, + includeIfNull: false, + unknownEnumValue: JobStatus.unknownDefaultOpenApi, + ) + + + final JobStatus status; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is SyncJobOut && + other.id == id && + other.requestedAt == requestedAt && + other.source_ == source_ && + other.status == status; + + @override + int get hashCode => + id.hashCode + + requestedAt.hashCode + + source_.hashCode + + status.hashCode; + + factory SyncJobOut.fromJson(Map json) => _$SyncJobOutFromJson(json); + + Map toJson() => _$SyncJobOutToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/sync_job_out.g.dart b/app/packages/api_client/lib/src/model/sync_job_out.g.dart new file mode 100644 index 0000000..7c99160 --- /dev/null +++ b/app/packages/api_client/lib/src/model/sync_job_out.g.dart @@ -0,0 +1,138 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'sync_job_out.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$SyncJobOutCWProxy { + SyncJobOut id(String id); + + SyncJobOut requestedAt(DateTime requestedAt); + + SyncJobOut source_(String source_); + + SyncJobOut status(JobStatus status); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SyncJobOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// SyncJobOut(...).copyWith(id: 12, name: "My name") + /// ```` + SyncJobOut call({ + String id, + DateTime requestedAt, + String source_, + JobStatus status, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfSyncJobOut.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfSyncJobOut.copyWith.fieldName(...)` +class _$SyncJobOutCWProxyImpl implements _$SyncJobOutCWProxy { + const _$SyncJobOutCWProxyImpl(this._value); + + final SyncJobOut _value; + + @override + SyncJobOut id(String id) => this(id: id); + + @override + SyncJobOut requestedAt(DateTime requestedAt) => + this(requestedAt: requestedAt); + + @override + SyncJobOut source_(String source_) => this(source_: source_); + + @override + SyncJobOut status(JobStatus status) => this(status: status); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SyncJobOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// SyncJobOut(...).copyWith(id: 12, name: "My name") + /// ```` + SyncJobOut call({ + Object? id = const $CopyWithPlaceholder(), + Object? requestedAt = const $CopyWithPlaceholder(), + Object? source_ = const $CopyWithPlaceholder(), + Object? status = const $CopyWithPlaceholder(), + }) { + return SyncJobOut( + id: id == const $CopyWithPlaceholder() + ? _value.id + // ignore: cast_nullable_to_non_nullable + : id as String, + requestedAt: requestedAt == const $CopyWithPlaceholder() + ? _value.requestedAt + // ignore: cast_nullable_to_non_nullable + : requestedAt as DateTime, + source_: source_ == const $CopyWithPlaceholder() + ? _value.source_ + // ignore: cast_nullable_to_non_nullable + : source_ as String, + status: status == const $CopyWithPlaceholder() + ? _value.status + // ignore: cast_nullable_to_non_nullable + : status as JobStatus, + ); + } +} + +extension $SyncJobOutCopyWith on SyncJobOut { + /// Returns a callable class that can be used as follows: `instanceOfSyncJobOut.copyWith(...)` or like so:`instanceOfSyncJobOut.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$SyncJobOutCWProxy get copyWith => _$SyncJobOutCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SyncJobOut _$SyncJobOutFromJson(Map json) => $checkedCreate( + 'SyncJobOut', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const ['id', 'requested_at', 'source', 'status'], + ); + final val = SyncJobOut( + id: $checkedConvert('id', (v) => v as String), + requestedAt: $checkedConvert( + 'requested_at', + (v) => DateTime.parse(v as String), + ), + source_: $checkedConvert('source', (v) => v as String), + status: $checkedConvert( + 'status', + (v) => $enumDecode( + _$JobStatusEnumMap, + v, + unknownValue: JobStatus.unknownDefaultOpenApi, + ), + ), + ); + return val; + }, + fieldKeyMap: const {'requestedAt': 'requested_at', 'source_': 'source'}, +); + +Map _$SyncJobOutToJson(SyncJobOut instance) => + { + 'id': instance.id, + 'requested_at': instance.requestedAt.toIso8601String(), + 'source': instance.source_, + 'status': _$JobStatusEnumMap[instance.status]!, + }; + +const _$JobStatusEnumMap = { + JobStatus.queued: 'queued', + JobStatus.running: 'running', + JobStatus.done: 'done', + JobStatus.error: 'error', + JobStatus.unknownDefaultOpenApi: 'unknown_default_open_api', +}; diff --git a/app/packages/api_client/lib/src/model/sync_run_out.dart b/app/packages/api_client/lib/src/model/sync_run_out.dart new file mode 100644 index 0000000..14f15b4 --- /dev/null +++ b/app/packages/api_client/lib/src/model/sync_run_out.dart @@ -0,0 +1,220 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/run_status.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'sync_run_out.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class SyncRunOut { + /// Returns a new [SyncRunOut] instance. + SyncRunOut({ + + required this.counts, + + required this.cursorAfter, + + required this.cursorBefore, + + required this.error, + + required this.finishedAt, + + required this.id, + + required this.source_, + + required this.startedAt, + + required this.status, + + required this.triggeredBy, + + required this.warnings, + }); + + @JsonKey( + + name: r'counts', + required: true, + includeIfNull: true, + ) + + + final Map? counts; + + + + @JsonKey( + + name: r'cursor_after', + required: true, + includeIfNull: true, + ) + + + final String? cursorAfter; + + + + @JsonKey( + + name: r'cursor_before', + required: true, + includeIfNull: true, + ) + + + final String? cursorBefore; + + + + @JsonKey( + + name: r'error', + required: true, + includeIfNull: true, + ) + + + final String? error; + + + + @JsonKey( + + name: r'finished_at', + required: true, + includeIfNull: true, + ) + + + final DateTime? finishedAt; + + + + @JsonKey( + + name: r'id', + required: true, + includeIfNull: false, + ) + + + final String id; + + + + @JsonKey( + + name: r'source', + required: true, + includeIfNull: false, + ) + + + final String source_; + + + + @JsonKey( + + name: r'started_at', + required: true, + includeIfNull: false, + ) + + + final DateTime startedAt; + + + + @JsonKey( + + name: r'status', + required: true, + includeIfNull: false, + unknownEnumValue: RunStatus.unknownDefaultOpenApi, + ) + + + final RunStatus status; + + + + @JsonKey( + + name: r'triggered_by', + required: true, + includeIfNull: false, + ) + + + final String triggeredBy; + + + + @JsonKey( + + name: r'warnings', + required: true, + includeIfNull: true, + ) + + + final List? warnings; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is SyncRunOut && + other.counts == counts && + other.cursorAfter == cursorAfter && + other.cursorBefore == cursorBefore && + other.error == error && + other.finishedAt == finishedAt && + other.id == id && + other.source_ == source_ && + other.startedAt == startedAt && + other.status == status && + other.triggeredBy == triggeredBy && + other.warnings == warnings; + + @override + int get hashCode => + (counts == null ? 0 : counts.hashCode) + + (cursorAfter == null ? 0 : cursorAfter.hashCode) + + (cursorBefore == null ? 0 : cursorBefore.hashCode) + + (error == null ? 0 : error.hashCode) + + (finishedAt == null ? 0 : finishedAt.hashCode) + + id.hashCode + + source_.hashCode + + startedAt.hashCode + + status.hashCode + + triggeredBy.hashCode + + (warnings == null ? 0 : warnings.hashCode); + + factory SyncRunOut.fromJson(Map json) => _$SyncRunOutFromJson(json); + + Map toJson() => _$SyncRunOutToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/sync_run_out.g.dart b/app/packages/api_client/lib/src/model/sync_run_out.g.dart new file mode 100644 index 0000000..321ac23 --- /dev/null +++ b/app/packages/api_client/lib/src/model/sync_run_out.g.dart @@ -0,0 +1,258 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'sync_run_out.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$SyncRunOutCWProxy { + SyncRunOut counts(Map? counts); + + SyncRunOut cursorAfter(String? cursorAfter); + + SyncRunOut cursorBefore(String? cursorBefore); + + SyncRunOut error(String? error); + + SyncRunOut finishedAt(DateTime? finishedAt); + + SyncRunOut id(String id); + + SyncRunOut source_(String source_); + + SyncRunOut startedAt(DateTime startedAt); + + SyncRunOut status(RunStatus status); + + SyncRunOut triggeredBy(String triggeredBy); + + SyncRunOut warnings(List? warnings); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SyncRunOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// SyncRunOut(...).copyWith(id: 12, name: "My name") + /// ```` + SyncRunOut call({ + Map? counts, + String? cursorAfter, + String? cursorBefore, + String? error, + DateTime? finishedAt, + String id, + String source_, + DateTime startedAt, + RunStatus status, + String triggeredBy, + List? warnings, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfSyncRunOut.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfSyncRunOut.copyWith.fieldName(...)` +class _$SyncRunOutCWProxyImpl implements _$SyncRunOutCWProxy { + const _$SyncRunOutCWProxyImpl(this._value); + + final SyncRunOut _value; + + @override + SyncRunOut counts(Map? counts) => this(counts: counts); + + @override + SyncRunOut cursorAfter(String? cursorAfter) => this(cursorAfter: cursorAfter); + + @override + SyncRunOut cursorBefore(String? cursorBefore) => + this(cursorBefore: cursorBefore); + + @override + SyncRunOut error(String? error) => this(error: error); + + @override + SyncRunOut finishedAt(DateTime? finishedAt) => this(finishedAt: finishedAt); + + @override + SyncRunOut id(String id) => this(id: id); + + @override + SyncRunOut source_(String source_) => this(source_: source_); + + @override + SyncRunOut startedAt(DateTime startedAt) => this(startedAt: startedAt); + + @override + SyncRunOut status(RunStatus status) => this(status: status); + + @override + SyncRunOut triggeredBy(String triggeredBy) => this(triggeredBy: triggeredBy); + + @override + SyncRunOut warnings(List? warnings) => this(warnings: warnings); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SyncRunOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// SyncRunOut(...).copyWith(id: 12, name: "My name") + /// ```` + SyncRunOut call({ + Object? counts = const $CopyWithPlaceholder(), + Object? cursorAfter = const $CopyWithPlaceholder(), + Object? cursorBefore = const $CopyWithPlaceholder(), + Object? error = const $CopyWithPlaceholder(), + Object? finishedAt = const $CopyWithPlaceholder(), + Object? id = const $CopyWithPlaceholder(), + Object? source_ = const $CopyWithPlaceholder(), + Object? startedAt = const $CopyWithPlaceholder(), + Object? status = const $CopyWithPlaceholder(), + Object? triggeredBy = const $CopyWithPlaceholder(), + Object? warnings = const $CopyWithPlaceholder(), + }) { + return SyncRunOut( + counts: counts == const $CopyWithPlaceholder() + ? _value.counts + // ignore: cast_nullable_to_non_nullable + : counts as Map?, + cursorAfter: cursorAfter == const $CopyWithPlaceholder() + ? _value.cursorAfter + // ignore: cast_nullable_to_non_nullable + : cursorAfter as String?, + cursorBefore: cursorBefore == const $CopyWithPlaceholder() + ? _value.cursorBefore + // ignore: cast_nullable_to_non_nullable + : cursorBefore as String?, + error: error == const $CopyWithPlaceholder() + ? _value.error + // ignore: cast_nullable_to_non_nullable + : error as String?, + finishedAt: finishedAt == const $CopyWithPlaceholder() + ? _value.finishedAt + // ignore: cast_nullable_to_non_nullable + : finishedAt as DateTime?, + id: id == const $CopyWithPlaceholder() + ? _value.id + // ignore: cast_nullable_to_non_nullable + : id as String, + source_: source_ == const $CopyWithPlaceholder() + ? _value.source_ + // ignore: cast_nullable_to_non_nullable + : source_ as String, + startedAt: startedAt == const $CopyWithPlaceholder() + ? _value.startedAt + // ignore: cast_nullable_to_non_nullable + : startedAt as DateTime, + status: status == const $CopyWithPlaceholder() + ? _value.status + // ignore: cast_nullable_to_non_nullable + : status as RunStatus, + triggeredBy: triggeredBy == const $CopyWithPlaceholder() + ? _value.triggeredBy + // ignore: cast_nullable_to_non_nullable + : triggeredBy as String, + warnings: warnings == const $CopyWithPlaceholder() + ? _value.warnings + // ignore: cast_nullable_to_non_nullable + : warnings as List?, + ); + } +} + +extension $SyncRunOutCopyWith on SyncRunOut { + /// Returns a callable class that can be used as follows: `instanceOfSyncRunOut.copyWith(...)` or like so:`instanceOfSyncRunOut.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$SyncRunOutCWProxy get copyWith => _$SyncRunOutCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SyncRunOut _$SyncRunOutFromJson(Map json) => $checkedCreate( + 'SyncRunOut', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'counts', + 'cursor_after', + 'cursor_before', + 'error', + 'finished_at', + 'id', + 'source', + 'started_at', + 'status', + 'triggered_by', + 'warnings', + ], + ); + final val = SyncRunOut( + counts: $checkedConvert( + 'counts', + (v) => (v as Map?)?.map( + (k, e) => MapEntry(k, e as Object), + ), + ), + cursorAfter: $checkedConvert('cursor_after', (v) => v as String?), + cursorBefore: $checkedConvert('cursor_before', (v) => v as String?), + error: $checkedConvert('error', (v) => v as String?), + finishedAt: $checkedConvert( + 'finished_at', + (v) => v == null ? null : DateTime.parse(v as String), + ), + id: $checkedConvert('id', (v) => v as String), + source_: $checkedConvert('source', (v) => v as String), + startedAt: $checkedConvert( + 'started_at', + (v) => DateTime.parse(v as String), + ), + status: $checkedConvert( + 'status', + (v) => $enumDecode( + _$RunStatusEnumMap, + v, + unknownValue: RunStatus.unknownDefaultOpenApi, + ), + ), + triggeredBy: $checkedConvert('triggered_by', (v) => v as String), + warnings: $checkedConvert( + 'warnings', + (v) => (v as List?)?.map((e) => e as Object).toList(), + ), + ); + return val; + }, + fieldKeyMap: const { + 'cursorAfter': 'cursor_after', + 'cursorBefore': 'cursor_before', + 'finishedAt': 'finished_at', + 'source_': 'source', + 'startedAt': 'started_at', + 'triggeredBy': 'triggered_by', + }, +); + +Map _$SyncRunOutToJson(SyncRunOut instance) => + { + 'counts': instance.counts, + 'cursor_after': instance.cursorAfter, + 'cursor_before': instance.cursorBefore, + 'error': instance.error, + 'finished_at': instance.finishedAt?.toIso8601String(), + 'id': instance.id, + 'source': instance.source_, + 'started_at': instance.startedAt.toIso8601String(), + 'status': _$RunStatusEnumMap[instance.status]!, + 'triggered_by': instance.triggeredBy, + 'warnings': instance.warnings, + }; + +const _$RunStatusEnumMap = { + RunStatus.running: 'running', + RunStatus.ok: 'ok', + RunStatus.error: 'error', + RunStatus.unknownDefaultOpenApi: 'unknown_default_open_api', +}; diff --git a/app/packages/api_client/lib/src/model/token_pair.dart b/app/packages/api_client/lib/src/model/token_pair.dart new file mode 100644 index 0000000..ca8eb50 --- /dev/null +++ b/app/packages/api_client/lib/src/model/token_pair.dart @@ -0,0 +1,106 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'token_pair.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class TokenPair { + /// Returns a new [TokenPair] instance. + TokenPair({ + + required this.accessToken, + + required this.expiresIn, + + required this.refreshToken, + + this.tokenType = 'bearer', + }); + + @JsonKey( + + name: r'access_token', + required: true, + includeIfNull: false, + ) + + + final String accessToken; + + + + @JsonKey( + + name: r'expires_in', + required: true, + includeIfNull: false, + ) + + + final int expiresIn; + + + + @JsonKey( + + name: r'refresh_token', + required: true, + includeIfNull: false, + ) + + + final String refreshToken; + + + + @JsonKey( + defaultValue: 'bearer', + name: r'token_type', + required: false, + includeIfNull: false, + ) + + + final String? tokenType; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is TokenPair && + other.accessToken == accessToken && + other.expiresIn == expiresIn && + other.refreshToken == refreshToken && + other.tokenType == tokenType; + + @override + int get hashCode => + accessToken.hashCode + + expiresIn.hashCode + + refreshToken.hashCode + + tokenType.hashCode; + + factory TokenPair.fromJson(Map json) => _$TokenPairFromJson(json); + + Map toJson() => _$TokenPairToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/token_pair.g.dart b/app/packages/api_client/lib/src/model/token_pair.g.dart new file mode 100644 index 0000000..c80a78a --- /dev/null +++ b/app/packages/api_client/lib/src/model/token_pair.g.dart @@ -0,0 +1,124 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'token_pair.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$TokenPairCWProxy { + TokenPair accessToken(String accessToken); + + TokenPair expiresIn(int expiresIn); + + TokenPair refreshToken(String refreshToken); + + TokenPair tokenType(String? tokenType); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `TokenPair(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// TokenPair(...).copyWith(id: 12, name: "My name") + /// ```` + TokenPair call({ + String accessToken, + int expiresIn, + String refreshToken, + String? tokenType, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfTokenPair.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfTokenPair.copyWith.fieldName(...)` +class _$TokenPairCWProxyImpl implements _$TokenPairCWProxy { + const _$TokenPairCWProxyImpl(this._value); + + final TokenPair _value; + + @override + TokenPair accessToken(String accessToken) => this(accessToken: accessToken); + + @override + TokenPair expiresIn(int expiresIn) => this(expiresIn: expiresIn); + + @override + TokenPair refreshToken(String refreshToken) => + this(refreshToken: refreshToken); + + @override + TokenPair tokenType(String? tokenType) => this(tokenType: tokenType); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `TokenPair(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// TokenPair(...).copyWith(id: 12, name: "My name") + /// ```` + TokenPair call({ + Object? accessToken = const $CopyWithPlaceholder(), + Object? expiresIn = const $CopyWithPlaceholder(), + Object? refreshToken = const $CopyWithPlaceholder(), + Object? tokenType = const $CopyWithPlaceholder(), + }) { + return TokenPair( + accessToken: accessToken == const $CopyWithPlaceholder() + ? _value.accessToken + // ignore: cast_nullable_to_non_nullable + : accessToken as String, + expiresIn: expiresIn == const $CopyWithPlaceholder() + ? _value.expiresIn + // ignore: cast_nullable_to_non_nullable + : expiresIn as int, + refreshToken: refreshToken == const $CopyWithPlaceholder() + ? _value.refreshToken + // ignore: cast_nullable_to_non_nullable + : refreshToken as String, + tokenType: tokenType == const $CopyWithPlaceholder() + ? _value.tokenType + // ignore: cast_nullable_to_non_nullable + : tokenType as String?, + ); + } +} + +extension $TokenPairCopyWith on TokenPair { + /// Returns a callable class that can be used as follows: `instanceOfTokenPair.copyWith(...)` or like so:`instanceOfTokenPair.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$TokenPairCWProxy get copyWith => _$TokenPairCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TokenPair _$TokenPairFromJson(Map json) => $checkedCreate( + 'TokenPair', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const ['access_token', 'expires_in', 'refresh_token'], + ); + final val = TokenPair( + accessToken: $checkedConvert('access_token', (v) => v as String), + expiresIn: $checkedConvert('expires_in', (v) => (v as num).toInt()), + refreshToken: $checkedConvert('refresh_token', (v) => v as String), + tokenType: $checkedConvert('token_type', (v) => v as String? ?? 'bearer'), + ); + return val; + }, + fieldKeyMap: const { + 'accessToken': 'access_token', + 'expiresIn': 'expires_in', + 'refreshToken': 'refresh_token', + 'tokenType': 'token_type', + }, +); + +Map _$TokenPairToJson(TokenPair instance) => { + 'access_token': instance.accessToken, + 'expires_in': instance.expiresIn, + 'refresh_token': instance.refreshToken, + 'token_type': ?instance.tokenType, +}; diff --git a/app/packages/api_client/lib/src/model/transaction_out.dart b/app/packages/api_client/lib/src/model/transaction_out.dart new file mode 100644 index 0000000..1c967c0 --- /dev/null +++ b/app/packages/api_client/lib/src/model/transaction_out.dart @@ -0,0 +1,416 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/flow_type.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'transaction_out.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class TransactionOut { + /// Returns a new [TransactionOut] instance. + TransactionOut({ + + required this.categoryId, + + required this.comment, + + required this.date, + + required this.deleted, + + required this.flowType, + + required this.hold, + + required this.id, + + required this.income, + + required this.incomeAccountId, + + required this.incomeCurrency, + + required this.incomeRub, + + required this.isOneOff, + + required this.mcc, + + required this.outcome, + + required this.outcomeAccountId, + + required this.outcomeCurrency, + + required this.outcomeRub, + + required this.payee, + + required this.payeeCanonical, + + required this.sourceId, + + required this.tags, + + required this.tripId, + + required this.ts, + }); + + @JsonKey( + + name: r'category_id', + required: true, + includeIfNull: true, + ) + + + final int? categoryId; + + + + @JsonKey( + + name: r'comment', + required: true, + includeIfNull: true, + ) + + + final String? comment; + + + + @JsonKey( + + name: r'date', + required: true, + includeIfNull: false, + ) + + + final DateTime date; + + + + @JsonKey( + + name: r'deleted', + required: true, + includeIfNull: false, + ) + + + final bool deleted; + + + + @JsonKey( + + name: r'flow_type', + required: true, + includeIfNull: false, + unknownEnumValue: FlowType.unknownDefaultOpenApi, + ) + + + final FlowType flowType; + + + + @JsonKey( + + name: r'hold', + required: true, + includeIfNull: false, + ) + + + final bool hold; + + + + @JsonKey( + + name: r'id', + required: true, + includeIfNull: false, + ) + + + final int id; + + + + /// decimal as string + @JsonKey( + + name: r'income', + required: true, + includeIfNull: false, + ) + + + final String income; + + + + @JsonKey( + + name: r'income_account_id', + required: true, + includeIfNull: true, + ) + + + final int? incomeAccountId; + + + + @JsonKey( + + name: r'income_currency', + required: true, + includeIfNull: true, + ) + + + final String? incomeCurrency; + + + + /// decimal as string + @JsonKey( + + name: r'income_rub', + required: true, + includeIfNull: true, + ) + + + final String? incomeRub; + + + + @JsonKey( + + name: r'is_one_off', + required: true, + includeIfNull: false, + ) + + + final bool isOneOff; + + + + @JsonKey( + + name: r'mcc', + required: true, + includeIfNull: true, + ) + + + final int? mcc; + + + + /// decimal as string + @JsonKey( + + name: r'outcome', + required: true, + includeIfNull: false, + ) + + + final String outcome; + + + + @JsonKey( + + name: r'outcome_account_id', + required: true, + includeIfNull: true, + ) + + + final int? outcomeAccountId; + + + + @JsonKey( + + name: r'outcome_currency', + required: true, + includeIfNull: true, + ) + + + final String? outcomeCurrency; + + + + /// decimal as string + @JsonKey( + + name: r'outcome_rub', + required: true, + includeIfNull: true, + ) + + + final String? outcomeRub; + + + + @JsonKey( + + name: r'payee', + required: true, + includeIfNull: true, + ) + + + final String? payee; + + + + @JsonKey( + + name: r'payee_canonical', + required: true, + includeIfNull: true, + ) + + + final String? payeeCanonical; + + + + @JsonKey( + + name: r'source_id', + required: true, + includeIfNull: false, + ) + + + final String sourceId; + + + + @JsonKey( + + name: r'tags', + required: true, + includeIfNull: false, + ) + + + final List tags; + + + + @JsonKey( + + name: r'trip_id', + required: true, + includeIfNull: true, + ) + + + final int? tripId; + + + + @JsonKey( + + name: r'ts', + required: true, + includeIfNull: false, + ) + + + final DateTime ts; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is TransactionOut && + other.categoryId == categoryId && + other.comment == comment && + other.date == date && + other.deleted == deleted && + other.flowType == flowType && + other.hold == hold && + other.id == id && + other.income == income && + other.incomeAccountId == incomeAccountId && + other.incomeCurrency == incomeCurrency && + other.incomeRub == incomeRub && + other.isOneOff == isOneOff && + other.mcc == mcc && + other.outcome == outcome && + other.outcomeAccountId == outcomeAccountId && + other.outcomeCurrency == outcomeCurrency && + other.outcomeRub == outcomeRub && + other.payee == payee && + other.payeeCanonical == payeeCanonical && + other.sourceId == sourceId && + other.tags == tags && + other.tripId == tripId && + other.ts == ts; + + @override + int get hashCode => + (categoryId == null ? 0 : categoryId.hashCode) + + (comment == null ? 0 : comment.hashCode) + + date.hashCode + + deleted.hashCode + + flowType.hashCode + + hold.hashCode + + id.hashCode + + income.hashCode + + (incomeAccountId == null ? 0 : incomeAccountId.hashCode) + + (incomeCurrency == null ? 0 : incomeCurrency.hashCode) + + (incomeRub == null ? 0 : incomeRub.hashCode) + + isOneOff.hashCode + + (mcc == null ? 0 : mcc.hashCode) + + outcome.hashCode + + (outcomeAccountId == null ? 0 : outcomeAccountId.hashCode) + + (outcomeCurrency == null ? 0 : outcomeCurrency.hashCode) + + (outcomeRub == null ? 0 : outcomeRub.hashCode) + + (payee == null ? 0 : payee.hashCode) + + (payeeCanonical == null ? 0 : payeeCanonical.hashCode) + + sourceId.hashCode + + tags.hashCode + + (tripId == null ? 0 : tripId.hashCode) + + ts.hashCode; + + factory TransactionOut.fromJson(Map json) => _$TransactionOutFromJson(json); + + Map toJson() => _$TransactionOutToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/transaction_out.g.dart b/app/packages/api_client/lib/src/model/transaction_out.g.dart new file mode 100644 index 0000000..5613d9b --- /dev/null +++ b/app/packages/api_client/lib/src/model/transaction_out.g.dart @@ -0,0 +1,437 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'transaction_out.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$TransactionOutCWProxy { + TransactionOut categoryId(int? categoryId); + + TransactionOut comment(String? comment); + + TransactionOut date(DateTime date); + + TransactionOut deleted(bool deleted); + + TransactionOut flowType(FlowType flowType); + + TransactionOut hold(bool hold); + + TransactionOut id(int id); + + TransactionOut income(String income); + + TransactionOut incomeAccountId(int? incomeAccountId); + + TransactionOut incomeCurrency(String? incomeCurrency); + + TransactionOut incomeRub(String? incomeRub); + + TransactionOut isOneOff(bool isOneOff); + + TransactionOut mcc(int? mcc); + + TransactionOut outcome(String outcome); + + TransactionOut outcomeAccountId(int? outcomeAccountId); + + TransactionOut outcomeCurrency(String? outcomeCurrency); + + TransactionOut outcomeRub(String? outcomeRub); + + TransactionOut payee(String? payee); + + TransactionOut payeeCanonical(String? payeeCanonical); + + TransactionOut sourceId(String sourceId); + + TransactionOut tags(List tags); + + TransactionOut tripId(int? tripId); + + TransactionOut ts(DateTime ts); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `TransactionOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// TransactionOut(...).copyWith(id: 12, name: "My name") + /// ```` + TransactionOut call({ + int? categoryId, + String? comment, + DateTime date, + bool deleted, + FlowType flowType, + bool hold, + int id, + String income, + int? incomeAccountId, + String? incomeCurrency, + String? incomeRub, + bool isOneOff, + int? mcc, + String outcome, + int? outcomeAccountId, + String? outcomeCurrency, + String? outcomeRub, + String? payee, + String? payeeCanonical, + String sourceId, + List tags, + int? tripId, + DateTime ts, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfTransactionOut.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfTransactionOut.copyWith.fieldName(...)` +class _$TransactionOutCWProxyImpl implements _$TransactionOutCWProxy { + const _$TransactionOutCWProxyImpl(this._value); + + final TransactionOut _value; + + @override + TransactionOut categoryId(int? categoryId) => this(categoryId: categoryId); + + @override + TransactionOut comment(String? comment) => this(comment: comment); + + @override + TransactionOut date(DateTime date) => this(date: date); + + @override + TransactionOut deleted(bool deleted) => this(deleted: deleted); + + @override + TransactionOut flowType(FlowType flowType) => this(flowType: flowType); + + @override + TransactionOut hold(bool hold) => this(hold: hold); + + @override + TransactionOut id(int id) => this(id: id); + + @override + TransactionOut income(String income) => this(income: income); + + @override + TransactionOut incomeAccountId(int? incomeAccountId) => + this(incomeAccountId: incomeAccountId); + + @override + TransactionOut incomeCurrency(String? incomeCurrency) => + this(incomeCurrency: incomeCurrency); + + @override + TransactionOut incomeRub(String? incomeRub) => this(incomeRub: incomeRub); + + @override + TransactionOut isOneOff(bool isOneOff) => this(isOneOff: isOneOff); + + @override + TransactionOut mcc(int? mcc) => this(mcc: mcc); + + @override + TransactionOut outcome(String outcome) => this(outcome: outcome); + + @override + TransactionOut outcomeAccountId(int? outcomeAccountId) => + this(outcomeAccountId: outcomeAccountId); + + @override + TransactionOut outcomeCurrency(String? outcomeCurrency) => + this(outcomeCurrency: outcomeCurrency); + + @override + TransactionOut outcomeRub(String? outcomeRub) => this(outcomeRub: outcomeRub); + + @override + TransactionOut payee(String? payee) => this(payee: payee); + + @override + TransactionOut payeeCanonical(String? payeeCanonical) => + this(payeeCanonical: payeeCanonical); + + @override + TransactionOut sourceId(String sourceId) => this(sourceId: sourceId); + + @override + TransactionOut tags(List tags) => this(tags: tags); + + @override + TransactionOut tripId(int? tripId) => this(tripId: tripId); + + @override + TransactionOut ts(DateTime ts) => this(ts: ts); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `TransactionOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// TransactionOut(...).copyWith(id: 12, name: "My name") + /// ```` + TransactionOut call({ + Object? categoryId = const $CopyWithPlaceholder(), + Object? comment = const $CopyWithPlaceholder(), + Object? date = const $CopyWithPlaceholder(), + Object? deleted = const $CopyWithPlaceholder(), + Object? flowType = const $CopyWithPlaceholder(), + Object? hold = const $CopyWithPlaceholder(), + Object? id = const $CopyWithPlaceholder(), + Object? income = const $CopyWithPlaceholder(), + Object? incomeAccountId = const $CopyWithPlaceholder(), + Object? incomeCurrency = const $CopyWithPlaceholder(), + Object? incomeRub = const $CopyWithPlaceholder(), + Object? isOneOff = const $CopyWithPlaceholder(), + Object? mcc = const $CopyWithPlaceholder(), + Object? outcome = const $CopyWithPlaceholder(), + Object? outcomeAccountId = const $CopyWithPlaceholder(), + Object? outcomeCurrency = const $CopyWithPlaceholder(), + Object? outcomeRub = const $CopyWithPlaceholder(), + Object? payee = const $CopyWithPlaceholder(), + Object? payeeCanonical = const $CopyWithPlaceholder(), + Object? sourceId = const $CopyWithPlaceholder(), + Object? tags = const $CopyWithPlaceholder(), + Object? tripId = const $CopyWithPlaceholder(), + Object? ts = const $CopyWithPlaceholder(), + }) { + return TransactionOut( + categoryId: categoryId == const $CopyWithPlaceholder() + ? _value.categoryId + // ignore: cast_nullable_to_non_nullable + : categoryId as int?, + comment: comment == const $CopyWithPlaceholder() + ? _value.comment + // ignore: cast_nullable_to_non_nullable + : comment as String?, + date: date == const $CopyWithPlaceholder() + ? _value.date + // ignore: cast_nullable_to_non_nullable + : date as DateTime, + deleted: deleted == const $CopyWithPlaceholder() + ? _value.deleted + // ignore: cast_nullable_to_non_nullable + : deleted as bool, + flowType: flowType == const $CopyWithPlaceholder() + ? _value.flowType + // ignore: cast_nullable_to_non_nullable + : flowType as FlowType, + hold: hold == const $CopyWithPlaceholder() + ? _value.hold + // ignore: cast_nullable_to_non_nullable + : hold as bool, + id: id == const $CopyWithPlaceholder() + ? _value.id + // ignore: cast_nullable_to_non_nullable + : id as int, + income: income == const $CopyWithPlaceholder() + ? _value.income + // ignore: cast_nullable_to_non_nullable + : income as String, + incomeAccountId: incomeAccountId == const $CopyWithPlaceholder() + ? _value.incomeAccountId + // ignore: cast_nullable_to_non_nullable + : incomeAccountId as int?, + incomeCurrency: incomeCurrency == const $CopyWithPlaceholder() + ? _value.incomeCurrency + // ignore: cast_nullable_to_non_nullable + : incomeCurrency as String?, + incomeRub: incomeRub == const $CopyWithPlaceholder() + ? _value.incomeRub + // ignore: cast_nullable_to_non_nullable + : incomeRub as String?, + isOneOff: isOneOff == const $CopyWithPlaceholder() + ? _value.isOneOff + // ignore: cast_nullable_to_non_nullable + : isOneOff as bool, + mcc: mcc == const $CopyWithPlaceholder() + ? _value.mcc + // ignore: cast_nullable_to_non_nullable + : mcc as int?, + outcome: outcome == const $CopyWithPlaceholder() + ? _value.outcome + // ignore: cast_nullable_to_non_nullable + : outcome as String, + outcomeAccountId: outcomeAccountId == const $CopyWithPlaceholder() + ? _value.outcomeAccountId + // ignore: cast_nullable_to_non_nullable + : outcomeAccountId as int?, + outcomeCurrency: outcomeCurrency == const $CopyWithPlaceholder() + ? _value.outcomeCurrency + // ignore: cast_nullable_to_non_nullable + : outcomeCurrency as String?, + outcomeRub: outcomeRub == const $CopyWithPlaceholder() + ? _value.outcomeRub + // ignore: cast_nullable_to_non_nullable + : outcomeRub as String?, + payee: payee == const $CopyWithPlaceholder() + ? _value.payee + // ignore: cast_nullable_to_non_nullable + : payee as String?, + payeeCanonical: payeeCanonical == const $CopyWithPlaceholder() + ? _value.payeeCanonical + // ignore: cast_nullable_to_non_nullable + : payeeCanonical as String?, + sourceId: sourceId == const $CopyWithPlaceholder() + ? _value.sourceId + // ignore: cast_nullable_to_non_nullable + : sourceId as String, + tags: tags == const $CopyWithPlaceholder() + ? _value.tags + // ignore: cast_nullable_to_non_nullable + : tags as List, + tripId: tripId == const $CopyWithPlaceholder() + ? _value.tripId + // ignore: cast_nullable_to_non_nullable + : tripId as int?, + ts: ts == const $CopyWithPlaceholder() + ? _value.ts + // ignore: cast_nullable_to_non_nullable + : ts as DateTime, + ); + } +} + +extension $TransactionOutCopyWith on TransactionOut { + /// Returns a callable class that can be used as follows: `instanceOfTransactionOut.copyWith(...)` or like so:`instanceOfTransactionOut.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$TransactionOutCWProxy get copyWith => _$TransactionOutCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TransactionOut _$TransactionOutFromJson( + Map json, +) => $checkedCreate( + 'TransactionOut', + json, + ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const [ + 'category_id', + 'comment', + 'date', + 'deleted', + 'flow_type', + 'hold', + 'id', + 'income', + 'income_account_id', + 'income_currency', + 'income_rub', + 'is_one_off', + 'mcc', + 'outcome', + 'outcome_account_id', + 'outcome_currency', + 'outcome_rub', + 'payee', + 'payee_canonical', + 'source_id', + 'tags', + 'trip_id', + 'ts', + ], + ); + final val = TransactionOut( + categoryId: $checkedConvert('category_id', (v) => (v as num?)?.toInt()), + comment: $checkedConvert('comment', (v) => v as String?), + date: $checkedConvert('date', (v) => DateTime.parse(v as String)), + deleted: $checkedConvert('deleted', (v) => v as bool), + flowType: $checkedConvert( + 'flow_type', + (v) => $enumDecode( + _$FlowTypeEnumMap, + v, + unknownValue: FlowType.unknownDefaultOpenApi, + ), + ), + hold: $checkedConvert('hold', (v) => v as bool), + id: $checkedConvert('id', (v) => (v as num).toInt()), + income: $checkedConvert('income', (v) => v as String), + incomeAccountId: $checkedConvert( + 'income_account_id', + (v) => (v as num?)?.toInt(), + ), + incomeCurrency: $checkedConvert('income_currency', (v) => v as String?), + incomeRub: $checkedConvert('income_rub', (v) => v as String?), + isOneOff: $checkedConvert('is_one_off', (v) => v as bool), + mcc: $checkedConvert('mcc', (v) => (v as num?)?.toInt()), + outcome: $checkedConvert('outcome', (v) => v as String), + outcomeAccountId: $checkedConvert( + 'outcome_account_id', + (v) => (v as num?)?.toInt(), + ), + outcomeCurrency: $checkedConvert('outcome_currency', (v) => v as String?), + outcomeRub: $checkedConvert('outcome_rub', (v) => v as String?), + payee: $checkedConvert('payee', (v) => v as String?), + payeeCanonical: $checkedConvert('payee_canonical', (v) => v as String?), + sourceId: $checkedConvert('source_id', (v) => v as String), + tags: $checkedConvert( + 'tags', + (v) => (v as List).map((e) => (e as num).toInt()).toList(), + ), + tripId: $checkedConvert('trip_id', (v) => (v as num?)?.toInt()), + ts: $checkedConvert('ts', (v) => DateTime.parse(v as String)), + ); + return val; + }, + fieldKeyMap: const { + 'categoryId': 'category_id', + 'flowType': 'flow_type', + 'incomeAccountId': 'income_account_id', + 'incomeCurrency': 'income_currency', + 'incomeRub': 'income_rub', + 'isOneOff': 'is_one_off', + 'outcomeAccountId': 'outcome_account_id', + 'outcomeCurrency': 'outcome_currency', + 'outcomeRub': 'outcome_rub', + 'payeeCanonical': 'payee_canonical', + 'sourceId': 'source_id', + 'tripId': 'trip_id', + }, +); + +Map _$TransactionOutToJson(TransactionOut instance) => + { + 'category_id': instance.categoryId, + 'comment': instance.comment, + 'date': instance.date.toIso8601String(), + 'deleted': instance.deleted, + 'flow_type': _$FlowTypeEnumMap[instance.flowType]!, + 'hold': instance.hold, + 'id': instance.id, + 'income': instance.income, + 'income_account_id': instance.incomeAccountId, + 'income_currency': instance.incomeCurrency, + 'income_rub': instance.incomeRub, + 'is_one_off': instance.isOneOff, + 'mcc': instance.mcc, + 'outcome': instance.outcome, + 'outcome_account_id': instance.outcomeAccountId, + 'outcome_currency': instance.outcomeCurrency, + 'outcome_rub': instance.outcomeRub, + 'payee': instance.payee, + 'payee_canonical': instance.payeeCanonical, + 'source_id': instance.sourceId, + 'tags': instance.tags, + 'trip_id': instance.tripId, + 'ts': instance.ts.toIso8601String(), + }; + +const _$FlowTypeEnumMap = { + FlowType.income: 'income', + FlowType.expense: 'expense', + FlowType.internalTransfer: 'internal_transfer', + FlowType.savingsTransfer: 'savings_transfer', + FlowType.brokerExternalFlow: 'broker_external_flow', + FlowType.deleted: 'deleted', + FlowType.other: 'other', + FlowType.unknownDefaultOpenApi: 'unknown_default_open_api', +}; diff --git a/app/packages/api_client/lib/src/model/transaction_page.dart b/app/packages/api_client/lib/src/model/transaction_page.dart new file mode 100644 index 0000000..f5e367f --- /dev/null +++ b/app/packages/api_client/lib/src/model/transaction_page.dart @@ -0,0 +1,107 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:fintracker_api/src/model/transaction_out.dart'; +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'transaction_page.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class TransactionPage { + /// Returns a new [TransactionPage] instance. + TransactionPage({ + + required this.items, + + required this.page, + + required this.pageSize, + + required this.total, + }); + + @JsonKey( + + name: r'items', + required: true, + includeIfNull: false, + ) + + + final List items; + + + + @JsonKey( + + name: r'page', + required: true, + includeIfNull: false, + ) + + + final int page; + + + + @JsonKey( + + name: r'page_size', + required: true, + includeIfNull: false, + ) + + + final int pageSize; + + + + @JsonKey( + + name: r'total', + required: true, + includeIfNull: false, + ) + + + final int total; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is TransactionPage && + other.items == items && + other.page == page && + other.pageSize == pageSize && + other.total == total; + + @override + int get hashCode => + items.hashCode + + page.hashCode + + pageSize.hashCode + + total.hashCode; + + factory TransactionPage.fromJson(Map json) => _$TransactionPageFromJson(json); + + Map toJson() => _$TransactionPageToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/transaction_page.g.dart b/app/packages/api_client/lib/src/model/transaction_page.g.dart new file mode 100644 index 0000000..bf789ea --- /dev/null +++ b/app/packages/api_client/lib/src/model/transaction_page.g.dart @@ -0,0 +1,120 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'transaction_page.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$TransactionPageCWProxy { + TransactionPage items(List items); + + TransactionPage page(int page); + + TransactionPage pageSize(int pageSize); + + TransactionPage total(int total); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `TransactionPage(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// TransactionPage(...).copyWith(id: 12, name: "My name") + /// ```` + TransactionPage call({ + List items, + int page, + int pageSize, + int total, + }); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfTransactionPage.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfTransactionPage.copyWith.fieldName(...)` +class _$TransactionPageCWProxyImpl implements _$TransactionPageCWProxy { + const _$TransactionPageCWProxyImpl(this._value); + + final TransactionPage _value; + + @override + TransactionPage items(List items) => this(items: items); + + @override + TransactionPage page(int page) => this(page: page); + + @override + TransactionPage pageSize(int pageSize) => this(pageSize: pageSize); + + @override + TransactionPage total(int total) => this(total: total); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `TransactionPage(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// TransactionPage(...).copyWith(id: 12, name: "My name") + /// ```` + TransactionPage call({ + Object? items = const $CopyWithPlaceholder(), + Object? page = const $CopyWithPlaceholder(), + Object? pageSize = const $CopyWithPlaceholder(), + Object? total = const $CopyWithPlaceholder(), + }) { + return TransactionPage( + items: items == const $CopyWithPlaceholder() + ? _value.items + // ignore: cast_nullable_to_non_nullable + : items as List, + page: page == const $CopyWithPlaceholder() + ? _value.page + // ignore: cast_nullable_to_non_nullable + : page as int, + pageSize: pageSize == const $CopyWithPlaceholder() + ? _value.pageSize + // ignore: cast_nullable_to_non_nullable + : pageSize as int, + total: total == const $CopyWithPlaceholder() + ? _value.total + // ignore: cast_nullable_to_non_nullable + : total as int, + ); + } +} + +extension $TransactionPageCopyWith on TransactionPage { + /// Returns a callable class that can be used as follows: `instanceOfTransactionPage.copyWith(...)` or like so:`instanceOfTransactionPage.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$TransactionPageCWProxy get copyWith => _$TransactionPageCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TransactionPage _$TransactionPageFromJson(Map json) => + $checkedCreate('TransactionPage', json, ($checkedConvert) { + $checkKeys( + json, + requiredKeys: const ['items', 'page', 'page_size', 'total'], + ); + final val = TransactionPage( + items: $checkedConvert( + 'items', + (v) => (v as List) + .map((e) => TransactionOut.fromJson(e as Map)) + .toList(), + ), + page: $checkedConvert('page', (v) => (v as num).toInt()), + pageSize: $checkedConvert('page_size', (v) => (v as num).toInt()), + total: $checkedConvert('total', (v) => (v as num).toInt()), + ); + return val; + }, fieldKeyMap: const {'pageSize': 'page_size'}); + +Map _$TransactionPageToJson(TransactionPage instance) => + { + 'items': instance.items.map((e) => e.toJson()).toList(), + 'page': instance.page, + 'page_size': instance.pageSize, + 'total': instance.total, + }; diff --git a/app/packages/api_client/lib/src/model/user_out.dart b/app/packages/api_client/lib/src/model/user_out.dart new file mode 100644 index 0000000..493edf2 --- /dev/null +++ b/app/packages/api_client/lib/src/model/user_out.dart @@ -0,0 +1,74 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:copy_with_extension/copy_with_extension.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'user_out.g.dart'; + + +@CopyWith() +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class UserOut { + /// Returns a new [UserOut] instance. + UserOut({ + + required this.email, + + required this.id, + }); + + @JsonKey( + + name: r'email', + required: true, + includeIfNull: false, + ) + + + final String email; + + + + @JsonKey( + + name: r'id', + required: true, + includeIfNull: false, + ) + + + final int id; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is UserOut && + other.email == email && + other.id == id; + + @override + int get hashCode => + email.hashCode + + id.hashCode; + + factory UserOut.fromJson(Map json) => _$UserOutFromJson(json); + + Map toJson() => _$UserOutToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/app/packages/api_client/lib/src/model/user_out.g.dart b/app/packages/api_client/lib/src/model/user_out.g.dart new file mode 100644 index 0000000..59d9a88 --- /dev/null +++ b/app/packages/api_client/lib/src/model/user_out.g.dart @@ -0,0 +1,82 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_out.dart'; + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class _$UserOutCWProxy { + UserOut email(String email); + + UserOut id(int id); + + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `UserOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// UserOut(...).copyWith(id: 12, name: "My name") + /// ```` + UserOut call({String email, int id}); +} + +/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfUserOut.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfUserOut.copyWith.fieldName(...)` +class _$UserOutCWProxyImpl implements _$UserOutCWProxy { + const _$UserOutCWProxyImpl(this._value); + + final UserOut _value; + + @override + UserOut email(String email) => this(email: email); + + @override + UserOut id(int id) => this(id: id); + + @override + /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `UserOut(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. + /// + /// Usage + /// ```dart + /// UserOut(...).copyWith(id: 12, name: "My name") + /// ```` + UserOut call({ + Object? email = const $CopyWithPlaceholder(), + Object? id = const $CopyWithPlaceholder(), + }) { + return UserOut( + email: email == const $CopyWithPlaceholder() + ? _value.email + // ignore: cast_nullable_to_non_nullable + : email as String, + id: id == const $CopyWithPlaceholder() + ? _value.id + // ignore: cast_nullable_to_non_nullable + : id as int, + ); + } +} + +extension $UserOutCopyWith on UserOut { + /// Returns a callable class that can be used as follows: `instanceOfUserOut.copyWith(...)` or like so:`instanceOfUserOut.copyWith.fieldName(...)`. + // ignore: library_private_types_in_public_api + _$UserOutCWProxy get copyWith => _$UserOutCWProxyImpl(this); +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +UserOut _$UserOutFromJson(Map json) => + $checkedCreate('UserOut', json, ($checkedConvert) { + $checkKeys(json, requiredKeys: const ['email', 'id']); + final val = UserOut( + email: $checkedConvert('email', (v) => v as String), + id: $checkedConvert('id', (v) => (v as num).toInt()), + ); + return val; + }); + +Map _$UserOutToJson(UserOut instance) => { + 'email': instance.email, + 'id': instance.id, +}; diff --git a/app/packages/api_client/openapi-config.yaml b/app/packages/api_client/openapi-config.yaml new file mode 100644 index 0000000..d3d9d50 --- /dev/null +++ b/app/packages/api_client/openapi-config.yaml @@ -0,0 +1,9 @@ +# openapi-generator-cli config for `just gen-client` (generator: dart-dio) +pubName: fintracker_api +pubVersion: 0.1.0 +pubDescription: Generated client for the fin-tracker backend +pubAuthor: fin-tracker +serializationLibrary: json_serializable +useEnumExtension: true +enumUnknownDefaultCase: true +# money arrives as decimal strings; the app wraps them in `Decimal` at the boundary diff --git a/app/packages/api_client/pubspec.lock b/app/packages/api_client/pubspec.lock new file mode 100644 index 0000000..a7c2140 --- /dev/null +++ b/app/packages/api_client/pubspec.lock @@ -0,0 +1,581 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: da0d9209ca76bde579f2da330aeb9df62b6319c834fa7baae052021b0462401f + url: "https://pub.dev" + source: hosted + version: "85.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "974859dc0ff5f37bc4313244b3218c791810d03ab3470a579580279ba971a48d" + url: "https://pub.dev" + source: hosted + version: "7.7.1" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + build: + dependency: transitive + description: + name: build + sha256: ce76b1d48875e3233fde17717c23d1f60a91cc631597e49a400c89b475395b1d + url: "https://pub.dev" + source: hosted + version: "3.1.0" + build_config: + dependency: transitive + description: + name: build_config + sha256: "4f64382b97504dc2fcdf487d5aae33418e08b4703fc21249e4db6d804a4d0187" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: e1d40ef3f7934986d5da2271b1ba07794921ce263e44d622fb6c406d76589e33 + url: "https://pub.dev" + source: hosted + version: "4.1.6" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: d1d57f7807debd7349b4726a19fd32ec8bc177c71ad0febf91a20f84cd2d4b46 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: b24597fceb695969d47025c958f3837f9f0122e237c6a22cb082a5ac66c3ca30 + url: "https://pub.dev" + source: hosted + version: "2.7.1" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "066dda7f73d8eb48ba630a55acb50c4a84a2e6b453b1cb4567f581729e794f7b" + url: "https://pub.dev" + source: hosted + version: "9.3.1" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: f87ea98192116f7093cb214551ce1929caae0681fdba282b3d8b4462adee7bb7 + url: "https://pub.dev" + source: hosted + version: "8.13.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + cli_config: + dependency: transitive + description: + name: cli_config + sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec + url: "https://pub.dev" + source: hosted + version: "0.2.0" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: aa5932e94c6c39c2f9ec4e5e06dfdd11a9430a61f6c41b6ba75b28ce0c481baf + url: "https://pub.dev" + source: hosted + version: "4.12.0" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + copy_with_extension: + dependency: "direct main" + description: + name: copy_with_extension + sha256: "28b8a99384df46f5287ed87e249869fddedd299752ea83603800448e0523f00b" + url: "https://pub.dev" + source: hosted + version: "7.1.0" + copy_with_extension_gen: + dependency: "direct dev" + description: + name: copy_with_extension_gen + sha256: "7093595476bcafd7e32efbfef96b763d2f86d5c0410e19f16de6b48b63a0288c" + url: "https://pub.dev" + source: hosted + version: "7.1.0" + coverage: + dependency: transitive + description: + name: coverage + sha256: "956a3de0725ca232ad353565a8290d3357592bf4250f6f298a185e2d949c5d3d" + url: "https://pub.dev" + source: hosted + version: "1.15.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + dio: + dependency: "direct main" + description: + name: dio + sha256: "852ec3b48cc431ac04fff978413c541502b67ffc3e26921e74e3d994694192c1" + url: "https://pub.dev" + source: hosted + version: "5.11.1" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "3a1b2cd7be71086f38504956e3ebcd2837288d231ff454bafa78021244102bfc" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "218aeb56050c714f62a3182775320dfa04602b55074873e24e31bbd39bda96fb" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + io: + dependency: transitive + description: + name: io + sha256: "2635216ca6a737e60de577ffa1a48a0bec76ca8a62917cfc1bb88c14c570646f" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + js: + dependency: transitive + description: + name: js + sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" + url: "https://pub.dev" + source: hosted + version: "0.7.2" + json_annotation: + dependency: "direct main" + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + json_serializable: + dependency: "direct dev" + description: + name: json_serializable + sha256: c5b2ee75210a0f263c6c7b9eeea80553dbae96ea1bf57f02484e806a3ffdffa3 + url: "https://pub.dev" + source: hosted + version: "6.11.2" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + meta: + dependency: transitive + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + mime: + dependency: transitive + description: + name: mime + sha256: bd47de35f07e27267e69c8c8b22edf9473bfee170a60d60fcc93730c5144b7f6 + url: "https://pub.dev" + source: hosted + version: "2.1.0" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + pool: + dependency: transitive + description: + name: pool + sha256: "4177f68c237ea2128d1bee66ac17b2ce05ba3dbaafcbdd54c5d40a39d0b6b11c" + url: "https://pub.dev" + source: hosted + version: "1.5.3" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c38b81cbf34450b67e0265d73433569d12e34782e30ed769c9cc99c9d5f2e796 + url: "https://pub.dev" + source: hosted + version: "1.6.0" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "7b19d6ba131c6eb98bfcbf8d56c1a7002eba438af2e7ae6f8398b2b0f4f381e3" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "6a3c6cc82073a8797f8c4dc4572146114a39652851c157db37e964d9c7038723" + url: "https://pub.dev" + source: hosted + version: "1.3.8" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "14c2945847669b44089bb1222f66873d7ff7103c58911917f2a63c5a62327898" + url: "https://pub.dev" + source: hosted + version: "0.10.14" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: a00e5f18bffc764f923e7dec1038527f7fe7a1791361a7117f0358193f13d53a + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test: + dependency: "direct dev" + description: + name: test + sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7" + url: "https://pub.dev" + source: hosted + version: "1.26.3" + test_api: + dependency: transitive + description: + name: test_api + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + url: "https://pub.dev" + source: hosted + version: "0.7.7" + test_core: + dependency: transitive + description: + name: test_core + sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0" + url: "https://pub.dev" + source: hosted + version: "0.6.12" + timing: + dependency: transitive + description: + name: timing + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "5f37239c4851efcef929cea7824e76df7f2f0970aef85d66bbc430afa40e72f0" + url: "https://pub.dev" + source: hosted + version: "15.3.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea + url: "https://pub.dev" + source: hosted + version: "3.1.4" +sdks: + dart: ">=3.11.0 <4.0.0" diff --git a/app/packages/api_client/pubspec.yaml b/app/packages/api_client/pubspec.yaml new file mode 100644 index 0000000..97e7ea9 --- /dev/null +++ b/app/packages/api_client/pubspec.yaml @@ -0,0 +1,19 @@ +name: fintracker_api +version: 0.1.0 +description: Generated client for the fin-tracker backend +homepage: homepage + + +environment: + sdk: '>=3.8.0 <4.0.0' + +dependencies: + dio: '^5.7.0' + copy_with_extension: '^7.1.0' + json_annotation: '^4.9.0' + +dev_dependencies: + build_runner: any + copy_with_extension_gen: ^7.1.0 + json_serializable: '^6.9.3' + test: '^1.16.0' diff --git a/app/packages/api_client/test/account_balance_test.dart b/app/packages/api_client/test/account_balance_test.dart new file mode 100644 index 0000000..6f488e4 --- /dev/null +++ b/app/packages/api_client/test/account_balance_test.dart @@ -0,0 +1,43 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for AccountBalance +void main() { + final AccountBalance? instance = /* AccountBalance(...) */ null; + // TODO add properties to the entity + + group(AccountBalance, () { + // int accountId + test('to test the property `accountId`', () async { + // TODO + }); + + // decimal as string + // String balance + test('to test the property `balance`', () async { + // TODO + }); + + // decimal as string + // String balanceRub + test('to test the property `balanceRub`', () async { + // TODO + }); + + // String currency + test('to test the property `currency`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // AccountRole role + test('to test the property `role`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/account_kind_test.dart b/app/packages/api_client/test/account_kind_test.dart new file mode 100644 index 0000000..39f8ea4 --- /dev/null +++ b/app/packages/api_client/test/account_kind_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for AccountKind +void main() { + + group(AccountKind, () { + }); +} diff --git a/app/packages/api_client/test/account_out_test.dart b/app/packages/api_client/test/account_out_test.dart new file mode 100644 index 0000000..0bdb691 --- /dev/null +++ b/app/packages/api_client/test/account_out_test.dart @@ -0,0 +1,99 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for AccountOut +void main() { + final AccountOut? instance = /* AccountOut(...) */ null; + // TODO add properties to the entity + + group(AccountOut, () { + // bool archived + test('to test the property `archived`', () async { + // TODO + }); + + // decimal as string + // String balance + test('to test the property `balance`', () async { + // TODO + }); + + // DateTime balanceAsOf + test('to test the property `balanceAsOf`', () async { + // TODO + }); + + // Broker broker + test('to test the property `broker`', () async { + // TODO + }); + + // decimal as string + // String creditLimit + test('to test the property `creditLimit`', () async { + // TODO + }); + + // String currency + test('to test the property `currency`', () async { + // TODO + }); + + // int id + test('to test the property `id`', () async { + // TODO + }); + + // bool includeInNetWorth + test('to test the property `includeInNetWorth`', () async { + // TODO + }); + + // AccountKind kind + test('to test the property `kind`', () async { + // TODO + }); + + // int mirrorOfAccountId + test('to test the property `mirrorOfAccountId`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // DateTime openedAt + test('to test the property `openedAt`', () async { + // TODO + }); + + // EventSource primaryEventSource + test('to test the property `primaryEventSource`', () async { + // TODO + }); + + // AccountRole role + test('to test the property `role`', () async { + // TODO + }); + + // String source_ + test('to test the property `source_`', () async { + // TODO + }); + + // String sourceId + test('to test the property `sourceId`', () async { + // TODO + }); + + // decimal as string + // String startBalance + test('to test the property `startBalance`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/account_patch_test.dart b/app/packages/api_client/test/account_patch_test.dart new file mode 100644 index 0000000..cfea45c --- /dev/null +++ b/app/packages/api_client/test/account_patch_test.dart @@ -0,0 +1,36 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for AccountPatch +void main() { + final AccountPatch? instance = /* AccountPatch(...) */ null; + // TODO add properties to the entity + + group(AccountPatch, () { + // bool includeInNetWorth + test('to test the property `includeInNetWorth`', () async { + // TODO + }); + + // int mirrorOfAccountId + test('to test the property `mirrorOfAccountId`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // EventSource primaryEventSource + test('to test the property `primaryEventSource`', () async { + // TODO + }); + + // AccountRole role + test('to test the property `role`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/account_role_test.dart b/app/packages/api_client/test/account_role_test.dart new file mode 100644 index 0000000..ec8b247 --- /dev/null +++ b/app/packages/api_client/test/account_role_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for AccountRole +void main() { + + group(AccountRole, () { + }); +} diff --git a/app/packages/api_client/test/accounts_api_test.dart b/app/packages/api_client/test/accounts_api_test.dart new file mode 100644 index 0000000..f27fc1e --- /dev/null +++ b/app/packages/api_client/test/accounts_api_test.dart @@ -0,0 +1,29 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + + +/// tests for AccountsApi +void main() { + final instance = FintrackerApi().getAccountsApi(); + + group(AccountsApi, () { + // List + // + // Every account, archived ones included — the client decides what to show. + // + //Future> accountsList() async + test('test accountsList', () async { + // TODO + }); + + // Patch + // + // Update the user-owned fields. Everything else is overwritten by the next sync. + // + //Future accountsPatch(int accountId, AccountPatch accountPatch) async + test('test accountsPatch', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/auth_api_test.dart b/app/packages/api_client/test/auth_api_test.dart new file mode 100644 index 0000000..906beed --- /dev/null +++ b/app/packages/api_client/test/auth_api_test.dart @@ -0,0 +1,39 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + + +/// tests for AuthApi +void main() { + final instance = FintrackerApi().getAuthApi(); + + group(AuthApi, () { + // Login + // + //Future authLogin(LoginRequest loginRequest) async + test('test authLogin', () async { + // TODO + }); + + // Logout + // + //Future authLogout(RefreshRequest refreshRequest) async + test('test authLogout', () async { + // TODO + }); + + // Me + // + //Future authMe() async + test('test authMe', () async { + // TODO + }); + + // Refresh + // + //Future authRefresh(RefreshRequest refreshRequest) async + test('test authRefresh', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/broker_test.dart b/app/packages/api_client/test/broker_test.dart new file mode 100644 index 0000000..237dbe9 --- /dev/null +++ b/app/packages/api_client/test/broker_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for Broker +void main() { + + group(Broker, () { + }); +} diff --git a/app/packages/api_client/test/cash_flow_month_test.dart b/app/packages/api_client/test/cash_flow_month_test.dart new file mode 100644 index 0000000..8c11c9c --- /dev/null +++ b/app/packages/api_client/test/cash_flow_month_test.dart @@ -0,0 +1,57 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for CashFlowMonth +void main() { + final CashFlowMonth? instance = /* CashFlowMonth(...) */ null; + // TODO add properties to the entity + + group(CashFlowMonth, () { + // decimal as string + // String baselineRub + test('to test the property `baselineRub`', () async { + // TODO + }); + + // decimal as string + // String expenseRub + test('to test the property `expenseRub`', () async { + // TODO + }); + + // decimal as string + // String incomeRub + test('to test the property `incomeRub`', () async { + // TODO + }); + + // DateTime month + test('to test the property `month`', () async { + // TODO + }); + + // decimal as string + // String oneOffRub + test('to test the property `oneOffRub`', () async { + // TODO + }); + + // decimal as string + // String savingsRate + test('to test the property `savingsRate`', () async { + // TODO + }); + + // decimal as string + // String savingsTransferRub + test('to test the property `savingsTransferRub`', () async { + // TODO + }); + + // int txnCount + test('to test the property `txnCount`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/cashflow_api_test.dart b/app/packages/api_client/test/cashflow_api_test.dart new file mode 100644 index 0000000..35f8fbe --- /dev/null +++ b/app/packages/api_client/test/cashflow_api_test.dart @@ -0,0 +1,38 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + + +/// tests for CashflowApi +void main() { + final instance = FintrackerApi().getCashflowApi(); + + group(CashflowApi, () { + // Monthly + // + // The last `months` months, oldest first. + // + //Future> cashflowMonthly({ int months }) async + test('test cashflowMonthly', () async { + // TODO + }); + + // Runway + // + // How many months the liquid reserve covers; null before the first refresh. + // + //Future cashflowRunway() async + test('test cashflowRunway', () async { + // TODO + }); + + // Spending + // + // Expenses of one month by category, largest first. + // + //Future> cashflowSpending({ String month }) async + test('test cashflowSpending', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/categories_api_test.dart b/app/packages/api_client/test/categories_api_test.dart new file mode 100644 index 0000000..23fa078 --- /dev/null +++ b/app/packages/api_client/test/categories_api_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + + +/// tests for CategoriesApi +void main() { + final instance = FintrackerApi().getCategoriesApi(); + + group(CategoriesApi, () { + // List + // + // Flat list of the ZenMoney tag tree; the client nests it by `parent_id`. + // + //Future> categoriesList() async + test('test categoriesList', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/category_out_test.dart b/app/packages/api_client/test/category_out_test.dart new file mode 100644 index 0000000..cba9f27 --- /dev/null +++ b/app/packages/api_client/test/category_out_test.dart @@ -0,0 +1,51 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for CategoryOut +void main() { + final CategoryOut? instance = /* CategoryOut(...) */ null; + // TODO add properties to the entity + + group(CategoryOut, () { + // bool archived + test('to test the property `archived`', () async { + // TODO + }); + + // int color + test('to test the property `color`', () async { + // TODO + }); + + // String icon + test('to test the property `icon`', () async { + // TODO + }); + + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // int parentId + test('to test the property `parentId`', () async { + // TODO + }); + + // bool showIncome + test('to test the property `showIncome`', () async { + // TODO + }); + + // bool showOutcome + test('to test the property `showOutcome`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/data_quality_row_test.dart b/app/packages/api_client/test/data_quality_row_test.dart new file mode 100644 index 0000000..d4d3ac7 --- /dev/null +++ b/app/packages/api_client/test/data_quality_row_test.dart @@ -0,0 +1,46 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for DataQualityRow +void main() { + final DataQualityRow? instance = /* DataQualityRow(...) */ null; + // TODO add properties to the entity + + group(DataQualityRow, () { + // String checkName + test('to test the property `checkName`', () async { + // TODO + }); + + // DateTime computedAt + test('to test the property `computedAt`', () async { + // TODO + }); + + // int count + test('to test the property `count`', () async { + // TODO + }); + + // String detail + test('to test the property `detail`', () async { + // TODO + }); + + // int id + test('to test the property `id`', () async { + // TODO + }); + + // Map ref + test('to test the property `ref`', () async { + // TODO + }); + + // String severity + test('to test the property `severity`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/event_source_test.dart b/app/packages/api_client/test/event_source_test.dart new file mode 100644 index 0000000..6563a3c --- /dev/null +++ b/app/packages/api_client/test/event_source_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for EventSource +void main() { + + group(EventSource, () { + }); +} diff --git a/app/packages/api_client/test/flow_type_test.dart b/app/packages/api_client/test/flow_type_test.dart new file mode 100644 index 0000000..1867ebc --- /dev/null +++ b/app/packages/api_client/test/flow_type_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for FlowType +void main() { + + group(FlowType, () { + }); +} diff --git a/app/packages/api_client/test/health_api_test.dart b/app/packages/api_client/test/health_api_test.dart new file mode 100644 index 0000000..1b6f7bf --- /dev/null +++ b/app/packages/api_client/test/health_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + + +/// tests for HealthApi +void main() { + final instance = FintrackerApi().getHealthApi(); + + group(HealthApi, () { + // Check + // + //Future healthCheck() async + test('test healthCheck', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/health_test.dart b/app/packages/api_client/test/health_test.dart new file mode 100644 index 0000000..4d5de58 --- /dev/null +++ b/app/packages/api_client/test/health_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for Health +void main() { + final Health? instance = /* Health(...) */ null; + // TODO add properties to the entity + + group(Health, () { + // String database + test('to test the property `database`', () async { + // TODO + }); + + // String status + test('to test the property `status`', () async { + // TODO + }); + + // String version + test('to test the property `version`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/http_validation_error_test.dart b/app/packages/api_client/test/http_validation_error_test.dart new file mode 100644 index 0000000..3e36eb0 --- /dev/null +++ b/app/packages/api_client/test/http_validation_error_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for HTTPValidationError +void main() { + final HTTPValidationError? instance = /* HTTPValidationError(...) */ null; + // TODO add properties to the entity + + group(HTTPValidationError, () { + // List detail + test('to test the property `detail`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/job_status_test.dart b/app/packages/api_client/test/job_status_test.dart new file mode 100644 index 0000000..3cc6a1a --- /dev/null +++ b/app/packages/api_client/test/job_status_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for JobStatus +void main() { + + group(JobStatus, () { + }); +} diff --git a/app/packages/api_client/test/location_inner_test.dart b/app/packages/api_client/test/location_inner_test.dart new file mode 100644 index 0000000..781db7f --- /dev/null +++ b/app/packages/api_client/test/location_inner_test.dart @@ -0,0 +1,11 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for LocationInner +void main() { + final LocationInner? instance = /* LocationInner(...) */ null; + // TODO add properties to the entity + + group(LocationInner, () { + }); +} diff --git a/app/packages/api_client/test/login_request_test.dart b/app/packages/api_client/test/login_request_test.dart new file mode 100644 index 0000000..2c724d2 --- /dev/null +++ b/app/packages/api_client/test/login_request_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for LoginRequest +void main() { + final LoginRequest? instance = /* LoginRequest(...) */ null; + // TODO add properties to the entity + + group(LoginRequest, () { + // String email + test('to test the property `email`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/metrics_api_test.dart b/app/packages/api_client/test/metrics_api_test.dart new file mode 100644 index 0000000..4a6c900 --- /dev/null +++ b/app/packages/api_client/test/metrics_api_test.dart @@ -0,0 +1,38 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + + +/// tests for MetricsApi +void main() { + final instance = FintrackerApi().getMetricsApi(); + + group(MetricsApi, () { + // Data Quality + // + // Findings of the latest refresh, most serious first. + // + //Future> metricsDataQuality() async + test('test metricsDataQuality', () async { + // TODO + }); + + // Refresh + // + // Rebuild every metric_* table inline (seconds at personal volumes). + // + //Future metricsRefresh() async + test('test metricsRefresh', () async { + // TODO + }); + + // Status + // + // When the metric tables were last rebuilt, and whether it failed. + // + //Future metricsStatus() async + test('test metricsStatus', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/net_worth_breakdown_test.dart b/app/packages/api_client/test/net_worth_breakdown_test.dart new file mode 100644 index 0000000..a905fb6 --- /dev/null +++ b/app/packages/api_client/test/net_worth_breakdown_test.dart @@ -0,0 +1,61 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for NetWorthBreakdown +void main() { + final NetWorthBreakdown? instance = /* NetWorthBreakdown(...) */ null; + // TODO add properties to the entity + + group(NetWorthBreakdown, () { + // List accounts + test('to test the property `accounts`', () async { + // TODO + }); + + // Map byCurrency + test('to test the property `byCurrency`', () async { + // TODO + }); + + // DateTime d + test('to test the property `d`', () async { + // TODO + }); + + // decimal as string + // String debtRub + test('to test the property `debtRub`', () async { + // TODO + }); + + // decimal as string + // String investmentRub + test('to test the property `investmentRub`', () async { + // TODO + }); + + // decimal as string + // String liquidRub + test('to test the property `liquidRub`', () async { + // TODO + }); + + // int missingFxCount + test('to test the property `missingFxCount`', () async { + // TODO + }); + + // decimal as string + // String savingsRub + test('to test the property `savingsRub`', () async { + // TODO + }); + + // decimal as string + // String totalRub + test('to test the property `totalRub`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/net_worth_day_test.dart b/app/packages/api_client/test/net_worth_day_test.dart new file mode 100644 index 0000000..237715e --- /dev/null +++ b/app/packages/api_client/test/net_worth_day_test.dart @@ -0,0 +1,56 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for NetWorthDay +void main() { + final NetWorthDay? instance = /* NetWorthDay(...) */ null; + // TODO add properties to the entity + + group(NetWorthDay, () { + // Map byCurrency + test('to test the property `byCurrency`', () async { + // TODO + }); + + // DateTime d + test('to test the property `d`', () async { + // TODO + }); + + // decimal as string + // String debtRub + test('to test the property `debtRub`', () async { + // TODO + }); + + // decimal as string + // String investmentRub + test('to test the property `investmentRub`', () async { + // TODO + }); + + // decimal as string + // String liquidRub + test('to test the property `liquidRub`', () async { + // TODO + }); + + // int missingFxCount + test('to test the property `missingFxCount`', () async { + // TODO + }); + + // decimal as string + // String savingsRub + test('to test the property `savingsRub`', () async { + // TODO + }); + + // decimal as string + // String totalRub + test('to test the property `totalRub`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/networth_api_test.dart b/app/packages/api_client/test/networth_api_test.dart new file mode 100644 index 0000000..02db8ba --- /dev/null +++ b/app/packages/api_client/test/networth_api_test.dart @@ -0,0 +1,29 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + + +/// tests for NetworthApi +void main() { + final instance = FintrackerApi().getNetworthApi(); + + group(NetworthApi, () { + // Breakdown + // + // The latest day's buckets, plus every account's current balance native and in RUB. + // + //Future networthBreakdown() async + test('test networthBreakdown', () async { + // TODO + }); + + // Series + // + // Daily net worth; defaults to the last 365 days. + // + //Future> networthSeries({ DateTime from, DateTime to }) async + test('test networthSeries', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/problem_test.dart b/app/packages/api_client/test/problem_test.dart new file mode 100644 index 0000000..c5f2b73 --- /dev/null +++ b/app/packages/api_client/test/problem_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for Problem +void main() { + final Problem? instance = /* Problem(...) */ null; + // TODO add properties to the entity + + group(Problem, () { + // String detail + test('to test the property `detail`', () async { + // TODO + }); + + // List errors + test('to test the property `errors`', () async { + // TODO + }); + + // int status + test('to test the property `status`', () async { + // TODO + }); + + // String title + test('to test the property `title`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/refresh_log_out_test.dart b/app/packages/api_client/test/refresh_log_out_test.dart new file mode 100644 index 0000000..70a54f6 --- /dev/null +++ b/app/packages/api_client/test/refresh_log_out_test.dart @@ -0,0 +1,36 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for RefreshLogOut +void main() { + final RefreshLogOut? instance = /* RefreshLogOut(...) */ null; + // TODO add properties to the entity + + group(RefreshLogOut, () { + // String error + test('to test the property `error`', () async { + // TODO + }); + + // DateTime finishedAt + test('to test the property `finishedAt`', () async { + // TODO + }); + + // int id + test('to test the property `id`', () async { + // TODO + }); + + // DateTime startedAt + test('to test the property `startedAt`', () async { + // TODO + }); + + // String trigger + test('to test the property `trigger`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/refresh_request_test.dart b/app/packages/api_client/test/refresh_request_test.dart new file mode 100644 index 0000000..f3c15a8 --- /dev/null +++ b/app/packages/api_client/test/refresh_request_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for RefreshRequest +void main() { + final RefreshRequest? instance = /* RefreshRequest(...) */ null; + // TODO add properties to the entity + + group(RefreshRequest, () { + // String refreshToken + test('to test the property `refreshToken`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/rule_create_test.dart b/app/packages/api_client/test/rule_create_test.dart new file mode 100644 index 0000000..6a96ead --- /dev/null +++ b/app/packages/api_client/test/rule_create_test.dart @@ -0,0 +1,46 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for RuleCreate +void main() { + final RuleCreate? instance = /* RuleCreate(...) */ null; + // TODO add properties to the entity + + group(RuleCreate, () { + // bool enabled (default value: true) + test('to test the property `enabled`', () async { + // TODO + }); + + // RuleKind kind + test('to test the property `kind`', () async { + // TODO + }); + + // RuleMatchType matchType + test('to test the property `matchType`', () async { + // TODO + }); + + // String note + test('to test the property `note`', () async { + // TODO + }); + + // String pattern + test('to test the property `pattern`', () async { + // TODO + }); + + // int priority (default value: 100) + test('to test the property `priority`', () async { + // TODO + }); + + // String value + test('to test the property `value`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/rule_kind_test.dart b/app/packages/api_client/test/rule_kind_test.dart new file mode 100644 index 0000000..61c1cc6 --- /dev/null +++ b/app/packages/api_client/test/rule_kind_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for RuleKind +void main() { + + group(RuleKind, () { + }); +} diff --git a/app/packages/api_client/test/rule_match_type_test.dart b/app/packages/api_client/test/rule_match_type_test.dart new file mode 100644 index 0000000..b729f73 --- /dev/null +++ b/app/packages/api_client/test/rule_match_type_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for RuleMatchType +void main() { + + group(RuleMatchType, () { + }); +} diff --git a/app/packages/api_client/test/rule_out_test.dart b/app/packages/api_client/test/rule_out_test.dart new file mode 100644 index 0000000..95e0109 --- /dev/null +++ b/app/packages/api_client/test/rule_out_test.dart @@ -0,0 +1,61 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for RuleOut +void main() { + final RuleOut? instance = /* RuleOut(...) */ null; + // TODO add properties to the entity + + group(RuleOut, () { + // bool enabled + test('to test the property `enabled`', () async { + // TODO + }); + + // int id + test('to test the property `id`', () async { + // TODO + }); + + // RuleKind kind + test('to test the property `kind`', () async { + // TODO + }); + + // DateTime lastMatchedAt + test('to test the property `lastMatchedAt`', () async { + // TODO + }); + + // int matchCount + test('to test the property `matchCount`', () async { + // TODO + }); + + // RuleMatchType matchType + test('to test the property `matchType`', () async { + // TODO + }); + + // String note + test('to test the property `note`', () async { + // TODO + }); + + // String pattern + test('to test the property `pattern`', () async { + // TODO + }); + + // int priority + test('to test the property `priority`', () async { + // TODO + }); + + // String value + test('to test the property `value`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/rule_patch_test.dart b/app/packages/api_client/test/rule_patch_test.dart new file mode 100644 index 0000000..728f322 --- /dev/null +++ b/app/packages/api_client/test/rule_patch_test.dart @@ -0,0 +1,46 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for RulePatch +void main() { + final RulePatch? instance = /* RulePatch(...) */ null; + // TODO add properties to the entity + + group(RulePatch, () { + // bool enabled + test('to test the property `enabled`', () async { + // TODO + }); + + // RuleKind kind + test('to test the property `kind`', () async { + // TODO + }); + + // RuleMatchType matchType + test('to test the property `matchType`', () async { + // TODO + }); + + // String note + test('to test the property `note`', () async { + // TODO + }); + + // String pattern + test('to test the property `pattern`', () async { + // TODO + }); + + // int priority + test('to test the property `priority`', () async { + // TODO + }); + + // String value + test('to test the property `value`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/rules_api_test.dart b/app/packages/api_client/test/rules_api_test.dart new file mode 100644 index 0000000..23f9bb2 --- /dev/null +++ b/app/packages/api_client/test/rules_api_test.dart @@ -0,0 +1,57 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + + +/// tests for RulesApi +void main() { + final instance = FintrackerApi().getRulesApi(); + + group(RulesApi, () { + // Apply + // + // Re-run the whole metric refresh so edited rules take effect everywhere at once. + // + //Future rulesApply() async + test('test rulesApply', () async { + // TODO + }); + + // Create + // + //Future rulesCreate(RuleCreate ruleCreate) async + test('test rulesCreate', () async { + // TODO + }); + + // Delete + // + //Future rulesDelete(int ruleId) async + test('test rulesDelete', () async { + // TODO + }); + + // List + // + //Future> rulesList() async + test('test rulesList', () async { + // TODO + }); + + // Patch + // + //Future rulesPatch(int ruleId, RulePatch rulePatch) async + test('test rulesPatch', () async { + // TODO + }); + + // Stale + // + // Enabled rules that matched nothing in the latest refresh: the payee was renamed, or the transaction was re-categorised in ZenMoney. + // + //Future> rulesStale() async + test('test rulesStale', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/run_status_test.dart b/app/packages/api_client/test/run_status_test.dart new file mode 100644 index 0000000..65c6b2f --- /dev/null +++ b/app/packages/api_client/test/run_status_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for RunStatus +void main() { + + group(RunStatus, () { + }); +} diff --git a/app/packages/api_client/test/runway_out_test.dart b/app/packages/api_client/test/runway_out_test.dart new file mode 100644 index 0000000..2069085 --- /dev/null +++ b/app/packages/api_client/test/runway_out_test.dart @@ -0,0 +1,34 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for RunwayOut +void main() { + final RunwayOut? instance = /* RunwayOut(...) */ null; + // TODO add properties to the entity + + group(RunwayOut, () { + // DateTime asOf + test('to test the property `asOf`', () async { + // TODO + }); + + // decimal as string + // String avgBaseline3mRub + test('to test the property `avgBaseline3mRub`', () async { + // TODO + }); + + // decimal as string + // String liquidReserveRub + test('to test the property `liquidReserveRub`', () async { + // TODO + }); + + // decimal as string + // String runwayMonths + test('to test the property `runwayMonths`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/source_status_test.dart b/app/packages/api_client/test/source_status_test.dart new file mode 100644 index 0000000..d4b840c --- /dev/null +++ b/app/packages/api_client/test/source_status_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for SourceStatus +void main() { + final SourceStatus? instance = /* SourceStatus(...) */ null; + // TODO add properties to the entity + + group(SourceStatus, () { + // String cursor + test('to test the property `cursor`', () async { + // TODO + }); + + // DateTime lastRunAt + test('to test the property `lastRunAt`', () async { + // TODO + }); + + // RunStatus lastRunStatus + test('to test the property `lastRunStatus`', () async { + // TODO + }); + + // DateTime lastSuccessAt + test('to test the property `lastSuccessAt`', () async { + // TODO + }); + + // bool queued + test('to test the property `queued`', () async { + // TODO + }); + + // String source_ + test('to test the property `source_`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/spending_row_test.dart b/app/packages/api_client/test/spending_row_test.dart new file mode 100644 index 0000000..3b1cdfe --- /dev/null +++ b/app/packages/api_client/test/spending_row_test.dart @@ -0,0 +1,47 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for SpendingRow +void main() { + final SpendingRow? instance = /* SpendingRow(...) */ null; + // TODO add properties to the entity + + group(SpendingRow, () { + // decimal as string + // String amountRub + test('to test the property `amountRub`', () async { + // TODO + }); + + // int categoryId + test('to test the property `categoryId`', () async { + // TODO + }); + + // String categoryName + test('to test the property `categoryName`', () async { + // TODO + }); + + // DateTime month + test('to test the property `month`', () async { + // TODO + }); + + // int rootCategoryId + test('to test the property `rootCategoryId`', () async { + // TODO + }); + + // String rootCategoryName + test('to test the property `rootCategoryName`', () async { + // TODO + }); + + // int txnCount + test('to test the property `txnCount`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/sync_api_test.dart b/app/packages/api_client/test/sync_api_test.dart new file mode 100644 index 0000000..9a74fc4 --- /dev/null +++ b/app/packages/api_client/test/sync_api_test.dart @@ -0,0 +1,32 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + + +/// tests for SyncApi +void main() { + final instance = FintrackerApi().getSyncApi(); + + group(SyncApi, () { + // Runs + // + //Future> syncRuns({ String source_, int limit }) async + test('test syncRuns', () async { + // TODO + }); + + // Status + // + //Future> syncStatus() async + test('test syncStatus', () async { + // TODO + }); + + // Trigger + // + //Future syncTrigger(String source_) async + test('test syncTrigger', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/sync_job_out_test.dart b/app/packages/api_client/test/sync_job_out_test.dart new file mode 100644 index 0000000..e9c2848 --- /dev/null +++ b/app/packages/api_client/test/sync_job_out_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for SyncJobOut +void main() { + final SyncJobOut? instance = /* SyncJobOut(...) */ null; + // TODO add properties to the entity + + group(SyncJobOut, () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // DateTime requestedAt + test('to test the property `requestedAt`', () async { + // TODO + }); + + // String source_ + test('to test the property `source_`', () async { + // TODO + }); + + // JobStatus status + test('to test the property `status`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/sync_run_out_test.dart b/app/packages/api_client/test/sync_run_out_test.dart new file mode 100644 index 0000000..d3e13c0 --- /dev/null +++ b/app/packages/api_client/test/sync_run_out_test.dart @@ -0,0 +1,66 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for SyncRunOut +void main() { + final SyncRunOut? instance = /* SyncRunOut(...) */ null; + // TODO add properties to the entity + + group(SyncRunOut, () { + // Map counts + test('to test the property `counts`', () async { + // TODO + }); + + // String cursorAfter + test('to test the property `cursorAfter`', () async { + // TODO + }); + + // String cursorBefore + test('to test the property `cursorBefore`', () async { + // TODO + }); + + // String error + test('to test the property `error`', () async { + // TODO + }); + + // DateTime finishedAt + test('to test the property `finishedAt`', () async { + // TODO + }); + + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String source_ + test('to test the property `source_`', () async { + // TODO + }); + + // DateTime startedAt + test('to test the property `startedAt`', () async { + // TODO + }); + + // RunStatus status + test('to test the property `status`', () async { + // TODO + }); + + // String triggeredBy + test('to test the property `triggeredBy`', () async { + // TODO + }); + + // List warnings + test('to test the property `warnings`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/token_pair_test.dart b/app/packages/api_client/test/token_pair_test.dart new file mode 100644 index 0000000..3eeda3c --- /dev/null +++ b/app/packages/api_client/test/token_pair_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for TokenPair +void main() { + final TokenPair? instance = /* TokenPair(...) */ null; + // TODO add properties to the entity + + group(TokenPair, () { + // String accessToken + test('to test the property `accessToken`', () async { + // TODO + }); + + // int expiresIn + test('to test the property `expiresIn`', () async { + // TODO + }); + + // String refreshToken + test('to test the property `refreshToken`', () async { + // TODO + }); + + // String tokenType (default value: 'bearer') + test('to test the property `tokenType`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/transaction_out_test.dart b/app/packages/api_client/test/transaction_out_test.dart new file mode 100644 index 0000000..d0de79a --- /dev/null +++ b/app/packages/api_client/test/transaction_out_test.dart @@ -0,0 +1,130 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for TransactionOut +void main() { + final TransactionOut? instance = /* TransactionOut(...) */ null; + // TODO add properties to the entity + + group(TransactionOut, () { + // int categoryId + test('to test the property `categoryId`', () async { + // TODO + }); + + // String comment + test('to test the property `comment`', () async { + // TODO + }); + + // DateTime date + test('to test the property `date`', () async { + // TODO + }); + + // bool deleted + test('to test the property `deleted`', () async { + // TODO + }); + + // FlowType flowType + test('to test the property `flowType`', () async { + // TODO + }); + + // bool hold + test('to test the property `hold`', () async { + // TODO + }); + + // int id + test('to test the property `id`', () async { + // TODO + }); + + // decimal as string + // String income + test('to test the property `income`', () async { + // TODO + }); + + // int incomeAccountId + test('to test the property `incomeAccountId`', () async { + // TODO + }); + + // String incomeCurrency + test('to test the property `incomeCurrency`', () async { + // TODO + }); + + // decimal as string + // String incomeRub + test('to test the property `incomeRub`', () async { + // TODO + }); + + // bool isOneOff + test('to test the property `isOneOff`', () async { + // TODO + }); + + // int mcc + test('to test the property `mcc`', () async { + // TODO + }); + + // decimal as string + // String outcome + test('to test the property `outcome`', () async { + // TODO + }); + + // int outcomeAccountId + test('to test the property `outcomeAccountId`', () async { + // TODO + }); + + // String outcomeCurrency + test('to test the property `outcomeCurrency`', () async { + // TODO + }); + + // decimal as string + // String outcomeRub + test('to test the property `outcomeRub`', () async { + // TODO + }); + + // String payee + test('to test the property `payee`', () async { + // TODO + }); + + // String payeeCanonical + test('to test the property `payeeCanonical`', () async { + // TODO + }); + + // String sourceId + test('to test the property `sourceId`', () async { + // TODO + }); + + // List tags + test('to test the property `tags`', () async { + // TODO + }); + + // int tripId + test('to test the property `tripId`', () async { + // TODO + }); + + // DateTime ts + test('to test the property `ts`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/transaction_page_test.dart b/app/packages/api_client/test/transaction_page_test.dart new file mode 100644 index 0000000..a26c3fd --- /dev/null +++ b/app/packages/api_client/test/transaction_page_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for TransactionPage +void main() { + final TransactionPage? instance = /* TransactionPage(...) */ null; + // TODO add properties to the entity + + group(TransactionPage, () { + // List items + test('to test the property `items`', () async { + // TODO + }); + + // int page + test('to test the property `page`', () async { + // TODO + }); + + // int pageSize + test('to test the property `pageSize`', () async { + // TODO + }); + + // int total + test('to test the property `total`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/transactions_api_test.dart b/app/packages/api_client/test/transactions_api_test.dart new file mode 100644 index 0000000..ae60fb2 --- /dev/null +++ b/app/packages/api_client/test/transactions_api_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + + +/// tests for TransactionsApi +void main() { + final instance = FintrackerApi().getTransactionsApi(); + + group(TransactionsApi, () { + // List + // + // One page of transactions, newest first, with RUB amounts at each own date's rate. + // + //Future transactionsList({ DateTime from, DateTime to, int accountId, int categoryId, FlowType flowType, String q, bool includeDeleted, int page, int pageSize }) async + test('test transactionsList', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/user_out_test.dart b/app/packages/api_client/test/user_out_test.dart new file mode 100644 index 0000000..5c8d892 --- /dev/null +++ b/app/packages/api_client/test/user_out_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for UserOut +void main() { + final UserOut? instance = /* UserOut(...) */ null; + // TODO add properties to the entity + + group(UserOut, () { + // String email + test('to test the property `email`', () async { + // TODO + }); + + // int id + test('to test the property `id`', () async { + // TODO + }); + + }); +} diff --git a/app/packages/api_client/test/validation_error_test.dart b/app/packages/api_client/test/validation_error_test.dart new file mode 100644 index 0000000..013d9c8 --- /dev/null +++ b/app/packages/api_client/test/validation_error_test.dart @@ -0,0 +1,36 @@ +import 'package:test/test.dart'; +import 'package:fintracker_api/fintracker_api.dart'; + +// tests for ValidationError +void main() { + final ValidationError? instance = /* ValidationError(...) */ null; + // TODO add properties to the entity + + group(ValidationError, () { + // Object ctx + test('to test the property `ctx`', () async { + // TODO + }); + + // Object input + test('to test the property `input`', () async { + // TODO + }); + + // List loc + test('to test the property `loc`', () async { + // TODO + }); + + // String msg + test('to test the property `msg`', () async { + // TODO + }); + + // String type + test('to test the property `type`', () async { + // TODO + }); + + }); +}