// // 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's TWR beside each benchmark's, on the same grid of days. `days_skipped` 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: | portfolio: /// * [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> benchmarksBenchmarks({ String? scope = 'all', List? period, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/api/v1/analytics/benchmarks'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'http', 'scheme': 'bearer', 'name': 'HTTPBearer', }, ], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { if (scope != null) r'scope': scope, if (period != null) r'period': period, }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); BenchmarkComparison? _responseData; try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'BenchmarkComparison', 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: /// * [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> benchmarksCreate({ required BenchmarkCreate benchmarkCreate, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/api/v1/benchmarks'; 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(benchmarkCreate); } 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, ); BenchmarkOut? _responseData; try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'BenchmarkOut', 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: /// * [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> benchmarksDelete({ required int benchmarkId, CancelToken? cancelToken, Map? headers, Map? 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: { ...?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 /// 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] as data /// Throws [DioException] if API call or serialization fails Future>> benchmarksList({ CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/api/v1/benchmarks'; 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, BenchmarkOut>(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: /// * [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> benchmarksPatch({ required int benchmarkId, required BenchmarkPatch benchmarkPatch, CancelToken? cancelToken, Map? headers, Map? 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: { ...?headers, }, extra: { 'secure': >[ { '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( _path, data: _bodyData, options: _options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); BenchmarkOut? _responseData; try { final rawData = _response.data; _responseData = rawData == null ? null : deserialize(rawData, 'BenchmarkOut', 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, ); } }