chore(app): сгенерированный Dart-клиент

just gen-client — покрывает links, cashflow-broker, ручные цены,
imports/pending, goals/income/rebalance/tax/benchmarks.
This commit is contained in:
Dmitry
2026-09-19 10:46:09 +03:00
parent b69bb4a0c9
commit ccd06f32f7
242 changed files with 25877 additions and 3 deletions
@@ -11,6 +11,7 @@ import 'package:dio/dio.dart';
import 'package:fintracker_api/src/model/allocation_bucket.dart';
import 'package:fintracker_api/src/model/allocation_dimension.dart';
import 'package:fintracker_api/src/model/cash_flow_broker_month.dart';
import 'package:fintracker_api/src/model/holding_out.dart';
import 'package:fintracker_api/src/model/problem.dart';
import 'package:fintracker_api/src/model/returns_out.dart';
@@ -110,6 +111,89 @@ _responseData = rawData == null ? null : deserialize<List<AllocationBucket>, All
);
}
/// Cashflow Broker
/// Money moved across the brokerage boundary, by month: the other half of cash flow that &#x60;metric_cash_flow_monthly&#x60; (ZenMoney spending) does not cover.
///
/// Parameters:
/// * [scope] - all | account:<id> | portfolio:<id>
/// * [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<CashFlowBrokerMonth>] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<List<CashFlowBrokerMonth>>> analyticsCashflowBroker({
String? scope = 'all',
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/analytics/cashflow-broker';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (scope != null) r'scope': scope,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
List<CashFlowBrokerMonth>? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<List<CashFlowBrokerMonth>, CashFlowBrokerMonth>(rawData, 'List<CashFlowBrokerMonth>', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<List<CashFlowBrokerMonth>>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Holdings
/// Open positions, most valuable first; unpriced ones last with null values.
///
@@ -0,0 +1,435 @@
//
// 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/benchmark_comparison.dart';
import 'package:fintracker_api/src/model/benchmark_create.dart';
import 'package:fintracker_api/src/model/benchmark_out.dart';
import 'package:fintracker_api/src/model/benchmark_patch.dart';
import 'package:fintracker_api/src/model/problem.dart';
class BenchmarksApi {
final Dio _dio;
const BenchmarksApi(this._dio);
/// Benchmarks
/// The portfolio&#39;s TWR beside each benchmark&#39;s, on the same grid of days. &#x60;days_skipped&#x60; is returned on both sides and is not cosmetic: a non-zero value on either means the two chains did not cover the same days, and the difference is then an approximation of an excess return rather than one.
///
/// Parameters:
/// * [scope] - all | account:<id> | portfolio:<id>
/// * [period] - repeatable: 1m 3m 6m ytd 1y 3y all
/// * [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 [BenchmarkComparison] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<BenchmarkComparison>> benchmarksBenchmarks({
String? scope = 'all',
List<String?>? period,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/analytics/benchmarks';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (scope != null) r'scope': scope,
if (period != null) r'period': period,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
BenchmarkComparison? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<BenchmarkComparison, BenchmarkComparison>(rawData, 'BenchmarkComparison', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<BenchmarkComparison>(
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:
/// * [benchmarkCreate]
/// * [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 [BenchmarkOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<BenchmarkOut>> benchmarksCreate({
required BenchmarkCreate benchmarkCreate,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/benchmarks';
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
contentType: 'application/json',
validateStatus: validateStatus,
);
dynamic _bodyData;
try {
_bodyData = jsonEncode(benchmarkCreate);
} catch(error, stackTrace) {
throw DioException(
requestOptions: _options.compose(
_dio.options,
_path,
),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
BenchmarkOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<BenchmarkOut, BenchmarkOut>(rawData, 'BenchmarkOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<BenchmarkOut>(
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:
/// * [benchmarkId]
/// * [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<Response<void>> benchmarksDelete({
required int benchmarkId,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/benchmarks/{benchmark_id}'.replaceAll('{' r'benchmark_id' '}', benchmarkId.toString());
final _options = Options(
method: r'DELETE',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _response = await _dio.request<Object>(
_path,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
return _response;
}
/// List
/// Every benchmark, defaults first — the order the comparison block shows them in.
///
/// 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<BenchmarkOut>] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<List<BenchmarkOut>>> benchmarksList({
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/benchmarks';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _response = await _dio.request<Object>(
_path,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
List<BenchmarkOut>? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<List<BenchmarkOut>, BenchmarkOut>(rawData, 'List<BenchmarkOut>', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<List<BenchmarkOut>>(
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:
/// * [benchmarkId]
/// * [benchmarkPatch]
/// * [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 [BenchmarkOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<BenchmarkOut>> benchmarksPatch({
required int benchmarkId,
required BenchmarkPatch benchmarkPatch,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/benchmarks/{benchmark_id}'.replaceAll('{' r'benchmark_id' '}', benchmarkId.toString());
final _options = Options(
method: r'PATCH',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
contentType: 'application/json',
validateStatus: validateStatus,
);
dynamic _bodyData;
try {
_bodyData = jsonEncode(benchmarkPatch);
} catch(error, stackTrace) {
throw DioException(
requestOptions: _options.compose(
_dio.options,
_path,
),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
BenchmarkOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<BenchmarkOut, BenchmarkOut>(rawData, 'BenchmarkOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<BenchmarkOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
}
@@ -0,0 +1,434 @@
//
// 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/goal_create.dart';
import 'package:fintracker_api/src/model/goal_out.dart';
import 'package:fintracker_api/src/model/goal_patch.dart';
import 'package:fintracker_api/src/model/goal_progress_out.dart';
import 'package:fintracker_api/src/model/problem.dart';
class GoalsApi {
final Dio _dio;
const GoalsApi(this._dio);
/// Create
///
///
/// Parameters:
/// * [goalCreate]
/// * [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 [GoalOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<GoalOut>> goalsCreate({
required GoalCreate goalCreate,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/goals';
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
contentType: 'application/json',
validateStatus: validateStatus,
);
dynamic _bodyData;
try {
_bodyData = jsonEncode(goalCreate);
} catch(error, stackTrace) {
throw DioException(
requestOptions: _options.compose(
_dio.options,
_path,
),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
GoalOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<GoalOut, GoalOut>(rawData, 'GoalOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<GoalOut>(
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:
/// * [goalId]
/// * [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<Response<void>> goalsDelete({
required int goalId,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/goals/{goal_id}'.replaceAll('{' r'goal_id' '}', goalId.toString());
final _options = Options(
method: r'DELETE',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _response = await _dio.request<Object>(
_path,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
return _response;
}
/// List
///
///
/// Parameters:
/// * [includeArchived]
/// * [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<GoalOut>] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<List<GoalOut>>> goalsList({
bool? includeArchived = false,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/goals';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (includeArchived != null) r'include_archived': includeArchived,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
List<GoalOut>? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<List<GoalOut>, GoalOut>(rawData, 'List<GoalOut>', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<List<GoalOut>>(
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:
/// * [goalId]
/// * [goalPatch]
/// * [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 [GoalOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<GoalOut>> goalsPatch({
required int goalId,
required GoalPatch goalPatch,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/goals/{goal_id}'.replaceAll('{' r'goal_id' '}', goalId.toString());
final _options = Options(
method: r'PATCH',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
contentType: 'application/json',
validateStatus: validateStatus,
);
dynamic _bodyData;
try {
_bodyData = jsonEncode(goalPatch);
} catch(error, stackTrace) {
throw DioException(
requestOptions: _options.compose(
_dio.options,
_path,
),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
GoalOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<GoalOut, GoalOut>(rawData, 'GoalOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<GoalOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Progress
///
///
/// Parameters:
/// * [goalId]
/// * [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 [GoalProgressOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<GoalProgressOut>> goalsProgress({
required int goalId,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/goals/{goal_id}/progress'.replaceAll('{' r'goal_id' '}', goalId.toString());
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _response = await _dio.request<Object>(
_path,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
GoalProgressOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<GoalProgressOut, GoalProgressOut>(rawData, 'GoalProgressOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<GoalProgressOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
}
@@ -0,0 +1,448 @@
//
// 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/commit_request.dart';
import 'package:fintracker_api/src/model/import_preview.dart';
import 'package:fintracker_api/src/model/import_result.dart';
import 'package:fintracker_api/src/model/import_summary.dart';
import 'package:fintracker_api/src/model/problem.dart';
class ImportsApi {
final Dio _dio;
const ImportsApi(this._dio);
/// Commit
/// Write the file&#39;s events into the ledger and rebuild every metric.
///
/// Parameters:
/// * [importId]
/// * [commitRequest]
/// * [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 [ImportResult] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<ImportResult>> importsCommit({
required int importId,
required CommitRequest commitRequest,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/imports/{import_id}/commit'.replaceAll('{' r'import_id' '}', importId.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
contentType: 'application/json',
validateStatus: validateStatus,
);
dynamic _bodyData;
try {
_bodyData = jsonEncode(commitRequest);
} catch(error, stackTrace) {
throw DioException(
requestOptions: _options.compose(
_dio.options,
_path,
),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
ImportResult? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<ImportResult, ImportResult>(rawData, 'ImportResult', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<ImportResult>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Create
/// Upload a report, parse it and show what committing it would do. Writes no event.
///
/// Parameters:
/// * [file] - the report itself
/// * [accountId] - target account, if known
/// * [parser] - force a parser from registry.names()
/// * [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 [ImportPreview] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<ImportPreview>> importsCreate({
required MultipartFile file,
int? accountId,
String? parser,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/imports';
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
contentType: 'multipart/form-data',
validateStatus: validateStatus,
);
dynamic _bodyData;
try {
_bodyData = FormData.fromMap(<String, dynamic>{
r'account_id': accountId,
r'file': file,
r'parser': parser,
});
} catch(error, stackTrace) {
throw DioException(
requestOptions: _options.compose(
_dio.options,
_path,
),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
ImportPreview? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<ImportPreview, ImportPreview>(rawData, 'ImportPreview', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<ImportPreview>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Delete
/// Drop an uncommitted import. A committed one stays: &#x60;raw_*&#x60; is append-only.
///
/// Parameters:
/// * [importId]
/// * [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<Response<void>> importsDelete({
required int importId,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/imports/{import_id}'.replaceAll('{' r'import_id' '}', importId.toString());
final _options = Options(
method: r'DELETE',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _response = await _dio.request<Object>(
_path,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
return _response;
}
/// Get
/// The preview again — recomputed for an uncommitted import, replayed for a committed one.
///
/// Parameters:
/// * [importId]
/// * [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 [ImportPreview] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<ImportPreview>> importsGet({
required int importId,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/imports/{import_id}'.replaceAll('{' r'import_id' '}', importId.toString());
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _response = await _dio.request<Object>(
_path,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
ImportPreview? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<ImportPreview, ImportPreview>(rawData, 'ImportPreview', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<ImportPreview>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// List
/// Newest imports first, with the counters each was committed with.
///
/// Parameters:
/// * [status] - uploaded | parsed | committed | failed
/// * [limit]
/// * [offset]
/// * [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<ImportSummary>] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<List<ImportSummary>>> importsList({
String? status,
int? limit = 50,
int? offset = 0,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/imports';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (status != null) r'status': status,
if (limit != null) r'limit': limit,
if (offset != null) r'offset': offset,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
List<ImportSummary>? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<List<ImportSummary>, ImportSummary>(rawData, 'List<ImportSummary>', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<List<ImportSummary>>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
}
@@ -0,0 +1,296 @@
//
// 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/calendar_out.dart';
import 'package:fintracker_api/src/model/forecast_out.dart';
import 'package:fintracker_api/src/model/history_out.dart';
import 'package:fintracker_api/src/model/problem.dart';
class IncomeApi {
final Dio _dio;
const IncomeApi(this._dio);
/// Calendar
/// Payments in a window, one row each; defaults to the next 12 months, forecast only.
///
/// Parameters:
/// * [scope] - all | account:<id> | portfolio:<id>
/// * [dateFrom]
/// * [dateTo]
/// * [includePaid]
/// * [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 [CalendarOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<CalendarOut>> incomeCalendar({
String? scope = 'all',
DateTime? dateFrom,
DateTime? dateTo,
bool? includePaid = false,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/income/calendar';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (scope != null) r'scope': scope,
if (dateFrom != null) r'date_from': dateFrom,
if (dateTo != null) r'date_to': dateTo,
if (includePaid != null) r'include_paid': includePaid,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
CalendarOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<CalendarOut, CalendarOut>(rawData, 'CalendarOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<CalendarOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Forecast
/// Expected income per month, split by basis, plus the yield it implies.
///
/// Parameters:
/// * [scope] - all | account:<id> | portfolio:<id>
/// * [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 [ForecastOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<ForecastOut>> incomeForecast({
String? scope = 'all',
int? months = 12,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/income/forecast';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (scope != null) r'scope': scope,
if (months != null) r'months': months,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
ForecastOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<ForecastOut, ForecastOut>(rawData, 'ForecastOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<ForecastOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// History
/// Income actually received, grouped by month, kind and currency. &#x60;group&#x60; exists for the contract&#39;s sake and accepts only &#x60;month&#x60;: the table is stored monthly, and a finer grouping would have to re-read the ledger, which is what the calendar&#39;s &#x60;paid&#x60; rows already do per payment.
///
/// Parameters:
/// * [scope] - all | account:<id> | portfolio:<id>
/// * [group] - month
/// * [dateFrom]
/// * [dateTo]
/// * [kind] - dividend | coupon | …
/// * [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 [HistoryOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<HistoryOut>> incomeHistory({
String? scope = 'all',
String? group = 'month',
DateTime? dateFrom,
DateTime? dateTo,
String? kind,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/income/history';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (scope != null) r'scope': scope,
if (group != null) r'group': group,
if (dateFrom != null) r'date_from': dateFrom,
if (dateTo != null) r'date_to': dateTo,
if (kind != null) r'kind': kind,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
HistoryOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<HistoryOut, HistoryOut>(rawData, 'HistoryOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<HistoryOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
}
@@ -11,6 +11,11 @@ import 'package:dio/dio.dart';
import 'package:fintracker_api/src/model/instrument_detail.dart';
import 'package:fintracker_api/src/model/instrument_out.dart';
import 'package:fintracker_api/src/model/pending_instrument_out.dart';
import 'package:fintracker_api/src/model/pending_resolve_request.dart';
import 'package:fintracker_api/src/model/pending_resolve_result.dart';
import 'package:fintracker_api/src/model/price_manual_in.dart';
import 'package:fintracker_api/src/model/price_manual_out.dart';
import 'package:fintracker_api/src/model/problem.dart';
class InstrumentsApi {
@@ -199,4 +204,291 @@ _responseData = rawData == null ? null : deserialize<List<InstrumentOut>, Instru
);
}
/// Pending
/// Instruments a report named that nothing in the master resolves to.
///
/// Parameters:
/// * [status] - pending | resolved | ignored | all
/// * [limit]
/// * [offset]
/// * [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<PendingInstrumentOut>] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<List<PendingInstrumentOut>>> instrumentsPending({
String? status = 'pending',
int? limit = 100,
int? offset = 0,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/instruments/pending';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (status != null) r'status': status,
if (limit != null) r'limit': limit,
if (offset != null) r'offset': offset,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
List<PendingInstrumentOut>? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<List<PendingInstrumentOut>, PendingInstrumentOut>(rawData, 'List<PendingInstrumentOut>', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<List<PendingInstrumentOut>>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Pending Resolve
/// Link, create or ignore — then bind the events that were waiting and rebuild the lots.
///
/// Parameters:
/// * [pendingId]
/// * [pendingResolveRequest]
/// * [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 [PendingResolveResult] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<PendingResolveResult>> instrumentsPendingResolve({
required int pendingId,
required PendingResolveRequest pendingResolveRequest,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/instruments/pending/{pending_id}/resolve'.replaceAll('{' r'pending_id' '}', pendingId.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
contentType: 'application/json',
validateStatus: validateStatus,
);
dynamic _bodyData;
try {
_bodyData = jsonEncode(pendingResolveRequest);
} catch(error, stackTrace) {
throw DioException(
requestOptions: _options.compose(
_dio.options,
_path,
),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
PendingResolveResult? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<PendingResolveResult, PendingResolveResult>(rawData, 'PendingResolveResult', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<PendingResolveResult>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Set Manual Price
/// Set (or replace) the manual price of &#x60;instrument_id&#x60; on &#x60;body.d&#x60;. For what no exchange quotes: real estate, crypto, a custom holding, an OTC bond nobody lists. One row per (instrument, day) — a second call for the same day replaces it rather than piling up duplicates the price series would then have to pick between. Does not itself refresh &#x60;metric_*&#x60;; call &#x60;POST /metrics/refresh&#x60; after, same as &#x60;/rules/apply&#x60;.
///
/// Parameters:
/// * [instrumentId]
/// * [priceManualIn]
/// * [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 [PriceManualOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<PriceManualOut>> instrumentsSetManualPrice({
required int instrumentId,
required PriceManualIn priceManualIn,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/instruments/{instrument_id}/prices'.replaceAll('{' r'instrument_id' '}', instrumentId.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
contentType: 'application/json',
validateStatus: validateStatus,
);
dynamic _bodyData;
try {
_bodyData = jsonEncode(priceManualIn);
} catch(error, stackTrace) {
throw DioException(
requestOptions: _options.compose(
_dio.options,
_path,
),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
PriceManualOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<PriceManualOut, PriceManualOut>(rawData, 'PriceManualOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<PriceManualOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
}
@@ -0,0 +1,249 @@
//
// 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/link_create.dart';
import 'package:fintracker_api/src/model/link_out.dart';
import 'package:fintracker_api/src/model/problem.dart';
import 'package:fintracker_api/src/model/unmatched_out.dart';
class LinksApi {
final Dio _dio;
const LinksApi(this._dio);
/// Create
/// Confirm a pairing the matcher missed. Never touched by the automatic rebuild afterwards.
///
/// Parameters:
/// * [linkCreate]
/// * [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 [LinkOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<LinkOut>> linksCreate({
required LinkCreate linkCreate,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/links';
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
contentType: 'application/json',
validateStatus: validateStatus,
);
dynamic _bodyData;
try {
_bodyData = jsonEncode(linkCreate);
} catch(error, stackTrace) {
throw DioException(
requestOptions: _options.compose(
_dio.options,
_path,
),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
LinkOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<LinkOut, LinkOut>(rawData, 'LinkOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<LinkOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Delete
/// Undo a link, manual or automatic. &#x60;flow_type&#x60; reverts on the next &#x60;POST /metrics/refresh&#x60;, when &#x60;classify&#x60; rebuilds it from the rules and &#x60;matching&#x60; no longer overwrites it.
///
/// Parameters:
/// * [linkId]
/// * [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<Response<void>> linksDelete({
required int linkId,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/links/{link_id}'.replaceAll('{' r'link_id' '}', linkId.toString());
final _options = Options(
method: r'DELETE',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _response = await _dio.request<Object>(
_path,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
return _response;
}
/// Unmatched
/// Every candidate that survives matching without a link, on either side.
///
/// 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 [UnmatchedOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<UnmatchedOut>> linksUnmatched({
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/links/unmatched';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _response = await _dio.request<Object>(
_path,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
UnmatchedOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<UnmatchedOut, UnmatchedOut>(rawData, 'UnmatchedOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<UnmatchedOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
}
@@ -0,0 +1,296 @@
//
// 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_available.dart';
import 'package:fintracker_api/src/model/problem.dart';
import 'package:fintracker_api/src/model/rebalance_out.dart';
import 'package:fintracker_api/src/model/targets_in.dart';
import 'package:fintracker_api/src/model/targets_out.dart';
class RebalanceApi {
final Dio _dio;
const RebalanceApi(this._dio);
/// Rebalance
///
///
/// Parameters:
/// * [portfolioId]
/// * [dimension] - asset_class | sector | country | currency
/// * [cashAvailable] - переопределяет остаток на счетах для what-if
/// * [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 [RebalanceOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<RebalanceOut>> rebalanceRebalance({
required int portfolioId,
String? dimension = 'asset_class',
CashAvailable? cashAvailable,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/portfolios/{portfolio_id}/rebalance'.replaceAll('{' r'portfolio_id' '}', portfolioId.toString());
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (dimension != null) r'dimension': dimension,
if (cashAvailable != null) r'cash_available': cashAvailable,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
RebalanceOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<RebalanceOut, RebalanceOut>(rawData, 'RebalanceOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<RebalanceOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Set Targets
/// Replace the whole set for one dimension. The weights must add up to 1 within &#x60;WEIGHT_TOLERANCE&#x60;; otherwise the request is refused with the actual sum in the message, so the user can see by how much the plan misses rather than being handed a silently rescaled one.
///
/// Parameters:
/// * [portfolioId]
/// * [targetsIn]
/// * [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 [TargetsOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<TargetsOut>> rebalanceSetTargets({
required int portfolioId,
required TargetsIn targetsIn,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/portfolios/{portfolio_id}/targets'.replaceAll('{' r'portfolio_id' '}', portfolioId.toString());
final _options = Options(
method: r'PUT',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
contentType: 'application/json',
validateStatus: validateStatus,
);
dynamic _bodyData;
try {
_bodyData = jsonEncode(targetsIn);
} catch(error, stackTrace) {
throw DioException(
requestOptions: _options.compose(
_dio.options,
_path,
),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
TargetsOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<TargetsOut, TargetsOut>(rawData, 'TargetsOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<TargetsOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Targets
///
///
/// Parameters:
/// * [portfolioId]
/// * [dimension] - asset_class | sector | country | currency
/// * [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 [TargetsOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<TargetsOut>> rebalanceTargets({
required int portfolioId,
String? dimension = 'asset_class',
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/portfolios/{portfolio_id}/targets'.replaceAll('{' r'portfolio_id' '}', portfolioId.toString());
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (dimension != null) r'dimension': dimension,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
TargetsOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<TargetsOut, TargetsOut>(rawData, 'TargetsOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<TargetsOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
}
@@ -0,0 +1,194 @@
//
// 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/tax_lots_out.dart';
import 'package:fintracker_api/src/model/tax_year_out.dart';
class TaxApi {
final Dio _dio;
const TaxApi(this._dio);
/// Lots
/// Open lots with the date after which a sale falls under the long-term exemption. &#x60;year&#x60; selects the rate the \&quot;what if I sold today\&quot; figure is computed at; the lots themselves are always the ones open right now. &#x60;lot&#x60; is rebuilt from the ledger on every refresh and holds today&#39;s state only, so there is no honest way to answer \&quot;which lots were open on 31 December two years ago\&quot; — and inventing one would be worse than the limitation.
///
/// Parameters:
/// * [year]
/// * [accountId]
/// * [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 [TaxLotsOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<TaxLotsOut>> taxLots({
int? year,
int? accountId,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/tax/lots';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (year != null) r'year': year,
if (accountId != null) r'account_id': accountId,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
TaxLotsOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<TaxLotsOut, TaxLotsOut>(rawData, 'TaxLotsOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<TaxLotsOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Summary
/// The year&#39;s estimated tax position, per account and in total.
///
/// Parameters:
/// * [year]
/// * [accountId]
/// * [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 [TaxYearOut] as data
/// Throws [DioException] if API call or serialization fails
Future<Response<TaxYearOut>> taxSummary({
int? year,
int? accountId,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/api/v1/tax';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'HTTPBearer',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (year != null) r'year': year,
if (accountId != null) r'account_id': accountId,
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
TaxYearOut? _responseData;
try {
final rawData = _response.data;
_responseData = rawData == null ? null : deserialize<TaxYearOut, TaxYearOut>(rawData, 'TaxYearOut', growable: true);
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<TaxYearOut>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
}